WO2025138232A1 - 编解码方法、码流、编码器、解码器以及存储介质 - Google Patents

编解码方法、码流、编码器、解码器以及存储介质 Download PDF

Info

Publication number
WO2025138232A1
WO2025138232A1 PCT/CN2023/143587 CN2023143587W WO2025138232A1 WO 2025138232 A1 WO2025138232 A1 WO 2025138232A1 CN 2023143587 W CN2023143587 W CN 2023143587W WO 2025138232 A1 WO2025138232 A1 WO 2025138232A1
Authority
WO
WIPO (PCT)
Prior art keywords
color component
current block
candidate
value
prediction parameter
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
PCT/CN2023/143587
Other languages
English (en)
French (fr)
Inventor
霍俊彦
马彦卓
杨付正
郝雪
李明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to PCT/CN2023/143587 priority Critical patent/WO2025138232A1/zh
Publication of WO2025138232A1 publication Critical patent/WO2025138232A1/zh
Anticipated expiration legal-status Critical
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/117Filters, e.g. for pre-processing or post-processing

Definitions

  • the present application relates to the field of video coding and decoding technology, and in particular to a coding and decoding method, a bit stream, an encoder, a decoder and a storage medium.
  • the obtained chrominance mode is the DC mode.
  • the intra-frame prediction mode of the chrominance mode cannot be properly determined, resulting in inaccurate chrominance prediction of the current block and loss of coding efficiency.
  • the present application provides a coding and decoding method, a bit stream, an encoder, a decoder and a storage medium, which can not only improve the uniformity of chrominance prediction, but also improve the accuracy of chrominance prediction, save bit rate, and thus improve coding and decoding efficiency.
  • an embodiment of the present application provides a decoding method, which is applied to a decoder, and the method includes:
  • first reference prediction parameter set for the current block according to the prediction parameter; wherein the first reference prediction parameter set includes one or more first candidate reference prediction parameters;
  • a predicted value of the second color component of the current block is determined.
  • an embodiment of the present application provides an encoding method, which is applied to an encoder, and the method includes:
  • the second determination unit is configured to determine a prediction parameter of the current block; and determine a first reference prediction parameter set of the current block according to the prediction parameter; wherein the first reference prediction parameter set includes one or more first candidate reference prediction parameters;
  • an embodiment of the present application provides a decoder, including a second memory and a second processor, wherein:
  • an embodiment of the present application provides a computer-readable storage medium, which stores a computer program.
  • the computer program When executed by at least one processor, it implements the method described in the first aspect or the method described in the second aspect.
  • the embodiment of the present application provides a coding and decoding method, a code stream, an encoder, a decoder and a storage medium, whether it is an encoding end or a decoding end, determining the prediction parameters of the current block; determining the first reference prediction parameter set of the current block according to the prediction parameters; wherein the first reference prediction parameter set includes one or more first candidate reference prediction parameters; determining the first color component reference sample value and the second color component reference sample value of the current block according to the first reference prediction parameter set; determining the mapping relationship between the first color component and the second color component according to the first color component reference sample value and the second color component reference sample value; determining the prediction value of the second color component of the current block according to the mapping relationship and the first color component sample value of the current block.
  • the first reference prediction parameter set for the chroma component can be determined, and the luminance component reference sample value and the chroma component reference sample value of the current block can be determined according to the first reference prediction parameter set, so as to establish a mapping relationship between the luminance component and the chroma component, and then the chroma component is predicted using the mapping relationship.
  • FIG2 is a schematic diagram of the position distribution of adjacent blocks provided in an embodiment of the present application.
  • FIG3 is a schematic diagram of a positional relationship between a luminance block and a chrominance block provided in an embodiment of the present application
  • FIG4A is a schematic block diagram of a composition of an encoder provided in an embodiment of the present application.
  • FIG4B is a schematic block diagram of a decoder provided in an embodiment of the present application.
  • FIG5 is a schematic diagram of a network architecture of a coding and decoding system provided in an embodiment of the present application.
  • FIG6 is a flowchart diagram 1 of a decoding method provided in an embodiment of the present application.
  • FIG7 is a second flow chart of a decoding method provided in an embodiment of the present application.
  • FIG8 is a third flowchart of a decoding method provided in an embodiment of the present application.
  • FIG10 is a third schematic diagram of the position relationship between a luminance block and a chrominance block provided in an embodiment of the present application.
  • FIG11 is a fourth schematic diagram of the positional relationship between a luminance block and a chrominance block provided in an embodiment of the present application.
  • FIG12 is a schematic diagram of a structure of whether an offset position does not cover a current block provided by an embodiment of the present application.
  • FIG13 is a schematic diagram of a structure of whether an offset position exceeds a preset available area provided in an embodiment of the present application.
  • FIG14 is a schematic diagram of a type of template provided in an embodiment of the present application.
  • FIG15 is a schematic diagram of motion compensation of a template provided in an embodiment of the present application.
  • FIG16 is a schematic diagram of the positions of a co-located brightness area and a reference brightness area provided in an embodiment of the present application;
  • FIG17A is a first schematic diagram of downsampling provided in an embodiment of the present application.
  • FIG17B is a second schematic diagram of downsampling provided in an embodiment of the present application.
  • FIG17C is a third down-sampling schematic diagram provided in an embodiment of the present application.
  • FIG17D is a fourth schematic diagram of downsampling provided in an embodiment of the present application.
  • FIG17E is a fifth down-sampling schematic diagram provided in an embodiment of the present application.
  • FIG17F is a sixth schematic diagram of downsampling provided in an embodiment of the present application.
  • FIG18 is a fourth flowchart of a decoding method provided in an embodiment of the present application.
  • FIG19 is a flowchart diagram 5 of a decoding method provided in an embodiment of the present application.
  • numCurrCand is set equal to the number of candidates in bvCandList; otherwise numCurrCand is set to 0.
  • Step 5 When numCurrCand is less than MaxNumIbcMergeCand, the following applies until numCurrCand equals MaxNumIbcMergeCand:
  • bvCandList[numCurrCand][0] is set equal to 0 (the horizontal component of BV);
  • the specific bvL can be obtained according to the index bvIdx and the block vector candidate list bvCandList:
  • Step 2 Rounding operation is performed on the above-obtained prediction bvL.
  • the right shift parameter AmvrShift is used for rounding
  • the left shift parameter AmvrShift is used to improve the resolution. The details are as follows:
  • bvL[1] Sign(bvL[1])*(((Abs(bvL[1])+offset)>>AmvrShift) ⁇ AmvrShift).
  • Step 3 For the real bvL, its range needs to be controlled between -2 17 and 2 17 –1.
  • the specific derivation process is as follows:
  • u[1] (bvL[1]+bvd[1]+2 18 )% 2 18 ;
  • the chroma component For the chroma component, if it is a dual-tree partition, the chroma component does not perform IBC; if it is a single-tree partition, the BV of the chroma component needs to be derived.
  • the input includes: brightness bvL (1/16 pixel accuracy).
  • the output includes: chrominance block vector (Block Vector Chroma, bvC) (1/32 pixel accuracy).
  • chrominance block vector Block Vector Chroma, bvC
  • bvC[1] ((bvL[1]>>(3+SubHeightC))*32).
  • S102 Use the block vector to derive a prediction sample.
  • the input includes: the luma position (xCb, yCb), which specifies the upper left corner sample of the current block relative to the upper left corner luma sample of the current image; a variable cbWidth, which specifies the width of the current block in luma samples; a variable cbHeight, which specifies the height of the current block in luma samples; a block vector BV; a variable cIdx, which specifies the color component index of the current block.
  • the output includes: an array of predicted samples predSamples.
  • xVb (x+(bv[0]>>4))&(IbcBufWidthY-1);
  • IntraMipFlag[xCb+cbWidth/2][yCb+cbHeight/2] is equal to 1
  • lumaIntraPredMode is set equal to INTRA_PLANAR.
  • the intra-frame prediction mode of the chrominance block is determined according to the intra-frame prediction mode of the luminance block at the center of the luminance region at the same position as the chrominance block.
  • the determination method can be to directly use the intra-frame prediction mode of the luminance block or to further derive the intra-frame prediction mode.
  • xCenter xCb + cbWidth >> 1;
  • bypass indicates the bypass mode, and na indicates no processing.
  • an embodiment of the present application provides a coding and decoding method to determine prediction parameters of a current block; determine a first reference prediction parameter set of the current block based on the prediction parameters; wherein the first reference prediction parameter set includes one or more first candidate reference prediction parameters; determine a first color component reference sample value and a second color component reference sample value of the current block based on the first reference prediction parameter set; determine a mapping relationship between the first color component and the second color component based on the first color component reference sample value and the second color component reference sample value; determine a prediction value of the second color component of the current block based on the mapping relationship and the first color component sample value of the current block.
  • the first reference prediction parameter set for the chrominance component can be determined, and based on the first reference prediction parameter set, the reference sample value of the luminance component and the reference sample value of the chrominance component of the current block can be determined, so as to establish a mapping relationship between the luminance component and the chrominance component, and then use the mapping relationship to predict the chrominance component.
  • the correlation between the reconstructed samples in the current image and the samples of the current block is fully utilized here, the singleness of the chrominance prediction is improved, and thus the accuracy of the chrominance prediction can be improved; and based on the established mapping relationship, pixel-level prediction can also be effectively performed, so as to further save bit rate, improve encoding and decoding efficiency, and thus improve encoding and decoding performance.
  • the encoder 100 may include a transform and quantization unit 101, an intra-frame estimation unit 102, an intra-frame prediction unit 103, a motion compensation unit 104, a motion estimation unit 105, an inverse transform and inverse quantization unit 106, a filter control analysis unit 107, a filtering unit 108, an encoding unit 109, and a decoded image cache unit 110, etc.
  • the filtering unit 108 may implement deblocking filtering and sample adaptive offset (Sample Adaptive Offset, SAO) filtering
  • the encoding unit 109 may 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 unit (CTU), and then the residual pixel information obtained after intra-frame or inter-frame prediction is transformed by the transformation and quantization unit 101 to transform the video coding block, including transforming the residual information from the pixel domain to the transform domain, and quantizing the obtained transform coefficients to further reduce the bit rate;
  • the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to perform intra-frame prediction on the video coding block; specifically, the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to determine the intra-frame prediction mode to be used to encode the video coding block;
  • the motion compensation unit 104 and the motion estimation unit 105 are used to perform inter-frame prediction coding of the received video coding block relative to one or more blocks in one or more reference frames to provide temporal prediction information;
  • the motion estimation performed by the motion estimation unit 105 is a process of generating a motion vector, and the motion vector can estimate the motion of the video coding block, and then
  • the motion vector determined by the motion estimation unit 105 performs motion compensation; after determining the intra-frame prediction mode, the intra-frame prediction unit 103 is also used to provide the selected intra-frame 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 transform and inverse quantization unit 106 is used to reconstruct the video coding block, reconstruct the residual block in the pixel domain, and the reconstructed residual block is removed by the filter control analysis unit 107 and the filtering unit 108.
  • a bit stream of the video signal is output; the bit stream is input into the decoder 200, and first passes through the decoding unit 201 to obtain the decoded transform coefficient; the transform coefficient is processed by the inverse transform and inverse quantization unit 202 to generate a residual block in the pixel domain; the intra-frame prediction unit 203 can be used to generate prediction data of the current video decoding block based on the determined intra-frame prediction mode and the data of the previously decoded block from the current frame or picture; the motion compensation unit 204 determines the prediction information for the video decoding block by analyzing the motion vector and other associated syntax elements, and The prediction information is used to generate a predictive block of 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 generated by the intra-frame prediction unit 203 or the motion compensation unit 204; the decoded video signal passes through the filtering unit 205 to remove
  • the embodiment of the present application also provides a network architecture of a codec system including an encoder and a decoder, wherein FIG5 shows a schematic diagram of a network architecture of a codec system provided by an embodiment of the present application.
  • the network architecture includes one or more electronic devices 13 to 1N and a communication network 01, wherein the electronic devices 13 to 1N can perform video interaction through the communication network 01.
  • the electronic device can be various types of devices with video codec functions, for example, the electronic device can include a smart phone, a tablet computer, a personal computer, a personal digital assistant, a navigator, a digital phone, a video phone, a television, a sensor device, a server, etc., without any limitation here.
  • the encoding and decoding method of the embodiment of the present application is mainly applied to the intra-frame prediction unit 103 part shown in Figure 4A and the intra-frame prediction unit 203 part shown in Figure 4B.
  • the embodiment of the present application can be applied to both the encoder and the decoder, and can even be applied to both the encoder and the decoder at the same time, but the embodiment of the present application does not make any limitation.
  • the "current block” specifically refers to the coding block currently to be intra-frame predicted; when applied to the intra-frame prediction unit 203, the "current block” specifically refers to the decoding block currently to be intra-frame predicted.
  • FIG6 is a flowchart of a decoding method provided by an embodiment of the present application. As shown in FIG6, the method may include:
  • the decoding method of the embodiment of the present application is applied to a decoder.
  • the decoding method may specifically refer to an intra-frame prediction method, more specifically, a chrominance prediction method based on a block vector.
  • the video image can be divided into a plurality of decoding blocks, each decoding block may include a first color component, a second color component and a third color component, and the current block in the embodiment of the present application refers to a decoding block in the video image that is currently to be subjected to chrominance prediction.
  • the current block predicts a first color component, and the first color component is a brightness component
  • the current block may also be referred to as a brightness block
  • the current block may also be referred to as a chrominance block.
  • the prediction parameter can be used to indicate whether the current block uses the first prediction mode.
  • the method may include: decoding a bitstream, and determining the prediction parameter of the current block.
  • the value of the prediction parameter is the first value, it is determined that the current block uses the first prediction mode; if the value of the prediction parameter is the second value, it is determined that the current block does not use the first prediction mode.
  • the method may further include: decoding the bitstream to determine the value of the first syntax element; and determining the prediction parameters of the current block according to the value of the first syntax element.
  • the first syntax element can be represented by intra_bvglut_flag, or can also be represented by bvglut_flag.
  • the first syntax element can be used to indicate whether the current block uses the first prediction mode.
  • the value of the first syntax element is the first value, it is determined that the current block uses the first prediction mode; if the value of the first syntax element is the second value, it is determined that the current block does not use the first prediction mode.
  • determining the prediction parameter of the current block according to the value of the first syntax element may include: setting the value of the prediction parameter to be equal to the value of the first syntax element.
  • the first value is different from the second value.
  • the first value can be set to 1 and the second value can be set to 0; or the first value can be set to 0 and the second value can be set to 1; or the first value can be set to true and the second value can be set to false; or the first value can be set to false and the second value can be set to true.
  • the first value is set to 1, and the second value is set to 0.
  • the value of the first syntax element is 1, it indicates that the prediction parameter indicates that the current block uses the first prediction mode, and the decoding method of the embodiment of the present application continues to be performed; otherwise, if the value of the first syntax element is 0, it indicates that the prediction parameter indicates that the current block does not use the first prediction mode, and other prediction modes in the related art (such as PLANAR mode, CCLM mode, angle prediction mode, etc.) can be used for decoding processing.
  • the first reference prediction parameter set of the current block is determined.
  • the first prediction mode may be the BVG-LUT mode. That is, for the current block, if If the previous block uses the BVG-LUT mode, the first reference prediction parameter set of the current block can be determined.
  • determining a first reference prediction parameter set for a current block may include:
  • S702 Determine a second reference prediction parameter set for the current block according to the first color component block.
  • S703 Determine a first reference prediction parameter set for the current block according to the second reference prediction parameter set.
  • the first reference prediction parameter set may include one or more first candidate reference prediction parameters, wherein the first candidate reference prediction parameter may be a vector parameter based on the second color component.
  • the second reference prediction parameter set may include one or more second candidate reference prediction parameters, wherein the second candidate reference prediction parameters may be vector parameters based on the first color component.
  • the first color component may be a luminance component
  • the second color component may be a chrominance component
  • the first candidate reference prediction parameter may be a vector parameter based on the chrominance component
  • the second candidate reference prediction parameter may be a vector parameter based on the luminance component
  • the vector parameter includes one of the following: a block vector parameter, a motion vector parameter. That is, whether it is the first reference prediction parameter set or the second reference prediction parameter set, it can be a parameter list applied to a BV, or it can also be a parameter list applied to a MV.
  • the "first reference prediction parameter” here can be a block vector parameter based on the chrominance component, then the first reference prediction parameter set can be called the chrominance BVC candidate list; the "second reference prediction parameter” here can be a block vector parameter based on the luminance component, then the second reference prediction parameter set can be called the luminance BVL candidate list.
  • determining the first color component block of the current block may include:
  • S802 Determine a first candidate block at a first position based on a plurality of divided blocks in a first color component area.
  • S803 Perform a position offset search in a preset search area at the first position to determine a plurality of second candidate blocks.
  • S804 Determine a first color component block of the current block according to the first candidate block and/or multiple second candidate blocks.
  • the first color component area at the same position of the current block is first determined; then, based on the multiple divided blocks of the first color component area, the first color component block of the current block is determined.
  • the first color component region may also be referred to as a "co-located brightness region".
  • the co-located brightness region may refer to the co-located brightness region corresponding to the current block.
  • the first color component region at the co-located position may be divided into blocks, for example, using a binary tree structure, a ternary tree structure, a quadtree structure, etc. to divide the blocks, and multiple blocks may be obtained, each of which may be regarded as a CU, a sub-block, or a transform block, etc.; then the first color component block of the current block is determined from the multiple divided blocks.
  • the area filled with oblique lines represents the co-located brightness area corresponding to the chrominance component.
  • the co-located brightness area multiple blocks can be divided; the block at the center position can be selected from these blocks as the corresponding brightness block of the current block.
  • the block filled with black in FIG3 is the corresponding brightness block of the current block (the first color component block).
  • the first position may refer to any position of the first color component area.
  • the first position may be the center position, the upper left corner position, the lower right corner position, a specific position, etc. in the first color component area.
  • determining the first color component block of the current block may include: determining position information of the current block; scaling the position information of the current block according to a preset sampling format to obtain co-located area position information corresponding to the current block; determining target position information based on the co-located area position information, and using the candidate block containing the target position information as the first color component block of the current block.
  • determining the target location information according to the co-located area location information may include: determining the target location information according to the co-located area location information The center position of the row is calculated, and the obtained center position information is used as the target position information; or, the upper left corner position is calculated based on the position information of the same area, and the obtained upper left position information is used as the target position information; or, the lower right corner position is calculated based on the position information of the same area, and the obtained lower left position information is used as the target position information.
  • the preset sampling format may be a chroma sampling format (or referred to as a color sampling format).
  • a chroma sampling format or referred to as a color sampling format.
  • the block at the center position (the block at the center position of the luminance area) is the luminance block containing the center coordinates (xCb+cbWidth>1, yCb+cbHeight>>1), that is, the block filled with black in FIG3.
  • the small white block indicates the position of the center coordinates, which can be used to locate the position of the luminance block.
  • the position of the co-located luminance pixel corresponding to the upper left corner of the current block relative to the luminance pixel in the upper left corner of the image is (xCb, yCb)
  • the width of the co-located luminance area corresponding to the current block i.e., the entire oblique line filled area of the luminance component in FIG9) is cbWidth, and the height is cbHeight
  • the block at the upper left corner is the luminance block containing the upper left corner coordinates (xCb, yCb), that is, the block filled with black in FIG9.
  • the small white block indicates the position of the upper left corner coordinates, which can be used to locate the position of the luminance block.
  • the luminance block used in the luminance region is the luminance block containing the position coordinates (xCb + xOffset, yCb + yOffset).
  • the luminance block used in the luminance region is the luminance block containing the position coordinates (xCb + cbWidth-1 + xOffset, yCb + cbHeight-1 + yOffset).
  • the first candidate block as the first color component block can be a block at any position among the multiple blocks shown in FIG3.
  • a block at the center position in the co-located brightness area as shown in FIG3 (a block filled with black)
  • a block at the upper left corner position in the co-located brightness area as shown in FIG9 a block filled with black
  • a block at the lower right corner position in the co-located brightness area as shown in FIG10 (a block filled with black)
  • a block at the upper right corner position a block at the lower left corner position in the co-located brightness area, or even a block at the center position of the upper left area, etc., without any limitation here.
  • the first candidate block on the basis of the first candidate block, multiple positions can be searched to the upper left, upper, and left, etc., to obtain multiple second candidate blocks. Then, based on the first candidate block and/or multiple second candidate blocks, the first color component block of the current block can be determined.
  • the method may further include: determining at least one candidate block at a preset position from a plurality of divided blocks of the first color component area; and determining a first color component block of the current block based on the at least one candidate block.
  • the at least one candidate block may be used as the first color component block of the current block. That is, for the first color component block, it may be at least one candidate block obtained in sequence.
  • the first color component block there are five brightness pixel positions.
  • CU specifically: C, TL, TR, BL and BR.
  • the embodiment of the present application is not limited to five positions, and can be multiple different positions; and is not limited to the five positions shown in FIG. 11, and no limitation is made to this.
  • the positions may be acquired sequentially in a preset order, and the preset order includes but is not limited to the following order: C->TL->TR->BL->BR.
  • the position of the co-located luminance pixel corresponding to the upper left corner of the current block relative to the luminance pixel in the upper left corner of the image i.e., the position of the luminance pixel TL
  • the width of the co-located luminance area corresponding to the current chrominance coding block i.e., the entire diagonal filled area of the luminance component in Figure 11
  • the height is cbHeight.
  • the coordinates of the position of the brightness pixel C are (xCb+cbWidth/2, yCb+cbHeight/2);
  • the coordinates of the position of the luminance pixel TL are (xCb, yCb);
  • the coordinates of the position of the brightness pixel TR are (xCb+cbWidth-1, yCb);
  • the coordinates of the position of the brightness pixel BL are (xCb, yCb+cbHeight-1);
  • the coordinates of the position of the brightness pixel BR are (xCb+cbWidth-1, yCb+cbHeight-1).
  • the brightness block used in the brightness area is the brightness block containing the coordinates of the position plus the position coordinates of the above-mentioned offset position.
  • the corresponding first color component block needs to be determined first.
  • the first color component is a brightness component
  • the corresponding brightness block of the current block needs to be determined.
  • the above-mentioned several possible implementations can be used to determine one or more corresponding brightness blocks.
  • a second reference prediction parameter set for the current block can be constructed.
  • the method may include: determining one or more candidate vector parameters based on the first color component according to the first color component block; determining a second reference prediction parameter set for the current block according to the one or more candidate vector parameters based on the first color component.
  • determining the second reference prediction parameter set of the current block based on one or more candidate vector parameters based on the first color component may include: adjusting the candidate vector parameters based on the first color component to determine the candidate vector parameters based on the second color component; when the candidate vector parameters based on the second color component meet a preset availability condition, using the candidate vector parameters based on the first color component as the second candidate reference prediction parameters and adding them to the second reference prediction parameter set.
  • the candidate vector parameter based on the first color component can be the BV of the luminance block, that is, BVL; the candidate vector parameter based on the second color component can be the BV of the chroma block, that is, BVC.
  • adjusting the candidate vector parameters based on the first color component to determine the candidate vector parameters based on the second color component may include: determining a preset sampling format for the current block; scaling the candidate vector parameters based on the first color component according to the preset sampling format to determine the candidate vector parameters based on the second color component.
  • the above adjustment may include scaling according to a preset sampling format, wherein the preset sampling format may be a mapping relationship between the brightness BV and the scaled chrominance BV shown in Table 8.
  • the preset format may refer to a color sampling format, such as monochrome, 4:2:0, 4:2:2, 4:4:4, etc.
  • the syntax element sps_chroma_format_idc is used to indicate the type of the color sampling format, and the color sampling format here is specifically a chroma sampling format.
  • the type of the color sampling format is different, and the corresponding scaling operation is also different.
  • the candidate BVL can be scaled according to the color sampling format to obtain a scaled BVC; and then it is determined whether the scaled BVC meets the preset usability conditions.
  • the scaled BVC meets the preset usability conditions, including but not limited to:
  • the offset position indicated by the scaled BVC does not exceed the preset available area
  • one or more candidate vector parameters based on the first color component are scaled according to the first color component block. If a candidate BVL is scaled based on the color sampling format shown in Table 8, and the scaled BVC meets the preset availability condition, then this candidate BVL can be used as a second candidate reference prediction parameter and added to the second reference prediction parameter set to construct a second reference prediction parameter set.
  • the second reference prediction parameter set can include one or more second candidate reference prediction parameters.
  • the first reference prediction parameter set of the current block can be further determined.
  • the method may include: adjusting one or more second candidate reference prediction parameters in the second reference prediction parameter set to determine the first candidate reference prediction parameters corresponding to the one or more second candidate reference prediction parameters; and determining the first reference prediction parameter set of the current block according to the first candidate reference prediction parameters corresponding to the one or more second candidate reference prediction parameters.
  • the number of the first candidate reference prediction parameters is the same as that of the second candidate reference prediction parameters. That is to say, for each second candidate reference prediction parameter, it can be adjusted to obtain one or more first candidate reference prediction parameters, and then an available first candidate reference prediction parameter is determined therefrom.
  • the number of the first candidate reference prediction parameters and the second candidate reference prediction parameters may also be different, and at this time, each second candidate reference prediction parameter may determine more than one available first candidate reference prediction parameter, and no limitation is made here.
  • one or more second candidate reference prediction parameters in the second reference prediction parameter set are adjusted to determine the first candidate reference prediction parameters corresponding to each of the one or more second candidate reference prediction parameters.
  • the method may include: adjusting the second candidate reference prediction parameters to determine a third reference prediction parameter set based on the second color component; and determining, based on the third reference prediction parameter set, the first candidate reference prediction parameter corresponding to the second candidate reference prediction parameter.
  • this method can be used to determine the corresponding first candidate reference prediction parameter to obtain a first reference prediction parameter set.
  • the first candidate reference prediction parameter may be a candidate BV of the chroma block, namely, a candidate BVC;
  • the second candidate reference prediction parameter may be a candidate BV of the luminance block, namely, a candidate BVL.
  • the second candidate reference prediction parameter may be adjusted to determine one or more candidate vector parameters based on the second color component, namely, one or more candidate BVCs, which may construct a third reference prediction parameter set.
  • adjusting the second candidate reference prediction parameter to determine a third reference prediction parameter set based on the second color component may include: scaling the second candidate reference prediction parameter according to a preset sampling format of the current block, determining a candidate vector parameter based on the second color component, and adding the candidate vector parameter based on the second color component to the third reference prediction parameter set.
  • the above-mentioned one or more offset values can be any number of arbitrary numerical values, such as -1, +1, -2, +2, -3, +3, etc., without any limitation here.
  • the chrominance BVC candidate items containing one or more candidates can be constructed by adjusting BVL or BVC.
  • the construction method of the candidate items includes but is not limited to the following situations:
  • BVL can be adjusted to form four situations, thereby achieving adjustment of BVC.
  • BVL (BVLhor, BVLver).
  • BVC[0] BVL[0]*2/SubWidthC
  • BVC[1] BVL[1]*2/SubHeightC
  • SubWidthC and SubHeightC can be determined according to the mapping relationship between sps_chroma_format_idc and the color sampling format in Table 1.
  • BVL can be adjusted to form multiple situations, thereby realizing the adjustment of BVC.
  • BVL (BVLhor, BVLver)
  • BVL (BVLhor+1, BVLver)
  • BVL (BVLhor, BVLver+1)
  • BVL (BVLhor+1, BVLver+1)
  • BVL (BVLhor+3, BVLver)
  • BVL (BVLhor, BVLver+3)
  • BVL (BVLhor+3, BVLver+3)
  • BVL (BVLhor-2, BVLver)
  • BVL (BVLhor, BVLver-2) and other situations, and construct a list for these candidates in order.
  • the candidate vector parameter only when the candidate vector parameter meets the preset availability condition, it is possible to determine the candidate vector parameter as the first candidate reference prediction parameter.
  • one or more candidate vector parameters meet preset availability conditions, including but not limited to:
  • the offset position indicated by the one or more candidate vector parameters does not exceed the slice boundary
  • the offset position indicated by one or more candidate vector parameters does not cover the current block
  • the offset position indicated by one or more candidate vector parameters does not exceed a preset available area
  • the offset position indicated by one or more candidate vector parameters has been reconstructed.
  • the preset availability condition here may also consider whether it exceeds the slice boundary. For example, the offset position indicated by one or more candidate vector parameters does not exceed the slice boundary, or the offset position indicated by one or more candidate vector parameters does not exceed the tile boundary.
  • the candidate vector parameters meet the preset usable conditions, that is, the candidate vector parameters are usable.
  • the candidate vector parameters meet the preset usable conditions, which at least include: the offset position indicated by the candidate vector parameter does not exceed the image boundary; and the offset position indicated by the candidate vector parameter does not exceed the slice boundary; and the offset position indicated by the candidate vector parameter does not cover the current block; and the offset position indicated by the candidate vector parameter does not exceed the preset usable area; and the offset position indicated by the candidate vector parameter has been reconstructed.
  • FIG12 shows a schematic diagram of a structure of whether an offset position provided by an embodiment of the present application does not cover the current block.
  • a block filled with black represents the current block
  • an area filled with oblique lines represents an available area
  • an unfilled area represents an unavailable area.
  • the offset position indicated by the candidate block vector parameter is in an unavailable area, then the offset position covers the current block.
  • FIG13 shows a schematic diagram of a structure of whether an offset position provided by an embodiment of the present application exceeds a preset available area.
  • a block filled with black represents a current block
  • an area filled with oblique lines represents an available area
  • the reference blocks in the available area have been reconstructed.
  • the reference blocks adjacent to the current block (m, n) specifically: reference block (m-2, n-2), reference block (m-1, n-2), reference block (m, n-2), reference block (m+1, n-2), reference block (m-2, n-1), reference block (m-1, n-1), reference block (m, n-1), reference block (m+1, n-1), reference block (m-2, n), reference block (m-1, n), etc. can be used as preset available areas.
  • the construction method of the third reference prediction parameter set includes but is not limited to the multiple situations described above, and one of them can be used to construct the candidate list, or multiple methods can be used at the same time to construct the list, that is, four BVC candidates are determined for each BVL to construct the third reference prediction parameter set. Then, one available BVC is determined for the four BVC candidates corresponding to each BVL, that is, the first candidate reference prediction parameter corresponding to the BVL.
  • determining a first candidate reference prediction parameter based on one or more candidate vector parameters includes: if a candidate vector parameter that satisfies a preset usable condition exists in the third reference prediction parameter set, determining the candidate vector parameter that satisfies the preset usable condition as the first candidate reference prediction parameter; if a plurality of candidate vector parameters that satisfy the preset usable condition exist in the third reference prediction parameter set, determining the candidate vector parameter that satisfies the preset usable condition as the first candidate reference prediction parameter.
  • a decision is made based on multiple candidate vector parameters that meet the preset available conditions to determine the first candidate reference prediction parameter.
  • the first candidate reference prediction parameter when determining the first candidate reference prediction parameter according to the one or more candidate vector parameters, a certain candidate vector parameter that meets the preset availability conditions can be directly determined as the first candidate reference prediction parameter. In other words, if only one BVC candidate in the constructed available BVC candidate list meets the preset availability conditions, then the first candidate reference prediction parameter finally selected is the BVC.
  • a decision can also be made on the multiple candidate vector parameters that meet the preset availability conditions. Specifically, it can be: determining the first template of the current block; determining the first matching template of each of the multiple candidate vector parameters based on the first template and the multiple candidate vector parameters; when the first template and the first matching template meet the preset existence conditions, calculating the matching error between the first template of the current block and the first matching template according to the preset error criterion to determine the first generation value of each of the multiple candidate vector parameters; determining the minimum cost value from the first generation values of each of the multiple candidate vector parameters, and determining the candidate vector parameter corresponding to the minimum cost value as the first candidate reference prediction parameter.
  • one or more candidate vector parameters can be determined from the multiple candidate vector parameters according to the first generation values.
  • the decision-making method includes but is not limited to the method of using a template to make a decision.
  • the first template includes one or more sample values in the adjacent decoded area of the current block.
  • the type of the first template may include at least one of the following: an upper template, an upper right template, a left template, a lower left template, and an upper left template.
  • the upper template is located in the upper decoded area adjacent to the current block
  • the upper right template is located in the upper right decoded area adjacent to the current block
  • the left template is located in the left decoded area adjacent to the current block
  • the lower left template is located in the lower left decoded area adjacent to the current block
  • the upper left template is located in the upper left decoded area adjacent to the current block.
  • FIG 14 is a schematic diagram of the template type.
  • the template can be classified into template types such as upper template, left template, upper right template, lower left template, and upper left template, based on the relative position relationship between the template and the current block.
  • the template sizes of different types for different coding blocks can be fixed the same or different.
  • the template size selects the same template size for the current block of any size.
  • the following formula illustrates a setting condition for the template size, where nTbW and nTbH are the width and height of the current block, respectively, and iTempW and iTempH are the width and height of the adopted template, respectively:
  • the area indicated by the multiple candidate vector parameters that has the same shape and contains the same number of sample values as the first template is determined as the first matching template.
  • the preset error criterion may include but is not limited to any one of absolute error and SAD, transformed absolute error and SATD, sum of squared differences SSE, mean absolute difference MAD, mean absolute error MAE, mean squared error MSE, etc.
  • the cost function for calculating the cost of the template area that is, there are multiple choices for the preset error criterion.
  • SAD sum of absolute errors
  • SATD sum of transformed absolute errors
  • SSE sum of squared differences
  • MAD mean absolute difference
  • MAE mean absolute error
  • MSE mean squared error
  • predTempSizeW is the width of the template
  • predTempSizeH is the height of the template
  • predTemp[i][j] is the pixel point of the template at BV
  • recTempC[i][j] is the pixel point of the current block template.
  • the method may also include: when the first template and the first matching template do not satisfy the preset existence condition, determining the first candidate vector parameter in the third reference prediction parameter set that satisfies the preset availability condition as the first candidate reference prediction parameter; or, when the first template and the first matching template do not satisfy the preset existence condition, determining the candidate vector parameter at the second position in the third reference prediction parameter set that satisfies the preset availability condition as the first reference prediction parameter.
  • the matching error between the first template and the first matching template of the current block can be calculated according to the preset error criterion to select the candidate vector parameter corresponding to the minimum cost value as the first candidate reference prediction parameter; if the first template and the first matching template do not meet the preset existence condition, the first candidate vector parameter that meets the preset availability condition in the third reference prediction parameter set or the candidate vector parameter at a specified position can be determined as the first candidate reference prediction parameter.
  • the first type the upper template and the left template of the current block both exist, and the upper template and the left template at the corresponding BV both exist. In this case, both the upper template and the left template are available.
  • the fourth type only the upper template exists in the current block. There are three methods at this time: Method 1: The upper template at the corresponding BV does not exist, so it is not used directly. At this time, the BV finally selected is the first BVC in the BVC candidate list or the BVC at a specified position. Method 2: The upper template at the corresponding BV does not exist, and the uppermost template height row inside the reference block is used to replace the upper template. Method 3: The upper template at the corresponding BV exists, so it is used directly.
  • the fifth type only the left template exists in the current block. There are three methods at this time: Method 1: The left template at the corresponding BV does not exist, so it is not used directly. At this time, the final selected BV is the first BVC in the BVC candidate list or the BVC at a specified position. Method 2: The left template at the corresponding BV does not exist, and the leftmost template width column in the reference block is used to replace the left template. Method 3: The left template at the corresponding BV exists, so it is used directly.
  • the sixth type Neither the upper template nor the left template of the current block exists.
  • the BV finally selected is the first BVC in the BVC candidate list or a BVC at a specified position.
  • a first reference prediction parameter set can be constructed.
  • S603 Determine a first color component reference sample value and a second color component reference sample value of a current block according to a first reference prediction parameter set.
  • the method may also include: when all candidate vector parameters in the third reference prediction parameter set do not meet the preset availability conditions, determining the first color component reconstruction sample and the second color component reconstruction sample at the third position of the current block; determining the first color component reference sample value and the second color component reference sample value of the current block based on the first color component reconstruction sample and the second color component reconstruction sample at the third position.
  • the luminance pixels and chrominance pixels at a set position can also be obtained, and the set position includes but is not limited to an adjacent row and an adjacent column of the current block to obtain the first color component reference sample value and the second color component reference sample value of the current block.
  • determining the first color component reference sample value and the second color component reference sample value of the current block according to the first reference prediction parameter set may include: determining the first color component reconstructed sample and the second color component reconstructed sample indicated by one or more first candidate reference prediction parameters respectively according to the first reference prediction parameter set; determining the first color component reconstructed sample and the second color component reconstructed sample at a third position of the current block; determining the first color component reference sample value and the second color component reference sample value of the current block according to the first color component reconstructed sample and the second color component reconstructed sample indicated by one or more first candidate reference prediction parameters respectively and the first color component reconstructed sample and the second color component reconstructed sample at the third position.
  • determining, according to a first reference prediction parameter set, a first color component reconstruction sample and a second color component reconstruction sample respectively indicated by one or more first candidate reference prediction parameters may include: determining the position of a current block; scaling the position of the current block to determine the position of a first color component region at the same position of the current block; and scaling the first candidate reference prediction parameters to determine the scaled reference prediction parameters of the first color component region at the same position of the current block; determining a reference block of the first color component according to the position of the first color component region and the scaled reference prediction parameters, and determining the first color component reconstruction sample indicated by the first candidate reference prediction parameter according to the reference block of the first color component; determining a reference block of the second color component according to the position of the current block and the first candidate reference prediction parameter, and determining the second color component reconstruction sample indicated by the first candidate reference prediction parameter according to the reference block of the second color component.
  • the position of the first color component area can be obtained by scaling the position of the current block according to the preset sampling format; the scaled reference prediction parameter of the first color component area can also be obtained by scaling the first candidate reference prediction parameter according to the preset sampling format.
  • the preset sampling format can refer to the aforementioned Table 4.
  • the scaled reference prediction parameter can be obtained by amplifying the chroma BV; however, considering that the luminance BV may have a loss of accuracy, the luminance BV obtained by amplifying the chroma BV is not necessarily equal to the original luminance BV (the second candidate reference prediction parameter).
  • the current block is a chroma block
  • the first color component area at the same position is the same-position luma area.
  • first color component reference sample value luminance reference sample
  • determining the first color component reconstructed sample indicated by the first candidate reference prediction parameter based on the reference block of the first color component can include: downsampling the reference block of the first color component to determine the first color component reconstructed sample indicated by the first candidate reference prediction parameter so that the resolution of the first color component reconstructed sample is the same as the resolution of the second color component reconstructed sample.
  • downsampling the reference block of the first color component to determine the reconstructed sample of the first color component indicated by the first candidate reference prediction parameter may include: determining the downsampling method of the current block; downsampling the reference block of the first color component according to the downsampling method to determine the reconstructed sample of the first color component indicated by the first candidate reference prediction parameter.
  • the samples are downsampled so that the resolution of the downsampled luminance samples is the same as that of the chrominance samples.
  • the following sampling methods can be used to compete or a certain sampling method can be used by default, but they include but are not limited to the following six sampling methods.
  • the luminance sample after downsampling at position (i, j) is:
  • determining the downsampling method of the current block may include: decoding a bit stream to determine a value of filter identification information; and determining the downsampling method of the current block according to the value of the filter identification information.
  • the decoder can determine the value of the filter identification information by decoding the bit stream, and then determine the downsampling method of the current block.
  • the filter identification information can be represented by filter_idx, and the value of the filter identification information can be 0, 1, 2, 3, 4, 5, etc.
  • the downsampled brightness reference sample recBvAftDownLuma at the corresponding BV of the co-located brightness area corresponding to the current block can be obtained through downsampling.
  • determining a first color component reconstruction sample and a second color component reconstruction sample at a third position of a current block may include: determining a first template of the current block; and determining the first color component reconstruction sample and the second color component reconstruction sample at the third position based on the first template.
  • the first template includes one or more sample values in the adjacent decoded area of the current block.
  • the type of the first template may include at least one of the following: an upper template, an upper right template, a left template, a lower left template, and an upper left template.
  • the upper template is located in the upper decoded area adjacent to the current block
  • the upper right template is located in the upper right decoded area adjacent to the current block
  • the left template is located in the left decoded area adjacent to the current block
  • the lower left template is located in the lower left decoded area adjacent to the current block
  • the upper left template is located in the upper left decoded area adjacent to the current block.
  • the first color component reference sample value and the second color component reference sample value of the current block not only the first color component reconstructed sample and the second color component reconstructed sample indicated by one or more first candidate reference prediction parameters, but also the first color component reconstructed sample and the second color component reconstructed sample at a third position (e.g., the first template area) of the current block.
  • the third position represents any set position of the current block, which includes but is not limited to an adjacent row and an adjacent column of the current block.
  • a mapping relationship between luminance and chrominance can be constructed according to the luminance reference sample recBvAftDownLuma, the chrominance reference sample recBvChroma, and the reconstructed luminance sample and the reconstructed chrominance sample at the third position.
  • S604 Determine a mapping relationship between the first color component and the second color component according to the first color component reference sample value and the second color component reference sample value.
  • determining the mapping relationship between the first color component and the second color component based on the first color component reference sample value and the second color component reference sample value may include: determining a first lookup table based on the first color component reference sample value and the second color component reference sample value, wherein the first lookup table is used to record the value of the second color component corresponding to the first color component when the index keyword is the first color component.
  • determining the mapping relationship between the first color component and the second color component based on the first color component reference sample value and the second color component reference sample value may include: determining a first discrete model based on the first color component reference sample value and the second color component reference sample value, wherein the first discrete model is used to indicate the mapping relationship between the first color component and the second color component.
  • the mapping relationship here can be a lookup table (LUT).
  • the index key in the lookup table can be the first color component
  • the mapping relationship can also be a discrete model, which is used to characterize the mapping relationship between key and value.
  • the first color component parameter sample can also be limited to a preset sample range.
  • the method can also include: mapping the first color component reference sample value so that the first color component reference sample value is within the preset sample range.
  • the preset sample range may be [0, (1 ⁇ bitdepth)-1], where bitdepth represents the bit depth.
  • bitdepth represents the bit depth.
  • the preset sample range may be [0, 255], [0, 511], etc., but no limitation is made. If there are multiple sample ranges, one of them may be selected as the final preset sample range using a rate-distortion cost method.
  • the sample range is [0, 1023].
  • the key value recBvAftDownLuma it can be mapped to a preset sample range of [0, 255] or [0, 511].
  • the method may also include: when the first reference sample values in the first color component reference sample values are the same and correspond to multiple different second reference sample values in the second color component reference sample values, calculating the average value of the multiple second reference sample values, and using the obtained average value as a value having a mapping relationship with the first reference sample value.
  • the entries with the same key value can be overwritten in sequence according to the sample order, or operations such as the average value can be taken.
  • the initialization setting of LUT[] is -1, that is, an unavailable value. "Overwriting" mainly means that if there is the same key value later, the new value will be used for storage; but it is not limited to this method, and all can also be stored and then the average value can be calculated as the value corresponding to the key.
  • the first color component reference sample value and the second color component reference sample value used to construct the mapping relationship can also be obtained in other ways, which are exemplarily described below in combination with several implementation methods.
  • the luma samples are not downsampled, and the chroma samples may be upsampled to obtain chroma reference samples.
  • determining the second color component reconstructed samples indicated by the first candidate reference prediction parameter based on the reference block of the second color component may include: upsampling the reference block of the second color component to determine the second color component reconstructed samples indicated by the first candidate reference prediction parameter, so that the resolution of the first color component reconstructed samples is the same as the resolution of the second color component reconstructed samples.
  • the reconstructed luminance sample recBvBefDownLuma at BV is used as the luminance reference sample
  • the obtained up-sampled reconstructed chrominance sample recBvChromaUp is used as the chrominance reference sample; then the mapping relationship between luminance and chrominance is constructed according to the luminance reference sample and the chrominance reference sample.
  • the downsampling method includes but is not limited to average downsampling, etc.
  • the method may further include: determining a first template of the current block; and determining a first color component reference sample value and a second color component reference sample value of the current block according to the first template.
  • the first color component reference sample value and the second color component reference sample value used to construct the mapping relationship may also include the first color component reference sample value and the second color component reference sample value determined by the first template of the current block.
  • the first template of the current block can determine the first color component area template at the same position as the first template; then the first color component reference sample value can be determined according to the reconstructed sample in the first color component area template; the second color component reference sample value can be determined according to the reconstructed sample in the first template.
  • the first template includes one or more reconstructed samples in the adjacent decoded area of the current block.
  • a chroma reference sample can be obtained; after determining the co-located luminance region template of the current chroma template, a luminance reference sample can be obtained according to the co-located luminance region template. Then, in combination with the luminance reference samples and chroma reference samples obtained in the above embodiment, a mapping relationship between luminance and chroma is constructed according to these luminance reference samples and chroma reference samples.
  • determining the first color component sample of the current block may include: determining the reconstructed pixel samples of the first color component area at the same position of the current block; and determining the first color component sample of the current block based on the reconstructed pixel samples of the first color component area.
  • the reconstructed pixel samples of the first color component area may be directly used as the first color component sample of the current block, or the reconstructed pixel samples of the first color component area may be filtered and the filtered reconstructed pixel samples may be used as the first color component sample of the current block, and no limitation is made here.
  • the filtering process is a downsampling process.
  • the luminance reference sample has been mapped in a sample range
  • the down-sampled reconstructed luminance sample also needs to be mapped in the same sample range here to obtain the first color component sample value of the current block.
  • determining the predicted value of the second color component of the current block based on the mapping relationship and the first color component sample value of the current block may include: if a first color component value equal to the first color component sample value is found in the mapping relationship, then determining the value of the second color component corresponding to the first color component value as the predicted value of the second color component of the current block.
  • the variable cIdx specifies the color component index of the current block, and the following prediction method can be used here:
  • the chrominance prediction value is derived using the mapping relationship (discrete model) established in the above embodiment.
  • the method may also include: if a first color component value equal to the first color component sample value is not found in the mapping relationship, the first color component sample value is corrected to determine the first color component correction value, and the mapping relationship is continued to be searched for whether there is a first color component value equal to the first color component correction value.
  • performing correction processing on the first color component reconstruction value to determine the first color component correction value may include: performing offset calculation on the first color component sample value according to one or more preset offset values to determine the first color component correction value.
  • the offset value may be +1, -1, +2, -2, +3, -3, etc., and the number and specific value of the offset value are not limited.
  • the multiple offset values may also be set in a certain order, for example, the correction processing is performed in the order of ⁇ +1, -1, +2, -2, +3, -3 ⁇ .
  • Yc is corrected in the order of ⁇ Yc+1, Yc-1, Yc+2, Yc-2, Yc+3, Yc-3 ⁇ , and then a matching check is performed in the input brightness set based on the corrected Yc, and then the value corresponding to the corrected Yc is determined as the chrominance prediction value of the current block.
  • the method for determining the predicted value of the second color component of the current block, also includes: if a first color component value equal to the first color component correction value is not found in the mapping relationship, an average value of the second color component reference sample value is calculated, and the obtained average value is determined as the predicted value of the second color component of the current block.
  • Yc is corrected in the order of ⁇ Yc+1, Yc-1, Yc+2, Yc-2, Yc+3, Yc-3 ⁇ ; if all the above corrected Yc cannot be matched in the mapping relationship, the chromaticity prediction value can be set to the average value of the reconstructed chromaticity sample recBvChroma at the corresponding BV.
  • the method for determining the predicted value of the second color component of the current block, also includes: determining a first initial predicted value of the second color component of the current block based on a mapping relationship and a sample value of the first color component of the current block; and performing a correction operation on the first initial predicted value to determine the predicted value of the second color component of the current block.
  • a correction operation is performed on the first initial prediction value obtained according to the mapping relationship.
  • the correction operation here may include a clip operation, a filtering operation, a weighted operation with the prediction value obtained from other prediction modes, etc., and there is no limitation on this.
  • a plurality of third initial prediction values can be obtained based on these plurality of BVs; then these plurality of third initial prediction values are weighted, and the weighted prediction values are used as the chrominance prediction values of the current block; or, the weighted prediction values may be further modified, including but not limited to weighting with CCLM-type modes or other prediction modes, to obtain the chrominance prediction values of the current block.
  • the variable cIdx specifies the color component index of the current block
  • the prediction method is: refer to the brightness value Yc at the same position to derive the predicted value using the established mapping relationship. If Yc is not found in the input brightness set in the established mapping relationship, the following processing methods are included but not limited to: check in the order of ⁇ Yc+1, Yc-1, Yc+2, Yc-2, Yc+3, Yc-3 ⁇ . If all the above values cannot be matched in the mapping relationship, the chroma prediction value of the current block is set to the average value of the reconstructed chroma sample recBvChroma at the corresponding BV.
  • the first type both the upper template and the left template of the current block exist, and both the upper template and the left template are available.
  • the second type Only the upper template exists in the current block, and only the upper template is available.
  • predTempSizeW is the width of the template
  • predTempSizeH is the height of the template
  • predSamplesR[i][j] is the predicted pixel point of the current block template after LUT
  • recSamplesR[i][j] is the reconstructed pixel point of the current block template.
  • the cost of each established LUT candidate is calculated and sorted in other cases, and the sorting method includes but is not limited to bubble sort, selection sort, insertion sort, Shell sort, merge sort, quick sort, radix sort, heap sort, counting sort, bucket sort, etc. Among them, the LUT candidate with the smallest cost is selected as the final LUT used.
  • the method may further include: decoding the code stream to determine the residual value of the second color component of the current block; and determining the reconstructed value of the second color component of the current block based on the residual value and the predicted value.
  • determining the reconstructed value of the second color component of the current block may include: performing an addition operation on the residual value and the predicted value to obtain the reconstructed value of the second color component of the current block.
  • the method further includes: determining a first color component region at the same position of the current block; if the current block uses the DM mode and the first color component region is predicted based on the block vector, determining that the current block uses the first prediction mode.
  • the first color component area at the same position of the current block is determined; if the current block uses the DM mode and the first color component area is predicted based on the block vector, it is determined that the current block uses the first prediction mode.
  • the current block is predicted using the first prediction mode (BVG-LUT mode). For example:
  • the first syntax element can be used to indicate whether the current block uses the BVG-LUT mode, and the first syntax element can be represented by intra_bvgplt_flag or bvgplt_flag.
  • the chroma prediction mode is derived as follows:
  • the chroma intra prediction mode IntraPredModeC[xCb][yCb] uses cclm_mode_flag, cclm_mode_idx, intra_chroma_pred_mode, lumaIntraPredMode and lumaTempPredMode specified in the following table. These fill items other than the BVG-LUT mode are exemplary to give the corresponding values, and they must not be filled in with this value. Among them, Table 9 shows an example of chroma prediction mode derivation. As shown in Table 9, 0 represents Planar mode, 1 represents DC mode, 18 represents horizontal mode, 50 represents vertical mode, and 81 to 83 represent CCLM mode.
  • BvglutEnabled is equal to 1 if multiple of the following conditions are true at the same time (including but not limited to the following conditions):
  • ModeIncludeBv is equal to 1
  • sh_slice_type is equal to I frame
  • CtbLog2SizeC is less than or equal to MaxChromaIbcSize; wherein MaxChromaIbcSize may be determined according to the chroma CTU size or a preset value.
  • BvglutEnabled is equal to 1:
  • CtbLog2SizeC is less than or equal to MaxChromaIbcSize; wherein MaxChromaIbcSize may be determined according to the chroma CTU size or a preset value.
  • BvglutEnabled is equal to 1:
  • the prediction mode of the current block can also be determined at the encoding end based on the competition between the BVG-LUT mode and other modes. Among them, in the DM mode, in addition to the BVG-LUT mode, other modes can also compete. The final use mode is determined according to the template cost. For example, instead of directly using the BV obtained by brightness, BV replication can be directly used, or the BVG-LUT mode defined in the embodiment of the present application can be used. After both modes are applied to the template of the current block, the one with the smaller template cost is selected as the prediction mode of the current block.
  • the coordinates of the position of the brightness pixel TR are (xCb+cbWidth-1, yCb);
  • the coordinates of the position of the brightness pixel BL are (xCb, yCb+cbHeight-1);
  • the corresponding first color component block needs to be determined first.
  • the first color component is a brightness component
  • the corresponding brightness block of the current block needs to be determined.
  • the above-mentioned several possible implementations can be used to determine one or more corresponding brightness blocks.
  • the candidate vector parameter based on the first color component can be the BV of the luminance block, that is, BVL; the candidate vector parameter based on the second color component can be the BV of the chroma block, that is, BVC.
  • adjusting the candidate vector parameters based on the first color component to determine the candidate vector parameters based on the second color component may include: determining a preset sampling format for the current block; scaling the candidate vector parameters based on the first color component according to the preset sampling format to determine the candidate vector parameters based on the second color component.
  • the candidate BVL can be scaled according to the color sampling format to obtain a scaled BVC; and then it is determined whether the scaled BVC meets the preset usability conditions.
  • the scaled BVC meets the preset usability conditions, including but not limited to:
  • the offset position indicated by the scaled BVC does not exceed the preset available area
  • the number of the first candidate reference prediction parameters is the same as the number of the second candidate reference prediction parameters. That is to say, for each second candidate reference prediction parameter, it can be adjusted to obtain one or more first candidate reference prediction parameters, and then an available first candidate reference prediction parameter is determined therefrom.
  • the number of the first candidate reference prediction parameters and the second candidate reference prediction parameters may also be different, and at this time, each second candidate reference prediction parameter may determine more than one available first candidate reference prediction parameter, and no limitation is made here.
  • this method can be used to determine the corresponding first candidate reference prediction parameter to obtain a first reference prediction parameter set.
  • the first candidate reference prediction parameter may be a candidate BV of the chroma block, namely, a candidate BVC;
  • the second candidate reference prediction parameter may be a candidate BV of the luminance block, namely, a candidate BVL.
  • the second candidate reference prediction parameter may be adjusted to determine one or more candidate vector parameters based on the second color component, namely, one or more candidate BVCs, which may construct a third reference prediction parameter set.
  • adjusting the second candidate reference prediction parameter to determine a third reference prediction parameter set based on the second color component may include: scaling the second candidate reference prediction parameter according to a preset sampling format of the current block, determining a candidate vector parameter based on the second color component, and adding the candidate vector parameter based on the second color component to the third reference prediction parameter set.
  • adjusting the second candidate reference prediction parameter to determine a third reference prediction parameter set based on the second color component may include: scaling the second candidate reference prediction parameter according to a preset sampling format of the current block to determine a first initial vector parameter based on the second color component; performing an offset calculation on the first initial vector parameter based on the second color component according to one or more offset values to determine one or more candidate vector parameters based on the second color component, and adding the one or more candidate vector parameters based on the second color component to the third reference prediction parameter set.
  • adjusting the second candidate reference prediction parameter to determine the third reference prediction parameter set based on the second color component may include: performing offset calculation on the second candidate reference prediction parameter according to one or more offset values to determine one or more second initial vector parameters based on the first color component; scaling the one or more second initial vector parameters based on the first color component according to a preset sampling format of the current block to determine one or more candidate vector parameters based on the second color component, and converting the one or more second initial vector parameters based on the first color component into the first color component; The candidate vector parameters based on the second color component are added to the third reference prediction parameter set.
  • the above-mentioned one or more offset values can be any number of arbitrary numerical values, such as -1, +1, -2, +2, -3, +3, etc., without any limitation here.
  • the chrominance BVC candidate items containing one or more candidates can be constructed by adjusting BVL or BVC.
  • the construction method of the candidate items includes but is not limited to the following situations:
  • BVL can be adjusted to form four situations, thereby achieving adjustment of BVC.
  • BVL (BVLhor, BVLver).
  • BVL (BVL hor, BVL ver )
  • BVL (BVL hor +1, BVL ver )
  • BVL (BVL hor, BVL ver +1)
  • BVL (BVL hor +1, BVL ver +1).
  • BVC[0] BVL[0]*2/SubWidthC
  • BVC[1] BVL[1]*2/SubHeightC
  • SubWidthC and SubHeightC can be determined according to the mapping relationship between sps_chroma_format_idc and the color sampling format in Table 1.
  • BVC is obtained by scaling BVL according to the above formula, so that when BVL is an odd number or an even number, four BVC candidates are formed, and these candidates are added to the chroma BVC candidate list (ie, the third reference prediction parameter set).
  • BVL can be adjusted to form four situations, thereby achieving adjustment of BVC.
  • BVL (BVLhor, BVLver)
  • BVL (BVLhor-1, BVLver)
  • BVL (BVLhor, BVLver-1)
  • BVL (BVLhor-1, BVLver-1).
  • FIG13 shows a schematic diagram of a structure of whether an offset position provided by an embodiment of the present application exceeds a preset available area.
  • a block filled with black represents a current block
  • an area filled with oblique lines represents an available area
  • the reference blocks in the available area have been reconstructed.
  • the reference blocks adjacent to the current block (m, n) specifically: reference block (m-2, n-2), reference block (m-1, n-2), reference block (m, n-2), reference block (m+1, n-2), reference block (m-2, n-1), reference block (m-1, n-1), reference block (m, n-1), reference block (m+1, n-1), reference block (m-2, n), reference block (m-1, n), etc. can be used as preset available areas.
  • the construction method of the third reference prediction parameter set includes but is not limited to the multiple situations described above, and one of them can be used to construct the candidate list, or multiple methods can be used at the same time to construct the list, that is, four BVC candidates are determined for each BVL to construct the third reference prediction parameter set. Then, one available BVC is determined for the four BVC candidates corresponding to each BVL, that is, the first candidate reference prediction parameter corresponding to the BVL.
  • a first candidate reference prediction parameter is determined based on one or more candidate vector parameters, including: if there is a candidate vector parameter that meets a preset availability condition in the third reference prediction parameter set, then the candidate vector parameter that meets the preset availability condition is determined as the first candidate reference prediction parameter; if there are multiple candidate vector parameters that meet the preset availability condition in the third reference prediction parameter set, then a decision is made on the multiple candidate vector parameters that meet the preset availability condition to determine the first candidate reference prediction parameter.
  • the first candidate reference prediction parameter when determining the first candidate reference prediction parameter according to the one or more candidate vector parameters, a certain candidate vector parameter that meets the preset availability conditions can be directly determined as the first candidate reference prediction parameter. In other words, if only one BVC candidate in the constructed available BVC candidate list meets the preset availability conditions, then the first candidate reference prediction parameter finally selected is the BVC.
  • a decision can also be made on the multiple candidate vector parameters that meet the preset availability conditions. Specifically, it can be: determining the first template of the current block; determining the first matching template of each of the multiple candidate vector parameters based on the first template and the multiple candidate vector parameters; when the first template and the first matching template meet the preset existence conditions, calculating the matching error between the first template of the current block and the first matching template according to the preset error criterion to determine the first generation value of each of the multiple candidate vector parameters; determining the minimum cost value from the first generation values of each of the multiple candidate vector parameters, and determining the candidate vector parameter corresponding to the minimum cost value as the first candidate reference prediction parameter.
  • one or more candidate vector parameters can be determined from the multiple candidate vector parameters according to the first generation values.
  • the decision-making method includes but is not limited to the method of using a template to make a decision.
  • the first template includes one or more sample values in the adjacent decoded area of the current block.
  • the type of the first template may include at least one of the following: an upper template, an upper right template, a left template, a lower left template, and an upper left template.
  • the upper template is located in the upper decoded area adjacent to the current block
  • the upper right template is located in the upper right decoded area adjacent to the current block
  • the left template is located in the left decoded area adjacent to the current block
  • the lower left template is located in the lower left decoded area adjacent to the current block
  • the upper left template is located in the upper left decoded area adjacent to the current block.
  • FIG 14 is a schematic diagram of the template type.
  • the template can be classified into template types such as upper template, left template, upper right template, lower left template, and upper left template, based on the relative position relationship between the template and the current block.
  • the template sizes of different types for different coding blocks can be fixed the same or different.
  • the template size selects the same template size for the current block of any size.
  • the following formula illustrates a setting condition for the template size, where nTbW and nTbH are the width and height of the current block, respectively, and iTempW and iTempH are the width and height of the adopted template, respectively:
  • nTbW and nTbH are the width and height of the current block, respectively
  • iTempW and iTempH are the width and height of the adopted template, respectively:
  • nTbW and nTbH are the width and height of the current block
  • nTbW ⁇ nTbH are the number of pixels in the current block
  • iTempW and iTempH are the width and height of the adopted template:
  • the area indicated by the multiple candidate vector parameters that has the same shape and contains the same number of sample values as the first template is determined as the first matching template.
  • the first template of the current block is used to perform motion compensation on the obtained multiple BVC candidates (i.e., candidate block vector parameters that meet the preset availability conditions) to obtain a template corresponding to the BV (first matching template).
  • FIG15 is a schematic diagram of template motion compensation. As shown in FIG15, if the BV (BVC candidate) is available, the first template and the BV are used to perform motion compensation to obtain a template corresponding to the BV, i.e., the first matching template.
  • the preset error criterion may include but is not limited to any one of absolute error and SAD, transformed absolute error and SATD, sum of squared differences SSE, mean absolute difference MAD, mean absolute error MAE, mean squared error MSE, etc.
  • the cost function for calculating the cost of the template area that is, there are multiple choices for the preset error criterion.
  • SAD sum of absolute errors
  • SATD sum of transformed absolute errors
  • SSE sum of squared differences
  • MAD mean absolute difference
  • MAE mean absolute error
  • MSE mean squared error
  • predTempSizeW is the width of the template
  • predTempSizeH is the height of the template
  • predTemp[i][j] is the pixel point of the template at BV
  • recTempC[i][j] is the pixel point of the current block template.
  • the method may also include: when the first template and the first matching template do not satisfy the preset existence condition, determining the first candidate vector parameter in the third reference prediction parameter set that satisfies the preset availability condition as the first candidate reference prediction parameter; or, when the first template and the first matching template do not satisfy the preset existence condition, determining the candidate vector parameter at the second position in the third reference prediction parameter set that satisfies the preset availability condition as the first reference prediction parameter.
  • the matching error between the first template and the first matching template of the current block can be calculated according to the preset error criterion to select the candidate vector parameter corresponding to the minimum cost value as the first candidate reference prediction parameter; if the first template and the first matching template do not meet the preset existence condition, the first candidate vector parameter that meets the preset availability condition in the third reference prediction parameter set or the candidate vector parameter at a specified position can be determined as the first candidate reference prediction parameter.
  • the first type the upper template and the left template of the current block both exist, and the upper template and the left template at the corresponding BV both exist. In this case, both the upper template and the left template are available.
  • determining a first color component reconstruction sample and a second color component reconstruction sample at a third position of a current block may include: determining a first template of the current block; and determining the first color component reconstruction sample and the second color component reconstruction sample at the third position based on the first template.
  • the first template includes one or more sample values in the adjacent decoded area of the current block.
  • the type of the first template may include at least one of the following: an upper template, an upper right template, a left template, a lower left template, and an upper left template.
  • the upper template is located in the upper decoded area adjacent to the current block
  • the upper right template is located in the upper right decoded area adjacent to the current block
  • the left template is located in the left decoded area adjacent to the current block
  • the lower left template is located in the lower left decoded area adjacent to the current block
  • the upper left template is located in the upper left decoded area adjacent to the current block.
  • the first color component reference sample value and the second color component reference sample value of the current block not only the first color component reconstructed sample and the second color component reconstructed sample indicated by one or more first candidate reference prediction parameters, but also the first color component reconstructed sample and the second color component reconstructed sample at a third position (e.g., the first template area) of the current block.
  • the third position represents any set position of the current block, which includes but is not limited to an adjacent row and an adjacent column of the current block.
  • S2004 Determine a mapping relationship between the first color component and the second color component according to the first color component reference sample value and the second color component reference sample value.
  • determining the mapping relationship between the first color component and the second color component based on the first color component reference sample value and the second color component reference sample value may include: determining a first lookup table based on the first color component reference sample value and the second color component reference sample value, wherein the first lookup table is used to record the value of the second color component corresponding to the first color component when the index keyword is the first color component.
  • determining the mapping relationship between the first color component and the second color component based on the first color component reference sample value and the second color component reference sample value may include: determining a first discrete model based on the first color component reference sample value and the second color component reference sample value, wherein the first discrete model is used to indicate the mapping relationship between the first color component and the second color component.
  • the mapping relationship here can be a lookup table (LUT).
  • the index key in the lookup table can be the first color component
  • the mapping relationship can also be a discrete model, which is used to characterize the mapping relationship between key and value.
  • the first color component parameter sample can also be limited to a preset sample range.
  • the method can also include: mapping the first color component reference sample value so that the first color component reference sample value is within the preset sample range.
  • the sample range is [0, 1023].
  • the key value recBvAftDownLuma it can be mapped to a preset sample range of [0, 255] or [0, 511].
  • the method may also include: when the first reference sample values in the first color component reference sample values are the same and correspond to multiple different second reference sample values in the second color component reference sample values, overwriting processing is performed in sequence according to the sample order, and the last second reference sample value is used as the value having a mapping relationship with the first reference sample value.
  • the method may further include: when the first reference sample values in the first color component reference sample values are the same and correspond to multiple different second reference sample values in the second color component reference sample values, calculating the average value of the multiple second reference sample values, and converting The obtained average value is used as a value having a mapping relationship with the first reference sample value.
  • the entries with the same key value can be overwritten in sequence according to the sample order, or operations such as the average value can be taken.
  • the initialization setting of LUT[] is -1, that is, an unavailable value. "Overwriting" mainly means that if there is the same key value later, the new value will be used for storage; but it is not limited to this method, and all can also be stored and then the average value can be calculated as the value corresponding to the key.
  • the first color component reference sample value and the second color component reference sample value used to construct the mapping relationship can also be obtained in other ways, which are exemplarily described below in combination with several implementation methods.
  • the luma samples are not downsampled, and the chroma samples may be upsampled to obtain chroma reference samples.
  • determining the second color component reconstructed samples indicated by the first candidate reference prediction parameter based on the reference block of the second color component may include: upsampling the reference block of the second color component to determine the second color component reconstructed samples indicated by the first candidate reference prediction parameter, so that the resolution of the first color component reconstructed samples is the same as the resolution of the second color component reconstructed samples.
  • the reconstructed luminance sample recBvBefDownLuma at BV is used as the luminance reference sample
  • the obtained up-sampled reconstructed chrominance sample recBvChromaUp is used as the chrominance reference sample; then the mapping relationship between luminance and chrominance is constructed according to the luminance reference sample and the chrominance reference sample.
  • the downsampling method includes but is not limited to average downsampling, etc.
  • the method may further include: determining a first template of the current block; and determining a first color component reference sample value and a second color component reference sample value of the current block according to the first template.
  • the first color component reference sample and the second color component reference sample used to construct the mapping relationship may also include the first color component reference sample and the second color component reference sample determined by the first template of the current block.
  • the first color component area template at the same position as the first template can be determined; then, according to the reconstructed samples in the first color component area template, the first color component reference sample can be determined; and according to the reconstructed samples in the first template, the second color component reference sample can be determined.
  • the first template includes one or more reconstructed samples in the adjacent decoded area of the current block.
  • a chroma reference sample can be obtained; after determining the co-located luminance region template of the current chroma template, a luminance reference sample can be obtained according to the co-located luminance region template. Then, in combination with the luminance reference samples and chroma reference samples obtained in the above embodiment, a mapping relationship between luminance and chroma is constructed according to these luminance reference samples and chroma reference samples.
  • determining the first color component sample of the current block may include: determining the reconstructed pixel samples of the first color component area at the same position of the current block; and determining the first color component sample of the current block based on the reconstructed pixel samples of the first color component area.
  • the reconstructed pixel samples of the first color component area may be directly used as the first color component sample of the current block, or the reconstructed pixel samples of the first color component area may be filtered and the filtered reconstructed pixel samples may be used as the first color component sample of the current block, and no limitation is made here.
  • the filtering process is a downsampling process.
  • the luminance reference sample has been mapped in a sample range
  • the down-sampled reconstructed luminance sample also needs to be mapped in the same sample range here to obtain the first color component sample value of the current block.
  • determining the predicted value of the second color component of the current block based on the mapping relationship and the first color component sample value of the current block may include: if a first color component value equal to the first color component sample value is found in the mapping relationship, then determining the value of the second color component corresponding to the first color component value as the predicted value of the second color component of the current block.
  • the variable cIdx specifies the color component index of the current block, and the following prediction method can be used here:
  • the chrominance prediction value is derived using the mapping relationship (discrete model) established in the above embodiment.
  • the method may also include: if a first color component value equal to the first color component sample value is not found in the mapping relationship, the first color component sample value is corrected to determine the first color component correction value, and the mapping relationship is continued to be searched for whether there is a first color component value equal to the first color component correction value.
  • the first color component reconstruction value is corrected to determine the first color component correction value, which may include: In summary: performing an offset calculation on the first color component sample value according to one or more preset offset values to determine the first color component correction value.
  • the offset value may be +1, -1, +2, -2, +3, -3, etc., and the number and specific value of the offset value are not limited.
  • the multiple offset values may also be set in a certain order, for example, the correction processing is performed in the order of ⁇ +1, -1, +2, -2, +3, -3 ⁇ .
  • Yc is corrected in the order of ⁇ Yc+1, Yc-1, Yc+2, Yc-2, Yc+3, Yc-3 ⁇ , and then a matching check is performed in the input brightness set based on the corrected Yc, and then the value corresponding to the corrected Yc is determined as the chrominance prediction value of the current block.
  • the method for determining the predicted value of the second color component of the current block, also includes: if a first color component value equal to the first color component correction value is not found in the mapping relationship, an average value of the second color component reference sample value is calculated, and the obtained average value is determined as the predicted value of the second color component of the current block.
  • the method for determining the predicted value of the second color component of the current block, also includes: determining a first initial predicted value of the second color component of the current block based on a mapping relationship and a sample value of the first color component of the current block; and performing a correction operation on the first initial predicted value to determine the predicted value of the second color component of the current block.
  • a correction operation is performed on the first initial prediction value obtained according to the mapping relationship.
  • the correction operation here may include a clip operation, a filtering operation, a weighted operation with the prediction value obtained from other prediction modes, etc., and there is no limitation on this.
  • performing a correction operation on the first initial prediction value to determine the prediction value of the second color component of the current block may include: performing prediction processing on the second color component of the current block according to the first preset mode to determine the second initial prediction value of the second color component of the current block; performing weighted calculation on the first initial prediction value and the second initial prediction value to determine the prediction value of the second color component of the current block.
  • the first preset mode includes at least one of the following: PLANAR mode, DM mode, DC mode and CCLM mode. That is to say, performing a correction operation on the first initial prediction value obtained according to the mapping relationship may include but is not limited to weighting with a CCLM-type mode or other prediction modes to obtain a chrominance prediction value of the current block.
  • performing a correction operation on the first initial prediction value to determine the prediction value of the second color component of the current block may include: limiting the first initial prediction value within a preset numerical range, or it may also be referred to as a "clip operation".
  • the lower limit value of the preset numerical range is the minimum prediction value (min)
  • the upper limit value of the preset numerical range is the maximum prediction value (max).
  • the first initial prediction value can be used as the chrominance prediction value of the current block; if the first initial prediction value is greater than max, then max can be used as the chrominance prediction value of the current block; if the first initial prediction value is less than min, then min can be used as the chrominance prediction value of the current block.
  • the method for determining the prediction value of the second color component of the current block, also includes: when the first reference prediction parameter set includes multiple first candidate reference prediction parameters, determining multiple third initial prediction values of the second color component of the current block; performing weighted calculation on the multiple third initial prediction values to determine the prediction value of the second color component of the current block.
  • a plurality of third initial prediction values can be obtained based on these plurality of BVs; then these plurality of third initial prediction values are weighted, and the weighted prediction values are used as the chrominance prediction values of the current block; or, the weighted prediction values may be further modified, including but not limited to weighting with CCLM-type modes or other prediction modes, to obtain the chrominance prediction value of the current block.
  • the method may also include: when the first reference prediction parameter set includes multiple first candidate reference prediction parameters, determining the first color component reconstruction samples and the second color component reconstruction samples indicated by each of the multiple first candidate reference prediction parameters; determining multiple mapping relationships between the first color component and the second color component based on the first color component reconstruction samples and the second color component reconstruction samples indicated by each of the multiple first candidate reference prediction parameters; determining multiple third initial prediction values of the second color component of the current block based on the multiple mapping relationships; and performing weighted calculation on the multiple third initial prediction values to determine the prediction value of the second color component of the current block.
  • multiple blocks of the same brightness area are obtained, and the positions of the multiple blocks include but are not limited to the following positions, as shown in Figure 11.
  • Multiple blocks can correspond to multiple brightness BVs, and these multiple brightness BVs respectively construct candidates for their respective chrominance BVC candidate lists, and the availability of the BVs in the candidate list is judged to decide one BV or multiple BVs or to decide multiple groups of BVs through clustering.
  • multiple mapping tables LUTs between brightness and chrominance can be established, so that multiple initial chrominance prediction values can be obtained according to these multiple mapping tables LUTs, and the chrominance prediction value of the current block can be obtained through weighted calculation.
  • the method may include: When a color component block includes multiple candidate blocks, a second reference prediction parameter set of a current block is determined; wherein the second reference prediction parameter set includes multiple second candidate reference prediction parameters; multiple first candidate reference prediction parameters are determined based on the multiple second candidate reference prediction parameters; and multiple candidate mapping relationships between the first color component and the second color component are determined based on the multiple first candidate reference prediction parameters; a target mapping relationship is determined from the multiple candidate mapping relationships; and a predicted value of the second color component of the current block is determined based on the target mapping relationship and the sample value of the first color component of the current block.
  • determining a target mapping relationship from multiple candidate mapping relationships may include: performing cost calculations on multiple candidate mapping relationships respectively to determine cost results corresponding to each of the multiple candidate mapping relationships; determining a minimum cost result from the cost results corresponding to each of the multiple candidate mapping relationships, and determining the candidate mapping relationship corresponding to the minimum cost result as the target mapping relationship.
  • the distortion value method can be used to determine the cost result, specifically, the rate-distortion cost method can be used to determine the cost result; however, it can also be the size of SAD, the size of MSE, the size of SSE or other standards for judging the cost, which are not specifically limited here.
  • the method further includes: determining a mapping relationship index value, wherein the mapping relationship index value is used to indicate an index number of a target mapping relationship among a plurality of candidate mapping relationships; encoding the mapping relationship index value, and writing the obtained encoding bits into a bit stream.
  • mapping relationship index value can also be determined and written into the bitstream based on the index number of the candidate mapping relationship corresponding to the minimum cost result in multiple candidate mapping relationships, so that the decoding end can determine the corresponding target mapping relationship based on the mapping relationship index value obtained by decoding.
  • a plurality of mapping tables LUT between brightness and chrominance can be established, and then the selected target mapping table LUT can be indicated using syntax elements.
  • a plurality of blocks of the same brightness region are obtained, and the positions of the plurality of blocks include but are not limited to the following positions, as shown in FIG11 .
  • the plurality of blocks can correspond to a plurality of brightness BVs, and the plurality of brightness BVs respectively construct candidates for their respective chrominance BVC candidate lists, and judge the availability of the BVs in the candidate list to decide one BV or a plurality of BVs or to decide a plurality of groups of BVs by clustering, and the respective available chrominance BVCs of the plurality of blocks can respectively establish a mapping table LUT; at the decoding end, the mapping relationship index value can be determined by decoding the corresponding syntax elements; and then the target mapping relationship can be determined according to the mapping relationship index value, and then the chrominance prediction value of the current block can be determined.
  • the number of mapping relationships established here can be set arbitrarily, for example, the number can be set to 4, but there is no limitation.
  • the method may include: when the first color component block of the current block includes multiple candidate blocks, determining a second reference prediction parameter set for the current block; wherein the second reference prediction parameter set includes multiple second candidate reference prediction parameters; determining multiple first candidate reference prediction parameters based on the multiple second candidate reference prediction parameters; and determining multiple candidate mapping relationships between the first color component and the second color component based on the multiple first candidate reference prediction parameters; performing matching error calculations on the multiple candidate mapping relationships based on a template matching method to determine the second generation values of each of the multiple candidate mapping relationships; determining the minimum cost value from the second generation values of each of the multiple candidate mapping relationships, and determining the candidate mapping relationship corresponding to the minimum cost value as the target mapping relationship; determining the predicted value of the second color component of the current block based on the target mapping relationship and the sample value of the first color component of the current block.
  • matching errors are calculated for multiple candidate mapping relationships based on a template matching method to determine the second generation values of each of the multiple candidate mapping relationships, which may include: determining the first template of the current block; determining the reconstructed pixel sample values of the first color component area template at the same position of the first template; determining the predicted values of the second color components of the first template under multiple mapping relationships based on the multiple candidate mapping relationships and the reconstructed pixel sample values of the first color component area template; performing cost calculation based on the reconstructed value of the second color component of the first template and the predicted value of the second color component of the first template under multiple mapping relationships to determine the second generation values of each of the multiple candidate mapping relationships.
  • mapping tables LUT between brightness and chromaticity can be established, and then a template is used to select which mapping table LUT to use.
  • multiple blocks of the same brightness area are obtained, and the positions of the multiple blocks include but are not limited to the following positions, as shown in Figure 11.
  • Multiple blocks can correspond to multiple brightness BVs, and these multiple brightness BVs respectively construct candidates for their respective chromaticity BVC candidate lists, and judge the availability of the BVs in the candidate list to decide one BV or multiple BVs or decide multiple groups of BVs through clustering.
  • the available chromaticity BVCs of these multiple blocks can respectively establish a mapping table LUT; the current block template is predicted by using different mapping tables LUT, and the difference is calculated with the reconstructed value of the template, and then it is decided which mapping relationship to use, and then the mapping relationship finally decided is used to determine the chromaticity prediction value of the current block.
  • the number of mapping relationships established here can be set arbitrarily, for example, the number can be set to 4, but there is no limitation.
  • the specific process of performing LUT prediction on the current block template is:
  • the variable cIdx specifies the color component index of the current block
  • the prediction method is: refer to the brightness value Yc at the same position to derive the predicted value using the established mapping relationship.
  • Yc is not found in the input luminance set in the established mapping relationship, the following processing methods are included but not limited to: check in the order of ⁇ Yc+1, Yc-1, Yc+2, Yc-2, Yc+3, Yc-3 ⁇ ; if all the above values cannot be matched in the mapping relationship, the chrominance prediction value of the current block is set to the average value of the reconstructed chrominance samples recBvChroma at the corresponding BV.
  • the first type both the upper template and the left template of the current block exist. In this case, both the upper template and the left template are available.
  • the second type Only the upper template exists in the current block, and only the upper template is available.
  • the third type Only the left template exists in the current block, and only the left template is available.
  • the fourth type Neither the upper template nor the left template of the current block exists.
  • the LUT finally selected is the first LUT established or the LUT at a specified position.
  • the cost function for calculating the template region cost for example, the sum of absolute error (SAD), the sum of transformed absolute error (SATD), the sum of squared differences (SSE), the mean absolute difference (MAD), the mean absolute error (MAE), the mean squared error (MSE) and other evaluation criteria can be selected.
  • SAD sum of absolute error
  • SATD sum of transformed absolute error
  • SSE sum of squared differences
  • MAD mean absolute difference
  • MAE mean absolute error
  • MSE mean squared error
  • the evaluation criteria mentioned in the following content can be selected from the above criteria. Taking the evaluation criterion of SAD as an example, the calculation formula is as follows:
  • predTempSizeW is the width of the template
  • predTempSizeH is the height of the template
  • predSamplesR[i][j] is the predicted pixel point of the current block template after LUT
  • recSamplesR[i][j] is the reconstructed pixel point of the current block template.
  • the method further includes: encoding the residual value of the second color component of the current block, and writing the obtained encoding bits into the bit stream, so that the subsequent decoding end can restore the reconstructed value of the second color component of the current block according to the residual value and the predicted value.
  • CtbLog2SizeC is less than or equal to MaxChromaIbcSize; wherein MaxChromaIbcSize may be determined according to the chroma CTU size or a preset value.
  • BvglutEnabled is equal to 1:
  • ModeIncludeBv is equal to 1
  • CtbLog2SizeC is less than or equal to MaxChromaIbcSize; wherein MaxChromaIbcSize may be determined according to the chroma CTU size or a preset value.
  • BvglutEnabled is equal to 1:
  • CtbLog2SizeC is less than or equal to MaxChromaIbcSize; wherein MaxChromaIbcSize may be determined according to the chroma CTU size or a preset value.
  • BvglutEnabled is equal to 0.
  • BvglutEnabled is equal to 0
  • the value of the first syntax element can be inferred to be 0.
  • an embodiment of the present application also provides a code stream, which is generated by bit encoding based on the information to be encoded; wherein the information to be encoded includes at least one of the following: a residual value of the second color component of the current block, a value of the filter identification information, a mapping relationship index value, a value of the first syntax element, and a value of the second syntax element.
  • the filter identification information is used to indicate the downsampling method of the current block
  • the first syntax element is used to indicate whether the current block uses the first prediction mode
  • the second syntax element is used to indicate whether the current block is allowed to use the first prediction mode
  • the present embodiment provides a coding method, which determines the prediction parameters of the current block; determines the first reference prediction parameter set of the current block according to the prediction parameters; wherein the first reference prediction parameter set includes one or more first candidate reference prediction parameters; determines the first color component reference sample value and the second color component reference sample value of the current block according to the first reference prediction parameter set; determines the mapping relationship between the first color component and the second color component according to the first color component reference sample value and the second color component reference sample value; determines the prediction value of the second color component of the current block according to the mapping relationship and the first color component sample value of the current block.
  • the first reference prediction parameter set of the chrominance component can be determined, and the luminance component reference sample value and the chrominance component reference sample value of the current block can be determined according to the first reference prediction parameter set, so as to establish a mapping relationship between the luminance component and the chrominance component, and then use the mapping relationship to perform Prediction of chrominance components.
  • the correlation between the reconstructed samples in the current image and the current block samples is fully utilized here to improve the singleness of chrominance prediction, thereby improving the accuracy of chrominance prediction; and according to the established mapping relationship, pixel-level prediction can also be effectively performed, thereby further saving bit rate, improving encoding and decoding efficiency, and thus improving encoding and decoding performance.
  • the embodiment of the present application adds a new prediction mode BVG-LUT mode (i.e., Scheme 1).
  • the decoding code stream determines the prediction parameters of the current block.
  • the prediction parameters indicate that the current block uses the BVG LUT mode
  • the BV of the corresponding luminance block is obtained, and the luminance BV (BVL) is adjusted and applied to the chrominance to construct a candidate list of chrominance BV (BVC).
  • the BVC candidates in the candidate list of chrominance BVC are available: if available, enter the decision link; if not available, the BVC can be adjusted to available and then enter the decision link or discarded, and then the reconstructed luminance samples and reconstructed chrominance samples at the set position of the current block are directly used to construct the mapping relationship between the luminance component and the chrominance component, and then perform BV-based chrominance prediction.
  • FIG22 for a detailed flow diagram of an encoding method provided in an embodiment of the present application.
  • the detailed flow may include:
  • S2201 Determine whether the BVG-LUT mode is applied to the current block.
  • S2203 Construct a brightness BVL candidate list.
  • S2204 Construct a chroma BVC candidate list.
  • step S2201 if the judgment result is no, that is, the BVG-LUT mode is not applied to the current block, then step S2208 is executed; if the judgment result is yes, that is, the BVG-LUT mode is applied to the current block, then steps S2202 to S2207 are executed.
  • step S2205 if the judgment result is no, it is directly discarded, and then step S2207 is executed; if the judgment result is yes, step S2206 is executed to make a BV decision, and then step S2207 is executed.
  • the encoding method of the embodiment of the present application may specifically include:
  • the methods of obtaining include but are not limited to:
  • chromaPos (x, y)
  • scale chromaPos according to the chroma sampling format shown in Table 4
  • co-located luminance area position lumaPos (xCb, yCb) corresponding to the current chroma block.
  • the position of the co-located luminance pixel corresponding to the upper left corner of the current chroma coding block relative to the luminance pixel in the upper left corner of the image is (xCb, yCb)
  • the width of the co-located luminance area corresponding to the current chroma coding block is cbWidth
  • the height is cbHeight.
  • the center position block of the brightness area is the brightness block containing the position coordinates (xCb+cbWidth>>1, yCb+cbHeight>>1); multiple positions can be searched to the upper left, above, and left at this brightness block position, including but not limited to the following example search positions:
  • the brightness block used in the brightness area is the brightness block containing the position coordinates (xCb+cbWidth>>1+xOffset, yCb+cbHeight>>1+yOffset);
  • chromaPos (x, y)
  • scale chromaPos according to the chroma sampling format shown in Table 4
  • co-located luminance area position lumaPos (xCb, yCb) corresponding to the current chroma block.
  • the position of the co-located luminance pixel corresponding to the upper left corner of the current chroma coding block relative to the luminance pixel in the upper left corner of the image is (xCb, yCb)
  • the width of the co-located luminance area corresponding to the current chroma coding block is cbWidth
  • the height is cbHeight.
  • the upper left corner block of the luminance area is the luminance block containing the position coordinates (xCb, yCb); multiple positions can be searched to the upper left, above, and left at this luminance block position, including but not limited to the following example search positions:
  • the brightness block used in the brightness area is the brightness block containing the position coordinates (xCb+xOffset, yCb+yOffset).
  • chromaPos (x, y)
  • the position of the co-located luminance pixel corresponding to the upper left corner of the current chroma coding block relative to the luminance pixel in the upper left corner of the image is (xCb, yCb)
  • the width of the co-located luminance area corresponding to the current chroma coding block is cbWidth
  • the height is cbHeight.
  • the upper left corner block of the brightness area is the brightness block containing the position coordinates (xCb+cbWidth-1, yCb+cbHeight-1); multiple positions can be searched to the upper left, above, and left at this brightness block position, including but not limited to the following example search positions:
  • the brightness block used in the brightness area is the brightness block containing the position coordinates (xCb + cbWidth-1 + xOffset, yCb + cbHeight-1 + yOffset);
  • Method 4 In the block containing five brightness pixel positions shown in FIG. 11 (including but not limited to five positions, which may be multiple different positions), the positions are acquired sequentially, and the order of sequential acquisition includes but is not limited to the following order: C->TL->TR->BL->BR.
  • chromaPos (x, y)
  • scale chromaPos according to the chroma sampling format shown in Table 4
  • co-located luminance area position lumaPos (xCb, yCb) corresponding to the current chroma block.
  • the position of the co-located luminance pixel corresponding to the upper left corner of the current chroma coding block relative to the luminance pixel in the upper left corner of the image i.e., the position of the luminance pixel TL
  • the width of the co-located luminance area corresponding to the current chroma coding block is cbWidth
  • the height is cbHeight.
  • the coordinates of the position of the brightness pixel C are (xCb+cbWidth/2, yCb+cbHeight/2);
  • the coordinates of the position of the luminance pixel TL are (xCb, yCb);
  • the coordinates of the position of the brightness pixel TR are (xCb+cbWidth-1, yCb);
  • the coordinates of the position of the brightness pixel BL are (xCb, yCb+cbHeight-1);
  • the coordinates of the position of the brightness pixel BR are (xCb+cbWidth-1, yCb+cbHeight-1).
  • the brightness block used in the brightness area is the brightness block containing the coordinates of the position plus the position coordinates of the above offset position.
  • the BVL information encoded in the mode with BV information is scaled, that is, the chrominance BV information BVC is obtained by adopting the method of S3, and then the availability judgment of step S4 is performed. If available, this BVL information is added to the BVL list.
  • a chrominance BVC candidate list containing one or more candidates is constructed by adjusting BVL or BVC.
  • the construction method is as follows.
  • the candidate list can be constructed by using one of the methods, or multiple methods can be used at the same time.
  • Method 1 Scaling is performed according to the chroma sampling format shown in Table 8, and the scaled BVC is added to the chroma BVC candidate list.
  • Method 2 After obtaining the BV of the corresponding luminance block, record it as BVL, and the chrominance BV obtained through BVL is recorded as BVC. By adjusting BVL or BVC, a chrominance BVC candidate containing one or more candidates is constructed.
  • the candidate construction methods include but are not limited to the following:
  • Construction method 1 Adjust BVL to form four situations, and then adjust BVC.
  • BVL (BVL hor, BVL ver )
  • BVL (BVL hor +1, BVL ver )
  • BVL (BVL hor, BVL ver +1)
  • BVL (BVL hor +1, BVL ver +1).
  • BVL (BVL hor, BVL ver )
  • BVL (BVL hor +1, BVL ver )
  • BVL (BVL hor, BVL ver +1)
  • BVL (BVL hor +1, BVL ver +1).
  • BVC[0] BVL[0]*2/SubWidthC
  • BVC[1] BVL[1]*2/SubHeightC.
  • SubWidthC and SubHeightC are determined according to the corresponding relationship between sps_chroma_format_idc and the chroma format sampling structure in Table 1.
  • BVL is scaled to obtain BVC.
  • four BVC candidates are formed, and these candidates are added to the chrominance BVC candidate list.
  • one BVC is determined for each BVL using the S5 method.
  • Construction method 2 Adjust BVL to form four situations, and then adjust BVC.
  • BVL (BVL hor, BVL ver )
  • BVL (BVL hor +1, BVL ver )
  • BVL (BVL hor, BVL ver +1)
  • BVL (BVL hor +1, BVL ver +1).
  • BVL (BVL hor, BVL ver )
  • BVL (BVL hor -1, BVL ver )
  • BVL (BVL hor, BVL ver -1)
  • BVL (BVL hor, BVL ver -1)
  • BVL (BVL hor -1, BVL ver -1).
  • BVL is scaled according to the chroma sampling format in method 1 to obtain BVC, so that when BVL is an odd number or an even number, four BVC candidates are formed, and these candidates are added to the chroma BVC candidate list.
  • Construction method three Adjust BVL to form various situations, and then adjust BVC.
  • BVC is obtained by scaling BVL according to the chroma sampling format in method 1, so that when BVL is an odd number or an even number, multiple BVC candidates are formed, and these candidates are added to the chroma BVC candidate list.
  • Construction method 4 Adjust the BVC obtained in method 1 to obtain nine candidates.
  • Construction method 5 Adjust the BVC obtained in method 1 to obtain multiple candidates.
  • S5 is executed to make a BV decision. If none of them are available, the luminance and chrominance pixels of a set position are obtained, and the position includes but is not limited to a row and a column adjacent to the current block, and S6 is entered to establish a LUT using the template pixels.
  • the available BVC candidate list obtained in S4 contains only one BVC candidate, the BVC finally selected is this BVC.
  • the decision-making methods include but are not limited to the following methods:
  • the template can be classified into template types such as upper template, left template, upper right template, lower left template, and upper left template, as shown in Figure 14.
  • the template sizes of different types in different coding blocks can be fixed the same or different:
  • the template size selects the same template size for the current block of any size.
  • the following formula illustrates a setting condition for the template size, where nTbW and nTbH are the width and height of the current block, respectively, and iTempW and iTempH are the width and height of the adopted template, respectively:
  • nTbW and nTbH are the width and height of the current block, respectively
  • iTempW and iTempH are the width and height of the adopted template, respectively:
  • nTbW and nTbH are the width and height of the current block
  • nTbW ⁇ nTbH are the number of pixels in the current block
  • iTempW and iTempH are the width and height of the adopted template:
  • motion compensation is performed using the template of the current block to obtain the template corresponding to the BV, as shown in Figure 15.
  • the use of the template when calculating the cost has the following situations:
  • the first type the upper template and the left template of the current block both exist, and the upper template and the left template at the corresponding BV both exist. In this case, both the upper template and the left template are available.
  • the second method both the upper template and the left template of the current block exist, and only the upper template exists at the corresponding BV.
  • Method 2 If the left template at the corresponding BV does not exist, the leftmost template width column in the reference block is used instead of the left template, that is, the upper template and the left template are used for calculation.
  • the third type the upper template and the left template of the current block both exist, and only the left template exists at the corresponding BV.
  • Method 1 the upper template at the corresponding BV does not exist, so it is not used directly, that is, only the left template is used for calculation.
  • Method 2 the upper template at the corresponding BV does not exist, and the uppermost template height row inside the reference block is used to replace the upper template, that is, the upper template and the left template are used for calculation.
  • the fourth type only the upper template exists in the current block. There are three methods at this time: Method 1: The upper template at the corresponding BV does not exist, so it is not used directly. At this time, the BV finally selected is the first BVC in the BVC candidate list or the BVC at a specified position. Method 2: The upper template at the corresponding BV does not exist, and the uppermost template height row inside the reference block is used to replace the upper template. Method 3: The upper template at the corresponding BV exists, so it is used directly.
  • the fifth type only the left template exists in the current block. There are three methods at this time: Method 1: The left template at the corresponding BV does not exist, so it is not used directly. At this time, the final selected BV is the first BVC in the BVC candidate list or the BVC at a specified position. Method 2: The left template at the corresponding BV does not exist, and the leftmost template width column in the reference block is used to replace the left template. Method 3: The left template at the corresponding BV exists, so it is used directly.
  • the sixth type Neither the upper template nor the left template of the current block exists.
  • the BV finally selected is the first BVC in the BVC candidate list or a BVC at a specified position.
  • the cost function for calculating the template area cost for example, you can choose the sum of absolute difference (SAD), the sum of absolute difference (SATD), the sum of squared differences (SSE), the mean absolute difference (MAD), the mean absolute error (MAE), the mean squared error (MSE), the rate distortion function (RDO) and other evaluation criteria.
  • SAD sum of absolute difference
  • SSE sum of squared differences
  • MAD mean absolute difference
  • MAE mean absolute error
  • MSE mean squared error
  • RDO rate distortion function
  • predTempSizeW is the width of the template
  • predTempSizeH is the height of the template
  • predTemp[i][j] is the pixel point of the template at BV
  • recTempC[i][j] is the pixel point of the current block template.
  • the sorting method includes but is not limited to bubble sort, selection sort, insertion sort, shell sort, merge sort, quick sort, radix sort, heap sort, counting sort, bucket sort, etc.
  • the BVC with the smallest cost is selected as the final BV, so as to perform chromaticity prediction based on BV.
  • FIG23 is a schematic diagram of a chromaticity prediction process based on BV provided in an embodiment of the present application. As shown in FIG23 , the process may include:
  • chromaPos (x, y)
  • scale chromaPos according to the chroma sampling format shown in Table 4
  • co-located luminance area position lumaPos (xCb, yCb) corresponding to the current chroma block.
  • the reconstructed luminance samples corresponding to the position of the current chrominance block are set, including but not limited to a row and a column of samples adjacent to the same luminance area corresponding to the current chrominance block.
  • the brightness at the above position is downsampled to obtain a downsampled brightness sample, and the following sampling methods are used to compete or one sampling method is used by default.
  • the encoding end competition method includes but is not limited to the following methods:
  • Different sampling methods correspond to different brightness downsampling reconstruction values. Each sampling method is predicted, transformed, quantized, reconstructed, and calculated for distortion and bits, and then the optimal one is updated.
  • Different sampling methods correspond to different brightness downsampling reconstruction values. Each sampling method is predicted, and the distortion between the predicted value and the original value is calculated, including but not limited to SAD, SATD, etc. A downsampling method with the smallest distortion is selected, and the downsampling method is predicted, transformed, quantized, and reconstructed to calculate the distortion and bits.
  • each of downsampling methods 1 to 6 calculates the distortion between the predicted value and the original value, including but not limited to SAD, SATD, etc.
  • the distortions of 2 to 6 are compared with the distortion of 1 in turn. If scale*distortion(downsampling methods 2 to 6) ⁇ distortion(downsampling method 1), the value of scale includes but is not limited to 1, 1.5, 1.15, 1.3, etc., then the corresponding RDO times are increased.
  • BVL including but not limited to the center luminance block
  • BVC including but not limited to the center luminance block
  • the width of the storage buffer is iRecRefLumaStride
  • the brightness sample after downsampling is recBvAftDownLuma
  • the downsampled reconstructed luminance sample recBvAftDownLuma at the BV corresponding to the co-located luminance area corresponding to the current chrominance block is obtained.
  • reconstructed chroma samples at the set position of the current chroma block are obtained, including but not limited to a row and a column of samples adjacent to the current chroma block, including but not limited to only the left template and the upper template.
  • a luminance-to-chrominance mapping table LUT is established for the reconstructed luminance samples recBvAftDownLuma and the reconstructed chrominance samples recBvChroma obtained in S231 and the reconstructed luminance and chrominance samples at the set position, including but not limited to the following methods:
  • Brightness is the key and chroma is the value.
  • the sample range is [0,1023].
  • the key value recBvAftDownLuma it can be mapped to ranges such as [0,255] and [0,511] without any limitation.
  • entries with the same key value can be overwritten in sequence according to the sample order, or operations such as averaging can be taken.
  • the variable cIdx specifies the color component index of the current block, and the following prediction method is used:
  • Yc is not found in the input luminance set in the discrete mapping model established in S232, the following processing is included but not limited to: checking in the order of ⁇ Yc+1, Yc ⁇ 1, Yc+2, Yc ⁇ 2, Yc+3, Yc ⁇ 3 ⁇ . If the model cannot match all of the above values, the prediction is set to the average value of the reconstructed chrominance samples recBvChroma at the corresponding BV.
  • mapping table LUT is empty
  • the prediction methods include but are not limited to the following: filling with 512, using arbitrary angle prediction, etc.
  • the predicted value of the above implementation is modified to obtain a final predicted value, including but not limited to weighting with a CCLM-type model or other models.
  • multiple BVs are determined in step S5, and predictions based on the BVs are performed to obtain multiple prediction values. These multiple prediction values are then weighted to obtain a weighted prediction value, and the prediction value may also be further modified, including but not limited to weighting with a CCLM-type model or other models.
  • the improvement of the DM mode is modified (ie, solution 2).
  • solution 2 the improvement of the DM mode.
  • the current chrominance block is predicted using the BVG-LUT mode.
  • the chroma prediction mode derivation is shown in Table 9.
  • the chroma intra prediction mode IntraPredModeC[xCb][yCb] uses cclm_mode_flag, cclm_mode_idx, intra_chroma_pred_mode, lumaIntraPredMode and lumaTempPredMode specified in Table 9.
  • 0 represents Planar mode
  • 1 represents DC mode
  • 18 represents horizontal mode
  • 50 represents vertical mode
  • 81 to 83 represent CCLM mode.
  • IntraPredModeC[xCb][yCb] uses BVG-LUT.
  • Step S1 Obtain the center block and the extended position of the same brightness area.
  • the embodiment of the present application further provides a code stream organization method, which may include but is not limited to the following methods.
  • Method 1 Encoding inside MODE_INTRA. Here we only list one code stream parsing position for illustrative purposes only.
  • ModeIncludeBv is set, and if the corresponding luminance block is not encoded in a mode with BV information, ModeIncludeBv is equal to 0; otherwise ModeIncludeBv is equal to 1.
  • BvglutEnabled is equal to 1 if multiple of the following conditions are true at the same time (including but not limited to the following conditions):
  • ModeIncludeBv is equal to 1.
  • sh_slice_type is equal to I frame.
  • CtbLog2SizeC is less than or equal to MaxChromaIbcSize, where MaxChromaIbcSize can be determined according to the chroma CTU size or a preset value.
  • ModeIncludeBv being equal to 1 and/or sh_slice_type being equal to I frame may be omitted, and no limitation is made here.
  • bvglut_flag is 1, indicating that the current chrominance prediction mode is BVG-LUT, including but not limited to the following binarization methods, which can be encoded in context or bypass mode. For example, as shown in Table 11, Table 12, Table 13 or Table 14. Here, FL represents fixed length.
  • filter_idx includes but is not limited to the following binarization methods, and also includes but is not limited to being encoded in a context or bypass manner. For example, as shown in Table 15, Table 16, and Table 17.
  • Mode 2 Encoding in MODE_IBC.
  • the specific syntax elements are described in Table 18.
  • ModeIncludeBv is set, and if the corresponding luminance block is not encoded in a mode with BV information, ModeIncludeBv is equal to 0; otherwise ModeIncludeBv is equal to 1.
  • BvglutEnabled is equal to 1 if multiple of the following conditions are true at the same time (including but not limited to the following conditions):
  • ModeIncludeBv is equal to 1.
  • sh_slice_type is equal to I frame.
  • CtbLog2SizeC is less than or equal to MaxChromaIbcSize, where MaxChromaIbcSize can be determined according to the chroma CTU size or a preset value.
  • ModeIncludeBv being equal to 1 and/or sh_slice_type being equal to I frame may be omitted, and no limitation is made here.
  • pred_mode_ibc_flag is 1, indicating that the current chrominance prediction mode is BVG-LUT.
  • pred_mode_ibc_flag the syntax description in encoding is shown in Tables 19 and 20. Here, FL indicates fixed length.
  • Solution 2 Taking the use of multiple downsampling methods as an example, in the implementation, the specific syntax element description is shown in Table 21.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Image Processing (AREA)

Abstract

本申请公开了一种编解码方法、码流、编码器、解码器以及存储介质,该方法包括:确定当前块的预测参数;根据预测参数,确定当前块的第一参考预测参数集;其中,第一参考预测参数集包含一个或多个第一候选参考预测参数;根据第一参考预测参数集,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值;根据第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系;根据映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。这样,不仅可以改善色度预测的单一性,而且还可以提高色度预测的准确性,节省码率,进而提升编解码效率。

Description

编解码方法、码流、编码器、解码器以及存储介质 技术领域
本申请涉及视频编解码技术领域,尤其涉及一种编解码方法、码流、编码器、解码器以及存储介质。
背景技术
随着人们对视频显示质量要求的提高,高清和超高清视频等新视频应用形式应运而生。国际标准组织ISO/IEC和ITU-T的联合视频研究组(Joint Video Exploration Team,JVET)制定了视频编码标准H.266/多功能视频编码(Versatile Video Coding,VVC)。其中,帧内块拷贝(Intra block copy,IBC)是VVC针对屏幕内容类型的视频序列提供的一种块级的编码模式。
在相关技术中,对于直接模式(Direct Mode,DM)而言,如果亮度块使用IBC模式,那么获取的色度模式为DC模式,此时不能恰当地确定色度模式的帧内预测模式,导致当前块的色度预测不准确,损失了编码效率。
发明内容
本申请提供一种编解码方法、码流、编码器、解码器以及存储介质,不仅可以改善色度预测的单一性,而且还可以提高色度预测的准确性,节省码率,进而提升编解码效率。
本申请的技术方案可以如下实现:
第一方面,本申请实施例提供了一种解码方法,应用于解码器,该方法包括:
确定当前块的预测参数;
根据预测参数,确定当前块的第一参考预测参数集;其中,第一参考预测参数集包含一个或多个第一候选参考预测参数;
根据第一参考预测参数集,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值;
根据第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系;
根据映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。
第二方面,本申请实施例提供了一种编码方法,应用于编码器,该方法包括:
确定当前块的预测参数;
根据预测参数,确定当前块的第一参考预测参数集;其中,第一参考预测参数集包含一个或多个第一候选参考预测参数;
根据第一参考预测参数集,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值;
根据第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系;
根据映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。
第三方面,本申请实施例提供了一种码流,该码流是根据待编码信息进行比特编码生成的;其中,待编码信息包括下述至少一项:
当前块的第二颜色分量的残差值、滤波标识信息的取值、映射关系索引值、第一语法元素的取值和第二语法元素的取值;其中,滤波标识信息用于指示当前块的下采样方式,第一语法元素用于指示当前块是否使用第一预测模式,第二语法元素用于指示当前块是否允许使用第一预测模式。
第四方面,本申请实施例提供了一种编码器,包括第一确定单元和第一预测单元,其中:
所述第一确定单元,配置为确定当前块的预测参数;以及根据所述预测参数,确定所述当前块的第一参考预测参数集;其中,所述第一参考预测参数集包含一个或多个第一候选参考预测参数;
所述第一确定单元,还配置为根据所述第一参考预测参数集,确定所述当前块的第一颜色分量参考样值和第二颜色分量参考样值;以及根据所述第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系;
所述第一预测单元,配置为根据所述映射关系以及所述当前块的第一颜色分量样值,确定所述当前块的第二颜色分量的预测值。
第五方面,本申请实施例提供了一种编码器,包括第一存储器和第一处理器,其中:
第一存储器,用于存储能够在第一处理器上运行的计算机程序;
第一处理器,用于在运行计算机程序时,执行如第二方面所述的方法。
第六方面,本申请实施例提供了一种解码器,包括第二确定单元和第二预测单元,其中:
所述第二确定单元,配置为确定当前块的预测参数;以及根据所述预测参数,确定所述当前块的第一参考预测参数集;其中,所述第一参考预测参数集包含一个或多个第一候选参考预测参数;
所述第二确定单元,还配置为根据所述第一参考预测参数集,确定所述当前块的第一颜色分量参考样值和第二颜色分量参考样值;以及根据所述第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系;
所述第二预测单元,配置为根据所述映射关系以及所述当前块的第一颜色分量样值,确定所述当前块的第二颜色分量的预测值。
第七方面,本申请实施例提供了一种解码器,包括第二存储器和第二处理器,其中:
第二存储器,用于存储能够在第二处理器上运行的计算机程序;
第二处理器,用于在运行计算机程序时,执行如第一方面所述的方法。
第八方面,本申请实施例提供了一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,计算机程序被至少一个处理器执行时实现如第一方面所述的方法、或者如第二方面所述的方法。
本申请实施例提供了一种编解码方法、码流、编码器、解码器以及存储介质,无论是编码端还是解码端,确定当前块的预测参数;根据预测参数,确定当前块的第一参考预测参数集;其中,第一参考预测参数集包含一个或多个第一候选参考预测参数;根据第一参考预测参数集,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值;根据第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系;根据映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。这样,如果当前块使用BVG-LUT模式,那么可以确定应用色度分量的第一参考预测参数集,并根据第一参考预测参数集,确定当前块的亮度分量参考样值和色度分量参考样值,以此建立亮度分量与色度分量之间的映射关系,然后利用该映射关系进行色度分量的预测。也就是说,这里充分利用了当前图像中已重建样本与当前块样本之间的相关性,改善了色度预测的单一性,从而能够提高色度预测的准确性;而且根据所建立的映射关系,还可以有效进行像素级的预测,从而能够进一步节省码率,提高编解码效率,进而提升编解码性能。
附图说明
图1为一种基于IBC模式获取重建样本的流程示意图;
图2为本申请实施例提供的一种相邻块的位置分布示意图;
图3为本申请实施例提供的一种亮度块与色度块的位置关系示意图一;
图4A为本申请实施例提供的一种编码器的组成框图示意图;
图4B为本申请实施例提供的一种解码器的组成框图示意图;
图5为本申请实施例提供的一种编解码系统的网络架构示意图;
图6为本申请实施例提供的一种解码方法的流程示意图一;
图7为本申请实施例提供的一种解码方法的流程示意图二;
图8为本申请实施例提供的一种解码方法的流程示意图三;
图9为本申请实施例提供的一种亮度块与色度块的位置关系示意图二;
图10为本申请实施例提供的一种亮度块与色度块的位置关系示意图三;
图11为本申请实施例提供的一种亮度块与色度块的位置关系示意图四;
图12为本申请实施例提供的一种偏移位置是否未覆盖当前块的结构示意图;
图13为本申请实施例提供的一种偏移位置是否超出预设可用区域的结构示意图;
图14为本申请实施例提供的一种模板的类型示意图;
图15为本申请实施例提供的一种模板的运动补偿示意图;
图16为本申请实施例提供的一种同位亮度区域及参考亮度区域的位置示意图;
图17A为本申请实施例提供的一种下采样示意图一;
图17B为本申请实施例提供的一种下采样示意图二;
图17C为本申请实施例提供的一种下采样示意图三;
图17D为本申请实施例提供的一种下采样示意图四;
图17E为本申请实施例提供的一种下采样示意图五;
图17F为本申请实施例提供的一种下采样示意图六;
图18为本申请实施例提供的一种解码方法的流程示意图四;
图19为本申请实施例提供的一种解码方法的流程示意图五;
图20为本申请实施例提供的一种编码方法的流程示意图一;
图21为本申请实施例提供的一种编码方法的流程示意图二;
图22为本申请实施例提供的一种编码方法的详细流程示意图;
图23为本申请实施例提供的一种基于BV的色度预测流程示意图;
图24为本申请实施例提供的一种编码器的组成结构示意图;
图25为本申请实施例提供的一种编码器的具体硬件结构示意图;
图26为本申请实施例提供的一种解码器的组成结构示意图;
图27为本申请实施例提供的一种解码器的具体硬件结构示意图;
图28为本申请实施例提供的一种编解码系统的组成结构示意图。
具体实施方式
为了能够更加详尽地了解本申请实施例的特点与技术内容,下面结合附图对本申请实施例的实现进行详细阐述,所附附图仅供参考说明之用,并非用来限定本申请实施例。
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中所使用的术语只是为了描述本申请实施例的目的,不是旨在限制本申请。
在以下的描述中,涉及到“一些实施例”,其描述了所有可能实施例的子集,但是可以理解,“一些实施例”可以是所有可能实施例的相同子集或不同子集,并且可以在不冲突的情况下相互结合。还需要指出,本申请实施例所涉及的术语“第一\第二\第三”仅是用于区别类似的对象,不代表针对对象的特定排序,可以理解地,“第一\第二\第三”在允许的情况下可以互换特定的顺序或先后次序,以使这里描述的本申请实施例能够以除了在这里图示或描述的以外的顺序实施。
对本申请实施例进行进一步详细说明之前,先对本申请实施例中涉及的名词和术语进行说明,本申请实施例中涉及的名词和术语适用于如下的解释:
编码块(Coding Block,CB);
帧内块拷贝(Intra block copy,IBC);
屏幕内容编码(Screen Content Coding,SCC);
块匹配(Block Matching,BM);
编码单元(Coding Unit,CU);
块向量(Block Vector,BV);
运动向量(Motion Vector,MV);
直接块矢量(Direct Block Vector,DBV);
BV引导的查表法(Block Vector Guided LUT,BVG-LUT);
高级运动矢量预测(IBC Advanced Motion Vector Prediction,AMVP);
分量间线性模型预测(Cross-Component Linear Model prediction,CCLM);
合并模式(MERGE Mode);
平面模式(PLANAR Mode);
绝对误差和(Sum of Absolute Difference,SAD);
绝对变换误差和(Sum of Absolute Transformed Difference,SATD);
均方误差(Mean Squared Error,MSE);
均方根误差(Root Mean Square Error,RMSE);
平均绝对误差(Mean Absolute Error,MAE);
平均绝对离差(Mean Absolute Deviation,MAD);
H.266/多功能视频编码(Versatile Video Coding,VVC);
VVC的参考软件测试平台(VVC Test Model,VTM)。
可以理解,在视频图像中,一般采用第一颜色分量、第二颜色分量和第三颜色分量来表征编码块。其中,这三个颜色分量分别为一个亮度分量、一个蓝色色度分量和一个红色色度分量,具体地,亮度分量通常使用符号Y表示,蓝色色度分量通常使用符号Cb或者U表示,红色色度分量通常使用符号Cr或者V表示;这样,视频图像可以用YCbCr格式表示,也可以用YUV格式表示。
还可以理解,IBC是VVC针对屏幕内容类型的视频序列编码的扩展工具,它显著提高了屏幕内容 序列的编码效率。具体地,IBC是一种块级的编码模式,和帧间技术类似,编码端执行运动搜索,具体是通过块匹配为当前编码块寻找到其最佳的块向量,也可以称为运动向量。其中,块向量是从当前块指向参考块的向量。和帧间技术不同的地方在于,IBC的最佳块向量是在当前块所处图像(即当前编码图像)的重建区域搜索得到的,而帧间的运动向量是对当前编码图像外的其他参考图像(例如,当前编码图像在时间域上的参考图像)搜索得到的。
在H.266/VVC中,IBC模式下获取当前块的重建值的具体过程可以包括:推导块向量、利用块向量推导预测样本、推导残差样本和利用预测样本以及残差样本推导重建样本。
在一种具体的实现方式中,对于IBC模式下获取重建样本的流程,如图1所示,该流程可以包括:
S101:推导块向量。
对于亮度分量而言,输入包括:亮度位置(xCb,yCb),指定当前块的左上角样本相对于当前图像的左上角亮度样本;一个变量cbWidth,指定亮度样本中当前块的宽度;一个变量cbHeight,指定亮度样本中当前块的高度。输出包括:亮度的bvL(Block Vector for Luma samples)。需要说明的是,包含亮度样本的当前块又可称为“亮度块”。
在这里,IBC模式分为IBC MERGE模式和IBC AMVP模式,在推导bvL的时候均需要建立IBC块向量候选列表bvCandList,下面将针对IBC MERGE列表的建立流程进行详细介绍,其中,IBC AMVP列表的建立流程与IBC MERGE列表一致,但两者的最大候选数量可以不同。
步骤一:当IsGt4by4等于TRUE时(变量IsGt4by4为当亮度块的宽度乘以高度大于16时为TRUE),根据亮度块位置(xCb,yCb)、亮度块的宽度cbWidth和高度cbHeight,确定相邻编码单元的空间块的可用性以及块向量候选,对应设置相邻块的可用性标志availableFlagA1、availableFlagB1和块向量bvA1和bvB1。其中,A1和B1所在的相邻块与当前块的相对位置如图2所示。
步骤二:当IsGt4by4等于TRUE时,对于块向量候选列表bvCandList的构造,伪代码如下:
步骤三:变量numCurrCand(当前已经得到的候选数量)推导过程如下:
若IsGt4by4等于TRUE,numCurrCand设置为等于bvCandList中的候选数;否则numCurrCand设置为0。
步骤四:当numCurrCand小于MaxNumIbcMergeCand(MERGE模式下的最大候选数量)、且NumHmvpIbcCand(IBC模式下的历史最优块向量Hmvp的最大候选数量)大于0时,以bvCandList和numCurrCand作为输入,修改后的bvCandList和numCurrCand作为输出,调用解码规范所规定的基于历史的IBC块向量候选的推导过程。
步骤五:当numCurrCand小于MaxNumIbcMergeCand时,以下适用直至numCurrCand等于MaxNumIbcMergeCand:
bvCandList[numCurrCand][0]设置为等于0(BV的水平分量);
bvCandList[numCurrCand][1]设置为等于0(BV的垂直分量);
numCurrCand增加1。
这样,块向量候选列表bvCandList建立完成,候选的索引bvIdx采用如下方式推导,general_merge_flag表示是否为IBC MERGE模式:
bvIdx=general_merge_flag[xCb][yCb]?merge_idx[xCb][yCb]:mvp_l0_flag[xCb][yCb]
这样,根据索引bvIdx以及块向量候选列表bvCandList就可以得到具体的bvL:
bvL[0]=bvCandList[bvIdx][0];
bvL[1]=bvCandList[bvIdx][1]。
对于IBC AMVP模式,通过索引bvIdx以及块向量候选列表bvCandList就可以得到具体的bvL为预测bvL,而真实bvL还需要加上块向量差异(Block Vector Difference,BVD),其具体流程如下:
步骤一:得到BVD的水平和垂直分量。其中,MvdL0为前向运动向量差异,BVD的水平分量用bvd[0]表示,BVD的垂直分量用bvd[1]表示,具体如下:
bvd[0]=MvdL0[xCb][yCb][0];
bvd[1]=MvdL0[xCb][yCb][1]。
步骤二:对上述获取的预测bvL进行舍入操作。其中,右移参数AmvrShift进行舍入,左移参数AmvrShift用于提高分辨率。具体如下:
Offset=(AmvrShift==0)?0:((1<<(AmvrShift-1))-1);
bvL[0]=Sign(bvL[0])*(((Abs(bvL[0])+offset)>>AmvrShift)<<AmvrShift);
bvL[1]=Sign(bvL[1])*(((Abs(bvL[1])+offset)>>AmvrShift)<<AmvrShift)。
步骤三:对于真实bvL,其范围需要控制在-217到217–1之间,具体推导过程如下:
u[0]=(bvL[0]+bvd[0]+218)%218
bvL[0]=(u[0]>=217)?(u[0]-218):u[0];
u[1]=(bvL[1]+bvd[1]+218)%218
bvL[1]=(u[1]>=217)?(u[1]-218):u[1]。
对于色度分量而言,如果是双树划分,色度分量不执行IBC;如果是单树划分,需要推导色度分量的BV。
其中,输入包括:亮度的bvL(1/16像素精度)。输出包括:色度块向量(Block Vector Chroma,bvC)(1/32像素精度)。具体推导过程如下:
bvC[0]=((bvL[0]>>(3+SubWidthC))*32);
bvC[1]=((bvL[1]>>(3+SubHeightC))*32)。
S102:利用块向量推导预测样本。
在这里,输入包括:亮度位置(xCb,yCb),指定当前块的左上角样本相对于当前图像的左上角亮度样本;一个变量cbWidth,指定亮度样本中当前块的宽度;一个变量cbHeight,指定亮度样本中当前块的高度;块向量BV;一个变量cIdx,指定当前块的颜色分量索引。输出包括:预测样本的数组predSamples。
对于预测样本而言,具体推导过程如下:
当cIdx等于0即为亮度分量的时候,对于x=xCb…xCb+cbWidth-1以及y=yCb…yCb+cbHeight–1:
xVb=(x+(bv[0]>>4))&(IbcBufWidthY-1);
yVb=(y+(bv[1]>>4))&(CtbSizeY-1);
predSamples[x][y]=ibcVirBuf[0][xVb][yVb]。
其中,IbcBufWidthY为IBC存储的重建缓存单元(Buffer)的亮度像素的宽度,CtbSizeY为CTU(Coding Tree Unit)的大小,ibcVirBuf为IBC存储的重建像素。
当cIdx不等于0即为色度分量时,对于x=xCb/SubWidthC…xCb/SubWidthC+cbWidth/SubWidthC-1以及y=yCb/SubHeightC…yCb/SubHeightC+cbHeight/SubHeightC-1:
xVb=(x+(bv[0]>>(3+SubWidthC)))&(IbcBufWidthC-1);
yVb=(y+(bv[1]>>(3+SubHeightC)))&((CtbSizeY/subHeightC)-1);
predSamples[x][y]=ibcVirBuf[cIdx][xVb][yVb]。
其中,变量SubWidthC和SubHeightC具体取决于通过sps_chroma_format_idc指定的颜色采样格式,具体对应关系如表1所示。
表1
S103:推导残差样本。
解码码流,确定当前块的残差样本。
S104:利用预测样本以及残差样本推导重建样本。
根据当前块的预测样本和残差样本,确定当前块的重建样本。例如,计算当前块的预测样本与残差的和值,将当前块的重建样本设置设置为等于该和值;其中,所述计算过程包括对和值进行限制在预设取值范围内的操作,所述预设取值范围根据重建样本的比特深度确定。
在另一种具体的实现方式中,对于H.266/VVC中的色度预测模式的推导过程,输入包括:亮度位置(xCb,yCb),指定当前块的左上角样本相对于当前图像的左上角亮度样本;一个变量cbWidth,指定亮度样本中当前块的宽度;一个变量cbHeight,指定亮度样本中当前块的高度;变量treeType,指定是使用单树划分还是双树划分。输出包括:色度帧内预测模式IntraPredModeC[xCb][yCb]和MIP色度直接模式标志MipChromaDirect Flag[xCb][yCb]。
若treeType等于SINGLE_TREE,即单树划分的情况下,sps_chroma_format_idc等于3,即YUV444格式(4:4:4格式),intra_chroma_pred_mode等于4,并且IntraMipFlag[xCb][yCb]等于1,即对应同位亮度中心块的预测模式为MIP模式,则:
①MIP色度直接模式标志MipChromaDirectFlag[xCb][yCb]设置为等于1,即色度使用亮度的MIP模式。
②色度帧内预测模式IntraPredModeC[xCb][yCb]设置为等于IntraPredModeY[xCb][yCb]。
否则:
①MIP色度直接模式标志MipChromaDirectFlag[xCb][yCb]设置为等于0。
②对应的亮度帧内预测模式lumaIntraPredMode推导如下:
若IntraMipFlag[xCb+cbWidth/2][yCb+cbHeight/2]等于1,则lumaIntraPredMode设置为等于INTRA_PLANAR。
否则,若CuPredMode[0][xCb+cbWidth/2][yCb+cbHeight/2]等于MODE_IBC或MODE_PLT,则将lumaIntraPredMode设置为等于INTRA_DC。
注:在ECM中新引入了IntraTmp模式,如果CuPredMode[0][xCb+cbWidth/2][yCb+cbHeight/2]等于MODE_INTRA,而且是IntraTmp模式,则将lumaIntraPredMode设置为等于INTRA_PLANAR。
否则,lumaIntraPredMode设置为等于IntraPredModeY[xCb+cbWidth/2][yCb+cbHeight/2]。
③色度帧内预测模式IntraPredModeC[xCb][yCb]推导如下:
若cu_act_enabled_flag[xCb][yCb]等于1,则色度帧内预测模式IntraPredModeC[xCb][yCb]设置为等于lumaIntraPredMode。
否则:
若BdpcmFlag[xCb][yCb][1]等于1,则IntraPredModeC[xCb][yCb]设置为等于BdpcmDir[xCb][yCb][1]?INTRA_ANGULAR50:INTRA_ANGULAR18。
否则cu_act_enabled_flag[xCb][yCb]等于0并且BdpcmFlag[xCb][yCb][1]等于0,色度帧内预测模式IntraPredModeC[xCb][yCb]使用cclm_mode_flag、cclm_mode_idx、表2中指定的intra_chroma_pred_mode和lumaIntraPredMode。
表2
当sps_chroma_format_idc等于2时,使用表2中的色度帧内预测模式X可以推导出色度帧内预测模式Y,具体参见表3所示的模式X到模式Y的映射过程规范,然后将色度帧内预测模式X设置为等于色度帧内预测模式Y。
表3
在又一种具体的实现方式中,对于DM模式而言,DM模式指的是直接使用对应位置的亮度预测模式信息:
当I帧使用双树划分时,允许亮度分量和色度分量使用独立的块划分结构,如H.266/VVC中的Dual Tree模式。此时,色度编码块对应位置的亮度分量可能包含多个亮度编码块,如图3所示,在H.266/VVC中,在intra_chroma_pred_mode的值等于4时,指示当前色度块使用DM模式进行解码。
根据色度块对应同位置亮度区域的中心位置亮度块的帧内预测模式,确定所述色度块的帧内预测模式。确定方式可以是直接使用亮度块的帧内预测模式,或者进一步推导得到的帧内预测模式。
在实际实施中,可以根据色度块对应同位置亮度区域的中心位置坐标作为参考点,以包含该参考点的亮度块的帧内预测模式,来确定所述色度块的帧内预测模式。确定方式可以是直接使用亮度块的帧内预测模式,或者进一步推导得到的帧内预测模式。
另外,在本申请实施例中,这里提及的块可以是一个CU,或者一个子块,或者一个变换块等,对此不作任何限定。
其中,DM模式所取编码块位置具体描述如下:
获取当前色度块的位置,即当前色度块的左上角色度样本相对于当前图片的左上角色度样本的位置,chromaPos=(x,y),根据如表4所示的颜色采样格式对chromaPos进行缩放,得到当前色度块对应的同位亮度区域位置lumaPos=(xCb,yCb)。
表4
亮度位置(xCb,yCb),指定当前色度块对应的亮度区域的左上角亮度样本相对于当前图像的左上角亮度样本的位置;一个变量cbWidth,指定亮度样本中当前块的宽度;一个变量cbHeight,指定亮度样本中当前块的高度。
当前色度块及对应的亮度区域的位置关系如图3所示,当前色度CU对应的亮度区域的中心亮度像素位置描述如下,其中,xCenter表示水平坐标位置,yCenter表示垂直坐标位置,包含该像素位置的编码块为色度块对应亮度块中心位置的块:
xCenter=xCb+cbWidth>>1;
yCenter=yCb+cbHeight>>1。
在又一种具体的实现方式中,对于H.266/VVC中色度预测的解码过程,与其解码相关的语法元素如表5所示。另外,对于语法元素intra_chroma_pred_mode的取值,其对应的二值化字符串(Bin string)如表6所示;对于不同的语法元素(例如cclm_mode_flag、cclm_mode_idx和intra_chroma_pred_mode等),每一位编码比特所采用的编码方式具体如表7所示。
表5
表6
表7

其中,binIdx表示比特位数,若binIdx=0,则表示第0位比特;若binIdx=1,则表示第1位比特。另外,bypass表示旁路模式,na表示不作处理。
相关技术中,在双树划分下:对于DM模式,如果对应亮度块为IBC模式,那么获取的色度预测模式为DC模式,此时损失了编码效率。即在色度预测过程中,没有利用当前图像中已重建样本与当前编码块样本之间的相关性,导致了编码效率的损失。
基于此,本申请实施例提供了一种编解码方法,确定当前块的预测参数;根据预测参数,确定当前块的第一参考预测参数集;其中,第一参考预测参数集包含一个或多个第一候选参考预测参数;根据第一参考预测参数集,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值;根据第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系;根据映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。
这样,如果当前块使用BVG-LUT模式,那么可以确定应用色度分量的第一参考预测参数集,并根据第一参考预测参数集,确定当前块的亮度分量参考样值和色度分量参考样值,以此建立亮度分量与色度分量之间的映射关系,然后利用该映射关系进行色度分量的预测。也就是说,这里充分利用了当前图像中已重建样本与当前块样本之间的相关性,改善了色度预测的单一性,从而能够提高色度预测的准确性;而且根据所建立的映射关系,还可以有效进行像素级的预测,从而能够进一步节省码率,提高编解码效率,进而提升编解码性能。
下面将结合附图对本申请各实施例进行详细说明。
参见图4A,其示出了本申请实施例提供的一种编码器的组成框图示意图。如图4A所示,编码器100可以包括变换与量化单元101、帧内估计单元102、帧内预测单元103、运动补偿单元104、运动估计单元105、反变换与反量化单元106、滤波器控制分析单元107、滤波单元108、编码单元109和解码图像缓存单元110等,其中,滤波单元108可以实现去方块滤波及样本自适应缩进(Sample Adaptive Offset,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存储用于后续帧内预测或运动补偿的参考图像,同时也用于视频信号的输出,即得到了所恢复的原始视频信号。
进一步地,本申请实施例还提供了一种包含编码器和解码器的编解码系统的网络架构,其中,图5示出了本申请实施例提供的一种编解码系统的网络架构示意图。如图5所示,该网络架构包括一个或多个电子设备13至1N和通信网络01,其中,电子设备13至1N可以通过通信网络01进行视频交互。电子设备在实施的过程中可以为各种类型的具有视频编解码功能的设备,例如,所述电子设备可以包括智能手机、平板电脑、个人计算机、个人数字助理、导航仪、数字电话、视频电话、电视机、传感设备、服务器等,这里不作任何限定。
需要说明的是,本申请实施例中的解码器或编码器就可以为上述电子设备。其中,编码器也可称为“视频编码器”或者“图像编码器”,解码器也可称为“视频解码器”或者“图像解码器”。
还需要说明的是,本申请实施例的编解码方法主要应用在如图4A所示的帧内预测单元103部分和如图4B所示的帧内预测单元203部分。也就是说,本申请实施例既可以应用于编码器,也可以应用于解码器,甚至还可以同时应用于编码器和解码器,但是本申请实施例不作任何限定。
还需要说明的是,当应用于帧内预测单元103部分时,“当前块”具体是指当前待进行帧内预测的编码块;当应用于帧内预测单元203部分时,“当前块”具体是指当前待进行帧内预测的解码块。
在本申请的一实施例中,图6为本申请实施例提供的一种解码方法的流程示意图一。如图6所示,该方法可以包括:
S601,确定当前块的预测参数。
需要说明的是,本申请实施例的解码方法应用于解码器。另外,该解码方法具体可以是指一种帧内预测方法,更具体地,是一种基于块向量的色度预测方法。其中,视频图像可以划分为多个解码块,每个解码块可以包括第一颜色分量、第二颜色分量和第三颜色分量,而本申请实施例中的当前块是指视频图像中当前待进行色度预测的解码块。
在这里,如果当前块进行第一颜色分量的预测,而且第一颜色分量为亮度分量,那么当前块也可以称为亮度块;或者,如果当前块进行第二颜色分量的预测,而且第二颜色分量为色度分量,那么当前块也可以称为色度块。
还需要说明的是,在本申请实施例中,对于预测参数来说,预测参数可以用于指示当前块是否使用第一预测模式。在一些实施例中,该方法可以包括:解码码流,确定当前块的预测参数。
在本申请实施例中,若预测参数的取值为第一值,则确定当前块使用第一预测模式;若预测参数的取值为第二值,则确定当前块不使用第一预测模式。
在一些实施例中,对于预测参数来说,该方法还可以包括:解码码流,确定第一语法元素的取值;根据第一语法元素的取值,确定当前块的预测参数。
需要说明的是,在本申请实施例中,第一语法元素可以用intra_bvglut_flag表示,或者也可以用bvglut_flag表示。其中,第一语法元素可以用于指示当前块是否使用第一预测模式。在这里,若第一语法元素的取值为第一值,则确定当前块使用第一预测模式;若第一语法元素的取值为第二值,则确定当前块不使用第一预测模式。
还需要说明的是,在本申请实施例中,根据第一语法元素的取值,确定当前块的预测参数,可以包括:将预测参数的取值设置为等于第一语法元素的取值。
还需要说明的是,在本申请实施例中,第一值与第二值不同。其中,第一值可以设置为1,第二值可以设置为0;或者,第一值可以设置为0,第二值可以设置为1;或者,第一值可以设置为真(true),第二值可以设置为假(false);或者,第一值可以设置为假(false),第二值可以设置为真(true)。
在一种具体的实施例中,第一值设置为1,第二值设置为0。示例性地,如果第一语法元素的取值为1,则表明预测参数指示当前块使用第一预测模式,此时继续执行本申请实施例的解码方法;否则,如果第一语法元素的取值为0,则表明预测参数指示当前块不使用第一预测模式,此时可以采用相关技术中的其他预测模式(例如PLANAR模式、CCLM模式、角度预测模式等)进行解码处理。
S602,根据预测参数,确定当前块的第一参考预测参数集;其中,第一参考预测参数集包含一个或多个第一候选参考预测参数。
需要说明的是,在本申请实施例中,在预测参数指示当前块使用第一预测模式时,确定当前块的第一参考预测参数集。其中,第一预测模式可以为BVG-LUT模式。也就是说,对于当前块来说,如果当 前块使用BVG-LUT模式,则可以确定当前块的第一参考预测参数集。
在一些实施例中,确定当前块的第一参考预测参数集,如图7所示,该方法可以包括:
S701,确定当前块的第一颜色分量块。
S702,根据第一颜色分量块,确定当前块的第二参考预测参数集。
S703,根据第二参考预测参数集,确定当前块的第一参考预测参数集。
需要说明的是,在本申请实施例中,第一参考预测参数集可以包含一个或多个第一候选参考预测参数。其中,第一候选参考预测参数可以为基于第二颜色分量的向量参数。
还需要说明的是,在本申请实施例中,第二参考预测参数集可以包含一个或多个第二候选参考预测参数。其中,第二候选参考预测参数可以为基于第一颜色分量的向量参数。
示例性地,第一颜色分量可以为亮度分量,第二颜色分量可以为色度分量,那么第一候选参考预测参数可以为基于色度分量的向量参数,第二候选参考预测参数可以为基于亮度分量的向量参数。
在一些实施例中,向量参数包括下述其中之一:块向量参数、运动向量参数。也就是说,无论是第一参考预测参数集还是第二参考预测参数集,均可以为应用于BV的参数列表,或者也可以为应用于MV的参数列表。
在一种具体的实施例中,以BV为例,这里的“第一参考预测参数”可以为基于色度分量的块向量参数,那么第一参考预测参数集可以称为色度BVC候选列表;这里的“第二参考预测参数”可以为基于亮度分量的块向量参数,那么第二参考预测参数集可以称为亮度BVL候选列表。
在一些实施例中,确定当前块的第一颜色分量块,如图8所示,该方法可以包括:
S801,确定当前块的同位置的第一颜色分量区域。
S802,基于第一颜色分量区域的多个划分块,确定处于第一位置的第一候选块。
S803,在第一位置的预设搜索区域进行位置偏移搜索,确定多个第二候选块。
S804,根据第一候选块和/或多个第二候选块,确定当前块的第一颜色分量块。
需要说明的是,在本申请实施例中,首先确定当前块的同位置的第一颜色分量区域;然后基于第一颜色分量区域的多个划分块,确定当前块的第一颜色分量块。
需要说明的是,在本申请实施例中,如果第一颜色分量为亮度分量,那么第一颜色分量区域也可称为“同位亮度区域”。例如,如果当前块为色度块,那么同位亮度区域可以是指当前块对应的同位置亮度区域。对于当前块而言,在同位置的第一颜色分量区域,可以对其进行块划分,例如采用二叉树结构、三叉树结构、四叉树结构等进行块划分,能够得到多个块,每一个块可以看作是一个CU、一个子块或者一个变换块等;然后从这多个划分块中确定出当前块的第一颜色分量块。
示例性地,以图3为例,用斜线填充的区域表示色度分量对应的同位亮度区域。在该同位亮度区域中,可以划分有多个块;可以从这些块中选取中心位置的块作为当前块的对应亮度块,例如图3中用黑色填充的块即为当前块的对应亮度块(第一颜色分量块)。
在一种具体的实施例中,对于确定当前块的第一颜色分量块,该方法可以包括:从第一颜色分量区域的多个划分块中,确定处于第一位置的第一候选块;根据处于第一位置的第一候选块,确定当前块的第一颜色分量块。
在本申请实施例中,第一位置可以是指第一颜色分量区域的任意位置。示例性地,第一位置可以为第一颜色分量区域中的中心位置、左上角位置、右下角位置、特定位置等。
在本申请实施例中,第一候选块可以是指处于第一位置的块。在一种具体的实施例中,将第一颜色分量区域中处于中心位置的块选取为第一候选块;和/或,将第一颜色分量区域中处于左上角位置的块选取为第一候选块;和/或,将第一颜色分量区域中处于右下角位置的块选取为第一候选块,等等,这里不作任何限定。
进一步地,在一些实施例中,根据处于第一位置的第一候选块,确定当前块的第一颜色分量块,该方法可以包括:在第一位置的预设搜索区域进行位置偏移搜索,确定多个第二候选块;根据第一候选块和/或多个第二候选块,确定当前块的第一颜色分量块。
在本申请实施例中,在第一位置的预设搜索区域进行位置偏移搜索,可以是在第一位置的基础上向左上、上、左等方向搜索多个位置,例如可以获取第一位置的向左上坐标偏移(xOffset,yOffset)=(-2,-2),向上坐标偏移(xOffset,yOffset)=(0,-2),向左坐标偏移(xOffset,yOffset)=(-2,0)等,这里不作任何限定。
在一些实施例中,确定当前块的第一颜色分量块,可以包括:确定当前块的位置信息;根据预设采样格式对当前块的位置信息进行缩放处理,得到当前块对应的同位区域位置信息;根据同位区域位置信息确定目标位置信息,将包含目标位置信息的候选块作为当前块的第一颜色分量块。
在一些实施例中,根据同位区域位置信息确定目标位置信息,可以包括:根据同位区域位置信息进 行中心位置计算,将所得到的中心位置信息作为目标位置信息;或者,根据同位区域位置信息进行左上角位置计算,将所得到的左上位置信息作为目标位置信息;或者,根据同位区域位置信息进行右下角位置计算,将所得到的左下位置信息作为目标位置信息。
在本申请实施例中,预设采样格式可以为色度采样格式(或称为颜色采样格式)。示例性地,当前块的位置(x,y)与同位区域位置(xCb,yCb)之间的映射关系如表4所示。
在一种可能的实现方式中,获取当前块的位置,即当前块的左上角色度样本相对于当前图像的左上角色度样本的位置,chromaPos=(x,y),根据表4所示的色度采样格式对chromaPos进行缩放,得到当前块对应的同位亮度区域位置lumaPos=(xCb,yCb)。
在这里,假设当前块左上角对应的同位亮度像素相对于图像左上角亮度像素的位置为(xCb,yCb),当前块对应的同位亮度区域(即图3中亮度分量的整个斜线填充区域)的宽度为cbWidth,高度为cbHeight;那么处于中心位置的块(亮度区域中心位置块),即为包含中心坐标(xCb+cbWidth>>1,yCb+cbHeight>>1)的亮度块,也即在图3中用黑色填充的块。其中,在图3中,白色小块表示中心坐标的位置,可以用于定位该亮度块的位置。
在这里,对于多个第二候选块,在该亮度块位置上可以向左上、上和左搜索多个位置,包括但不限于以下示例性的搜索位置:获取同位亮度区域中心位置的向左上坐标偏移(xOffset,yOffset)=(-2,-2),向上坐标偏移(xOffset,yOffset)=(0,-2),向左坐标偏移(xOffset,yOffset)=(-2,0)。亮度区域所采用亮度块即为包含位置坐标(xCb+cbWidth>>1+xOffset,yCb+cbHeight>>1+yOffset)的亮度块。
在另一种可能的实现方式中,获取当前块的位置,即当前块的左上角色度样本相对于当前图像的左上角色度样本的位置,chromaPos=(x,y),根据表4所示的色度采样格式对chromaPos进行缩放,得到当前块对应的同位亮度区域位置lumaPos=(xCb,yCb)。
在这里,假设当前块左上角对应的同位亮度像素相对于图像左上角亮度像素的位置为(xCb,yCb),当前块对应的同位亮度区域(即图9中亮度分量的整个斜线填充区域)的宽度为cbWidth,高度为cbHeight;那么处于左上角位置的块(亮度区域左上角块),即为包含左上角坐标(xCb,yCb)的亮度块,也即在图9中用黑色填充的块。其中,在图9中,白色小块表示左上角坐标的位置,可以用于定位该亮度块的位置。
在这里,对于多个第二候选块,在该亮度块位置上可以向左上、上和左搜索多个位置,包括但不限于以下示例性的搜索位置:获取同位亮度区域左上角位置的向左上坐标偏移(xOffset,yOffset)=(-2,-2),向上坐标偏移(xOffset,yOffset)=(0,-2),向左坐标偏移(xOffset,yOffset)=(-2,0)。亮度区域所采用亮度块即为包含位置坐标(xCb+xOffset,yCb+yOffset)的亮度块。
在又一种可能的实现方式中,获取当前块的位置,即当前块的左上角色度样本相对于当前图像的左上角色度样本的位置,chromaPos=(x,y),根据表4所示的色度采样格式对chromaPos进行缩放,得到当前块对应的同位亮度区域位置lumaPos=(xCb,yCb)。
在这里,假设当前块左上角对应的同位亮度像素相对于图像左上角亮度像素的位置为(xCb,yCb),当前块对应的同位亮度区域(即图10中亮度分量的整个斜线填充区域)的宽度为cbWidth,高度为cbHeight;那么处于右下角位置的块(亮度区域右下角块),即为包含右下角坐标(xCb+cbWidth-1,yCb+cbHeight-1)的亮度块,也即在图10中用黑色填充的块。其中,在图10中,白色小块表示右下角坐标的位置,可以用于定位该亮度块的位置。
在这里,对于多个第二候选块,在该亮度块位置上可以向左上、上和左搜索多个位置,包括但不限于以下示例性的搜索位置:获取同位亮度区域右下角位置的向左上坐标偏移(xOffset,yOffset)=(-2,-2),向上坐标偏移(xOffset,yOffset)=(0,-2),向左坐标偏移(xOffset,yOffset)=(-2,0)。亮度区域所采用亮度块即为包含位置坐标(xCb+cbWidth-1+xOffset,yCb+cbHeight-1+yOffset)的亮度块。
也就是说,在本申请实施例中,对于作为第一颜色分量块的第一候选块,可以是图3所示多个块中的任意位置的块。例如,如图3所示的同位亮度区域中处于中心位置的块(用黑色填充的块),如图9所示的同位亮度区域中处于左上角位置的块(用黑色填充的块),如图10所示的同位亮度区域中处于右下角位置的块(用黑色填充的块),甚至还可以是同位亮度区域中处于右上角位置的块、处于左下角位置的块,更甚者可以是处于左上区域的中心位置的块等等,这里不作任何限定。进一步地,在第一候选块的基础上,还可以向左上、上和左等搜索多个位置,以得到多个第二候选块。然后根据第一候选块和/或多个第二候选块,从而能够确定出当前块的第一颜色分量块。
在一些实施例中,该方法还可以包括:从第一颜色分量区域的多个划分块中,确定处于预设位置的至少一个候选块;根据至少一个候选块,确定当前块的第一颜色分量块。
在本申请实施例中,可以将这至少一个候选块作为当前块的第一颜色分量块。也就是说,对于第一颜色分量块,可以是依次获取的至少一个候选块。例如,如图11所示,这里包括五个亮度像素位置的 CU,具体为:C、TL、TR、BL和BR。但是本申请实施例并不局限于五个位置,可以是多个不同位置;而且也并不局限于图11所示的五个位置,对此均不作任何限定。
在又一种可能的实现方式中,以图11所示的包含五个亮度像素位置的块为例,可以按照预设顺序依次获取,该预设顺序包括但不限于以下顺序:C->TL->TR->BL->BR。
对于C、TL、TR、BL、BR的详细位置推导过程,获取当前块的位置,即当前块的左上角色度样本相对于当前图像的左上角色度样本的位置,chromaPos=(x,y),根据表4所示的色度采样格式对chromaPos进行缩放,得到当前块对应的同位亮度区域位置lumaPos=(xCb,yCb)。
在这里,假设当前块左上角对应的同位亮度像素相对于图像左上角亮度像素的位置(即亮度像素TL的位置)为(xCb,yCb),当前色度编码块对应的同位亮度区域(即图11中亮度分量的整个斜线填充区域)的宽度为cbWidth,高度为cbHeight。
亮度像素C的位置的坐标为(xCb+cbWidth/2,yCb+cbHeight/2);
亮度像素TL的位置的坐标为(xCb,yCb);
亮度像素TR的位置的坐标为(xCb+cbWidth-1,yCb);
亮度像素BL的位置的坐标为(xCb,yCb+cbHeight-1);
亮度像素BR的位置的坐标为(xCb+cbWidth-1,yCb+cbHeight-1)。
在这里,搜索每个位置时,在此位置上也可以向左上、上和左搜索多个位置,包括但不限于以下示例性的搜索位置:获取此位置的向左上坐标偏移(xOffset,yOffset)=(-2,-2),向上坐标偏移(xOffset,yOffset)=(0,-2),向左坐标偏移(xOffset,yOffset)=(-2,0)。亮度区域所采用亮度块即为包含该位置坐标加上述偏移位置的位置坐标的亮度块。
这样,对于当前块而言,首先需要确定出对应的第一颜色分量块。示例性地,在第一颜色分量为亮度分量时,这里需要确定出当前块的对应亮度块。具体地,可以使用上述的几种可能的实现方式来确定出一个或多个对应亮度块。
可以理解,在确定出第一颜色分量块之后,可以构建当前块的第二参考预测参数集。在一些实施例中,该方法可以包括:根据第一颜色分量块,确定一个或多个基于第一颜色分量的候选向量参数;根据一个或多个基于第一颜色分量的候选向量参数,确定当前块的第二参考预测参数集。
需要说明的是,在本申请实施例中,根据一个或多个基于第一颜色分量的候选向量参数,确定当前块的第二参考预测参数集,可以包括:对基于第一颜色分量的候选向量参数进行调整,确定基于第二颜色分量的候选向量参数;在基于第二颜色分量的候选向量参数满足预设可用条件时,将基于第一颜色分量的候选向量参数作为第二候选参考预测参数并添加至第二参考预测参数集。
在这里,以块向量参数BV为例,假设当前块为色度块,第一颜色分量块为亮度块,那么基于第一颜色分量的候选向量参数可以为亮度块的BV,即BVL;基于第二颜色分量的候选向量参数可以为色度块的BV,即BVC。
还需要说明的是,在本申请实施例中,假设基于第一颜色分量的候选向量参数为亮度BV=(BVLhor,BVLver),基于第二颜色分量的候选向量参数为色度BV=(BVChor,BVCver),那么可以通过调整BVL(亮度BV)来确定出对应的色度BV。
在一种具体的实施例中,对基于第一颜色分量的候选向量参数进行调整,确定基于第二颜色分量的候选向量参数,可以包括:确定当前块的预设采样格式;根据预设采样格式对基于第一颜色分量的候选向量参数进行缩放,确定基于第二颜色分量的候选向量参数。
需要说明的是,在本申请实施例中,上述调整可以包括根据预设采样格式进行缩放处理。其中,预设采样格式可以为表8所示的亮度BV与缩放后的色度BV之间的映射关系。
表8
在这里,预设采用格式可以是指颜色采样格式,例如单色、4:2:0、4:2:2、4:4:4等。语法元素sps_chroma_format_idc用于指示颜色采样格式的类型,这里的颜色采样格式具体为色度采样格式。在这里,颜色采样格式的类型不同,其对应的缩放操作也是不同的。
示例性地,若sps_chroma_format_idc的取值为0,则确定颜色采样格式为单色,即不存在色度BV参数(BVChor,BVChor);若sps_chroma_format_idc的取值为1,则确定颜色采样格式为4:2:0,这时候亮度BV与色度BV之间的映射关系为:BVChor=BVLhor>>1,BVChor=BVLver>>1;若sps_chroma _format_idc的取值为2,则确定颜色采样格式为4:2:2,这时候亮度BV与色度BV之间的映射关系为:BVChor=BVLhor>>1,BVChor=BVLver;若sps_chroma_format_idc的取值为3,那么表示颜色采样格式为4:4:4,这时候亮度BV与色度BV之间的映射关系为:BVChor=BVLhor,BVChor=BVLver
这样,基于表8,可以选择根据颜色采样格式对候选BVL进行缩放,得到缩放后的BVC;然后判断缩放后的BVC是否满足预设可用条件。其中,缩放后的BVC满足预设可用条件,包括但不限于:
根据缩放后的BVC指示的偏移位置未超出图像边界;
根据缩放后的BVC指示的偏移位置未超出片边界;
根据缩放后的BVC指示的偏移位置未覆盖当前块;
根据缩放后的BVC指示的偏移位置未超出预设可用区域;
根据缩放后的BVC指示的偏移位置已经重建。
还需要说明的是,在本申请实施例中,根据第一颜色分量块,将得到的一个或多个基于第一颜色分量的候选向量参数(即一个或多个候选BVL)进行缩放。其中,如果基于表8所示的颜色采样格式对某一个候选BVL进行缩放,而且缩放后的BVC满足预设可用条件,那么可以将这个候选BVL作为第二候选参考预测参数并添加至第二参考预测参数集,以此构建第二参考预测参数集。其中,第二参考预测参数集可以包含一个或多个第二候选参考预测参数。
还可以理解,在构建出第二参考预测参数集之后,可以进一步确定当前块的第一参考预测参数集。在一些实施例中,该方法可以包括:对第二参考预测参数集中的一个或多个第二候选参考预测参数进行调整,确定一个或多个第二候选参考预测参数各自对应的第一候选参考预测参数;根据一个或多个第二候选参考预测参数各自对应的第一候选参考预测参数,确定当前块的第一参考预测参数集。
需要说明的是,在本申请实施例中,第一候选参考预测参数与第二候选参考预测参数的数量相同。也就是说,针对每一个第二候选参考预测参数,可以对其进行调整,得到一个或多个第一候选参考预测参数,然后从中决策出一个可用的第一候选参考预测参数。但是需要注意的是,第一候选参考预测参数与第二候选参考预测参数的数量也可以不同,此时每一个第二候选参考预测参数决策出可用的第一候选参考预测参数可以不只一个,这里不作任何限定。
在一些实施例中,对第二参考预测参数集中的一个或多个第二候选参考预测参数进行调整,确定一个或多个第二候选参考预测参数各自对应的第一候选参考预测参数,这里以其中一个第二候选参考预测参数为例,该方法可以包括:对第二候选参考预测参数进行调整,确定基于第二颜色分量的第三参考预测参数集;根据第三参考预测参数集,确定第二候选参考预测参数对应的第一候选参考预测参数。
在本申请实施例中,针对每一个第二候选参考预测参数,都可以采用这种方式来确定出各自对应的第一候选参考预测参数,以得到第一参考预测参数集。
示例性地,假设当前块为色度块,第一颜色分量块为亮度块,那么第一候选参考预测参数可以为色度块的候选BV,即候选BVC;第二候选参考预测参数可以为亮度块的候选BV,即候选BVL。其中,对第二候选参考预测参数进行调整,可以确定一个或多个基于第二颜色分量的候选向量参数,即一个或多个候选BVC,这些候选BVC能够构建出第三参考预测参数集。
可以理解的是,在本申请实施例中,假设第二候选参考预测参数为亮度BV=(BVLhor,BVLver),基于第二颜色分量的候选向量参数为色度BV=(BVChor,BVCver),那么可以选择通过调整BVL(亮度BV)或BVC(色度BV)来构建包含一个或者多个候选块向量参数的色度BVC候选列表。
在一种可能的实现方式中,对第二候选参考预测参数进行调整,确定基于第二颜色分量的第三参考预测参数集,可以包括:根据当前块的预设采样格式对第二候选参考预测参数进行缩放,确定基于第二颜色分量的候选向量参数,并将基于第二颜色分量的候选向量参数添加至第三参考预测参数集。
需要说明的是,在本申请实施例中,上述调整可以包括根据预设采样格式进行缩放处理。其中,预设采样格式可以为表8所示的亮度BV与缩放后的色度BV之间的映射关系。在这里,预设采用格式可以是指颜色采样格式,例如单色、4:2:0、4:2:2、4:4:4等。如此,可以选择根据表8所示的颜色采样格式进行缩放,将缩放后的BVC作为候选向量参数添加至第三参考预测参数集中。
在另一种可能的实现方式中,对第二候选参考预测参数进行调整,确定基于第二颜色分量的第三参考预测参数集,可以包括:根据当前块的预设采样格式对第二候选参考预测参数进行缩放,确定基于第二颜色分量的第一初始向量参数;根据一个或多个偏移值对基于第二颜色分量的第一初始向量参数进行偏移计算,确定一个或多个基于第二颜色分量的候选向量参数,并将一个或多个基于第二颜色分量的候选向量参数添加至第三参考预测参数集。
在又一种可能的实现方式中,对第二候选参考预测参数进行调整,确定基于第二颜色分量的第三参考预测参数集,可以包括:根据一个或多个偏移值对第二候选参考预测参数进行偏移计算,确定一个或多个基于第一颜色分量的第二初始向量参数;根据当前块的预设采样格式对一个或多个基于第一颜色分 量的第二初始向量参数进行缩放,确定一个或多个基于第二颜色分量的候选向量参数,并将一个或多个基于第二颜色分量的候选向量参数添加至第三参考预测参数集。
需要说明的是,在本申请实施例中,上述一个或多个偏移值可以为任意数量的任意数值,例如-1、+1、-2、+2、-3、+3等,这里不作任何限定。
也就是说,在本申请实施例中,可以在获取对应亮度块的BV后,将其记为BVL,通过BVL获取到的色度BV,记为BVC,然后通过调整BVL或BVC来构建包含一个或者多个候选的色度BVC候选项。候选项的构建方式包括但不限于以下情况:
在一种可能的构建方式中,可以调整BVL形成四种情况,进而实现对BVC的调整。其中,当BVL为奇数时,取BVL=(BVLhor,BVLver)、BVL=(BVLhor+1,BVLver)、BVL=(BVLhor,BVLver+1)、BVL=(BVLhor+1,BVLver+1)四种情况。当BVL为偶数时,取BVL=(BVLhor,BVLver)。
或者,当BVL为偶数时,取BVL=(BVLhor,BVLver)、BVL=(BVLhor+1,BVLver)、BVL=(BVLhor,BVLver+1)、BVL=(BVLhor+1,BVLver+1)四种情况。
在这里,BVC[0]=BVL[0]*2/SubWidthC,BVC[1]=BVL[1]*2/SubHeightC。SubWidthC和SubHeightC可以根据表1中的sps_chroma_format_idc与颜色采样格式的映射关系来确定。
根据上述公式对BVL进行缩放得到BVC,这样当BVL为奇数或偶数时,会形成四种BVC候选,将这些候选添加至色度BVC候选列表(即第三参考预测参数集)。
在另一种可能的构建方式中,可以调整BVL形成四种情况,进而实现对BVC的调整。其中,当BVL为奇数时,取BVL=(BVLhor,BVLver)、BVL=(BVLhor+1,BVLver)、BVL=(BVLhor,BVLver+1)、BVL=(BVLhor+1,BVLver+1)四种情况。当BVL为偶数时,取BVL=(BVLhor,BVLver)、BVL=(BVLhor-1,BVLver)、BVL=(BVLhor,BVLver-1)、BVL=(BVLhor-1,BVLver-1)四种情况。接着,根据表8中的颜色采样格式对BVL进行缩放得到BVC,这样当BVL为奇数或者偶数时,均会形成四种BVC候选,将这些候选添加至色度BVC候选列表(即第三参考预测参数集)。
需要说明的是,在这种构建方式中,也可以通过以下计算统一奇偶数不同情况下的操作:取BVL=(BVLhor-1,BVLver-1)、BVL=(BVLhor+1,BVLver-1)、BVL=(BVLho-1r,BVLver+1)、BVL=(BVLhor+1,BVLver+1)四种情况。
在又一种可能的构建方式中,可以调整BVL形成多种情况,进而实现对BVC的调整。其中,当BVL为奇数时,取BVL=(BVLhor,BVLver)、BVL=(BVLhor+1,BVLver)、BVL=(BVLhor,BVLver+1)、BVL=(BVLhor+1,BVLver+1)、BVL=(BVLhor+3,BVLver)、BVL=(BVLhor,BVLver+3)、BVL=(BVLhor+3,BVLver+3)、BVL=(BVLhor-2,BVLver)、BVL=(BVLhor,BVLver-2)等多种情况,对这些候选按顺序构建列表。当BVL为偶数时,取BVL=(BVLhor,BVLver)、BVL=(BVLhor-1,BVLver)、BVL=(BVLhor,BVLver-1)、BVL=(BVLhor-1,BVLver-1)、BVL=(BVLhor-3,BVLver)、BVL=(BVLhor,BVLver-3)、BVL=(BVLhor-3,BVLver-3)、BVL=(BVLhor+2,BVLver)、BVL=(BVLhor,BVLver+2)等多种情况。接着,根据表8中的颜色采样格式对BVL进行缩放得到BVC,这样当BVL为奇数或者偶数时,均会形成多种BVC候选,将这些候选添加至色度BVC候选列表(即第三参考预测参数集)。
需要说明的是,在这种构建方式中,也可以通过以下计算统一奇偶数不同情况下的操作:取BVL=(BVLhor-1,BVLver-1)、BVL=(BVLhor+1,BVLver-1)、BVL=(BVLhor-1,BVLver+1)、BVL=(BVLhor+1,BVLver+1)、BVL=(BVLhor+3,BVLver-1)、BVL=(BVLhor-1,BVLver+3)、BVL=(BVLhor+3,BVLver+3)、BVL=(BVLhor-3,BVLver-1)、BVL=(BVLhor-1,BVLver-3)等。
在又一种可能的构建方式中,还可以对得到的BVC进行调整得到九种候选:即设置BVC=(BVChor,BVCver)、BVC=(BVChor-1,BVCver)、BVC=(BVChor,BVCver-1)、BVC=(BVChor-1,BVCver-1)、BVC=(BVChor+1,BVCver)、BVC=(BVChor,BVCver+1)、BVC=(BVChor+1,BVCver+1)、BVC=(BVChor-1,BVCver+1)、BVC=(BVChor+1,BVCver-1),这样就形成了九种BVC候选,将这些候选添加至色度BVC候选列表(即第三参考预测参数集)。
在又一种可能的构建方式中,还可以对得到的BVC进行调整得到多种候选:即设置BVC=(BVChor,BVCver)、BVC=(BVChor-1,BVCver)、BVC=(BVChor,BVCver-1)、BVC=(BVChor-1,BVCver-1)、BVC=(BVChor+1,BVCver)、BVC=(BVChor,BVCver+1)、BVC=(BVChor+1,BVCver+1)、BVC=(BVChor-1,BVCver+1)、BVC=(BVChor+1,BVCver-1)、BVC=(BVChor-2,BVCver)、BVC=(BVChor,BVCver-2)、BVC=(BVChor-2,BVCver-2)、BVC=(BVChor+2,BVCver)、BVC=(BVChor,BVCver+2)、BVC=(BVChor+2,BVCver+2)、BVC=(BVChor-2,BVCver+2)、BVC=(BVChor+2,BVCver-2)等,这样就形成了多种BVC候选,将这些候选添加至色度BVC候选列表(即第三参考预测参数集)。
还需要说明的是,在本申请实施例中,对于BVL为奇数或者偶数的情况,由于BVL是一个二维矢量,这里具体是指其中的某个分量为奇数或者偶数。另外,这里的“+1”、“-1”、“+2”、“-2”、“+3”、“-3” 均是指整像素精度。
可以理解,在本申请实施例中,在根据第三参考预测参数集来确定第一候选参考预测参数时,还需要判断第三参考预测参数集中的候选向量参数是否可用,即需要从第三参考预测参数集中选择一个或多个可用的候选向量参数。因此,在一些实施例中,根据第三参考预测参数集,确定第二候选参考预测参数对应的第一候选参考预测参数,可以包括:判断第三参考预测参数集是否存在满足预设可用条件的一个或多个候选向量参数;在第三参考预测参数集存在满足预设可用条件的一个或多个候选向量参数时,根据一个或多个候选向量参数确定第一候选参考预测参数。
具体来讲,在本申请实施例中,只有在候选向量参数满足预设可用条件时,才有可能将候选向量参数确定为第一候选参考预测参数。
在一些实施例中,一个或多个候选向量参数满足预设可用条件,包括但不限于:
根据一个或多个候选向量参数指示的偏移位置未超出图像边界;
根据一个或多个候选向量参数指示的偏移位置未超出片边界;
根据一个或多个候选向量参数指示的偏移位置未覆盖当前块;
根据一个或多个候选向量参数指示的偏移位置未超出预设可用区域;
根据一个或多个候选向量参数指示的偏移位置已经重建。
需要说明的是,在本申请实施例中,假定当前块的位置(xCb,yCb),针对候选向量参数,BVC=(BVChor,BVCver),此时找到对应的偏移位置(xCb+BVChor,yCb+BVCver)。在这里,偏移位置未超出图像边界也可以使用坐标位置信息与当前块的尺寸参数等数据进行具体描述。例如,xCb+width+BVChor<=xCb或yCb+height+BVCver<=yCb。
还需要说明的是,在本申请实施例中,这里的预设可用条件,也可以考虑是否超出片边界。例如根据一个或多个候选向量参数指示的偏移位置未超出slice边界,或者根据一个或多个候选向量参数指示的偏移位置未超出tile边界。
在本申请实施例中,只有上述条件全部成立的情况下,这时候才可以确定候选向量参数满足预设可用条件,即候选向量参数可用。在一种具体的实施例中,以其中一个候选向量参数为例,该候选向量参数满足预设可用条件,至少包括:根据候选向量参数指示的偏移位置未超出图像边界;以及根据候选向量参数指示的偏移位置未超出片边界;以及根据候选向量参数指示的偏移位置未覆盖当前块;以及根据候选向量参数指示的偏移位置未超出预设可用区域;以及根据候选向量参数指示的偏移位置已经重建。
示例性地,图12示出了本申请实施例提供的一种偏移位置是否未覆盖当前块的结构示意图。如图12所示,用黑色填充的块表示当前块,用斜线填充区域表示可用区域,无填充区域表示不可用区域。对于当前块而言,如果候选块向量参数指示的偏移位置处于不可用区域,那么就会发生偏移位置覆盖当前块的情况。
示例性地,图13示出了本申请实施例提供的一种偏移位置是否超出预设可用区域的结构示意图。如图13所示,用黑色填充的块表示当前块,用斜线填充区域表示可用区域,而且可用区域内的参考块均已经重建。在本申请实施例中,考虑到Buffer的存储能力,通常情况下,可以将当前块(m,n)相邻的这些参考块,具体为:参考块(m-2,n-2)、参考块(m-1,n-2)、参考块(m,n-2)、参考块(m+1,n-2)、参考块(m-2,n-1)、参考块(m-1,n-1)、参考块(m,n-1)、参考块(m+1,n-1)、参考块(m-2,n)、参考块(m-1,n)等作为预设可用区域。
也就是说,在进行是否可用的判断时,可以获取当前块的位置(xCb,yCb),获取色度BVC=(BVChor,BVCver),找到对应的偏移位置(xCb+BVChor,yCb+BVCver),判断以下条件,包括但不限于以下条件(即预设可用条件),如果均成立则该色度BV可用:
得到的偏移位置是否未超出图像边界;
得到的偏移位置是否未覆盖当前块,具体参见图12;
xCb+width+BVChor<=xCb或yCb+height+BVCver<=yCb;
得到的偏移位置是否未超出预设可用区域,具体参见图13;
得到的偏移位置是否已经重建。
还可以理解,在本申请实施例中,第三参考预测参数集的构建方式包括但不限于如上所述的多种情况,可采用其中之一构建候选列表,也可以同时使用多种方式且构建列表,即针对每个BVL确定出四个BVC候选,以构建出第三参考预测参数集。然后针对每个BVL对应的四个BVC候选决策出一个可用BVC,即该BVL对应的第一候选参考预测参数。
在一些实施例中,根据一个或多个候选向量参数确定第一候选参考预测参数,包括:若第三参考预测参数集存在满足预设可用条件的一个候选向量参数,则将满足预设可用条件的一个候选向量参数确定为第一候选参考预测参数;若第三参考预测参数集存在满足预设可用条件的多个候选向量参数,则对满 足预设可用条件的多个候选向量参数进行决策,确定第一候选参考预测参数。
需要说明的是,在本申请实施例中,如果存在满足预设可用条件的一个或多个候选向量参数,那么在根据一个或多个候选向量参数确定第一候选参考预测参数时,可以直接将满足预设可用条件的某一个候选向量参数确定为第一候选参考预测参数。也就是说,如果构建的可用BVC候选列表仅有一个BVC候选满足预设可用条件,那么最终选择的第一候选参考预测参数即为该BVC。
还需要说明的是,在本申请实施例中,如果存在满足预设可用条件的多个候选向量参数,那么还可以对满足预设可用条件的多个候选向量参数进行决策。具体可以为:确定当前块的第一模板;根据第一模板和多个候选向量参数,确定多个候选向量参数各自的第一匹配模板;在第一模板与第一匹配模板满足预设存在条件时,根据预设的误差准则,计算当前块的第一模板与第一匹配模板之间的匹配误差,以确定多个候选向量参数各自的第一代价值;从多个候选向量参数各自的第一代价值中确定最小代价值,将最小代价值对应的候选向量参数确定为第一候选参考预测参数。
也就是说,在本申请实施例中,对满足预设可用条件的多个候选向量参数,在确定多个候选向量参数对应的第一代价值之后,可以根据第一代价值,从多个候选向量参数中确定一个或多个候选向量参数。示例性地,如果构建的可用BVC候选列表有多个可用的BVC候选,那么便需要对这些可用的BVC进行决策以得到最终的BV,决策的方式包括但不限于采用模板进行决策的方式。
需要说明的是,在本申请实施例中,第一模板包括当前块的相邻已解码区域中的一个或多个样值。相应地,第一模板的类型可以包括下述至少一项:上模板、右上模板、左模板、左下模板和左上模板。其中,上模板位于当前块相邻的上侧已解码区域,右上模板位于当前块相邻的右上侧已解码区域,左模板位于当前块相邻的左侧已解码区域,左下模板位于当前块相邻的左下侧已解码区域,左上模板位于当前块相邻的左上侧已解码区域。
还需要说明的是,在本申请实施例中,在进行模板(当前块的第一模板)的选择时,可以根据当前块的相邻区域的像素可用性,判断模板位置的像素是否可用,包括重建色度信息。图14为模板类型的示意图,如图14所示,根据模板与当前块的相对位置关系,可将模板分类为上模板、左模板、右上模板、左下模板、左上模板等模板类型。其中,不同编码块的不同类型的模板尺寸可以固定相同,也可以不同。
例如,模板尺寸对任意尺寸的当前块选择相同的模板尺寸,如下公式说明了一种模板尺寸的设置条件,其中,nTbW和nTbH分别为当前块的宽度和高度,iTempW和iTempH分别为采用的模板的宽度和高度:
上模板:
左模板:
例如,可以根据当前块的不同尺寸选择不同的模板尺寸,如下公式说明了一种模板的尺寸设置条件,nTbW和nTbH分别为当前块的宽度和高度,iTempW和iTempH分别为采用的模板的宽度和高度:
上模板:
左模板:
其中,
例如,也可以根据当前块内的像素数选择不同的模板尺寸,如下公式说明了一种模板的尺寸设置条件,nTbW和nTbH分别为当前块的宽度和高度,nTbW×nTbH分别为当前块的像素数,iTempW和iTempH分别为采用的模板的宽度和高度:
上模板:
左模板:
在一些实施例中,在根据多个候选向量参数确定第一匹配模板时,以当前点的位置为起点,将多个候选向量参数所指示的、与第一模板具有相同形状和包含相同数量样值的区域,确定为第一匹配模板。
示例性地,在本申请实施例中,在进行第一匹配模板的确定时,对得到的多种BVC候选(即满足预设可用条件的候选块向量参数),利用当前块的第一模板进行运动补偿,得到对应BV处的模板(第一匹配模板)。图15为模板运动补偿的示意图,如图15所示,如果BV(BVC候选)是可用的,就会利用第一模板和该BV进行运动补偿,得到对应BV处的模板,即第一匹配模板。
还可以理解地,在本申请实施例中,预设的误差准则可以包括但不限于绝对误差和SAD、变换绝对误差和SATD、差值平方和SSE、平均绝对差值MAD、平均绝对误差MAE、平均平方误差MSE等的任意一种。
示例性地,在本申请实施例中,在进行成本计算时,即确定第一代价值时,对于计算模板区域的成本的成本函数有多种选择,即预设的误差准则可以有多种选择。例如,可以选择绝对误差和(SAD)、变换绝对误差和(SATD)、差值平方和(SSE)、平均绝对差值(MAD)、平均绝对误差(MAE)、平均平方误差(MSE)等评价准则。下述内容所提到的某种评价准则均可从上述准则中选择其一,以SAD的评价准则为例,计算公式如下:
其中,predTempSizeW为模板的宽度,predTempSizeH为模板的高度,predTemp[i][j]为BV处模板的像素点,recTempC[i][j]为当前块模板的像素点。
进一步地,在一些实施例中,该方法还可以包括:在第一模板与第一匹配模板不满足预设存在条件时,将第三参考预测参数集中满足预设可用条件的第一个候选向量参数确定为第一候选参考预测参数;或者,在第一模板与第一匹配模板不满足预设存在条件时,将第三参考预测参数集中满足预设可用条件的第二位置处的候选向量参数确定为第一参考预测参数。
也就是说,如果第一模板与第一匹配模板满足预设存在条件,这时候可以根据预设的误差准则计算当前块的第一模板与第一匹配模板之间的匹配误差,以选择最小代价值对应的候选向量参数作为第一候选参考预测参数;如果第一模板与第一匹配模板不满足预设存在条件,这时候可以将第三参考预测参数集中满足预设可用条件的第一个候选向量参数或者某个指定位置处的候选向量参数确定为第一候选参考预测参数。
示例性地,针对第一模板与第一匹配模板是否满足预设存在条件,计算成本(即代价值)时的模板使用情况存在以下几种情况:
第一种:当前块的上模板和左模板均存在,且对应BV处的上模板和左模板均存在,此时上模板和左模板均可用。
第二种:当前块的上模板和左模板均存在,对应BV处仅上模板存在,此时存在两种方法:方法一:对应BV处左模板不存在,直接不用,即仅用上模板计算。方法二:对应BV处左模板不存在,采用参考块内部最左侧的模板宽度列代替左模板,即采用上模板和左模板计算。
第三种:当前块的上模板和左模板均存在,对应BV处仅左模板存在,此时存在两种方法:方法一:对应BV处上模板不存在,直接不用,即仅用左模板计算。方法二:对应BV处上模板不存在,采用参考块内部最上侧的模板高度行代替上模板,即采用上模板和左模板计算。
第四种:当前块仅上模板存在,此时存在三种方法:方法一:对应BV处上模板不存在,直接不用,此时最终选择的BV为BVC候选列表中的第一个BVC或某个指定位置的BVC。方法二:对应BV处上模板不存在,采用参考块内部最上侧的模板高度行代替上模板。方法三:对应BV处上模板存在,直接用。
第五种:当前块仅左模板存在,此时存在三种方法:方法一:对应BV处左模板不存在,直接不用,此时最终选择的BV为BVC候选列表中的第一个BVC或某个指定位置的BVC。方法二:对应BV处左模板不存在,采用参考块内部最左侧的模板宽度列代替左模板。方法三:对应BV处左模板存在,直接用。
第六种:当前块上模板和左模板均不存在,此时最终选择的BV为BVC候选列表中的第一个BVC或某个指定位置的BVC。
示例性地,在本申请实施例中,在根据多个候选向量参数各自的第一代价值来确定第一候选参考预测参数时,除去无法计算成本的情况,其他情况对BVC的候选列表中每个候选进行成本的计算,并排 序,排序方法包括但不限于采用冒泡排序、选择排序、插入排序、希尔排序、归并排序、快速排序、基数排序、堆排序、计数排序、桶排序等排序方法。选择成本最小的任意数量的BVC作为最终选择的BV(第一候选参考预测参数),以此进行基于BV的色度预测。还需要注意的是,在对多个候选向量参数进行代价值计算时,可以每一个候选向量参数计算一个成本,始终保留成本最小的候选向量参数,这种情况下也可以不需要列表,甚至也不需要排序。
这样,在得到一个或多个第一候选参考预测参数之后,可以构建出第一参考预测参数集。
S603,根据第一参考预测参数集,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值。
需要说明的是,在本申请实施例中,这里的“参考预测参数”是用于推导当前块的参考样值的参数,具体可以为向量参数(例如BV或MV)。然后根据这些参考样值(Samples),可以用于推导第一颜色分量与第二颜色分量之间的映射关系。
还需要说明的是,如果第三参考预测参数集中的全部候选向量参数均不可用,即第三参考预测参数集中的全部候选块向量参数均不满足预设可用条件,这时候不存在可用的第一候选参考预测参数,那么也就不存在第一参考预测参数集。在这种情况下,该方法还可以包括:在第三参考预测参数集中的全部候选向量参数均不满足预设可用条件时,确定当前块的第三位置处的第一颜色分量重建样本和第二颜色分量重建样本;根据第三位置处的第一颜色分量重建样本和第二颜色分量重建样本,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值。
也就是说,在本申请实施例中,还可以获取设定位置处的亮度像素和色度像素,该设定位置包括但不限于当前块的相邻一行和相邻一列,以得到当前块的第一颜色分量参考样值和第二颜色分量参考样值。
在一些实施例中,根据第一参考预测参数集,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值,可以包括:根据第一参考预测参数集,确定一个或多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本;确定当前块的第三位置处的第一颜色分量重建样本和第二颜色分量重建样本;根据一个或多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本以及第三位置处的第一颜色分量重建样本和第二颜色分量重建样本,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值。
在本申请实施例中,根据第一参考预测参数集,确定一个或多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本,可以包括:确定当前块的位置;对当前块的位置进行缩放,确定当前块的同位置的第一颜色分量区域的位置;以及对第一候选参考预测参数进行缩放,确定当前块的同位置的第一颜色分量区域的缩放后参考预测参数;根据第一颜色分量区域的位置和缩放后参考预测参数,确定第一颜色分量的参考块,并根据第一颜色分量的参考块确定第一候选参考预测参数指示的第一颜色分量重建样本;根据当前块的位置和第一候选参考预测参数,确定第二颜色分量的参考块,并根据第二颜色分量的参考块确定第一候选参考预测参数指示的第二颜色分量重建样本。
在本申请实施例中,对于第一颜色分量区域的位置,可以是根据预设采样格式对当前块的位置进行缩放得到的;对于第一颜色分量区域的缩放后参考预测参数,也可以是根据预设采样格式对第一候选参考预测参数进行缩放得到的。在这里,预设采样格式可以参见前述表4。需要注意的是,缩放后参考预测参数可以是由色度BV进行放大得到的;但是考虑到亮度BV可能会存在精度损失,因此由色度BV放大后得到的亮度BV与原始亮度BV(第二候选参考预测参数)不一定相等。
示例性地,当前块为色度块,同位置的第一颜色分量区域则为同位亮度区域。对于第一颜色分量参考样值(亮度参考样本)的获取,首先获取当前块的位置,即当前块的左上角色度样本相对于当前图像的左上角色度样本的位置,chromaPos=(x,y);根据表4所示的颜色采样格式对chromaPos进行缩放,得到当前块对应的同位亮度区域位置lumaPos=(xCb,yCb)。
示例性地,获取色度BV=(BVChor,BVCver),根据表4所示的颜色采样格式对色度BV进行缩放,得到当前块对应的同位亮度区域的亮度BV=(BVYhor,BVYver)。获取当前块对应的同位亮度区域位置lumaPos=(xCb,yCb),获取亮度BV=(BVYhor,BVYver),找到当前块对应的同位亮度区域对应的偏移位置(xCb+BVYhor,yCb+BVYver),如图16所示。
在一种具体的实现方式中,在得到该偏移位置处的亮度样本之后,可以对其进行下采样得到亮度参考样本。在一些实施例中,根据第一颜色分量的参考块确定第一候选参考预测参数指示的第一颜色分量重建样本,可以包括:对第一颜色分量的参考块进行下采样处理,确定第一候选参考预测参数指示的第一颜色分量重建样本,以使第一颜色分量重建样本的分辨率与第二颜色分量重建样本的分辨率相同。
需要说明的是,在本申请实施例中,对第一颜色分量的参考块进行下采样处理,确定第一候选参考预测参数指示的第一颜色分量重建样本,可以包括:确定当前块的下采样方式;根据下采样方式对第一颜色分量的参考块进行下采样处理,确定第一候选参考预测参数指示的第一颜色分量重建样本。
还需要说明的是,在本申请实施例中,由于亮度样本与色度样本的分辨率不一致,因此需要对亮度 样本进行下采样处理,以使得下采样后的亮度样本与色度样本的分辨率相同。在这里,对于确定当前块的下采样方式,可以采用下面几种采样方式竞争或者默认采用某一种采样方式,但是包括不限于以下六种采样方式。示例性地,假定下采样前的亮度样本为recBvBefDownLuma,存储buffer的宽度为iRecRefLumaStride,下采样后的亮度样本为recBvAftDownLuma,则位置(i,j)处下采样后的亮度样本为:
下采样方式一(如图17A所示):
recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]*2
+recBvBefDownLuma[2*i+1]
+recBvBefDownLuma[2*i-1]
+recBvBefDownLuma[2*i+iRecRefLumaStride]*2
+recBvBefDownLuma[2*i+1+iRecRefLumaStride]
+recBvBefDownLuma[2*i-1+iRecRefLumaStride]+4)>>3;
下采样方式二(如图17B所示):
recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]
+recBvBefDownLuma[2*i+1]+1)>>1;
下采样方式三(如图17C所示):
recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]
+recBvBefDownLuma[2*i+iRecRefLumaStride]+1)>>1;
下采样方式四(如图17D所示):
recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i+iRecRefLumaStride]
+recBvBefDownLuma[2*i+1+iRecRefLumaStride]+1)>>1;
下采样方式五(如图17E所示):
recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i+1]
+recBvBefDownLuma[2*i+1+iRecRefLumaStride]+1)>>1;
下采样方式六(如图17F所示):
recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]
+recBvBefDownLuma[2*i+1]
+recBvBefDownLuma[2*i+iRecRefLumaStride]
+recBvBefDownLuma[2*i+1+iRecRefLumaStride]+2)>>2。
在一些实施例中,确定当前块的下采样方式,可以包括:解码码流,确定滤波标识信息的取值;根据滤波标识信息的取值,确定当前块的下采样方式。
也就是说,解码端通过解码码流,可以确定滤波标识信息的取值,进而确定出当前块的下采样方式。其中,滤波标识信息可以用filter_idx表示,滤波标识信息的取值可以为0,1,2,3,4,5等。这样,在确定出当前块的下采样方式之后,经过下采样即可获取到当前块对应的同位亮度区域对应BV处的下采样后的亮度参考样本recBvAftDownLuma。
进一步地,对于当前块的色度样本,首先获取当前块的位置(xCbC,yCbC),获取色度BV=(BVChor,BVCver),找到对应偏移位置(xCbC+BVChor,yCbC+BVCver),即获取到了当前块对应BV处的色度参考样本recBvChroma。
在一些实施例中,确定当前块的第三位置处的第一颜色分量重建样本和第二颜色分量重建样本,该方法可以包括:确定当前块的第一模板;根据第一模板,确定第三位置处的第一颜色分量重建样本和第二颜色分量重建样本。
需要说明的是,在本申请实施例中,第一模板包括当前块的相邻已解码区域中的一个或多个样值。相应地,第一模板的类型可以包括下述至少一项:上模板、右上模板、左模板、左下模板和左上模板。其中,上模板位于当前块相邻的上侧已解码区域,右上模板位于当前块相邻的右上侧已解码区域,左模板位于当前块相邻的左侧已解码区域,左下模板位于当前块相邻的左下侧已解码区域,左上模板位于当前块相邻的左上侧已解码区域。
也就是说,对于当前块的第一颜色分量参考样值和第二颜色分量参考样值来说,不仅包括一个或多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本,还包括当前块的第三位置(例如第一模板区域)处的第一颜色分量重建样本和第二颜色分量重建样本。其中,第三位置表示当前块的任意设定位置,该位置包括但不限于当前块的相邻一行和相邻一列。
这样,根据亮度参考样本recBvAftDownLuma和色度参考样本recBvChroma以及第三位置处的重建亮度样本和重建色度样本,可以构建亮度与色度之间的映射关系。
S604,根据第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系。
需要说明的是,在一种可能的实现方式中,根据第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系,可以包括:根据第一颜色分量参考样值和第二颜色分量参考样值确定第一查找表,其中,第一查找表用于记录索引关键字为第一颜色分量时所对应的第二颜色分量的取值。
还需要说明的是,在另一种可能的实现方式中,根据第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系,可以包括:根据第一颜色分量参考样值和第二颜色分量参考样值确定第一离散模型,其中,第一离散模型用于指示第一颜色分量与第二颜色分量之间的映射关系。
也就是说,这里的映射关系可以是查找表(Look Up Table,LUT)。其中,查找表中的索引关键字(key)可以为第一颜色分量,查找表的取值(value)可以为第二颜色分量,即value=LUT[key]。或者,映射关系还可以是离散模型,用于表征key-value之间的映射关系。
示例性地,假定亮度分量为key,色度分量为value,那么映射关系中的每一key-value对,可以采用包括但不限于如下方式建立:
LUT[recBvAftDownLuma[i][j]]=recBvChroma[i][j]             (8)
还需要说明的是,在本申请实施例中,对于第一颜色分量参数样本,还可以限定在预设样本范围。在一些实施例中,该方法还可以包括:对第一颜色分量参考样值进行映射处理,以使第一颜色分量参考样值处于预设样本范围。
在本申请实施例中,预设样本范围可以为[0,(1<<bitdepth)-1],其中,bitdepth表示比特深度。示例性地,预设样本范围可以为[0,255]、[0,511]等范围,但是不作任何限定。其中,对于存在多个样本范围,那么可以使用率失真代价方式从中选择其中一个作为最终的预设样本范围。
示例性地,以比特深度大于8bit的视频为例,假定视频的比特深度为10bit,那么样本范围为[0,1023]。对于key值的recBvAftDownLuma,可以将其映射为[0,255]或者[0,511]的预设样本范围。
进一步地,在一些实施例中,该方法还可以包括:在第一颜色分量参考样值中的第一参考样值相同且对应第二颜色分量参考样值中不同的多个第二参考样值时,按照样本顺序依次进行覆盖处理,将最后一个第二参考样值作为与第一参考样值具有映射关系的值。
进一步地,在一些实施例中,该方法还可以包括:在第一颜色分量参考样值中的第一参考样值相同且对应第二颜色分量参考样值中不同的多个第二参考样值时,对多个第二参考样值进行平均值计算,将所得到的平均值作为与第一参考样值具有映射关系的值。
也就是说,在本申请实施例中,对于映射关系中具有相同key值的不同色度值,可以按照样本顺序依次覆盖相同key值的条目,或者采取平均值等操作。另外,在映射关系中,LUT[]的初始化设置为-1,即不可用的值。“覆盖”主要是指后面如果有相同的key值,则会使用新的value值进行存储;但是并不局限于这种方式,还可以全部存储然后求取平均值作为该key对应的value值。
可以理解地,在本申请实施例中,关于用于构建映射关系的第一颜色分量参考样值和第二颜色分量参考样值,也可以采用其他方式进行获得,下面结合几种实现方式进行示例性地说明。
在另一种具体的实现方式中,亮度样本不进行下采样,此时可以对色度样本进行上采样得到色度参考样本。在一些实施例中,根据第二颜色分量的参考块确定第一候选参考预测参数指示的第二颜色分量重建样本,可以包括:对第二颜色分量的参考块进行上采样处理,确定第一候选参考预测参数指示的第二颜色分量重建样本,以使第一颜色分量重建样本的分辨率与第二颜色分量重建样本的分辨率相同。
也就是说,在本申请实施例中,在获取到同位亮度区域的重建亮度样本recBvBefDownLuma之后,不进行下采样。这时候,获取到当前块对应BV处的重建色度样本recBvChroma之后需要进行上采样,包括但不限于线性插值等方式,得到和BV处重建亮度样本同样尺寸的重建色度样本recBvChromaUp。
如此,将BV处的重建亮度样本recBvBefDownLuma作为亮度参考样本,将所得到的上采样后的重建色度样本recBvChromaUp作为色度参考样本;然后根据亮度参考样本和色度参考样本来构建亮度与色度之间的映射关系。
相应地,在本申请实施例中,还需要对当前块的第二颜色分量的预测值进行下采样处理。也就是说,在构建映射关系的时候如果当前块的重建色度样本进行上采样处理,那么根据该映射关系对当前块进行亮度到色度的预测,还需要将所得到的色度预测值进行下采样操作得到当前块最终的色度预测值。其中,下采样方式包括但不限于平均下采样等。
在又一种具体的实现方式中,该方法还可以包括:确定当前块的第一模板;根据第一模板,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值。
在本申请实施例中,对于用于构建映射关系的第一颜色分量参考样值和第二颜色分量参考样值,还可以包括由当前块的第一模板所确定的第一颜色分量参考样值和第二颜色分量参考样值。具体地,根据 当前块的第一模板,可以确定第一模板同位置的第一颜色分量区域模板;然后根据第一颜色分量区域模板中的重建样本可以确定第一颜色分量参考样值;根据第一模板中的重建样本可以确定第二颜色分量参考样值。其中,第一模板包括当前块的相邻已解码区域中的一个或多个重建样本。
示例性地,根据当前块的当前色度模板,可以获取色度参考样本;在确定出当前色度模板的同位亮度区域模板后,根据同位亮度区域模板可以获取亮度参考样本。然后结合上述实施例所得到的亮度参考样本和色度参考样本,根据这些亮度参考样本和色度参考样本来构建亮度与色度之间的映射关系。
S605,根据映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。
需要说明的是,在本申请实施例中,对于确定当前块的第一颜色分量样值,可以包括:确定当前块的同位置的第一颜色分量区域的重建像素样本;基于第一颜色分量区域的重建像素样本,确定当前块的第一颜色分量样值。其中,可以是将第一颜色分量区域的重建像素样本直接作为当前块的第一颜色分量样值,也可以是对第一颜色分量区域的重建像素样本进行滤波处理,将滤波后的重建像素样本作为当前块的第一颜色分量样值,这里不作任何限定。
示例性地,在本申请实施例中,滤波处理为下采样处理。这里,可以获取当前块对应的同位亮度区域lumaPos=(xCb,yCb)位置的重建亮度样本recBefDownLuma,对该亮度样本采用下采样方式得到下采样后的重建亮度样本recAftDownLuma,并将下采样后的重建亮度样本作为当前块的第一颜色分量样值。另外,如果亮度参考样本进行过样本范围的映射处理,那么这里也需要对下采样后的重建亮度样本进行相同样本范围的映射处理,以得到当前块的第一颜色分量样值。
在一些实施例中,根据映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值,可以包括:若在映射关系中查找到与第一颜色分量样值相等的第一颜色分量值,则将第一颜色分量值对应的第二颜色分量的取值确定为当前块的第二颜色分量的预测值。
示例性地,在本申请实施例中,假定当前块的预测值为predSamples,那么对于predSamples[cIdx][x][y],变量cIdx指定当前块的颜色分量索引,这里可以采用如下预测方式:
参考其同位置的亮度值Yc,使用前述实施例建立的映射关系(离散模型)来推导出色度预测值。
在一些实施例中,对于确定当前块的第二颜色分量的预测值,该方法还可以包括:若在映射关系中没有查找到与第一颜色分量样值相等的第一颜色分量值,则对第一颜色分量样值进行修正处理,确定第一颜色分量修正值,并继续在映射关系中查找是否存在与第一颜色分量修正值相等的第一颜色分量值。
在一种具体的实施例中,对第一颜色分量重建值进行修正处理,确定第一颜色分量修正值,可以包括:根据预设的一个或多个偏移值对第一颜色分量样值进行偏移计算,确定第一颜色分量修正值。
在本申请实施例中,偏移值可以为+1、-1、+2、-2、+3、-3等,关于偏移值的数量以及具体取值均不作限定。另外,对于第一颜色分量重建值的修正处理,这多个偏移值也可以设置有一定的顺序,例如按照{+1、-1、+2、-2、+3、-3}顺序进行修正处理。
示例性地,在本申请实施例中,对于前述实施例建立的映射关系,如果在其中的输入亮度集中没有查找到Yc,则包括但不限于以下处理方式:按照{Yc+1、Yc-1、Yc+2、Yc-2、Yc+3、Yc-3}顺序对Yc进行修正处理,然后根据修正后的Yc在输入亮度集中进行匹配检查,然后将修正后的Yc对应的value值确定为当前块的色度预测值。
在一些实施例中,对于确定当前块的第二颜色分量的预测值,该方法还包括:若在映射关系中没有查找到与第一颜色分量修正值相等的第一颜色分量值,则对第二颜色分量参考样值进行平均值计算,将所得到的平均值确定为当前块的第二颜色分量的预测值。
示例性地,在本申请实施例中,对于前述实施例建立的映射关系,如果在其中的输入亮度集中没有查找到Yc,则包括但不限于以下处理方式:按照{Yc+1、Yc-1、Yc+2、Yc-2、Yc+3、Yc-3}顺序对Yc进行修正处理,如果映射关系中不能匹配以上所有的修正后的Yc,那么可以将色度预测值设置为对应BV处的重建色度样本recBvChroma的平均值。
在一些实施例中,对于确定当前块的第二颜色分量的预测值,该方法还包括:根据映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的第一初始预测值;对第一初始预测值进行修正操作,确定当前块的第二颜色分量的预测值。
需要说明的是,在本申请实施例中,对于根据映射关系所得到的第一初始预测值进行修正操作,这里的修正操作可以包括clip操作、滤波操作、与其他预测模式得到的预测值进行加权操作等等,对此不作任何限定。
在一种具体的实施例中,对第一初始预测值进行修正操作,确定当前块的第二颜色分量的预测值,可以包括:根据第一预设模式对当前块的第二颜色分量进行预测处理,确定当前块的第二颜色分量的第二初始预测值;对第一初始预测值和第二初始预测值进行加权计算,确定当前块的第二颜色分量的预测值。需要说明的是,在本申请实施例中,第一预设模式至少包括下述其中一项:PLANAR模式、DM模 式、DC模式和CCLM模式。也就是说,对于根据映射关系所得到的第一初始预测值进行修正操作,可以包括但不限于与CCLM类模式或者其他预测模式进行加权,以得到当前块的色度预测值。
在另一种具体的实施例中,对第一初始预测值进行修正操作,确定当前块的第二颜色分量的预测值,可以包括:将第一初始预测值限制在预设数值范围之内,或者也可以称为“钳位(clip)操作”。需要说明的是,在本申请实施例中,预设数值范围的下限值为最小预测值(min),预设数值范围的上限值为最大预测值(max)。其中,如果第一初始预测值处于该预设数值范围之内,那么可以将第一初始预测值作为当前块的色度预测值;如果第一初始预测值大于max,那么可以将max作为当前块的色度预测值;如果第一初始预测值小于min,那么可以将min作为当前块的色度预测值。
在一些实施例中,对于确定当前块的第二颜色分量的预测值,该方法还包括:在第一参考预测参数集包括多个第一候选参考预测参数时,确定当前块的第二颜色分量的多个第三初始预测值;对多个第三初始预测值进行加权计算,确定当前块的第二颜色分量的预测值。
需要说明的是,在本申请实施例中,如果前述实施例决策出多个BV(第一候选参考预测参数),那么根据这多个BV可以得到多个第三初始预测值;然后对这多个第三初始预测值进行加权,将加权后的预测值作为当前块的色度预测值;或者,还可以继续对加权后的预测值进行修正,包括但不限于与CCLM类模式或者其他预测模式进行加权,以得到当前块的色度预测值。
在一种具体的实施例中,对于确定当前块的第二颜色分量的预测值,该方法还可以包括:在第一参考预测参数集包括多个第一候选参考预测参数时,确定多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本;根据多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本,确定第一颜色分量与第二颜色分量之间的多个映射关系;根据多个映射关系,确定当前块的第二颜色分量的多个第三初始预测值;对多个第三初始预测值进行加权计算,确定当前块的第二颜色分量的预测值。
需要说明的是,在本申请实施例中,获取同位亮度区域的多个块,多个块的位置包括但不限于以下位置,如图11所示。多个块可以对应多个亮度BV,这多个亮度BV分别构建各自的色度BVC候选列表的候选项,判断该候选列表中的BV的可用性,以决策出一个BV或者多个BV或者通过聚类决策出多组BV,针对多组BV可以建立亮度与色度之间的多个映射表LUT,如此根据这多个映射表LUT可以得到多个初始色度预测值,通过加权计算就可以得到当前块的色度预测值。
在一些实施例中,对于确定当前块的第二颜色分量的预测值,如图18所示,该方法可以包括:
S1801,在当前块的第一颜色分量块包括多个候选块时,确定当前块的第二参考预测参数集;其中,第二参考预测参数集包含多个第二候选参考预测参数。
S1802,根据多个第二候选参考预测参数,确定多个第一候选参考预测参数;并基于多个第一候选参考预测参数,确定第一颜色分量与第二颜色分量之间的多个候选映射关系。
S1803,解码码流,确定映射关系索引值。
S1804,根据映射关系索引值和多个候选映射关系,确定目标映射关系。
S1805,根据目标映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。
需要说明的是,在本申请实施例中,可以建立多个亮度与色度之间的映射表LUT,然后使用语法元素指明所选择的目标映射表LUT。示例性地,获取同位亮度区域的多个块,多个块的位置包括但不限于以下位置,如图11所示。多个块可以对应多个亮度BV,这多个亮度BV分别构建各自的色度BVC候选列表的候选项,判断该候选列表中的BV的可用性,以决策出一个BV或者多个BV或者通过聚类决策出多组BV,这多个块的各自的可用色度BVC能够分别建立一个映射表LUT;在解码端,通过解码相应的语法元素可以确定出映射关系索引值;然后根据映射关系索引值可以确定出目标映射关系,进而确定出当前块的色度预测值。需要注意的是,这里建立的映射关系的数量可以任意设定,例如可以将数量设置为4,但是不作任何限定。
在一些实施例中,对于确定当前块的第二颜色分量的预测值,如图19所示,该方法可以包括:
S1901,在当前块的第一颜色分量块包括多个候选块时,确定当前块的第二参考预测参数集;其中,第二参考预测参数集包含多个第二候选参考预测参数。
S1902,根据多个第二候选参考预测参数,确定多个第一候选参考预测参数;并基于多个第一候选参考预测参数,确定第一颜色分量与第二颜色分量之间的多个候选映射关系。
S1903,基于模板匹配方式对多个候选映射关系进行匹配误差计算,以确定多个候选映射关系各自的第二代价值。
S1904,从多个候选映射关系各自的第二代价值中确定最小代价值,将最小代价值对应的候选映射关系确定为目标映射关系。
S1905,根据目标映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。
在一种具体的实施例中,基于模板匹配方式对多个候选映射关系进行匹配误差计算,以确定多个候选映射关系各自的第二代价值,可以包括:确定当前块的第一模板;确定第一模板的同位置的第一颜色分量区域模板的重建像素样值;根据多个候选映射关系和第一颜色分量区域模板的重建像素样值,确定第一模板在多个映射关系下各自的第二颜色分量的预测值;根据第一模板的第二颜色分量的重建值与第一模板在多个映射关系下各自的第二颜色分量的预测值进行代价计算,确定多个候选映射关系各自的第二代价值。
需要说明的是,在本申请实施例中,可以建立多个亮度与色度之间的映射表LUT,然后使用模板选择使用哪一个映射表LUT。示例性地,获取同位亮度区域的多个块,多个块的位置包括但不限于以下位置,如图11所示。多个块可以对应多个亮度BV,这多个亮度BV分别构建各自的色度BVC候选列表的候选项,判断该候选列表中的BV的可用性,以决策出一个BV或者多个BV或者通过聚类决策出多组BV,这多个块的各自的可用色度BVC能够分别建立一个映射表LUT;对当前块模板经过利用不同的映射表LUT进行预测,和模板的重建值计算差值,进而决策具体使用哪一个映射关系,然后使用最终决策出的映射关系来确定当前块的色度预测值。需要注意的是,这里建立的映射关系的数量可以任意设定,例如可以将数量设置为4,但是不作任何限定。
在一种具体的实施例中,对当前块模板进行LUT预测的具体过程为:
获取当前块模板对应的同位亮度区域模板lumaPos=(xCbR,yCbR)位置的重建亮度样本recBefDownLumaR,对该亮度样本进行下采样以得到下采样后的重建亮度样本recAftDownLumaR,对该样本进行相同样本范围的映射处理。
假设当前块模板的预测值为predSamplesR,则对于predSamplesR[cIdx][x][y],变量cIdx指定当前块的颜色分量索引,预测方式为:参考其同位置的亮度值Yc,以使用所建立的映射关系推导出预测值。如果在所建立的映射关系中的输入亮度集中未找到Yc,则包括但不限于以下处理方式:按{Yc+1、Yc-1、Yc+2、Yc-2、Yc+3、Yc-3}顺序进行检查,如果该映射关系中不能匹配以上所有值,则将当前块的色度预测值设置为对应BV处的重建色度样本recBvChroma的平均值。
在当前块模板以及每个LUT的模板预测值进行成本计算时,模板的使用情况存在以下几种情况:
第一种:当前块的上模板和左模板均存在,此时上模板和左模板均可用。
第二种:当前块仅上模板存在,此时仅上模板可用。
第三种:当前块仅左模板存在,此时仅左模板可用。
第四种:当前块上模板和左模板均不存在,此时最终选择的LUT为建立的第一个LUT或某个指定位置的LUT。
示例性地,在本申请实施例中,假设当前块模板的重建值为recSamplesR,对于计算模板区域成本的成本函数有多种选择,例如,可以选择绝对误差和(SAD)、变换绝对误差和(SATD)、差值平方和(SSE)、平均绝对差值(MAD)、平均绝对误差(MAE)、平均平方误差(MSE)等评价准则。下述内容所提到的某种评价准则均可从上述准则中选择其一,以SAD的评价准则为例,计算公式如下:
其中,predTempSizeW为模板的宽度,predTempSizeH为模板的高度,predSamplesR[i][j]为当前块模板的经过LUT后的预测像素点,recSamplesR[i][j]为当前块模板的重建像素点。
还需要说明的是,在本申请实施例中,对于利用当前块模板选择最终的LUT,除去无法计算成本的情况,其他情况对建立的每个LUT候选进行成本的计算,并排序,排序方法包括但不限于采用冒泡排序、选择排序、插入排序、希尔排序、归并排序、快速排序、基数排序、堆排序、计数排序、桶排序等排序方法。其中,选择成本最小的LUT候选作为最终使用的LUT。
在一些实施例中,在确定出当前块的第二颜色分量的预测值之后,该方法还可以包括:解码码流,确定当前块的第二颜色分量的残差值;根据残差值和预测值,确定当前块的第二颜色分量的重建值。
需要说明的是,在本申请实施例中,对于确定当前块的第二颜色分量的重建值,可以包括:对根据残差值和预测值进行加法运算,得到当前块的第二颜色分量的重建值。
在一些实施例中,该方法还包括:确定当前块的同位置的第一颜色分量区域;若当前块使用DM模式且第一颜色分量区域是基于块向量进行预测,则确定当前块使用第一预测模式。
需要说明的是,在本申请实施例中,确定当前块的同位置的第一颜色分量区域;若当前块使用DM模式且第一颜色分量区域是基于块向量进行预测,则确定当前块使用第一预测模式。
示例性地,在本申请实施例中,双树划分下,DM模式下,如果对应亮度区域具有BV信息,则当前块采用第一预测模式(BVG-LUT模式)进行预测。例如:
如果CuPredMode[0][xCb+cbWidth/2][yCb+cbHeight/2]等于MODE_IBC,置intra_bvglut_flag=1,则色度帧内预测模式IntraPredModeC[xCb][yCb]使用BVG-LUT。
如果CuPredMode[0][xCb+cbWidth/2][yCb+cbHeight/2]等于MODE_INTRA,如果IntraTmpFlag[xCb+cbWidth/2][yCb+cbHeight/2]等于1,置intra_bvglut_flag=1,则色度帧内预测模式IntraPredModeC[xCb][yCb]使用BVG-LUT。
在本申请实施例中,第一语法元素可以用于指示当前块是否使用BVG-LUT模式,第一语法元素可以用intra_bvgplt_flag或者bvgplt_flag表示。其中,色度预测模式推导如下:
色度帧内预测模式IntraPredModeC[xCb][yCb]使用cclm_mode_flag、cclm_mode_idx、下表中指定的intra_chroma_pred_mode、lumaIntraPredMode和lumaTempPredMode。这些除BVG-LUT模式之外的填充项是示例性的给出对应的值,而不是必须填写为该值。其中,表9示出了色度预测模式推导的示例。如表9所示,0代表Planar模式,1代表DC模式,18代表水平模式、50代表垂直模式,81~83代表CCLM模式。
表9
根据表9可以看出,DM模式下,如果intra_bvglut_flag==1,即同位亮度区域中心位置块获取到的信息含有BV,则色度帧内预测模式IntraPredModeC[xCb][yCb]使用BVG-LUT模式。
在一些实施例中,该方法还包括:确定第二语法元素的取值;在第二语法元素指示当前块允许使用第一预测模式时,执行确定当前块的预测参数的步骤。
需要说明的是,在本申请实施例中,第二语法元素可以用BvglutEnabled表示。如果第二语法元素的取值为第一值,则第二语法元素指示当前块允许使用第一预测模式;如果第二语法元素的取值为第二值,则第二语法元素指示当前块不允许使用第一预测模式。
还需要说明的是,在本申请实施例中,第一值与第二值不同。其中,第一值和第二值可以是参数形式,也可以是数字形式。具体地,无论是第一语法元素还是第二语法元素均可以是写入在概述(profile)中的参数,也可以是一个标志位/标识符的取值,这里也不作任何限定。
示例性地,第一值可以设置为1,第二值可以设置为0;或者,第一值可以设置为0,第二值可以设置为1;或者,第一值可以设置为true,第二值可以设置为false;或者,第一值可以设置为false,第二值可以设置为true。其中,在本申请实施例中,第一值可以设置为1,第二值可以设置为0,但是对此并不作任何限定。
示例性地,在本申请实施例中,如果语法元素sps_ibc_enabled_flag等于0且sps_intratmp_enabled_flag等于0,则BvglutEnabled等于0。否则,设置变量ModeIncludeBv,如果对应的亮度块没有以有BV信息的模式进行编码,则ModeIncludeBv等于0;否则ModeIncludeBv等于1。
在一种可能的实现方式中,如果以下多个条件同时为真(包括但不限于以下条件),则BvglutEnabled等于1:
ModeIncludeBv等于1;
sh_slice_type等于I帧;
CtbLog2SizeC小于等于MaxChromaIbcSize;其中,MaxChromaIbcSize可根据色度CTU大小或预设值确定。
在另一种可能的实现方式中,如果以下多个条件同时为真(包括但不限于以下条件),则BvglutEnabled等于1:
ModeIncludeBv等于1;
CtbLog2SizeC小于等于MaxChromaIbcSize;其中,MaxChromaIbcSize可根据色度CTU大小或预设值确定。
在又一种可能的实现方式中,如果以下多个条件同时为真(包括但不限于以下条件),则BvglutEnabled等于1:
CtbLog2SizeC小于等于MaxChromaIbcSize;其中,MaxChromaIbcSize可根据色度CTU大小或预设值确定。
针对每一种可能的实现方式,否则,BvglutEnabled等于0。在这里,如果BvglutEnabled等于0,那么第一语法元素的取值可以被推断为0。
还需要说明的是,在本申请实施例中,对于当前块的预测模式,也可以是在编码端根据BVG-LUT模式与其他模式进行竞争确定的。其中,在DM模式下,除了BVG-LUT模式,还可以与其他模式竞争。根据模板代价决定最终使用模式。例如,与直接使用由亮度得到的BV,可以直接利用BV复制,也可以利用本申请实施例定义的BVG-LUT模式,这两种模式均应用于当前块的模板后,选择模板代价更小的一个作为当前块的预测模式。
本实施例提供了一种解码方法,确定当前块的预测参数;根据预测参数,确定当前块的第一参考预测参数集;其中,第一参考预测参数集包含一个或多个第一候选参考预测参数;根据第一参考预测参数集,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值;根据第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系;根据映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。这样,如果当前块使用BVG-LUT模式,那么可以确定应用色度分量的第一参考预测参数集,并根据第一参考预测参数集,确定当前块的亮度分量参考样值和色度分量参考样值,以此建立亮度分量与色度分量之间的映射关系,然后利用该映射关系进行色度分量的预测。也就是说,这里充分利用了当前图像中已重建样本与当前块样本之间的相关性,改善了色度预测的单一性,从而能够提高色度预测的准确性;而且根据所建立的映射关系,还可以有效进行像素级的预测,从而能够进一步节省码率,提高编解码效率,进而提升编解码性能。
在本申请的另一实施例中,图20为本申请实施例提供的一种编码方法的流程示意图一。如图20所示,该方法可以包括:
S2001,确定当前块的预测参数。
需要说明的是,本申请实施例的编码方法应用于编码器。另外,该编码方法具体可以是指一种帧内预测方法,更具体地,是一种基于块向量的色度预测方法。其中,视频图像可以划分为多个编码块,每个编码块可以包括第一颜色分量、第二颜色分量和第三颜色分量,而本申请实施例中的当前块是指视频图像中当前待进行色度预测的编码块。
在这里,如果当前块进行第一颜色分量的预测,而且第一颜色分量为亮度分量,那么当前块也可以称为亮度块;或者,如果当前块进行第二颜色分量的预测,而且第二颜色分量为色度分量,那么当前块也可以称为色度块。
还需要说明的是,在本申请实施例中,对于预测参数来说,预测参数可以用于指示当前块是否使用第一预测模式。在一些实施例中,该方法可以包括:确定当前块使用第一预测模式的第一代价值,以及确定当前块不使用第一预测模式的第二代价值;根据第一代价值和第二代价值,确定预测参数。
在一种具体的实施例中,根据第一代价值和第二代价值,确定预测参数,可以包括:若第一代价值小于第二代价值,则确定预测参数指示当前块使用第一预测模式;若第一代价值大于第二代价值,则确定预测参数指示当前块不使用第一预测模式。
在一些实施例中,该方法还可以包括:根据预测参数,确定第一语法元素的取值;对第一语法元素的取值进行编码处理,将所得到的编码比特写入码流。
需要说明的是,在本申请实施例中,根据预测参数,确定第一语法元素的取值,可以包括:若预测参数指示当前块使用第一预测模式,则确定第一语法元素的取值为第一值;若预测参数指示当前块不使用第一预测模式,则确定第一语法元素的取值为第二值。
还需要说明的是,在本申请实施例中,若当前块使用第一预测模式,则确定预测参数的取值为第一值;若当前块不使用第一预测模式,则确定预测参数的取值为第二值。在这里,该方法还可以包括:将预测参数的取值设置为等于第一语法元素的取值。
还需要说明的是,在本申请实施例中,第一语法元素可以用intra_bvglut_flag表示,或者也可以用bvglut_flag表示。其中,第一语法元素可以用于指示当前块是否使用第一预测模式。在这里,若第一语法元素的取值为第一值,则确定当前块使用第一预测模式;若第一语法元素的取值为第二值,则确定当 前块不使用第一预测模式。
可以理解的是,在本申请实施例中,第一值与第二值不同。其中,第一值可以设置为1,第二值可以设置为0;或者,第一值可以设置为0,第二值可以设置为1;或者,第一值可以设置为真(true),第二值可以设置为假(false);或者,第一值可以设置为假(false),第二值可以设置为真(true)。
在一种具体的实施例中,第一值设置为1,第二值设置为0。示例性地,如果第一语法元素的取值为1,则表明预测参数指示当前块使用第一预测模式,此时继续执行本申请实施例的编码方法;否则,如果第一语法元素的取值为0,则表明预测参数指示当前块不使用第一预测模式,此时可以采用相关技术中的其他预测模式(例如PLANAR模式、CCLM模式、角度预测模式等)进行编码处理。
S2002,根据预测参数,确定当前块的第一参考预测参数集;其中,第一参考预测参数集包含一个或多个第一候选参考预测参数。
需要说明的是,在本申请实施例中,在预测参数指示当前块使用第一预测模式时,确定当前块的第一参考预测参数集。其中,第一预测模式可以为BVG-LUT模式。也就是说,对于当前块来说,如果当前块使用BVG-LUT模式,则可以确定当前块的第一参考预测参数集。
在一些实施例中,确定当前块的第一参考预测参数集,该方法可以包括:确定当前块的第一颜色分量块;根据第一颜色分量块,确定当前块的第二参考预测参数集;根据第二参考预测参数集,确定当前块的第一参考预测参数集。
需要说明的是,在本申请实施例中,第一参考预测参数集可以包含一个或多个第一候选参考预测参数。其中,第一候选参考预测参数可以为基于第二颜色分量的向量参数。
还需要说明的是,在本申请实施例中,第二参考预测参数集可以包含一个或多个第二候选参考预测参数。其中,第二候选参考预测参数可以为基于第一颜色分量的向量参数。
示例性地,第一颜色分量可以为亮度分量,第二颜色分量可以为色度分量,那么第一候选参考预测参数可以为基于色度分量的向量参数,第二候选参考预测参数可以为基于亮度分量的向量参数。
在一些实施例中,向量参数包括下述其中之一:块向量参数、运动向量参数。也就是说,无论是第一参考预测参数集还是第二参考预测参数集,均可以为应用于BV的参数列表,或者也可以为应用于MV的参数列表。
在一种具体的实施例中,以BV为例,这里的“第一参考预测参数”可以为基于色度分量的块向量参数,那么第一参考预测参数集可以称为色度BVC候选列表;这里的“第二参考预测参数”可以为基于亮度分量的块向量参数,那么第二参考预测参数集可以称为亮度BVL候选列表。
在一些实施例中,确定当前块的第一颜色分量块,该方法可以包括:确定当前块的同位置的第一颜色分量区域;基于第一颜色分量区域的多个划分块,确定当前块的第一颜色分量块。
需要说明的是,在本申请实施例中,如果第一颜色分量为亮度分量,那么第一颜色分量区域也可称为“同位亮度区域”。例如,如果当前块为色度块,那么同位亮度区域可以是指当前块对应的同位置亮度区域。对于当前块而言,在同位置的第一颜色分量区域,可以对其进行块划分,例如采用二叉树结构、三叉树结构、四叉树结构等进行块划分,能够得到多个块,每一个块可以看作是一个CU、一个子块或者一个变换块等;然后从这多个划分块中确定出当前块的第一颜色分量块。
示例性地,以图3为例,用斜线填充的区域表示色度分量对应的同位亮度区域。在该同位亮度区域中,可以划分有多个块;可以从这些块中选取中心位置的块作为当前块的对应亮度块,例如图3中用黑色填充的块即为当前块的对应亮度块(第一颜色分量块)。
在一种具体的实施例中,对于确定当前块的第一颜色分量块,该方法可以包括:从多个划分块中,确定处于第一位置的第一候选块;根据处于第一位置的第一候选块,确定当前块的第一颜色分量块。
在本申请实施例中,第一位置可以是指第一颜色分量区域的任意位置。示例性地,第一位置可以为第一颜色分量区域中的中心位置、左上角位置、右下角位置、特定位置等。
在本申请实施例中,第一候选块可以是指处于第一位置的块。在一种具体的实施例中,将第一颜色分量区域中处于中心位置的块选取为第一候选块;和/或,将第一颜色分量区域中处于左上角位置的块选取为第一候选块;和/或,将第一颜色分量区域中处于右下角位置的块选取为第一候选块,等等,这里不作任何限定。
进一步地,在一些实施例中,根据处于第一位置的第一候选块,确定当前块的第一颜色分量块,该方法可以包括:在第一位置的预设搜索区域进行位置偏移搜索,确定多个第二候选块;根据第一候选块和/或多个第二候选块,确定当前块的第一颜色分量块。
在本申请实施例中,在第一位置的预设搜索区域进行位置偏移搜索,可以是在第一位置的基础上向左上、上、左等方向搜索多个位置,例如可以获取第一位置的向左上坐标偏移(xOffset,yOffset)=(-2,-2),向上坐标偏移(xOffset,yOffset)=(0,-2),向左坐标偏移(xOffset,yOffset)=(-2,0)等,这 里不作任何限定。
在一些实施例中,确定当前块的第一颜色分量块,可以包括:确定当前块的位置信息;根据预设采样格式对当前块的位置信息进行缩放处理,得到当前块对应的同位区域位置信息;根据同位区域位置信息确定目标位置信息,将包含目标位置信息的候选块作为当前块的第一颜色分量块。
在一些实施例中,根据同位区域位置信息确定目标位置信息,可以包括:根据同位区域位置信息进行中心位置计算,将所得到的中心位置信息作为目标位置信息;或者,根据同位区域位置信息进行左上角位置计算,将所得到的左上位置信息作为目标位置信息;或者,根据同位区域位置信息进行右下角位置计算,将所得到的左下位置信息作为目标位置信息。
在本申请实施例中,预设采样格式可以为色度采样格式(或称为颜色采样格式)。示例性地,当前块的位置(x,y)与同位区域位置(xCb,yCb)之间的映射关系如表4所示。
在一种可能的实现方式中,获取当前块的位置,即当前块的左上角色度样本相对于当前图像的左上角色度样本的位置,chromaPos=(x,y),根据表4所示的色度采样格式对chromaPos进行缩放,得到当前块对应的同位亮度区域位置lumaPos=(xCb,yCb)。
在这里,假设当前块左上角对应的同位亮度像素相对于图像左上角亮度像素的位置为(xCb,yCb),当前块对应的同位亮度区域(即图3中亮度分量的整个斜线填充区域)的宽度为cbWidth,高度为cbHeight;那么处于中心位置的块(亮度区域中心位置块),即为包含中心坐标(xCb+cbWidth>>1,yCb+cbHeight>>1)的亮度块,也即在图3中用黑色填充的块。其中,在图3中,白色小块表示中心坐标的位置,可以用于定位该亮度块的位置。
在这里,对于多个第二候选块,在该亮度块位置上可以向左上、上和左搜索多个位置,包括但不限于以下示例性的搜索位置:获取同位亮度区域中心位置的向左上坐标偏移(xOffset,yOffset)=(-2,-2),向上坐标偏移(xOffset,yOffset)=(0,-2),向左坐标偏移(xOffset,yOffset)=(-2,0)。亮度区域所采用亮度块即为包含位置坐标(xCb+cbWidth>>1+xOffset,yCb+cbHeight>>1+yOffset)的亮度块。
在另一种可能的实现方式中,获取当前块的位置,即当前块的左上角色度样本相对于当前图像的左上角色度样本的位置,chromaPos=(x,y),根据表4所示的色度采样格式对chromaPos进行缩放,得到当前块对应的同位亮度区域位置lumaPos=(xCb,yCb)。
在这里,假设当前块左上角对应的同位亮度像素相对于图像左上角亮度像素的位置为(xCb,yCb),当前块对应的同位亮度区域(即图9中亮度分量的整个斜线填充区域)的宽度为cbWidth,高度为cbHeight;那么处于左上角位置的块(亮度区域左上角块),即为包含左上角坐标(xCb,yCb)的亮度块,也即在图9中用黑色填充的块。其中,在图9中,白色小块表示左上角坐标的位置,可以用于定位该亮度块的位置。
在这里,对于多个第二候选块,在该亮度块位置上可以向左上、上和左搜索多个位置,包括但不限于以下示例性的搜索位置:获取同位亮度区域左上角位置的向左上坐标偏移(xOffset,yOffset)=(-2,-2),向上坐标偏移(xOffset,yOffset)=(0,-2),向左坐标偏移(xOffset,yOffset)=(-2,0)。亮度区域所采用亮度块即为包含位置坐标(xCb+xOffset,yCb+yOffset)的亮度块。
在又一种可能的实现方式中,获取当前块的位置,即当前块的左上角色度样本相对于当前图像的左上角色度样本的位置,chromaPos=(x,y),根据表4所示的色度采样格式对chromaPos进行缩放,得到当前块对应的同位亮度区域位置lumaPos=(xCb,yCb)。
在这里,假设当前块左上角对应的同位亮度像素相对于图像左上角亮度像素的位置为(xCb,yCb),当前块对应的同位亮度区域(即图10中亮度分量的整个斜线填充区域)的宽度为cbWidth,高度为cbHeight;那么处于右下角位置的块(亮度区域右下角块),即为包含右下角坐标(xCb+cbWidth-1,yCb+cbHeight-1)的亮度块,也即在图10中用黑色填充的块。其中,在图10中,白色小块表示右下角坐标的位置,可以用于定位该亮度块的位置。
在这里,对于多个第二候选块,在该亮度块位置上可以向左上、上和左搜索多个位置,包括但不限于以下示例性的搜索位置:获取同位亮度区域右下角位置的向左上坐标偏移(xOffset,yOffset)=(-2,-2),向上坐标偏移(xOffset,yOffset)=(0,-2),向左坐标偏移(xOffset,yOffset)=(-2,0)。亮度区域所采用亮度块即为包含位置坐标(xCb+cbWidth-1+xOffset,yCb+cbHeight-1+yOffset)的亮度块。
也就是说,在本申请实施例中,对于作为第一颜色分量块的第一候选块,可以是图3所示多个块中的任意位置的块。例如,如图3所示的同位亮度区域中处于中心位置的块(用黑色填充的块),如图9所示的同位亮度区域中处于左上角位置的块(用黑色填充的块),如图10所示的同位亮度区域中处于右下角位置的块(用黑色填充的块),甚至还可以是同位亮度区域中处于右上角位置的块、处于左下角位置的块,更甚者可以是处于左上区域的中心位置的块等等,这里不作任何限定。进一步地,在第一候选块的基础上,还可以向左上、上和左等搜索多个位置,以得到多个第二候选块。然后根据第一候选块和 /或多个第二候选块,从而能够确定出当前块的第一颜色分量块。
在一些实施例中,该方法还可以包括:从第一颜色分量区域的多个划分块中,确定处于预设位置的至少一个候选块;根据至少一个候选块,确定当前块的第一颜色分量块。
在本申请实施例中,可以将这至少一个候选块作为当前块的第一颜色分量块。也就是说,对于第一颜色分量块,可以是依次获取的至少一个候选块。例如,如图11所示,这里包括五个亮度像素位置的CU,具体为:C、TL、TR、BL和BR。但是本申请实施例并不局限于五个位置,可以是多个不同位置;而且也并不局限于图11所示的五个位置,对此均不作任何限定。
在又一种可能的实现方式中,以图11所示的包含五个亮度像素位置的块为例,可以按照预设顺序依次获取,该预设顺序包括但不限于以下顺序:C->TL->TR->BL->BR。
对于C、TL、TR、BL、BR的详细位置推导过程,获取当前块的位置,即当前块的左上角色度样本相对于当前图像的左上角色度样本的位置,chromaPos=(x,y),根据表4所示的色度采样格式对chromaPos进行缩放,得到当前块对应的同位亮度区域位置lumaPos=(xCb,yCb)。
在这里,假设当前块左上角对应的同位亮度像素相对于图像左上角亮度像素的位置(即亮度像素TL的位置)为(xCb,yCb),当前色度编码块对应的同位亮度区域(即图11中亮度分量的整个斜线填充区域)的宽度为cbWidth,高度为cbHeight。
亮度像素C的位置的坐标为(xCb+cbWidth/2,yCb+cbHeight/2);
亮度像素TL的位置的坐标为(xCb,yCb);
亮度像素TR的位置的坐标为(xCb+cbWidth-1,yCb);
亮度像素BL的位置的坐标为(xCb,yCb+cbHeight-1);
亮度像素BR的位置的坐标为(xCb+cbWidth-1,yCb+cbHeight-1)。
在这里,搜索每个位置时,在此位置上也可以向左上、上和左搜索多个位置,包括但不限于以下示例性的搜索位置:获取此位置的向左上坐标偏移(xOffset,yOffset)=(-2,-2),向上坐标偏移(xOffset,yOffset)=(0,-2),向左坐标偏移(xOffset,yOffset)=(-2,0)。亮度区域所采用亮度块即为包含该位置坐标加上述偏移位置的位置坐标的亮度块。
这样,对于当前块而言,首先需要确定出对应的第一颜色分量块。示例性地,在第一颜色分量为亮度分量时,这里需要确定出当前块的对应亮度块。具体地,可以使用上述的几种可能的实现方式来确定出一个或多个对应亮度块。
可以理解,在确定出第一颜色分量块之后,可以构建当前块的第二参考预测参数集。在一些实施例中,该方法可以包括:根据第一颜色分量块,确定一个或多个基于第一颜色分量的候选向量参数;根据一个或多个基于第一颜色分量的候选向量参数,确定当前块的第二参考预测参数集。
需要说明的是,在本申请实施例中,根据一个或多个基于第一颜色分量的候选向量参数,确定当前块的第二参考预测参数集,可以包括:对基于第一颜色分量的候选向量参数进行调整,确定基于第二颜色分量的候选向量参数;在基于第二颜色分量的候选向量参数满足预设可用条件时,将基于第一颜色分量的候选向量参数作为第二候选参考预测参数并添加至第二参考预测参数集。
在这里,以块向量参数BV为例,假设当前块为色度块,第一颜色分量块为亮度块,那么基于第一颜色分量的候选向量参数可以为亮度块的BV,即BVL;基于第二颜色分量的候选向量参数可以为色度块的BV,即BVC。
还需要说明的是,在本申请实施例中,假设基于第一颜色分量的候选向量参数为亮度BV=(BVLhor,BVLver),基于第二颜色分量的候选向量参数为色度BV=(BVChor,BVCver),那么可以通过调整BVL(亮度BV)来确定出对应的色度BV。
在一种具体的实施例中,对基于第一颜色分量的候选向量参数进行调整,确定基于第二颜色分量的候选向量参数,可以包括:确定当前块的预设采样格式;根据预设采样格式对基于第一颜色分量的候选向量参数进行缩放,确定基于第二颜色分量的候选向量参数。
需要说明的是,在本申请实施例中,上述调整可以包括根据预设采样格式进行缩放处理。其中,预设采样格式可以为表8所示的亮度BV与缩放后的色度BV之间的映射关系。在这里,预设采用格式可以是指颜色采样格式,例如单色、4:2:0、4:2:2、4:4:4等。语法元素sps_chroma_format_idc用于指示颜色采样格式的类型,这里的颜色采样格式具体为色度采样格式。在这里,颜色采样格式的类型不同,其对应的缩放操作也是不同的。
示例性地,若sps_chroma_format_idc的取值为0,则确定颜色采样格式为单色,即不存在色度BV参数(BVChor,BVChor);若sps_chroma_format_idc的取值为1,则确定颜色采样格式为4:2:0,这时候亮度BV与色度BV之间的映射关系为:BVChor=BVLhor>>1,BVChor=BVLver>>1;若sps_chroma_format_idc的取值为2,则确定颜色采样格式为4:2:2,这时候亮度BV与色度BV之间的映射关系为: BVChor=BVLhor>>1,BVChor=BVLver;若sps_chroma_format_idc的取值为3,那么表示颜色采样格式为4:4:4,这时候亮度BV与色度BV之间的映射关系为:BVChor=BVLhor,BVChor=BVLver
这样,基于表8,可以选择根据颜色采样格式对候选BVL进行缩放,得到缩放后的BVC;然后判断缩放后的BVC是否满足预设可用条件。其中,缩放后的BVC满足预设可用条件,包括但不限于:
根据缩放后的BVC指示的偏移位置未超出图像边界;
根据缩放后的BVC指示的偏移位置未超出片边界;
根据缩放后的BVC指示的偏移位置未覆盖当前块;
根据缩放后的BVC指示的偏移位置未超出预设可用区域;
根据缩放后的BVC指示的偏移位置已经重建。
还需要说明的是,在本申请实施例中,根据第一颜色分量块,将得到的一个或多个基于第一颜色分量的候选向量参数(即一个或多个候选BVL)进行缩放。其中,如果基于表8所示的颜色采样格式对某一个候选BVL进行缩放,而且缩放后的BVC满足预设可用条件,那么可以将这个候选BVL作为第二候选参考预测参数并添加至第二参考预测参数集,以此构建第二参考预测参数集。其中,第二参考预测参数集可以包含一个或多个第二候选参考预测参数。
还可以理解,在构建出第二参考预测参数集之后,可以进一步确定当前块的第一参考预测参数集。在一些实施例中,该方法可以包括:对第二参考预测参数集中的一个或多个第二候选参考预测参数进行调整,确定一个或多个第二候选参考预测参数各自对应的第一候选参考预测参数;根据一个或多个第二候选参考预测参数各自对应的第一候选参考预测参数,确定当前块的第一参考预测参数集。
需要说明的是,在本申请实施例中,第一候选参考预测参数与第二候选参考预测参数的数量相同。也就是说,针对每一个第二候选参考预测参数,可以对其进行调整,得到一个或多个第一候选参考预测参数,然后从中决策出一个可用的第一候选参考预测参数。但是需要注意的是,第一候选参考预测参数与第二候选参考预测参数的数量也可以不同,此时每一个第二候选参考预测参数决策出可用的第一候选参考预测参数可以不只一个,这里不作任何限定。
在一些实施例中,对第二参考预测参数集中的一个或多个第二候选参考预测参数进行调整,确定一个或多个第二候选参考预测参数各自对应的第一候选参考预测参数,这里以其中一个第二候选参考预测参数为例,该方法可以包括:对第二候选参考预测参数进行调整,确定基于第二颜色分量的第三参考预测参数集;根据第三参考预测参数集,确定第二候选参考预测参数对应的第一候选参考预测参数。
在本申请实施例中,针对每一个第二候选参考预测参数,都可以采用这种方式来确定出各自对应的第一候选参考预测参数,以得到第一参考预测参数集。
示例性地,假设当前块为色度块,第一颜色分量块为亮度块,那么第一候选参考预测参数可以为色度块的候选BV,即候选BVC;第二候选参考预测参数可以为亮度块的候选BV,即候选BVL。其中,对第二候选参考预测参数进行调整,可以确定一个或多个基于第二颜色分量的候选向量参数,即一个或多个候选BVC,这些候选BVC能够构建出第三参考预测参数集。
可以理解的是,在本申请实施例中,假设第二候选参考预测参数为亮度BV=(BVLhor,BVLver),基于第二颜色分量的候选向量参数为色度BV=(BVChor,BVCver),那么可以选择通过调整BVL(亮度BV)或BVC(色度BV)来构建包含一个或者多个候选块向量参数的色度BVC候选列表。
在一种可能的实现方式中,对第二候选参考预测参数进行调整,确定基于第二颜色分量的第三参考预测参数集,可以包括:根据当前块的预设采样格式对第二候选参考预测参数进行缩放,确定基于第二颜色分量的候选向量参数,并将基于第二颜色分量的候选向量参数添加至第三参考预测参数集。
需要说明的是,在本申请实施例中,上述调整可以包括根据预设采样格式进行缩放处理。其中,预设采样格式可以为表8所示的亮度BV与缩放后的色度BV之间的映射关系。在这里,预设采用格式可以是指颜色采样格式,例如单色、4:2:0、4:2:2、4:4:4等。如此,可以选择根据表8所示的颜色采样格式进行缩放,将缩放后的BVC作为候选向量参数添加至第三参考预测参数集中。
在另一种可能的实现方式中,对第二候选参考预测参数进行调整,确定基于第二颜色分量的第三参考预测参数集,可以包括:根据当前块的预设采样格式对第二候选参考预测参数进行缩放,确定基于第二颜色分量的第一初始向量参数;根据一个或多个偏移值对基于第二颜色分量的第一初始向量参数进行偏移计算,确定一个或多个基于第二颜色分量的候选向量参数,并将一个或多个基于第二颜色分量的候选向量参数添加至第三参考预测参数集。
在又一种可能的实现方式中,对第二候选参考预测参数进行调整,确定基于第二颜色分量的第三参考预测参数集,可以包括:根据一个或多个偏移值对第二候选参考预测参数进行偏移计算,确定一个或多个基于第一颜色分量的第二初始向量参数;根据当前块的预设采样格式对一个或多个基于第一颜色分量的第二初始向量参数进行缩放,确定一个或多个基于第二颜色分量的候选向量参数,并将一个或多个 基于第二颜色分量的候选向量参数添加至第三参考预测参数集。
需要说明的是,在本申请实施例中,上述一个或多个偏移值可以为任意数量的任意数值,例如-1、+1、-2、+2、-3、+3等,这里不作任何限定。
也就是说,在本申请实施例中,可以在获取对应亮度块的BV后,将其记为BVL,通过BVL获取到的色度BV,记为BVC,然后通过调整BVL或BVC来构建包含一个或者多个候选的色度BVC候选项。候选项的构建方式包括但不限于以下情况:
在一种可能的构建方式中,可以调整BVL形成四种情况,进而实现对BVC的调整。其中,当BVL为奇数时,取BVL=(BVLhor,BVLver)、BVL=(BVLhor+1,BVLver)、BVL=(BVLhor,BVLver+1)、BVL=(BVLhor+1,BVLver+1)四种情况。当BVL为偶数时,取BVL=(BVLhor,BVLver)。
或者,当BVL为偶数时,取BVL=(BVLhor,BVLver)、BVL=(BVLhor+1,BVLver)、BVL=(BVLhor,BVLver+1)、BVL=(BVLhor+1,BVLver+1)四种情况。
在这里,BVC[0]=BVL[0]*2/SubWidthC,BVC[1]=BVL[1]*2/SubHeightC。SubWidthC和SubHeightC可以根据表1中的sps_chroma_format_idc与颜色采样格式的映射关系来确定。
根据上述公式对BVL进行缩放得到BVC,这样当BVL为奇数或偶数时,会形成四种BVC候选,将这些候选添加至色度BVC候选列表(即第三参考预测参数集)。
在另一种可能的构建方式中,可以调整BVL形成四种情况,进而实现对BVC的调整。其中,当BVL为奇数时,取BVL=(BVLhor,BVLver)、BVL=(BVLhor+1,BVLver)、BVL=(BVLhor,BVLver+1)、BVL=(BVLhor+1,BVLver+1)四种情况。当BVL为偶数时,取BVL=(BVLhor,BVLver)、BVL=(BVLhor-1,BVLver)、BVL=(BVLhor,BVLver-1)、BVL=(BVLhor-1,BVLver-1)四种情况。接着,根据表8中的颜色采样格式对BVL进行缩放得到BVC,这样当BVL为奇数或者偶数时,均会形成四种BVC候选,将这些候选添加至色度BVC候选列表(即第三参考预测参数集)。
需要说明的是,在这种构建方式中,也可以通过以下计算统一奇偶数不同情况下的操作:取BVL=(BVLhor-1,BVLver-1)、BVL=(BVLhor+1,BVLver-1)、BVL=(BVLho-1r,BVLver+1)、BVL=(BVLhor+1,BVLver+1)四种情况。
在又一种可能的构建方式中,可以调整BVL形成多种情况,进而实现对BVC的调整。其中,当BVL为奇数时,取BVL=(BVLhor,BVLver)、BVL=(BVLhor+1,BVLver)、BVL=(BVLhor,BVLver+1)、BVL=(BVLhor+1,BVLver+1)、BVL=(BVLhor+3,BVLver)、BVL=(BVLhor,BVLver+3)、BVL=(BVLhor+3,BVLver+3)、BVL=(BVLhor-2,BVLver)、BVL=(BVLhor,BVLver-2)等多种情况,对这些候选按顺序构建列表。当BVL为偶数时,取BVL=(BVLhor,BVLver)、BVL=(BVLhor-1,BVLver)、BVL=(BVLhor,BVLver-1)、BVL=(BVLhor-1,BVLver-1)、BVL=(BVLhor-3,BVLver)、BVL=(BVLhor,BVLver-3)、BVL=(BVLhor-3,BVLver-3)、BVL=(BVLhor+2,BVLver)、BVL=(BVLhor,BVLver+2)等多种情况。接着,根据表8中的颜色采样格式对BVL进行缩放得到BVC,这样当BVL为奇数或者偶数时,均会形成多种BVC候选,将这些候选添加至色度BVC候选列表(即第三参考预测参数集)。
需要说明的是,在这种构建方式中,也可以通过以下计算统一奇偶数不同情况下的操作:取BVL=(BVLhor-1,BVLver-1)、BVL=(BVLhor+1,BVLver-1)、BVL=(BVLhor-1,BVLver+1)、BVL=(BVLhor+1,BVLver+1)、BVL=(BVLhor+3,BVLver-1)、BVL=(BVLhor-1,BVLver+3)、BVL=(BVLhor+3,BVLver+3)、BVL=(BVLhor-3,BVLver-1)、BVL=(BVLhor-1,BVLver-3)等。
在又一种可能的构建方式中,还可以对得到的BVC进行调整得到九种候选:即设置BVC=(BVChor,BVCver)、BVC=(BVChor-1,BVCver)、BVC=(BVChor,BVCver-1)、BVC=(BVChor-1,BVCver-1)、BVC=(BVChor+1,BVCver)、BVC=(BVChor,BVCver+1)、BVC=(BVChor+1,BVCver+1)、BVC=(BVChor-1,BVCver+1)、BVC=(BVChor+1,BVCver-1),这样就形成了九种BVC候选,将这些候选添加至色度BVC候选列表(即第三参考预测参数集)。
在又一种可能的构建方式中,还可以对得到的BVC进行调整得到多种候选:即设置BVC=(BVChor,BVCver)、BVC=(BVChor-1,BVCver)、BVC=(BVChor,BVCver-1)、BVC=(BVChor-1,BVCver-1)、BVC=(BVChor+1,BVCver)、BVC=(BVChor,BVCver+1)、BVC=(BVChor+1,BVCver+1)、BVC=(BVChor-1,BVCver+1)、BVC=(BVChor+1,BVCver-1)、BVC=(BVChor-2,BVCver)、BVC=(BVChor,BVCver-2)、BVC=(BVChor-2,BVCver-2)、BVC=(BVChor+2,BVCver)、BVC=(BVChor,BVCver+2)、BVC=(BVChor+2,BVCver+2)、BVC=(BVChor-2,BVCver+2)、BVC=(BVChor+2,BVCver-2)等,这样就形成了多种BVC候选,将这些候选添加至色度BVC候选列表(即第三参考预测参数集)。
还需要说明的是,在本申请实施例中,对于BVL为奇数或者偶数的情况,由于BVL是一个二维矢量,这里具体是指其中的某个分量为奇数或者偶数。另外,这里的“+1”、“-1”、“+2”、“-2”、“+3”、“-3”均是指整像素精度。
可以理解,在本申请实施例中,在根据第三参考预测参数集来确定第一候选参考预测参数时,还需要判断第三参考预测参数集中的候选向量参数是否可用,即需要从第三参考预测参数集中选择一个或多个可用的候选向量参数。因此,在一些实施例中,根据第三参考预测参数集,确定第二候选参考预测参数对应的第一候选参考预测参数,可以包括:判断第三参考预测参数集是否存在满足预设可用条件的一个或多个候选向量参数;在第三参考预测参数集存在满足预设可用条件的一个或多个候选向量参数时,根据一个或多个候选向量参数确定第一候选参考预测参数。
具体来讲,在本申请实施例中,只有在候选向量参数满足预设可用条件时,才有可能将候选向量参数确定为第一候选参考预测参数。
在一些实施例中,一个或多个候选向量参数满足预设可用条件,包括但不限于:
根据一个或多个候选向量参数指示的偏移位置未超出图像边界;
根据一个或多个候选向量参数指示的偏移位置未超出片边界;
根据一个或多个候选向量参数指示的偏移位置未覆盖当前块;
根据一个或多个候选向量参数指示的偏移位置未超出预设可用区域;
根据一个或多个候选向量参数指示的偏移位置已经重建。
需要说明的是,在本申请实施例中,假定当前块的位置(xCb,yCb),针对候选向量参数,BVC=(BVChor,BVCver),此时找到对应的偏移位置(xCb+BVChor,yCb+BVCver)。在这里,偏移位置未超出图像边界也可以使用坐标位置信息与当前块的尺寸参数等数据进行具体描述。例如,xCb+width+BVChor<=xCb或yCb+height+BVCver<=yCb。
还需要说明的是,在本申请实施例中,这里的预设可用条件,也可以考虑是否超出片边界。例如根据一个或多个候选向量参数指示的偏移位置未超出slice边界,或者根据一个或多个候选向量参数指示的偏移位置未超出tile边界。
在本申请实施例中,只有上述条件全部成立的情况下,这时候才可以确定候选向量参数满足预设可用条件,即候选向量参数可用。在一种具体的实施例中,以其中一个候选向量参数为例,该候选向量参数满足预设可用条件,至少包括:根据候选向量参数指示的偏移位置未超出图像边界;以及根据候选向量参数指示的偏移位置未超出片边界;以及根据候选向量参数指示的偏移位置未覆盖当前块;以及根据候选向量参数指示的偏移位置未超出预设可用区域;以及根据候选向量参数指示的偏移位置已经重建。
示例性地,图12示出了本申请实施例提供的一种偏移位置是否未覆盖当前块的结构示意图。如图12所示,用黑色填充的块表示当前块,用斜线填充区域表示可用区域,无填充区域表示不可用区域。对于当前块而言,如果候选块向量参数指示的偏移位置处于不可用区域,那么就会发生偏移位置覆盖当前块的情况。
示例性地,图13示出了本申请实施例提供的一种偏移位置是否超出预设可用区域的结构示意图。如图13所示,用黑色填充的块表示当前块,用斜线填充区域表示可用区域,而且可用区域内的参考块均已经重建。在本申请实施例中,考虑到Buffer的存储能力,通常情况下,可以将当前块(m,n)相邻的这些参考块,具体为:参考块(m-2,n-2)、参考块(m-1,n-2)、参考块(m,n-2)、参考块(m+1,n-2)、参考块(m-2,n-1)、参考块(m-1,n-1)、参考块(m,n-1)、参考块(m+1,n-1)、参考块(m-2,n)、参考块(m-1,n)等作为预设可用区域。
也就是说,在进行是否可用的判断时,可以获取当前块的位置(xCb,yCb),获取色度BVC=(BVChor,BVCver),找到对应的偏移位置(xCb+BVChor,yCb+BVCver),判断以下条件,包括但不限于以下条件(即预设可用条件),如果均成立则该色度BV可用:
得到的偏移位置是否未超出图像边界;
得到的偏移位置是否未覆盖当前块,具体参见图12;
xCb+width+BVChor<=xCb或yCb+height+BVCver<=yCb;
得到的偏移位置是否未超出预设可用区域,具体参见图13;
得到的偏移位置是否已经重建。
还可以理解,在本申请实施例中,第三参考预测参数集的构建方式包括但不限于如上所述的多种情况,可采用其中之一构建候选列表,也可以同时使用多种方式且构建列表,即针对每个BVL确定出四个BVC候选,以构建出第三参考预测参数集。然后针对每个BVL对应的四个BVC候选决策出一个可用BVC,即该BVL对应的第一候选参考预测参数。
在一些实施例中,根据一个或多个候选向量参数确定第一候选参考预测参数,包括:若第三参考预测参数集存在满足预设可用条件的一个候选向量参数,则将满足预设可用条件的一个候选向量参数确定为第一候选参考预测参数;若第三参考预测参数集存在满足预设可用条件的多个候选向量参数,则对满足预设可用条件的多个候选向量参数进行决策,确定第一候选参考预测参数。
需要说明的是,在本申请实施例中,如果存在满足预设可用条件的一个或多个候选向量参数,那么在根据一个或多个候选向量参数确定第一候选参考预测参数时,可以直接将满足预设可用条件的某一个候选向量参数确定为第一候选参考预测参数。也就是说,如果构建的可用BVC候选列表仅有一个BVC候选满足预设可用条件,那么最终选择的第一候选参考预测参数即为该BVC。
还需要说明的是,在本申请实施例中,如果存在满足预设可用条件的多个候选向量参数,那么还可以对满足预设可用条件的多个候选向量参数进行决策。具体可以为:确定当前块的第一模板;根据第一模板和多个候选向量参数,确定多个候选向量参数各自的第一匹配模板;在第一模板与第一匹配模板满足预设存在条件时,根据预设的误差准则,计算当前块的第一模板与第一匹配模板之间的匹配误差,以确定多个候选向量参数各自的第一代价值;从多个候选向量参数各自的第一代价值中确定最小代价值,将最小代价值对应的候选向量参数确定为第一候选参考预测参数。
也就是说,在本申请实施例中,对满足预设可用条件的多个候选向量参数,在确定多个候选向量参数对应的第一代价值之后,可以根据第一代价值,从多个候选向量参数中确定一个或多个候选向量参数。示例性地,如果构建的可用BVC候选列表有多个可用的BVC候选,那么便需要对这些可用的BVC进行决策以得到最终的BV,决策的方式包括但不限于采用模板进行决策的方式。
需要说明的是,在本申请实施例中,第一模板包括当前块的相邻已解码区域中的一个或多个样值。相应地,第一模板的类型可以包括下述至少一项:上模板、右上模板、左模板、左下模板和左上模板。其中,上模板位于当前块相邻的上侧已解码区域,右上模板位于当前块相邻的右上侧已解码区域,左模板位于当前块相邻的左侧已解码区域,左下模板位于当前块相邻的左下侧已解码区域,左上模板位于当前块相邻的左上侧已解码区域。
还需要说明的是,在本申请实施例中,在进行模板(当前块的第一模板)的选择时,可以根据当前块的相邻区域的像素可用性,判断模板位置的像素是否可用,包括重建色度信息。图14为模板类型的示意图,如图14所示,根据模板与当前块的相对位置关系,可将模板分类为上模板、左模板、右上模板、左下模板、左上模板等模板类型。其中,不同编码块的不同类型的模板尺寸可以固定相同,也可以不同。
例如,模板尺寸对任意尺寸的当前块选择相同的模板尺寸,如下公式说明了一种模板尺寸的设置条件,其中,nTbW和nTbH分别为当前块的宽度和高度,iTempW和iTempH分别为采用的模板的宽度和高度:
上模板:
左模板:
例如,可以根据当前块的不同尺寸选择不同的模板尺寸,如下公式说明了一种模板的尺寸设置条件,nTbW和nTbH分别为当前块的宽度和高度,iTempW和iTempH分别为采用的模板的宽度和高度:
上模板:
左模板:
其中,
例如,也可以根据当前块内的像素数选择不同的模板尺寸,如下公式说明了一种模板的尺寸设置条件,nTbW和nTbH分别为当前块的宽度和高度,nTbW×nTbH分别为当前块的像素数,iTempW和iTempH分别为采用的模板的宽度和高度:
上模板:
左模板:
在一些实施例中,在根据多个候选向量参数确定第一匹配模板时,以当前点的位置为起点,将多个候选向量参数所指示的、与第一模板具有相同形状和包含相同数量样值的区域,确定为第一匹配模板。
示例性地,在本申请实施例中,在进行第一匹配模板的确定时,对得到的多种BVC候选(即满足预设可用条件的候选块向量参数),利用当前块的第一模板进行运动补偿,得到对应BV处的模板(第一匹配模板)。图15为模板运动补偿的示意图,如图15所示,如果BV(BVC候选)是可用的,就会利用第一模板和该BV进行运动补偿,得到对应BV处的模板,即第一匹配模板。
还可以理解地,在本申请实施例中,预设的误差准则可以包括但不限于绝对误差和SAD、变换绝对误差和SATD、差值平方和SSE、平均绝对差值MAD、平均绝对误差MAE、平均平方误差MSE等的任意一种。
示例性地,在本申请实施例中,在进行成本计算时,即确定第一代价值时,对于计算模板区域的成本的成本函数有多种选择,即预设的误差准则可以有多种选择。例如,可以选择绝对误差和(SAD)、变换绝对误差和(SATD)、差值平方和(SSE)、平均绝对差值(MAD)、平均绝对误差(MAE)、平均平方误差(MSE)等评价准则。下述内容所提到的某种评价准则均可从上述准则中选择其一,以SAD的评价准则为例,计算公式如下:
其中,predTempSizeW为模板的宽度,predTempSizeH为模板的高度,predTemp[i][j]为BV处模板的像素点,recTempC[i][j]为当前块模板的像素点。
进一步地,在一些实施例中,该方法还可以包括:在第一模板与第一匹配模板不满足预设存在条件时,将第三参考预测参数集中满足预设可用条件的第一个候选向量参数确定为第一候选参考预测参数;或者,在第一模板与第一匹配模板不满足预设存在条件时,将第三参考预测参数集中满足预设可用条件的第二位置处的候选向量参数确定为第一参考预测参数。
也就是说,如果第一模板与第一匹配模板满足预设存在条件,这时候可以根据预设的误差准则计算当前块的第一模板与第一匹配模板之间的匹配误差,以选择最小代价值对应的候选向量参数作为第一候选参考预测参数;如果第一模板与第一匹配模板不满足预设存在条件,这时候可以将第三参考预测参数集中满足预设可用条件的第一个候选向量参数或者某个指定位置处的候选向量参数确定为第一候选参考预测参数。
示例性地,针对第一模板与第一匹配模板是否满足预设存在条件,计算成本(即代价值)时的模板使用情况存在以下几种情况:
第一种:当前块的上模板和左模板均存在,且对应BV处的上模板和左模板均存在,此时上模板和左模板均可用。
第二种:当前块的上模板和左模板均存在,对应BV处仅上模板存在,此时存在两种方法:方法一:对应BV处左模板不存在,直接不用,即仅用上模板计算。方法二:对应BV处左模板不存在,采用参考块内部最左侧的模板宽度列代替左模板,即采用上模板和左模板计算。
第三种:当前块的上模板和左模板均存在,对应BV处仅左模板存在,此时存在两种方法:方法一:对应BV处上模板不存在,直接不用,即仅用左模板计算。方法二:对应BV处上模板不存在,采用参考块内部最上侧的模板高度行代替上模板,即采用上模板和左模板计算。
第四种:当前块仅上模板存在,此时存在三种方法:方法一:对应BV处上模板不存在,直接不用,此时最终选择的BV为BVC候选列表中的第一个BVC或某个指定位置的BVC。方法二:对应BV处上模板不存在,采用参考块内部最上侧的模板高度行代替上模板。方法三:对应BV处上模板存在,直接用。
第五种:当前块仅左模板存在,此时存在三种方法:方法一:对应BV处左模板不存在,直接不用,此时最终选择的BV为BVC候选列表中的第一个BVC或某个指定位置的BVC。方法二:对应BV处左模板不存在,采用参考块内部最左侧的模板宽度列代替左模板。方法三:对应BV处左模板存在,直接用。
第六种:当前块上模板和左模板均不存在,此时最终选择的BV为BVC候选列表中的第一个BVC或某个指定位置的BVC。
示例性地,在本申请实施例中,在根据多个候选向量参数各自的第一代价值来确定第一候选参考预测参数时,除去无法计算成本的情况,其他情况对BVC的候选列表中每个候选进行成本的计算,并排序,排序方法包括但不限于采用冒泡排序、选择排序、插入排序、希尔排序、归并排序、快速排序、基数排序、堆排序、计数排序、桶排序等排序方法。选择成本最小的任意数量的BVC作为最终选择的BV(第一候选参考预测参数),以此进行基于BV的色度预测。还需要注意的是,在对多个候选向量参数进行代价值计算时,可以每一个候选向量参数计算一个成本,始终保留成本最小的候选向量参数,这种 情况下也可以不需要列表,甚至也不需要排序。
这样,在得到一个或多个第一候选参考预测参数之后,可以构建出第一参考预测参数集。
S2003,根据第一参考预测参数集,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值。
需要说明的是,在本申请实施例中,这里的“参考预测参数”是用于推导当前块的参考样值的参数,具体可以为向量参数(例如BV或MV)。然后根据这些参考样值(Samples),可以用于推导第一颜色分量与第二颜色分量之间的映射关系。
还需要说明的是,如果第三参考预测参数集中的全部候选向量参数均不可用,即第三参考预测参数集中的全部候选块向量参数均不满足预设可用条件,这时候不存在可用的第一候选参考预测参数,那么也就不存在第一参考预测参数集。在这种情况下,该方法还可以包括:在第三参考预测参数集中的全部候选向量参数均不满足预设可用条件时,确定当前块的第三位置处的第一颜色分量重建样本和第二颜色分量重建样本;根据第三位置处的第一颜色分量重建样本和第二颜色分量重建样本,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值。
也就是说,在本申请实施例中,还可以获取设定位置处的亮度像素和色度像素,该设定位置包括但不限于当前块的相邻一行和相邻一列,以得到当前块的第一颜色分量参考样值和第二颜色分量参考样值。
在一些实施例中,根据第一参考预测参数集,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值,可以包括:根据第一参考预测参数集,确定一个或多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本;确定当前块的第三位置处的第一颜色分量重建样本和第二颜色分量重建样本;根据一个或多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本以及第三位置处的第一颜色分量重建样本和第二颜色分量重建样本,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值。
在本申请实施例中,根据第一参考预测参数集,确定一个或多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本,可以包括:确定当前块的位置;对当前块的位置进行缩放,确定当前块的同位置的第一颜色分量区域的位置;以及对第一候选参考预测参数进行缩放,确定当前块的同位置的第一颜色分量区域的缩放后参考预测参数;根据第一颜色分量区域的位置和缩放后参考预测参数,确定第一颜色分量的参考块,并根据第一颜色分量的参考块确定第一候选参考预测参数指示的第一颜色分量重建样本;根据当前块的位置和第一候选参考预测参数,确定第二颜色分量的参考块,并根据第二颜色分量的参考块确定第一候选参考预测参数指示的第二颜色分量重建样本。
在本申请实施例中,对于第一颜色分量区域的位置,可以是根据预设采样格式对当前块的位置进行缩放得到的;对于第一颜色分量区域的缩放后参考预测参数,也可以是根据预设采样格式对第一候选参考预测参数进行缩放得到的。在这里,预设采样格式可以参见前述表4。需要注意的是,缩放后参考预测参数可以是由色度BV进行放大得到的;但是考虑到亮度BV可能会存在精度损失,因此由色度BV放大后得到的亮度BV与原始亮度BV(第二候选参考预测参数)不一定相等。
示例性地,当前块为色度块,同位置的第一颜色分量区域则为同位亮度区域。对于第一颜色分量参考样值(亮度参考样本)的获取,首先获取当前块的位置,即当前块的左上角色度样本相对于当前图像的左上角色度样本的位置,chromaPos=(x,y);根据表4所示的颜色采样格式对chromaPos进行缩放,得到当前块对应的同位亮度区域位置lumaPos=(xCb,yCb)。
示例性地,获取色度BV=(BVChor,BVCver),根据表4所示的颜色采样格式对色度BV进行缩放,得到当前块对应的同位亮度区域的亮度BV=(BVYhor,BVYver)。获取当前块对应的同位亮度区域位置lumaPos=(xCb,yCb),获取亮度BV=(BVYhor,BVYver),找到当前块对应的同位亮度区域对应的偏移位置(xCb+BVYhor,yCb+BVYver),如图16所示。
在一种具体的实现方式中,在得到该偏移位置处的亮度样本之后,可以对其进行下采样得到亮度参考样本。在一些实施例中,根据第一颜色分量的参考块确定第一候选参考预测参数指示的第一颜色分量重建样本,可以包括:对第一颜色分量的参考块进行下采样处理,确定第一候选参考预测参数指示的第一颜色分量重建样本,以使第一颜色分量重建样本的分辨率与第二颜色分量重建样本的分辨率相同。
需要说明的是,在本申请实施例中,对第一颜色分量的参考块进行下采样处理,确定第一候选参考预测参数指示的第一颜色分量重建样本,可以包括:确定当前块的下采样方式;根据下采样方式对第一颜色分量的参考块进行下采样处理,确定第一候选参考预测参数指示的第一颜色分量重建样本。
在一些实施例中,对于确定当前块的下采样方式,如图21所示,该方法可以包括:
S2101,基于预设竞争方式对多种候选下采样方式进行代价计算,确定多种候选下采样方式各自对应的代价结果。
S2102,从多种候选下采样方式各自对应的代价结果中选择最小代价结果。
S2103,将最小代价结果对应的候选下采样方式确定为当前块的下采样方式。
需要说明的是,在本申请实施例中,预设竞争方式可以为率失真优化(Rate–distortion optimization,RDO)方式,例如采用全RDO竞争方式、只进行一次RDO选择的竞争方式、进行可变次数RDO选择的竞争方式、进行设定次数的RDO竞争方式等,下面针对这几种方式进行详细描述。
示例性地,对当前块的亮度重建样本进行下采样得到下采样后的亮度样本,编码端的预设竞争方式包括但不限于以下方式:
①采用全RDO竞争方式。
不同采样方式对应的亮度下采样重建值不同,对每一种采样方式进行预测、变换、量化、重建计算失真和比特,进而更新最优。
②只进行一次RDO选择。
不同采样方式对应的亮度下采样重建值不同,对每一种采样方式进行预测,计算预测值和原始值之间的失真,包括但不限于SAD、SATD等,选出一种失真最小的下采样方式,对这种下采样方式进行预测、变换、量化、重建计算失真和比特。
③进行可变次数的RDO选择。
默认进行下采样方式一的预测、变换、量化、重建计算失真和比特。下采样方式一到六的每一种均计算预测值和原始值之间的失真,包括但不限于SAD、SATD等,对二到六的失真依次和一的失真进行比较,如果scale*失真(下采样方式二到六)<失真(下采样方式一),scale的取值包括但不限于1、1.5、1.15、1.3等,则增加相应的RDO次数。
④进行设定次数的RDO选择。
采用②进行一次RDO,将该种采样方式得到的预测值与BVL(包括但不限于中心亮度块得到)指向位置处的帧内预测模式加权得到预测值进行RDO,或者将该种采样方式得到的预测值与BVC(包括但不限于中心亮度块得到)指向位置处的色度预测值加权得到预测值进行RDO。需要注意的是,如果增加加权计算,则需要在码流中应该相应增加一个weight_flag(指示是否加权)或者weight_idx(指示加权权值可选项中的序号,例如0,1/4,1/2,3/4,1等)语法元素。
还需要说明的是,在本申请实施例中,由于亮度样本与色度样本的分辨率不一致,因此需要对亮度样本进行下采样处理,以使得下采样后的亮度样本与色度样本的分辨率相同。在这里,对于确定当前块的下采样方式,可以采用下面几种候选采样方式竞争或者默认采用某一种采样方式,但是包括不限于以下六种采样方式。示例性地,假定下采样前的亮度样本为recBvBefDownLuma,存储buffer的宽度为iRecRefLumaStride,下采样后的亮度样本为recBvAftDownLuma,则位置(i,j)处下采样后的亮度样本为:
下采样方式一(如图17A所示):
recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]*2
+recBvBefDownLuma[2*i+1]
+recBvBefDownLuma[2*i-1]
+recBvBefDownLuma[2*i+iRecRefLumaStride]*2
+recBvBefDownLuma[2*i+1+iRecRefLumaStride]
+recBvBefDownLuma[2*i-1+iRecRefLumaStride]+4)>>3;
下采样方式二(如图17B所示):
recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]
+recBvBefDownLuma[2*i+1]+1)>>1;
下采样方式三(如图17C所示):
recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]
+recBvBefDownLuma[2*i+iRecRefLumaStride]+1)>>1;
下采样方式四(如图17D所示):
recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i+iRecRefLumaStride]
+recBvBefDownLuma[2*i+1+iRecRefLumaStride]+1)>>1;
下采样方式五(如图17E所示):
recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i+1]
+recBvBefDownLuma[2*i+1+iRecRefLumaStride]+1)>>1;
下采样方式六(如图17F所示):
recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]
+recBvBefDownLuma[2*i+1]
+recBvBefDownLuma[2*i+iRecRefLumaStride]
+recBvBefDownLuma[2*i+1+iRecRefLumaStride]+2)>>2。
在一些实施例中,该方法还可以包括:确定滤波标识信息的取值;对滤波标识信息的取值进行编码 处理,将所得到的编码比特写入码流。
也就是说,在本申请实施例中,滤波标识信息用于指示当前块的下采样方式在多种候选下采样方式中的索引序号。以使得解码端通过解码码流确定滤波标识信息的取值之后,就可以直接确定出当前块的下采样方式。其中,滤波标识信息可以用filter_idx表示,滤波标识信息的取值可以为0,1,2,3,4,5等。这样,在确定出当前块的下采样方式之后,经过下采样即可获取到当前块对应的同位亮度区域对应BV处的下采样后的亮度参考样本recBvAftDownLuma。
进一步地,对于当前块的色度样本,首先获取当前块的位置(xCbC,yCbC),获取色度BV=(BVChor,BVCver),找到对应偏移位置(xCbC+BVChor,yCbC+BVCver),即获取到了当前块对应BV处的色度参考样本recBvChroma。
在一些实施例中,确定当前块的第三位置处的第一颜色分量重建样本和第二颜色分量重建样本,该方法可以包括:确定当前块的第一模板;根据第一模板,确定第三位置处的第一颜色分量重建样本和第二颜色分量重建样本。
需要说明的是,在本申请实施例中,第一模板包括当前块的相邻已解码区域中的一个或多个样值。相应地,第一模板的类型可以包括下述至少一项:上模板、右上模板、左模板、左下模板和左上模板。其中,上模板位于当前块相邻的上侧已解码区域,右上模板位于当前块相邻的右上侧已解码区域,左模板位于当前块相邻的左侧已解码区域,左下模板位于当前块相邻的左下侧已解码区域,左上模板位于当前块相邻的左上侧已解码区域。
也就是说,对于当前块的第一颜色分量参考样值和第二颜色分量参考样值来说,不仅包括一个或多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本,还包括当前块的第三位置(例如第一模板区域)处的第一颜色分量重建样本和第二颜色分量重建样本。其中,第三位置表示当前块的任意设定位置,该位置包括但不限于当前块的相邻一行和相邻一列。
这样,根据亮度参考样本recBvAftDownLuma和色度参考样本recBvChroma以及第三位置处的重建亮度样本和重建色度样本,可以构建亮度与色度之间的映射关系。
S2004,根据第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系。
需要说明的是,在一种可能的实现方式中,根据第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系,可以包括:根据第一颜色分量参考样值和第二颜色分量参考样值确定第一查找表,其中,第一查找表用于记录索引关键字为第一颜色分量时所对应的第二颜色分量的取值。
还需要说明的是,在另一种可能的实现方式中,根据第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系,可以包括:根据第一颜色分量参考样值和第二颜色分量参考样值确定第一离散模型,其中,第一离散模型用于指示第一颜色分量与第二颜色分量之间的映射关系。
也就是说,这里的映射关系可以是查找表(Look Up Table,LUT)。其中,查找表中的索引关键字(key)可以为第一颜色分量,查找表的取值(value)可以为第二颜色分量,即value=LUT[key]。或者,映射关系还可以是离散模型,用于表征key-value之间的映射关系。
示例性地,假定亮度分量为key,色度分量为value,那么映射关系中的每一key-value对,可以采用包括但不限于如下方式建立:
LUT[recBvAftDownLuma[i][j]]=recBvChroma[i][j]          (17)
还需要说明的是,在本申请实施例中,对于第一颜色分量参数样本,还可以限定在预设样本范围。在一些实施例中,该方法还可以包括:对第一颜色分量参考样值进行映射处理,以使第一颜色分量参考样值处于预设样本范围。
在本申请实施例中,预设样本范围可以为[0,(1<<bitdepth)-1],其中,bitdepth表示比特深度。示例性地,预设样本范围可以为[0,255]、[0,511]等范围,但是不作任何限定。其中,对于存在多个样本范围,那么可以使用率失真代价方式从中选择其中一个作为最终的预设样本范围。
示例性地,以比特深度大于8bit的视频为例,假定视频的比特深度为10bit,那么样本范围为[0,1023]。对于key值的recBvAftDownLuma,可以将其映射为[0,255]或者[0,511]的预设样本范围。
进一步地,在一些实施例中,该方法还可以包括:在第一颜色分量参考样值中的第一参考样值相同且对应第二颜色分量参考样值中不同的多个第二参考样值时,按照样本顺序依次进行覆盖处理,将最后一个第二参考样值作为与第一参考样值具有映射关系的值。
进一步地,在一些实施例中,该方法还可以包括:在第一颜色分量参考样值中的第一参考样值相同且对应第二颜色分量参考样值中不同的多个第二参考样值时,对多个第二参考样值进行平均值计算,将 所得到的平均值作为与第一参考样值具有映射关系的值。
也就是说,在本申请实施例中,对于映射关系中具有相同key值的不同色度值,可以按照样本顺序依次覆盖相同key值的条目,或者采取平均值等操作。另外,在映射关系中,LUT[]的初始化设置为-1,即不可用的值。“覆盖”主要是指后面如果有相同的key值,则会使用新的value值进行存储;但是并不局限于这种方式,还可以全部存储然后求取平均值作为该key对应的value值。
可以理解地,在本申请实施例中,关于用于构建映射关系的第一颜色分量参考样值和第二颜色分量参考样值,也可以采用其他方式进行获得,下面结合几种实现方式进行示例性地说明。
在另一种具体的实现方式中,亮度样本不进行下采样,此时可以对色度样本进行上采样得到色度参考样本。在一些实施例中,根据第二颜色分量的参考块确定第一候选参考预测参数指示的第二颜色分量重建样本,可以包括:对第二颜色分量的参考块进行上采样处理,确定第一候选参考预测参数指示的第二颜色分量重建样本,以使第一颜色分量重建样本的分辨率与第二颜色分量重建样本的分辨率相同。
也就是说,在本申请实施例中,在获取到同位亮度区域的重建亮度样本recBvBefDownLuma之后,不进行下采样。这时候,获取到当前块对应BV处的重建色度样本recBvChroma之后需要进行上采样,包括但不限于线性插值等方式,得到和BV处重建亮度样本同样尺寸的重建色度样本recBvChromaUp。
如此,将BV处的重建亮度样本recBvBefDownLuma作为亮度参考样本,将所得到的上采样后的重建色度样本recBvChromaUp作为色度参考样本;然后根据亮度参考样本和色度参考样本来构建亮度与色度之间的映射关系。
相应地,在本申请实施例中,还需要对当前块的第二颜色分量的预测值进行下采样处理。也就是说,在构建映射关系的时候如果当前块的重建色度样本进行上采样处理,那么根据该映射关系对当前块进行亮度到色度的预测,还需要将所得到的色度预测值进行下采样操作得到当前块最终的色度预测值。其中,下采样方式包括但不限于平均下采样等。
在又一种具体的实现方式中,该方法还可以包括:确定当前块的第一模板;根据第一模板,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值。
在本申请实施例中,对于用于构建映射关系的第一颜色分量参考样值和第二颜色分量参考样值,还可以包括由当前块的第一模板所确定的第一颜色分量参考样值和第二颜色分量参考样值。具体地,根据当前块的第一模板,可以确定第一模板同位置的第一颜色分量区域模板;然后根据第一颜色分量区域模板中的重建样本可以确定第一颜色分量参考样值;根据第一模板中的重建样本可以确定第二颜色分量参考样值。其中,第一模板包括当前块的相邻已解码区域中的一个或多个重建样本。
示例性地,根据当前块的当前色度模板,可以获取色度参考样本;在确定出当前色度模板的同位亮度区域模板后,根据同位亮度区域模板可以获取亮度参考样本。然后结合上述实施例所得到的亮度参考样本和色度参考样本,根据这些亮度参考样本和色度参考样本来构建亮度与色度之间的映射关系。
S2005,根据映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。
需要说明的是,在本申请实施例中,对于确定当前块的第一颜色分量样值,可以包括:确定当前块的同位置的第一颜色分量区域的重建像素样本;基于第一颜色分量区域的重建像素样本,确定当前块的第一颜色分量样值。其中,可以是将第一颜色分量区域的重建像素样本直接作为当前块的第一颜色分量样值,也可以是对第一颜色分量区域的重建像素样本进行滤波处理,将滤波后的重建像素样本作为当前块的第一颜色分量样值,这里不作任何限定。
示例性地,在本申请实施例中,滤波处理为下采样处理。这里,可以获取当前块对应的同位亮度区域lumaPos=(xCb,yCb)位置的重建亮度样本recBefDownLuma,对该亮度样本采用下采样方式得到下采样后的重建亮度样本recAftDownLuma,并将下采样后的重建亮度样本作为当前块的第一颜色分量样值。另外,如果亮度参考样本进行过样本范围的映射处理,那么这里也需要对下采样后的重建亮度样本进行相同样本范围的映射处理,以得到当前块的第一颜色分量样值。
在一些实施例中,根据映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值,可以包括:若在映射关系中查找到与第一颜色分量样值相等的第一颜色分量值,则将第一颜色分量值对应的第二颜色分量的取值确定为当前块的第二颜色分量的预测值。
示例性地,在本申请实施例中,假定当前块的预测值为predSamples,那么对于predSamples[cIdx][x][y],变量cIdx指定当前块的颜色分量索引,这里可以采用如下预测方式:
参考其同位置的亮度值Yc,使用前述实施例建立的映射关系(离散模型)来推导出色度预测值。
在一些实施例中,对于确定当前块的第二颜色分量的预测值,该方法还可以包括:若在映射关系中没有查找到与第一颜色分量样值相等的第一颜色分量值,则对第一颜色分量样值进行修正处理,确定第一颜色分量修正值,并继续在映射关系中查找是否存在与第一颜色分量修正值相等的第一颜色分量值。
在一种具体的实施例中,对第一颜色分量重建值进行修正处理,确定第一颜色分量修正值,可以包 括:根据预设的一个或多个偏移值对第一颜色分量样值进行偏移计算,确定第一颜色分量修正值。
在本申请实施例中,偏移值可以为+1、-1、+2、-2、+3、-3等,关于偏移值的数量以及具体取值均不作限定。另外,对于第一颜色分量重建值的修正处理,这多个偏移值也可以设置有一定的顺序,例如按照{+1、-1、+2、-2、+3、-3}顺序进行修正处理。
示例性地,在本申请实施例中,对于前述实施例建立的映射关系,如果在其中的输入亮度集中没有查找到Yc,则包括但不限于以下处理方式:按照{Yc+1、Yc-1、Yc+2、Yc-2、Yc+3、Yc-3}顺序对Yc进行修正处理,然后根据修正后的Yc在输入亮度集中进行匹配检查,然后将修正后的Yc对应的value值确定为当前块的色度预测值。
在一些实施例中,对于确定当前块的第二颜色分量的预测值,该方法还包括:若在映射关系中没有查找到与第一颜色分量修正值相等的第一颜色分量值,则对第二颜色分量参考样值进行平均值计算,将所得到的平均值确定为当前块的第二颜色分量的预测值。
示例性地,在本申请实施例中,对于前述实施例建立的映射关系,如果在其中的输入亮度集中没有查找到Yc,则包括但不限于以下处理方式:按照{Yc+1、Yc-1、Yc+2、Yc-2、Yc+3、Yc-3}顺序对Yc进行修正处理,如果映射关系中不能匹配以上所有的修正后的Yc,那么可以将色度预测值设置为对应BV处的重建色度样本recBvChroma的平均值。
在一些实施例中,对于确定当前块的第二颜色分量的预测值,该方法还包括:根据映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的第一初始预测值;对第一初始预测值进行修正操作,确定当前块的第二颜色分量的预测值。
需要说明的是,在本申请实施例中,对于根据映射关系所得到的第一初始预测值进行修正操作,这里的修正操作可以包括clip操作、滤波操作、与其他预测模式得到的预测值进行加权操作等等,对此不作任何限定。
在一种具体的实施例中,对第一初始预测值进行修正操作,确定当前块的第二颜色分量的预测值,可以包括:根据第一预设模式对当前块的第二颜色分量进行预测处理,确定当前块的第二颜色分量的第二初始预测值;对第一初始预测值和第二初始预测值进行加权计算,确定当前块的第二颜色分量的预测值。需要说明的是,在本申请实施例中,第一预设模式至少包括下述其中一项:PLANAR模式、DM模式、DC模式和CCLM模式。也就是说,对于根据映射关系所得到的第一初始预测值进行修正操作,可以包括但不限于与CCLM类模式或者其他预测模式进行加权,以得到当前块的色度预测值。
在另一种具体的实施例中,对第一初始预测值进行修正操作,确定当前块的第二颜色分量的预测值,可以包括:将第一初始预测值限制在预设数值范围之内,或者也可以称为“钳位(clip)操作”。需要说明的是,在本申请实施例中,预设数值范围的下限值为最小预测值(min),预设数值范围的上限值为最大预测值(max)。其中,如果第一初始预测值处于该预设数值范围之内,那么可以将第一初始预测值作为当前块的色度预测值;如果第一初始预测值大于max,那么可以将max作为当前块的色度预测值;如果第一初始预测值小于min,那么可以将min作为当前块的色度预测值。
在一些实施例中,对于确定当前块的第二颜色分量的预测值,该方法还包括:在第一参考预测参数集包括多个第一候选参考预测参数时,确定当前块的第二颜色分量的多个第三初始预测值;对多个第三初始预测值进行加权计算,确定当前块的第二颜色分量的预测值。
需要说明的是,在本申请实施例中,如果前述实施例决策出多个BV(第一候选参考预测参数),那么根据这多个BV可以得到多个第三初始预测值;然后对这多个第三初始预测值进行加权,将加权后的预测值作为当前块的色度预测值;或者,还可以继续对加权后的预测值进行修正,包括但不限于与CCLM类模式或者其他预测模式进行加权,以得到当前块的色度预测值。
在一种具体的实施例中,对于确定当前块的第二颜色分量的预测值,该方法还可以包括:在第一参考预测参数集包括多个第一候选参考预测参数时,确定多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本;根据多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本,确定第一颜色分量与第二颜色分量之间的多个映射关系;根据多个映射关系,确定当前块的第二颜色分量的多个第三初始预测值;对多个第三初始预测值进行加权计算,确定当前块的第二颜色分量的预测值。
需要说明的是,在本申请实施例中,获取同位亮度区域的多个块,多个块的位置包括但不限于以下位置,如图11所示。多个块可以对应多个亮度BV,这多个亮度BV分别构建各自的色度BVC候选列表的候选项,判断该候选列表中的BV的可用性,以决策出一个BV或者多个BV或者通过聚类决策出多组BV,针对多组BV可以建立亮度与色度之间的多个映射表LUT,如此根据这多个映射表LUT可以得到多个初始色度预测值,通过加权计算就可以得到当前块的色度预测值。
在一些实施例中,对于确定当前块的第二颜色分量的预测值,该方法可以包括:在当前块的第一颜 色分量块包括多个候选块时,确定当前块的第二参考预测参数集;其中,第二参考预测参数集包含多个第二候选参考预测参数;根据多个第二候选参考预测参数,确定多个第一候选参考预测参数;并基于多个第一候选参考预测参数,确定第一颜色分量与第二颜色分量之间的多个候选映射关系;从多个候选映射关系中,确定目标映射关系;根据目标映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。
在一种具体的实施例中,从多个候选映射关系中,确定目标映射关系,可以包括:对多个候选映射关系分别进行代价计算,确定多个候选映射关系各自对应的代价结果;从多个候选映射关系各自对应的代价结果中确定最小代价结果,将最小代价结果对应的候选映射关系确定为目标映射关系。
需要说明的是,在本申请实施例中,这里可以使用失真值的方式来确定代价结果,具体可以为率失真代价方式来确定代价结果;但是也可以是SAD的大小,MSE的大小,SSE大小或其他的判断代价的标准,在此不作具体限定。
进一步地,在一些实施例中,该方法还包括:确定映射关系索引值,其中,映射关系索引值用于指示目标映射关系在多个候选映射关系中的索引序号;对映射关系索引值进行编码处理,将所得到的编码比特写入码流。
还需要说明的是,在本申请实施例中,还可以根据最小代价结果对应的候选映射关系在多个候选映射关系中的索引序号,确定映射关系索引值并写入码流,以便解码端能够根据解码得到的映射关系索引值来确定对应的目标映射关系。
也就是说,在本申请实施例中,可以建立多个亮度与色度之间的映射表LUT,然后使用语法元素指明所选择的目标映射表LUT。示例性地,获取同位亮度区域的多个块,多个块的位置包括但不限于以下位置,如图11所示。多个块可以对应多个亮度BV,这多个亮度BV分别构建各自的色度BVC候选列表的候选项,判断该候选列表中的BV的可用性,以决策出一个BV或者多个BV或者通过聚类决策出多组BV,这多个块的各自的可用色度BVC能够分别建立一个映射表LUT;在解码端,通过解码相应的语法元素可以确定出映射关系索引值;然后根据映射关系索引值可以确定出目标映射关系,进而确定出当前块的色度预测值。需要注意的是,这里建立的映射关系的数量可以任意设定,例如可以将数量设置为4,但是不作任何限定。
在一些实施例中,对于确定当前块的第二颜色分量的预测值,该方法可以包括:在当前块的第一颜色分量块包括多个候选块时,确定当前块的第二参考预测参数集;其中,第二参考预测参数集包含多个第二候选参考预测参数;根据多个第二候选参考预测参数,确定多个第一候选参考预测参数;并基于多个第一候选参考预测参数,确定第一颜色分量与第二颜色分量之间的多个候选映射关系;基于模板匹配方式对多个候选映射关系进行匹配误差计算,以确定多个候选映射关系各自的第二代价值;从多个候选映射关系各自的第二代价值中确定最小代价值,将最小代价值对应的候选映射关系确定为目标映射关系;根据目标映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。
在一种具体的实施例中,基于模板匹配方式对多个候选映射关系进行匹配误差计算,以确定多个候选映射关系各自的第二代价值,可以包括:确定当前块的第一模板;确定第一模板的同位置的第一颜色分量区域模板的重建像素样值;根据多个候选映射关系和第一颜色分量区域模板的重建像素样值,确定第一模板在多个映射关系下各自的第二颜色分量的预测值;根据第一模板的第二颜色分量的重建值与第一模板在多个映射关系下各自的第二颜色分量的预测值进行代价计算,确定多个候选映射关系各自的第二代价值。
需要说明的是,在本申请实施例中,可以建立多个亮度与色度之间的映射表LUT,然后使用模板选择使用哪一个映射表LUT。示例性地,获取同位亮度区域的多个块,多个块的位置包括但不限于以下位置,如图11所示。多个块可以对应多个亮度BV,这多个亮度BV分别构建各自的色度BVC候选列表的候选项,判断该候选列表中的BV的可用性,以决策出一个BV或者多个BV或者通过聚类决策出多组BV,这多个块的各自的可用色度BVC能够分别建立一个映射表LUT;对当前块模板经过利用不同的映射表LUT进行预测,和模板的重建值计算差值,进而决策具体使用哪一个映射关系,然后使用最终决策出的映射关系来确定当前块的色度预测值。需要注意的是,这里建立的映射关系的数量可以任意设定,例如可以将数量设置为4,但是不作任何限定。
在一种具体的实施例中,对当前块模板进行LUT预测的具体过程为:
获取当前块模板对应的同位亮度区域模板lumaPos=(xCbR,yCbR)位置的重建亮度样本recBef DownLumaR,对该亮度样本进行下采样以得到下采样后的重建亮度样本recAftDownLumaR,对该样本进行相同样本范围的映射处理。
假设当前块模板的预测值为predSamplesR,则对于predSamplesR[cIdx][x][y],变量cIdx指定当前块的颜色分量索引,预测方式为:参考其同位置的亮度值Yc,以使用所建立的映射关系推导出预测值。 如果在所建立的映射关系中的输入亮度集中未找到Yc,则包括但不限于以下处理方式:按{Yc+1、Yc-1、Yc+2、Yc-2、Yc+3、Yc-3}顺序进行检查,如果该映射关系中不能匹配以上所有值,则将当前块的色度预测值设置为对应BV处的重建色度样本recBvChroma的平均值。
在当前块模板以及每个LUT的模板预测值进行成本计算时,模板的使用情况存在以下几种情况:
第一种:当前块的上模板和左模板均存在,此时上模板和左模板均可用。
第二种:当前块仅上模板存在,此时仅上模板可用。
第三种:当前块仅左模板存在,此时仅左模板可用。
第四种:当前块上模板和左模板均不存在,此时最终选择的LUT为建立的第一个LUT或某个指定位置的LUT。
示例性地,在本申请实施例中,假设当前块模板的重建值为recSamplesR,对于计算模板区域成本的成本函数有多种选择,例如,可以选择绝对误差和(SAD)、变换绝对误差和(SATD)、差值平方和(SSE)、平均绝对差值(MAD)、平均绝对误差(MAE)、平均平方误差(MSE)等评价准则。下述内容所提到的某种评价准则均可从上述准则中选择其一,以SAD的评价准则为例,计算公式如下:
其中,predTempSizeW为模板的宽度,predTempSizeH为模板的高度,predSamplesR[i][j]为当前块模板的经过LUT后的预测像素点,recSamplesR[i][j]为当前块模板的重建像素点。
还需要说明的是,在本申请实施例中,对于利用当前块模板选择最终的LUT,除去无法计算成本的情况,其他情况对建立的每个LUT候选进行成本的计算,并排序,排序方法包括但不限于采用冒泡排序、选择排序、插入排序、希尔排序、归并排序、快速排序、基数排序、堆排序、计数排序、桶排序等排序方法。其中,选择成本最小的LUT候选作为最终使用的LUT。
S2006,根据当前块的第二颜色分量的预测值,确定当前块的第二颜色分量的残差值。
需要说明的是,在本申请实施例中,确定当前块的第二颜色分量的初始值;根据初始值和预测值,确定当前块的第二颜色分量的残差值。具体地,可以是对初始值和预测值进行减法运算,得到当前块的第二颜色分量的残差值。
在一些实施例中,该方法还包括:对当前块的第二颜色分量的残差值进行编码处理,将所得到的编码比特写入码流。以便后续解码端能够根据残差值和预测值来恢复当前块的第二颜色分量的重建值。
在一些实施例中,确定当前块的预测参数,可以包括:确定当前块的预测模式;根据当前块的预测模式,确定当前块的预测参数。
需要说明的是,在本申请实施例中,确定当前块的预测模式,可以包括:确定当前块的多种候选模式;其中,多种候选模式包括第一预测模式和第一预测模式之外的其他预测模式;基于预设代价方式对多种候选模式进行代价计算,确定多种候选模式各自对应的代价结果;从多种候选模式各自对应的代价结果中确定最小代价结果,将最小代价结果对应的候选模式确定为当前块的预测模式;其中,预设代价方式至少包括下述其中一项:率失真代价方式和模板匹配方式。
还需要说明的是,在本申请实施例中,对于当前块的预测模式,也可以是在编码端BVG-LUT模式与其他模式可以同时使用。其中,在DM模式下,除了BVG-LUT模式,还可以与其他模式竞争。根据模板代价决定最终使用模式。例如,与直接使用由亮度得到的BV,可以直接利用BV复制,也可以利用本申请实施例定义的BVG-LUT模式,这两种模式均应用于当前块的模板后,选择模板代价更小的一个作为当前块的预测模式。
在一些实施例中,该方法还包括:确定当前块的同位置的第一颜色分量区域;若当前块使用DM模式且第一颜色分量区域是基于块向量进行预测,则确定当前块使用第一预测模式。
需要说明的是,在本申请实施例中,确定当前块的同位置的第一颜色分量区域;若当前块使用DM模式且第一颜色分量区域是基于块向量进行预测,则确定当前块使用第一预测模式。
示例性地,在本申请实施例中,双树划分下,DM模式下,如果对应亮度区域具有BV信息,则当前块采用第一预测模式(BVG-LUT模式)进行预测。例如:
如果CuPredMode[0][xCb+cbWidth/2][yCb+cbHeight/2]等于MODE_IBC,置intra_bvglut_flag=1,则色度帧内预测模式IntraPredModeC[xCb][yCb]使用BVG-LUT。
如果CuPredMode[0][xCb+cbWidth/2][yCb+cbHeight/2]等于MODE_INTRA,如果IntraTmpFlag[xCb+cbWidth/2][yCb+cbHeight/2]等于1,置intra_bvglut_flag=1,则色度帧内预测模式IntraPredModeC[xCb][yCb]使用BVG-LUT。
在本申请实施例中,第一语法元素可以用于指示当前块是否使用BVG-LUT模式,第一语法元素可以用intra_bvgplt_flag或者bvgplt_flag表示。其中,色度预测模式推导如下:
色度帧内预测模式IntraPredModeC[xCb][yCb]使用cclm_mode_flag、cclm_mode_idx、下表中指定 的intra_chroma_pred_mode、lumaIntraPredMode和lumaTempPredMode。这些除BVG-LUT模式之外的填充项是示例性的给出对应的值,而不是必须填写为该值。其中,表9示出了色度预测模式推导的示例。如表9所示,0代表Planar模式,1代表DC模式,18代表水平模式、50代表垂直模式,81~83代表CCLM模式。
根据表9可以看出,DM模式下,如果intra_bvglut_flag==1,即同位亮度区域中心位置块获取到的信息含有BV,则色度帧内预测模式IntraPredModeC[xCb][yCb]使用BVG-LUT模式。
在一些实施例中,该方法还包括:确定第二语法元素的取值;在第二语法元素指示当前块允许使用第一预测模式时,执行确定当前块的预测参数的步骤。
在一些实施例中,该方法还包括:确定第二语法元素的取值;其中,第二语法元素用于指示当前块是否允许使用第一预测模式;对第二语法元素的取值进行编码处理,将所得到的编码比特写入码流。
需要说明的是,在本申请实施例中,第二语法元素可以用BvglutEnabled表示。如果第二语法元素的取值为第一值,则第二语法元素指示当前块允许使用第一预测模式;如果第二语法元素的取值为第二值,则第二语法元素指示当前块不允许使用第一预测模式。
还需要说明的是,在本申请实施例中,第一值与第二值不同。其中,第一值和第二值可以是参数形式,也可以是数字形式。具体地,无论是第一语法元素还是第二语法元素均可以是写入在概述(profile)中的参数,也可以是一个标志位/标识符的取值,这里也不作任何限定。
示例性地,第一值可以设置为1,第二值可以设置为0;或者,第一值可以设置为0,第二值可以设置为1;或者,第一值可以设置为true,第二值可以设置为false;或者,第一值可以设置为false,第二值可以设置为true。其中,在本申请实施例中,第一值可以设置为1,第二值可以设置为0,但是对此并不作任何限定。
示例性地,在本申请实施例中,如果语法元素sps_ibc_enabled_flag等于0且sps_intratmp_enabled_flag等于0,则BvglutEnabled等于0。否则,设置变量ModeIncludeBv,如果对应的亮度块没有以有BV信息的模式进行编码,则ModeIncludeBv等于0;否则ModeIncludeBv等于1。
在一种可能的实现方式中,如果以下多个条件同时为真(包括但不限于以下条件),则BvglutEnabled等于1:
ModeIncludeBv等于1;
sh_slice_type等于I帧;
CtbLog2SizeC小于等于MaxChromaIbcSize;其中,MaxChromaIbcSize可根据色度CTU大小或预设值确定。
在另一种可能的实现方式中,如果以下多个条件同时为真(包括但不限于以下条件),则BvglutEnabled等于1:
ModeIncludeBv等于1;
CtbLog2SizeC小于等于MaxChromaIbcSize;其中,MaxChromaIbcSize可根据色度CTU大小或预设值确定。
在又一种可能的实现方式中,如果以下多个条件同时为真(包括但不限于以下条件),则BvglutEnabled等于1:
CtbLog2SizeC小于等于MaxChromaIbcSize;其中,MaxChromaIbcSize可根据色度CTU大小或预设值确定。
针对每一种可能的实现方式,否则,BvglutEnabled等于0。在这里,如果BvglutEnabled等于0,那么第一语法元素的取值可以被推断为0。
进一步地,本申请实施例还提供了一种码流,该码流是根据待编码信息进行比特编码生成的;其中,待编码信息包括下述至少一项:当前块的第二颜色分量的残差值、滤波标识信息的取值、映射关系索引值、第一语法元素的取值和第二语法元素的取值。
在本申请实施例中,滤波标识信息用于指示当前块的下采样方式,第一语法元素用于指示当前块是否使用第一预测模式,第二语法元素用于指示当前块是否允许使用第一预测模式。
本实施例提供了一种编码方法,确定当前块的预测参数;根据预测参数,确定当前块的第一参考预测参数集;其中,第一参考预测参数集包含一个或多个第一候选参考预测参数;根据第一参考预测参数集,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值;根据第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系;根据映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。这样,如果当前块使用BVG-LUT模式,那么可以确定应用色度分量的第一参考预测参数集,并根据第一参考预测参数集,确定当前块的亮度分量参考样值和色度分量参考样值,以此建立亮度分量与色度分量之间的映射关系,然后利用该映射关系进行 色度分量的预测。也就是说,这里充分利用了当前图像中已重建样本与当前块样本之间的相关性,改善了色度预测的单一性,从而能够提高色度预测的准确性;而且根据所建立的映射关系,还可以有效进行像素级的预测,从而能够进一步节省码率,提高编解码效率,进而提升编解码性能。
在本申请的又一实施例中,基于前述实施例所述的编解码方法,本申请实施例添加一种新的预测模式BVG-LUT模式(即方案一)。在方案一的流程中,从解码侧角度,解码码流确定当前块的预测参数,当预测参数指示当前块使用BVG LUT模式时,获取对应亮度块的BV,对亮度BV(BVL)进行调整应用于色度,构建色度BV(BVC)的候选列表。然后,判断色度BVC的候选列表中的BVC候选项是否可用:如果可用进入决策环节;若不可用可调整BVC至可用继而进入决策环节或者丢弃,然后直接使用当前块的设定位置的重建亮度样本和重建色度样本来构建亮度分量与色度分量之间的映射关系,进而执行基于BV的色度预测。
示例性地,参见图22为本申请实施例提供的一种编码方法的详细流程示意图。如图22所示,该详细流程可以包括:
S2201:判断BVG-LUT模式是否应用于当前块。
S2202:获取对应亮度块。
S2203:构建亮度BVL候选列表。
S2204:构建色度BVC候选列表。
S2205:判断候选BV是否可用。
S2206:若候选BV可用,则决策最终的色度BV。
S2207:基于色度BV进行色度预测。
S2208:使用其他预测模式进行色度预测。
需要说明的是,在本申请实施例中,对于步骤S2201来说,若判断结果为否,即BVG-LUT模式不应用于当前块,那么执行步骤S2208;若判断结果为是,即BVG-LUT模式应用于当前块,那么执行步骤S2202~S2207。另外,对于步骤S2205来说,若判断结果为否,则直接丢弃,然后执行步骤S2207;若判断结果为是,则执行步骤S2206,进行BV决策,然后再执行步骤S2207。
在一种具体的实施例中,对于本申请实施例的编码方法,具体可以包括:
S1:获取对应亮度块(具体是获取当前块色度分量对应的参考亮度块)。
获取的方法包括但不限于:
(方法1)获取同位亮度区域中心位置块,如图3所示:
获取当前色度块的位置,即当前色度块的左上角色度样本相对于当前图片的左上角色度样本的位置,chromaPos=(x,y),根据表4所示的色度采样格式对chromaPos进行缩放,得到当前色度块对应的同位亮度区域位置lumaPos=(xCb,yCb)。
假设当前色度编码块左上角对应的同位亮度像素相对于图像左上角亮度像素的位置为(xCb,yCb),当前色度编码块对应的同位亮度区域的宽为cbWidth,高为cbHeight。
亮度区域中心位置块即为包含位置坐标(xCb+cbWidth>>1,yCb+cbHeight>>1)的亮度块;在此亮度块位置上可以向左上、上和左搜索多个位置,包括但不限于以下举例的搜索位置:
获取同位亮度区域中心位置块的向左上坐标偏移(xOffset,yOffset)=(-2,-2),向上坐标偏移(xOffset,yOffset)=(0,-2),向左坐标偏移(xOffset,yOffset)=(-2,0)。亮度区域所采用亮度块即为包含位置坐标(xCb+cbWidth>>1+xOffset,yCb+cbHeight>>1+yOffset)的亮度块;
(方法2)获取同位亮度区域左上角的块,如图9所示:
获取当前色度块的位置,即当前色度块的左上角色度样本相对于当前图片的左上角色度样本的位置,chromaPos=(x,y),根据表4所示的色度采样格式对chromaPos进行缩放,得到当前色度块对应的同位亮度区域位置lumaPos=(xCb,yCb)。
假设当前色度编码块左上角对应的同位亮度像素相对于图像左上角亮度像素的位置为(xCb,yCb),当前色度编码块对应的同位亮度区域的宽为cbWidth,高为cbHeight。
亮度区域左上角块即为包含位置坐标(xCb,yCb)的亮度块;在此亮度块位置上可以向左上、上和左搜索多个位置,包括但不限于以下举例的搜索位置:
获取同位亮度区域左上角块的向左上坐标偏移(xOffset,yOffset)=(-2,-2),向上坐标偏移(xOffset,yOffset)=(0,-2),向左坐标偏移(xOffset,yOffset)=(-2,0)。亮度区域所采用亮度块即为包含位置坐标(xCb+xOffset,yCb+yOffset)的亮度块。
(方法3)获取同位亮度区域右下角处的块,如图10所示:
获取当前色度块的位置,即当前色度块的左上角色度样本相对于当前图片的左上角色度样本的位置, chromaPos=(x,y),根据表4所示的色度采样格式对chromaPos进行缩放,得到当前色度块对应的同位亮度区域位置lumaPos=(xCb,yCb)。
假设当前色度编码块左上角对应的同位亮度像素相对于图像左上角亮度像素的位置为(xCb,yCb),当前色度编码块对应的同位亮度区域的宽为cbWidth,高为cbHeight。
亮度区域左上角块即为包含位置坐标(xCb+cbWidth-1,yCb+cbHeight-1)的亮度块;在此亮度块位置上可以向左上、上和左搜索多个位置,包括但不限于以下举例的搜索位置:
获取同位亮度区域右下角块的向左上坐标偏移(xOffset,yOffset)=(-2,-2),向上坐标偏移(xOffset,yOffset)=(0,-2),向左坐标偏移(xOffset,yOffset)=(-2,0)。亮度区域所采用亮度块即为包含位置坐标(xCb+cbWidth-1+xOffset,yCb+cbHeight-1+yOffset)的亮度块;
(方法4)在图11所示的包含五个亮度像素位置的块(包括但不限于五个位置,可以是多个不同位置),依次获取,依次获取的顺序包括但不限于以下顺序:C->TL->TR->BL->BR。
对于C、TL、TR、BL、BR的详细位置推导过程:
获取当前色度块的位置,即当前色度块的左上角色度样本相对于当前图片的左上角色度样本的位置,chromaPos=(x,y),根据表4所示的色度采样格式对chromaPos进行缩放,得到当前色度块对应的同位亮度区域位置lumaPos=(xCb,yCb)。
当前色度编码块左上角对应的同位亮度像素相对于图像左上角亮度像素的位置(即亮度像素TL的位置)为(xCb,yCb),当前色度编码块对应的同位亮度区域的宽为cbWidth,高为cbHeight。
亮度像素C的位置的坐标为(xCb+cbWidth/2,yCb+cbHeight/2);
亮度像素TL的位置的坐标为(xCb,yCb);
亮度像素TR的位置的坐标为(xCb+cbWidth-1,yCb);
亮度像素BL的位置的坐标为(xCb,yCb+cbHeight-1);
亮度像素BR的位置的坐标为(xCb+cbWidth-1,yCb+cbHeight-1)。
在搜索每个位置时,在此位置上可以向左上、上和左搜索多个位置,包括但不限于以下举例的搜索位置:获取此位置的向左上坐标偏移(xOffset,yOffset)=(-2,-2),向上坐标偏移(xOffset,yOffset)=(0,-2),向左坐标偏移(xOffset,yOffset)=(-2,0)。亮度区域所采用亮度块即为包含该位置坐标加上述偏移位置的位置坐标的亮度块。
S2:构建亮度BVL候选列表。
根据S1获取的亮度块,将得到的为以有BV信息的模式进行编码的BVL信息进行缩放,即采用S3的方式一得到色度BV信息BVC,再进行S4步骤的可用性判断,如果可用,将此BVL信息加入BVL列表。
S3:构建色度BVC候选列表。
对S2获取的BVL候选列表,假设列表里的亮度BV=(BVLhor,BVLver),色度BV=(BVChor,BVCver),通过调整BVL或BVC来构建包含一个或者多个候选的色度BVC候选列表。构建方式如下所述。可采用其中之一构建候选列表,也可以同时使用多种方式构建列表。
方式一:根据表8所示的色度采样格式进行缩放,将缩放后的BVC添加至色度BVC候选列表。
方式二:获取对应亮度块的BV后,将其记为BVL,通过BVL获取到的色度BV,记为BVC,通过调整BVL或BVC来构建包含一个或者多个候选的色度BVC候选项。
候选项构建方式包括但不限于以下情况:
构建方式一:调整BVL形成四种情况,进而实现对BVC的调整。
当BVL为奇数时,取BVL=(BVLhor,BVLver)、BVL=(BVLhor+1,BVLver)、BVL=(BVLhor,BVLver+1)、BVL=(BVLhor+1,BVLver+1)四种情况。
当BVL为偶数时,取BVL=(BVLhor,BVLver)。
或:
当BVL为偶数时,取BVL=(BVLhor,BVLver)、BVL=(BVLhor+1,BVLver)、BVL=(BVLhor,BVLver+1)、BVL=(BVLhor+1,BVLver+1)四种情况。
在这里,BVC[0]=BVL[0]*2/SubWidthC;BVC[1]=BVL[1]*2/SubHeightC。其中,SubWidthC和SubHeightC根据表1中的sps_chroma_format_idc与色度格式采样结构对应关系来确定。
根据上式对BVL进行缩放得到BVC,这样当BVL为奇或偶数时,会形成四种BVC候选,将这些候选添加至色度BVC候选列表。然后采用S5的方式一对每个BVL的四个BVC决策出一个BVC。
构建方式二:调整BVL形成四种情况,进而实现对BVC的调整。
当BVL为奇数时,取BVL=(BVLhor,BVLver)、BVL=(BVLhor+1,BVLver)、BVL=(BVLhor,BVLver+1)、BVL=(BVLhor+1,BVLver+1)四种情况。
当BVL为偶数时,取BVL=(BVLhor,BVLver)、BVL=(BVLhor-1,BVLver)、BVL=(BVLhor,BVLver-1)、BVL=(BVLhor-1,BVLver-1)四种情况。
根据方式一中的色度采样格式对BVL进行缩放得到BVC,这样当BVL为奇数或者偶数时,均会形成四种BVC候选,将这些候选添加至色度BVC候选列表。本方式也可以通过以下计算统一奇偶数不同情况下的操作:取BVL=(BVLhor-1,BVLver-1)、BVL=(BVLhor+1,BVLver-1)、BVL=(BVLho-1r,BVLver+1)、BVL=(BVLhor+1,BVLver+1)四种情况。
构建方式三:调整BVL形成多种情况,进而实现对BVC的调整。
当BVL为奇数时,取BVL=(BVLhor,BVLver)、BVL=(BVLhor+1,BVLver)、BVL=(BVLhor,BVLver+1)、BVL=(BVLhor+1,BVLver+1)、BVL=(BVLhor+3,BVLver)、BVL=(BVLhor,BVLver+3)、BVL=(BVLhor+3,BVLver+3)、BVL=(BVLhor-2,BVLver)、BVL=(BVLhor,BVLver-2)等多种情况,对这些候选按顺序构建列表。
当BVL为偶数时,取BVL=(BVLhor,BVLver)、BVL=(BVLhor-1,BVLver)、BVL=(BVLhor,BVLver-1)、BVL=(BVLhor-1,BVLver-1)、BVL=(BVLhor-3,BVLver)、BVL=(BVLhor,BVLver-3)、BVL=(BVLhor-3,BVLver-3)、BVL=(BVLhor+2,BVLver)、BVL=(BVLhor,BVLver+2)等多种情况。
根据方式一中的色度采样格式对BVL进行缩放得到BVC,这样当BVL为奇数或者偶数时,均会形成多种BVC候选,将这些候选添加至色度BVC候选列表。
类似方式二,也可以统一表示为:取BVL=(BVLhor-1,BVLver-1)、BVL=(BVLhor+1,BVLver-1)、BVL=(BVLhor-1,BVLver+1)、BVL=(BVLhor+1,BVLver+1)、BVL=(BVLhor+3,BVLver-1)、BVL=(BVLhor-1,BVLver+3)、BVL=(BVLhor+3,BVLver+3)、BVL=(BVLhor-3,BVLver-1)、BVL=(BVLhor-1,BVLver-3)等。
构建方式四:对方式一得到的BVC进行调整得到九种候选。
设置BVC=(BVChor,BVCver)、BVC=(BVChor-1,BVCver)、BVC=(BVChor,BVCver-1)、BVC=(BVChor-1,BVCver-1)、BVC=(BVChor+1,BVCver)、BVC=(BVChor,BVCver+1)、BVC=(BVChor+1,BVCver+1)、BVC=(BVChor-1,BVCver+1)、BVC=(BVChor+1,BVCver-1),这样就形成了九种BVC候选,将这些候选添加至色度BVC候选列表。
构建方式五:对方式一得到的BVC进行调整得到多种候选。
设置BVC=(BVChor,BVCver)、BVC=(BVChor-1,BVCver)、BVC=(BVChor,BVCver-1)、BVC=(BVChor-1,BVCver-1)、BVC=(BVChor+1,BVCver)、BVC=(BVChor,BVCver+1)、BVC=(BVChor+1,BVCver+1)、BVC=(BVChor-1,BVCver+1)、BVC=(BVChor+1,BVCver-1)、BVC=(BVChor-2,BVCver)、BVC=(BVChor,BVCver-2)、BVC=(BVChor-2,BVCver-2)、BVC=(BVChor+2,BVCver)、BVC=(BVChor,BVCver+2)、BVC=(BVChor+2,BVCver+2)、BVC=(BVChor-2,BVCver+2)、BVC=(BVChor+2,BVCver-2)等,这样就形成了多种BVC候选,将这些候选添加至色度BVC候选列表。
S4:判断BV是否可用。
获取当前色度块的位置(xCb,yCb),获取S3得到的所有BVC候选,对BVC候选,BVC=(BVChor,BVCver),找到对应偏移位置(xCb+BVChor,yCb+BVCver),判断以下条件,包括但不限于以下条件,如果均成立则该候选色度BV可用,这样构建得到一个可用BVC候选列表:
得到的偏移位置是否不超出Picture边界;
得到的偏移位置是否不覆盖当前块,如图12所示;
xCb+width+BVChor<=xCb或yCb+height+BVCver<=yCb;
得到的偏移位置是否不超出可用区域,如图13所示;
得到的偏移位置是否已经重建。
如果至少有一个BVC候选可用,则执行S5进行BV决策。如果均不可用,获取设定位置的亮度和色度像素,该位置包括但不限于当前块的邻近一行一列,进入S6采用模板像素建立LUT。
S5:决策BV。
需要说明的是,S4得到的可用BVC候选列表仅有一个BVC候选,则最终选择的BV即为该BVC。
还需要说明的是,S4得到的可用BVC候选列表有多个BVC候选,则需要对这些BVC进行决策以得到最终的BV,决策的方式包括但不限于以下方式:
BVC候选列表中方所有可用BVC全部使用。
或:
采用模板进行决策:
(a)模板选择:
根据当前编码块的邻近区域的像素可用性,判断模板位置的像素是否可用,包括重建色度信息。包 括但不限于:根据模板与当前编码块的相对位置关系,可将模板分类为上模板、左模板、右上模板、左下模板、左上模板等模板类型,如图14所示。
不同编码块的不同类型的模板尺寸可以固定相同,也可以不同:
例如,模板尺寸对任意尺寸的当前块选择相同的模板尺寸,如下公式说明了一种模板尺寸的设置条件,其中,nTbW和nTbH分别为当前块的宽度和高度,iTempW和iTempH分别为采用的模板的宽度和高度:
上模板:
左模板:
例如,可以根据当前块的不同尺寸选择不同的模板尺寸,如下公式说明了一种模板的尺寸设置条件,nTbW和nTbH分别为当前块的宽度和高度,iTempW和iTempH分别为采用的模板的宽度和高度:
上模板:
左模板:
其中,
例如,也可以根据当前块内的像素数选择不同的模板尺寸,如下公式说明了一种模板的尺寸设置条件,nTbW和nTbH分别为当前块的宽度和高度,nTbW×nTbH分别为当前块的像素数,iTempW和iTempH分别为采用的模板的宽度和高度:
上模板:
左模板:
(b)模板的BV预测:
对得到的多种BVC候选,利用当前块的模板进行运动补偿,得到对应BV处的模板,如图15所示。计算成本时的模板的使用情况存在以下几种情况:
第一种:当前块的上模板和左模板均存在,且对应BV处的上模板和左模板均存在,此时上模板和左模板均可用。
第二种:当前块的上模板和左模板均存在,对应BV处仅上模板存在,此时存在两种方法:方法一:对应BV处左模板不存在,直接不用,即仅用上模板计算。方法二:对应BV处左模板不存在,采用参考块内部最左侧的模板宽度列代替左模板,即采用上模板和左模板计算。
第三种:当前块的上模板和左模板均存在,对应BV处仅左模板存在,此时存在两种方法:方法一:对应BV处上模板不存在,直接不用,即仅用左模板计算。方法二:对应BV处上模板不存在,采用参考块内部最上侧的模板高度行代替上模板,即采用上模板和左模板计算。
第四种:当前块仅上模板存在,此时存在三种方法:方法一:对应BV处上模板不存在,直接不用,此时最终选择的BV为BVC候选列表中的第一个BVC或某个指定位置的BVC。方法二:对应BV处上模板不存在,采用参考块内部最上侧的模板高度行代替上模板。方法三:对应BV处上模板存在,直接用。
第五种:当前块仅左模板存在,此时存在三种方法:方法一:对应BV处左模板不存在,直接不用,此时最终选择的BV为BVC候选列表中的第一个BVC或某个指定位置的BVC。方法二:对应BV处左模板不存在,采用参考块内部最左侧的模板宽度列代替左模板。方法三:对应BV处左模板存在,直接用。
第六种:当前块上模板和左模板均不存在,此时最终选择的BV为BVC候选列表中的第一个BVC或某个指定位置的BVC。
(c)计算成本:
对于计算模板区域成本的成本函数有多种选择,例如,可以选择绝对误差和(SAD)、变换绝对误差和(SATD)、差值平方和(SSE)、平均绝对差值(MAD)、平均绝对误差(MAE)、平均平方误差(MSE)、率失真函数(RDO)等评价准则。下述内容所提到的某种评价准则均可从上述准则中选择其一,以SAD的评价准则为例,计算公式如下:
其中,predTempSizeW为模板的宽度,predTempSizeH为模板的高度,predTemp[i][j]为BV处模板的像素点,recTempC[i][j]为当前块模板的像素点。
(d)选择最终的BV:
除去(b)中无法计算成本的情况,其他情况对BVC的候选列表中每个候选进行成本的计算,并排序,排序方法包括但不限于采用冒泡排序、选择排序、插入排序、希尔排序、归并排序、快速排序、基数排序、堆排序、计数排序、桶排序等排序方法。选择成本最小的BVC作为最终的BV,以此进行基于BV的色度预测。
S6:基于BV的色度预测。
对于色度预测,包括但不限于以下方式:
在方式一中,图23为本申请实施例提供的一种基于BV的色度预测流程示意图。如图23所示,该流程可以包括:
S231,获取亮度样本及色度样本。
(1)获取亮度样本:
获取当前色度块的位置,即当前色度块的左上角色度样本相对于当前图片的左上角色度样本的位置,chromaPos=(x,y),根据表4所示的色度采样格式对chromaPos进行缩放,得到当前色度块对应的同位亮度区域位置lumaPos=(xCb,yCb)。
获取色度BV=(BVChor,BVCver),根据色度采样格式对色度BV进行调整,得到当前色度块对应的同位亮度区域的亮度BV=(BVYhor,BVYver)。
获取当前色度块对应的同位亮度区域位置lumaPos=(xCb,yCb),获取亮度BV=(BVYhor,BVYver),找到当前色度块对应的同位亮度区域对应的偏移位置(xCb+BVYhor,yCb+BVYver,如图16所示。
同时,将当前色度块设定位置处对应的重建亮度样本,包括但不限于当前色度块对应的同位亮度区域的邻近的一行一列样本,也可以有一行、多行、一列、多列四种情况的不同组合,这里不作任何限定。
对上述位置处的亮度进行下采样得到下采样后的亮度样本,采用下面几种采样方式竞争或者默认采用一种采样方式,编码端竞争方式包括但不限于以下方式:
①采用全RDO竞争方式。
不同采样方式对应的亮度下采样重建值不同,对每一种采样方式进行预测、变换、量化、重建计算失真和比特,进而更新最优。
②只进行一次RDO选择。
不同采样方式对应的亮度下采样重建值不同,对每一种采样方式进行预测,计算预测值和原始值之间的失真,包括但不限于SAD、SATD等,选出一种失真最小的下采样方式,对这种下采样方式进行预测、变换、量化、重建计算失真和比特。
③进行可变次数的RDO选择。
默认进行下采样方式一的预测、变换、量化、重建计算失真和比特。下采样方式一到六的每一种均计算预测值和原始值之间的失真,包括但不限于SAD、SATD等,对二到六的失真依次和一的失真进行比较,如果scale*失真(下采样方式二到六)<失真(下采样方式一),scale的取值包括但不限于1、1.5、1.15、1.3等,则增加相应的RDO次数。
④进行设定次数的RDO选择。
采用②进行一次RDO,将该种采样方式得到的预测值与BVL(包括但不限于中心亮度块得到)指向位置处的帧内预测模式加权得到预测值进行RDO,或者将该种采样方式得到的预测值与BVC(包括但不限于中心亮度块得到)指向位置处的色度预测值加权得到预测值进行RDO。需要注意的是,如果增加加权计算,则需要在码流中应该相应增加一个weight_flag(指示是否加权)或者weight_idx(指示加权权值可选项中的序号,例如0,1/4,1/2,3/4,1等)语法元素。
包括但不限于以下的六种下采样方式:
假设下采样前的亮度样本为recBvBefDownLuma,存储buffer的宽度为iRecRefLumaStride,下采样后的亮度样本为recBvAftDownLuma,则位置(i,j)处下采样后的样本为:
下采样方式一(如图17A所示):
recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]*2
+recBvBefDownLuma[2*i+1]
+recBvBefDownLuma[2*i-1]
+recBvBefDownLuma[2*i+iRecRefLumaStride]*2
+recBvBefDownLuma[2*i+1+iRecRefLumaStride]
+recBvBefDownLuma[2*i-1+iRecRefLumaStride]+4)>>3
下采样方式二(如图17B所示):
recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]
+recBvBefDownLuma[2*i+1]+1)>>1
下采样方式三(如图17C所示):
recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]
+recBvBefDownLuma[2*i+iRecRefLumaStride]+1)>>1
下采样方式四(如图17D所示):
recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i+iRecRefLumaStride]
+recBvBefDownLuma[2*i+1+iRecRefLumaStride]+1)>>1
下采样方式五(如图17E所示):
recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i+1]
+recBvBefDownLuma[2*i+1+iRecRefLumaStride]+1)>>1
下采样方式六(如图17F所示):
recBvAftDownLuma[i][j]=(recBvBefDownLuma[2*i]
+recBvBefDownLuma[2*i+1]
+recBvBefDownLuma[2*i+iRecRefLumaStride]
+recBvBefDownLuma[2*i+1+iRecRefLumaStride]+2)>>2
经过下采样后,即获取到了当前色度块对应的同位亮度区域对应BV处的下采样重建亮度样本recBvAftDownLuma。
(2)获取色度样本:
获取当前色度块的位置(xCbC,yCbC),获取色度BV=(BVChor,BVCver),找到对应偏移位置(xCbC+BVChor,yCbC+BVCver),即获取到了当前色度块对应BV处的重建色度样本recBvChroma。
同时,获取当前色度块设定位置处的重建色度样本,包括但不限于当前色度块邻近的一行一列样本,包括但不限于仅左模板和上模板。
S232,建立亮度到色度的映射表LUT。
对S231中获取到的重建亮度样本recBvAftDownLuma和重建色度样本recBvChroma以及设定位置处的重建亮度和色度样本建立亮度到色度的映射表LUT,包括但不限于以下方式:
亮度为key,色度为value。
对于比特深度大于8bit的视频,样本范围为[0,1023],对于key值recBvAftDownLuma,可以将其映射为[0,255]、[0,511]等范围,并不作任何限定。
对于LUT表中的每一key-value对采用包括但不限于如下方式建立:
LUT[recBvAftDownLuma[i][j]]=recBvChroma[i][j]          (26)
另外,对于相同key值的不同色度值,可以按照样本顺序依次覆盖相同key值的条目,或者采取平均等操作。
S233,根据映射表LUT对当前块进行亮度到色度的预测。
获取当前色度块对应的同位亮度区域lumaPos=(xCb,yCb)位置的重建亮度样本recBefDownLuma,对该亮度样本采用S231的方式进行相同的下采样方式得到下采样后的重建亮度样本recAftDownLuma,对该样本进行和S232相同的样本范围的映射处理。
在一种可能的实现方式中,假设当前色度块的预测值为predSamples,则对于predSamples[cIdx][x][y],变量cIdx指定当前块的颜色分量索引,采用如下预测方式:
参考其同位置的亮度值Yc,以使用S232建立的离散映射模型导出预测值。
如果在S232建立的离散映射模型中的输入亮度集中未找到Yc,则包括但不限于以下处理方式:按{Yc+1、Yc─1、Yc+2、Yc─2、Yc+3、Yc─3}顺序进行检查,如果模型不能匹配以上所有值,则将预测设置为对应BV处的重建色度样本recBvChroma的平均值。
如果映射表LUT为空,则包括但不限于以下预测方式:填充为512、采用任意角度预测等。
在另一种可能的实现方式中,对上述实现方式的预测值进行修正得到最终的预测值,包括但不限于与CCLM类模式或者其他模式进行加权。
在又一种可能的实现方式中,在S5步骤决策出多个BV,进行基于BV的预测,得到多种预测值, 然后将这多种预测值进行加权,得到加权后的预测值,也可以继续对该预测值进行修正,包括但不限于与CCLM类模式或者其他模式进行加权。
在另一种实施例中,修改DM模式的改进(即方案二)。双树划分下,DM模式下,如果对应亮度区域具有BV信息,则当前色度块采用BVG-LUT模式进行预测。例如:
如果CuPredMode[0][xCb+cbWidth/2][yCb+cbHeight/2]等于MODE_IBC,置intra_bvglut_flag=1,则色度帧内预测模式IntraPredModeC[xCb][yCb]使用BVG-LUT。
如果CuPredMode[0][xCb+cbWidth/2][yCb+cbHeight/2]等于MODE_INTRA,如果IntraTmpFlag[xCb+cbWidth/2][yCb+cbHeight/2]等于1,置intra_bvglut_flag=1,则色度帧内预测模式IntraPredModeC[xCb][yCb]使用BVG-LUT。
在这里,色度预测模式推导详见表9所示。色度帧内预测模式IntraPredModeC[xCb][yCb]使用cclm_mode_flag、cclm_mode_idx、表9中指定的intra_chroma_pred_mode、lumaIntraPredMode和lumaTempPredMode。其中,0代表Planar模式,1代表DC模式,18代表水平模式、50代表垂直模式,81~83代表CCLM模式。这些除BVG-LUT模式之外的填充项是示例性地给出对应的值,而不是必须填写为该值。
DM模式下,如果intra_bvglut_flag==1,即同位亮度区域中心位置块获取到的信息含有BV,则色度帧内预测模式IntraPredModeC[xCb][yCb]使用BVG-LUT。
另外,采用方案一中BVG-LUT模式的流程进行预测,具体步骤同方案一的S1、S2、S3、S4、S5和S6。步骤S1获取同位亮度区域中心块及扩展位置。
基于前述实施例所述的编解码方法,本申请实施例还提供了一种码流组织方法。这里可以包括但不限于以下几种方式。
方式一:编码在MODE_INTRA内部。这里只列举一种码流解析位置,仅用作示例性说明。
添加在intra_chroma_pred_mode前面,以采用多种下采样方式为例。
表10
在这里,如果sps_ibc_enabled_flag等于0且sps_intratmp_enabled_flag等于0,则BvglutEnabled等于0。否则,设置变量ModeIncludeBv,如果对应的亮度块没有以有BV信息的模式进行编码的,则ModeIncludeBv等于0;否则ModeIncludeBv等于1。
如果以下多个条件同时为真(包括但不限于以下条件),则BvglutEnabled等于1:
ModeIncludeBv等于1。
sh_slice_type等于I帧。
CtbLog2SizeC小于等于MaxChromaIbcSize。其中,MaxChromaIbcSize可根据色度CTU大小或预设值确定。
否则,BvglutEnabled等于0。
需要说明的是,在这些条件中,也可以省略去ModeIncludeBv等于1和/或sh_slice_type等于I帧,这里不作任何限定。
BvglutEnabled等于0,则bvglut_flag被推断为0。
bvglut_flag为1表示当前色度预测模式为BVG-LUT,包括但不限于以下二值化方式,可以采用上下文或者旁路的方式编码。示例性地,如表11、表12、表13或表14所示。在这里,FL表示定长。
表11
表12
表13
或:
表14
另外,filter_idx包括但不限于以下二值化方式,而且包括但不限于可以采用上下文或者旁路的方式编码。示例性地,如表15、表16、表17所示。
表15
在filter_idx=0或1时,如表16所示。在filter_idx=2、3、4、5时,如表17所示。
表16
表17
方式二:编码在MODE_IBC,具体语法元素描述如表18所示。
表18
在这里,如果sps_ibc_enabled_flag等于0且sps_intratmp_enabled_flag等于0,则BvglutEnabled等于0。否则,设置变量ModeIncludeBv,如果对应的亮度块没有以有BV信息的模式进行编码的,则ModeIncludeBv等于0;否则ModeIncludeBv等于1。
如果以下多个条件同时为真(包括但不限于以下条件),则BvglutEnabled等于1:
ModeIncludeBv等于1。
sh_slice_type等于I帧。
CtbLog2SizeC小于等于MaxChromaIbcSize。其中,MaxChromaIbcSize可根据色度CTU大小或预设值确定。
否则BvglutEnabled等于0。
需要说明的是,在这些条件中,也可以省略去ModeIncludeBv等于1和/或sh_slice_type等于I帧,这里不作任何限定。
treeType==DUAL_TREE_CHROMA下,BvglutEnabled等于0,则pred_mode_ibc_flag被推断为0。treeType==DUAL_TREE_CHROMA下,pred_mode_ibc_flag为1表示当前色度预测模式为BVG-LUT。其中,对于语法元素pred_mode_ibc_flag,在编码中的语法描述如表19、表20所示。在这里,FL表示定长。
表19
表20
需要说明的是,上述的方式一和方式二均对应前述实施例的方案一的情况。
方案二:以采用多种下采样方式为例,在实现中,具体语法元素描述如表21所示。
表21

另外,对于不同的语法元素(例如cclm_mode_flag、cclm_mode_idx和intra_chroma_pred_mode等),每一位编码比特所采用的编码方式具体如表22所示;对于语法元素intra_chroma_pred_mode的取值,其对应的二值化字符串(Bin string)如表23所示。
表22
表23
对于intra_chroma_pred_mode的第0个bin,代表DM模式,编码方式与VVC相同。语法元素BvglutEnabled的推导过程如下:
如果sps_ibc_enabled_flag等于0且sps_intratmp_enabled_flag等于0,则BvglutEnabled等于0。
否则,如果以下多个条件同时为真(包括但不限于以下条件),则BvglutEnabled等于1:
sh_slice_type等于I帧。
CtbLog2SizeC小于等于MaxChromaIbcSize。其中,MaxChromaIbcSize可根据色度CTU大小或预设值确定。
如果BvglutEnabled等于1:
当intra_chroma_pred_mode等于0、1、2或3这四种色度预测模式时,这四种色度预测模式参考表4;当intra_chroma_pred_mode等于4时,实行方案二。
否则,参考H.266标准中的色度预测过程。
如果为DM模式,filter_idx的二值化方式同上。
需要说明的是,在本申请实施例中,可以建立多个LUT,并用语法元素指明选择的LUT的方案。具体地,获取同位亮度区域的多个块,多个块的位置包括但不限于以下位置,如图25所示。S2建立多个块中的可用块的亮度BV的BVL候选列表,S3中根据S2中的亮度BV分别构建各自的色度BVC候选列表的候选项,多个块分别经过S4判断该候选列表中的BV的可用性,多个块分别再经过S5决策出一个BV或者多个BV或者通过聚类决策出多组BV,这多个块的各自的可用色度BVC经过S6的S231和S232各自建立一个映射表LUT,此时可以根据已重建块的LUT维护的全局LUT进行当前块LUT表更新,编码端经过S6的S233采用RDO决策使用哪一个映射表,并且采用语法元素标识传送到解码端,S6的S233根据最终决策出的映射表得到最终的预测值。建立的映射表的数量可以任意设定,这里将数量设置为4以进行码流标识的说明。
示例性地,这里只列举一种码流解析位置,仅作说明,具体语法描述如表24所示。
表24
其中,bvglut_flag为真表示当前色度预测模式为BVG-LUT,进一步编码使用的映射表的lut_idx,包括但不限于以下二值化方式,可以采用上下文模型或者旁路模型的方式编码。示例性地,如表25、表26或表27所示。在这里,FL表示定长。
表25
表26
或:表27
还需要说明的是,在本申请实施例中,可以建立多个LUT,用模板选择使用哪个LUT的方案。具体地,获取同位亮度区域的多个块,多个块的位置包括但不限于以下位置,如图25所示。S2建立多个块中的可用块的亮度BV的BVL候选列表,S3中根据S2中的亮度BV分别构建各自的色度BVC候选列表的候选项,多个块分别经过S4判断该候选列表中的BV的可用性,多个块分别再经过S5决策出一个BV或者多个BV或者通过聚类决策出多组BV,这多个块的各自的可用色度BVC经过S6的S61和S62各自建立一个映射表LUT,对当前块模板经过利用不同的映射表LUT进行预测,和模板重建值计算差值,进而决策使用哪一个映射表,编解码端均需要执行,S6的S63根据最终决策出的映射表得到最终的预测值。建立的映射表的数量可以任意设定。
对当前块模板进行LUT预测的具体过程为:
获取当前色度块模板对应的同位亮度区域模板lumaPos=(xCbR,yCbR)位置的重建亮度样本recBefDownLumaR,对该亮度样本采用S61的方式进行相同的下采样方式得到下采样后的重建亮度样本recAftDownLumaR,对该样本进行和S62相同的样本范围的映射处理。
假设当前色度块模板的预测值为predSamplesR,则对于predSamplesR[cIdx][x][y],变量cIdx指定当前块的颜色分量索引,采用如下预测方式:
参考其同位置的亮度值Yc,以使用S62建立的离散映射模型导出预测值。
如果在S62建立的离散映射模型中的输入亮度集中未找到Yc,则包括但不限于以下处理方式:按{Yc+1、Yc─1、Yc+2、Yc─2、Yc+3、Yc─3}顺序进行检查,如果模型不能匹配以上所有值,则将预测设置为对应BV处的重建色度样本recBvChroma的平均值。
对当前块模板以及每个LUT的模板预测值进行成本计算:计算成本时的模板选择参见S5决策BV中的模板选择。其中,计算成本时的模板的使用情况存在以下几种情况:
第一种:当前块的上模板和左模板均存在,此时上模板和左模板均可用。
第二种:当前块仅上模板存在,此时仅上模板可用。
第三种:当前块仅左模板存在,此时仅左模板可用。
第四种:当前块上模板和左模板均不存在,此时最终选择的LUT为建立的第一个LUT或某个指定位置的LUT。
假设当前色度块模板的重建值为recSamplesR,对于计算模板区域成本的成本函数有多种选择,例如,可以选择绝对误差和(SAD)、变换绝对误差和(SATD)、差值平方和(SSE)、平均绝对差值(MAD)、平均绝对误差(MAE)、平均平方误差(MSE)、率失真函数(RDO)等评价准则。其中,本申请实施例所提到的某种评价准则均可从上述准则中选择其一进行成本计算。
利用当前块模板选择最终的LUT:除去无法计算成本的情况,其他情况对建立的每个LUT候选进行成本的计算,并排序,排序方法包括但不限于采用冒泡排序、选择排序、插入排序、希尔排序、归并排序、快速排序、基数排序、堆排序、计数排序、桶排序等排序方法。选择成本最小的LUT候选作为最终使用的映射表LUT,以此进行S6的S233进行预测。
还需要说明的是,在本申请实施例中,可以进行色度上采样与亮度对齐后建立LUT的方案。具体地,对于S6的S231获取亮度及色度样本中所获取的亮度样本:仅获取对应亮度区域的重建亮度样本recBvBefDownLuma,不进行下采样。
对于S6的S231获取亮度及色度样本中所获取的色度样本:获取到当前色度块对应BV处的重建色度样本recBvChroma后,进行上采样,包括但不限于线性插值等方式,得到和BV处重建亮度样本同样尺寸的重建色度样本recBvChromaUp。
将所得到的重建亮度样本recBvBefDownLuma和重建色度样本recBvChromaUp经过S232建立BV处亮度到色度的映射表LUT。
将当前色度块的重建亮度样本recBefDownLuma和LUT经过S63对当前块进行亮度到色度的预测,再将这个预测值进行下采样操作得到当前块最终的色度预测值,下采样方式包括但不限于平均下采样等。
还需要说明的是,在本申请实施例中,还可以与其他模式同时使用。DM模式下,除了本模式,还可以与其他模式竞争。根据模板代价决定最终使用模式。例如,与直接使用由亮度得到的BV,可以直接利用BV复制,也可以利用本专利定义的模式,该两种模式均应用于当前色度块的模板后,选择模板代价更小的一个作为当前色度块的预测模式。
在本申请实施例中,通过上述实施例对前述实施例的具体实现进行详细阐述,从中可以看出,本申请实施例在于提出一种新的色度预测方式:一方面,充分利用了已有技术的优势,改善了色度预测的单一性,充分利用了同位亮度区域的信息,有效地提高了色度预测的准确性;另一方面,对BV处的亮度和色度建立映射表,可以有效的进行像素级预测,从而进一步提高了编码效率。也就是说,本申请实施例充分考虑了重建亮度以及BV等可用信息,并根据这些信息对色度进行预测,改善了色度预测的单一性;并在获取到亮度BV后,对BV处的亮度和色度建立映射表,可以有效的进行像素级预测,从而可以有效地对色度块进行准确的预测,进一步提高了编码效率。
在本申请的再一实施例中,基于前述实施例相同的发明构思,图24为本申请实施例提供的一种编码器的组成结构示意图。如图24所示,该编码器240可以包括第一确定单元2401和第一预测单元2402,其中:
第一确定单元2401,配置为确定当前块的预测参数;以及根据预测参数,确定当前块的第一参考预测参数集;其中,第一参考预测参数集包含一个或多个第一候选参考预测参数;
第一确定单元2401,还配置为根据第一参考预测参数集,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值;以及根据第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系;
第一预测单元2402,配置为根据映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。
在一些实施例中,第一确定单元2401,还配置为在预测参数指示当前块使用第一预测模式时,确定当前块的第一参考预测参数集。
在一些实施例中,第一确定单元2401,还配置为确定当前块使用第一预测模式的第一代价值,以及确定当前块不使用第一预测模式的第二代价值;以及根据第一代价值和第二代价值,确定预测参数。
在一些实施例中,第一确定单元2401,还配置为若第一代价值小于第二代价值,则确定预测参数 指示当前块使用第一预测模式;以及若第一代价值大于第二代价值,则确定预测参数指示当前块不使用第一预测模式。
在一些实施例中,参见图24,编码器240还可以包括编码单元2403,其中:
第一确定单元2401,还配置为根据预测参数,确定第一语法元素的取值;
编码单元2403,配置为对第一语法元素的取值进行编码处理,将所得到的编码比特写入码流。
在一些实施例中,第一确定单元2401,还配置为若预测参数指示当前块使用第一预测模式,则确定第一语法元素的取值为第一值;以及若预测参数指示当前块不使用第一预测模式,则确定第一语法元素的取值为第二值。
在一些实施例中,第一确定单元2401,还配置为确定当前块的第一颜色分量块;根据第一颜色分量块,确定当前块的第二参考预测参数集;其中,第二参考预测参数集包含一个或多个第二候选参考预测参数;以及根据第二参考预测参数集,确定当前块的第一参考预测参数集。
在一些实施例中,第一候选参考预测参数为基于第二颜色分量的向量参数,第二候选参考预测参数为基于第一颜色分量的向量参数。
在一些实施例中,向量参数包括下述其中之一:块向量参数、运动向量参数。
在一些实施例中,第一确定单元2401,还配置为确定当前块的同位置的第一颜色分量区域;以及基于第一颜色分量区域的多个划分块,确定当前块的第一颜色分量块。
在一些实施例中,第一确定单元2401,还配置为从多个划分块中,确定处于第一位置的第一候选块;以及根据处于第一位置的第一候选块,确定当前块的第一颜色分量块。
在一些实施例中,第一确定单元2401,还配置为在第一位置的预设搜索区域进行位置偏移搜索,确定多个第二候选块;以及根据第一候选块和/或多个第二候选块,确定当前块的第一颜色分量块。
在一些实施例中,第一确定单元2401,还配置为根据第一颜色分量块,确定一个或多个基于第一颜色分量的候选向量参数;以及根据一个或多个基于第一颜色分量的候选向量参数,确定当前块的第二参考预测参数集。
在一些实施例中,第一确定单元2401,还配置为对基于第一颜色分量的候选向量参数进行调整,确定基于第二颜色分量的候选向量参数;以及在基于第二颜色分量的候选向量参数满足预设可用条件时,将基于第一颜色分量的候选向量参数作为第二候选参考预测参数并添加至第二参考预测参数集。
在一些实施例中,第一确定单元2401,还配置为确定当前块的预设采样格式;以及根据预设采样格式对基于第一颜色分量的候选向量参数进行缩放,确定基于第二颜色分量的候选向量参数。
在一些实施例中,第一确定单元2401,还配置为对第二参考预测参数集中的一个或多个第二候选参考预测参数进行调整,确定一个或多个第二候选参考预测参数各自对应的第一候选参考预测参数;以及根据一个或多个第二候选参考预测参数各自对应的第一候选参考预测参数,确定当前块的第一参考预测参数集。
在一些实施例中,第一确定单元2401,还配置为对第二候选参考预测参数进行调整,确定基于第二颜色分量的第三参考预测参数集;以及根据第三参考预测参数集,确定第二候选参考预测参数对应的第一候选参考预测参数。
在一些实施例中,第一确定单元2401,还配置为根据当前块的预设采样格式对第二候选参考预测参数进行缩放,确定基于第二颜色分量的候选向量参数,并将基于第二颜色分量的候选向量参数添加至第三参考预测参数集。
在一些实施例中,第一确定单元2401,还配置为根据当前块的预设采样格式对第二候选参考预测参数进行缩放,确定基于第二颜色分量的第一初始向量参数;以及根据一个或多个偏移值对基于第二颜色分量的第一初始向量参数进行偏移计算,确定一个或多个基于第二颜色分量的候选向量参数,并将一个或多个基于第二颜色分量的候选向量参数添加至第三参考预测参数集。
在一些实施例中,第一确定单元2401,还配置为根据一个或多个偏移值对第二候选参考预测参数进行偏移计算,确定一个或多个基于第一颜色分量的第二初始向量参数;以及根据当前块的预设采样格式对一个或多个基于第一颜色分量的第二初始向量参数进行缩放,确定一个或多个基于第二颜色分量的候选向量参数,并将一个或多个基于第二颜色分量的候选向量参数添加至第三参考预测参数集。
在一些实施例中,第一确定单元2401,还配置为在第三参考预测参数集存在满足预设可用条件的一个或多个候选向量参数时,根据一个或多个候选向量参数确定第一候选参考预测参数。
在一些实施例中,一个或多个候选向量参数满足预设可用条件,至少包括:根据一个或多个候选向量参数指示的偏移位置未超出图像边界;根据一个或多个候选向量参数指示的偏移位置未超出片边界;根据一个或多个候选向量参数指示的偏移位置未覆盖当前块;根据一个或多个候选向量参数指示的偏移位置未超出预设可用区域;根据一个或多个候选向量参数指示的偏移位置已经重建。
在一些实施例中,第一确定单元2401,还配置为若第三参考预测参数集存在满足预设可用条件的一个候选向量参数,则将满足预设可用条件的一个候选向量参数确定为第一候选参考预测参数;以及若第三参考预测参数集存在满足预设可用条件的多个候选向量参数,则对满足预设可用条件的多个候选向量参数进行决策,确定第一候选参考预测参数。
在一些实施例中,第一确定单元2401,还配置为确定当前块的第一模板;根据第一模板和多个候选向量参数,确定多个候选向量参数各自的第一匹配模板;在第一模板与第一匹配模板满足预设存在条件时,根据预设的误差准则,计算当前块的第一模板与第一匹配模板之间的匹配误差,以确定多个候选向量参数各自的第一代价值;以及从多个候选向量参数各自的第一代价值中确定最小代价值,将最小代价值对应的候选向量参数确定为第一候选参考预测参数。
在一些实施例中,第一确定单元2401,还配置为在第一模板与第一匹配模板不满足预设存在条件时,将第三参考预测参数集中满足预设可用条件的第一个候选向量参数确定为第一候选参考预测参数;或者,在第一模板与第一匹配模板不满足预设存在条件时,将第三参考预测参数集中满足预设可用条件的第二位置处的候选向量参数确定为第一参考预测参数。
在一些实施例中,第一确定单元2401,配置为在第三参考预测参数集中的全部候选向量参数均不满足预设可用条件时,确定当前块的第三位置处的第一颜色分量重建样本和第二颜色分量重建样本;第一确定单元2401,还配置为根据第三位置处的第一颜色分量重建样本和第二颜色分量重建样本,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值。
在一些实施例中,第一确定单元2401,还配置为根据第一参考预测参数集,确定一个或多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本;确定当前块的第三位置处的第一颜色分量重建样本和第二颜色分量重建样本;以及根据一个或多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本以及第三位置处的第一颜色分量重建样本和第二颜色分量重建样本,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值。
在一些实施例中,第一确定单元2401,还配置为确定当前块的位置;对当前块的位置进行缩放,确定当前块的同位置的第一颜色分量区域的位置;以及对第一候选参考预测参数进行缩放,确定当前块的同位置的第一颜色分量区域的缩放后块向量参数;以及根据第一颜色分量区域的位置和缩放后块向量参数,确定第一颜色分量的参考块,并根据第一颜色分量的参考块确定第一候选参考预测参数指示的第一颜色分量重建样本;以及根据当前块的位置和第一候选参考预测参数,确定第二颜色分量的参考块,并根据第二颜色分量的参考块确定第一候选参考预测参数指示的第二颜色分量重建样本。
在一些实施例中,第一确定单元2401,还配置为对第一颜色分量的参考块进行下采样处理,确定第一候选参考预测参数指示的第一颜色分量重建样本,以使第一颜色分量重建样本的分辨率与第二颜色分量重建样本的分辨率相同。
在一些实施例中,第一确定单元2401,还配置为对第二颜色分量的参考块进行上采样处理,确定第一候选参考预测参数指示的第二颜色分量重建样本,以使第一颜色分量重建样本的分辨率与第二颜色分量重建样本的分辨率相同;相应地,对当前块的第二颜色分量的预测值进行下采样处理。
在一些实施例中,第一确定单元2401,还配置为确定当前块的下采样方式;根据下采样方式对第一颜色分量的参考块进行下采样处理,确定第一候选参考预测参数指示的第一颜色分量重建样本。
在一些实施例中,第一确定单元2401,还配置为基于预设竞争方式对多种候选下采样方式进行代价计算,确定多种候选下采样方式各自对应的代价结果;从多种候选下采样方式各自对应的代价结果中选择最小代价结果;以及将最小代价结果对应的候选下采样方式确定为当前块的下采样方式。
在一些实施例中,预设竞争方式为率失真优化方式。
在一些实施例中,第一确定单元2401,还配置为确定滤波标识信息的取值;其中,滤波标识信息用于指示当前块的下采样方式在多种候选下采样方式中的索引序号;编码单元2403,还配置为对滤波标识信息的取值进行编码处理,将所得到的编码比特写入码流。
在一些实施例中,第一确定单元2401,还配置为确定当前块的第一模板;以及根据第一模板,确定第三位置处的第一颜色分量重建样本和第二颜色分量重建样本。
在一些实施例中,第一模板的类型包括下述至少一项:上模板、右上模板、左模板、左下模板和左上模板;其中,上模板位于当前块相邻的上侧已解码区域,右上模板位于当前块相邻的右上侧已解码区域,左模板位于当前块相邻的左侧已解码区域,左下模板位于当前块相邻的左下侧已解码区域,左上模板位于当前块相邻的左上侧已解码区域。
在一些实施例中,第一确定单元2401,还配置为根据第一颜色分量参考样值和第二颜色分量参考样值确定第一查找表,其中,第一查找表用于记录索引关键字为第一颜色分量时所对应的第二颜色分量的取值。
在一些实施例中,第一确定单元2401,还配置为根据第一颜色分量参考样值和第二颜色分量参考样值确定第一离散模型,其中,第一离散模型用于指示第一颜色分量与第二颜色分量之间的映射关系。
在一些实施例中,第一确定单元2401,还配置为对第一颜色分量参考样值进行映射处理,以使第一颜色分量参考样值处于预设样本范围。
在一些实施例中,第一确定单元2401,还配置为在第一颜色分量参考样值中的第一参考样值相同且对应第二颜色分量参考样值中不同的多个第二参考样值时,按照样本顺序依次进行覆盖处理,将最后一个第二参考样值作为与第一参考样值具有映射关系的值。
在一些实施例中,第一确定单元2401,还配置为在第一颜色分量参考样值中的第一参考样值相同且对应第二颜色分量参考样值中不同的多个第二参考样值时,对多个第二参考样值进行平均值计算,将所得到的平均值作为与第一参考样值具有映射关系的值。
在一些实施例中,第一确定单元2401,还配置为确定当前块的同位置的第一颜色分量区域的重建像素样本;以及基于第一颜色分量区域的重建像素样本,确定当前块的第一颜色分量样值。
在一些实施例中,第一预测单元2402,还配置为若在映射关系中查找到与第一颜色分量样值相等的第一颜色分量值,则将第一颜色分量值对应的第二颜色分量的取值确定为当前块的第二颜色分量的预测值。
在一些实施例中,第一确定单元2401,还配置为若在映射关系中没有查找到与第一颜色分量样值相等的第一颜色分量值,则对第一颜色分量样值进行修正处理,确定第一颜色分量修正值,并继续在映射关系中查找是否存在与第一颜色分量修正值相等的第一颜色分量值。
在一些实施例中,第一确定单元2401,还配置为根据预设的一个或多个偏移值对第一颜色分量样值进行偏移计算,确定第一颜色分量修正值。
在一些实施例中,第一预测单元2402,还配置为若在映射关系中没有查找到与第一颜色分量修正值相等的第一颜色分量值,则对第二颜色分量参考样值进行平均值计算,将所得到的平均值确定为当前块的第二颜色分量的预测值。
在一些实施例中,第一预测单元2402,还配置为根据映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的第一初始预测值;以及对第一初始预测值进行修正操作,确定当前块的第二颜色分量的预测值。
在一些实施例中,第一预测单元2402,还配置为根据第一预设模式对当前块的第二颜色分量进行预测处理,确定当前块的第二颜色分量的第二初始预测值;其中,第一预设模式至少包括下述其中一项:PLANAR模式、DM模式、DC模式和CCLM模式;以及对第一初始预测值和第二初始预测值进行加权计算,确定当前块的第二颜色分量的预测值。
在一些实施例中,第一确定单元2401,还配置为确定当前块的第二颜色分量的初始值;以及根据初始值和预测值,确定当前块的第二颜色分量的残差值;编码单元2403,还配置为对当前块的第二颜色分量的残差值进行编码处理,将所得到的编码比特写入码流。
在一些实施例中,第一确定单元2401,还配置为在第一参考预测参数集包括多个第一候选参考预测参数时,确定多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本;以及根据多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本,确定第一颜色分量与第二颜色分量之间的多个映射关系;第一预测单元2402,还配置为根据多个映射关系,确定当前块的第二颜色分量的多个第三初始预测值;以及对多个第三初始预测值进行加权计算,确定当前块的第二颜色分量的预测值。
在一些实施例中,第一确定单元2401,还配置为在当前块的第一颜色分量块包括多个候选块时,确定当前块的第二参考预测参数集;其中,第二参考预测参数集包含多个第二候选参考预测参数;根据多个第二候选参考预测参数,确定多个第一候选参考预测参数;基于多个第一候选参考预测参数,确定第一颜色分量与第二颜色分量之间的多个候选映射关系;以及从多个候选映射关系中,确定目标映射关系;第一预测单元2402,还配置为根据目标映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。
在一些实施例中,第一确定单元2401,还配置为对多个候选映射关系分别进行代价计算,确定多个候选映射关系各自对应的代价结果;以及从多个候选映射关系各自对应的代价结果中确定最小代价结果,将最小代价结果对应的候选映射关系确定为目标映射关系。
在一些实施例中,第一确定单元2401,还配置为确定映射关系索引值,其中,映射关系索引值用于指示目标映射关系在多个候选映射关系中的索引序号;编码单元2403,还配置为对映射关系索引值进行编码处理,将所得到的编码比特写入码流。
在一些实施例中,第一确定单元2401,还配置为在当前块的第一颜色分量块包括多个候选块时, 确定当前块的第二参考预测参数集;其中,第二参考预测参数集包含多个第二候选参考预测参数;根据多个第二候选参考预测参数,确定多个第一候选参考预测参数;基于多个第一候选参考预测参数,确定第一颜色分量与第二颜色分量之间的多个候选映射关系;基于模板匹配方式对多个候选映射关系进行匹配误差计算,以确定多个候选映射关系各自的第二代价值;以及从多个候选映射关系各自的第二代价值中确定最小代价值,将最小代价值对应的候选映射关系确定为目标映射关系;第一预测单元2402,还配置为根据目标映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。
在一些实施例中,第一确定单元2401,还配置为确定当前块的第一模板;以及确定第一模板的同位置的第一颜色分量区域模板的重建像素样值;第一预测单元2402,还配置为根据多个候选映射关系和第一颜色分量区域模板的重建像素样值,确定第一模板在多个映射关系下各自的第二颜色分量的预测值;第一确定单元2401,还配置为根据第一模板的第二颜色分量的重建值与第一模板在多个映射关系下各自的第二颜色分量的预测值进行代价计算,确定多个候选映射关系各自的第二代价值。
在一些实施例中,第一确定单元2401,还配置为确定当前块的预测模式;以及根据当前块的预测模式,确定当前块的预测参数。
在一些实施例中,第一确定单元2401,还配置为确定当前块的多种候选模式;其中,多种候选模式包括第一预测模式和第一预测模式之外的其他预测模式;基于预设代价方式对多种候选模式进行代价计算,确定多种候选模式各自对应的代价结果;以及从多种候选模式各自对应的代价结果中确定最小代价结果,将最小代价结果对应的候选模式确定为当前块的预测模式;其中,预设代价方式至少包括下述其中一项:率失真代价方式和模板匹配方式。
在一些实施例中,第一确定单元2401,还配置为确定当前块的同位置的第一颜色分量区域;以及若当前块使用DM模式且第一颜色分量区域是基于块向量进行预测,则确定当前块使用第一预测模式。
在一些实施例中,第一确定单元2401,还配置为确定第二语法元素的取值;其中,第二语法元素用于指示当前块是否允许使用第一预测模式;编码单元2403,还配置为对第二语法元素的取值进行编码处理,将所得到的编码比特写入码流。
可以理解地,在本申请实施例中,“单元”可以是部分电路、部分处理器、部分程序或软件等等,当然也可以是模块,还可以是非模块化的。而且在本实施例中的各组成部分可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
所述集成的单元如果以软件功能模块的形式实现并非作为独立的产品进行销售或使用时,可以存储在一个计算机可读取存储介质中,基于这样的理解,本实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或processor(处理器)执行本实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
因此,本申请实施例提供了一种计算机可读存储介质,应用于编码器240,该计算机可读存储介质存储有计算机程序,所述计算机程序被第一处理器执行时实现前述实施例中任一项所述的方法。
基于编码器240的组成以及计算机可读存储介质,图25为本申请实施例提供的编码器240的具体硬件结构示意图。如图25所示,编码器240可以包括:第一通信接口2501、第一存储器2502和第一处理器2503;各个组件通过第一总线系统2504耦合在一起。可理解,第一总线系统2504用于实现这些组件之间的连接通信。第一总线系统2504除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图25中将各种总线都标为第一总线系统2504。其中,
第一通信接口2501,用于在与其他外部网元之间进行收发信息过程中,信号的接收和发送;
第一存储器2502,用于存储能够在第一处理器2503上运行的计算机程序;
第一处理器2503,用于在运行所述计算机程序时,执行:
确定当前块的预测参数;以及根据预测参数,确定当前块的第一参考预测参数集;其中,第一参考预测参数集包含一个或多个第一候选参考预测参数;根据第一参考预测参数集,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值;以及根据第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系;根据映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。
可以理解,本申请实施例中的第一存储器2502可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(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)。本申请描述的系统和方法的第一存储器2502旨在包括但不限于这些和任意其它适合类型的存储器。
而第一处理器2503可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过第一处理器2503中的硬件的集成逻辑电路或者软件形式的指令完成。上述的第一处理器2503可以是通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于第一存储器2502,第一处理器2503读取第一存储器2502中的信息,结合其硬件完成上述方法的步骤。
可以理解的是,本申请描述的这些实施例可以用硬件、软件、固件、中间件、微码或其组合来实现。对于硬件实现,处理单元可以实现在一个或多个专用集成电路(Application Specific Integrated Circuits,ASIC)、数字信号处理器(Digital Signal Processing,DSP)、数字信号处理设备(DSP Device,DSPD)、可编程逻辑设备(Programmable Logic Device,PLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、通用处理器、控制器、微控制器、微处理器、用于执行本申请所述功能的其它电子单元或其组合中。对于软件实现,可通过执行本申请所述功能的模块(例如过程、函数等)来实现本申请所述的技术。软件代码可存储在存储器中并通过处理器执行。存储器可以在处理器中或在处理器外部实现。
可选地,作为另一个实施例,第一处理器2503还配置为在运行所述计算机程序时,执行前述实施例中任一项所述的方法。
本实施例提供了一种编码器,在该编码器中,充分利用了当前图像中已重建样本与当前块样本之间的相关性,改善了色度预测的单一性,从而能够提高色度预测的准确性;而且根据所建立的映射关系,还可以有效进行像素级的预测,从而能够进一步节省码率,提高编解码效率,进而提升编解码性能。
在本申请的再一实施例中,基于前述实施例相同的发明构思,图26为本申请实施例提供的一种解码器的组成结构示意图。如图26所示,该解码器260可以包括第二确定单元2601和第二预测单元2602,其中:
第二确定单元2601,配置为确定当前块的预测参数;以及根据预测参数,确定当前块的第一参考预测参数集;其中,第一参考预测参数集包含一个或多个第一候选参考预测参数;
第二确定单元2601,还配置为根据第一参考预测参数集,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值;以及根据第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系;
第二预测单元2602,配置为根据映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。
在一些实施例中,参见图26,解码器260还包括解码单元2603,配置为解码码流,确定第一语法元素的取值;第二确定单元2601,还配置为根据第一语法元素的取值,确定当前块的预测参数。
在一些实施例中,第二确定单元2601,还配置为在预测参数指示当前块使用第一预测模式时,确定当前块的第一参考预测参数集。
在一些实施例中,第二确定单元2601,还配置为确定当前块的第一颜色分量块;根据第一颜色分量块,确定当前块的第二参考预测参数集;其中,第二参考预测参数集包含一个或多个第二候选参考预测参数;以及根据第二参考预测参数集,确定当前块的第一参考预测参数集。
在一些实施例中,第一候选参考预测参数为基于第二颜色分量的向量参数,第二候选参考预测参数为基于第一颜色分量的向量参数。
在一些实施例中,向量参数包括下述其中之一:块向量参数、运动向量参数。
在一些实施例中,第二确定单元2601,还配置为确定当前块的同位置的第一颜色分量区域;以及基于第一颜色分量区域的多个划分块,确定当前块的第一颜色分量块。
在一些实施例中,第二确定单元2601,还配置为从多个划分块中,确定处于第一位置的第一候选块;以及根据处于第一位置的第一候选块,确定当前块的第一颜色分量块。
在一些实施例中,第二确定单元2601,还配置为在第一位置的预设搜索区域进行位置偏移搜索,确定多个第二候选块;以及根据第一候选块和/或多个第二候选块,确定当前块的第一颜色分量块。
在一些实施例中,第二确定单元2601,还配置为根据第一颜色分量块,确定一个或多个基于第一颜色分量的候选向量参数;以及根据一个或多个基于第一颜色分量的候选向量参数,确定当前块的第二参考预测参数集。
在一些实施例中,第二确定单元2601,还配置为对基于第一颜色分量的候选向量参数进行调整,确定基于第二颜色分量的候选向量参数;以及在基于第二颜色分量的候选向量参数满足预设可用条件时,将基于第一颜色分量的候选向量参数作为第二候选参考预测参数并添加至第二参考预测参数集。
在一些实施例中,第二确定单元2601,还配置为确定当前块的预设采样格式;以及根据预设采样格式对基于第一颜色分量的候选向量参数进行缩放,确定基于第二颜色分量的候选向量参数。
在一些实施例中,第二确定单元2601,还配置为对第二参考预测参数集中的一个或多个第二候选参考预测参数进行调整,确定一个或多个第二候选参考预测参数各自对应的第一候选参考预测参数;以及根据一个或多个第二候选参考预测参数各自对应的第一候选参考预测参数,确定当前块的第一参考预测参数集。
在一些实施例中,第二确定单元2601,还配置为对第二候选参考预测参数进行调整,确定基于第二颜色分量的第三参考预测参数集;以及根据第三参考预测参数集,确定第二候选参考预测参数对应的第一候选参考预测参数。
在一些实施例中,第二确定单元2601,还配置为根据当前块的预设采样格式对第二候选参考预测参数进行缩放,确定基于第二颜色分量的候选向量参数,并将基于第二颜色分量的候选向量参数添加至第三参考预测参数集。
在一些实施例中,第二确定单元2601,还配置为根据当前块的预设采样格式对第二候选参考预测参数进行缩放,确定基于第二颜色分量的第一初始向量参数;以及根据一个或多个偏移值对基于第二颜色分量的第一初始向量参数进行偏移计算,确定一个或多个基于第二颜色分量的候选向量参数,并将一个或多个基于第二颜色分量的候选向量参数添加至第三参考预测参数集。
在一些实施例中,第二确定单元2601,还配置为根据一个或多个偏移值对第二候选参考预测参数进行偏移计算,确定一个或多个基于第一颜色分量的第二初始向量参数;以及根据当前块的预设采样格式对一个或多个基于第一颜色分量的第二初始向量参数进行缩放,确定一个或多个基于第二颜色分量的候选向量参数,并将一个或多个基于第二颜色分量的候选向量参数添加至第三参考预测参数集。
在一些实施例中,第二确定单元2601,还配置为在第三参考预测参数集存在满足预设可用条件的一个或多个候选向量参数时,根据一个或多个候选向量参数确定第一候选参考预测参数。
在一些实施例中,一个或多个候选向量参数满足预设可用条件,至少包括:根据一个或多个候选向量参数指示的偏移位置未超出图像边界;根据一个或多个候选向量参数指示的偏移位置未超出片边界;根据一个或多个候选向量参数指示的偏移位置未覆盖当前块;根据一个或多个候选向量参数指示的偏移位置未超出预设可用区域;根据一个或多个候选向量参数指示的偏移位置已经重建。
在一些实施例中,第二确定单元2601,还配置为若第三参考预测参数集存在满足预设可用条件的一个候选向量参数,则将满足预设可用条件的一个候选向量参数确定为第一候选参考预测参数;以及若第三参考预测参数集存在满足预设可用条件的多个候选向量参数,则对满足预设可用条件的多个候选向量参数进行决策,确定第一候选参考预测参数。
在一些实施例中,第二确定单元2601,还配置为确定当前块的第一模板;根据第一模板和多个候选向量参数,确定多个候选向量参数各自的第一匹配模板;在第一模板与第一匹配模板满足预设存在条件时,根据预设的误差准则,计算当前块的第一模板与第一匹配模板之间的匹配误差,以确定多个候选向量参数各自的第一代价值;以及从多个候选向量参数各自的第一代价值中确定最小代价值,将最小代价值对应的候选向量参数确定为第一候选参考预测参数。
在一些实施例中,第二确定单元2601,还配置为在第一模板与第一匹配模板不满足预设存在条件时,将第三参考预测参数集中满足预设可用条件的第一个候选向量参数确定为第一候选参考预测参数;或者,在第一模板与第一匹配模板不满足预设存在条件时,将第三参考预测参数集中满足预设可用条件的第二位置处的候选向量参数确定为第一参考预测参数。
在一些实施例中,第二确定单元2601,还配置为在第三参考预测参数集中的全部候选向量参数均不满足预设可用条件时,确定当前块的第三位置处的第一颜色分量重建样本和第二颜色分量重建样本;以及根据第三位置处的第一颜色分量重建样本和第二颜色分量重建样本,确定当前块的第一颜色分量参 考样值和第二颜色分量参考样值。
在一些实施例中,第二确定单元2601,配置为根据第一参考预测参数集,确定一个或多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本;确定当前块的第三位置处的第一颜色分量重建样本和第二颜色分量重建样本;以及根据一个或多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本以及第三位置处的第一颜色分量重建样本和第二颜色分量重建样本,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值。
在一些实施例中,第二确定单元2601,还配置为确定当前块的位置;对当前块的位置进行缩放,确定当前块的同位置的第一颜色分量区域的位置;以及对第一候选参考预测参数进行缩放,确定当前块的同位置的第一颜色分量区域的缩放后块向量参数;以及根据第一颜色分量区域的位置和缩放后块向量参数,确定第一颜色分量的参考块,并根据第一颜色分量的参考块确定第一候选参考预测参数指示的第一颜色分量重建样本;以及根据当前块的位置和第一候选参考预测参数,确定第二颜色分量的参考块,并根据第二颜色分量的参考块确定第一候选参考预测参数指示的第二颜色分量重建样本。
在一些实施例中,第二确定单元2601,还配置为对第一颜色分量的参考块进行下采样处理,确定第一候选参考预测参数指示的第一颜色分量重建样本,以使第一颜色分量重建样本的分辨率与第二颜色分量重建样本的分辨率相同。
在一些实施例中,第二确定单元2601,还配置为对第二颜色分量的参考块进行上采样处理,确定第一候选参考预测参数指示的第二颜色分量重建样本,以使第一颜色分量重建样本的分辨率与第二颜色分量重建样本的分辨率相同;相应地,对当前块的第二颜色分量的预测值进行下采样处理。
在一些实施例中,第二确定单元2601,还配置为确定当前块的下采样方式;以及根据下采样方式对第一颜色分量的参考块进行下采样处理,确定第一候选参考预测参数指示的第一颜色分量重建样本。
在一些实施例中,解码单元2603,还配置为解码码流,确定滤波标识信息的取值;第二确定单元2601,还配置为根据滤波标识信息的取值,确定当前块的下采样方式。
在一些实施例中,第二确定单元2601,还配置为确定当前块的第一模板;以及根据第一模板,确定第三位置处的第一颜色分量重建样本和第二颜色分量重建样本。
在一些实施例中,第一模板的类型包括下述至少一项:上模板、右上模板、左模板、左下模板和左上模板;其中,上模板位于当前块相邻的上侧已解码区域,右上模板位于当前块相邻的右上侧已解码区域,左模板位于当前块相邻的左侧已解码区域,左下模板位于当前块相邻的左下侧已解码区域,左上模板位于当前块相邻的左上侧已解码区域。
在一些实施例中,第二确定单元2601,还配置为根据第一颜色分量参考样值和第二颜色分量参考样值确定第一查找表,其中,第一查找表用于记录索引关键字为第一颜色分量时所对应的第二颜色分量的取值。
在一些实施例中,第二确定单元2601,还配置为根据第一颜色分量参考样值和第二颜色分量参考样值确定第一离散模型,其中,第一离散模型用于指示第一颜色分量与第二颜色分量之间的映射关系。
在一些实施例中,第二确定单元2601,还配置为对第一颜色分量参考样值进行映射处理,以使第一颜色分量参考样值处于预设样本范围。
在一些实施例中,第二确定单元2601,还配置为在第一颜色分量参考样值中的第一参考样值相同且对应第二颜色分量参考样值中不同的多个第二参考样值时,按照样本顺序依次进行覆盖处理,将最后一个第二参考样值作为与第一参考样值具有映射关系的值。
在一些实施例中,第二确定单元2601,还配置为在第一颜色分量参考样值中的第一参考样值相同且对应第二颜色分量参考样值中不同的多个第二参考样值时,对多个第二参考样值进行平均值计算,将所得到的平均值作为与第一参考样值具有映射关系的值。
在一些实施例中,第二确定单元2601,还配置为确定当前块的同位置的第一颜色分量区域的重建像素样本;基于第一颜色分量区域的重建像素样本,确定当前块的第一颜色分量样值。
在一些实施例中,第二预测单元2602,还配置为若在映射关系中查找到与第一颜色分量样值相等的第一颜色分量值,则将第一颜色分量值对应的第二颜色分量的取值确定为当前块的第二颜色分量的预测值。
在一些实施例中,第二确定单元2601,还配置为若在映射关系中没有查找到与第一颜色分量样值相等的第一颜色分量值,则对第一颜色分量样值进行修正处理,确定第一颜色分量修正值,并继续在映射关系中查找是否存在与第一颜色分量修正值相等的第一颜色分量值。
在一些实施例中,第二确定单元2601,还配置为根据预设的一个或多个偏移值对第一颜色分量样值进行偏移计算,确定第一颜色分量修正值。
在一些实施例中,第二预测单元2602,还配置为若在映射关系中没有查找到与第一颜色分量修正 值相等的第一颜色分量值,则对第二颜色分量参考样值进行平均值计算,将所得到的平均值确定为当前块的第二颜色分量的预测值。
在一些实施例中,第二预测单元2602,还配置为根据映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的第一初始预测值;以及对第一初始预测值进行修正操作,确定当前块的第二颜色分量的预测值。
在一些实施例中,第二预测单元2602,还配置为根据第一预设模式对当前块的第二颜色分量进行预测处理,确定当前块的第二颜色分量的第二初始预测值;其中,第一预设模式至少包括下述其中一项:PLANAR模式、DM模式、DC模式和CCLM模式;以及对第一初始预测值和第二初始预测值进行加权计算,确定当前块的第二颜色分量的预测值。
在一些实施例中,解码单元2603,还配置为解码码流,确定当前块的第二颜色分量的残差值;第二确定单元2601,还配置为根据残差值和预测值,确定当前块的第二颜色分量的重建值。
在一些实施例中,第二确定单元2601,还配置为在第一参考预测参数集包括多个第一候选参考预测参数时,确定多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本;以及根据多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本,确定第一颜色分量与第二颜色分量之间的多个映射关系;第二预测单元2602,还配置为根据多个映射关系,确定当前块的第二颜色分量的多个第三初始预测值;以及对多个第三初始预测值进行加权计算,确定当前块的第二颜色分量的预测值。
在一些实施例中,第二确定单元2601,还配置为在当前块的第一颜色分量块包括多个候选块时,确定当前块的第二参考预测参数集;其中,第二参考预测参数集包含多个第二候选参考预测参数;根据多个第二候选参考预测参数,确定多个第一候选参考预测参数;以及基于多个第一候选参考预测参数,确定第一颜色分量与第二颜色分量之间的多个候选映射关系;解码单元2603,还配置为解码码流,确定映射关系索引值;第二确定单元2601,还配置为根据映射关系索引值和多个候选映射关系,确定目标映射关系;第二预测单元2602,还配置为根据目标映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。
在一些实施例中,第二确定单元2601,还配置为在当前块的第一颜色分量块包括多个候选块时,确定当前块的第二参考预测参数集;其中,第二参考预测参数集包含多个第二候选参考预测参数;根据多个第二候选参考预测参数,确定多个第一候选参考预测参数;基于多个第一候选参考预测参数,确定第一颜色分量与第二颜色分量之间的多个候选映射关系;基于模板匹配方式对多个候选映射关系进行匹配误差计算,以确定多个候选映射关系各自的第二代价值;以及从多个候选映射关系各自的第二代价值中确定最小代价值,将最小代价值对应的候选映射关系确定为目标映射关系;第二预测单元2602,还配置为根据目标映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。
在一些实施例中,第二确定单元2601,还配置为确定当前块的第一模板;以及确定第一模板的同位置的第一颜色分量区域模板的重建像素样值;第二预测单元2602,还配置为根据多个候选映射关系和第一颜色分量区域模板的重建像素样值,确定第一模板在多个映射关系下各自的第二颜色分量的预测值;第二确定单元2601,还配置为根据第一模板的第二颜色分量的重建值与第一模板在多个映射关系下各自的第二颜色分量的预测值进行代价计算,确定多个候选映射关系各自的第二代价值。
在一些实施例中,第二确定单元2601,还配置为确定当前块的同位置的第一颜色分量区域;以及若当前块使用DM模式且第一颜色分量区域是基于块向量进行预测,则确定当前块使用第一预测模式。
在一些实施例中,第二确定单元2601,还配置为确定第二语法元素的取值;以及在第二语法元素指示当前块允许使用第一预测模式时,执行确定当前块的预测参数的步骤。
可以理解地,在本实施例中,“单元”可以是部分电路、部分处理器、部分程序或软件等等,当然也可以是模块,还可以是非模块化的。而且在本实施例中的各组成部分可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
所述集成的单元如果以软件功能模块的形式实现并非作为独立的产品进行销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本实施例提供了一种计算机可读存储介质,应用于解码器260,该计算机可读存储介质存储有计算机程序,所述计算机程序被第二处理器执行时实现前述实施例中任一项所述的方法。
基于解码器260的组成以及计算机可读存储介质,图27为本申请实施例提供的解码器260的具体硬件结构示意图。如图27所示,解码器260可以包括:第二通信接口2701、第二存储器2702和第二处理器2703;各个组件通过第二总线系统2704耦合在一起。可理解,第二总线系统2704用于实现这些组件之间的连接通信。第二总线系统2704除包括数据总线之外,还包括电源总线、控制总线和状态 信号总线。但是为了清楚说明起见,在图27中将各种总线都标为第二总线系统2704。其中,
第二通信接口2701,用于在与其他外部网元之间进行收发信息过程中,信号的接收和发送;
第二存储器2702,用于存储能够在第二处理器2703上运行的计算机程序;
第二处理器2703,用于在运行所述计算机程序时,执行:
确定当前块的预测参数;以及根据预测参数,确定当前块的第一参考预测参数集;其中,第一参考预测参数集包含一个或多个第一候选参考预测参数;根据第一参考预测参数集,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值;以及根据第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系;根据映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。
可选地,作为另一个实施例,第二处理器2703还配置为在运行所述计算机程序时,执行前述实施例中任一项所述的方法。
可以理解,第二存储器2702与第一存储器2502的硬件功能类似,第二处理器2703与第一处理器2503的硬件功能类似;这里不再详述。
本实施例提供了一种解码器,在该解码器中,充分利用了当前图像中已重建样本与当前块样本之间的相关性,改善了色度预测的单一性,从而能够提高色度预测的准确性;而且根据所建立的映射关系,还可以有效进行像素级的预测,从而能够进一步节省码率,提高编解码效率,进而提升编解码性能。
在本申请的再一实施例中,图28为本申请实施例提供的一种编解码系统的组成结构示意图。如图28所示,编解码系统280可以包括编码器2801和解码器2802。
在本申请实施例中,编码器2801可以为前述实施例中任一项所述的编码器,解码器2802可以为前述实施例中任一项所述的解码器。
需要说明的是,在本申请中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
本申请所提供的几个方法实施例中所揭露的方法,在不冲突的情况下可以任意组合,得到新的方法实施例。
本申请所提供的几个产品实施例中所揭露的特征,在不冲突的情况下可以任意组合,得到新的产品实施例。
本申请所提供的几个方法或设备实施例中所揭露的特征,在不冲突的情况下可以任意组合,得到新的方法实施例或设备实施例。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。
工业实用性
本申请实施例中,无论是编码端还是解码端,确定当前块的预测参数;根据预测参数,确定当前块的第一参考预测参数集;其中,第一参考预测参数集包含一个或多个第一候选参考预测参数;根据第一参考预测参数集,确定当前块的第一颜色分量参考样值和第二颜色分量参考样值;根据第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系;根据映射关系以及当前块的第一颜色分量样值,确定当前块的第二颜色分量的预测值。这样,如果当前块使用BVG-LUT模式,那么可以确定应用色度分量的第一参考预测参数集,并根据第一参考预测参数集,确定当前块的亮度分量参考样值和色度分量参考样值,以此建立亮度分量与色度分量之间的映射关系,然后利用该映射关系进行色度分量的预测。也就是说,这里充分利用了当前图像中已重建样本与当前块样本之间的相关性,改善了色度预测的单一性,从而能够提高色度预测的准确性;而且根据所建立的映射关系,还可以有效进行像素级的预测,从而能够进一步节省码率,提高编解码效率,进而提升编解码性能。

Claims (115)

  1. 一种解码方法,应用于解码器,所述方法包括:
    确定当前块的预测参数;
    根据所述预测参数,确定所述当前块的第一参考预测参数集;其中,所述第一参考预测参数集包含一个或多个第一候选参考预测参数;
    根据所述第一参考预测参数集,确定所述当前块的第一颜色分量参考样值和第二颜色分量参考样值;
    根据所述第一颜色分量参考样值和所述第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系;
    根据所述映射关系以及所述当前块的第一颜色分量样值,确定所述当前块的第二颜色分量的预测值。
  2. 根据权利要求1所述的方法,其中,所述确定当前块的预测参数,包括:
    解码码流,确定第一语法元素的取值;
    根据所述第一语法元素的取值,确定所述当前块的预测参数。
  3. 根据权利要求1所述的方法,其中,所述根据所述预测参数,确定所述当前块的第一参考预测参数集,包括:
    在所述预测参数指示所述当前块使用第一预测模式时,确定所述当前块的第一参考预测参数集。
  4. 根据权利要求1所述的方法,其中,所述确定所述当前块的第一参考预测参数集,包括:
    确定所述当前块的第一颜色分量块;
    根据所述第一颜色分量块,确定所述当前块的第二参考预测参数集;其中,所述第二参考预测参数集包含一个或多个第二候选参考预测参数;
    根据所述第二参考预测参数集,确定所述当前块的第一参考预测参数集。
  5. 根据权利要求4所述的方法,其中,所述第一候选参考预测参数为基于第二颜色分量的向量参数,所述第二候选参考预测参数为基于第一颜色分量的向量参数。
  6. 根据权利要求5所述的方法,其中,所述向量参数包括下述其中之一:块向量参数、运动向量参数。
  7. 根据权利要求4所述的方法,其中,所述确定所述当前块的第一颜色分量块,包括:
    确定所述当前块的同位置的第一颜色分量区域;
    基于所述第一颜色分量区域的多个划分块,确定所述当前块的第一颜色分量块。
  8. 根据权利要求7所述的方法,其中,所述基于所述第一颜色分量区域的多个划分块,确定所述当前块的第一颜色分量块,包括:
    从所述多个划分块中,确定处于第一位置的第一候选块;
    根据所述处于第一位置的第一候选块,确定所述当前块的第一颜色分量块。
  9. 根据权利要求8所述的方法,其中,所述根据所述处于第一位置的第一候选块,确定所述当前块的第一颜色分量块,包括:
    在所述第一位置的预设搜索区域进行位置偏移搜索,确定多个第二候选块;
    根据所述第一候选块和/或所述多个第二候选块,确定所述当前块的第一颜色分量块。
  10. 根据权利要求4所述的方法,其中,所述根据所述第一颜色分量块,确定所述当前块的第二参考预测参数集,包括:
    根据所述第一颜色分量块,确定一个或多个基于第一颜色分量的候选向量参数;
    根据所述一个或多个基于第一颜色分量的候选向量参数,确定所述当前块的第二参考预测参数集。
  11. 根据权利要求10所述的方法,其中,所述根据所述一个或多个基于第一颜色分量的候选向量参数,确定所述当前块的第二参考预测参数集,包括:
    对所述基于第一颜色分量的候选向量参数进行调整,确定基于第二颜色分量的候选向量参数;
    在所述基于第二颜色分量的候选向量参数满足预设可用条件时,将所述基于第一颜色分量的候选向量参数作为所述第二候选参考预测参数并添加至所述第二参考预测参数集。
  12. 根据权利要求11所述的方法,其中,所述对所述基于第一颜色分量的候选向量参数进行调整,确定基于第二颜色分量的候选向量参数,包括:
    确定所述当前块的预设采样格式;
    根据所述预设采样格式对所述基于第一颜色分量的候选向量参数进行缩放,确定所述基于第二颜色分量的候选向量参数。
  13. 根据权利要求4所述的方法,其中,所述根据所述第二参考预测参数集,确定所述当前块的第 一参考预测参数集,包括:
    对所述第二参考预测参数集中的一个或多个第二候选参考预测参数进行调整,确定所述一个或多个第二候选参考预测参数各自对应的第一候选参考预测参数;
    根据所述一个或多个第二候选参考预测参数各自对应的第一候选参考预测参数,确定所述当前块的第一参考预测参数集。
  14. 根据权利要求13所述的方法,其中,所述对所述第二参考预测参数集中的一个或多个第二候选参考预测参数进行调整,确定所述一个或多个第二候选参考预测参数各自对应的第一候选参考预测参数,包括:
    对所述第二候选参考预测参数进行调整,确定基于第二颜色分量的第三参考预测参数集;
    根据所述第三参考预测参数集,确定所述第二候选参考预测参数对应的第一候选参考预测参数。
  15. 根据权利要求14所述的方法,其中,所述对所述第二候选参考预测参数进行调整,确定基于第二颜色分量的第三参考预测参数集,包括:
    根据所述当前块的预设采样格式对所述第二候选参考预测参数进行缩放,确定基于第二颜色分量的候选向量参数,并将所述基于第二颜色分量的候选向量参数添加至所述第三参考预测参数集。
  16. 根据权利要求14所述的方法,其中,所述对所述第二候选参考预测参数进行调整,确定基于第二颜色分量的第三参考预测参数集,包括:
    根据所述当前块的预设采样格式对所述第二候选参考预测参数进行缩放,确定基于第二颜色分量的第一初始向量参数;
    根据一个或多个偏移值对所述基于第二颜色分量的第一初始向量参数进行偏移计算,确定一个或多个基于第二颜色分量的候选向量参数,并将所述一个或多个基于第二颜色分量的候选向量参数添加至所述第三参考预测参数集。
  17. 根据权利要求14所述的方法,其中,所述对所述第二候选参考预测参数进行调整,确定第二颜色分量的第三参考预测参数集,包括:
    根据一个或多个偏移值对所述第二候选参考预测参数进行偏移计算,确定一个或多个基于第一颜色分量的第二初始向量参数;
    根据所述当前块的预设采样格式对所述一个或多个基于第一颜色分量的第二初始向量参数进行缩放,确定一个或多个基于第二颜色分量的候选向量参数,并将所述一个或多个基于第二颜色分量的候选向量参数添加至所述第三参考预测参数集。
  18. 根据权利要求14所述的方法,其中,所述根据所述第三参考预测参数集,确定所述第二候选参考预测参数对应的第一候选参考预测参数,包括:
    在所述第三参考预测参数集存在满足预设可用条件的一个或多个候选向量参数时,根据所述一个或多个候选向量参数确定所述第一候选参考预测参数。
  19. 根据权利要求18所述的方法,其中,所述一个或多个候选向量参数满足预设可用条件,至少包括:
    根据所述一个或多个候选向量参数指示的偏移位置未超出图像边界;
    根据所述一个或多个候选向量参数指示的偏移位置未超出片边界;
    根据所述一个或多个候选向量参数指示的偏移位置未覆盖所述当前块;
    根据所述一个或多个候选向量参数指示的偏移位置未超出预设可用区域;
    根据所述一个或多个候选向量参数指示的偏移位置已经重建。
  20. 根据权利要求18所述的方法,其中,所述根据所述一个或多个候选向量参数确定所述第一候选参考预测参数,包括:
    若所述第三参考预测参数集存在满足预设可用条件的一个候选向量参数,则将所述满足预设可用条件的一个候选向量参数确定为所述第一候选参考预测参数;
    若所述第三参考预测参数集存在满足预设可用条件的多个候选向量参数,则对所述满足预设可用条件的多个候选向量参数进行决策,确定所述第一候选参考预测参数。
  21. 根据权利要求20所述的方法,其中,所述对所述满足预设可用条件的多个候选向量参数进行决策,确定所述第一候选参考预测参数,包括:
    确定所述当前块的第一模板;
    根据所述第一模板和所述多个候选向量参数,确定所述多个候选向量参数各自的第一匹配模板;
    在所述第一模板与所述第一匹配模板满足预设存在条件时,根据预设的误差准则,计算所述当前块的第一模板与所述第一匹配模板之间的匹配误差,以确定所述多个候选向量参数各自的第一代价值;
    从所述多个候选向量参数各自的第一代价值中确定最小代价值,将所述最小代价值对应的候选向量 参数确定为所述第一候选参考预测参数。
  22. 根据权利要求21所述的方法,其中,所述方法还包括:
    在所述第一模板与所述第一匹配模板不满足预设存在条件时,将所述第三参考预测参数集中满足预设可用条件的第一个候选向量参数确定为所述第一候选参考预测参数;或者,
    在所述第一模板与所述第一匹配模板不满足预设存在条件时,将所述第三参考预测参数集中满足预设可用条件的第二位置处的候选向量参数确定为所述第一参考预测参数。
  23. 根据权利要求14所述的方法,其中,所述方法还包括:
    在所述第三参考预测参数集中的全部候选向量参数均不满足预设可用条件时,确定所述当前块的第三位置处的第一颜色分量重建样本和第二颜色分量重建样本;
    根据所述第三位置处的第一颜色分量重建样本和第二颜色分量重建样本,确定所述当前块的第一颜色分量参考样值和第二颜色分量参考样值。
  24. 根据权利要求1所述的方法,其中,所述根据所述第一参考预测参数集,确定所述当前块的第一颜色分量参考样值和第二颜色分量参考样值,包括:
    根据所述第一参考预测参数集,确定所述一个或多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本;
    确定所述当前块的第三位置处的第一颜色分量重建样本和第二颜色分量重建样本;
    根据所述一个或多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本以及所述第三位置处的第一颜色分量重建样本和第二颜色分量重建样本,确定所述当前块的第一颜色分量参考样值和第二颜色分量参考样值。
  25. 根据权利要求24所述的方法,其中,所述根据所述第一参考预测参数集,确定所述一个或多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本,包括:
    确定所述当前块的位置;
    对所述当前块的位置进行缩放,确定所述当前块的同位置的第一颜色分量区域的位置;以及对所述第一候选参考预测参数进行缩放,确定所述当前块的同位置的第一颜色分量区域的缩放后参考预测参数;
    根据所述第一颜色分量区域的位置和所述缩放后参考预测参数,确定第一颜色分量的参考块,并根据所述第一颜色分量的参考块确定所述第一候选参考预测参数指示的第一颜色分量重建样本;
    根据所述当前块的位置和所述第一候选参考预测参数,确定第二颜色分量的参考块,并根据所述第二颜色分量的参考块确定所述第一候选参考预测参数指示的第二颜色分量重建样本。
  26. 根据权利要求25所述的方法,其中,所述根据所述第一颜色分量的参考块确定所述第一候选参考预测参数指示的第一颜色分量重建样本,包括:
    对所述第一颜色分量的参考块进行下采样处理,确定所述第一候选参考预测参数指示的第一颜色分量重建样本,以使所述第一颜色分量重建样本的分辨率与所述第二颜色分量重建样本的分辨率相同。
  27. 根据权利要求25所述的方法,其中,所述根据所述第二颜色分量的参考块确定所述第一候选参考预测参数指示的第二颜色分量重建样本,包括:
    对所述第二颜色分量的参考块进行上采样处理,确定所述第一候选参考预测参数指示的第二颜色分量重建样本,以使所述第一颜色分量重建样本的分辨率与所述第二颜色分量重建样本的分辨率相同;
    相应地,所述方法还包括:对所述当前块的第二颜色分量的预测值进行下采样处理。
  28. 根据权利要求26所述的方法,其中,所述对所述第一颜色分量的参考块进行下采样处理,确定所述第一候选参考预测参数指示的第一颜色分量重建样本,包括:
    确定所述当前块的下采样方式;
    根据所述下采样方式对所述第一颜色分量的参考块进行下采样处理,确定所述第一候选参考预测参数指示的第一颜色分量重建样本。
  29. 根据权利要求28所述的方法,其中,所述确定所述当前块的下采样方式,包括:
    解码码流,确定滤波标识信息的取值;
    根据所述滤波标识信息的取值,确定所述当前块的下采样方式。
  30. 根据权利要求24所述的方法,其中,所述确定所述当前块的第三位置处的第一颜色分量重建样本和第二颜色分量重建样本,包括:
    确定所述当前块的第一模板;
    根据所述第一模板,确定所述第三位置处的第一颜色分量重建样本和第二颜色分量重建样本。
  31. 根据权利要求21或30所述的方法,其中,所述第一模板的类型包括下述至少一项:上模板、右上模板、左模板、左下模板和左上模板;
    其中,所述上模板位于所述当前块相邻的上侧已解码区域,所述右上模板位于所述当前块相邻的右 上侧已解码区域,所述左模板位于所述当前块相邻的左侧已解码区域,所述左下模板位于所述当前块相邻的左下侧已解码区域,所述左上模板位于所述当前块相邻的左上侧已解码区域。
  32. 根据权利要求1至31中任一项所述的方法,其中,所述根据所述第一颜色分量参考样值和所述第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系,包括:
    根据所述第一颜色分量参考样值和所述第二颜色分量参考样值确定第一查找表,其中,所述第一查找表用于记录索引关键字为第一颜色分量时所对应的第二颜色分量的取值。
  33. 根据权利要求1至31中任一项所述的方法,其中,所述根据所述第一颜色分量参考样值和所述第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系,包括:
    根据所述第一颜色分量参考样值和所述第二颜色分量参考样值确定第一离散模型,其中,所述第一离散模型用于指示第一颜色分量与第二颜色分量之间的映射关系。
  34. 根据权利要求32或33所述的方法,其中,所述方法还包括:
    对所述第一颜色分量参考样值进行映射处理,以使所述第一颜色分量参考样值处于预设样本范围。
  35. 根据权利要求32或33所述的方法,其中,所述方法还包括:
    在所述第一颜色分量参考样值中的第一参考样值相同且对应所述第二颜色分量参考样值中不同的多个第二参考样值时,按照样本顺序依次进行覆盖处理,将最后一个第二参考样值作为与所述第一参考样值具有映射关系的值。
  36. 根据权利要求32或33所述的方法,其中,所述方法还包括:
    在所述第一颜色分量参考样值中的第一参考样值相同且对应所述第二颜色分量参考样值中不同的多个第二参考样值时,对所述多个第二参考样值进行平均值计算,将所得到的平均值作为与所述第一参考样值具有映射关系的值。
  37. 根据权利要求1所述的方法,其中,所述方法还包括:
    确定所述当前块的同位置的第一颜色分量区域的重建像素样本;
    基于所述第一颜色分量区域的重建像素样本,确定所述当前块的第一颜色分量样值。
  38. 根据权利要求1所述的方法,其中,所述根据所述映射关系以及所述当前块的第一颜色分量样值,确定所述当前块的第二颜色分量的预测值,包括:
    若在所述映射关系中查找到与所述第一颜色分量样值相等的第一颜色分量值,则将所述第一颜色分量值对应的第二颜色分量的取值确定为所述当前块的第二颜色分量的预测值。
  39. 根据权利要求38所述的方法,其中,所述方法还包括:
    若在所述映射关系中没有查找到与所述第一颜色分量样值相等的第一颜色分量值,则对所述第一颜色分量样值进行修正处理,确定第一颜色分量修正值,并继续在所述映射关系中查找是否存在与所述第一颜色分量修正值相等的第一颜色分量值。
  40. 根据权利要求39所述的方法,其中,所述对所述第一颜色分量重建值进行修正处理,确定第一颜色分量修正值,包括:
    根据预设的一个或多个偏移值对所述第一颜色分量样值进行偏移计算,确定所述第一颜色分量修正值。
  41. 根据权利要求39所述的方法,其中,所述方法还包括:
    若在所述映射关系中没有查找到与所述第一颜色分量修正值相等的第一颜色分量值,则对所述第二颜色分量参考样值进行平均值计算,将所得到的平均值确定为所述当前块的第二颜色分量的预测值。
  42. 根据权利要求1所述的方法,其中,所述根据所述映射关系以及所述当前块的第一颜色分量样值,确定所述当前块的第二颜色分量的预测值,包括:
    根据所述映射关系以及所述当前块的第一颜色分量样值,确定所述当前块的第二颜色分量的第一初始预测值;
    对所述第一初始预测值进行修正操作,确定所述当前块的第二颜色分量的预测值。
  43. 根据权利要求42所述的方法,其中,所述对所述第一初始预测值进行修正操作,确定所述当前块的第二颜色分量的预测值,包括:
    根据第一预设模式对所述当前块的第二颜色分量进行预测处理,确定所述当前块的第二颜色分量的第二初始预测值;其中,所述第一预设模式至少包括下述其中一项:PLANAR模式、DM模式、DC模式和CCLM模式;
    对所述第一初始预测值和所述第二初始预测值进行加权计算,确定所述当前块的第二颜色分量的预测值。
  44. 根据权利要求1所述的方法,其中,所述方法还包括:
    解码码流,确定所述当前块的第二颜色分量的残差值;
    根据所述残差值和所述预测值,确定所述当前块的第二颜色分量的重建值。
  45. 根据权利要求1所述的方法,其中,所述方法还包括:
    在所述第一参考预测参数集包括多个第一候选参考预测参数时,确定所述多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本;
    根据所述多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本,确定第一颜色分量与第二颜色分量之间的多个映射关系;
    根据所述多个映射关系,确定所述当前块的第二颜色分量的多个第三初始预测值;
    对所述多个第三初始预测值进行加权计算,确定所述当前块的第二颜色分量的预测值。
  46. 根据权利要求1所述的方法,其中,所述方法还包括:
    在所述当前块的第一颜色分量块包括多个候选块时,确定所述当前块的第二参考预测参数集;其中,所述第二参考预测参数集包含多个第二候选参考预测参数;
    根据所述多个第二候选参考预测参数,确定多个第一候选参考预测参数;
    基于所述多个第一候选参考预测参数,确定第一颜色分量与第二颜色分量之间的多个候选映射关系;
    解码码流,确定映射关系索引值;
    根据所述映射关系索引值和所述多个候选映射关系,确定目标映射关系;
    根据所述目标映射关系以及所述当前块的第一颜色分量样值,确定所述当前块的第二颜色分量的预测值。
  47. 根据权利要求1所述的方法,其中,所述方法还包括:
    在所述当前块的第一颜色分量块包括多个候选块时,确定所述当前块的第二参考预测参数集;其中,所述第二参考预测参数集包含多个第二候选参考预测参数;
    根据所述多个第二候选参考预测参数,确定多个第一候选参考预测参数;
    基于所述多个第一候选参考预测参数,确定第一颜色分量与第二颜色分量之间的多个候选映射关系;
    基于模板匹配方式对所述多个候选映射关系进行匹配误差计算,以确定所述多个候选映射关系各自的第二代价值;
    从所述多个候选映射关系各自的第二代价值中确定最小代价值,将所述最小代价值对应的候选映射关系确定为目标映射关系;
    根据所述目标映射关系以及所述当前块的第一颜色分量样值,确定所述当前块的第二颜色分量的预测值。
  48. 根据权利要求47所述的方法,其中,所述基于模板匹配方式对所述多个候选映射关系进行匹配误差计算,以确定所述多个候选映射关系各自的第二代价值,包括:
    确定所述当前块的第一模板;
    确定所述第一模板的同位置的第一颜色分量区域模板的重建像素样值;
    根据所述多个候选映射关系和所述第一颜色分量区域模板的重建像素样值,确定所述第一模板在所述多个映射关系下各自的第二颜色分量的预测值;
    根据所述第一模板的第二颜色分量的重建值与所述第一模板在所述多个映射关系下各自的第二颜色分量的预测值进行代价计算,确定所述多个候选映射关系各自的第二代价值。
  49. 根据权利要求1所述的方法,其中,所述方法还包括:
    确定所述当前块的同位置的第一颜色分量区域;
    若所述当前块使用DM模式且所述第一颜色分量区域是基于块向量进行预测,则确定所述当前块使用第一预测模式。
  50. 根据权利要求1至49中任一项所述的方法,其中,所述方法还包括:
    确定第二语法元素的取值;
    在所述第二语法元素指示所述当前块允许使用第一预测模式时,执行确定当前块的预测参数的步骤。
  51. 一种编码方法,应用于编码器,所述方法包括:
    确定当前块的预测参数;
    根据所述预测参数,确定所述当前块的第一参考预测参数集;其中,所述第一参考预测参数集包含一个或多个第一候选参考预测参数;
    根据所述第一参考预测参数集,确定所述当前块的第一颜色分量参考样值和第二颜色分量参考样值;
    根据所述第一颜色分量参考样值和所述第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系;
    根据所述映射关系以及所述当前块的第一颜色分量样值,确定所述当前块的第二颜色分量的预测值。
  52. 根据权利要求51所述的方法,其中,所述根据所述预测参数,确定所述当前块的第一参考预 测参数集,包括:
    在所述预测参数指示所述当前块使用第一预测模式时,确定所述当前块的第一参考预测参数集。
  53. 根据权利要求52所述的方法,其中,所述确定当前块的预测参数,包括:
    确定所述当前块使用第一预测模式的第一代价值,以及确定所述当前块不使用第一预测模式的第二代价值;
    根据所述第一代价值和所述第二代价值,确定所述预测参数。
  54. 根据权利要求53所述的方法,其中,所述根据所述第一代价值和所述第二代价值,确定所述预测参数,包括:
    若所述第一代价值小于所述第二代价值,则确定所述预测参数指示所述当前块使用第一预测模式;
    若所述第一代价值大于所述第二代价值,则确定所述预测参数指示所述当前块不使用第一预测模式。
  55. 根据权利要求54所述的方法,其中,所述方法还包括:
    根据所述预测参数,确定第一语法元素的取值;
    对所述第一语法元素的取值进行编码处理,将所得到的编码比特写入码流。
  56. 根据权利要求55所述的方法,其中,所述根据所述预测参数,确定第一语法元素的取值,包括:
    若所述预测参数指示所述当前块使用第一预测模式,则确定所述第一语法元素的取值为第一值;
    若所述预测参数指示所述当前块不使用第一预测模式,则确定所述第一语法元素的取值为第二值。
  57. 根据权利要求51所述的方法,其中,所述确定所述当前块的第一参考预测参数集,包括:
    确定所述当前块的第一颜色分量块;
    根据所述第一颜色分量块,确定所述当前块的第二参考预测参数集;其中,所述第二参考预测参数集包含一个或多个第二候选参考预测参数;
    根据所述第二参考预测参数集,确定所述当前块的第一参考预测参数集。
  58. 根据权利要求57所述的方法,其中,所述第一候选参考预测参数为基于第二颜色分量的向量参数,所述第二候选参考预测参数为基于第一颜色分量的向量参数。
  59. 根据权利要求58所述的方法,其中,所述向量参数包括下述其中之一:块向量参数、运动向量参数。
  60. 根据权利要求57所述的方法,其中,所述确定所述当前块的第一颜色分量块,包括:
    确定所述当前块的同位置的第一颜色分量区域;
    基于所述第一颜色分量区域的多个划分块,确定所述当前块的第一颜色分量块。
  61. 根据权利要求60所述的方法,其中,所述基于所述第一颜色分量区域的多个划分块,确定所述当前块的第一颜色分量块,包括:
    从所述多个划分块中,确定处于第一位置的第一候选块;
    根据所述处于第一位置的第一候选块,确定所述当前块的第一颜色分量块。
  62. 根据权利要求61所述的方法,其中,所述根据所述处于第一位置的第一候选块,确定所述当前块的第一颜色分量块,包括:
    在所述第一位置的预设搜索区域进行位置偏移搜索,确定多个第二候选块;
    根据所述第一候选块和/或所述多个第二候选块,确定所述当前块的第一颜色分量块。
  63. 根据权利要求57所述的方法,其中,所述根据所述第一颜色分量块,确定所述当前块的第二参考预测参数集,包括:
    根据所述第一颜色分量块,确定一个或多个基于第一颜色分量的候选向量参数;
    根据所述一个或多个基于第一颜色分量的候选向量参数,确定所述当前块的第二参考预测参数集。
  64. 根据权利要求63所述的方法,其中,所述根据所述一个或多个基于第一颜色分量的候选向量参数,确定所述当前块的第二参考预测参数集,包括:
    对所述基于第一颜色分量的候选向量参数进行调整,确定基于第二颜色分量的候选向量参数;
    在所述基于第二颜色分量的候选向量参数满足预设可用条件时,将所述基于第一颜色分量的候选向量参数作为所述第二候选参考预测参数并添加至所述第二参考预测参数集。
  65. 根据权利要求64所述的方法,其中,所述对所述基于第一颜色分量的候选向量参数进行调整,确定基于第二颜色分量的候选向量参数,包括:
    确定所述当前块的预设采样格式;
    根据所述预设采样格式对所述基于第一颜色分量的候选向量参数进行缩放,确定所述基于第二颜色分量的候选向量参数。
  66. 根据权利要求57所述的方法,其中,所述根据所述第二参考预测参数集,确定所述当前块的 第一参考预测参数集,包括:
    对所述第二参考预测参数集中的一个或多个第二候选参考预测参数进行调整,确定所述一个或多个第二候选参考预测参数各自对应的第一候选参考预测参数;
    根据所述一个或多个第二候选参考预测参数各自对应的第一候选参考预测参数,确定所述当前块的第一参考预测参数集。
  67. 根据权利要求66所述的方法,其中,所述对所述第二参考预测参数集中的一个或多个第二候选参考预测参数进行调整,确定所述一个或多个第二候选参考预测参数各自对应的第一候选参考预测参数,包括:
    对所述第二候选参考预测参数进行调整,确定基于第二颜色分量的第三参考预测参数集;
    根据所述第三参考预测参数集,确定所述第二候选参考预测参数对应的第一候选参考预测参数。
  68. 根据权利要求67所述的方法,其中,所述对所述第二候选参考预测参数进行调整,确定基于第二颜色分量的第三参考预测参数集,包括:
    根据所述当前块的预设采样格式对所述第二候选参考预测参数进行缩放,确定基于第二颜色分量的候选向量参数,并将所述基于第二颜色分量的候选向量参数添加至所述第三参考预测参数集。
  69. 根据权利要求67所述的方法,其中,所述对所述第二候选参考预测参数进行调整,确定基于第二颜色分量的第三参考预测参数集,包括:
    根据所述当前块的预设采样格式对所述第二候选参考预测参数进行缩放,确定基于第二颜色分量的第一初始向量参数;
    根据一个或多个偏移值对所述基于第二颜色分量的第一初始向量参数进行偏移计算,确定一个或多个基于第二颜色分量的候选向量参数,并将所述一个或多个基于第二颜色分量的候选向量参数添加至所述第三参考预测参数集。
  70. 根据权利要求67所述的方法,其中,所述对所述第二候选参考预测参数进行调整,确定第二颜色分量的第三参考预测参数集,包括:
    根据一个或多个偏移值对所述第二候选参考预测参数进行偏移计算,确定一个或多个基于第一颜色分量的第二初始向量参数;
    根据所述当前块的预设采样格式对所述一个或多个基于第一颜色分量的第二初始向量参数进行缩放,确定一个或多个基于第二颜色分量的候选向量参数,并将所述一个或多个基于第二颜色分量的候选向量参数添加至所述第三参考预测参数集。
  71. 根据权利要求67所述的方法,其中,所述根据所述第三参考预测参数集,确定所述第二候选参考预测参数对应的第一候选参考预测参数,包括:
    在所述第三参考预测参数集存在满足预设可用条件的一个或多个候选向量参数时,根据所述一个或多个候选向量参数确定所述第一候选参考预测参数。
  72. 根据权利要求71所述的方法,其中,所述一个或多个候选向量参数满足预设可用条件,至少包括:
    根据所述一个或多个候选向量参数指示的偏移位置未超出图像边界;
    根据所述一个或多个候选向量参数指示的偏移位置未超出片边界;
    根据所述一个或多个候选向量参数指示的偏移位置未覆盖所述当前块;
    根据所述一个或多个候选向量参数指示的偏移位置未超出预设可用区域;
    根据所述一个或多个候选向量参数指示的偏移位置已经重建。
  73. 根据权利要求71所述的方法,其中,所述根据所述一个或多个候选向量参数确定所述第一候选参考预测参数,包括:
    若所述第三参考预测参数集存在满足预设可用条件的一个候选向量参数,则将所述满足预设可用条件的一个候选向量参数确定为所述第一候选参考预测参数;
    若所述第三参考预测参数集存在满足预设可用条件的多个候选向量参数,则对所述满足预设可用条件的多个候选向量参数进行决策,确定所述第一候选参考预测参数。
  74. 根据权利要求73所述的方法,其中,所述对所述满足预设可用条件的多个候选向量参数进行决策,确定所述第一候选参考预测参数,包括:
    确定所述当前块的第一模板;
    根据所述第一模板和所述多个候选向量参数,确定所述多个候选向量参数各自的第一匹配模板;
    在所述第一模板与所述第一匹配模板满足预设存在条件时,根据预设的误差准则,计算所述当前块的第一模板与所述第一匹配模板之间的匹配误差,以确定所述多个候选向量参数各自的第一代价值;
    从所述多个候选向量参数各自的第一代价值中确定最小代价值,将所述最小代价值对应的候选向量 参数确定为所述第一候选参考预测参数。
  75. 根据权利要求74所述的方法,其中,所述方法还包括:
    在所述第一模板与所述第一匹配模板不满足预设存在条件时,将所述第三参考预测参数集中满足预设可用条件的第一个候选向量参数确定为所述第一候选参考预测参数;或者,
    在所述第一模板与所述第一匹配模板不满足预设存在条件时,将所述第三参考预测参数集中满足预设可用条件的第二位置处的候选向量参数确定为所述第一参考预测参数。
  76. 根据权利要求67所述的方法,其中,所述方法还包括:
    在所述第三参考预测参数集中的全部候选向量参数均不满足预设可用条件时,确定所述当前块的第三位置处的第一颜色分量重建样本和第二颜色分量重建样本;
    根据所述第三位置处的第一颜色分量重建样本和第二颜色分量重建样本,确定所述当前块的第一颜色分量参考样值和第二颜色分量参考样值。
  77. 根据权利要求51所述的方法,其中,所述根据所述第一参考预测参数集,确定所述当前块的第一颜色分量参考样值和第二颜色分量参考样值,包括:
    根据所述第一参考预测参数集,确定所述一个或多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本;
    确定所述当前块的第三位置处的第一颜色分量重建样本和第二颜色分量重建样本;
    根据所述一个或多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本以及所述第三位置处的第一颜色分量重建样本和第二颜色分量重建样本,确定所述当前块的第一颜色分量参考样值和第二颜色分量参考样值。
  78. 根据权利要求77所述的方法,其中,所述根据所述第一参考预测参数集,确定所述一个或多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本,包括:
    确定所述当前块的位置;
    对所述当前块的位置进行缩放,确定所述当前块的同位置的第一颜色分量区域的位置;以及对所述第一候选参考预测参数进行缩放,确定所述当前块的同位置的第一颜色分量区域的缩放后参考预测参数;
    根据所述第一颜色分量区域的位置和所述缩放后参考预测参数,确定第一颜色分量的参考块,并根据所述第一颜色分量的参考块确定所述第一候选参考预测参数指示的第一颜色分量重建样本;
    根据所述当前块的位置和所述第一候选参考预测参数,确定第二颜色分量的参考块,并根据所述第二颜色分量的参考块确定所述第一候选参考预测参数指示的第二颜色分量重建样本。
  79. 根据权利要求78所述的方法,其中,所述根据所述第一颜色分量的参考块确定所述第一候选参考预测参数指示的第一颜色分量重建样本,包括:
    对所述第一颜色分量的参考块进行下采样处理,确定所述第一候选参考预测参数指示的第一颜色分量重建样本,以使所述第一颜色分量重建样本的分辨率与所述第二颜色分量重建样本的分辨率相同。
  80. 根据权利要求78所述的方法,其中,所述根据所述第二颜色分量的参考块确定所述第一候选参考预测参数指示的第二颜色分量重建样本,包括:
    对所述第二颜色分量的参考块进行上采样处理,确定所述第一候选参考预测参数指示的第二颜色分量重建样本,以使所述第一颜色分量重建样本的分辨率与所述第二颜色分量重建样本的分辨率相同;
    相应地,所述方法还包括:对所述当前块的第二颜色分量的预测值进行下采样处理。
  81. 根据权利要求79所述的方法,其中,所述对所述第一颜色分量的参考块进行下采样处理,确定所述第一候选参考预测参数指示的第一颜色分量重建样本,包括:
    确定所述当前块的下采样方式;
    根据所述下采样方式对所述第一颜色分量的参考块进行下采样处理,确定所述第一候选参考预测参数指示的第一颜色分量重建样本。
  82. 根据权利要求81所述的方法,其中,所述确定所述当前块的下采样方式,包括:
    基于预设竞争方式对多种候选下采样方式进行代价计算,确定所述多种候选下采样方式各自对应的代价结果;
    从所述多种候选下采样方式各自对应的代价结果中选择最小代价结果;
    将所述最小代价结果对应的候选下采样方式确定为所述当前块的下采样方式。
  83. 根据权利要求82所述的方法,其中,所述预设竞争方式为率失真优化方式。
  84. 根据权利要求82所述的方法,其中,所述方法还包括:
    确定滤波标识信息的取值;其中,所述滤波标识信息用于指示所述当前块的下采样方式在所述多种候选下采样方式中的索引序号;
    对所述滤波标识信息的取值进行编码处理,将所得到的编码比特写入码流。
  85. 根据权利要求77所述的方法,其中,所述确定所述当前块的第三位置处的第一颜色分量重建样本和第二颜色分量重建样本,包括:
    确定所述当前块的第一模板;
    根据所述第一模板,确定所述第三位置处的第一颜色分量重建样本和第二颜色分量重建样本。
  86. 根据权利要求74或85所述的方法,其中,所述第一模板的类型包括下述至少一项:上模板、右上模板、左模板、左下模板和左上模板;
    其中,所述上模板位于所述当前块相邻的上侧已解码区域,所述右上模板位于所述当前块相邻的右上侧已解码区域,所述左模板位于所述当前块相邻的左侧已解码区域,所述左下模板位于所述当前块相邻的左下侧已解码区域,所述左上模板位于所述当前块相邻的左上侧已解码区域。
  87. 根据权利要求51至86中任一项所述的方法,其中,所述根据所述第一颜色分量参考样值和所述第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系,包括:
    根据所述第一颜色分量参考样值和所述第二颜色分量参考样值确定第一查找表,其中,所述第一查找表用于记录索引关键字为第一颜色分量时所对应的第二颜色分量的取值。
  88. 根据权利要求51至86中任一项所述的方法,其中,所述根据所述第一颜色分量参考样值和所述第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系,包括:
    根据所述第一颜色分量参考样值和所述第二颜色分量参考样值确定第一离散模型,其中,所述第一离散模型用于指示第一颜色分量与第二颜色分量之间的映射关系。
  89. 根据权利要求87或88所述的方法,其中,所述方法还包括:
    对所述第一颜色分量参考样值进行映射处理,以使所述第一颜色分量参考样值处于预设样本范围。
  90. 根据权利要求87或88所述的方法,其中,所述方法还包括:
    在所述第一颜色分量参考样值中的第一参考样值相同且对应所述第二颜色分量参考样值中不同的多个第二参考样值时,按照样本顺序依次进行覆盖处理,将最后一个第二参考样值作为与所述第一参考样值具有映射关系的值。
  91. 根据权利要求87或88所述的方法,其中,所述方法还包括:
    在所述第一颜色分量参考样值中的第一参考样值相同且对应所述第二颜色分量参考样值中不同的多个第二参考样值时,对所述多个第二参考样值进行平均值计算,将所得到的平均值作为与所述第一参考样值具有映射关系的值。
  92. 根据权利要求51所述的方法,其中,所述方法还包括:
    确定所述当前块的同位置的第一颜色分量区域的重建像素样本;
    基于所述第一颜色分量区域的重建像素样本,确定所述当前块的第一颜色分量样值。
  93. 根据权利要求51所述的方法,其中,所述根据所述映射关系以及所述当前块的第一颜色分量样值,确定所述当前块的第二颜色分量的预测值,包括:
    若在所述映射关系中查找到与所述第一颜色分量样值相等的第一颜色分量值,则将所述第一颜色分量值对应的第二颜色分量的取值确定为所述当前块的第二颜色分量的预测值。
  94. 根据权利要求93所述的方法,其中,所述方法还包括:
    若在所述映射关系中没有查找到与所述第一颜色分量样值相等的第一颜色分量值,则对所述第一颜色分量样值进行修正处理,确定第一颜色分量修正值,并继续在所述映射关系中查找是否存在与所述第一颜色分量修正值相等的第一颜色分量值。
  95. 根据权利要求94所述的方法,其中,所述对所述第一颜色分量重建值进行修正处理,确定第一颜色分量修正值,包括:
    根据预设的一个或多个偏移值对所述第一颜色分量样值进行偏移计算,确定所述第一颜色分量修正值。
  96. 根据权利要求94所述的方法,其中,所述方法还包括:
    若在所述映射关系中没有查找到与所述第一颜色分量修正值相等的第一颜色分量值,则对所述第二颜色分量参考样值进行平均值计算,将所得到的平均值确定为所述当前块的第二颜色分量的预测值。
  97. 根据权利要求51所述的方法,其中,所述根据所述映射关系以及所述当前块的第一颜色分量样值,确定所述当前块的第二颜色分量的预测值,包括:
    根据所述映射关系以及所述当前块的第一颜色分量样值,确定所述当前块的第二颜色分量的第一初始预测值;
    对所述第一初始预测值进行修正操作,确定所述当前块的第二颜色分量的预测值。
  98. 根据权利要求97所述的方法,其中,所述对所述第一初始预测值进行修正操作,确定所述当前块的第二颜色分量的预测值,包括:
    根据第一预设模式对所述当前块的第二颜色分量进行预测处理,确定所述当前块的第二颜色分量的第二初始预测值;其中,所述第一预设模式至少包括下述其中一项:PLANAR模式、DM模式、DC模式和CCLM模式;
    对所述第一初始预测值和所述第二初始预测值进行加权计算,确定所述当前块的第二颜色分量的预测值。
  99. 根据权利要求51所述的方法,其中,所述方法还包括:
    确定所述当前块的第二颜色分量的初始值;
    根据所述初始值和所述预测值,确定所述当前块的第二颜色分量的残差值;
    对所述当前块的第二颜色分量的残差值进行编码处理,将所得到的编码比特写入码流。
  100. 根据权利要求51所述的方法,其中,所述方法还包括:
    在所述第一参考预测参数集包括多个第一候选参考预测参数时,确定所述多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本;
    根据所述多个第一候选参考预测参数各自指示的第一颜色分量重建样本和第二颜色分量重建样本,确定第一颜色分量与第二颜色分量之间的多个映射关系;
    根据所述多个映射关系,确定所述当前块的第二颜色分量的多个第三初始预测值;
    对所述多个第三初始预测值进行加权计算,确定所述当前块的第二颜色分量的预测值。
  101. 根据权利要求51所述的方法,其中,所述方法还包括:
    在所述当前块的第一颜色分量块包括多个候选块时,确定所述当前块的第二参考预测参数集;其中,所述第二参考预测参数集包含多个第二候选参考预测参数;
    根据所述多个第二候选参考预测参数,确定多个第一候选参考预测参数;
    基于所述多个第一候选参考预测参数,确定第一颜色分量与第二颜色分量之间的多个候选映射关系;
    从所述多个候选映射关系中,确定目标映射关系;
    根据所述目标映射关系以及所述当前块的第一颜色分量样值,确定所述当前块的第二颜色分量的预测值。
  102. 根据权利要求101所述的方法,其中,所述从所述多个候选映射关系中,确定目标映射关系,包括:
    对所述多个候选映射关系分别进行代价计算,确定所述多个候选映射关系各自对应的代价结果;
    从所述多个候选映射关系各自对应的代价结果中确定最小代价结果,将所述最小代价结果对应的候选映射关系确定为所述目标映射关系。
  103. 根据权利要求101所述的方法,其中,所述方法还包括:
    确定映射关系索引值,其中,所述映射关系索引值用于指示所述目标映射关系在所述多个候选映射关系中的索引序号;
    对所述映射关系索引值进行编码处理,将所得到的编码比特写入码流。
  104. 根据权利要求51所述的方法,其中,所述方法还包括:
    在所述当前块的第一颜色分量块包括多个候选块时,确定所述当前块的第二参考预测参数集;其中,所述第二参考预测参数集包含多个第二候选参考预测参数;
    根据所述多个第二候选参考预测参数,确定多个第一候选参考预测参数;
    基于所述多个第一候选参考预测参数,确定第一颜色分量与第二颜色分量之间的多个候选映射关系;
    基于模板匹配方式对所述多个候选映射关系进行匹配误差计算,以确定所述多个候选映射关系各自的第二代价值;
    从所述多个候选映射关系各自的第二代价值中确定最小代价值,将所述最小代价值对应的候选映射关系确定为目标映射关系;
    根据所述目标映射关系以及所述当前块的第一颜色分量样值,确定所述当前块的第二颜色分量的预测值。
  105. 根据权利要求104所述的方法,其中,所述基于模板匹配方式对所述多个候选映射关系进行匹配误差计算,以确定所述多个候选映射关系各自的第二代价值,包括:
    确定所述当前块的第一模板;
    确定所述第一模板的同位置的第一颜色分量区域模板的重建像素样值;
    根据所述多个候选映射关系和所述第一颜色分量区域模板的重建像素样值,确定所述第一模板在所述多个映射关系下各自的第二颜色分量的预测值;
    根据所述第一模板的第二颜色分量的重建值与所述第一模板在所述多个映射关系下各自的第二颜色分量的预测值进行代价计算,确定所述多个候选映射关系各自的第二代价值。
  106. 根据权利要求51所述的方法,其中,所述确定当前块的预测参数,包括:
    确定所述当前块的预测模式;
    根据所述当前块的预测模式,确定所述当前块的预测参数。
  107. 根据权利要求106所述的方法,其中,所述确定所述当前块的预测模式,包括:
    确定所述当前块的多种候选模式;其中,所述多种候选模式包括第一预测模式和所述第一预测模式之外的其他预测模式;
    基于预设代价方式对所述多种候选模式进行代价计算,确定所述多种候选模式各自对应的代价结果;
    从所述多种候选模式各自对应的代价结果中确定最小代价结果,将所述最小代价结果对应的候选模式确定为所述当前块的预测模式;
    其中,所述预设代价方式至少包括下述其中一项:率失真代价方式和模板匹配方式。
  108. 根据权利要求51所述的方法,其中,所述方法还包括:
    确定所述当前块的同位置的第一颜色分量区域;
    若所述当前块使用DM模式且所述第一颜色分量区域是基于块向量进行预测,则确定所述当前块使用第一预测模式。
  109. 根据权利要求51至108中任一项所述的方法,其中,所述方法还包括:
    确定第二语法元素的取值;其中,所述第二语法元素用于指示所述当前块是否允许使用第一预测模式;
    对所述第二语法元素的取值进行编码处理,将所得到的编码比特写入码流。
  110. 一种码流,其中,所述码流是根据待编码信息进行比特编码生成的;其中,所述待编码信息包括下述至少一项:
    当前块的第二颜色分量的残差值、滤波标识信息的取值、映射关系索引值、第一语法元素的取值和第二语法元素的取值;
    其中,所述滤波标识信息用于指示所述当前块的下采样方式,所述第一语法元素用于指示所述当前块是否使用第一预测模式,所述第二语法元素用于指示所述当前块是否允许使用第一预测模式。
  111. 一种编码器,包括第一确定单元和第一预测单元,其中:
    所述第一确定单元,配置为确定当前块的预测参数;以及根据所述预测参数,确定所述当前块的第一参考预测参数集;其中,所述第一参考预测参数集包含一个或多个第一候选参考预测参数;
    所述第一确定单元,还配置为根据所述第一参考预测参数集,确定所述当前块的第一颜色分量参考样值和第二颜色分量参考样值;以及根据所述第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系;
    所述第一预测单元,配置为根据所述映射关系以及所述当前块的第一颜色分量样值,确定所述当前块的第二颜色分量的预测值。
  112. 一种编码器,包括第一存储器和第一处理器,其中:
    所述第一存储器,用于存储能够在所述第一处理器上运行的计算机程序;
    所述第一处理器,用于在运行所述计算机程序时,执行如权利要求51至109中任一项所述的方法。
  113. 一种解码器,包括第二确定单元和第二预测单元,其中:
    所述第二确定单元,配置为确定当前块的预测参数;以及根据所述预测参数,确定所述当前块的第一参考预测参数集;其中,所述第一参考预测参数集包含一个或多个第一候选参考预测参数;
    所述第二确定单元,还配置为根据所述第一参考预测参数集,确定所述当前块的第一颜色分量参考样值和第二颜色分量参考样值;以及根据所述第一颜色分量参考样值和第二颜色分量参考样值,确定第一颜色分量与第二颜色分量之间的映射关系;
    所述第二预测单元,配置为根据所述映射关系以及所述当前块的第一颜色分量样值,确定所述当前块的第二颜色分量的预测值。
  114. 一种解码器,所述解码器包括第二存储器和第二处理器,其中:
    所述第二存储器,用于存储能够在所述第二处理器上运行的计算机程序;
    所述第二处理器,用于在运行所述计算机程序时,执行如权利要求1至50中任一项所述的方法。
  115. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算机程序,所述计算机程序被至少一个处理器执行时实现如权利要求1至50中任一项所述的方法、或者如权利要求51至109中任一项所述的方法。
PCT/CN2023/143587 2023-12-29 2023-12-29 编解码方法、码流、编码器、解码器以及存储介质 Pending WO2025138232A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2023/143587 WO2025138232A1 (zh) 2023-12-29 2023-12-29 编解码方法、码流、编码器、解码器以及存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2023/143587 WO2025138232A1 (zh) 2023-12-29 2023-12-29 编解码方法、码流、编码器、解码器以及存储介质

Publications (1)

Publication Number Publication Date
WO2025138232A1 true WO2025138232A1 (zh) 2025-07-03

Family

ID=96216720

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/143587 Pending WO2025138232A1 (zh) 2023-12-29 2023-12-29 编解码方法、码流、编码器、解码器以及存储介质

Country Status (1)

Country Link
WO (1) WO2025138232A1 (zh)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101352046A (zh) * 2006-07-04 2009-01-21 三星电子株式会社 图像编码/解码方法与装置
WO2012175646A1 (en) * 2011-06-22 2012-12-27 Canon Kabushiki Kaisha Method and device for processing colour information in an image
US20220256189A1 (en) * 2019-06-17 2022-08-11 Electronics And Telecommunications Research Institute Intra block copy-based encoding/decoding method, device, and bitstream storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101352046A (zh) * 2006-07-04 2009-01-21 三星电子株式会社 图像编码/解码方法与装置
WO2012175646A1 (en) * 2011-06-22 2012-12-27 Canon Kabushiki Kaisha Method and device for processing colour information in an image
US20220256189A1 (en) * 2019-06-17 2022-08-11 Electronics And Telecommunications Research Institute Intra block copy-based encoding/decoding method, device, and bitstream storage medium

Similar Documents

Publication Publication Date Title
TW202041002A (zh) 解碼器側運動向量精緻化之限制
CN113873249B (zh) 一种编解码方法、装置及其设备
TW202019173A (zh) 用於視訊寫碼中之適應性運動向量差解析度及增加的運動向量儲存精確度的運動向量捨位
CN112771861A (zh) 色度帧内预测方法和装置、及计算机存储介质
CN113840142B (zh) 图像分量预测方法、装置及计算机存储介质
TW202512734A (zh) 仿射模型化區塊的雙向光流子區塊細化
WO2025138232A1 (zh) 编解码方法、码流、编码器、解码器以及存储介质
WO2025007276A9 (zh) 编解码方法、码流、编码器、解码器以及存储介质
WO2024000768A1 (zh) 视频编、解码方法及装置、码流、解码器、编码器、存储介质
WO2024119521A1 (zh) 编解码方法、码流、编码器、解码器以及存储介质
WO2020258053A1 (zh) 图像分量预测方法、装置及计算机存储介质
WO2025147832A1 (zh) 编解码方法、码流、编码器、解码器以及存储介质
TW202431846A (zh) 編解碼方法、碼流、編碼器、解碼器以及儲存媒介
WO2025065696A1 (zh) 编解码方法、码流、编码器、解码器以及存储介质
WO2024212251A1 (zh) 编解码方法、码流、编码器、解码器以及存储介质
WO2025043408A1 (zh) 编解码方法、码流、编码器、解码器以及存储介质
CN120982096A (zh) 编解码方法、码流、编码器、解码器以及存储介质
WO2024207136A1 (zh) 编解码方法、码流、编码器、解码器以及存储介质
WO2025145426A1 (zh) 编解码方法、编码器、解码器以及存储介质
WO2025199705A1 (zh) 编解码方法、码流、编码器、解码器以及存储介质
WO2025213394A1 (zh) 编解码方法、编码器、解码器以及存储介质
WO2025213371A1 (zh) 编解码方法、码流、编码器、解码器以及存储介质
CA3287960A1 (en) Encoding/decoding method, code stream, encoder, decoder and storage medium
WO2024207132A1 (zh) 编解码方法、码流、编码器、解码器以及存储介质
WO2026085742A1 (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: 23962906

Country of ref document: EP

Kind code of ref document: A1