WO2023197195A1 - 视频编解码方法、编码器、解码器及存储介质 - Google Patents
视频编解码方法、编码器、解码器及存储介质 Download PDFInfo
- Publication number
- WO2023197195A1 WO2023197195A1 PCT/CN2022/086473 CN2022086473W WO2023197195A1 WO 2023197195 A1 WO2023197195 A1 WO 2023197195A1 CN 2022086473 W CN2022086473 W CN 2022086473W WO 2023197195 A1 WO2023197195 A1 WO 2023197195A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- intra prediction
- value
- prediction mode
- index
- type
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 192
- 230000009466 transformation Effects 0.000 claims abstract description 501
- 238000012545 processing Methods 0.000 claims abstract description 33
- 230000001131 transforming effect Effects 0.000 claims abstract description 22
- 238000005070 sampling Methods 0.000 claims description 277
- 239000011159 matrix material Substances 0.000 claims description 111
- 238000013507 mapping Methods 0.000 claims description 81
- 230000008569 process Effects 0.000 claims description 55
- 239000013598 vector Substances 0.000 claims description 44
- 238000005192 partition Methods 0.000 claims description 41
- 230000001186 cumulative effect Effects 0.000 claims description 32
- 230000015654 memory Effects 0.000 claims description 32
- 238000013139 quantization Methods 0.000 claims description 27
- 230000006870 function Effects 0.000 claims description 24
- 238000004590 computer program Methods 0.000 claims description 18
- 238000000638 solvent extraction Methods 0.000 claims description 7
- 238000005516 engineering process Methods 0.000 description 30
- 238000010586 diagram Methods 0.000 description 21
- 238000004364 calculation method Methods 0.000 description 14
- 239000013074 reference sample Substances 0.000 description 14
- 230000017105 transposition Effects 0.000 description 14
- 239000000872 buffer Substances 0.000 description 11
- 238000001914 filtration Methods 0.000 description 10
- 238000005457 optimization Methods 0.000 description 7
- 208000037170 Delayed Emergence from Anesthesia Diseases 0.000 description 6
- 238000004891 communication Methods 0.000 description 6
- 230000001360 synchronised effect Effects 0.000 description 5
- 238000004458 analytical method Methods 0.000 description 4
- 230000002441 reversible effect Effects 0.000 description 3
- 239000000523 sample Substances 0.000 description 3
- 101100042371 Caenorhabditis elegans set-3 gene Proteins 0.000 description 2
- 101150055297 SET1 gene Proteins 0.000 description 2
- 101150117538 Set2 gene Proteins 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 2
- 239000012141 concentrate Substances 0.000 description 2
- 238000010276 construction Methods 0.000 description 2
- 238000011084 recovery Methods 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 238000000844 transformation Methods 0.000 description 2
- KLDZYURQCUYZBL-UHFFFAOYSA-N 2-[3-[(2-hydroxyphenyl)methylideneamino]propyliminomethyl]phenol Chemical compound OC1=CC=CC=C1C=NCCCN=CC1=CC=CC=C1O KLDZYURQCUYZBL-UHFFFAOYSA-N 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000000903 blocking effect Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 201000001098 delayed sleep phase syndrome Diseases 0.000 description 1
- 208000033921 delayed sleep phase type circadian rhythm sleep disease Diseases 0.000 description 1
- 238000009795 derivation Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000008520 organization Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000002123 temporal effect Effects 0.000 description 1
- 238000012549 training Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/50—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
Definitions
- the embodiments of the present application relate to the field of image processing technology, and in particular, to a video encoding and decoding method, an encoder, a decoder, and a storage medium.
- H.266/VVC includes transformation techniques associated with the coding mode of the coded block.
- this transformation technology does not adapt to the coding mode of non-angle prediction, which reduces the coding efficiency.
- Embodiments of the present application provide a video encoding and decoding method, an encoder, a decoder, and a storage medium, which can improve the applicability of non-traditional intra prediction modes, make the selection of transformation cores more flexible, and thereby improve encoding and decoding efficiency.
- embodiments of the present application provide a video decoding method, which is applied to a decoder.
- the method includes:
- a reconstruction value of the current block is determined.
- embodiments of the present application provide a video coding method, applied to an encoder, and the method includes:
- the residual value is transformed to obtain the transformation coefficient of the current block.
- embodiments of the present application provide a decoder, including:
- the decoding part is configured to decode the code stream and determine the first type intra prediction mode parameters of the current block
- a first prediction part configured to determine a first prediction value of the current block according to the first type intra prediction mode parameter
- a first determining part configured to determine a first transform parameter of the current block based on a first predicted value of the current block or the first type intra prediction mode parameter; and based on the first transform parameter, Determine a second transformation parameter for transforming the current block;
- a first transformation part configured to perform transformation processing on the transformation coefficient of the current block based on the second transformation parameter and determine a residual value of the current block
- a reconstruction part configured to determine a reconstruction value of the current block based on the residual value and the first prediction value.
- an encoder which includes:
- a second determination part configured to determine the first type of intra prediction mode parameters
- a second prediction part configured to determine a first prediction value of the current block according to the first type intra prediction mode parameter
- the second determining part is further configured to calculate a residual value between the original value of the current block and the first predicted value; and according to the first predicted value of the current block or the first type intra frame Prediction mode parameters to determine a first transformation parameter of the current block; and based on the first transformation parameter, determine a second transformation parameter to transform the current block;
- the second transformation part is configured to perform transformation processing on the residual value based on the second transformation parameter to obtain the transformation coefficient of the current block.
- embodiments of the present application provide a decoder, including:
- a first memory configured to store a computer program for execution on the first processor
- the first processor is configured to execute the method described in the first aspect when running the computer program.
- an encoder which includes:
- a second memory configured to store a computer program for execution on the second processor
- the second processor is configured to execute the method described in the second aspect when running the computer program.
- embodiments of the present application provide a computer-readable storage medium that stores a computer program.
- the computer program is executed by the first processor, the method described in the second aspect is implemented, or the computer program is executed by the first processor.
- the second processor executes, the method described in the first aspect is implemented.
- Embodiments of the present application provide a video encoding and decoding method, an encoder, a decoder and a storage medium, which determine the first predicted value of the current block based on the first type of intra prediction mode parameters; based on the first predicted value of the current block Or the first type of intra prediction mode parameter, determine the first transformation parameter of the current block; based on the first transformation parameter, determine the second transformation parameter for transforming the current block; based on the second transformation parameter, perform the transformation coefficient of the current block Transformation processing determines the residual value of the current block; based on the residual value and the first predicted value, determines the reconstruction value of the current block.
- the transformation technology since the first prediction value of the current block or the first type of intra prediction mode parameter is introduced when performing LFNST transformation, the transformation technology , the selection of the transformation kernel or transformation matrix (corresponding to the second transformation parameter) is more flexible, which not only improves the applicability of the non-traditional intra prediction mode (the first type of intra prediction mode), but also improves the decoding efficiency. Can improve video image quality.
- the first type of intra prediction mode such as MIP
- Figure 1 is a schematic diagram of the application location of an LFNST technology provided by related technical solutions
- Figure 2A is a block diagram of a video coding system provided by an embodiment of the present application.
- Figure 2B is a block diagram of a video decoding system provided by an embodiment of the present application.
- Figure 3 is a schematic flow chart of a video decoding method provided by an embodiment of the present application.
- Figure 4 is a flow chart of a MIP prediction process provided by an embodiment of the present application.
- Figure 5 is a structural schematic diagram of the calculation process of matrix multiplication of a LFNST technology provided by the embodiment of the present application;
- Figure 6A is a structural block diagram of an LFNST transformation provided by a related technical solution
- Figure 6B is a structural block diagram of another LFNST transformation provided by a related technical solution.
- FIG. 6C is a structural block diagram of another LFNST transformation provided by related technical solutions.
- Figure 6D is a structural block diagram of yet another LFNST transformation provided by a related technical solution.
- Figure 7 is a flow chart of a specific LFNST process provided by the embodiment of the present application.
- Figure 8 is a schematic flow chart of another video encoding method provided by an embodiment of the present application.
- Figure 9 is a schematic structural diagram of a decoder provided by an embodiment of the present application.
- Figure 10 is a schematic diagram of the specific hardware structure of a decoder provided by an embodiment of the present application.
- Figure 11 is a schematic structural diagram of an encoder provided by an embodiment of the present application.
- Figure 12 is a schematic diagram of the specific hardware structure of an encoder provided by an embodiment of the present application.
- the first image component, the second image component and the third image component are generally used to represent the coding block (CB); among them, these three image components are a brightness component and a blue chrominance component respectively. and a red chrominance component.
- the brightness component is usually represented by the symbol Y
- the blue chroma component is usually represented by the symbol Cb or U
- the red chroma component is usually represented by the symbol Cr or V; in this way, the video image can be represented in the YCbCr format or YUV Format representation.
- the video image may also be in RGB format, YcgCo format, etc., which are not limited in the embodiments of this application.
- the first image component may be a brightness component
- the second image component may be a blue chrominance component
- the third image component may be a red chrominance component, but this is not specifically limited in the embodiment of the present application.
- the embodiments of the present application can be applied to scenarios of low-frequency inseparable secondary transformation or extended low-frequency inseparable secondary transformation, or other scenarios that require transformation technology associated with the coding mode of the coding block.
- the embodiments of the present application are not limited.
- FIG. 1 shows a schematic diagram of the application location of an LFNST technology provided by a related technical solution.
- the LFNST technology is applied between the forward primary transform unit 11 and the quantization unit 12
- the LFNST technology is applied between the inverse quantization unit 13 and the inverse primary transform unit 14 .
- LFNST technology is applied between the forward primary transform unit 11 and the quantization unit 12 .
- the data such as the prediction residual (which can be expressed as residual) is first transformed through the positive primary transformation unit 11 (which can be called “Core Transform” or “primary transformation” or “main transformation”) , to obtain the transformation coefficient matrix after the first transformation (i.e., the second transformation coefficient); then perform LFNST transformation (can be called “Secondary Transform” or “secondary transformation") on the coefficients in the transformation coefficient matrix, and get The LFNST transform coefficient matrix (ie, the first transform coefficient) is finally quantized by the quantization unit 12 on the LFNST transform coefficient matrix, and the final quantized coefficient is written into the video bitstream.
- the positive primary transformation unit 11 which can be called “Core Transform” or “primary transformation” or “main transformation”
- LFNST transformation can be called “Secondary Transform” or “secondary transformation”
- the quantized coefficients of the LFNST transform coefficient matrix can be obtained.
- the inverse quantization unit 13 performs inverse quantization processing on the quantized coefficients (which can be called “Scaling”) to obtain the recovery of the LFNST transform coefficient matrix.
- value i.e., the first transform coefficient
- the standard only defines the “inverse transform” operation on the decoder side, so the “inverse LFNST transform” is also called “LFNST transform” in the standard; here, in order to facilitate the transformation on the encoder side To distinguish, the “LFNST transform” on the encoder side can be called “forward LFNST transform”, and the “LFNST transform” on the decoder side can be called “reverse LFNST transform”.
- the prediction residual of the current transform block can be obtained by positive primary transformation to obtain the primary transformation coefficient, that is, the second transformation coefficient. Then, part of the primary transformation coefficient is multiplied by the transformation matrix through matrix multiplication to perform two transformations. After secondary transformation, a smaller and more concentrated secondary transformation coefficient (i.e., the first transformation coefficient) is obtained, and then quantized to obtain the quantized coefficient; on the decoder side, after the quantized coefficient is parsed, the Inverse quantization processing is performed, the first transform coefficient after inverse quantization is subjected to inverse quadratic transformation through matrix multiplication, and then the first transform coefficient after inverse quadratic transformation is subjected to inverse primary transformation, thereby recovering the prediction residual.
- the LFNST transformation process can include steps such as configuring core parameters, intra prediction mode mapping, selecting transformation matrices, calculating matrix multiplication, and constructing an inverse linear transformation coefficient matrix; after these steps, it means that LFNST is completed Transform.
- the step of selecting the transformation matrix ie, transformation kernel
- the value of the intra prediction mode indicator (which can be represented by predModeIntra) can be determined according to the number of the traditional intra prediction mode, that is, the value of the first transformation parameter.
- the transformation set index number is then determined based on the value of predModeIntra; but for non-traditional frame prediction modes, especially the matrix-based intra prediction (MIP) mode, the value of predModeIntra is directly set to indicate
- the intra prediction mode index number (i.e. 0) corresponding to the PLANAR mode causes the current block in MIP mode to only select the transform set with the transform set index number 0, which makes the current block in MIP mode lack variability when performing LFNST transformation. As a result, the LFNST technology is not well applicable to the MIP mode and also reduces the coding efficiency.
- the embodiment of the present application provides a video decoding method, which is applied to the decoder. Determine the first prediction value of the current block based on the first type of intra prediction mode parameter; determine the first transformation parameter of the current block based on the first prediction value of the current block or the first type of intra prediction mode parameter; based on the first The transformation parameter determines the second transformation parameter for transforming the current block; based on the second transformation parameter, transforms the transformation coefficient of the current block to determine the residual value of the current block; based on the residual value and the first prediction value, determines The reconstructed value of the current block.
- the transformation technology since the first prediction value of the current block or the first type of intra prediction mode parameter is introduced when performing LFNST transformation, the transformation technology , the selection of the transformation kernel or transformation matrix (corresponding to the second transformation parameter) is more flexible, which not only improves the applicability of the non-traditional intra prediction mode (the first type of intra prediction mode), but also improves the decoding efficiency. Can improve video image quality.
- the first type of intra prediction mode such as MIP
- the embodiment of the present application provides a video encoding method, which is applied to the encoder.
- determining the first type of intra prediction mode parameters according to the first type of intra prediction mode parameters, determining the first predicted value of the current block, and calculating the residual value between the original value of the current block and the first predicted value; according to The first prediction value or the first type intra prediction mode parameter of the current block determines the first transformation parameter of the current block; based on the first transformation parameter, determines the second transformation parameter for transforming the current block; based on the second transformation parameter, Transform the residual value to obtain the transformation coefficient of the current block.
- the transformation technology since the first prediction value of the current block or the first type of intra prediction mode parameter is introduced when performing LFNST transformation, the transformation technology , the selection of the transformation kernel or transformation matrix (corresponding to the second transformation parameter) is more flexible, which not only improves the applicability of the non-traditional intra prediction mode (the first type of intra prediction mode), but also improves the coding efficiency. Can improve video image quality.
- the first type of intra prediction mode such as MIP
- the video coding system 10 includes a transformation and quantization unit 101, an intra-frame estimation unit 102, an intra-frame Prediction unit 103, motion compensation unit 104, motion estimation unit 105, inverse transformation and inverse quantization unit 106, filter control analysis unit 107, filtering unit 108, encoding unit 109 and decoded image cache unit 110, etc., wherein the filtering unit 108 can To implement deblocking filtering and Sample Adaptive Offset (SAO) filtering, the encoding unit 109 can implement header information encoding and Context-based Adaptive Binary Arithmatic Coding (CABAC).
- CABAC Context-based Adaptive Binary Arithmatic Coding
- a video coding block can be obtained by dividing the coding tree block (Coding Tree Unit, CTU), and then the residual pixel information obtained after intra-frame or inter-frame prediction is processed through the transformation and quantization unit 101
- the video coding block is transformed, including transforming the residual information from the pixel domain to the transform domain, and quantizing the resulting transform coefficients to further reduce the bit rate;
- the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to Intra prediction is performed on the video encoding block; specifically, intra estimation unit 102 and intra prediction unit 103 are used to determine an intra prediction mode to be used to encode the video encoding block;
- motion compensation unit 104 and motion estimation unit 105 is used to perform inter-frame prediction encoding of the received video encoding block with respect to one or more blocks in one or more reference frames to provide temporal prediction information; motion estimation performed by the motion estimation unit 105 is to generate a motion vector.
- the motion vector can estimate the motion of the video encoding block, and then the motion compensation unit 104 performs motion compensation based on the motion vector determined by the motion estimation unit 105; after determining the intra prediction mode, the intra prediction unit 103 also is used to provide the selected intra prediction data to the encoding unit 109, and the motion estimation unit 105 also sends the calculated and determined motion vector data to the encoding unit 109; in addition, the inverse transformation and inverse quantization unit 106 is used for the video Reconstruction of the coding block, the residual block is reconstructed in the pixel domain, the reconstructed residual block removes block effect artifacts through the filter control analysis unit 107 and the filtering unit 108, and then the reconstructed residual block is added to the decoding A predictive block in the frame of the image cache unit 110 is used to generate a reconstructed video encoding block; the encoding unit 109 is used to encode various encoding parameters and quantized transform coefficients.
- the contextual content can be based on adjacent coding blocks and can be used to encode information indicating the determined intra prediction mode and output the code stream of the video signal; and the decoded image buffer unit 110 is used to store the reconstructed video coding blocks for Forecast reference. As the video image encoding proceeds, new reconstructed video encoding blocks will be continuously generated, and these reconstructed video encoding blocks will be stored in the decoded image cache unit 110 .
- the video decoding system 20 includes a decoding unit 201, an inverse transformation and inverse quantization unit 202, an intra-frame Prediction unit 203, motion compensation unit 204, filtering unit 205, decoded image cache unit 206, etc., wherein the decoding unit 201 can implement header information decoding and CABAC decoding, and the filtering unit 205 can implement deblocking filtering and SAO filtering.
- the code stream of the video signal is output; the code stream is input into the video decoding system 20 and first passes through the decoding unit 201 to obtain the decoded transformation coefficient; for the transformation coefficient, pass Inverse transform and inverse quantization unit 202 performs processing to generate a residual block in the pixel domain; intra prediction unit 203 may be operable to generate based on the determined intra prediction mode and data from previously decoded blocks of the current frame or picture. Prediction data for the current video decoding block; motion compensation unit 204 determines prediction information for the video decoding block by parsing motion vectors and other associated syntax elements, and uses the prediction information to generate predictions for the video decoding block being decoded.
- a decoded video block is formed by summing the residual block from inverse transform and inverse quantization unit 202 and the corresponding predictive block generated by intra prediction unit 203 or motion compensation unit 204; the decoded video signal Video quality can be improved by filtering unit 205 to remove blocking artifacts; the decoded video blocks are then stored in decoded image buffer unit 206, which stores reference images for subsequent intra prediction or motion compensation. , and is also used for the output of video signals, that is, the restored original video signals are obtained.
- the video coding method in the embodiment of the present application can be applied to the transformation and quantization unit 101 shown in Figure 2A.
- the transformation and quantization unit 101 includes the positive primary transformation unit 11 and the quantization unit 12 shown in Figure 1. This This video coding method is applied after transformation and before quantization.
- the video decoding method in the embodiment of the present application can also apply the inverse transformation and inverse quantization unit 202 shown in Figure 2B.
- the inverse transformation and inverse quantization unit 202 can include the inverse quantization unit 13 shown in Figure 1 and Inverse primary transformation unit 14, at this time, the video decoding method is applied in the process after inverse quantization and before inverse transformation.
- the video encoding method in the embodiment of the present application is applied to the video encoding system
- the video decoding method in the embodiment of the present application is applied to the video decoding system. It can even be applied to a video encoding system and a video decoding system at the same time, but this is not limited by the embodiments of the present application.
- the "current block” i.e., the transform block
- “Current block” ie, transform block
- Figure 3 shows a schematic flow chart of a video decoding method provided by an embodiment of the present application, applied to a decoder.
- the method may include:
- the decoder decodes the code stream and first obtains the prediction mode parameter of the current block.
- the prediction mode parameter indicates the encoding mode of the current block and parameters related to the mode.
- the prediction mode usually includes a traditional intra prediction mode and a non-traditional intra prediction mode
- the traditional intra prediction mode can include a direct current (DC) mode, a planar (PLANAR) mode, an angle prediction mode, etc.
- Prediction modes may include MIP mode, CCLM mode, IBC mode, PLT mode, etc.
- the second type of intra prediction mode represents a traditional intra prediction mode
- the first type of intra prediction mode represents a non-traditional intra prediction mode
- the first type of intra prediction mode can be understood as a non-angle prediction mode.
- the decoder determines the first type intra prediction mode parameters of the current block in the code stream when the decoded prediction mode parameters represent the first type intra prediction mode.
- the encoder when the encoder encodes the current block, the encoder performs predictive encoding on the current block. In this process, the prediction mode of the current block can be determined and the corresponding prediction mode parameters are written into The code stream is transmitted from the encoder to the decoder.
- the encoder can use rate distortion optimization (Rate Distortion Optimization, RDO) to determine the prediction mode parameters of the current block.
- rate distortion optimization Rate Distortion Optimization
- the decoding of the current block is also a decoding process performed on different color components.
- An image component indicator (which can be represented by cIdx) is used to indicate the luminance component or chrominance component of the current block.
- cIdx is equal to 0; if the current block predicts the chrominance component, then cIdx is equal to 1.
- (xTbY,yTbY) is the coordinate of the upper left corner sampling point of the current block
- IntraPredModeY[xTbY][yTbY] is the intra prediction mode of the luminance component
- IntraPredModeC[xTbY][yTbY] is the intra prediction mode of the chroma component.
- the decoder can determine the first type intra prediction mode parameters of the current block.
- the first type intra prediction mode parameters are parameters corresponding to the first type intra prediction mode.
- the parameters corresponding to the first type of intra prediction mode are MIP parameters.
- the first type of intra prediction mode parameters may include: the first type of intra prediction mode index (can be represented by modeId), the size of the current block, the category of the current block (can be represented by mipSizeId) and other parameters; the values of these parameters can be Obtained by decoding the code stream.
- the MIP parameters may include the MIP transposition indication parameter (can be represented by isTransposed), the MIP mode index sequence number (can be represented by modeId), the size of the current block, the category of the current block (can be represented by mipSizeId) and other parameters.
- determining the category of the current block based on the size of the current block may include:
- the value of mipSizeId can be set to 0;
- the value of mipSizeId can be set to 1;
- the value of mipSizeId can be set to 2.
- determining the category of the current block according to the size of the current block may include:
- the value of mipSizeId can be set to 0;
- the value of mipSizeId can be set to 1;
- the value of mipSizeId can be set to 2.
- the MIP parameters can also be determined, so that the LFNST transform kernel (which can be represented by kernel) used by the current block is determined based on the determined MIP parameters.
- the value of isTransposed can be determined; when the value of isTransposed is equal to 1, the sampling point input vector used in the MIP mode needs to be transposed; when the value of isTransposed is equal to 0 , there is no need to transpose the sampling point input vector used in the MIP mode; that is to say, the MIP transposition indication parameter can be used to indicate whether to transpose the sampling point input vector used in the MIP mode.
- the MIP mode index number (which can be represented by modeId) can also be determined; where the MIP mode index number can be used to indicate the MIP mode used by the current block, and the MIP mode can be used to indicate the use of MIP Determines how the intra prediction value of the current block is calculated and derived.
- MIP mode since MIP modes can include many kinds, these various MIP modes can be distinguished by MIP mode index numbers, that is, different MIP modes have different MIP mode index numbers; in this way, according to the use
- the MIP calculation and derivation method for determining the intra prediction value of the current block can determine the specific MIP mode, so that the corresponding MIP mode index number can be obtained; in the embodiment of the present application, the value of the MIP mode index number can be 0, 1, 2, 3, 4 or 5.
- parameter information such as the size, aspect ratio, and category of the current block (which can be represented by mipSizeId) of the current block can also be determined.
- the transformation kernel can be represented by kernel, such as the LFNST transformation kernel
- scanning order parameters used in the current block based on the determined MIP parameters, or determine based on the determined MIP parameters.
- the first predicted value of the current block, and the transform kernel or scan order parameter is selected based on the first predicted value.
- the decoder can perform intra prediction using the first type of intra prediction mode parameters, thereby determining the first prediction value of the current block.
- the first type of intra prediction mode parameter is the MIP parameter as an example for explanation.
- the input data for MIP prediction includes: the position of the current block (xTbCmp, yTbCmp), the MIP prediction mode applied to the current block (can be represented by modeId), the height of the current block ( Expressed by nTbH), the width of the current block (expressed by nTbW) and the transposition processing indication flag of whether transposition is required (can be expressed by isTransposed), etc.;
- the MIP prediction process can be divided into four steps: configuring core parameters 41, obtaining reference pixels 42, constructing input samples 43, and generating prediction values 44.
- the configuration core parameter 41 according to the size of the current block in the frame, the current block can be divided into three categories, and mipSizeId is used to record the type of the current block; and for different types of current blocks, refer to the number of sampling points and matrix multiplication output The number of sampling points is different.
- the reference pixel 42 when predicting the current block, the upper block and the left block of the current block are both encoded blocks.
- the reference pixel of the MIP technology is the reconstructed value of the pixels in the previous row and the left column of the current block
- the process of obtaining the reference pixel adjacent to the upper side (represented by refT) and the adjacent reference pixel on the left side (represented by refL) of the current block is the acquisition process of the reference pixel.
- this step is used for the input of matrix multiplication, and can mainly include: obtaining reference samples 431, constructing reference sample buffers 432, and deriving matrix multiplication input samples 433; wherein, the process of obtaining reference samples is downsampling.
- the process of constructing the reference sampling buffer 432 may include a filling method 4321 of the buffer when transposition is not required and a filling method 4322 of the buffer when transposition is required.
- this step is used to obtain the MIP predicted value of the current block, which mainly includes: constructing the matrix multiplication output sampling block 441, the matrix multiplication output sampling block 442, the matrix multiplication output sampling transpose 443 and generating the MIP The final prediction value 444; wherein, constructing the matrix multiplication output sampling block 441 may include obtaining the weight matrix 4411, obtaining the shift factor and offset factor 4412, and matrix multiplication operation 4413, and generating the MIP final prediction value 444 may include generating the MIP final prediction value 444 which does not require Sampled predicted values 4441 and generated predicted values 4442 that require upsampling. In this way, after these four steps, the intra prediction value of the current block can be obtained.
- the difference can be calculated based on the actual pixel value of the current block and the intra prediction value, and the calculated difference can be used as the prediction difference to facilitate subsequent prediction of the difference. Transformation processing.
- MIP parameters also need to be determined.
- the MIP parameters may include a MIP transposition indication parameter (which may be represented by isTransposed); here, the value of the MIP transposition indication parameter is used to indicate whether to transpose the sampling point input vector used in the MIP mode. .
- the adjacent reference sample set can be obtained based on the reference sample values corresponding to the adjacent reference pixels on the left side of the current block and the reference sample values corresponding to the adjacent reference pixels on the upper side; in this way, after obtaining the adjacent reference samples
- an input reference sample set can be constructed at this time, that is, the sampling point input vector used in MIP mode.
- the construction methods on the encoder side and the decoder side are different, mainly related to the value of the MIP transposition indication parameter.
- the MIP transposition indication parameter is calculated and determined by the encoder.
- the decoder can decode the MIP transposition indication parameter from the code stream.
- the decoder decodes the MIP transposition indication parameter.
- the reference sample value corresponding to the upper side of the adjacent reference sample set can be stored in Before the reference sampling value corresponding to the left side, there is no need to perform transposition processing at this time, that is, there is no need to transpose the sampling point input vector used in MIP mode, and the buffer can be directly determined as the input reference sample value set; when When the value of the MIP transpose indication parameter is 1, in the buffer, the reference sample value corresponding to the upper side of the adjacent reference sample set can be stored after the reference sample value corresponding to the left side.
- the buffer The area is transposed, that is, the sampling point input vector used in the MIP mode needs to be transposed, and then the transposed buffer is determined as the input reference sample set. In this way, after the input reference sample set is obtained, it can be used in the process of determining the intra prediction value corresponding to the current block in the MIP mode.
- the decoder may determine the first transformation parameter of the current block based on the first prediction value of the current block.
- the decoder may also determine the first transformation parameter of the current block based on the first type intra prediction mode parameter of the current block, which is not limited by this embodiment of the present application.
- the implementation of determining the first transformation parameter of the current block may include:
- the decoder may determine the first index of the second type of intra prediction mode through the first prediction value of the current block, where the second type of intra prediction mode includes at least one of the following: planar mode, DC mode and intra angle prediction mode. The decoder may then determine the first transformation parameter of the current block based on the first index of the second type intra prediction mode of the current block.
- the first transformation parameter in the embodiment of the present application is the basis for determining the second transformation parameter, that is, the transformation core index parameter (referring to the transformation coefficient matrix index) and the scanning order parameter of the transformation parameter.
- the decoder can map the non-traditional intra prediction mode to the traditional intra prediction mode and determine the first transformation parameter of the current block through the first index of the traditional intra prediction mode, thereby making the current block in
- a flexible method corresponding to the traditional intra prediction mode can be used to select the second transformation parameter for parameter transformation, which improves the non-traditional intra prediction mode (the first type of intra prediction mode)
- the applicability also improves the coding efficiency and can also improve the video image quality.
- the first predicted value may be the final predicted value obtained by using the first type of intra prediction mode for intra prediction, or may be the final predicted value obtained by using the first type of intra prediction mode for intra prediction.
- the intermediate forecast value during the forecast process may be the final predicted value obtained by using the first type of intra prediction mode for intra prediction.
- the first predicted value may be the final predicted value after upsampling during MIP prediction, or the intermediate predicted value before upsampling during MIP prediction, which is not limited in this embodiment of the application.
- the decoder may set the first transform parameter of the current block equal to the first index of the second type intra prediction mode of the current block.
- the implementation for S1 is as follows, including:
- the decoder can map the first prediction value to the second type of intra prediction mode, that is, obtain the index set of the second type of intra prediction mode, and then obtain the index set of the second type of intra prediction mode. Focus on determining the first index of the second type of intra prediction mode to be used for the current block.
- the index set of the second type intra prediction mode may store cumulative weight values corresponding to part or all of the allowed values of the index of one or more second type intra prediction modes. If there are multiple ones stored, the first index of the second type intra prediction mode of the current block may be one selected from the corresponding accumulated weight values among the indexes of multiple second type intra prediction modes.
- the decoder determines the horizontal gradient value and the vertical gradient value of the sampling points corresponding to some or all of the predicted values; according to the The horizontal gradient value and the vertical gradient value determine the index set of the second type intra prediction mode of the first prediction value.
- the MIP prediction value is used and different analysis methods are used to map the MIP prediction value to the traditional intra prediction mode by calculating the gradient information of the MIP mode prediction value.
- the traditional intra prediction mode is derived based on the gradient information, and the transform set and scan order used in LFNST are selected based on the derived intra prediction mode.
- the decoder can determine the second index of the second type of intra prediction mode corresponding to each sampling point, and convert some or all of the prediction values in the first prediction value into After the sampling points are determined, the index set of the second type of intra prediction mode can be obtained.
- the process of determining the second index of the second type intra prediction mode is consistent for each sampling point.
- the decoder determines the index set of the second type intra prediction mode of the first prediction value based on the horizontal gradient value and vertical gradient value of the sampling point, including: (1) and (2). as follows:
- the decoder determines the gradient angle value of the sampling point based on the horizontal gradient value and vertical gradient value of the sampling point; determines the second type of intra prediction mode corresponding to the gradient angle value based on the gradient angle value of the sampling point a second index; updating a cumulative weight value in the index set of the second type intra prediction mode corresponding to the determined second index of the second type intra prediction mode.
- the decoder determines the gradient angle value of the sampling point based on the horizontal gradient value and vertical gradient value of the sampling point and a preset functional relationship.
- the first implementation is: the preset functional relationship is the arctangent function; where the arctangent function is the ratio of the horizontal gradient value and the vertical gradient value of the sampling point.
- G x and G y are the horizontal direction gradient value and the vertical direction gradient value; ⁇ is the gradient angle value.
- the decoder processes the ratio of the horizontal gradient value and the vertical gradient value of the sampling point based on the arctangent function to determine the gradient angle value of the sampling point.
- the second implementation is: the preset functional relationship is a second mapping table between the gradient angle value of the sampling point and the horizontal gradient value and vertical gradient value of the sampling point.
- the decoder inputs the horizontal gradient value and the vertical gradient value of the sampling point, or the ratio of the horizontal gradient value and the vertical gradient value of the sampling point, into the second mapping table, and outputs the Gradient angle value.
- the mapping gradient angle value can be determined through the second mapping table and the horizontal gradient value and vertical gradient value of the sampling point.
- the second mapping table is the corresponding relationship between the horizontal gradient value and the vertical gradient value of the sampling point and the gradient angle value. It can also be the corresponding relationship between the horizontal gradient value and the vertical gradient value and the gradient angle value.
- the decoder after the decoder determines the gradient angle value, it can determine the second index of the second type intra prediction mode of the sampling point based on the gradient angle value of the sampling point.
- the implementation of the decoder determining the second index of the second type of intra prediction mode corresponding to the gradient angle value according to the gradient angle value of the sampling point includes: from and the second type of intra prediction mode Among the directions of intra-frame angle prediction indicated by part or all of the allowable values of the index, determine the second type of intra-frame prediction mode index corresponding to the intra-frame angle prediction direction with the smallest angle between the directions indicated by the gradient angle value. value; set the second index of the second type intra prediction mode of the gradient angle value to the second type intra prediction mode index value.
- the decoder may use an array to store some or all of the allowed values corresponding to the accumulated weight values of the index of the second type intra prediction mode.
- Each set of data in the array is the cumulative weight value of the allowed values corresponding to the second type intra prediction mode.
- the decoder first finds the intra-frame angle prediction direction that is closest to the direction indicated by the gradient angle value, and then determines the second type of intra-frame prediction mode corresponding to the intra-frame angle prediction direction.
- the second type of intra-frame prediction mode The index value serves as the second index of the second type intra prediction mode of the gradient angle value.
- the implementation of the decoder determining the second index of the second type intra prediction mode corresponding to the gradient angle value according to the gradient angle value of the sampling point includes: according to the preset gradient angle value and the first The third mapping table between the indices of the two types of intra prediction modes determines the second index of the second type of intra prediction mode corresponding to the gradient angle value.
- the third mapping table represents the correspondence between gradient angle values with different values or different value ranges and second type intra prediction mode indexes.
- the decoder may update the index set of the second type of intra prediction mode corresponding to The determined cumulative weight value of the second index of the second type of intra prediction mode, that is to say, each time the decoder determines the second index of a sampling point, it can concentrate on the index of the second type of intra prediction mode. , the cumulative weight value corresponding to the second index of the determined second type intra prediction mode is increased by the set value. In this way, after all sample points are processed, the index set of the second type intra prediction mode of the first predicted value can be obtained.
- the set value is equal to 1. Or the set value is equal to the sum (G) of the absolute value of the horizontal gradient value and the absolute value of the vertical gradient value.
- G the sum of the absolute value of the horizontal gradient value and the absolute value of the vertical gradient value.
- G is:
- the decoder determines the gradient direction, first gradient intensity and pattern partition corresponding to the sampling point based on the horizontal gradient value and vertical gradient value of the sampling point; the gradient direction, first gradient intensity and pattern partition corresponding to the sampling point , determine the second index of the second type intra prediction mode; update the cumulative weight value corresponding to the determined second index of the second type intra prediction mode in the index set of the second type intra prediction mode.
- the decoder determines the first gradient value of the sampling point based on the horizontal gradient value (gHor[x][y]) and the vertical gradient value ((gVer[x][y]) of the sampling point.
- the decoder determines the second index of the second type of intra prediction mode based on the gradient direction, first gradient strength and mode partition corresponding to the sampling point, including:
- the decoder determines the gradient offset ratio of the sampling point (grad[x][y]) based on the gradient direction corresponding to the sampling point; maps the gradient offset ratio of the sampling point to the preset mode offset range to obtain the sampling point
- the intra prediction mode index offset (angIdx[x][y]); according to the fourth mapping table of the preset mode partition and the mode index, determine the target second type intra prediction mode corresponding to the mode partition of the sampling point ; Combine the target second type intra prediction mode and the intra prediction mode index offset to determine the second index of the second type intra prediction mode of the sampling point.
- the decoder may update the index set of the second type of intra prediction mode corresponding to The determined cumulative weight value of the second index of the second type of intra prediction mode, that is to say, each time the decoder determines the second index of a sampling point, it can concentrate on the index of the second type of intra prediction mode. , the cumulative weight value corresponding to the second index of the determined second type intra prediction mode is increased by the set value. In this way, after all sample points are processed, the index set of the second type intra prediction mode of the first predicted value can be obtained.
- the implementation of the decoder updating the cumulative weight value corresponding to the determined second index of the second type intra prediction mode in the index set of the second type intra prediction mode includes: In the index set of prediction modes, the cumulative weight value corresponding to the second index of the determined second type intra prediction mode is increased by a set value.
- the set value is equal to 1 or the set value is equal to the sum of the absolute value of the horizontal gradient value and the absolute value of the vertical gradient value, which is not limited by the embodiment of the present application.
- the MIP mode analyze the predicted value of the MIP mode (ie, the first predicted value), derive a traditional intra prediction mode based on the predicted value of the MIP mode, and map predModeIntra to the traditional intra prediction mode, get the first index, that is, get the first transformation parameter equal to the first index.
- the decoder can analyze the gradient of the MIP prediction value, extract the direction with the largest gradient value, and correspond this direction to a traditional intra prediction mode.
- the mapping process is divided into two steps: Obtain the MIP mode Predict pixels, using gradients to derive traditional intra prediction modes.
- the mapping process includes: obtaining the predicted pixels of the MIP mode (that is, the sampling point of the first predicted value), and using the gradient to derive the traditional intra prediction mode.
- the decoder determines the index set of the second type intra prediction mode of the first predicted value based on the first predicted value as follows:
- the decoder may obtain the predicted value of the MIP mode based on the position and size of the MIP transform block (current block).
- the prediction of the current transform block has been completed.
- the predicted value can be obtained directly through the position and size of the MIP transform block.
- One possible way is to obtain the final predicted value after MIP completes matrix multiplication and upsampling.
- Another feasible way is to obtain the predicted value of the predicted value before MIP upsampling.
- the process of the decoder using gradients to derive the traditional intra prediction mode is: taking the final predicted pixels of the MIP mode as an example, for the final predicted pixels of the MIP mode, calculate all the predicted pixels or part of the predicted pixels
- the vertical gradient (vertical gradient value) and horizontal gradient (horizontal gradient value) map the direction with the largest gradient (gradient angle value) into a traditional intra-frame prediction mode.
- the MIP prediction mode is mapped to the traditional intra prediction mode, and the transformation set and scanning order used when performing LFNST are selected according to the mapped traditional intra prediction mode.
- the Sobel operator formula (3) is as follows, where G x is used to calculate the horizontal gradient, and G y is used to calculate the vertical gradient.
- the decoder obtains the traditional intra prediction mode IntraPredModeD (ie, the second type of intra prediction mode), where IntraPredModeD is between [0,66].
- ipm[x][y] angOffset[region[x][y]] (possible value is 18 or 50)+angIdx[x][y], that is, according to the predicted Set up a fourth mapping table between mode partition and mode index to determine the target second type intra prediction mode (angOffset[region[x][y]]) corresponding to the mode partition of the sampling point; combined with the target second type intra prediction Mode and intra prediction mode index offset, determine the second index (ipm[x][y]) of the second type intra prediction mode of the sampling point.
- the decoder may determine the implementation of the first index of the second type intra prediction mode of the current block based on the index set of the second type intra prediction mode of the first prediction value, including: :
- the decoder sets the first index of the second type intra prediction mode of the current block to the index set of the second type intra prediction mode of the first prediction value, and the largest cumulative weight value corresponds to the first index of the second type intra prediction mode.
- Second index Alternatively, the first index of the second type intra prediction mode of the current block is set to the index set of the second type intra prediction mode of the first prediction value, and the smallest cumulative weight value corresponds to the first index of the second type prediction mode.
- the second index is not limited by the embodiment of this application.
- the decoder After the decoder obtains the index set of the second type intra prediction mode of the first predicted value through the sampling points of some or all of the predicted values in the first predicted value, the decoder converts the first predicted value into the first predicted value.
- the second index of the second type prediction mode corresponding to the largest cumulative weight value is determined as the first index of the second type intra prediction mode of the current block.
- IntraPredModeD is set to argmax i (HoG[i]).
- predModeIntra is updated and set to the index number indicating the PLANAR mode.
- the decoder may also determine the second type intra prediction value of the current block based on the candidate second type intra prediction mode; the candidate second type intra prediction mode includes the following intra prediction modes One or more: planar mode, DC mode, intra-frame angle prediction mode.
- the first index of the second type intra prediction mode of the current block is determined according to the first intra prediction value and the second type intra prediction value.
- the decoder calculates the difference between the MIP mode prediction value and the traditional intra prediction mode prediction value, selects the traditional intra prediction mode whose prediction value is closest to the MIP mode prediction value, and performs the selection according to the selected intra prediction mode Transform set and scan order used when LFNST.
- the decoder determines a first prediction error between the first intra prediction value and the second type intra prediction value; and determines the corresponding candidate second type when the first prediction error satisfies the first preset condition.
- the index value corresponding to the intra prediction mode is determined as the first index of the second type intra prediction mode of the current block.
- the decoder determines the first prediction error between the first intra prediction value and the second type intra prediction value in the following two ways:
- Method 1 Determine the first prediction difference between the first intra prediction value and the second type intra prediction value according to the first error criterion
- the first error criterion is one of the following error criteria: sum of absolute errors (SAD), sum of squared errors (SSD), mean absolute error (MAD) and mean square error (MSE); the first preset condition is the first prediction The error reaches a minimum.
- Method 2 Determine the first prediction difference between the first intra prediction value and the second type intra prediction value according to the second error criterion
- the second error criterion is one of the following error criteria: signal-to-noise ratio (SNR) and peak signal-to-noise ratio (PSNR); the first preset condition is that the first prediction error reaches a maximum value.
- SNR signal-to-noise ratio
- PSNR peak signal-to-noise ratio
- the implementation may include: based on the first type of intra prediction mode parameter, determine the current A first index of the second type of intra prediction mode of the block; based on the first index of the second type of intra prediction mode, the first transformation parameter of the current block is determined.
- the decoder determines the first index of the second type intra prediction mode of the current block based on the first type intra prediction mode parameters, including the following two methods:
- the decoder determines the first index of the second type intra prediction mode of the current block according to a first preset mapping relationship between the first type intra prediction mode parameter and the second type intra prediction mode index.
- the first type of intra prediction mode parameters include: a first type of intra prediction mode index; the first preset mapping relationship represents the corresponding relationship between the first type of intra prediction mode index and the second type of intra prediction mode index. ; The decoder determines the first index of the second type intra prediction mode from the first preset mapping relationship according to the first type intra prediction mode index.
- the decoder determines a first index of the second type intra prediction mode of the current block based on the first type intra prediction mode weighting matrix indicated by the first type intra prediction mode parameter.
- the decoder determines the gradient parameters of the weighting matrix of the first type of intra prediction mode; and determines the second type of intra prediction mode of the current block according to the gradient parameters of the weighting matrix of the first type of intra prediction mode. the first index.
- the MIP prediction mode is mapped to the traditional intra prediction mode, and the transformation set and scanning order used when performing LFNST are selected according to the mapped traditional intra prediction mode.
- the decoder determines the first transformation parameter of the current block based on the first index of the second type of intra prediction mode, including:
- the decoder maps the first type intra prediction mode to the traditional intra prediction mode by analyzing the first prediction value of the first type intra prediction mode for the transformation block using the first type intra prediction mode. (the second type of intra prediction mode), perform wide-angle mapping on the mapped traditional prediction mode, and then perform the transformation set (transformation matrix) and Selection of scan order.
- the MIP mode is mapped to the traditional intra prediction mode, the mapped traditional prediction mode is wide-angle mapped, and then the wide-angle mapped
- the traditional prediction mode selects the transformation set (transformation matrix) and scan order.
- MIP mode is used as an example to illustrate the use of LFNST technology. It should be noted that this application is also applicable to scenarios where extended LFNST technology is used.
- LFNST can be performed on the current block.
- these conditions include: (a) the width and height of the current block are both greater than or equal to 4; (b) the width and height of the current block are less than or equal to the maximum size of the transform block; (c) the current block or the current coding block
- the prediction mode is intra prediction mode; (d) the primary transformation of the current block is a two-dimensional forward primary transformation (DCT2) in both the horizontal and vertical directions; (e) the current block or the intra frame of the coding block where the current block is located
- DCT2 two-dimensional forward primary transformation
- the prediction mode is non-MIP mode or the prediction mode of the transform block is MIP mode and the width and height of the transform block are both greater than or equal to 16. That is to say, for the current block in the embodiment of this application, the above five conditions need to be satisfied at the same time.
- the current block when it is determined that the current block can execute LFNST, it is also necessary to determine the LFNST transformation kernel used by the current block (which can be represented by kernel).
- LFNST transformation kernel used by the current block which can be represented by kernel.
- These four transformation kernel candidate sets can include set0, set1, set2 and set3.
- the selected transform core candidate set can be implicitly derived; for example, in the current H.266/VVC, according to the intra prediction mode of the current block, it can be determined to use Which of the four transform kernel candidate sets transforms the kernel candidate set.
- the initial value of the intra prediction mode (which can be represented by predModeIntra) can be determined.
- the calculation formula is as follows,
- the image component indicator (can be represented by cIdx) is used to indicate the luminance component or chrominance component of the current block; here, if the current block predicts the luminance component, then cIdx is equal to 0; if the current block predicts the chrominance component , then cIdx is equal to 1.
- (xTbY,yTbY) is the coordinate of the upper left corner sampling point of the current block
- IntraPredModeY[xTbY][yTbY] is the intra prediction mode of the luminance component
- IntraPredModeC[xTbY][yTbY] is the intra prediction mode of the chroma component.
- the value of the LFNST index number can be used to indicate whether the current block uses LFNST and the index number of the LFNST transformation core in the LFNST transformation core candidate set. Specifically, after parsing the LFNST index sequence number, when the value of the LFNST index sequence number is equal to 0, it indicates that the current block does not use LFNST; and when the value of the LFNST index sequence number is greater than 0, it indicates that the current block uses LFNST, and The index number of the transformation core is equal to the value of the LFNST index number, or the value of the LFNST index number minus 1.
- intra prediction modes can be divided into traditional intra prediction modes and non-traditional intra prediction modes.
- the information indicated by the predModeIntra value is as follows:
- predModeIntra can be INTRA_LT_CCLM, INTRA_L_CCLM or INTRA_T_CCLM (81, 82, 83 respectively in VVC);
- the value of predModeIntra can be the index number of the MIP mode used
- predModeIntra can be [0,66].
- predModeIntra if the prediction mode of the current block is CCLM mode or MIP mode, you can also use the following method to set the value of predModeIntra:
- the mode of the center brightness block corresponding to the brightness position of the current block is MIP mode, that is, intra_mip_flag[xTbY+nTbW/2][yTbY+nTbH/2] is 1, then set the value of predMode Intra to Indicates the index number of PLANAR mode (i.e. 0);
- the value of predModeIntra is set to the index number indicating the direct current (DC) mode ( That is 1);
- predModeIntra the value of predModeIntra to the value IntraPredModeY[xTbY+nTbW/2][yTbY+nTbH/2] of the mode index number of the center brightness block corresponding to the brightness position of the current block (such as the chroma block);
- intra_mip_flag[xTbY][yTbY] is 1 and cIdx is 0, it indicates that the prediction mode of the current transform block is MIP mode.
- the prediction value of MIP mode is analyzed, and a traditional intra prediction is derived based on the prediction value of MIP mode. mode, and maps predModeIntra to this traditional intra prediction mode.
- mapping process For the traditional intra prediction mode, wide-angle mapping can be performed according to the size of the current block, extending the traditional intra prediction mode [0, 66] to [-14, 80]; the mapping process is as follows:
- the selection of the transformation kernel or transformation matrix is more flexible, which not only improves the applicability of the non-traditional intra prediction mode (the first type of intra prediction mode), but also improves the decoding efficiency , and can also improve video image quality.
- the decoder may determine the second transformation parameter corresponding to the first transformation parameter according to a preset first mapping table between the first transformation parameter and the second transformation parameter.
- the second transformation parameter includes at least one of the following: a transformation core index parameter (referring to a transformation coefficient matrix index) and a scanning order parameter of the transformation parameter; wherein the transformation core index parameter indicates the transformation parameter used in the decoding process of the current block.
- Transform kernel indicates the scan order of the transformation parameters, and the scan order includes horizontal order and vertical order.
- the transformation kernel index parameter refers to the transformation coefficient matrix index, which can be obtained directly from the code stream, or the decoding end can determine the transformation set (that is, the transformation kernel candidate set), and then obtain the transformation kernel from the code stream before transforming The index number in the kernel candidate set.
- MIP mode is used as an example to illustrate the use of LFNST technology. It should be noted that this application is also applicable to scenarios where extended LFNST technology is used.
- the value of the LFNST index sequence number (which can be represented by SetIdx) can be determined.
- the specific value is shown in Table 1.
- the value of the LFNST index number is set to an index number indicating that the current block uses LFNST and the LFNST transform core is in the LFNST transform core candidate set.
- the LFNST transformation set includes four transformation kernel candidate sets (set0, set1, set2, set3), which correspond to the values of SetIdx as 0, 1, 2, and 3 respectively.
- the LFNST transformation core candidate set can be first determined based on the MIP parameters or the first prediction value, and then the LFNST index sequence number is obtained from the code stream, and the current block is determined from the LFNST transformation core candidate set based on the LFNST index sequence number.
- the transformation matrix of LFNST is a plurality of fixed coefficient matrices obtained through training.
- the LFNST transformation kernel candidate set includes two sets of transformation matrices (which can also be called LFNST transformation kernels). After the LFNST transformation kernel candidate set is determined, it is necessary to Select a set of LFNST transform kernels from the LFNST transform kernel candidate set, that is, the transformation matrix used to determine the LFNST of the current block.
- each LFNST transformation kernel candidate set includes three sets of transformation matrices, which will not be discussed here.
- the MIP mode index number can be converted into the LFNST intra prediction mode index number, that is, the value of the first index of the second type of intra prediction mode (which can be represented by predModeIntra) ; Then according to the value of predModeIntra, select one LFNST transformation core candidate set from multiple LFNST transformation core candidate sets to determine the transformation core candidate set; and in the selected LFNST transformation core candidate set, select the LFNST index sequence number indication
- the transformation kernel is set to the LFNST transformation kernel used by the current block.
- LFNST when the value of the LFNST index sequence number is equal to 0, LFNST will not be used; and when the value of the LFNST index sequence number is greater than 0, LFNST will be used, and the index sequence number of the transformation core is equal to LFNST
- the transform coefficients include: quantization coefficients.
- the decoder performs inverse quantization on the quantized coefficient to obtain the first transform coefficient; converts the first transform coefficient to obtain the first transform coefficient vector; and uses the transform matrix indicated by the transform kernel index parameter to transform the first transform coefficient.
- the transformation coefficient vector is transformed to obtain the second transformation coefficient vector; the second transformation coefficient vector is transformed using the scanning order parameter of the transformation parameter to obtain the second transformation coefficient;
- the decoder can determine the reconstruction value of the current block based on the residual value and the first predicted value.
- the transformation matrix selected by the current block can be obtained, and at this time, the prediction difference can be transformed.
- each set of transformation matrices can also include two sizes of basic transformation matrices T, such as 16x16 and 16x48.
- T basic transformation matrices
- an 8x16 transformation matrix will be used as for the transformation matrix selected for TUs of four sizes.
- the 8x16 transformation matrix comes from the first 8x16 of the 16x16 basic transformation matrix; for 4xN or For Nx4 (N>4) size TU, the 16x16 basic transformation matrix will be used; for the 8x8 size TU, the 8x48 transformation matrix will be used.
- the 8x48 transformation matrix comes from the first 8x48 of the 16x48 basic transformation matrix; for sizes larger than 8x8 TU, a 16x48 basic transformation matrix will be used.
- LFNST applies inseparable transformations based on direct matrix multiplication.
- a simplified inseparable transformation technology is used in the LFNST transformation.
- the main idea of the simplified inseparable transformation technology is to map N-dimensional vectors to R-dimensional vectors in different spaces.
- N/R (R ⁇ N) is the scaling factor; at this time, the transformation corresponding to the simplified inseparable transformation technology
- the matrix is an R ⁇ N matrix, as shown below,
- FIG. 5 shows a schematic structural diagram of the calculation process of matrix multiplication of an LFNST technology provided by an embodiment of the present application.
- (a) shows the calculation process of the forward LFNST transform. After the primary transformation coefficient passes through the transformation matrix T, the secondary transformation coefficient can be obtained;
- (b) shows the calculation process of the reverse LFNST transform.
- the inverse quadratic transformation coefficient passes through the transposed transformation matrix T T , the inverse primary transformation coefficient can be obtained.
- 16 coefficients will be input, and after forward LFNST, 16 or 8 coefficients will be output; while on the decoder side, 16 coefficients will be input or 8 coefficients, 16 coefficients will be output; that is, the encoder and decoder are exactly opposite in terms of the number of inputs and outputs.
- Transform unit TU
- nTbW ⁇ nTbH the size of the transform block
- the transform block is a prediction residual block obtained based on the prediction difference. That is, TU can be equal to 4 ⁇ 4, or it can be equal to 4 ⁇ N or N ⁇ 4 (N>4). They are described in detail below.
- the forward LFNST process corresponding to the 4 ⁇ 4 transform block is shown in Figure 6A.
- the white block is the prediction difference value
- the gray block is the primary transform coefficient
- the black block is the secondary transform coefficient; here, at the position of the "0" example, the encoder sets the transform coefficient to 0.
- the size of the transformation matrix used is 8 ⁇ 16. All the 4 ⁇ 4 primary transform coefficients in the current transform block are used as input, and the output is 4 ⁇ 2 secondary transform coefficients.
- the forward LFNST process corresponding to the 4 ⁇ N or N ⁇ 4 transform block is shown in Figure 6B.
- the white block is the prediction difference
- the gray block is the primary transform coefficient
- the black block is the secondary transform coefficient; here, for the 4 ⁇ N or N ⁇ 4 transform block, when forward LFNST, use
- the transformation matrix size is 16 ⁇ 16
- the first 4 ⁇ 4 sub-block within the current transform block specifically, the uppermost sub-block for the 4 ⁇ N transform block, and the leftmost sub-block for the N ⁇ 4 transform block
- the primary transformation coefficients within are taken as input, and the output is 4 ⁇ 4 secondary transformation coefficients.
- the encoder sets the transform coefficient still to 0.
- the forward LFNST process corresponding to the 8 ⁇ 8 transform block is shown in Figure 6C.
- the white block is the prediction difference
- the gray block is the primary transformation coefficient
- the black block is the secondary transformation coefficient
- the size of the transformation matrix used in forward LFNST is 8 ⁇ 48.
- the primary transformation coefficients of the first three 4 ⁇ 4 sub-blocks (ie, the three sub-blocks located in the upper left corner) in the current transformation block are used as input, and the output is 4 ⁇ 2 secondary transformation coefficients.
- the encoder sets the transform coefficient still to 0.
- the forward LFNST process corresponding to the transform block larger than 8 ⁇ 8 is shown in Figure 6D.
- the white block is the prediction difference
- the gray block is the primary transformation coefficient
- the black block is the secondary transformation coefficient
- the transformation matrix size used is 48 ⁇ 16
- the primary transform coefficients of the first three 4 ⁇ 4 sub-blocks (i.e., the three sub-blocks located in the upper left corner) in the current transform block are used as input
- the output is 4 ⁇ 4 secondary transform coefficients.
- the encoder sets the transform coefficient still to 0.
- the value of the LFNST index sequence number (lfnst_idx) is obtained by parsing the code stream; according to the value of lfnst_idx, the LFNST transformation core candidate set indicated by lfnst_idx can be selected Transformation matrix (transformation kernel). For example, when lfnst_idx is 1, the first set of transformation matrices can be used as the LFNST transformation kernel during the decoding process; when lfnst_idx is 2, the second set of transformation matrices can be used as the LFNST transformation kernel during the decoding process.
- each set of transformation matrices there are two sizes of basic transformation matrices.
- the sizes of the basic transformation matrices used on the decoder side are 16 ⁇ 16 and 48 ⁇ 16. Select based on nLfnstOutSzie. If nLfnstOutSzie is 16, select a 16x16 basic transformation matrix; or if nLfnstOutSzie is 48, select a 48x16 basic transformation matrix. Alternatively, if nonZeroSize is 8, only the first 8 rows of the transformation matrix are used for matrix multiplication calculations.
- the secondary transformation coefficient vector u[i] is taken as input, and the transformation matrix is used to multiply it to obtain the primary transformation coefficient vector v[j].
- i 0,1,...,nonZeroSize-1
- j 0 ,1,...,nLfnstOutSzie-1.
- the specific calculation process of v[j] is as follows,
- Clip3 works for clamping, which can limit the value of the coefficient to between the following two numbers, as shown below,
- the specific process of LFNST can be divided into four steps: configuring core parameters 81, intra prediction mode mapping 82, selecting transformation matrix 83, calculating matrix multiplication 84 and constructing a primary transformation coefficient matrix 85, etc.
- this step is used to determine the value of predModeIntra, which can mainly include: non-traditional intra prediction mode mapping 821 and wide angle mapping 822; for selecting transformation matrix 83, this step
- the process for selecting a transformation set and a transformation matrix may mainly include: selecting a transformation set 831 , selecting a transformation matrix group 832 and selecting a transformation matrix size 833 .
- Transform block size nonZeroSize nLfnstOutSzie 4 ⁇ 4 8 16 4 ⁇ N or N ⁇ 4(N>4) 16 16 8 ⁇ 8 8 48 >8 ⁇ 8 16 48
- nLfnstSize also needs to be configured, which means that there will be a transformation coefficient only within the range of the first nLfnstSize ⁇ nLfnstSize in the current block.
- the value of nLfnstSize is as follows:
- the intra prediction mode of the brightness or chroma component of the current block or the coding block where the current block is located can also be obtained.
- the value of predModeIntra can be determined, and the calculation formula is as shown above.
- the inverse quantized coefficients d[x][y] at this time are the secondary transform coefficients.
- the applicability of the LFNST technology to the current block using the MIP mode can be improved, making the selection of the transformation set (or transformation core) more flexible.
- the mapping between MIP and traditional intra prediction modes is established.
- the transformation set (transformation matrix) and scanning order are selected according to the mapped traditional prediction mode. This method is tested on ECM4.0 at 48 frame intervals under All Intra conditions, and can obtain -0.08%, 0.05%, and -0.10% BD-rate changes in Y, Cb, and Cr respectively (that is, under the same psnr average code rate change), thereby improving decoding efficiency.
- Figure 8 shows a schematic flow chart of a video encoding method provided by an embodiment of the present application. As shown in Figure 8, the method may include:
- each image block currently to be encoded can be called a coding block (CB).
- each encoding block may include a first image component, a second image component, and a third image component; and the current block is the encoding of the first image component, the second image component, or the third image component that is currently to be predicted in the video image. piece.
- the current block performs the first image component prediction, and the first image component is a brightness component, that is, the image component to be predicted is a brightness component, then the current block can also be called a brightness block; or, it is assumed that the current block performs the second image component prediction prediction, and the second image component is a chrominance component, that is, the image component to be predicted is a chrominance component, then the current block can also be called a chrominance block.
- the prediction mode parameter indicates the coding mode of the current block and parameters related to the mode.
- Rate Distortion Optimization can usually be used to determine the prediction mode parameters of the current block.
- determining the prediction mode parameters of the current block may include:
- the minimum rate distortion cost result is selected from the multiple calculated rate distortion cost results, and the prediction mode corresponding to the minimum rate distortion cost result is determined as the prediction mode parameter of the current block.
- multiple prediction modes can be used to separately encode the to-be-predicted image components for the current block.
- multiple prediction modes usually include traditional intra prediction modes and non-traditional intra prediction modes
- traditional intra prediction modes can include direct current (DC) mode, planar (PLANAR) mode, angle mode, etc.
- non-traditional intra prediction modes can include MIP mode, Cross-component Linear Model Prediction (CCLM) mode, Intra Block Copy (IBC) mode and PLT (Palette) mode, etc. .
- the rate distortion cost result corresponding to each prediction mode can be obtained; then the minimum rate distortion cost result is selected from the multiple rate distortion cost results obtained, and The prediction mode corresponding to the minimum rate distortion cost result is determined as the prediction mode parameter of the current block; in this way, the current block can be encoded using the determined prediction mode, and in this prediction mode, the prediction residual can be small , which can improve coding efficiency.
- S302. Determine the first predicted value of the current block according to the first type of intra prediction mode parameter, and calculate the residual value between the original value of the current block and the first predicted value.
- the decoder may determine the first transformation parameter of the current block based on the first prediction value of the current block.
- the decoder may also determine the first transformation parameter of the current block based on the first type intra prediction mode parameter of the current block, which is not limited by this embodiment of the present application.
- the implementation of determining the first transformation parameter of the current block may include:
- the decoder may determine the first index of the second type of intra prediction mode through the first prediction value of the current block, where the second type of intra prediction mode includes at least one of the following: planar mode, DC mode and intra angle prediction mode. The decoder may then determine the first transformation parameter of the current block based on the first index of the second type intra prediction mode of the current block.
- the first transformation parameter in the embodiment of the present application is the basis for determining the second transformation parameter, that is, the transformation core index parameter (referring to the transformation coefficient matrix index) and the scanning order parameter of the transformation parameter.
- the decoder can map the non-traditional intra prediction mode to the traditional intra prediction mode and determine the first transformation parameter of the current block through the first index of the traditional intra prediction mode, thereby making the current block in
- a flexible method corresponding to the traditional intra prediction mode can be used to select the second transformation parameter for parameter transformation, which improves the non-traditional intra prediction mode (the first type of intra prediction mode)
- the applicability also improves the encoding efficiency and can also improve the video image quality.
- the first predicted value may be the final predicted value obtained by using the first type of intra prediction mode for intra prediction, or may be the final predicted value obtained by using the first type of intra prediction mode for intra prediction.
- the intermediate forecast value during the forecast process may be the final predicted value obtained by using the first type of intra prediction mode for intra prediction.
- the first predicted value may be the final predicted value after upsampling during MIP prediction, or the intermediate predicted value before upsampling during MIP prediction, which is not limited in this embodiment of the application.
- the decoder may set the first transform parameter of the current block equal to the first index of the second type intra prediction mode of the current block.
- the implementation of S1 is as follows, including: S201. Based on the first prediction value, determine the index set of the second type of intra prediction mode of the first prediction value;
- the horizontal gradient value and the vertical gradient value of the sampling point corresponding to part or all of the predicted value are determined; according to the horizontal direction of the sampling point
- the gradient value and the vertical direction gradient value determine the index set of the second type intra prediction mode of the first prediction value.
- the encoder determines an index set of the second type intra prediction mode of the first predicted value based on the horizontal gradient value and vertical gradient value of the sampling point, including: (1) and (2).
- determining the gradient angle value of the sampling point based on the horizontal gradient value and vertical gradient value of the sampling point includes: based on the horizontal gradient value and vertical gradient value of the sampling point, and a preset function relationship to determine the gradient angle value of the sampling point.
- the preset functional relationship is the arctangent function; where the arctangent function is the ratio of the horizontal gradient value and the vertical gradient value of the sampling point;
- determining the gradient angle value of the sampling point based on the horizontal gradient value and vertical gradient value of the sampling point and a preset functional relationship includes: based on the arctangent function, The ratio of the horizontal gradient value and the vertical gradient value is processed to determine the gradient angle value of the sampling point.
- the preset functional relationship is a second mapping table between the gradient angle value of the sampling point and the horizontal gradient value and vertical gradient value of the sampling point;
- determining the gradient angle value of the sampling point based on the horizontal gradient value and vertical gradient value of the sampling point and a preset functional relationship includes: combining the horizontal gradient value of the sampling point and the vertical gradient value of the sampling point.
- the directional gradient value, or the ratio of the horizontal gradient value and the vertical gradient value of the sampling point is input into the second mapping table, and the gradient angle value of the sampling point is output.
- determining a second index of the second type of intra prediction mode corresponding to the gradient angle value according to the gradient angle value of the sampling point includes: from the index of the second type of intra prediction mode Among the directions of intra-frame angle prediction indicated by some or all of the allowed values, determine the second type of intra-frame prediction mode index value corresponding to the intra-frame angle prediction direction with the smallest angle between the direction indicated by the gradient angle value; The second index of the second type intra prediction mode of the gradient angle value is set to the second type intra prediction mode index value.
- the third mapping table represents the correspondence between the gradient angle values of different values or different value ranges and the second type intra prediction mode index.
- the encoder determines the gradient direction, first gradient intensity and pattern partition corresponding to the sampling point based on the horizontal gradient value and vertical gradient value of the sampling point; the gradient direction, first gradient intensity and pattern partition corresponding to the sampling point , determine the second index of the second type intra prediction mode; update the cumulative weight value corresponding to the determined second index of the second type intra prediction mode in the index set of the second type intra prediction mode.
- determining the gradient direction, first gradient intensity and pattern partition corresponding to the sampling point based on the horizontal gradient value and vertical gradient value of the sampling point includes: based on the horizontal gradient value of the sampling point and The vertical gradient value determines the first gradient strength of the sampling point; based on the horizontal gradient value and vertical gradient value of the sampling point, partition processing of the second type intra prediction mode is performed on the sampling point to determine the horizontal area index of the sampling point , vertical area index and gradient strength index; based on the horizontal area index, vertical area index and gradient intensity index of the sampling point, determine the pattern partition of the sampling point; based on the gradient intensity index of the sampling point, determine the gradient direction corresponding to the sampling point.
- the gradient direction, first gradient intensity and mode partition corresponding to the sampling point determine the second index of the second type intra prediction mode, including: determining the sampling point according to the gradient direction corresponding to the sampling point The gradient offset ratio of the sampling point is mapped to the preset mode offset range to obtain the intra prediction mode index offset of the sampling point; according to the fourth mapping of the preset mode partition and the mode index Table, determine the target second type intra prediction mode corresponding to the mode partition of the sampling point; combine the target second type intra prediction mode and the intra prediction mode index offset to determine the second type intra prediction mode of the sampling point the second index.
- updating a cumulative weight value in the index set of the second type intra prediction mode corresponding to the determined second index of the second type intra prediction mode includes: In the index set of modes, the cumulative weight value corresponding to the second index of the determined second type intra prediction mode is increased by a set value.
- the set value is equal to 1, or the set value is equal to the sum of the absolute value of the horizontal gradient value and the absolute value of the vertical gradient value.
- determining the first index of the second type of intra prediction mode of the current block based on the index set of the second type of intra prediction mode of the first prediction value includes: converting the second type of intra prediction mode of the current block to The first index of the intra prediction mode is set to the second index of the second prediction mode corresponding to the largest cumulative weight value in the index set of the second intra prediction mode of the first prediction value.
- determining the first index of the second type intra prediction mode of the current block based on the first prediction value of the current block includes: determining the first index of the current block according to the candidate second type intra prediction mode.
- the second type intra prediction value determine the first index of the second type intra prediction mode of the current block according to the first intra prediction value and the second type intra prediction value.
- the candidate second type intra prediction mode includes one or more of the following intra prediction modes: planar mode, DC mode, and intra angle prediction mode.
- a first prediction error between a first intra prediction value and a second type intra prediction value is determined; and a corresponding candidate second type intra prediction value when the first prediction error satisfies a first preset condition is determined.
- the index value corresponding to the prediction mode is determined as the first index of the second type intra prediction mode of the current block.
- Method 1 Determine the first prediction difference between the first intra prediction value and the second type intra prediction value according to the first error criterion
- the first error criterion is one of the following error criteria: sum of absolute errors (SAD), sum of squared errors (SSD), mean absolute error (MAD) and mean square error (MSE); the first preset condition is the first prediction The error reaches a minimum.
- Method 2 Determine the first prediction difference between the first intra prediction value and the second type intra prediction value according to the second error criterion
- the second error criterion is one of the following error criteria: signal-to-noise ratio (SNR) and peak signal-to-noise ratio (PSNR); the first preset condition is that the first prediction error reaches a maximum value.
- SNR signal-to-noise ratio
- PSNR peak signal-to-noise ratio
- the implementation may include: based on the first type of intra prediction mode parameter, determine the current A first index of the second type of intra prediction mode of the block; based on the first index of the second type of intra prediction mode, the first transformation parameter of the current block is determined.
- determining the first index of the second type intra prediction mode of the current block based on the first type intra prediction mode parameters includes two methods:
- the encoder determines a first index of the second type intra prediction mode of the current block based on a first preset mapping relationship between the first type intra prediction mode parameter and the second type intra prediction mode index.
- the first type of intra prediction mode parameters include: a first type of intra prediction mode index; the first preset mapping relationship represents the corresponding relationship between the first type of intra prediction mode index and the second type of intra prediction mode index;
- the encoder determines the second type of intra prediction mode of the current block according to the first preset mapping relationship between the first type of intra prediction mode parameter and the second type of intra prediction mode index.
- An index includes: determining the first index of the second type of intra prediction mode from the first preset mapping relationship according to the first type of intra prediction mode index.
- the encoder determines a first index of the second type intra prediction mode of the current block based on the first type intra prediction mode weighting matrix indicated by the first type intra prediction mode parameter.
- the encoder determines the first index of the second type intra prediction mode of the current block based on the first type intra prediction mode weight matrix indicated by the first type intra prediction mode parameter, including: Determine the gradient parameter of the weighting matrix of the first type of intra prediction mode; determine the first index of the second type of intra prediction mode of the current block according to the gradient parameter of the weighting matrix of the first type of intra prediction mode.
- the encoder determines the first transformation parameter of the current block based on the first index of the second type of intra prediction mode, including: performing wide-angle mapping on the first index of the second type of intra prediction mode, and determining the wide-angle prediction Mode index; based on the wide-angle prediction mode index, determine the first transformation parameter.
- the encoder determines a second transform parameter for transforming the current block based on the first transform parameter, including: according to a preset first mapping between the first transform parameter and the second transform parameter. table to determine the second transformation parameter corresponding to the first transformation parameter.
- the second transformation parameter includes at least one of the following: a transformation core index parameter (referring to a transformation coefficient matrix index) and a scanning order parameter of the transformation parameter; wherein the transformation core index parameter indicates the transformation parameter used in the decoding process of the current block.
- Transform kernel indicates the scan order of the transformation parameters, and the scan order includes horizontal order and vertical order.
- performing transformation processing on the residual value based on the second transformation parameter to obtain the transformation coefficient of the current block includes: transforming the residual value to obtain a second Transform coefficient; use the scanning order parameter of the transformation parameter to convert the second transformation coefficient to obtain a second transformation coefficient vector; use the transformation matrix indicated by the transformation core index parameter to convert the second transformation coefficient vector Perform transformation to obtain a first transform coefficient vector; transform the first transform coefficient vector to obtain a first transform coefficient; quantize the first transform coefficient to obtain a quantized coefficient of the current block, and the quantized coefficient is the current block The transform coefficients of the block.
- the description and explanation of the first index used by the encoder to determine the second type of intra prediction mode are consistent with those of the decoder, and will not be described again here.
- the difference is that the prediction mode parameter indicates the coding mode of the current block and parameters related to this mode.
- the encoder can use rate distortion optimization (Rate Distortion Optimization, RDO) to determine the prediction mode parameters of the current block.
- RDO Rate Distortion Optimization
- the encoder determines the LFNST transform core used in the current block, sets the LFNST index number and writes it into the video stream.
- the rate-distortion optimization method can be used to select the transform kernel used in the current block.
- the rate distortion cost (Rate Distortion Cost, RDCost) can be calculated for each transformation kernel using rate distortion optimization, and then the transformation kernel with the smallest rate distortion cost is selected as the transformation kernel used in the current block. That is to say, on the encoder side, a group of LFNST transformation cores can be selected through RDCost, and the index number corresponding to the LFNST transformation core (which can be represented by lfnst_idx) is written into the video code stream and transmitted to the decoder side.
- the selection of the transformation kernel or transformation matrix is more flexible, which not only improves the applicability of the non-traditional intra prediction mode (the first type of intra prediction mode), but also improves the coding efficiency , and can also improve video image quality.
- FIG. 9 shows a schematic structural diagram of a decoder 1 provided by an embodiment of the present application.
- the decoder 1 may include:
- the decoding part 10 is configured to decode the code stream and determine the first type intra prediction mode parameters of the current block;
- the first prediction part 11 is configured to determine the first prediction value of the current block according to the first type intra prediction mode parameter
- the first determining part 12 is configured to determine the first transform parameter of the current block based on the first predicted value of the current block or the first type intra prediction mode parameter; and based on the first transform parameter , determine the second transformation parameter for transforming the current block;
- the first transformation part 13 is configured to perform transformation processing on the transformation coefficient of the current block based on the second transformation parameter, and determine the residual value of the current block;
- the reconstruction part 14 is configured to determine a reconstruction value of the current block based on the residual value and the first predicted value.
- determining the first transformation parameter of the current block based on the first prediction value of the current block or the first type of intra prediction parameter includes:
- a first transform parameter of the current block is determined based on a first index of the second type of intra prediction mode of the current block.
- determining the first transformation parameter of the current block based on the first prediction value of the current block or the first type of intra prediction parameter includes:
- a first transform parameter of the current block is determined based on a first index of the second type of intra prediction mode.
- the second type of intra prediction mode includes at least one of the following: planar mode, direct current mode, and intra angle prediction mode.
- the first determining part 12 is further configured to set the first transformation parameter of the current block to be equal to the second type of intra prediction mode of the current block. an index.
- the first transformation part 13 is also configured to determine the relationship between the first transformation parameter and the second transformation parameter according to the preset first mapping table between the first transformation parameter and the second transformation parameter. The corresponding second transformation parameter.
- the second transformation parameter includes at least one of the following: a transformation core index parameter and a scanning order parameter of the transformation parameter; wherein the transformation core index parameter indicates the transformation parameter of the current block The transformation kernel used in the decoding process; the scanning order parameter indicates the scanning order of the transformation parameters, and the scanning order includes horizontal order and vertical order.
- the first determining part 12 is further configured to determine an index set of the second type intra prediction mode of the first predicted value based on the first predicted value;
- the index set stores cumulative weight values corresponding to some or all allowed values of the index of the second type intra prediction mode.
- the first determining part 12 is further configured to determine, for some or all of the first predicted values, the sampling points corresponding to the partial or all predicted values.
- An index set of the second type intra prediction mode of the first prediction value is determined according to the horizontal gradient value and the vertical gradient value of the sampling point.
- the first determining part 12 is further configured to determine the gradient angle value of the sampling point according to the horizontal gradient value and the vertical gradient value of the sampling point. ;
- the first determining part 12 is further configured to determine the horizontal gradient value and the vertical gradient value of the sampling point and a preset functional relationship.
- the gradient angle value of the sampling point is further configured to determine the horizontal gradient value and the vertical gradient value of the sampling point and a preset functional relationship.
- the preset functional relationship is an arctangent function; wherein the arctangent function is the ratio of the horizontal gradient value and the vertical gradient value of the sampling point;
- the first determining part 12 is further configured to perform a calculation on the ratio of the horizontal gradient value and the vertical gradient value of the sampling point based on the arctangent function. Process to determine the gradient angle value of the sampling point.
- the preset functional relationship is a second mapping table between the gradient angle value of the sampling point and the horizontal gradient value and vertical gradient value of the sampling point;
- the first determining part 12 is also configured to determine the horizontal gradient value and the vertical gradient value of the sampling point, or the horizontal gradient value and the vertical gradient value of the sampling point.
- the ratio of gradient values is input into the second mapping table, and the gradient angle value of the sampling point is output.
- the first determining part 12 is further configured to predict a direction from an intra-frame angle indicated by part or all of the allowed values of the index of the second type of intra-frame prediction mode. , determine the second type intra prediction mode index value corresponding to the intra frame angle prediction direction with the smallest angle between the direction indicated by the gradient angle value;
- the second index of the second type intra prediction mode of the gradient angle value is set to the second type intra prediction mode index value.
- the first determining part 12 is further configured to determine, according to the third mapping table between the preset gradient angle value and the second type intra prediction mode index, the corresponding A second index of the gradient angle value of the second type of intra prediction mode.
- the third mapping table represents the correspondence between gradient angle values with different values or different value ranges and second type intra prediction mode indexes.
- the first determining part 12 is further configured to set the index of the second type of intra prediction mode, corresponding to the second index of the determined second type of intra prediction mode.
- the cumulative weight of the index is increased by the set value.
- the set value is equal to 1.
- the set value is equal to the sum of the absolute value of the horizontal gradient value and the absolute value of the vertical gradient value.
- the first determining part 12 is further configured to set the first index of the second type intra prediction mode of the current block to the second index of the first prediction value.
- the largest cumulative weight value corresponds to the second index of the second prediction mode.
- the first determining part 12 is further configured to determine the second type intra prediction value of the current block according to the candidate second type intra prediction mode;
- a first index of the second type intra prediction mode of the current block is determined according to the first intra prediction value and the second type intra prediction value.
- the candidate second type intra prediction mode includes one or more of the following intra prediction modes: planar mode, DC mode, and intra angle prediction mode.
- the first determination part 12 is further configured to determine a first prediction error between the first intra prediction value and the second type intra prediction value;
- the index value corresponding to the candidate second type intra prediction mode corresponding when the first prediction error satisfies the first preset condition is determined as the first index of the second type intra prediction mode of the current block.
- the first determining part 12 is further configured to determine the first difference between the first intra prediction value and the second type intra prediction value according to a first error criterion. a forecast difference;
- the first error criterion is one of the following error criteria: sum of absolute errors, sum of square errors, mean absolute error and mean square error; the first preset condition is that the first prediction error reaches a minimum value.
- the first determining part 12 is further configured to determine the third difference between the first intra prediction value and the second type intra prediction value according to a second error criterion. a forecast difference;
- the second error criterion is one of the following error criteria: signal-to-noise ratio and peak signal-to-noise ratio; the first preset condition is that the first prediction error reaches a maximum value.
- the first determining part 12 is further configured to determine the gradient direction corresponding to the sampling point based on the horizontal gradient value and the vertical gradient value of the sampling point. , first gradient strength and pattern partitioning;
- the gradient direction, the first gradient intensity and the mode partition corresponding to the sampling point determine the second index of the second type of intra prediction mode
- the first determining part 12 is further configured to determine the third gradient value of the sampling point based on the horizontal gradient value and the vertical gradient value of the sampling point. -Gradient strength;
- the gradient direction corresponding to the sampling point is determined.
- the first determining part 12 is also configured to determine the gradient offset ratio of the sampling point according to the gradient direction corresponding to the sampling point;
- a second index of the second type intra prediction mode of the sampling point is determined.
- the first determining part 12 is further configured to determine the first preset mapping relationship between the first type of intra prediction mode parameter and the second type of intra prediction mode index. The first index of the second type of intra prediction mode for the current block.
- the first type of intra prediction mode parameters include: a first type of intra prediction mode index; the first preset mapping relationship represents the first type of intra prediction mode index and the second type of intra prediction mode index. Correspondence between class intra prediction mode indexes;
- the first determining part 12 is further configured to determine the first index of the second type of intra prediction mode from the first preset mapping relationship according to the first type of intra prediction mode index.
- the first determining part 12 is further configured to determine the weight matrix of the current block based on the first type intra prediction mode weighting matrix indicated by the first type intra prediction mode parameter.
- the first index of the second type of intra prediction mode is further configured to determine the weight matrix of the current block based on the first type intra prediction mode weighting matrix indicated by the first type intra prediction mode parameter.
- the first determining part 12 is further configured to determine the gradient parameters of the first type intra prediction mode weighting matrix
- the first index of the second type intra prediction mode of the current block is determined according to the gradient parameter of the first type intra prediction mode weighting matrix.
- the first determining part 12 is further configured to perform wide-angle mapping on the first index of the second type of intra prediction mode, and determine the wide-angle prediction mode index;
- the first transform parameter is determined based on the wide angle prediction mode index.
- the transform coefficient includes: a quantized coefficient; the first transform part 13 is also configured to perform inverse quantization on the quantized coefficient to obtain a first transform coefficient;
- the first transformation coefficient vector is transformed to obtain a second transformation coefficient vector
- FIG. 10 shows a schematic structural diagram of a decoder provided by an embodiment of the present application.
- the decoder may include:
- first memory 1002 configured to store a computer program running on the first processor
- the first processor 1003 is configured to execute the decoder method when running the computer program.
- the decoder also includes: a first communication interface 1001; the first communication interface 1001 is used for receiving and sending signals during the process of sending and receiving information with other external network elements.
- the various components are coupled together through a first bus system 1004 .
- the first bus system 1004 is used to implement connection communication between these components.
- the first bus system 1004 also includes a power bus, a control bus and a status signal bus.
- various buses are labeled as the first bus system 1004 in FIG. 10 .
- the first memory 1002 in the embodiment of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories.
- non-volatile memory can be read-only memory (Read-Only Memory, ROM), programmable read-only memory (Programmable ROM, PROM), erasable programmable read-only memory (Erasable PROM, EPROM), electrically removable memory. Erase programmable read-only memory (Electrically EPROM, EEPROM) or flash memory.
- Volatile memory may be Random Access Memory (RAM), which is used as an external cache.
- RAM static random access memory
- DRAM dynamic random access memory
- DRAM synchronous dynamic random access memory
- SDRAM double data rate synchronous dynamic random access memory
- Double Data Rate SDRAM DDRSDRAM
- enhanced SDRAM ESDRAM
- Synchlink DRAM SLDRAM
- Direct Rambus RAM DRRAM
- the first memory 1002 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
- the first processor 1003 may be an integrated circuit chip with signal processing capabilities. During the implementation process, each step of the above method can be completed by instructions in the form of hardware integrated logic circuits or software in the first processor 1003 .
- the above-mentioned first processor 1003 can be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or a ready-made programmable gate array (Field Programmable Gate Array, FPGA). or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
- DSP Digital Signal Processor
- ASIC Application Specific Integrated Circuit
- FPGA Field Programmable Gate Array
- a general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
- the steps of the method disclosed in conjunction with the embodiments of the present application can be directly implemented by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor.
- the software module can be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other mature storage media in this field.
- the storage medium is located in the first memory 1002.
- the first processor 1003 reads the information in the first memory 1002 and completes the steps of the above method in combination with its hardware.
- the embodiments described in this application can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof.
- the processing unit can be implemented in one or more Application Specific Integrated Circuits (ASIC), Digital Signal Processing (DSP), Digital Signal Processing Device (DSP Device, DSPD), programmable Logic device (Programmable Logic Device, PLD), Field-Programmable Gate Array (FPGA), general-purpose processor, controller, microcontroller, microprocessor, and other devices used to perform the functions described in this application electronic unit or combination thereof.
- ASIC Application Specific Integrated Circuits
- DSP Digital Signal Processing
- DSP Device Digital Signal Processing Device
- DSPD Digital Signal Processing Device
- PLD programmable Logic Device
- FPGA Field-Programmable Gate Array
- the technology described in this application can be implemented through modules (such as procedures, functions, etc.) that perform the functions described in this application.
- Software code may be stored in memory and executed by a processor.
- the memory can be implemented in the processor or external to the processor.
- the first processor 1003 is further configured to perform the method described in any one of the preceding embodiments when running the computer program.
- FIG. 11 shows a schematic structural diagram of an encoder 2 provided by an embodiment of the present application.
- the encoder 2 may include:
- the second determining part 20 is configured to determine the first type of intra prediction mode parameters
- the second prediction part 21 is configured to determine the first prediction value of the current block according to the first type intra prediction mode parameter
- the second determining part 20 is further configured to calculate a residual value between the original value of the current block and the first predicted value; and according to the first predicted value of the current block or the first type of frame intra prediction mode parameters, determining a first transformation parameter of the current block; and based on the first transformation parameter, determining a second transformation parameter for transforming the current block;
- the second transformation part 22 is configured to perform transformation processing on the residual value based on the second transformation parameter to obtain the transformation coefficient of the current block.
- the second determining part 20 is further configured to determine the first index of the second type intra prediction mode of the current block based on the first prediction value of the current block;
- a first transform parameter of the current block is determined based on a first index of the second type of intra prediction mode of the current block.
- determining the first transformation parameter of the current block based on the first prediction value of the current block or the first type of intra prediction parameter includes:
- a first transform parameter of the current block is determined based on a first index of the second type of intra prediction mode.
- the second type of intra prediction mode includes at least one of the following: planar mode, direct current mode, and intra angle prediction mode.
- the second determining part 20 is further configured to set the first transformation parameter of the current block to be equal to the second type of intra prediction mode of the current block. an index.
- the second transformation part 22 is also configured to determine the relationship between the first transformation parameter and the first transformation parameter according to the preset first mapping table between the first transformation parameter and the second transformation parameter. The corresponding second transformation parameter.
- the second transformation parameter includes at least one of the following: a transformation core index parameter and a scanning order parameter of the transformation parameter; wherein the transformation core index parameter indicates the transformation parameter of the current block The transformation kernel used in the decoding process; the scanning order parameter indicates the scanning order of the transformation parameters, and the scanning order includes horizontal order and vertical order.
- the second determining part 20 is further configured to determine an index set of the second type of intra prediction mode of the first predicted value based on the first predicted value;
- the index set stores cumulative weight values corresponding to some or all allowed values of the index of the second type intra prediction mode.
- the second determining part 20 is further configured to determine, for some or all of the first predicted values, the sampling points corresponding to the partial or all predicted values.
- An index set of the second type intra prediction mode of the first prediction value is determined according to the horizontal gradient value and the vertical gradient value of the sampling point.
- the second determining part 20 is further configured to determine the gradient angle value of the sampling point according to the horizontal gradient value and the vertical gradient value of the sampling point. ;
- the second determining part 20 is further configured to determine the horizontal gradient value and the vertical gradient value of the sampling point and a preset functional relationship.
- the gradient angle value of the sampling point is further configured to determine the horizontal gradient value and the vertical gradient value of the sampling point and a preset functional relationship.
- the preset functional relationship is an arctangent function; wherein the arctangent function is the ratio of the horizontal gradient value and the vertical gradient value of the sampling point;
- the second determining part 20 is further configured to perform a calculation on the ratio of the horizontal gradient value and the vertical gradient value of the sampling point based on the arctangent function. Process to determine the gradient angle value of the sampling point.
- the preset functional relationship is a second mapping table between the gradient angle value of the sampling point and the horizontal gradient value and vertical gradient value of the sampling point;
- the second determining part 20 is further configured to determine the horizontal gradient value and the vertical gradient value of the sampling point, or the horizontal gradient value and the vertical gradient value of the sampling point.
- the ratio of gradient values is input into the second mapping table, and the gradient angle value of the sampling point is output.
- the second determining part 20 is further configured to predict a direction from an intra-frame angle indicated by part or all of the allowed values of the index of the second type of intra-frame prediction mode. , determine the second type intra prediction mode index value corresponding to the intra frame angle prediction direction with the smallest angle between the direction indicated by the gradient angle value;
- the second index of the second type intra prediction mode of the gradient angle value is set to the second type intra prediction mode index value.
- the second determining part 20 is further configured to determine, according to the third mapping table between the preset gradient angle value and the second type intra prediction mode index, the corresponding A second index of the gradient angle value of the second type of intra prediction mode.
- the third mapping table represents the correspondence between gradient angle values with different values or different value ranges and second type intra prediction mode indexes.
- the second determining part 20 is further configured to set the index of the second type of intra prediction mode, corresponding to the second index of the determined second type of intra prediction mode.
- the cumulative weight of the index is increased by the set value.
- the set value is equal to 1.
- the set value is equal to the sum of the absolute value of the horizontal gradient value and the absolute value of the vertical gradient value.
- the second determining part 20 is further configured to set the first index of the second type intra prediction mode of the current block to the second index of the first prediction value.
- the largest cumulative weight value corresponds to the second index of the second prediction mode.
- the second determining part 20 is further configured to determine the second type intra prediction value of the current block according to the candidate second type intra prediction mode;
- a first index of the second type intra prediction mode of the current block is determined according to the first intra prediction value and the second type intra prediction value.
- the candidate second type intra prediction mode includes one or more of the following intra prediction modes: planar mode, DC mode, and intra angle prediction mode.
- the second determination part 20 is further configured to determine a first prediction error between the first intra prediction value and the second type intra prediction value;
- the index value corresponding to the candidate second type intra prediction mode corresponding when the first prediction error satisfies the first preset condition is determined as the first index of the second type intra prediction mode of the current block.
- the second determining part 20 is further configured to determine the first difference between the first intra prediction value and the second type intra prediction value according to a first error criterion. a forecast difference;
- the first error criterion is one of the following error criteria: sum of absolute errors, sum of square errors, mean absolute error and mean square error; the first preset condition is that the first prediction error reaches a minimum value.
- the second determining part 20 is further configured to determine the third difference between the first intra prediction value and the second type intra prediction value according to a second error criterion. a forecast difference;
- the second error criterion is one of the following error criteria: signal-to-noise ratio and peak signal-to-noise ratio; the first preset condition is that the first prediction error reaches a maximum value.
- the second determining part 20 is further configured to determine the gradient direction corresponding to the sampling point based on the horizontal gradient value and the vertical gradient value of the sampling point. , first gradient strength and pattern partitioning;
- the gradient direction, the first gradient intensity and the mode partition corresponding to the sampling point determine the second index of the second type of intra prediction mode
- the second determining part 20 is further configured to determine the third gradient value of the sampling point based on the horizontal gradient value and the vertical gradient value of the sampling point. -Gradient strength;
- the gradient direction corresponding to the sampling point is determined.
- the second determining part 20 is further configured to determine the gradient offset ratio of the sampling point according to the gradient direction corresponding to the sampling point;
- a second index of the second type intra prediction mode of the sampling point is determined.
- the second determining part 20 is further configured to determine the first preset mapping relationship between the first type of intra prediction mode parameter and the second type of intra prediction mode index. The first index of the second type of intra prediction mode for the current block.
- the first type of intra prediction mode parameters include: a first type of intra prediction mode index; the first preset mapping relationship represents the first type of intra prediction mode index and the second type of intra prediction mode index. Correspondence between class intra prediction mode indexes;
- the second determining part 20 is further configured to determine the first index of the second type of intra prediction mode from the first preset mapping relationship according to the first type of intra prediction mode index.
- the second determining part 20 is further configured to determine the weight matrix of the current block based on the first type intra prediction mode weighting matrix indicated by the first type intra prediction mode parameter. The first index of the second type of intra prediction mode.
- the second determining part 20 is further configured to determine the gradient parameters of the first type intra prediction mode weighting matrix
- the first index of the second type intra prediction mode of the current block is determined according to the gradient parameter of the first type intra prediction mode weighting matrix.
- the second determining part 20 is further configured to perform wide-angle mapping on the first index of the second type of intra prediction mode, and determine the wide-angle prediction mode index;
- the first transform parameter is determined based on the wide angle prediction mode index.
- the second transformation part 22 is also configured to transform the residual value to obtain a second transformation coefficient
- the second transformation coefficient vector is transformed to obtain a first transformation coefficient vector
- the first transform coefficient is quantized to obtain a quantized coefficient of the current block, and the quantized coefficient is the transform coefficient of the current block.
- FIG. 12 shows a schematic structural diagram of an encoder provided by an embodiment of the present application.
- the encoder may include: a second communication interface 1201 , a second memory 1202 and a second processor 1203 ; the various components are coupled together through a second bus system 1204 .
- the second bus system 1204 is used to implement connection communication between these components.
- the second bus system 1204 also includes a power bus, a control bus and a status signal bus.
- various buses are labeled as second bus system 1204 in FIG. 12 . in,
- the second communication interface 1201 is used for receiving and sending signals during the process of sending and receiving information with other external network elements;
- a second memory 1202 configured to store a computer program running on the second processor
- the second processor 1201 is configured to execute the method described by the encoder when running the computer program.
- Embodiments of the present application provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, which implements the method described in the decoder when executed by a first processor, or is executed by a third processor.
- the second processor implements the method described by the encoder when executed.
- the first predicted value of the current block is determined based on the first type of intra prediction mode parameter; the first predicted value of the current block is determined based on the first predicted value of the current block or the first type of intra prediction mode parameter.
- Transform parameter based on the first transform parameter, determine the second transform parameter for transforming the current block; based on the second transform parameter, transform the transform coefficient of the current block to determine the residual value of the current block; based on the residual value and The first predicted value determines the reconstruction value of the current block.
- the transformation technology since the first prediction value of the current block or the first type of intra prediction mode parameter is introduced when performing LFNST transformation, the transformation technology , the selection of the transformation kernel or transformation matrix (corresponding to the second transformation parameter) is more flexible, which not only improves the applicability of the non-traditional intra prediction mode (the first type of intra prediction mode), but also improves the decoding efficiency. Can improve video image quality.
- the first type of intra prediction mode such as MIP
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
本申请实施例公开了一种视频编解码方法、编码器、解码器以及存储介质,该方法包括:确定第一类帧内预测模式参数;根据所述第一类帧内预测模式参数,确定所述当前块的第一预测值,并计算当前块的原始值与所述第一预测值之间的残差值;根据所述当前块的第一预测值或所述第一类帧内预测模式参数,确定所述当前块的第一变换参数;基于所述第一变换参数,确定对所述当前块进行变换的第二变换参数;基于所述第二变换参数,对所述残差值进行变换处理,得到当前块的变换系数。
Description
本申请实施例涉及图像处理技术领域,尤其涉及一种视频编解码方法、编码器、解码器及存储介质。
随着人们对视频显示质量要求的提高,高清和超高清视频等新视频应用形式应运而生。国际标组织ISO/IEC和ITU-T的联合视频研究组(Joint Video Exploration Team,JVET)制定了视频编码标准H.266/多功能视频编码(Versatile Video Coding,VVC)。H.266/VVC中包含了与编码块的编码模式相关联的变换技术。然而,该变换技术没有适配非角度预测的编码模式,降低了编码效率。
发明内容
本申请实施例提供一种视频编解码方法、编码器、解码器及存储介质,可以提高对非传统帧内预测模式的适用性,使得变换核的选择更加灵活,从而能够提高编解码效率。
本申请实施例的技术方案可以如下实现:
第一方面,本申请实施例提供了一种视频解码方法,应用于解码器,该方法包括:
解码码流,确定当前块的第一类帧内预测模式参数;
根据所述第一类帧内预测模式参数,确定所述当前块的第一预测值;
基于所述当前块的第一预测值或所述第一类帧内预测模式参数,确定所述当前块的第一变换参数;
基于所述第一变换参数,确定对所述当前块进行变换的第二变换参数;
基于所述第二变换参数,对所述当前块的变换系数进行变换处理,确定所述当前块的残差值;
基于所述残差值和所述第一预测值,确定所述当前块的重建值。
第二方面,本申请实施例提供了一种视频编码方法,应用于编码器,该方法包括:
确定第一类帧内预测模式参数;
根据所述第一类帧内预测模式参数,确定所述当前块的第一预测值,并计算当前块的原始值与所述第一预测值之间的残差值;
根据所述当前块的第一预测值或所述第一类帧内预测模式参数,确定所述当前块的第一变换参数;
基于所述第一变换参数,确定对所述当前块进行变换的第二变换参数;
基于所述第二变换参数,对所述残差值进行变换处理,得到当前块的变换系数。
第三方面,本申请实施例提供了一种解码器,包括:
解码部分,被配置为解码码流,确定当前块的第一类帧内预测模式参数;
第一预测部分,被配置为根据所述第一类帧内预测模式参数,确定所述当前块的第一预测值;
第一确定部分,被配置为基于所述当前块的第一预测值或所述第一类帧内预测模式参数,确定所述当前块的第一变换参数;及基于所述第一变换参数,确定对所述当前块进行变换的第二变换参数;
第一变换部分,被配置为基于所述第二变换参数,对所述当前块的变换系数进行变换处理,确定所述当前块的残差值;
重建部分,被配置为基于所述残差值和所述第一预测值,确定所述当前块的重建值。
第四方面,本申请实施例提供了一种编码器,该编码器包括:
第二确定部分,被配置为确定第一类帧内预测模式参数;
第二预测部分,被配置为根据所述第一类帧内预测模式参数,确定所述当前块的第一预测值;
所述第二确定部分,还被配置为计算当前块的原始值与所述第一预测值之间的残差值;及根据所述当前块的第一预测值或所述第一类帧内预测模式参数,确定所述当前块的第一变换参数;以及基于所述第一变换参数,确定对所述当前块进行变换的第二变换参数;
第二变换部分,被配置为基于所述第二变换参数,对所述残差值进行变换处理,得到当前块的变换系数。
第五方面,本申请实施例提供了一种解码器,包括:
第一存储器,被配置为存储在第一处理器上运行的计算机程序;
所述第一处理器,用于在运行所述计算机程序时,执行第一方面项所述的方法。
第六方面,本申请实施例提供了一种编码器,该编码器包括:
第二存储器,被配置为存储在第二处理器上运行的计算机程序;
所述第二处理器,被配置为在运行所述计算机程序时,执行第二方面所述的方法。
第七方面,本申请实施例提供了一种计算机可读存储介质,该计算机存储介质存储有计算机程序,所述计算机程序被第一处理器执行时实现如第二方面所述的方法、或者被第二处理器执行时实现如第一方面所述的方法。
本申请实施例提供了一种视频编解码方法、编码器、解码器及存储介质,通过根据第一类帧内预测模式参数,确定当前块的第一预测值;基于当前块的第一预测值或第一类帧内预测模式参数,确定当前块的第一变换参数;基于第一变换参数,确定对当前块进行变换的第二变换参数;基于第二变换参数,对当前块的变换系数进行变换处理,确定当前块的残差值;基于残差值和第一预测值,确定当前块的重建值。这样,针对采用第一类帧内预测模式(例如MIP)的当前块来说,由于在进行LFNST变换时引入了当前块的第一预测值或者第一类帧内预测模式参数,使得在变换技术中,变换核或者变换矩阵(对应第二变换参数)的选择更加灵活,从而不仅提高了非传统帧内预测模式(第一类帧内预测模式)的适用性,还提高了解码效率,同时还能够提升视频图像质量。
图1为相关技术方案提供的一种LFNST技术的应用位置示意图;
图2A为本申请实施例提供的一种视频编码系统的组成框图;
图2B为本申请实施例提供的一种视频解码系统的组成框图;
图3为本申请实施例提供的一种视频解码方法的流程示意图;
图4为本申请实施例提供的一种MIP预测过程的流程框图;
图5为本申请实施例提供的一种LFNST技术矩阵乘法的计算过程的结构示意图;
图6A为相关技术方案提供的一种LFNST变换的结构框图;
图6B为相关技术方案提供的另一种LFNST变换的结构框图;
图6C为相关技术方案提供的又一种LFNST变换的结构框图;
图6D为相关技术方案提供的再一种LFNST变换的结构框图;
图7为本申请实施例提供的一种LFNST具体过程的流程框图;
图8为本申请实施例提供的另一种视频编码方法的流程示意图;
图9为本申请实施例提供的一种解码器的组成结构示意图;
图10为本申请实施例提供的一种解码器的具体硬件结构示意图;
图11为本申请实施例提供的一种编码器的组成结构示意图;
图12为本申请实施例提供的一种编码器的具体硬件结构示意图。
为了能够更加详尽地了解本申请实施例的特点与技术内容,下面结合附图对本申请实施例的实现进行详细阐述,所附附图仅供参考说明之用,并非用来限定本申请实施例。
在视频图像中,一般采用第一图像分量、第二图像分量和第三图像分量来表征编码块(Coding Block,CB);其中,这三个图像分量分别为一个亮度分量、一个蓝色色度分量和一个红色色度分量。示例性的,亮度分量通常使用符号Y表示,蓝色色度分量通常使用符号Cb或者U表示,红色色度分量通常使用符号Cr或者V表示;这样,视频图像可以用YCbCr格式表示,也可以用YUV格式表示。除此之外,视频图像也可以是RGB格式、YcgCo格式等,本申请实施例不作限制。
在本申请实施例中,第一图像分量可以为亮度分量,第二图像分量可以为蓝色色度分量,第三图像分量可以为红色色度分量,但是本申请实施例不作具体限定。
本申请实施例可以适用于低频不可分二次变换或者扩展低频不可分二次变换的场景中,或者其他需要与编码块的编码模式相关联的变换技术的场景中,本申请实施例不作限制。
下面将针对LFNST技术的相关技术方案描述。
参见图1,其示出了相关技术方案提供的一种LFNST技术的应用位置示意图。如图1所示,在帧内预测模式中,对于编码器侧,在正一次变换单元11与量化单元12之间应用有LFNST技术,在反量化单元13与反一次变换单元14之间应用有LFNST技术。
在编码器侧,首先针对数据,比如预测残差(可以用residual表示)通过正一次变换单元11进行第一次变换(可以称之为“Core Transform”或者“一次变换”或者“主变换”),以得到第一次变换后的变换系数矩阵(即第二变换系数);然后针对该变换系数矩阵中的系数进行LFNST变换(可以称之为“Secondary Transform”或者“二次变换”),得到LFNST变换系数矩阵(即第一变换系数),最后针对LFNST变换系数矩阵通过量化单元12进行量化处理,将最终的量化系数写入视频码流(bitstream)。
在解码器侧,通过解析码流,可以获得LFNST变换系数矩阵的量化系数,通过反量化单元13对该量化系数进行反量化处理(可以称之为“Scaling”),得到LFNST变换系数矩阵的恢复值(即第一变换系数),对该恢复值进行反向LFNST变换,可以得到第二变换系数;然后再通过反一次变换单元14对第二变换系数进行与编码器侧“Core Transform”对应的反变换,最终得到residual的恢复值。需要注意的是,标准中仅定义了解码器侧的“反变换”操作,因此在标准中针对“反向LFNST变换”也称之为“LFNST变换”;这里,为了便于和编码器侧的变换进行区分,可以将编码器侧“LFNST变换”称为“正向LFNST变换”,将解码器侧“LFNST变换”称为“反向LFNST变换”。
也就是说,在编码器侧,当前变换块的预测残差通过正一次变换,可以得到一次变换系数,即第二变换系数,然后将部分一次变换系数通过矩阵乘法,与变换矩阵相乘进行二次变换,得到数量更少且更加集中的二次变换系数(即第一变换系数),再对其进行量化处理,得到量化系数;在解码器侧,则是在解析出量化系数之后,对其进行反量化处理,将反量化后的第一变换系数通过矩阵乘法进行反二次变换,然后将反二次变换后的第一变换系数进行反一次变换,从而恢复出预测残差。
在与LFNST相关的技术中,LFNST变换过程可以包括:配置核心参数、帧内预测模式映射、选择变换矩阵、计算矩阵乘法和构造反一次变换系数矩阵等步骤;经过这些步骤之后,表示完成了LFNST变换。然而,在选择变换矩阵(即变换核)的步骤中,首先需要选择变换集,由于变换矩阵与预测模式的方向特性相关,目前是根据帧内预测模式来选择变换集的。其中,对于传统帧内预测模式,可以根据传统帧内预测模式的编号来确定帧内预测模式指示符的取值(可以用predModeIntra表示),即第一变换参数的取值。然后根据predModeIntra的取值来确定变换集索引序号;但是对于非传统帧预测模式,尤其是基于矩阵的帧内预测(Matrix-based Intra Prediction,MIP)模式,是将predModeIntra的取值直接设置为指示PLANAR模式对应的帧内预测模式索引序号(即0),致使MIP模式下当前块只能选择变换集索引序号为0的变换集,使得采用MIP模式下当前块在进行LFNST变换时缺乏可变性,从而导致LFNST技术不能很好地适用于MIP模式,并且还降低了编码效率。
本申请实施例提供了一种视频解码方法,应用于解码器。通过根据第一类帧内预测模式参数,确定当前块的第一预测值;基于当前块的第一预测值或第一类帧内预测模式参数,确定当前块的第一变换参数;基于第一变换参数,确定对当前块进行变换的第二变换参数;基于第二变换参数,对当前块的变换系数进行变换处理,确定当前块的残差值;基于残差值和第一预测值,确定当前块的重建值。这样,针对采用第一类帧内预测模式(例如MIP)的当前块来说,由于在进行LFNST变换时引入了当前块的第一预测值或者第一类帧内预测模式参数,使得在变换技术中,变换核或者变换矩阵(对应第二变换参数)的选择更加灵活,从而不仅提高了非传统帧内预测模式(第一类帧内预测模式)的适用性,还提高了解码效率,同时还能够提升视频图像质量。
本申请实施例提供了一种视频编码方法,应用于编码器。通过确定第一类帧内预测模式参数;根据第一类帧内预测模式参数,确定当前块的第一预测值,并计算当前块的原始值与第一预测值之间的残差值;根据当前块的第一预测值或第一类帧内预测模式参数,确定当前块的第一变换参数;基于第一变换参数,确定对当前块进行变换的第二变换参数;基于第二变换参数,对残差值进行变换处理,得到当前块的变换系数。这样,针对采用第一类帧内预测模式(例如MIP)的当前块来说,由于在进行LFNST变换时引入了当前块的第一预测值或者第一类帧内预测模式参数,使得在变换技术中,变换核或者变换矩阵(对应第二变换参数)的选择更加灵活,从而不仅提高了非传统帧内预测模式(第一类帧内预测模式)的适用性,还提高了编码效率,同时还能够提升视频图像质量。
下面将结合附图对本申请各实施例使用的系统框架进行详细说明。
参见图2A,其示出了本申请实施例提供的一种视频编码系统的组成框图示例;如图2A所示,该视频编码系统10包括变换与量化单元101、帧内估计单元102、帧内预测单元103、运动补偿单元104、运动估计单元105、反变换与反量化单元106、滤波器控制分析单元107、滤波单元108、编码单元109和解码图像缓存单元110等,其中,滤波单元108可以实现去方块滤波及样本自适应缩进(Sample Adaptive 0ffset,SAO)滤波,编码单元109可以实现头信息编码及基于上下文的自适应二进制算术编码(Context-based Adaptive Binary Arithmatic 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中。
参见图2B,其示出了本申请实施例提供的一种视频解码系统的组成框图示例;如图2B所示,该视频解码系统20包括解码单元201、反变换与反量化单元202、帧内预测单元203、运动补偿单元204、滤波单元205和解码图像缓存单元206等,其中,解码单元201可以实现头信息解码以及CABAC解码,滤波单元205可以实现去方块滤波以及SAO滤波。输入的视频信号经过图2A的编码处理之后,输出该视频信号的码流;该码流输入视频解码系统20中,首先经过解码单元201,用于得到解码后的变换系数;针对该变换系数通过反变换与反量化单元202进行处理,以便在像素域中产生残差块;帧内预测单元203可用于基于所确定的帧内预测模式和来自当前帧或图片的先前经解码块的数据而产生当前视频解码块的预测数据;运动补偿单元204是通过剖析运动向量和其他关联语法元素来确定用于视频解码块的预测信息,并使用该预测信息以产生正被解码的视频解码块的预测性块;通过对来自反变换与反量化单元202的残差块与由帧内预测单元203或运动补偿单元204产生的对应预测性块进行求和,而形成解码的视频块;该解码的视频信号通过滤波单元205以便去除方块效应伪影,可以改善视频质量;然后将经解码的视频块存储于解码图像缓存单元206中,解码图像缓存单元206存储用于后续帧内预测或运动补偿的参考图像,同时也用于视频信号的输出,即得到了所恢复的原始视频信号。
本申请实施例中的视频编码方法,可以应用在如图2A所示的变换与量化单元101部分,该变换与量化单元101包括有图1所示的正一次变换单元11和量化单元12,这时候该视频编码方法应用在变换之后且量化之前的过程中。另外,本申请实施例中的视频解码方法,还可以应用如图2B所示的反变换与反量化单元202部分,反变换与反量化单元202可以包括有图1所示的反量化单元13和反一次变换单元14,这时候该视频解码方法应用在反量化之后,且反变换之前的过程中。也就是说,本申请实施例中的视频编码方法应用于视频编码系统,本申请实施例中的视频解码方法应用于视频解码系统。甚至还可以同时应用于视频编码系统和视频解码系统,但是本申请实施例不作限定。还需要说明的是,当该视频编码方法应用于视频编码系统时,“当前块”(即变换块)可以为帧内预测中的当前编码块;当当该视频解码方法应用于视频解码系统时,“当前块”(即变换块)可以为指帧内预测中的当前解码块。
基于上述图2B的应用场景示例,参见图3,其示出了本申请实施例提供的一种视频解码方法的流程示意图,应用于解码器。如图3所示,该方法可以包括:
S101、解码码流,确定当前块的第一类帧内预测模式参数。
在本申请实施例中,解码器在解码过程中,解码码流,先获取到了当前块的预测模式参数,预测模式参数指示了当前块的编码模式及该模式相关的参数。其中,预测模式通常包括有传统帧内预测模式和非传统帧内预测模式,而传统帧内预测模式可以包括有直流(DC)模式、平面(PLANAR)模式和角度预测模式等,非传统帧内预测模式(第一类帧内预测模式)可以包括有MIP模式、CCLM模式、IBC模式和PLT模式等。
需要说明的是,在本申请实施例中,将第二类帧内预测模式表示的是传统帧内预测模式,第一类帧内预测模式表示的是非传统帧内预测模式。其中,第一类帧内预测模式可以理解为非角度预测模式。
解码器在解码时,针对解码出的预测模式参数表征未第一类帧内预测模式的时候,就确定码流中当前块的第一类帧内预测模式参数。
在本申请实施例中,编码器在对当前块进行编码时,编码器会针对当前块进行预测编码,在这过程中就可以确定出当前块的预测模式,并将相应的预测模式参数写入码流,由编码器传输到解码器。
需要说明的是,编码器可以采用率失真优化(Rate Distortion Optimization,RDO)的方式确定当前 块的预测模式参数。
在本申请实施例中,当前块的解码也是针对不同颜色分量进行的解码处理。采用图像分量指示符(可以用cIdx表示)指示当前块的亮度分量或色度分量。
示例性的,如果当前块预测的为亮度分量,那么cIdx等于0;如果当前块预测的为色度分量,那么cIdx等于1。另外,(xTbY,yTbY)是当前块左上角采样点的坐标,IntraPredModeY[xTbY][yTbY]为亮度分量的帧内预测模式,IntraPredModeC[xTbY][yTbY]为色度分量的帧内预测模式。
解码器在获知了预测模式之后,可以确定当前块的第一类帧内预测模式参数。第一类帧内预测模式参数为第一类帧内预测模式对应的参数。
示例性的,第一类帧内预测模式为MIP模式时,第一类帧内预测模式对应的参数为MIP参数。
第一类帧内预测模式参数可以包括:第一类帧内预测模式索引(可以用modeId表示)、当前块的大小、当前块的类别(可以用mipSizeId表示)等参数;这些参数的取值可以通过解码码流得到。其中,MIP参数可以包括有MIP转置指示参数(可以用isTransposed表示)、MIP模式索引序号(可以用modeId表示)、当前块的大小、当前块的类别(可以用mipSizeId表示)等参数。
在一种实施方式中,根据当前块的大小,确定当前块的类别,可以包括:
如果当前块的宽度和高度均等于4,那么可以将mipSizeId的取值设置为0;
反之,如果当前块的宽度和高度之一等于4,或者当前块的宽度和高度均等于8,那么可以将mipSizeId的取值设置为1;
反之,如果当前块为其他大小的块,那么可以将mipSizeId的取值设置为2。
在另一种实施方式中,根据当前块的大小,确定当前块的类别,可以包括:
如果当前块的宽度和高度均等于4,那么可以将mipSizeId的取值设置为0;
反之,如果当前块的宽度和高度之一等于4,那么可以将mipSizeId的取值设置为1;
反之,如果当前块为其他大小的块,那么可以将mipSizeId的取值设置为2。
这样,在使用MIP确定帧内预测值的过程中,还可以确定出MIP参数,便于根据所确定的MIP参数来确定当前块使用的LFNST变换核(可以用kernel表示)。
下面以MIP参数为例进行说明。
在一些实施例中,通过解码码流,可以确定isTransposed的取值;当isTransposed的取值等于1时,需要对MIP模式使用的采样点输入向量进行转置处理;当isTransposed的取值等于0时,不需要对MIP模式使用的采样点输入向量进行转置处理;也就是说,MIP转置指示参数可以用于指示是否对MIP模式使用的采样点输入向量进行转置处理。
在一些实施例中,通过解码码流,还可以确定MIP模式索引序号(可以用modeId表示);其中,MIP模式索引序号可以用于指示当前块使用的MIP模式,MIP模式可以用于指示使用MIP确定当前块的帧内预测值的计算推导方式。也就是说,在MIP模式中,由于MIP模式又可以包括有很多种,这多种MIP模式可以通过MIP模式索引序号进行区分,即不同的MIP模式具有不同的MIP模式索引序号;这样,根据使用MIP确定当前块的帧内预测值的计算推导方式,可以确定出具体的MIP模式,从而就可以得到对应的MIP模式索引序号;本申请实施例中,MIP模式索引序号的取值可以为0、1、2、3、4或5。
在一些实施例中,通过解码码流,还可以确定当前块的大小、宽高比、当前块的类别(可以用mipSizeId表示)等参数信息。这样,在确定出MIP参数之后,以方便后续根据所确定的MIP参数来选择当前块使用的变换核(可以用kernel表示,例如LFNST变换核)或扫描顺序参数,或者根据所确定的MIP参数确定当前块的第一预测值,基于第一预测值来选择变换核或扫描顺序参数。
S102、根据第一类帧内预测模式参数,确定当前块的第一预测值。
在本申请实施例中,解码器可以第一类帧内预测模式参数,进行帧内预测,从而确定出当前块的第一预测值的。
以第一类帧内预测模式参数为MIP参数为例进行说明。
在本申请实施例中,针对MIP模式,MIP预测的输入数据,包括有:当前块的位置(xTbCmp,yTbCmp)、当前块所应用的MIP预测模式(可以用modeId表示)、当前块的高度(用nTbH表示)、当前块的宽度(用nTbW表示)以及是否需要转置的转置处理指示标志(可以用isTransposed表示)等;MIP预测的输出数据,包括有:当前块的预测块,该预测块中像素坐标[x][y]所对应的帧内预测值为predSamples[x][y];其中,x=0,1,…,nTbW-1;y=0,1,…,nTbH-1。
在本申请的一些实施例中,如图4所示,MIP预测过程可以分为四个步骤:配置核心参数41、获取参考像素42、构造输入采样43以及生成预测值44。其中,对于配置核心参数41来说,根据帧内当前块的大小,可以将当前块划分为三类,用mipSizeId记录当前块的种类;而且不同种类的当前块,参 考采样点数量和矩阵乘法输出采样点数量是不同的。对于获取参考像素42来说,预测当前块时,这时候当前块的上块和左块都是已编码的块,MIP技术的参考像素为当前块的上一行像素和左一列像素的重建值,获取当前块的上侧边相邻的参考像素(用refT表示)和左侧边相邻的参考像素(用refL表示)的过程即为参考像素的获取过程。对于构造输入采样43来说,该步骤用于矩阵乘法的输入,主要可以包括:获取参考采样431、构造参考采样缓冲区432和推导矩阵乘法输入采样433;其中,获取参考采样的过程为下采样过程,而构造参考采样缓冲区432又可以包括不需要转置时缓冲区的填充方式4321和需要转置时缓冲区的填充方式4322。对于生成预测值44来说,该步骤用于获取当前块的MIP预测值,主要可以包括:构造矩阵乘法输出采样块441、矩阵乘法输出采样嵌位442、矩阵乘法输出采样转置443和生成MIP最终预测值444;其中,构造矩阵乘法输出采样块441又可以包括获取权重矩阵4411、获取移位因子和偏移因子4412和矩阵乘法运算4413,生成MIP最终预测值444又可以包括生成不需要上采样的预测值4441和生成需要上采样的预测值4442。这样,在经过该四个步骤之后,可以得到当前块的帧内预测值。
这样,在确定出当前块的帧内预测值之后,可以根据当前块的像素真实值与帧内预测值进行差值计算,将计算得到的差值作为预测差值,便于后续针对预测差值进行变换处理。
需要说明的是,在MIP预测过程中,还需要确定出MIP参数。
在一些实施例中,MIP参数可以包括有MIP转置指示参数(可以用isTransposed表示);这里,MIP转置指示参数的取值用于指示是否对MIP模式使用的采样点输入向量进行转置处理。
在MIP模式中,根据当前块左侧边相邻参考像素对应的参考采样值和上侧边相邻参考像素对应的参考采样值,可以得到相邻参考采样集;这样,在得到相邻参考采样集之后,这时候可以构造一个输入参考样值集,即MIP模式使用的采样点输入向量。但是针对输入参考样值集的构造,在编码器侧和解码器侧的构造方式是有区别的,主要是和MIP转置指示参数的取值有关。在编码时,MIP转置指示参数是编码器计算确定的,在解码时,解码器是可以从码流中解码出MIP转置指示参数的。
需要说明的是,解码器解码出MIP转置指示参数,当MIP转置指示参数的取值为0时,在缓冲区内,可以将相邻参考采样集中上侧边对应的参考采样值存储在左侧边对应的参考采样值之前,这时候不需要进行转置处理,即不需要对MIP模式使用的采样点输入向量进行转置处理,可以直接将缓冲区确定为输入参考样值集;当MIP转置指示参数的取值为1时,在缓冲区内,可以将相邻参考采样集中上侧边对应的参考采样值存储在左侧边对应的参考采样值之后,这时候对所述缓冲区进行转置处理,即需要对MIP模式使用的采样点输入向量进行转置处理,然后将转置后的缓冲区确定为输入参考样值集。这样,在得到输入参考样值集之后,可以用于MIP模式下确定当前块对应的帧内预测值的过程。
S103、基于当前块的第一预测值或第一类帧内预测模式参数,确定当前块的第一变换参数。
在本申请实施例中,解码器可以基于当前块的第一预测值,确定当前块的第一变换参数。解码器也可以基于当前块的第一类帧内预测模式参数,确定当前块的第一变换参数,本申请实施例不作限制。
在本申请的一些实施例中,针对解码器基于当前块的第一预测值,确定当前块的第一变换参数的实现可以包括:
S1、基于当前块的第一预测值,确定当前块的第二类帧内预测模式的第一索引;
S2、基于当前块的第二类帧内预测模式的第一索引,确定当前块的第一变换参数。
在本申请实施例中,解码器可以通过当前块的第一预测值来确定第二类帧内预测模式的第一索引,其中,第二类帧内预测模式包括以下至少之一:平面模式、直流模式和帧内角度预测模式。然后,解码器就可以基于当前块的第二类帧内预测模式的第一索引,确定当前块的第一变换参数。
本申请实施例中的第一变换参数为确定第二变换参数,即变换核索引参数(指变换系数矩阵索引)和变换参数的扫描顺序参数的依据。
也就是说,解码器可以通过将非传统帧内预测模式,映射到传统帧内预测模式中,通过传统帧内预测模式的第一索引来确定当前块的第一变换参数,进而使得当前块在非传统帧内预测模式下,可以采用与传统帧内预测模式对应的灵活方式,选择要进行参数变换的第二变换参数,提高了了非传统帧内预测模式(第一类帧内预测模式)的适用性,还提高了编码效率,同时还能够提升视频图像质量。
需要说明的是,在本申请实施例中,第一预测值可以为采用第一类帧内预测模式进行帧内预测的最终预测值,也可以为在采用第一类帧内预测模式进行帧内预测过程中的中间预测值。
示例性的,针对MIP模式,第一预测值可以为MIP预测中,上采样后的最终预测值,也可以为MIP预测中,上采样之前的中间预测值,本申请实施例不作限制。
在本申请的一些实施例中,解码器可以将当前块的第一变换参数设置为等于当前块的第二类帧内预测模式的第一索引。
在本申请的一些实施例中,针对S1的实现如下所示,包括:
S201、基于第一预测值,确定第一预测值的第二类帧内预测模式的索引集;
S202、基于第一预测值的第二类帧内预测模式的索引集,确定当前块的第二类帧内预测模式的第一索引;其中,第二类帧内预测模式的索引集中存储了第二类帧内预测模式的索引的部分或全部容许取值对应的累积权重值。
在本申请实施例中,解码器可以将第一预测值映射到第二类帧内预测模式下,即得到第二类帧内预测模式的索引集,再从第二类帧内预测模式的索引集中,确定当前块要使用的第二类帧内预测模式的第一索引。
需要说明的是,第二类帧内预测模式的索引集中可以存储一个或者多个第二类帧内预测模式的索引的部分或全部容许取值对应的累积权重值。若存储有多个,则当前块的第二类帧内预测模式的第一索引可以是从多个第二类帧内预测模式的索引中对应的累积权重值中选择出来的一个。
在本申请的一些实施例中,解码器对于第一预测值中的部分或全部的预测值,确定部分或全部预测值对应的采样点的水平方向梯度值和垂直方向梯度值;根据采样点的水平方向梯度值和垂直方向梯度值,确定第一预测值的第二类帧内预测模式的索引集。
示例性的,使用MIP预测值,通过不同的分析方法,将MIP预测值映射到传统帧内预测模式通过计算MIP模式预测值的梯度信息。例如,根据梯度信息推导出传统的帧内预测模式,根据推导出的帧内预测模式选择进行LFNST时使用的变换集和扫描顺序。
需要说明的是,解码器针对每个采样点,都可以确定出每个采样点对应的第二类帧内预测模式的第二索引,将第一预测值中的部分或全部的预测值对应的采样点都确定完后,就可以获取到第二类帧内预测模式的索引集了。
在本申请的一些实施例中,每个采样点确定第二类帧内预测模式的第二索引的过程一致。针对一个采样点,解码器根据采样点的水平方向梯度值和垂直方向梯度值,确定第一预测值的第二类帧内预测模式的索引集包括:(1)和(2)。如下:
(1)、解码器根据采样点的水平方向梯度值和垂直方向梯度值,确定采样点的梯度角度值;根据采样点的梯度角度值,确定对应于梯度角度值的第二类帧内预测模式的第二索引;更新第二类帧内预测模式的索引集中对应于所确定的第二类帧内预测模式的第二索引的累积权重值。
在本申请实施例中,解码器基于采样点的水平方向梯度值和垂直方向梯度值、以及预设的函数关系,确定采样点的梯度角度值。
第一种实现为:预设的函数关系为反正切函数;其中,反正切函数是采样点的水平方向梯度值和垂直方向梯度值的比值。
示例性的,预设的函数关系为公式(1)所示:
其中,G
x和G
y为水平方向梯度值和垂直方向梯度值;θ为梯度角度值。
在本申请的一些实施例中,解码器基于反正切函数,对所述采样点的水平方向梯度值和垂直方向梯度值的比值进行处理,确定采样点的梯度角度值。
第二种实现为:预设的函数关系是采样点的梯度角度值与采样点的水平方向梯度值和垂直方向梯度值之间的第二映射表。
在本申请的一些实施例中,解码器将采样点的水平方向梯度值和垂直方向梯度值,或者采样点的水平方向梯度值和垂直方向梯度值的比值输入第二映射表,输出采样点的梯度角度值。
需要说明的是,第二映射表已知的情况下,就可以通过第二映射表、采样点的水平方向梯度值和垂直方向梯度值,来确定出映射的梯度角度值了。第二映射表为采样点的水平方向梯度值、垂直方向梯度值,与梯度角度值的对应关系,也可以为水平方向梯度值和垂直方向梯度的比值,与梯度角度值的对应关系,本申请实施例不作限制。
在本申请实施例中,解码器在确定了梯度角度值后,就可以根据采样点的梯度角度值,确定出该采样点的第二类帧内预测模式的第二索引了。
在本申请的一些实施例中,解码器根据采样点的梯度角度值,确定对应于梯度角度值的第二类帧内预测模式的第二索引的实现包括:从与第二类帧内预测模式的索引的部分或全部容许取值所指示的帧内角度预测的方向中,确定与梯度角度值所指示方向之间夹角最小的帧内角度预测方向所对应的第二类帧内预测模式索引值;将梯度角度值的第二类帧内预测模式的第二索引,设置为第二类帧内预测模式索引值。
需要说明的是,解码器可以采用一个数组来保存第二类帧内预测模式的索引的部分或全部容许取值对应累积权重值。数组中的每组数据为第二类帧内预测模式对应的容许取值的累积权重值。
解码器将与梯度角度值所指示的方向最接近的帧内角度预测方向先找出来,然后确定该帧内角度预测方向对应的第二类帧内预测模式,该第二类帧内预测模式的索引值,就作为梯度角度值的第二类帧内预测模式的第二索引。
在本申请的一些实施例中,解码器根据采样点的梯度角度值,确定对应于梯度角度值的第二类帧内预测模式的第二索引的实现包括:根据预设的梯度角度值与第二类帧内预测模式索引之间的第三映射表,确定对应于梯度角度值的第二类帧内预测模式的第二索引。其中,第三映射表表征不同取值或不同取值范围内的梯度角度值与第二类帧内预测模式索引之间的对应关系。
在本申请的一些实施例中,解码器在确定了每个采样点对应的第二类帧内预测模式的第二索引后,该解码器可以更新第二类帧内预测模式的索引集中对应于所确定的第二类帧内预测模式的第二索引的累积权重值,也就是说,解码器每次确定一个采样点的第二索引后,就可以对第二类帧内预测模式的索引集中,对应于所确定的第二类帧内预测模式的第二索引的累积权重值增加设定的数值。这样,将采样点均处理完后,就可以得到第一预测值的第二类帧内预测模式的索引集了。
在本申请的一些实施例中,设定的数值等于1。或者设定的数值等于水平方向梯度值的绝对值与垂直方向梯度值的绝对值之和(G)。本申请实施例不作限制。
示例性的,如公式(2)所示,G为:
G=|G
x|+|G
y| (2)
(2)、解码器根据采样点的水平方向梯度值和垂直方向梯度值,确定采样点对应的梯度方向、第一梯度强度和模式分区;采样点对应的梯度方向、第一梯度强度和模式分区,确定第二类帧内预测模式的第二索引;更新第二类帧内预测模式的索引集中对应于所确定的第二类帧内预测模式的第二索引的累积权重值。
在本申请的一些实施例中,解码器基于采样点的水平方向梯度值(gHor[x][y])和垂直方向梯度值((gVer[x][y]),确定采样点的第一梯度强度;基于采样点的水平方向梯度值和垂直方向梯度值,对采样点进行第二类帧内预测模式的分区处理,确定采样点的水平区域索引(signH[x][y])、垂直区域索引(signV[x][y])和梯度强度索引(HgV[x][y]);基于采样点的水平区域索引、垂直区域索引和梯度强度索引,确定采样点的模式分区(region[x][y]);基于采样点的梯度强度索引,确定采样点对应的梯度方向(HgV[x][y]==1?)。
在本申请的一些实施例中,解码器根据采样点对应的梯度方向、第一梯度强度和模式分区,确定第二类帧内预测模式的第二索引的实现包括:
解码器根据采样点对应的梯度方向,确定采样点的梯度偏移比值(grad[x][y]);将采样点的梯度偏移比值,映射到预设模式偏移范围内,得到采样点的帧内预测模式索引偏移量(angIdx[x][y]);根据预设模式分区与模式索引的第四映射表,确定与采样点的模式分区对应的目标第二类帧内预测模式;结合目标第二类帧内预测模式和帧内预测模式索引偏移量,确定采样点的第二类帧内预测模式的第二索引。
在本申请的一些实施例中,解码器在确定了每个采样点对应的第二类帧内预测模式的第二索引后,该解码器可以更新第二类帧内预测模式的索引集中对应于所确定的第二类帧内预测模式的第二索引的累积权重值,也就是说,解码器每次确定一个采样点的第二索引后,就可以对第二类帧内预测模式的索引集中,对应于所确定的第二类帧内预测模式的第二索引的累积权重值增加设定的数值。这样,将采样点均处理完后,就可以得到第一预测值的第二类帧内预测模式的索引集了。
在本申请实施例中,解码器更新第二类帧内预测模式的索引集中对应于所确定的第二类帧内预测模式的第二索引的累积权重值的实现包括:对第二类帧内预测模式的索引集中,对应于所确定的第二类帧内预测模式的第二索引的累积权重值增加设定的数值。
其中,设定的数值等于1或设定的数值等于水平方向梯度值的绝对值与垂直方向梯度值的绝对值之和,本申请实施例不作限制。
示例性的,以MIP模式为例,分析MIP模式的预测值(即第一预测值),根据MIP模式的预测值推导出一种传统帧内预测模式,并将predModeIntra映射为该传统帧内预测模式,得到第一索引,即得到等于第一索引的第一变换参数。
在本申请实施例中,解码器可以分析MIP预测值的梯度,提取梯度值最大的方向,将该方向对应于一种传统的帧内预测模式,该映射过程分为两步:获取MIP模式的预测像素,利用梯度推导传统帧内预测模式。映射过程包括:获取MIP模式的预测像素(即第一预测值的采样点),利用梯度推导传统帧内预测模式。
解码器基于第一预测值,确定第一预测值的第二类帧内预测模式的索引集的过程如下:
在本申请实施例中,解码器获取MIP模式的预测值可以根据MIP变换块(当前块)的位置和尺寸获取MIP模式的预测值。在对当前变换块的残差值进行变换量化时,当前变换块的预测都是已经完成的,此时可以直接通过MIP变换块的位置和尺寸获取预测值。一种可实现的方式是获取MIP完成矩阵乘法并上采样后的最终预测值,另一种可实现的方式是获取MIP上采样前的预测值的预测值。
在本申请实施例中,解码器利用梯度推导传统帧内预测模式的过程为:以分析MIP模式最终的预测像素为例,对于MIP模式的最终的预测像素,计算其全部预测像素或者部分预测像素的垂直梯度(垂直方向梯度值)和水平梯度(水平方向梯度值),将梯度最大的方向(梯度角度值)映射为一种传统帧内预测模式。
本申请实施例中,通过分析MIP上采样前的预测值,将MIP预测模式映射到传统帧内预测模式,根据映射的传统帧内预测模式选择进行LFNST时使用的变换集和扫描顺序。
示例性的,一种可实现的方式是通过Sobel算子计算MIP最终预测值的水平梯度和垂直梯度。Sobel算子公式(3)如下所示,其中G
x是用于计算水平梯度,G
y是用来计算垂直梯度。
下面详细介绍利用Sobel进行梯度分析MIP预测值推导传统帧内预测模式过程。
先介绍以下参数设定和概念:
MIP模式的预测值的采样点为:p[x][y],其中x=0..nTbW–1,y=0..nTbH–1,其中nTbW表示当前MIP变换块的宽度,nTbH表示当前MIP变换块的高度。
解码器得到是传统帧内预测模式IntraPredModeD(即第二类帧内预测模式),其中IntraPredModeD在[0,66]之间。
需要设置一些规则,如下:
设置mapHgV={{2,1},{1,2}}and mapVgH={{3,4},{4,3}},即水平方向和垂直方向个划分为4个分区。
设置angTable={0,2048,4096,6144,8192,12288,16384,20480,24576,28672,32768,36864,40960,47104,53248,59392,65536},设置了16个模式对应不同的角度的偏移量。其中,设置angTable每个值对应的索引为【0-15】。
设置angOffset={18,18,50,50}。
设置HoG[67]对应[0,66]为包含每个传统帧内预测模式的梯度强度的数组。在此过程开始时,所有HOG数组中所有值初始化为0。
对于每一个预测像素p[x][y],with x=1…nTbW-2,y=1…nTbH-2,计算过程如下:
计算水平梯度gHor[x][y]=p[x-1][y-1]+2.p[x-1][y]+p[x-1][y+1]–p[x+1][y-1]–2.p[x+1][y]–p[x+1][y+1];
计算垂直梯度gVer[x][y]=p[x-1][y-1]+2.p[x][y-1]+p[x+1][y-1]–p[x-1][y+1]–2.p[x][y+1]–p[x+1][y+1]。
计算梯度强度iAmp[x][y]=abs(gHor[x][y])+abs(gVer[x][y])。
计算水平区域索引signH[x][y]=gHor[x][y]<0?1:0。
计算垂直区域索引signV[x][y]=gVer[x][y]<0?1:0。
计算梯度强度索引HgV[x][y]=(abs(gHor[x][y])>abs(gVer[x][y])?1:0),
计算确定模式分区:region[x][y]=(HgV[x][y]==1?mapHgV[signH[x][y]][signV[x][y]]:mapVgH[signH[x][y]][signV[x][y]]),即基于采样点的水平区域索引、垂直区域索引和梯度强度索引,确定采样点的模式分区。
计算梯度偏移比值grad[x][y]=(HgV[x][y]==1?abs(gVer[x][y])/abs(gHor[x][y]):abs((gHor[x][y]/gVer[x][y]))),即根据采样点对应的梯度方向,确定采样点的梯度偏移比值。
计算grad[x][y]=round(grad[x][y]*(1<<16))和计算帧内预测模式索引偏移量angIdx[x][y]=argmin
i(abs(angTable[i]–grad[x][y])),即将采样点的梯度偏移比值,映射到预设模式偏移范围内,得到采样点的帧内预测模式索引偏移量。
计算第二类帧内预测模式的索引:ipm[x][y]=angOffset[region[x][y]](可能取值为18或50)+angIdx[x][y],即根据预设模式分区与模式索引的第四映射表,确定与采样点的模式分区对应的目标第二类帧内预测模式(angOffset[region[x][y]]);结合目标第二类帧内预测模式和帧内预测模式索引偏移量,确定采样点的第二类帧内预测模式的第二索引(ipm[x][y])。
设置HOG[ipm[x][y]]=HOG[ipm[x][y]](累积权重值)+iAmp[x][y](设定的数值)。
这样,就得到了每个采样点对应的第二类帧内预测模式,以及第二类帧内预测模式的第二索引:HOG[ipm[x][y]]。
在本申请的一些实施例中,针对S202,解码器可以基于第一预测值的第二类帧内预测模式的索引集,确定当前块的第二类帧内预测模式的第一索引的实现包括:
解码器将当前块的第二类帧内预测模式的第一索引,设置为第一预测值的第二类帧内预测模式的索引集中,最大的累积权重值对应的第二类预测模式的第二索引。或者,将当前块的第二类帧内预测模式的第一索引,设置为第一预测值的第二类帧内预测模式的索引集中,最小的累积权重值对应的第二类预测模式的第二索引,本申请实施例不作限制。
需要说明的是,解码器通过第一预测值中的部分或全部的预测值的采样点,得到第一预测值的第二类帧内预测模式的索引集后,该解码器就将第一预测值的第二类帧内预测模式的索引集中,最大的累积权重值对应的第二类预测模式的第二索引,确定为当前块的第二类帧内预测模式的第一索引。
示例性的,设置IntraPredModeD的传统帧内预测模式为argmax
i(HoG[i])。
其中,argmax
i(L[i]),i=0,…,N,返回0到N之间的索引,使L最大化(如果有多个最大值,则返回较小的索引)。
argmin
i(L[i]),i=0,…,N,返回0到N之间的索引,使L最小化(如果有多个最小值,则返回较小的索引)。
最后,将predModeIntra映射为IntraPredModeD。
需要说明的是,如果HOG均为零幅度,则将predModeIntra的的取值更新设置为指示PLANAR模式的索引序号。
在本申请的一些实施例中,解码器还可以根据候选第二类帧内预测模式,确定当前块的第二类帧内预测值;候选第二类帧内预测模式包括以下帧内预测模式的一种或多种:平面模式、直流模式、帧内角度预测模式。根据第一帧内预测值与第二类帧内预测值,确定当前块的第二类帧内预测模式的第一索引。
示例性的,解码器计算MIP模式预测值与传统帧内预测模式预测值间的差距,选出预测值最接近MIP模式预测值的传统帧内预测模式,根据选出的帧内预测模式选择进行LFNST时使用的变换集和扫描顺序。
在本申请的一些实施例中,解码器确定第一帧内预测值与第二类帧内预测值的第一预测误差;将第一预测误差满足第一预设条件时对应的候选第二类帧内预测模式对应的索引值,确定为当前块的第二类帧内预测模式的第一索引。
解码器确定第一帧内预测值与第二类帧内预测值的第一预测误差包括以下两种方式:
方式一:根据第一误差准则,确定第一帧内预测值与第二类帧内预测值的第一预测差值;
其中,第一误差准则是以下误差准则之一:绝对误差和(SAD)、平方误差和(SSD)、平均绝对误差(MAD)和均方误差(MSE);第一预设条件是第一预测误差达到最小值。
方式二:根据第二误差准则,确定第一帧内预测值与第二类帧内预测值的第一预测差值;
其中,第二误差准则是以下误差准则之一:信噪比(SNR)和峰值信噪比(PSNR);第一预设条件是第一预测误差达到最大值。
在本申请的一些实施例中,针对解码器基于当前块的第一类帧内预测模式参数,确定当前块的第一变换参数的实现可以包括:基于第一类帧内预测模式参数,确定当前块的第二类帧内预测模式的第一索引;基于第二类帧内预测模式的第一索引,确定当前块的第一变换参数。
在本申请实施例中,解码器基于第一类帧内预测模式参数,确定当前块的第二类帧内预测模式的第一索引的方式包括以下两种:
方式一:
解码器根据第一类帧内预测模式参数与第二类帧内预测模式索引的第一预设映射关系,确定当前块的第二类帧内预测模式的第一索引。
其中,第一类帧内预测模式参数包括:第一类帧内预测模式索引;第一预设映射关系表示第一类帧内预测模式索引与第二类帧内预测模式索引之间的对应关系;解码器根据述第一类帧内预测模式索引,从第一预设映射关系中,确定第二类帧内预测模式的第一索引。
方式二:
解码器基于第一类帧内预测模式参数指示的第一类帧内预测模式加权矩阵,确定当前块的第二类帧内预测模式的第一索引。
在本申请的一些实施例中,解码器确定第一类帧内预测模式加权矩阵的梯度参数;根据第一类帧内预测模式加权矩阵的梯度参数,确定当前块的第二类帧内预测模式的第一索引。
示例性的,通过分析MIP的加权矩阵,将MIP预测模式映射到传统帧内预测模式,根据映射的传 统帧内预测模式选择进行LFNST时使用的变换集和扫描顺序。
在本申请的一些实施例中,针对S2,解码器基于第二类帧内预测模式的第一索引,确定当前块的第一变换参数的实现包括:
将第二类帧内预测模式的第一索引进行宽角度映射,确定宽角度预测模式索引;基于宽角度预测模式索引,确定第一变换参数。
需要说明的是,解码器对使用第一类帧内预测模式的变换块,通过分析第一类帧内预测模式的第一预测值,将第一类帧内预测模式映射到传统帧内预测模式(第让二类帧内预测模式),将映射后的传统预测模式进行宽角度映射,再根据宽角度映射后的传统预测模式(即确定的第一变换参数)进行变换集(变换矩阵)和扫描顺序的选取。
示例性的,对使用MIP预测模式的变换块,通过分析MIP模式的预测值,将MIP模式映射到传统帧内预测模式,将映射后的传统预测模式进行宽角度映射,再根据宽角度映射后的传统预测模式进行变换集(变换矩阵)和扫描顺序的选取。
本申请实施例中,以MIP模式,使用LFNST技术为例进行说明,需要说明的是,本申请也适用于使用扩展LFNST技术的场景中。
需要说明的是,并不是任意的当前块都可以执行LFNST。只有当前块同时满足如下条件时,才可以对当前块进行LFNST。其中,这些条件包括:(a)当前块的宽度和高度均大于或等于4;(b)当前块的宽度和高度均小于或等于变换块的最大尺寸;(c)当前块或当前所在编码块的预测模式为帧内预测模式;(d)当前块的一次变换在水平方向和垂直方向上均为二维正向一次变换(DCT2);(e)当前块或当前块所在编码块的帧内预测模式为非MIP模式或者变换块的预测模式为MIP模式且变换块的宽度和高度均大于或等于16。也就是说,针对本申请实施例中的当前块,需要同时满足上述的五个条件。
进一步地,在确定当前块可以执行LFNST时,这时候还需要确定当前块使用的LFNST变换核(可以用kernel表示)。其中,LFNST中共有4个变换核候选集,这四个变换核候选集可以包括有set0、set1、set2和set3。其中,根据当前块或当前块所在编码块的编码参数,可以隐含推导出所选择的变换核候选集;比如在目前H.266/VVC中,根据当前块的帧内预测模式,可以确定出使用四个变换核候选集中的哪一个变换核候选集。
在本申请实施例中,在获取到当前块的帧内预测模式之后,可以确定出帧内预测模式的初始取值(可以用predModeIntra表示)的取值,计算公式如下,
其中,图像分量指示符(可以用cIdx表示)用于指示当前块的亮度分量或色度分量;这里,如果当前块预测的为亮度分量,那么cIdx等于0;如果当前块预测的为色度分量,那么cIdx等于1。另外,(xTbY,yTbY)是当前块左上角采样点的坐标,IntraPredModeY[xTbY][yTbY]为亮度分量的帧内预测模式,IntraPredModeC[xTbY][yTbY]为色度分量的帧内预测模式。
需要说明的是,LFNST索引序号的取值可以用于指示当前块是否使用LFNST、且LFNST变换核在LFNST变换核候选集中的索引序号。具体地,在解析出LFNST索引序号之后,当LFNST索引序号的取值等于0时,表明了当前块不使用LFNST;而当LFNST索引序号的取值大于0时,表明了当前块使用LFNST,且变换核的索引序号等于LFNST索引序号的取值、或者该LFNST索引序号的取值减1。
还需要说明的是,在解码器侧,LFNST的输入数据,可以包括有:当前变换块的亮度位置(xTbY,yTbY),当前块的宽度nTbW,当前块的高度nTbH,当前块是亮度分量还是色度分量cIdx,当前变换块反量化(Scaling)后的系数d[x][y],x=0,1,…,nTbW-1,y=0,1,…,nTbH-1;LFNST的输出数据,可以包括有:二次变换系数经过LFNST生成的一次变换系数d’[x][y],x=0,1,…,nLfnstSize-1,y=0,1,…,nLfnstSize-1。
在H.266/VVC中,帧内预测模式又可以划分为传统帧内预测模式和非传统帧内预测模式。对于非传统帧内预测模式来说,predModeIntra取值指示的信息如下:
若当前块的预测模式为CCLM模式,则predModeIntra的取值可以为INTRA_LT_CCLM、INTRA_L_CCLM或INTRA_T_CCLM(在VVC中分别为81,82,83);
若当前块的预测模式为MIP模式,则predModeIntra的取值可以为所使用的MIP模式索引序号;
若当前块的预测模式为传统帧内预测模式,则predModeIntra的取值可以在[0,66]。
另外,如果当前块的预测模式为CCLM模式和MIP模式,那么还可以使用如下方式设predModeIntra的取值:
(1)当前块的预测模式为CCLM模式时,
若当前块(比如色度块)对应亮度位置的中心亮度块的模式为MIP模式,即intra_mip_flag[xTbY+nTbW/2][yTbY+nTbH/2]为1,则将predMode Intra的取值设置为指示PLANAR模式的索引序号(即0);
否则,若当前块(比如色度块)对应亮度位置的中心亮度块的模式为IBC(Intra Block Copy)模式或者Palette模式,则将predModeIntra的取值设置为指示直流(DC)模式的索引序号(即1);
否则,将predModeIntra的取值设置为当前块(比如色度块)对应亮度位置的中心亮度块的模式索引序号的取值IntraPredModeY[xTbY+nTbW/2][yTbY+nTbH/2];
(2)当前块的预测模式为MIP模式时,
若intra_mip_flag[xTbY][yTbY]为1且cIdx为0,则指示当前变换块的预测模式为MIP模式,此时分析MIP模式的预测值,根据MIP模式的预测值推导出一种传统帧内预测模式,并将predModeIntra映射为该传统帧内预测模式。
对于传统帧内预测模式来说,可以根据当前块的尺寸进行宽角度的映射,将传统帧内预测模式[0,66]扩展到[-14,80];映射过程如下:
首先计算宽高比例因子(可以用whRatio表示),如下所示,
whRatio=Abs(Log2(nTbW/nTbH)) (5)
对于非正方形的当前块(即nTbW不等于nTbH),这时候可以对predModeIntra进行如下修正,如果nTbW大于nTbH、且predModeIntra大于或等于2、且predModeIntra小于((whRatio>1?(8+2×whRatio):8),那么predModeIntra=(predModeIntra+65);否则,如果nTbW小于nTbH、且predModeIntra小于或等于66、且predModeIntra大于((whRatio>1?(60-2×whRatio):60),那么predModeIntra=(predModeIntra-67)。
可以理解的是,针对采用第一类帧内预测模式(例如MIP)的当前块来说,由于在进行LFNST变换时引入了当前块的第一预测值或者第一类帧内预测模式参数,使得在变换技术中,变换核或者变换矩阵(对应第二变换参数)的选择更加灵活,从而不仅提高了非传统帧内预测模式(第一类帧内预测模式)的适用性,还提高了解码效率,同时还能够提升视频图像质量。
S104、基于第一变换参数,确定对当前块进行变换的第二变换参数。
在本申请实施例中,解码器可以根据预设的第一变换参数与第二变换参数之间的第一映射表,确定与第一变换参数对应的第二变换参数。
其中,第二变换参数包括以下至少之一:变换核索引参数(指变换系数矩阵索引)和变换参数的扫描顺序参数;其中,变换核索引参数指示对当前块的变换参数进行解码过程中使用的变换核;扫描顺序参数指示变换参数的扫描顺序,扫描顺序包括水平顺序和垂直顺序。
需要说明的是,变换核索引参数指变换系数矩阵索引,可以直接从码流中得到,也可以是解码端确定好变换集(即变换核候选集),再从码流中获取变换核在变换核候选集中的索引序号。
本申请实施例中,以MIP模式,使用LFNST技术为例进行说明,需要说明的是,本申请也适用于使用扩展LFNST技术的场景中。
在目前H.266/VVC中,根据predModeIntra的取值以及表1(第一映射表),可以确定出LFNST索引序号(可以用SetIdx表示)的取值,具体取值如表1所示。这里,LFNST索引序号的取值设置为指示当前块使用LFNST、且LFNST变换核在LFNST变换核候选集中的索引序号。通常来说,LFNST变换集中包括有四个变换核候选集(set0,set1,set2,set3),分别对应于SetIdx的取值为0、1、2、3。
表1
predModeIntra | SetIdx |
predModeIntra<0 | 1 |
0<=predModeIntra<=1 | 0 |
2<=predModeIntra<=12 | 1 |
13<=predModeIntra<=23 | 2 |
24<=predModeIntra<=44 | 3 |
45<=predModeIntra<=55 | 2 |
56<=predModeIntra<=80 | 1 |
本申请实施例中,可以根据MIP参数或第一预测值,首先确定出LFNST变换核候选集,然后从码流中获取LFNST索引序号,基于LFNST索引序号,从LFNST变换核候选集中来确定当前块使用的LFNST变换核。这里,LFNST的变换矩阵是通过训练得到的多个固定系数矩阵,LFNST变换核候选集包括有2组变换矩阵(也可以称之为LFNST变换核),当确定出LFNST变换核候选集之后,需要从 LFNST变换核候选集中选取一组LFNST变换核,即确定当前块LFNST时所使用的变换矩阵。
需要说明的是,在扩展的LFNST中,LFNST变换核候选集的数量会更多,以及每个LFNST变换核候选集包括有的变换矩阵的组数有3组,此处不再展开论述。
其中,当选择LFNST变换核候选集中的第一组LFNST变换核(即第一组变换矩阵)时,将lfnst_idx设置为1;当选择LFNST变换核候选集中的第二组LFNST变换核(即第二组变换矩阵)时,将lfnst_idx设置为2。
需要说明的是,在确定出MIP模式索引之后,可以将MIP模式索引序号转换为LFNST帧内预测模式索引序号,即第二类帧内预测模式的第一索引(可以用predModeIntra表示)的取值;然后再根据predModeIntra的取值,从多个LFNST变换核候选集中选择一个LFNST变换核候选集,以确定出变换核候选集;并且在所选择的LFNST变换核候选集中,选择出LFNST索引序号指示的变换核,设置为当前块使用的LFNST变换核。
这里,针对LFNST索引序号的取值,当LFNST索引序号的取值等于0时,将不使用LFNST;而当LFNST索引序号的取值大于0时,将使用LFNST,且变换核的索引序号等于LFNST索引序号的取值、或者该LFNST索引序号的取值减1。
S105、基于第二变换参数,对当前块的变换系数进行变换处理,确定当前块的残差值。
S106、基于残差值和第一预测值,确定当前块的重建值。
在本申请实施例中,变换系数包括:量化系数。
在本申请实施例中,解码器对量化系数进行反量化,得到第一变换系数;对第一变换系数进行转换,得到第一变换系数向量;采用变换核索引参数指示的变换矩阵,对第一变换系数向量进行变换,得到第二变换系数向量;采用变换参数的扫描顺序参数,对第二变换系数向量进行转换,得到第二变换系数;
对第二变换系数进行反变换,得到当前块的残差值。解码器在获取了残差值和第一预测值后,就可以基于残差值和第一预测值,确定当前块的重建值了。
示例性的,在确定出LFNST变换核之后,就可以得到当前块所选择的变换矩阵,这时候就可以对预测差值进行变换处理。
其中,每组变换矩阵还可以包含两种尺寸的基础变换矩阵T,比如16x16和16x48。而针对对于4种尺寸的TU所选择的变换矩阵而言,具体地,对于4x4尺寸的TU,会使用8x16的变换矩阵,该8x16的变换矩阵来自于16x16基础变换矩阵的前8x16;对于4xN或Nx4(N>4)尺寸的TU,会使用16x16的基础变换矩阵;对于8x8尺寸的TU,会使用8x48的变换矩阵,该8x48的变换矩阵来自于16x48基础变换矩阵的前8x48;对于大于8x8尺寸的TU,会使用16x48的基础变换矩阵。需要注意的是,在目前H.266/VVC中,仅存储了解码器侧LFNST的变换矩阵(可以用T
T表示),而编码器侧所使用的变换矩阵为LFNST的变换矩阵的转置矩阵(可以用T表示)。
还需要说明的是,LFNST是基于直接矩阵乘法方式来应用不可分离变换。为了尽可能减小计算复杂度和的存储空间,在LFNST变换中使用了简化的不可分变换技术。其中,简化的不可分变换技术的主要思想是将N维向量映射到不同空间中的R维向量,这里,N/R(R<N)为缩放因子;这时候简化的不可分变换技术所对应的变换矩阵为R×N矩阵,如下所示,
这里,正向LFNST变换和反向LFNST变换所使用的变换矩阵互为转置关系,参见图5,其示出了本申请实施例提供的一种LFNST技术矩阵乘法的计算过程的结构示意图。如图5所示,(a)示出了正向LFNST变换的计算过程,由一次变换系数经过变换矩阵T之后,可以得到二次变换系数;(b)示出了反向LFNST变换的计算过程,由反二次变换系数经过转置变换矩阵T
T之后,可以得到反一次变换系数。
进一步地,在LFNST技术中,可以根据当前块的大小决定是采用4×4不可分变换还是8×8不可分变换;这里,可以将“4×4不可分变换”统称为“4×4 LFNST”,“8×8不可分变换”统称为“8×8 LFNST”。其中,假定当前块的宽度为nTbW,高度为nTbH,那么可以得出:如果min(nTbW,nTbH)<=4,那么可以对当前块使用4×4 LFNST;否则,可以对当前块使用8×8 LFNST。需要注意的是,min(A,B)的返回值是A和B中的较小值。
在一种实施方式中,针对4×4 LFNST,在编码器侧,将会输入16个系数,经过正向LFNST后,会输出16个或8个系数;而在解码器侧,将会输入16个或8个系数,会输出16个系数;也就是说,编码器和解码器关于输入和输出的数量正好相反。
假定变换块(Transform unit,TU)的大小可以表示为nTbW×nTbH,其中,变换块是基于预测差值所得到的预测残差块。即TU可以等于4×4,也可以等于4×N或N×4(N>4)。下面分别对其进行详细描述。
当TU等于4×4时,4×4的变换块对应的正向LFNST过程如图6A所示。其中,在图6A中,白色块为预测差值,灰色块为一次变换系数,黑色块为二次变换系数;这里,在“0”示例的位置上,编码器将变换系数设置为0。对于4×4的变换块,正向LFNST时,使用的变换矩阵大小为8×16,当前变换块内的4×4个一次变换系数全部作为输入,输出为4×2个二次变换系数。
当TU等于4×N或N×4(N>4)时,4×N或N×4的变换块对应的正向LFNST过程如图6B所示。其中,在图6B中,白色块为预测差值,灰色块为一次变换系数,黑色块为二次变换系数;这里,对于4×N或N×4的变换块,正向LFNST时,使用的变换矩阵大小为16×16,当前变换块内的第一个4×4子块(具体地,对于4×N变换块为最上侧子块,对于N×4变换块为最左侧子块)内的一次变换系数作为输入,输出为4×4个二次变换系数。这里,在“0”示例的位置上,编码器将变换系数仍然设置为0。
在另一种实施方式中,对于8×8 LFNST,在编码器侧,将会输入48个系数,经过正向LFNST后,会输出16个或8个系数;而在解码器侧,将会输入16个或8个系数,会输出48个系数;也就是说,编码器和解码器关于输入和输出的数量正好相反。
当TU等于8×8时,8×8的变换块对应的正向LFNST过程如图6C所示。其中,在图6C中,白色块为预测差值,灰色块为一次变换系数,黑色块为二次变换系数;对于8×8的变换块,正向LFNST时,使用的变换矩阵大小为8×48,当前变换块内的前三个4×4子块(即位于左上角的三个子块)的一次变换系数作为输入,输出为4×2个二次变换系数。这里,在“0”示例的位置上,编码器将变换系数仍然设置为0。
当TU大于8×8时,大于8×8的变换块对应的正向LFNST过程如图6D所示。其中,在图6D中,白色块为预测差值,灰色块为一次变换系数,黑色块为二次变换系数;对于大于8×8的变换块,正向LFNST时,使用的变换矩阵大小为48×16,当前变换块内的前三个4×4子块(即位于左上角的三个子块)的一次变换系数作为输入,输出为4×4个二次变换系数。这里,在“0”示例的位置上,编码器将变换系数仍然设置为0。
这样,预测差值所对应的TU无论是4×4大小,还是4×N或N×4(N>4)大小、或者8×8大小,甚至还可以大于8×8大小,这时候可以按照图6A或者图6B或者图6C或者图6D来实现对预测差值的变换处理。
需要说明的是,在选择出LFNST变换核候选集之后,通过解析码流,获得LFNST索引序号(lfnst_idx)的取值;根据lfnst_idx的取值,可以从LFNST变换核候选集中选择出lfnst_idx所指示的变换矩阵(变换核)。例如,当lfnst_idx为1时,解码过程中可以使用第一组变换矩阵作为LFNST变换核;当lfnst_idx为2时,解码过程中可以使用第二组变换矩阵作为LFNST变换核。
进一步地,针对每一组变换矩阵(变换核),包含有两种尺寸的基础变换矩阵,在解码器侧所使用的基础变换矩阵大小为16×16和48×16。根据nLfnstOutSzie进行选择,若nLfnstOutSzie为16,则选择16x16的基础变换矩阵;或者,若nLfnstOutSzie为48,则选择48x16的基础变换矩阵。或者,若nonZeroSize为8,则变换矩阵中仅前8行用于矩阵乘法计算。
进一步地,将二次变换系数向量u[i]作为输入,使用变换矩阵与之相乘得到一次变换系数向量v[j],这里,i=0,1,…,nonZeroSize-1,j=0,1,…,nLfnstOutSzie-1。假定前面步骤获取到的变换矩阵为lowFreqTransMatrix,那么v[j]的具体计算过程如下所示,
这里,Clip3为嵌位工作,可以将系数的值限制在下面的两个数之间,如下所示,
CoeffMin=-(1=15) (8)
CoeffMax=(1=15)-1 (9)
如此,经过上述矩阵计算之后,可以实现对变换系数的变换处理。这里,对于4×4 LFNST,在解码器侧,将会输入16个或8个系数,会输出16个系数;而对于8×8 LFNST,在解码器侧,将会输入16个或8个系数,会输出48个系数,以实现对变换系数的LFNST变换处理。
需要说明的是,如图7所示,LFNST具体过程可以分为四个步骤:配置核心参数81、帧内预测模式映射82、选择变换矩阵83、计算矩阵乘法84和构造一次变换系数矩阵85等五个步骤。其中,对于帧内预测模式映射82来说,该步骤用于确定predModeIntra的取值,主要可以包括:非传统帧内预测模 式映射821和宽角度映射822;对于选择变换矩阵83来说,该步骤用于选择出变换集以及变换矩阵,主要可以包括:选择变换集831、选择变换矩阵组别832和选择变换矩阵尺寸833。
对于配置核心参数81来说,首先需要配置进行LFNST计算的输入二次变换系数向量的长度(可以用nonZeroSize表示)和输出一次变换系数向量的长度(可以用nLfnstOutSzie表示)。其中,针对nonZeroSize和nLfnstOutSzie的取值如表2所示。
表2
变换块尺寸 | nonZeroSize | nLfnstOutSzie |
4×4 | 8 | 16 |
4×N或N×4(N>4) | 16 | 16 |
8×8 | 8 | 48 |
>8×8 | 16 | 48 |
通过以下公式计算得到nonZeroSize和nLfnstOutSzie等参数配置的,公式如下,
nLfnstOutSzie=(nTbW>=8&&nTbH>=8)?48:16 (10)
nonZeroSize=(nTbW==4&&nTbH==4)||(nTbW==8&&nTbH==8)?8:16 (11)
除此之外,还需要配置参数nLfnstSize,表示当前块内仅前nLfnstSize×nLfnstSize范围内会存在有一次变换系数,nLfnstSize的取值如下所示,
Log2LfnstSize=(nTbW>=8&&nTbH>=8)?3:2 (12)
nLfnstSize=1<<Log2LfnstSize (13)
这时候通过解析码流,还可以获取到当前块或者当前块所在编码块的亮度或色度分量的帧内预测模式,这时候可以确定出predModeIntra的取值,计算公式如前述所示。
进一步地,获取二次变化系数的向量u[i],i=0,1,…,nonZeroSize-1。在确定当前变换块使用了LFNST时,此时的反量化后的系数d[x][y]即为二次变换系数。按照对角扫描顺序获取其前nonZeroSize个值,即为二次变化系数的向量u[i],i=0,1,…,nonZeroSize-1;在下式中,xC和yC表示为按照对角顺序,编号为x的系数所在当前块内相对于左上角点的横坐标和纵坐标),xC和yC如下所示,
xC=DiagScanOrder[2][2][x][0] (14)
yC=DiagScanOrder[2][2][x][1] (15)
u[i]=d[xC][yC] (16)
在本申请实施例中,可以提高LFNST技术对使用MIP模式的当前块的适用性,使得变换集(或者变换核)的选取更加灵活。通过分析MIP预测值的特性,建立MIP和传统帧内预测模式的映射,使用MIP的变换块进行LFNST的过程中根据映射后的传统预测模式选取变换集(变换矩阵)和扫描顺序。该方法在ECM4.0上,以48帧间隔在All Intra条件下进行测试,可以在Y,Cb,Cr上分别获得-0.08%,0.05%,-0.10%的BD-rate变化(即同等psnr下平均码率变化),从而提高了解码效率。
基于上述图2A的应用场景示例,参见图8,其示出了本申请实施例提供的一种视频编码方法的流程示意图。如图8所示,该方法可以包括:
S301、确定第一类帧内预测模式参数。
需要说明的是,视频图像可以划分为多个图像块,每个当前待编码的图像块可以称为编码块(Coding Block,CB)。这里,每个编码块可以包括第一图像分量、第二图像分量和第三图像分量;而当前块为视频图像中当前待进行第一图像分量、第二图像分量或者第三图像分量预测的编码块。
其中,假定当前块进行第一图像分量预测,而且第一图像分量为亮度分量,即待预测图像分量为亮度分量,那么当前块也可以称为亮度块;或者,假定当前块进行第二图像分量预测,而且第二图像分量为色度分量,即待预测图像分量为色度分量,那么当前块也可以称为色度块。
还需要说明的是,预测模式参数指示了当前块的编码模式及该模式相关的参数。通常可以采用率失真优化(Rate Distortion Optimization,RDO)的方式确定当前块的预测模式参数。
具体地,在一些实施例中,确定当前块的预测模式参数,可以包括:
确定当前块的待预测图像分量;
基于所述当前块的参数,利用多种预测模式分别对所述待预测图像分量进行预测编码,计算多种预测模式下每一种预测模式对应的率失真代价结果;
从计算得到的多个率失真代价结果中选取最小率失真代价结果,并将所述最小率失真代价结果对应的预测模式确定为所述当前块的预测模式参数。
也就是说,在编码器侧,针对当前块可以采用多种预测模式分别对待预测图像分量进行编码。这里,多种预测模式通常包括有传统帧内预测模式和非传统帧内预测模式,而传统帧内预测模式又可以包括有直流(Direct Current,DC)模式、平面(PLANAR)模式和角度模式等,非传统帧内预测模式又可以包括有MIP模式、跨分量线性模型预测(Cross-component Linear Model Prediction,CCLM)模式、帧内块复制(Intra Block Copy,IBC)模式和PLT(Palette)模式等。
这样,在利用多种预测模式分别对当前块进行编码之后,可以得到每一种预测模式对应的率失真代价结果;然后从所得到的多个率失真代价结果中选取最小率失真代价结果,并将该最小率失真代价结果对应的预测模式确定为当前块的预测模式参数;如此,最终可以使用所确定的预测模式对当前块进行编码,而且在这种预测模式下,可以使得预测残差小,能够提高编码效率。
S302、根据第一类帧内预测模式参数,确定当前块的第一预测值,并计算当前块的原始值与第一预测值之间的残差值。
S303、根据当前块的第一预测值或第一类帧内预测模式参数,确定当前块的第一变换参数。
S304、基于第一变换参数,确定对当前块进行变换的第二变换参数。
S305、基于第二变换参数,对残差值进行变换处理,得到当前块的变换系数。
在本申请实施例中,解码器可以基于当前块的第一预测值,确定当前块的第一变换参数。解码器也可以基于当前块的第一类帧内预测模式参数,确定当前块的第一变换参数,本申请实施例不作限制。
在本申请的一些实施例中,针对解码器基于当前块的第一预测值,确定当前块的第一变换参数的实现可以包括:
S1、基于当前块的第一预测值,确定当前块的第二类帧内预测模式的第一索引;
S2、基于当前块的第二类帧内预测模式的第一索引,确定当前块的第一变换参数。
在本申请实施例中,解码器可以通过当前块的第一预测值来确定第二类帧内预测模式的第一索引,其中,第二类帧内预测模式包括以下至少之一:平面模式、直流模式和帧内角度预测模式。然后,解码器就可以基于当前块的第二类帧内预测模式的第一索引,确定当前块的第一变换参数。
本申请实施例中的第一变换参数为确定第二变换参数,即变换核索引参数(指变换系数矩阵索引)和变换参数的扫描顺序参数的依据。
也就是说,解码器可以通过将非传统帧内预测模式,映射到传统帧内预测模式中,通过传统帧内预测模式的第一索引来确定当前块的第一变换参数,进而使得当前块在非传统帧内预测模式下,可以采用与传统帧内预测模式对应的灵活方式,选择要进行参数变换的第二变换参数,提高了了非传统帧内预测模式(第一类帧内预测模式)的适用性,还提高了编码效率,同时还能够提升视频图像质量。
需要说明的是,在本申请实施例中,第一预测值可以为采用第一类帧内预测模式进行帧内预测的最终预测值,也可以为在采用第一类帧内预测模式进行帧内预测过程中的中间预测值。
示例性的,针对MIP模式,第一预测值可以为MIP预测中,上采样后的最终预测值,也可以为MIP预测中,上采样之前的中间预测值,本申请实施例不作限制。
在本申请的一些实施例中,解码器可以将当前块的第一变换参数设置为等于当前块的第二类帧内预测模式的第一索引。
在本申请的一些实施例中,针对S1的实现如下所示,包括:S201、基于第一预测值,确定第一预测值的第二类帧内预测模式的索引集;
S202、基于第一预测值的第二类帧内预测模式的索引集,确定当前块的第二类帧内预测模式的第一索引;其中,第二类帧内预测模式的索引集中存储了第二类帧内预测模式的索引的部分或全部容许取值对应的累积权重值。
在本申请的一些实施例中,对于第一预测值中的部分或全部的预测值,确定部分或全部预测值对应的采样点的水平方向梯度值和垂直方向梯度值;根据采样点的水平方向梯度值和垂直方向梯度值,确定第一预测值的第二类帧内预测模式的索引集。
编码器根据采样点的水平方向梯度值和垂直方向梯度值,确定第一预测值的第二类帧内预测模式的索引集,包括:(1)和(2)。
(1)、根据采样点的水平方向梯度值和垂直方向梯度值,确定采样点的梯度角度值;根据采样点的梯度角度值,确定对应于梯度角度值的第二类帧内预测模式的第二索引;更新第二类帧内预测模式的索引集中对应于所确定的第二类帧内预测模式的第二索引的累积权重值。
在本申请的一些实施例中,根据采样点的水平方向梯度值和垂直方向梯度值,确定采样点的梯度角度值,包括:基于采样点的水平方向梯度值和垂直方向梯度值、以及预设的函数关系,确定采样点的梯度角度值。预设的函数关系为反正切函数;其中,反正切函数是采样点的水平方向梯度值和垂直方向梯度值的比值;
在本申请的一些实施例中,基于采样点的水平方向梯度值和垂直方向梯度值、以及预设的函数关系,确定采样点的梯度角度值,包括:基于反正切函数,对所述采样点的水平方向梯度值和垂直方向梯度值的比值进行处理,确定采样点的梯度角度值。
其中,预设的函数关系是采样点的梯度角度值与采样点的水平方向梯度值和垂直方向梯度值之间的第二映射表;
在本申请的一些实施例中,基于采样点的水平方向梯度值和垂直方向梯度值、以及预设的函数关系,确定采样点的梯度角度值,包括:将采样点的水平方向梯度值和垂直方向梯度值,或者采样点的水平方向梯度值和垂直方向梯度值的比值输入第二映射表,输出采样点的梯度角度值。
在本申请的一些实施例中,根据采样点的梯度角度值,确定对应于梯度角度值的第二类帧内预测模式的第二索引,包括:从与第二类帧内预测模式的索引的部分或全部容许取值所指示的帧内角度预测的方向中,确定与梯度角度值所指示方向之间夹角最小的帧内角度预测方向所对应的第二类帧内预测模式索引值;将梯度角度值的第二类帧内预测模式的第二索引,设置为第二类帧内预测模式索引值。
或者,根据预设的梯度角度值与第二类帧内预测模式索引之间的第三映射表,确定对应于梯度角度值的第二类帧内预测模式的第二索引。
第三映射表表征不同取值或不同取值范围内的梯度角度值与第二类帧内预测模式索引之间的对应关系。
(2)、编码器根据采样点的水平方向梯度值和垂直方向梯度值,确定采样点对应的梯度方向、第一梯度强度和模式分区;采样点对应的梯度方向、第一梯度强度和模式分区,确定第二类帧内预测模式的第二索引;更新第二类帧内预测模式的索引集中对应于所确定的第二类帧内预测模式的第二索引的累积权重值。
在本申请的一些实施例中,根据采样点的水平方向梯度值和垂直方向梯度值,确定采样点对应的梯度方向、第一梯度强度和模式分区,包括:基于采样点的水平方向梯度值和垂直方向梯度值,确定采样点的第一梯度强度;基于采样点的水平方向梯度值和垂直方向梯度值,对采样点进行第二类帧内预测模式的分区处理,确定采样点的水平区域索引、垂直区域索引和梯度强度索引;基于采样点的水平区域索引、垂直区域索引和梯度强度索引,确定采样点的模式分区;基于采样点的梯度强度索引,确定采样点对应的梯度方向。
在本申请的一些实施例中,采样点对应的梯度方向、第一梯度强度和模式分区,确定第二类帧内预测模式的第二索引,包括:根据采样点对应的梯度方向,确定采样点的梯度偏移比值;将采样点的梯度偏移比值,映射到预设模式偏移范围内,得到采样点的帧内预测模式索引偏移量;根据预设模式分区与模式索引的第四映射表,确定与采样点的模式分区对应的目标第二类帧内预测模式;结合目标第二类帧内预测模式和帧内预测模式索引偏移量,确定采样点的第二类帧内预测模式的第二索引。
在本申请的一些实施例中,更新第二类帧内预测模式的索引集中对应于所确定的第二类帧内预测模式的第二索引的累积权重值,包括:对第二类帧内预测模式的索引集中,对应于所确定的第二类帧内预测模式的第二索引的累积权重值增加设定的数值。
其中,设定的数值等于1,或者,设定的数值等于水平方向梯度值的绝对值与垂直方向梯度值的绝对值之和。
在本申请的一些实施例中,基于第一预测值的第二类帧内预测模式的索引集,确定当前块的第二类帧内预测模式的第一索引,包括:将当前块的第二类帧内预测模式的第一索引,设置为第一预测值的第二类帧内预测模式的索引集中,最大的累积权重值对应的第二类预测模式的第二索引。
在本申请的一些实施例中,基于当前块的第一预测值,确定当前块的第二类帧内预测模式的第一索引,包括:根据候选第二类帧内预测模式,确定当前块的第二类帧内预测值;根据第一帧内预测值与第二类帧内预测值,确定当前块的第二类帧内预测模式的第一索引。
其中,候选第二类帧内预测模式包括以下帧内预测模式的一种或多种:平面模式、直流模式、帧内角度预测模式。
在本申请的一些实施例中,确定第一帧内预测值与第二类帧内预测值的第一预测误差;将第一预测误差满足第一预设条件时对应的候选第二类帧内预测模式对应的索引值,确定为当前块的第二类帧内预测模式的第一索引。
确定第一预测差值的方式包括以下两种:
方式一:根据第一误差准则,确定第一帧内预测值与第二类帧内预测值的第一预测差值;
其中,第一误差准则是以下误差准则之一:绝对误差和(SAD)、平方误差和(SSD)、平均绝对误差(MAD)和均方误差(MSE);第一预设条件是第一预测误差达到最小值。
方式二:根据第二误差准则,确定第一帧内预测值与第二类帧内预测值的第一预测差值;
其中,第二误差准则是以下误差准则之一:信噪比(SNR)和峰值信噪比(PSNR);第一预设条件是第一预测误差达到最大值。
在本申请的一些实施例中,针对解码器基于当前块的第一类帧内预测模式参数,确定当前块的第一变换参数的实现可以包括:基于第一类帧内预测模式参数,确定当前块的第二类帧内预测模式的第一索引;基于第二类帧内预测模式的第一索引,确定当前块的第一变换参数。
在本申请的一些实施例中,基于第一类帧内预测模式参数,确定当前块的第二类帧内预测模式的第一索引包括两种方式:
方式一:
编码器根据第一类帧内预测模式参数与第二类帧内预测模式索引的第一预设映射关系,确定当前块的第二类帧内预测模式的第一索引。
第一类帧内预测模式参数包括:第一类帧内预测模式索引;第一预设映射关系表示第一类帧内预测模式索引与第二类帧内预测模式索引之间的对应关系;
在本申请的一些实施例中,编码器根据第一类帧内预测模式参数与第二类帧内预测模式索引的第一预设映射关系,确定当前块的第二类帧内预测模式的第一索引,包括:根据述第一类帧内预测模式索引,从第一预设映射关系中,确定第二类帧内预测模式的第一索引。
方式二:
编码器基于第一类帧内预测模式参数指示的第一类帧内预测模式加权矩阵,确定当前块的第二类帧内预测模式的第一索引。
在本申请的一些实施例中,编码器基于第一类帧内预测模式参数指示的第一类帧内预测模式加权矩阵,确定当前块的第二类帧内预测模式的第一索引,包括:确定第一类帧内预测模式加权矩阵的梯度参数;根据第一类帧内预测模式加权矩阵的梯度参数,确定当前块的第二类帧内预测模式的第一索引。
针对S2,编码器基于第二类帧内预测模式的第一索引,确定当前块的第一变换参数,包括:将第二类帧内预测模式的第一索引进行宽角度映射,确定宽角度预测模式索引;基于宽角度预测模式索引,确定第一变换参数。
在本申请的一些实施例中,编码器基于第一变换参数,确定对当前块进行变换的第二变换参数,包括:根据预设的第一变换参数与第二变换参数之间的第一映射表,确定与第一变换参数对应的第二变换参数。
其中,第二变换参数包括以下至少之一:变换核索引参数(指变换系数矩阵索引)和变换参数的扫描顺序参数;其中,变换核索引参数指示对当前块的变换参数进行解码过程中使用的变换核;扫描顺序参数指示变换参数的扫描顺序,扫描顺序包括水平顺序和垂直顺序。
在本申请的一些实施例中,所述基于所述第二变换参数,对所述残差值进行变换处理,得到当前块的变换系数,包括:对所述残差值进行变换,得到第二变换系数;采用所述变换参数的扫描顺序参数,对所述第二变换系数进行转换,得到第二变换系数向量;采用所述变换核索引参数指示的变换矩阵,对所述第二变换系数向量进行变换,得到第一变换系数向量;对第一变换系数向量进行转换,得到第一变换系数;对所述第一变换系数进行量化,得到当前块的量化系数,所述量化系数为所述当前块的变换系数。
需要说明的是,编码器确定第二类帧内预测模式的第一索引的描述和说明,与解码器的一致,此处不再赘述。不同的是,预测模式参数指示了当前块的编码模式及该模式相关的参数。通常编码器可以采用率失真优化(Rate Distortion Optimization,RDO)的方式确定当前块的预测模式参数。
编码器在确定当前块使用的LFNST变换核,设置LFNST索引序号并写入视频码流。
需要说明的是,由于LFNST变换核候选集中包括有预设的用于MIP的两个或多个变换核,这时候可以使用率失真优化的方式选择当前块使用的变换核。具体地,可以针对每一种变换核分别使用率失真优化的方式计算率失真代价(Rate Distortion Cost,RDCost),然后选取率失真代价最小的变换核作为当前块使用的变换核。也就是说,在编码器侧,可以通过RDCost选择出一组LFNST变换核,并将LFNST变换核对应的索引序号(可以用lfnst_idx表示)写入视频码流,传输到解码器侧。
可以理解的是,针对采用第一类帧内预测模式(例如MIP)的当前块来说,由于在进行LFNST变换时引入了当前块的第一预测值或者第一类帧内预测模式参数,使得在变换技术中,变换核或者变换矩阵(对应第二变换参数)的选择更加灵活,从而不仅提高了非传统帧内预测模式(第一类帧内预测模式)的适用性,还提高了编码效率,同时还能够提升视频图像质量。
基于前述实施例相同的发明构思,参见图9,其示出了本申请实施例提供的一种解码器1的组成结构示意图。如图9所示,该解码器1可以包括:
解码部分10,被配置为解码码流,确定当前块的第一类帧内预测模式参数;
第一预测部分11,被配置为根据所述第一类帧内预测模式参数,确定所述当前块的第一预测值;
第一确定部分12,被配置为基于所述当前块的第一预测值或所述第一类帧内预测模式参数,确定所述当前块的第一变换参数;及基于所述第一变换参数,确定对所述当前块进行变换的第二变换参数;
第一变换部分13,被配置为基于所述第二变换参数,对所述当前块的变换系数进行变换处理,确定所述当前块的残差值;
重建部分14,被配置为基于所述残差值和所述第一预测值,确定所述当前块的重建值。
在本申请的一些实施例中,所述基于所述当前块的第一预测值或所述第一类帧内预测参数,确定所述当前块的第一变换参数,包括:
基于所述当前块的第一预测值,确定所述当前块的第二类帧内预测模式的第一索引;
基于所述当前块的所述第二类帧内预测模式的第一索引,确定所述当前块的第一变换参数。
在本申请的一些实施例中,所述基于所述当前块的第一预测值或所述第一类帧内预测参数,确定所述当前块的第一变换参数,包括:
基于所述第一类帧内预测模式参数,确定所述当前块的第二类帧内预测模式的第一索引;
基于所述第二类帧内预测模式的第一索引,确定所述当前块的第一变换参数。
在本申请的一些实施例中,所述第二类帧内预测模式包括以下至少之一:平面模式、直流模式和帧内角度预测模式。
在本申请的一些实施例中,所述第一确定部分12,还被配置为将所述当前块的第一变换参数设置为等于所述当前块的所述第二类帧内预测模式的第一索引。
在本申请的一些实施例中,所述第一变换部分13,还被配置为根据预设的第一变换参数与第二变换参数之间的第一映射表,确定与所述第一变换参数对应的所述第二变换参数。
在本申请的一些实施例中,所述第二变换参数包括以下至少之一:变换核索引参数和变换参数的扫描顺序参数;其中,所述变换核索引参数指示对所述当前块的变换参数进行解码过程中使用的变换核;所述扫描顺序参数指示变换参数的扫描顺序,所述扫描顺序包括水平顺序和垂直顺序。
在本申请的一些实施例中,所述第一确定部分12,还被配置为基于所述第一预测值,确定所述第一预测值的第二类帧内预测模式的索引集;
基于所述第一预测值的第二类帧内预测模式的索引集,确定所述当前块的所述第二类帧内预测模式的第一索引;其中,所述第二类帧内预测模式的索引集中存储了第二类帧内预测模式的索引的部分或全部容许取值对应的累积权重值。
在本申请的一些实施例中,所述第一确定部分12,还被配置为对于所述第一预测值中的部分或全部的预测值,确定所述部分或全部预测值对应的采样点的水平方向梯度值和垂直方向梯度值;
根据所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述第一预测值的所述第二类帧内预测模式的索引集。
在本申请的一些实施例中,所述第一确定部分12,还被配置为根据所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述采样点的梯度角度值;
根据所述采样点的梯度角度值,确定对应于所述梯度角度值的第二类帧内预测模式的第二索引;
更新所述第二类帧内预测模式的索引集中对应于所确定的第二类帧内预测模式的第二索引的累积权重值。
在本申请的一些实施例中,所述第一确定部分12,还被配置为基于所述采样点的所述水平方向梯度值和所述垂直方向梯度值、以及预设的函数关系,确定所述采样点的梯度角度值。
在本申请的一些实施例中,所述预设的函数关系为反正切函数;其中,所述反正切函数是所述采样点的所述水平方向梯度值和所述垂直方向梯度值的比值;
在本申请的一些实施例中,所述第一确定部分12,还被配置为基于所述反正切函数,对所述采样点的所述水平方向梯度值和所述垂直方向梯度值的比值进行处理,确定所述采样点的梯度角度值。
在本申请的一些实施例中,所述预设的函数关系是所述采样点的梯度角度值与所述采样点的水平方向梯度值和垂直方向梯度值之间的第二映射表;
在本申请的一些实施例中,所述第一确定部分12,还被配置为将所述采样点的水平方向梯度值和垂直方向梯度值,或者所述采样点的水平方向梯度值和垂直方向梯度值的比值输入所述第二映射表,输出所述采样点的梯度角度值。
在本申请的一些实施例中,所述第一确定部分12,还被配置为从与所述第二类帧内预测模式的索引的部分或全部容许取值所指示的帧内角度预测的方向中,确定与所述梯度角度值所指示方向之间夹角最小的帧内角度预测方向所对应的第二类帧内预测模式索引值;
将所述梯度角度值的所述第二类帧内预测模式的第二索引,设置为所述第二类帧内预测模式索引值。
在本申请的一些实施例中,所述第一确定部分12,还被配置为根据预设的梯度角度值与第二类帧内预测模式索引之间的第三映射表,确定对应于所述梯度角度值的所述第二类帧内预测模式的第二索引。
在本申请的一些实施例中,所述第三映射表表征不同取值或不同取值范围内的梯度角度值与第二类帧内预测模式索引之间的对应关系。
在本申请的一些实施例中,所述第一确定部分12,还被配置为对所述第二类帧内预测模式的索引集中,对应于所确定的第二类帧内预测模式的第二索引的累积权重值增加设定的数值。
在本申请的一些实施例中,所述设定的数值等于1。
在本申请的一些实施例中,所述设定的数值等于所述水平方向梯度值的绝对值与所述垂直方向梯度值的绝对值之和。
在本申请的一些实施例中,所述第一确定部分12,还被配置为将所述当前块的第二类帧内预测模式的第一索引,设置为所述第一预测值的第二类帧内预测模式的索引集中,最大的累积权重值对应的第二类预测模式的第二索引。
在本申请的一些实施例中,所述第一确定部分12,还被配置为根据候选第二类帧内预测模式,确定当前块的第二类帧内预测值;
根据所述第一帧内预测值与所述第二类帧内预测值,确定所述当前块的所述第二类帧内预测模式的第一索引。
在本申请的一些实施例中,所述候选第二类帧内预测模式包括以下帧内预测模式的一种或多种:平面模式、直流模式、帧内角度预测模式。
在本申请的一些实施例中,所述第一确定部分12,还被配置为确定所述第一帧内预测值与所述第二类帧内预测值的第一预测误差;
将所述第一预测误差满足第一预设条件时对应的候选第二类帧内预测模式对应的索引值,确定为所述当前块的所述第二类帧内预测模式的第一索引。
在本申请的一些实施例中,所述第一确定部分12,还被配置为根据第一误差准则,确定所述第一帧内预测值与所述第二类帧内预测值的所述第一预测差值;
其中,所述第一误差准则是以下误差准则之一:绝对误差和、平方误差和、平均绝对误差和均方误差;所述第一预设条件是所述第一预测误差达到最小值。
在本申请的一些实施例中,所述第一确定部分12,还被配置为根据第二误差准则,确定所述第一帧内预测值与所述第二类帧内预测值的所述第一预测差值;
其中,所述第二误差准则是以下误差准则之一:信噪比和峰值信噪比;所述第一预设条件是所述第一预测误差达到最大值。
在本申请的一些实施例中,所述第一确定部分12,还被配置为根据所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述采样点对应的梯度方向、第一梯度强度和模式分区;
所述采样点对应的所述梯度方向、所述第一梯度强度和所述模式分区,确定第二类帧内预测模式的第二索引;
更新所述第二类帧内预测模式的索引集中对应于所确定的第二类帧内预测模式的第二索引的累积权重值。
在本申请的一些实施例中,所述第一确定部分12,还被配置为基于所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述采样点的所述第一梯度强度;
基于所述采样点的所述水平方向梯度值和所述垂直方向梯度值,对所述采样点进行第二类帧内预测模式的分区处理,确定所述采样点的水平区域索引、垂直区域索引和梯度强度索引;
基于所述采样点的所述水平区域索引、所述垂直区域索引和所述梯度强度索引,确定所述采样点的所述模式分区;
基于所述采样点的梯度强度索引,确定所述采样点对应的所述梯度方向。
在本申请的一些实施例中,所述第一确定部分12,还被配置为根据所述采样点对应的梯度方向,确定采样点的梯度偏移比值;
将所述采样点的所述梯度偏移比值,映射到预设模式偏移范围内,得到采样点的帧内预测模式索引偏移量;
根据预设模式分区与模式索引的第四映射表,确定与所述采样点的所述模式分区对应的目标第二类帧内预测模式;
结合所述目标第二类帧内预测模式和所述帧内预测模式索引偏移量,确定所述采样点的第二类帧内预测模式的第二索引。
在本申请的一些实施例中,所述第一确定部分12,还被配置为根据第一类帧内预测模式参数与第 二类帧内预测模式索引的第一预设映射关系,确定所述当前块的所述第二类帧内预测模式的第一索引。
在本申请的一些实施例中,所述第一类帧内预测模式参数包括:第一类帧内预测模式索引;所述第一预设映射关系表示第一类帧内预测模式索引与第二类帧内预测模式索引之间的对应关系;
所述第一确定部分12,还被配置为根据述第一类帧内预测模式索引,从所述第一预设映射关系中,确定所述第二类帧内预测模式的第一索引。
在本申请的一些实施例中,所述第一确定部分12,还被配置为基于所述第一类帧内预测模式参数指示的第一类帧内预测模式加权矩阵,确定所述当前块的所述第二类帧内预测模式的第一索引。
在本申请的一些实施例中,所述第一确定部分12,还被配置为确定所述第一类帧内预测模式加权矩阵的梯度参数;
根据所述第一类帧内预测模式加权矩阵的梯度参数,确定所述当前块的所述第二类帧内预测模式的第一索引。
在本申请的一些实施例中,所述第一确定部分12,还被配置为将所述所述第二类帧内预测模式的第一索引进行宽角度映射,确定宽角度预测模式索引;
基于所述宽角度预测模式索引,确定所述第一变换参数。
在本申请的一些实施例中,所述变换系数包括:量化系数;所述第一变换部分13,还被配置为对所述量化系数进行反量化,得到第一变换系数;
对所述第一变换系数进行转换,得到第一变换系数向量;
采用所述变换核索引参数指示的变换矩阵,对所述第一变换系数向量进行变换,得到第二变换系数向量;
采用所述变换参数的扫描顺序参数,对所述第二变换系数向量进行转换,得到第二变换系数;
对所述第二变换系数进行反变换,得到所述当前块的所述残差值。
基于前述实施例相同的发明构思,参见图10,其示出了本申请实施例提供的一种解码器的组成结构示意图。如图10所示,该解码器可以包括:
第一存储器1002,被配置为存储在第一处理器上运行的计算机程序;
所述第一处理器1003,用于在运行所述计算机程序时,执行解码器的方法。
在本申请实施例中,解码器还包括:第一通信接口1001;第一通信接口1001,用于在与其他外部网元之间进行收发信息过程中,信号的接收和发送。各个组件通过第一总线系统1004耦合在一起。可理解,第一总线系统1004用于实现这些组件之间的连接通信。第一总线系统1004除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图10中将各种总线都标为第一总线系统1004。
可以理解,本申请实施例中的第一存储器1002可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(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)。本申请描述的系统和方法的第一存储器1002旨在包括但不限于这些和任意其它适合类型的存储器。
而第一处理器1003可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过第一处理器1003中的硬件的集成逻辑电路或者软件形式的指令完成。上述的第一处理器1003可以是通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于第一存储器1002,第一处理器1003读取第一存储器1002中的信息,结合其硬件完成上述方法的步骤。
可以理解的是,本申请描述的这些实施例可以用硬件、软件、固件、中间件、微码或其组合来实现。 对于硬件实现,处理单元可以实现在一个或多个专用集成电路(Application Specific Integrated Circuits,ASIC)、数字信号处理器(Digital Signal Processing,DSP)、数字信号处理设备(DSP Device,DSPD)、可编程逻辑设备(Programmable Logic Device,PLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、通用处理器、控制器、微控制器、微处理器、用于执行本申请所述功能的其它电子单元或其组合中。对于软件实现,可通过执行本申请所述功能的模块(例如过程、函数等)来实现本申请所述的技术。软件代码可存储在存储器中并通过处理器执行。存储器可以在处理器中或在处理器外部实现。
可选地,作为另一个实施例,第一处理器1003还配置为在运行所述计算机程序时,执行前述实施例中任一项所述的方法。
基于前述实施例相同的发明构思,参见图11,其示出了本申请实施例提供的一种编码器2的组成结构示意图。如图11所示,该编码器2可以包括:
第二确定部分20,被配置为确定第一类帧内预测模式参数;
第二预测部分21,被配置为根据所述第一类帧内预测模式参数,确定所述当前块的第一预测值;
所述第二确定部分20,还被配置为计算当前块的原始值与所述第一预测值之间的残差值;及根据所述当前块的第一预测值或所述第一类帧内预测模式参数,确定所述当前块的第一变换参数;以及基于所述第一变换参数,确定对所述当前块进行变换的第二变换参数;
第二变换部分22,被配置为基于所述第二变换参数,对所述残差值进行变换处理,得到当前块的变换系数。
在本申请的一些实施例中,所述第二确定部分20,还被配置为基于所述当前块的第一预测值,确定所述当前块的第二类帧内预测模式的第一索引;
基于所述当前块的所述第二类帧内预测模式的第一索引,确定所述当前块的第一变换参数。
在本申请的一些实施例中,所述基于所述当前块的第一预测值或所述第一类帧内预测参数,确定所述当前块的第一变换参数,包括:
基于所述第一类帧内预测模式参数,确定所述当前块的第二类帧内预测模式的第一索引;
基于所述第二类帧内预测模式的第一索引,确定所述当前块的第一变换参数。
在本申请的一些实施例中,所述第二类帧内预测模式包括以下至少之一:平面模式、直流模式和帧内角度预测模式。
在本申请的一些实施例中,所述第二确定部分20,还被配置为将所述当前块的第一变换参数设置为等于所述当前块的所述第二类帧内预测模式的第一索引。
在本申请的一些实施例中,所述第二变换部分22,还被配置为根据预设的第一变换参数与第二变换参数之间的第一映射表,确定与所述第一变换参数对应的所述第二变换参数。
在本申请的一些实施例中,所述第二变换参数包括以下至少之一:变换核索引参数和变换参数的扫描顺序参数;其中,所述变换核索引参数指示对所述当前块的变换参数进行解码过程中使用的变换核;所述扫描顺序参数指示变换参数的扫描顺序,所述扫描顺序包括水平顺序和垂直顺序。
在本申请的一些实施例中,所述第二确定部分20,还被配置为基于所述第一预测值,确定所述第一预测值的第二类帧内预测模式的索引集;
基于所述第一预测值的第二类帧内预测模式的索引集,确定所述当前块的所述第二类帧内预测模式的第一索引;其中,所述第二类帧内预测模式的索引集中存储了第二类帧内预测模式的索引的部分或全部容许取值对应的累积权重值。
在本申请的一些实施例中,所述第二确定部分20,还被配置为对于所述第一预测值中的部分或全部的预测值,确定所述部分或全部预测值对应的采样点的水平方向梯度值和垂直方向梯度值;
根据所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述第一预测值的所述第二类帧内预测模式的索引集。
在本申请的一些实施例中,所述第二确定部分20,还被配置为根据所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述采样点的梯度角度值;
根据所述采样点的梯度角度值,确定对应于所述梯度角度值的第二类帧内预测模式的第二索引;
更新所述第二类帧内预测模式的索引集中对应于所确定的第二类帧内预测模式的第二索引的累积权重值。
在本申请的一些实施例中,所述第二确定部分20,还被配置为基于所述采样点的所述水平方向梯度值和所述垂直方向梯度值、以及预设的函数关系,确定所述采样点的梯度角度值。
在本申请的一些实施例中,所述预设的函数关系为反正切函数;其中,所述反正切函数是所述采样点的所述水平方向梯度值和所述垂直方向梯度值的比值;
在本申请的一些实施例中,所述第二确定部分20,还被配置为基于所述反正切函数,对所述采样 点的所述水平方向梯度值和所述垂直方向梯度值的比值进行处理,确定所述采样点的梯度角度值。
在本申请的一些实施例中,所述预设的函数关系是所述采样点的梯度角度值与所述采样点的水平方向梯度值和垂直方向梯度值之间的第二映射表;
在本申请的一些实施例中,所述第二确定部分20,还被配置为将所述采样点的水平方向梯度值和垂直方向梯度值,或者所述采样点的水平方向梯度值和垂直方向梯度值的比值输入所述第二映射表,输出所述采样点的梯度角度值。
在本申请的一些实施例中,所述第二确定部分20,还被配置为从与所述第二类帧内预测模式的索引的部分或全部容许取值所指示的帧内角度预测的方向中,确定与所述梯度角度值所指示方向之间夹角最小的帧内角度预测方向所对应的第二类帧内预测模式索引值;
将所述梯度角度值的所述第二类帧内预测模式的第二索引,设置为所述第二类帧内预测模式索引值。
在本申请的一些实施例中,所述第二确定部分20,还被配置为根据预设的梯度角度值与第二类帧内预测模式索引之间的第三映射表,确定对应于所述梯度角度值的所述第二类帧内预测模式的第二索引。
在本申请的一些实施例中,所述第三映射表表征不同取值或不同取值范围内的梯度角度值与第二类帧内预测模式索引之间的对应关系。
在本申请的一些实施例中,所述第二确定部分20,还被配置为对所述第二类帧内预测模式的索引集中,对应于所确定的第二类帧内预测模式的第二索引的累积权重值增加设定的数值。
在本申请的一些实施例中,所述设定的数值等于1。
在本申请的一些实施例中,所述设定的数值等于所述水平方向梯度值的绝对值与所述垂直方向梯度值的绝对值之和。
在本申请的一些实施例中,所述第二确定部分20,还被配置为将所述当前块的第二类帧内预测模式的第一索引,设置为所述第一预测值的第二类帧内预测模式的索引集中,最大的累积权重值对应的第二类预测模式的第二索引。
在本申请的一些实施例中,所述第二确定部分20,还被配置为根据候选第二类帧内预测模式,确定当前块的第二类帧内预测值;
根据所述第一帧内预测值与所述第二类帧内预测值,确定所述当前块的所述第二类帧内预测模式的第一索引。
在本申请的一些实施例中,所述候选第二类帧内预测模式包括以下帧内预测模式的一种或多种:平面模式、直流模式、帧内角度预测模式。
在本申请的一些实施例中,所述第二确定部分20,还被配置为确定所述第一帧内预测值与所述第二类帧内预测值的第一预测误差;
将所述第一预测误差满足第一预设条件时对应的候选第二类帧内预测模式对应的索引值,确定为所述当前块的所述第二类帧内预测模式的第一索引。
在本申请的一些实施例中,所述第二确定部分20,还被配置为根据第一误差准则,确定所述第一帧内预测值与所述第二类帧内预测值的所述第一预测差值;
其中,所述第一误差准则是以下误差准则之一:绝对误差和、平方误差和、平均绝对误差和均方误差;所述第一预设条件是所述第一预测误差达到最小值。
在本申请的一些实施例中,所述第二确定部分20,还被配置为根据第二误差准则,确定所述第一帧内预测值与所述第二类帧内预测值的所述第一预测差值;
其中,所述第二误差准则是以下误差准则之一:信噪比和峰值信噪比;所述第一预设条件是所述第一预测误差达到最大值。
在本申请的一些实施例中,所述第二确定部分20,还被配置为根据所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述采样点对应的梯度方向、第一梯度强度和模式分区;
所述采样点对应的所述梯度方向、所述第一梯度强度和所述模式分区,确定第二类帧内预测模式的第二索引;
更新所述第二类帧内预测模式的索引集中对应于所确定的第二类帧内预测模式的第二索引的累积权重值。
在本申请的一些实施例中,所述第二确定部分20,还被配置为基于所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述采样点的所述第一梯度强度;
基于所述采样点的所述水平方向梯度值和所述垂直方向梯度值,对所述采样点进行第二类帧内预测模式的分区处理,确定所述采样点的水平区域索引、垂直区域索引和梯度强度索引;
基于所述采样点的所述水平区域索引、所述垂直区域索引和所述梯度强度索引,确定所述采样点的所述模式分区;
基于所述采样点的梯度强度索引,确定所述采样点对应的所述梯度方向。
在本申请的一些实施例中,所述第二确定部分20,还被配置为根据所述采样点对应的梯度方向,确定采样点的梯度偏移比值;
将所述采样点的所述梯度偏移比值,映射到预设模式偏移范围内,得到采样点的帧内预测模式索引偏移量;
根据预设模式分区与模式索引的第四映射表,确定与所述采样点的所述模式分区对应的目标第二类帧内预测模式;
结合所述目标第二类帧内预测模式和所述帧内预测模式索引偏移量,确定所述采样点的第二类帧内预测模式的第二索引。
在本申请的一些实施例中,所述第二确定部分20,还被配置为根据第一类帧内预测模式参数与第二类帧内预测模式索引的第一预设映射关系,确定所述当前块的所述第二类帧内预测模式的第一索引。
在本申请的一些实施例中,所述第一类帧内预测模式参数包括:第一类帧内预测模式索引;所述第一预设映射关系表示第一类帧内预测模式索引与第二类帧内预测模式索引之间的对应关系;
所述第二确定部分20,还被配置为根据述第一类帧内预测模式索引,从所述第一预设映射关系中,确定所述第二类帧内预测模式的第一索引。
在本申请的一些实施例中,所述第二确定部分20,还被配置为基于所述第一类帧内预测模式参数指示的第一类帧内预测模式加权矩阵,确定所述当前块的所述第二类帧内预测模式的第一索引。
在本申请的一些实施例中,所述第二确定部分20,还被配置为确定所述第一类帧内预测模式加权矩阵的梯度参数;
根据所述第一类帧内预测模式加权矩阵的梯度参数,确定所述当前块的所述第二类帧内预测模式的第一索引。
在本申请的一些实施例中,所述第二确定部分20,还被配置为将所述所述第二类帧内预测模式的第一索引进行宽角度映射,确定宽角度预测模式索引;
基于所述宽角度预测模式索引,确定所述第一变换参数。
在本申请的一些实施例中,所述第二变换部分22,还被配置为对所述残差值进行变换,得到第二变换系数;
采用所述变换参数的扫描顺序参数,对所述第二变换系数进行转换,得到第二变换系数向量;
采用所述变换核索引参数指示的变换矩阵,对所述第二变换系数向量进行变换,得到第一变换系数向量;
对第一变换系数向量进行转换,得到第一变换系数;
对所述第一变换系数进行量化,得到当前块的量化系数,所述量化系数为所述当前块的变换系数。
基于前述实施例相同的发明构思,参见图12,其示出了本申请实施例提供的一种编码器的组成结构示意图。如图12所示,该编码器可以包括:第二通信接口1201、第二存储器1202和第二处理器1203;各个组件通过第二总线系统1204耦合在一起。可理解,第二总线系统1204用于实现这些组件之间的连接通信。第二总线系统1204除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图12中将各种总线都标为第二总线系统1204。其中,
第二通信接口1201,用于在与其他外部网元之间进行收发信息过程中,信号的接收和发送;
第二存储器1202,被配置为存储在第二处理器上运行的计算机程序;
所述第二处理器1201,被配置为在运行所述计算机程序时,执行编码器所述的方法。
可以理解,第二存储器1202与第一存储器1002的硬件功能类似,第二处理器1203与第一处理器1003的硬件功能类似;这里不再详述。
本申请实施例提供了一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算机程序,所述计算机程序被第一处理器执行时实现解码器所述的方法、或者被第二处理器执行时实现编码器所述的方法。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。
本申请实施例中,通过根据第一类帧内预测模式参数,确定当前块的第一预测值;基于当前块的第一预测值或第一类帧内预测模式参数,确定当前块的第一变换参数;基于第一变换参数,确定对当前块 进行变换的第二变换参数;基于第二变换参数,对当前块的变换系数进行变换处理,确定当前块的残差值;基于残差值和第一预测值,确定当前块的重建值。这样,针对采用第一类帧内预测模式(例如MIP)的当前块来说,由于在进行LFNST变换时引入了当前块的第一预测值或者第一类帧内预测模式参数,使得在变换技术中,变换核或者变换矩阵(对应第二变换参数)的选择更加灵活,从而不仅提高了非传统帧内预测模式(第一类帧内预测模式)的适用性,还提高了解码效率,同时还能够提升视频图像质量。
Claims (73)
- 一种视频解码方法,应用于解码器,所述方法包括:解码码流,确定当前块的第一类帧内预测模式参数;根据所述第一类帧内预测模式参数,确定所述当前块的第一预测值;基于所述当前块的第一预测值或所述第一类帧内预测模式参数,确定所述当前块的第一变换参数;基于所述第一变换参数,确定对所述当前块进行变换的第二变换参数;基于所述第二变换参数,对所述当前块的变换系数进行变换处理,确定所述当前块的残差值;基于所述残差值和所述第一预测值,确定所述当前块的重建值。
- 根据权利要求1所述的方法,其中,所述基于所述当前块的第一预测值或所述第一类帧内预测参数,确定所述当前块的第一变换参数,包括:基于所述当前块的第一预测值,确定所述当前块的第二类帧内预测模式的第一索引;基于所述当前块的所述第二类帧内预测模式的第一索引,确定所述当前块的第一变换参数。
- 根据权利要求1所述的方法,其中,所述基于所述当前块的第一预测值或所述第一类帧内预测参数,确定所述当前块的第一变换参数,包括:基于所述第一类帧内预测模式参数,确定所述当前块的第二类帧内预测模式的第一索引;基于所述第二类帧内预测模式的第一索引,确定所述当前块的第一变换参数。
- 根据权利要求2或3所述的方法,其中,所述第二类帧内预测模式包括以下至少之一:平面模式、直流模式和帧内角度预测模式。
- 根据权利要求2或3所述的方法,其中,所述方法还包括:将所述当前块的第一变换参数设置为等于所述当前块的所述第二类帧内预测模式的第一索引。
- 根据权利要求1至5任一项所述的方法,其中,所述基于所述第一变换参数,确定对所述当前块进行变换的第二变换参数,包括:根据预设的第一变换参数与第二变换参数之间的第一映射表,确定与所述第一变换参数对应的所述第二变换参数。
- 根据权利要求1或6所述的方法,其中,所述第二变换参数包括以下至少之一:变换核索引参数和变换参数的扫描顺序参数;其中,所述变换核索引参数指示对所述当前块的变换参数进行解码过程中使用的变换核;所述扫描顺序参数指示变换参数的扫描顺序,所述扫描顺序包括水平顺序和垂直顺序。
- 根据权利要求2所述的方法,其中,所述基于所述当前块的第一预测值,确定所述当前块的第二类帧内预测模式的第一索引,包括:基于所述第一预测值,确定所述第一预测值的第二类帧内预测模式的索引集;基于所述第一预测值的第二类帧内预测模式的索引集,确定所述当前块的所述第二类帧内预测模式的第一索引;其中,所述第二类帧内预测模式的索引集中存储了第二类帧内预测模式的索引的部分或全部容许取值对应的累积权重值。
- 根据权利要求8所述的方法,其中,所述基于所述当前块的第一预测值,确定所述第一预测值的第二类传统帧内预测模式的索引集,包括:对于所述第一预测值中的部分或全部的预测值,确定所述部分或全部预测值对应的采样点的水平方向梯度值和垂直方向梯度值;根据所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述第一预测值的所述第二类帧内预测模式的索引集。
- 根据权利要求9所述的方法,其中,所述根据所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述第一预测值的所述第二类帧内预测模式的索引集,包括:根据所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述采样点的梯度角度值;根据所述采样点的梯度角度值,确定对应于所述梯度角度值的第二类帧内预测模式的第二索引;更新所述第二类帧内预测模式的索引集中对应于所确定的第二类帧内预测模式的第二索引的累积权重值。
- 根据权利要求10所述的方法,其中,所述根据所述采样点的水平方向梯度值和垂直方向梯度值,确定所述采样点的梯度角度值,包括:基于所述采样点的所述水平方向梯度值和所述垂直方向梯度值、以及预设的函数关系,确定所述采样点的梯度角度值。
- 根据权利要求11所述的方法,其中,所述预设的函数关系为反正切函数;其中,所述反正切函数是所述采样点的所述水平方向梯度值和所述垂直方向梯度值的比值;所述基于所述采样点的所述水平方向梯度值和所述垂直方向梯度值、以及预设的函数关系,确定所述采样点的梯度角度值,包括:基于所述反正切函数,对所述采样点的所述水平方向梯度值和所述垂直方向梯度值的比值进行处理,确定所述采样点的梯度角度值。
- 根据权利要求11所述的方法,其中,所述预设的函数关系是所述采样点的梯度角度值与所述采样点的水平方向梯度值和垂直方向梯度值之间的第二映射表;所述基于所述采样点的所述水平方向梯度值和所述垂直方向梯度值、以及预设的函数关系,确定所述采样点的梯度角度值,包括:将所述采样点的水平方向梯度值和垂直方向梯度值,或者所述采样点的水平方向梯度值和垂直方向梯度值的比值输入所述第二映射表,输出所述采样点的梯度角度值。
- 根据权利要求10所述的方法,其中,所述根据所述采样点的梯度角度值,确定对应于所述梯度角度值的第二类帧内预测模式的第二索引,包括:从与所述第二类帧内预测模式的索引的部分或全部容许取值所指示的帧内角度预测的方向中,确定与所述梯度角度值所指示方向之间夹角最小的帧内角度预测方向所对应的第二类帧内预测模式索引值;将所述梯度角度值的所述第二类帧内预测模式的第二索引,设置为所述第二类帧内预测模式索引值。
- 根据权利要求10所述的方法,其中,所述根据所述采样点的梯度角度值,确定对应于所述梯度角度值的第二类帧内预测模式的第二索引,包括:根据预设的梯度角度值与第二类帧内预测模式索引之间的第三映射表,确定对应于所述梯度角度值的所述第二类帧内预测模式的第二索引。
- 根据权利要求15所述的方法,其中,所述第三映射表表征不同取值或不同取值范围内的梯度角度值与第二类帧内预测模式索引之间的对应关系。
- 根据权利要求10所述的方法,其中,所述更新所述第二类帧内预测模式的索引集中对应于所确定的第二类帧内预测模式的第二索引的累积权重值,包括:对所述第二类帧内预测模式的索引集中,对应于所确定的第二类帧内预测模式的第二索引的累积权重值增加设定的数值。
- 根据权利要求17所述的方法,其中,所述设定的数值等于1。
- 根据权利要求17所述的方法,其中,所述设定的数值等于所述水平方向梯度值的绝对值与所述垂直方向梯度值的绝对值之和。
- 根据权利要求8所述的方法,其中,所述基于所述第一预测值的第二类帧内预测模式的索引集,确定所述当前块的所述第二类帧内预测模式的第一索引,包括:将所述当前块的第二类帧内预测模式的第一索引,设置为所述第一预测值的第二类帧内预测模式的索引集中,最大的累积权重值对应的第二类预测模式的第二索引。
- 根据权利要求2或20所述的方法,其中,所述基于所述当前块的第一预测值,确定所述当前块的第二类帧内预测模式的第一索引,包括:根据候选第二类帧内预测模式,确定当前块的第二类帧内预测值;根据所述第一帧内预测值与所述第二类帧内预测值,确定所述当前块的所述第二类帧内预测模式的第一索引。
- 根据权利要求21所述的方法,其中,所述候选第二类帧内预测模式包括以下帧内预测模式的一种或多种:平面模式、直流模式、帧内角度预测模式。
- 根据权利要求21所述的方法,其中,所述根据所述第一帧内预测值与所述第二类帧内预测值,确定所述当前块的所述第二类帧内预测模式的第一索引,包括:确定所述第一帧内预测值与所述第二类帧内预测值的第一预测误差;将所述第一预测误差满足第一预设条件时对应的候选第二类帧内预测模式对应的索引值,确定为所述当前块的所述第二类帧内预测模式的第一索引。
- 根据权利要求23所述的方法,其中,所述确定所述第一帧内预测值与所述第二类帧内预测值的第一预测误差,包括:根据第一误差准则,确定所述第一帧内预测值与所述第二类帧内预测值的所述第一预测差值;其中,所述第一误差准则是以下误差准则之一:绝对误差和、平方误差和、平均绝对误差和均方误差;所述第一预设条件是所述第一预测误差达到最小值。
- 根据权利要求23所述的方法,其中,所述确定所述第一帧内预测值与所述第二类帧内预测值的第一预测误差,包括:根据第二误差准则,确定所述第一帧内预测值与所述第二类帧内预测值的所述第一预测差值;其中,所述第二误差准则是以下误差准则之一:信噪比和峰值信噪比;所述第一预设条件是所述第一预测误差达到最大值。
- 根据权利要求10所述的方法,其中,所述根据所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述第一预测值的所述第二类帧内预测模式的索引集,包括:根据所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述采样点对应的梯度方向、第一梯度强度和模式分区;所述采样点对应的所述梯度方向、所述第一梯度强度和所述模式分区,确定第二类帧内预测模式的第二索引;更新所述第二类帧内预测模式的索引集中对应于所确定的第二类帧内预测模式的第二索引的累积权重值。
- 根据权利要求26所述的方法,其中,所述根据所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述采样点对应的梯度方向、第一梯度强度和模式分区,包括:基于所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述采样点的所述第一梯度强度;基于所述采样点的所述水平方向梯度值和所述垂直方向梯度值,对所述采样点进行第二类帧内预测模式的分区处理,确定所述采样点的水平区域索引、垂直区域索引和梯度强度索引;基于所述采样点的所述水平区域索引、所述垂直区域索引和所述梯度强度索引,确定所述采样点的所述模式分区;基于所述采样点的梯度强度索引,确定所述采样点对应的所述梯度方向。
- 根据权利要求26或27所述的方法,其中,所述采样点对应的所述梯度方向、所述第一梯度强度和所述模式分区,确定第二类帧内预测模式的第二索引,包括:根据所述采样点对应的梯度方向,确定采样点的梯度偏移比值;将所述采样点的所述梯度偏移比值,映射到预设模式偏移范围内,得到采样点的帧内预测模式索引偏移量;根据预设模式分区与模式索引的第四映射表,确定与所述采样点的所述模式分区对应的目标第二类帧内预测模式;结合所述目标第二类帧内预测模式和所述帧内预测模式索引偏移量,确定所述采样点的第二类帧内预测模式的第二索引。
- 根据权利要求3所述的方法,其中,所述基于所述第一类帧内预测模式参数,确定所述当前块的第二类帧内预测模式的第一索引,包括:根据第一类帧内预测模式参数与第二类帧内预测模式索引的第一预设映射关系,确定所述当前块的所述第二类帧内预测模式的第一索引。
- 根据权利要求29所述的方法,其中,所述第一类帧内预测模式参数包括:第一类帧内预测模式索引;所述第一预设映射关系表示第一类帧内预测模式索引与第二类帧内预测模式索引之间的对应关系;所述根据第一类帧内预测模式参数与第二类帧内预测模式索引的第一预设映射关系,确定所述当前块的所述第二类帧内预测模式的第一索引,包括:根据述第一类帧内预测模式索引,从所述第一预设映射关系中,确定所述第二类帧内预测模式的第一索引。
- 根据权利要求3所述的方法,其中,所述基于所述第一类帧内预测模式参数,确定所述当前块的第二类帧内预测模式的第一索引,包括:基于所述第一类帧内预测模式参数指示的第一类帧内预测模式加权矩阵,确定所述当前块的所述第二类帧内预测模式的第一索引。
- 根据权利要求31所述的方法,其中,所述基于所述第一类帧内预测模式参数指示的第一类帧内预测模式加权矩阵,确定所述当前块的所述第二类帧内预测模式的第一索引,包括:确定所述第一类帧内预测模式加权矩阵的梯度参数;根据所述第一类帧内预测模式加权矩阵的梯度参数,确定所述当前块的所述第二类帧内预测模式的 第一索引。
- 根据权利要求2所述的方法,其中,所述基于所述第二类帧内预测模式的第一索引,确定所述当前块的第一变换参数,包括:将所述所述第二类帧内预测模式的第一索引进行宽角度映射,确定宽角度预测模式索引;基于所述宽角度预测模式索引,确定所述第一变换参数。
- 根据权利要求7所述的方法,其中,所述变换系数包括:量化系数;所述基于所述第二变换参数,对所述当前块的变换系数进行变换处理,确定所述当前块的残差值,包括:对所述量化系数进行反量化,得到第一变换系数;对所述第一变换系数进行转换,得到第一变换系数向量;采用所述变换核索引参数指示的变换矩阵,对所述第一变换系数向量进行变换,得到第二变换系数向量;采用所述变换参数的扫描顺序参数,对所述第二变换系数向量进行转换,得到第二变换系数;对所述第二变换系数进行反变换,得到所述当前块的所述残差值。
- 一种视频编码方法,应用于编码器,所述方法包括:确定第一类帧内预测模式参数;根据所述第一类帧内预测模式参数,确定所述当前块的第一预测值,并计算当前块的原始值与所述第一预测值之间的残差值;根据所述当前块的第一预测值或所述第一类帧内预测模式参数,确定所述当前块的第一变换参数;基于所述第一变换参数,确定对所述当前块进行变换的第二变换参数;基于所述第二变换参数,对所述残差值进行变换处理,得到当前块的变换系数。
- 根据权利要求35所述的方法,其中,所述根据所述当前块的第一预测值或所述第一类帧内预测模式参数,确定所述当前块的第一变换参数,包括:基于所述当前块的第一预测值,确定所述当前块的第二类帧内预测模式的第一索引;基于所述当前块的所述第二类帧内预测模式的第一索引,确定所述当前块的第一变换参数。
- 根据权利要求35所述的方法,其中,所述基于所述当前块的第一预测值或所述第一类帧内预测参数,确定所述当前块的第一变换参数,包括:基于所述第一类帧内预测模式参数,确定所述当前块的第二类帧内预测模式的第一索引;基于所述第二类帧内预测模式的第一索引,确定所述当前块的第一变换参数。
- 根据权利要求36或37所述的方法,其中,所述第二类帧内预测模式包括以下至少之一:平面模式、直流模式和帧内角度预测模式。
- 根据权利要求36或37所述的方法,其中,所述方法还包括:将所述当前块的第一变换参数设置为等于所述当前块的所述第二类帧内预测模式的第一索引。
- 根据权利要求35至39任一项所述的方法,其中,所述基于所述第一变换参数,确定对所述当前块进行变换的第二变换参数,包括:根据预设的第一变换参数与第二变换参数之间的第一映射表,确定与所述第一变换参数对应的所述第二变换参数。
- 根据权利要求35或40所述的方法,其中,所述第二变换参数包括以下至少之一:变换核索引参数和变换参数的扫描顺序参数;其中,所述变换核索引参数指示对所述当前块的变换参数进行解码过程中使用的变换核;所述扫描顺序参数指示变换参数的扫描顺序,所述扫描顺序包括水平顺序和垂直顺序。
- 根据权利要求36所述的方法,其中,所述基于所述当前块的第一预测值,确定所述当前块的第二类帧内预测模式的第一索引,包括:基于所述第一预测值,确定所述第一预测值的第二类帧内预测模式的索引集;基于所述第一预测值的第二类帧内预测模式的索引集,确定所述当前块的所述第二类传统帧内预测模式的第一索引;其中,所述第二类帧内预测模式的索引集中存储了第二类帧内预测模式的索引的部分或全部容许取值对应的累积权重值。
- 根据权利要求42所述的方法,其中,所述基于所述当前块的第一预测值,确定所述第一预测值的第二类传统帧内预测模式的索引集,包括:对于所述第一预测值中的部分或全部的预测值,确定所述部分或全部预测值对应的采样点的水平方向梯度值和垂直方向梯度值;根据所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述第一预测值的所述第二类帧内预测模式的索引集。
- 根据权利要求43所述的方法,其中,所述根据所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述第一预测值的所述第二类帧内预测模式的索引集,包括:根据所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述采样点的梯度角度值;根据所述采样点的梯度角度值,确定对应于所述梯度角度值的第二类帧内预测模式的第二索引;更新所述第二类帧内预测模式的索引集中对应于所确定的第二类帧内预测模式的第二索引的累积权重值。
- 根据权利要求44所述的方法,其中,所述根据所述采样点的水平方向梯度值和垂直方向梯度值,确定所述采样点的梯度角度值,包括:基于所述采样点的所述水平方向梯度值和所述垂直方向梯度值、以及预设的函数关系,确定所述采样点的梯度角度值。
- 根据权利要求45所述的方法,其中,所述预设的函数关系为反正切函数;其中,所述反正切函数是所述采样点的所述水平方向梯度值和所述垂直方向梯度值的比值;所述基于所述采样点的所述水平方向梯度值和所述垂直方向梯度值、以及预设的函数关系,确定所述采样点的梯度角度值,包括:基于所述反正切函数,对所述采样点的所述水平方向梯度值和所述垂直方向梯度值的比值进行处理,确定所述采样点的梯度角度值。
- 根据权利要求45所述的方法,其中,所述预设的函数关系是所述采样点的梯度角度值与所述采样点的水平方向梯度值和垂直方向梯度值之间的第二映射表;所述基于所述采样点的所述水平方向梯度值和所述垂直方向梯度值、以及预设的函数关系,确定所述采样点的梯度角度值,包括:将所述采样点的水平方向梯度值和垂直方向梯度值,或者所述采样点的水平方向梯度值和垂直方向梯度值的比值输入所述第二映射表,输出所述采样点的梯度角度值。
- 根据权利要求44所述的方法,其中,所述根据所述采样点的梯度角度值,确定对应于所述梯度角度值的第二类帧内预测模式的第二索引,包括:从与所述第二类帧内预测模式的索引的部分或全部容许取值所指示的帧内角度预测的方向中,确定与所述梯度角度值所指示方向之间夹角最小的帧内角度预测方向所对应的第二类帧内预测模式索引值;将所述梯度角度值的所述第二类帧内预测模式的第二索引,设置为所述第二类帧内预测模式索引值。
- 根据权利要求44所述的方法,其中,所述根据所述采样点的梯度角度值,确定对应于所述梯度角度值的第二类帧内预测模式的第二索引,包括:根据预设的梯度角度值与第二类帧内预测模式索引之间的第三映射表,确定对应于所述梯度角度值的所述第二类帧内预测模式的第二索引。
- 根据权利要求49所述的方法,其中,所述第三映射表表征不同取值或不同取值范围内的梯度角度值与第二类帧内预测模式索引之间的对应关系。
- 根据权利要求44所述的方法,其中,所述更新所述第二类帧内预测模式的索引集中对应于所确定的第二类帧内预测模式的第二索引的累积权重值,包括:对所述第二类帧内预测模式的索引集中,对应于所确定的第二类帧内预测模式的第二索引的累积权重值增加设定的数值。
- 根据权利要求51所述的方法,其中,所述设定的数值等于1。
- 根据权利要求51所述的方法,其中,所述设定的数值等于所述水平方向梯度值的绝对值与所述垂直方向梯度值的绝对值之和。
- 根据权利要求42所述的方法,其中,所述基于所述第一预测值的第二类帧内预测模式的索引集,确定所述当前块的所述第二类帧内预测模式的第一索引,包括:将所述当前块的第二类帧内预测模式的第一索引,设置为所述第一预测值的第二类帧内预测模式的索引集中,最大的累积权重值对应的第二类预测模式的第二索引。
- 根据权利要求36或54所述的方法,其中,所述基于所述当前块的第一预测值,确定所述当前块的第二类帧内预测模式的第一索引,包括:根据候选第二类帧内预测模式,确定当前块的第二类帧内预测值;根据所述第一帧内预测值与所述第二类帧内预测值,确定所述当前块的所述第二类帧内预测模式的第一索引。
- 根据权利要求55所述的方法,其中,所述候选第二类帧内预测模式包括以下帧内预测模式的一种或多种:平面模式、直流模式、帧内角度预测模式。
- 根据权利要求56所述的方法,其中,所述根据所述第一帧内预测值与所述第二类帧内预测值,确定所述当前块的所述第二类帧内预测模式的第一索引,包括:确定所述第一帧内预测值与所述第二类帧内预测值的第一预测误差;将所述第一预测误差满足第一预设条件时对应的候选第二类帧内预测模式对应的索引值,确定为所述当前块的所述第二类帧内预测模式的第一索引。
- 根据权利要求57所述的方法,其中,所述确定所述第一帧内预测值与所述第二类帧内预测值的第一预测误差,包括:根据第一误差准则,确定所述第一帧内预测值与所述第二类帧内预测值的所述第一预测差值;其中,所述第一误差准则是以下误差准则之一:绝对误差和、平方误差和、平均绝对误差和均方误差;所述第一预设条件是所述第一预测误差达到最小值。
- 根据权利要求57所述的方法,其中,所述确定所述第一帧内预测值与所述第二类帧内预测值的第一预测误差,包括:根据第二误差准则,确定所述第一帧内预测值与所述第二类帧内预测值的所述第一预测差值;其中,所述第二误差准则是以下误差准则之一:信噪比和峰值信噪比;所述第一预设条件是所述第一预测误差达到最大值。
- 根据权利要求44所述的方法,其中,所述根据所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述第一预测值的所述第二类帧内预测模式的索引集,包括:根据所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述采样点对应的梯度方向、第一梯度强度和模式分区;所述采样点对应的所述梯度方向、所述第一梯度强度和所述模式分区,确定第二类帧内预测模式的第二索引;更新所述第二类帧内预测模式的索引集中对应于所确定的第二类帧内预测模式的第二索引的累积权重值。
- 根据权利要求60所述的方法,其中,所述根据所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述采样点对应的梯度方向、第一梯度强度和模式分区,包括:基于所述采样点的所述水平方向梯度值和所述垂直方向梯度值,确定所述采样点的所述第一梯度强度;基于所述采样点的所述水平方向梯度值和所述垂直方向梯度值,对所述采样点进行第二类帧内预测模式的分区处理,确定所述采样点的水平区域索引、垂直区域索引和梯度强度索引;基于所述采样点的所述水平区域索引、所述垂直区域索引和所述梯度强度索引,确定所述采样点的所述模式分区;基于所述采样点的梯度强度索引,确定所述采样点对应的所述梯度方向。
- 根据权利要求60或61所述的方法,其中,所述采样点对应的所述梯度方向、所述第一梯度强度和所述模式分区,确定第二类帧内预测模式的第二索引,包括:根据所述采样点对应的梯度方向,确定采样点的梯度偏移比值;将所述采样点的所述梯度偏移比值,映射到预设模式偏移范围内,得到采样点的帧内预测模式索引偏移量;根据预设模式分区与模式索引的第四映射表,确定与所述采样点的所述模式分区对应的目标第二类帧内预测模式;结合所述目标第二类帧内预测模式和所述帧内预测模式索引偏移量,确定所述采样点的第二类帧内预测模式的第二索引。
- 根据权利要求37所述的方法,其中,所述基于所述第一类帧内预测模式参数,确定所述当前块的第二类帧内预测模式的第一索引,包括:根据第一类帧内预测模式参数与第二类帧内预测模式索引的第一预设映射关系,确定所述当前块的所述第二类帧内预测模式的第一索引。
- 根据权利要求63所述的方法,其中,所述第一类帧内预测模式参数包括:第一类帧内预测模式索引;所述第一预设映射关系表示第一类帧内预测模式索引与第二类帧内预测模式索引之间的对应关系;所述根据第一类帧内预测模式参数与第二类帧内预测模式索引的第一预设映射关系,确定所述当前块的所述第二类帧内预测模式的第一索引,包括:根据述第一类帧内预测模式索引,从所述第一预设映射关系中,确定所述第二类帧内预测模式的第一索引。
- 根据权利要求37所述的方法,其中,所述基于所述第一类帧内预测模式参数,确定所述当前块的第二类帧内预测模式的第一索引,包括:基于所述第一类帧内预测模式参数指示的第一类帧内预测模式加权矩阵,确定所述当前块的所述第二类帧内预测模式的第一索引。
- 根据权利要求65所述的方法,其中,所述基于所述第一类帧内预测模式参数指示的第一类帧内预测模式加权矩阵,确定所述当前块的所述第二类帧内预测模式的第一索引,包括:确定所述第一类帧内预测模式加权矩阵的梯度参数;根据所述第一类帧内预测模式加权矩阵的梯度参数,确定所述当前块的所述第二类帧内预测模式的第一索引。
- 根据权利要求36所述的方法,其中,所述基于所述第二类帧内预测模式的第一索引,确定所述当前块的第一变换参数,包括:将所述所述第二类帧内预测模式的第一索引进行宽角度映射,确定宽角度预测模式索引;基于所述宽角度预测模式索引,确定所述第一变换参数。
- 根据权利要求41所述的方法,其中,所述基于所述第二变换参数,对所述残差值进行变换处理,得到当前块的变换系数,包括:对所述残差值进行变换,得到第二变换系数;采用所述变换参数的扫描顺序参数,对所述第二变换系数进行转换,得到第二变换系数向量;采用所述变换核索引参数指示的变换矩阵,对所述第二变换系数向量进行变换,得到第一变换系数向量;对第一变换系数向量进行转换,得到第一变换系数;对所述第一变换系数进行量化,得到当前块的量化系数,所述量化系数为所述当前块的变换系数。
- 一种解码器,所述解码器包括:解码部分,被配置为解码码流,确定当前块的第一类帧内预测模式参数;第一预测部分,被配置为根据所述第一类帧内预测模式参数,确定所述当前块的第一预测值;第一确定部分,被配置为基于所述当前块的第一预测值或所述第一类帧内预测模式参数,确定所述当前块的第一变换参数;及基于所述第一变换参数,确定对所述当前块进行变换的第二变换参数;第一变换部分,被配置为基于所述第二变换参数,对所述当前块的变换系数进行变换处理,确定所述当前块的残差值;重建部分,被配置为基于所述残差值和所述第一预测值,确定所述当前块的重建值。
- 一种编码器,所述编码器包括:第二确定部分,被配置为确定第一类帧内预测模式参数;第二预测部分,被配置为根据所述第一类帧内预测模式参数,确定所述当前块的第一预测值;所述第二确定部分,还被配置为计算当前块的原始值与所述第一预测值之间的残差值;及根据所述当前块的第一预测值或所述第一类帧内预测模式参数,确定所述当前块的第一变换参数;以及基于所述第一变换参数,确定对所述当前块进行变换的第二变换参数;第二变换部分,被配置为基于所述第二变换参数,对所述残差值进行变换处理,得到当前块的变换系数。
- 一种解码器,所述解码器包括:第一存储器,被配置为存储在第一处理器上运行的计算机程序;所述第一处理器,用于在运行所述计算机程序时,执行如权利要求1至34任一项所述的方法。
- 一种编码器,所述编码器包括:第二存储器,被配置为存储在第二处理器上运行的计算机程序;所述第二处理器,被配置为在运行所述计算机程序时,执行如权利要求35至68任一项所述的方法。
- 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算机程序,所述计算机程序被第一处理器执行时实现如权利要求1至34任一项所述的方法、或者被第二处理器执行时实现如权利要求35至68任一项所述的方法。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2022/086473 WO2023197195A1 (zh) | 2022-04-13 | 2022-04-13 | 视频编解码方法、编码器、解码器及存储介质 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2022/086473 WO2023197195A1 (zh) | 2022-04-13 | 2022-04-13 | 视频编解码方法、编码器、解码器及存储介质 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023197195A1 true WO2023197195A1 (zh) | 2023-10-19 |
Family
ID=88328748
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/086473 WO2023197195A1 (zh) | 2022-04-13 | 2022-04-13 | 视频编解码方法、编码器、解码器及存储介质 |
Country Status (1)
Country | Link |
---|---|
WO (1) | WO2023197195A1 (zh) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021196231A1 (zh) * | 2020-04-03 | 2021-10-07 | Oppo广东移动通信有限公司 | 变换方法、编码器、解码器以及存储介质 |
US20210314619A1 (en) * | 2019-02-08 | 2021-10-07 | Wilus Institute Of Standards And Technology Inc. | Video signal processing method and device using secondary transform |
CN113615182A (zh) * | 2019-06-04 | 2021-11-05 | 腾讯美国有限责任公司 | 用于视频编解码的方法和装置 |
CN113841407A (zh) * | 2019-04-16 | 2021-12-24 | Lg电子株式会社 | 基于帧内预测的图像编码中的变换 |
-
2022
- 2022-04-13 WO PCT/CN2022/086473 patent/WO2023197195A1/zh active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20210314619A1 (en) * | 2019-02-08 | 2021-10-07 | Wilus Institute Of Standards And Technology Inc. | Video signal processing method and device using secondary transform |
CN113841407A (zh) * | 2019-04-16 | 2021-12-24 | Lg电子株式会社 | 基于帧内预测的图像编码中的变换 |
CN113615182A (zh) * | 2019-06-04 | 2021-11-05 | 腾讯美国有限责任公司 | 用于视频编解码的方法和装置 |
WO2021196231A1 (zh) * | 2020-04-03 | 2021-10-07 | Oppo广东移动通信有限公司 | 变换方法、编码器、解码器以及存储介质 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2022104498A1 (zh) | 帧内预测方法、编码器、解码器以及计算机存储介质 | |
WO2021004152A1 (zh) | 图像分量的预测方法、编码器、解码器以及存储介质 | |
WO2021139572A1 (zh) | 编码方法、解码方法、编码器、解码器以及存储介质 | |
WO2021134635A1 (zh) | 变换方法、编码器、解码器以及存储介质 | |
US20230262212A1 (en) | Picture prediction method, encoder, decoder, and computer storage medium | |
WO2021004155A1 (zh) | 图像分量预测方法、编码器、解码器以及存储介质 | |
US20220329862A1 (en) | Transformation method, encoder, decoder, and storage medium | |
CN116472707A (zh) | 图像预测方法、编码器、解码器以及计算机存储介质 | |
CA3222255A1 (en) | Decoding prediction method and apparatus, and computer storage medium | |
US20220329809A1 (en) | Transform method, encoder, decoder, and storage medium | |
AU2019357929A1 (en) | Video image component prediction method and apparatus, and computer storage medium | |
WO2023197195A1 (zh) | 视频编解码方法、编码器、解码器及存储介质 | |
CN113766233B (zh) | 图像预测方法、编码器、解码器以及存储介质 | |
WO2024007120A1 (zh) | 编解码方法、编码器、解码器以及存储介质 | |
WO2021134637A1 (zh) | 变换方法、编码器、解码器以及存储介质 | |
WO2024007116A1 (zh) | 解码方法、编码方法、解码器以及编码器 | |
WO2023197193A1 (zh) | 编解码方法、装置、编码设备、解码设备以及存储介质 | |
WO2023197190A1 (zh) | 编解码方法、装置、编码设备、解码设备以及存储介质 | |
WO2023141970A1 (zh) | 解码方法、编码方法、解码器、编码器和编解码系统 | |
WO2023197194A1 (zh) | 编解码方法、装置、编码设备、解码设备以及存储介质 | |
WO2023197179A1 (zh) | 解码方法、编码方法、解码器以及编码器 | |
WO2023070505A1 (zh) | 帧内预测方法、解码器、编码器及编解码系统 | |
WO2023197181A1 (zh) | 解码方法、编码方法、解码器以及编码器 | |
WO2023184747A1 (zh) | 视频编解码方法、装置、设备、系统及存储介质 | |
WO2024183007A1 (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: 22936849 Country of ref document: EP Kind code of ref document: A1 |
|
WWE | Wipo information: entry into national phase |
Ref document number: 2401006791 Country of ref document: TH |