Encoding method, decoding method, bit stream, encoder, decoder and storage medium
By extending the use of the weight matrix for intra-frame prediction when the current block meets the requirements of PDP mode, the problem that PDP mode cannot replace the traditional angle mode is solved, the accuracy of intra-frame prediction is improved, and the encoding and decoding performance is enhanced.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
- Filing Date
- 2024-12-19
- Publication Date
- 2026-06-25
AI Technical Summary
In existing technologies, matrix-based position-dependent intra-prediction (PDP) modes cannot replace most traditional angle modes, resulting in insufficient accuracy of intra-prediction results and affecting encoding and decoding performance.
If the current block meets the requirements of PDP mode but the first prediction mode does not allow the use of weight matrix for intra-frame prediction, the second prediction mode is determined to allow the use of weight matrix for intra-frame prediction, and the prediction block is determined based on the weight matrix of PDP mode.
By extending the PDP mode, the accuracy of intra-frame prediction is improved, thereby enhancing encoding and decoding performance.
Smart Images

Figure CN2024140761_25062026_PF_FP_ABST
Abstract
Description
Encoding / decoding methods, bitstreams, encoders, decoders, and storage media Technical Field
[0001] This application relates to the field of video encoding and decoding technology, and in particular to an encoding and decoding method, a bitstream, an encoder, a decoder, and a storage medium. Background Technology
[0002] As people's demands for video display quality have increased, high-resolution video, such as HD and UHD, has emerged. However, high-resolution video typically contains more information, thus requiring more bandwidth. To reduce bandwidth requirements, video coding standards involving video compression have been introduced.
[0003] Matrix-based Position Dependent Intra Prediction (PDP) is an intra-prediction mode that uses a predefined weight matrix to achieve intra-prediction. The original traditional intra-prediction angle is replaced with the PDP prediction based on the weight matrix, which can obtain more accurate prediction results.
[0004] However, most traditional angle modes cannot be replaced by PDP modes, so the accuracy of intra-frame prediction results still needs to be further improved. Summary of the Invention
[0005] This application provides an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium, which can improve the accuracy of intra-frame prediction and enhance encoding / decoding performance.
[0006] The technical solution of this application embodiment can be implemented as follows:
[0007] In a first aspect, embodiments of this application provide a decoding method applied to a decoder, the method comprising:
[0008] Determine multiple angle prediction modes corresponding to the current block;
[0009] If the current block meets the PDP mode requirements, and the first prediction mode among multiple angle prediction modes is a mode that does not allow the use of weight matrices for intra-frame prediction, then the second prediction mode is determined based on the first prediction mode; wherein, the second prediction mode is a mode that allows the use of weight matrices for intra-frame prediction.
[0010] The weight matrix of the PDP mode is determined based on the second prediction mode, and the first prediction block corresponding to the current block is determined based on the weight matrix of the PDP mode.
[0011] Based on the weights of the first prediction block and the first prediction mode, the prediction block corresponding to the current block is determined.
[0012] Secondly, embodiments of this application provide an encoding method applied to an encoder, the method comprising:
[0013] Determine multiple angle prediction modes corresponding to the current block;
[0014] If the current block meets the PDP mode requirements, and the first prediction mode among multiple angle prediction modes is a mode that does not allow the use of weight matrices for intra-frame prediction, then the second prediction mode is determined based on the first prediction mode; wherein, the second prediction mode is a mode that allows the use of weight matrices for intra-frame prediction.
[0015] The weight matrix of the PDP mode is determined based on the second prediction mode, and the first prediction block corresponding to the current block is determined based on the weight matrix of the PDP mode.
[0016] Based on the weights of the first prediction block and the first prediction mode, the prediction block corresponding to the current block is determined.
[0017] Thirdly, embodiments of this application provide a bitstream, which is generated by bit encoding based on information to be encoded; wherein the information to be encoded includes at least one of the following: first syntax element identification information and second syntax element identification information.
[0018] Fourthly, embodiments of this application provide an encoder, which includes...
[0019] The first determining part is configured to determine multiple angle prediction modes corresponding to the current block; if the current block meets the PDP mode requirements and the first prediction mode among the multiple angle prediction modes is a mode that does not allow the use of weight matrices for intra-frame prediction, a second prediction mode is determined based on the first prediction mode; wherein, the second prediction mode is a mode that allows the use of weight matrices for intra-frame prediction; the weight matrix of the PDP mode is determined based on the second prediction mode, and the first prediction block corresponding to the current block is determined based on the weight matrix of the PDP mode; the prediction block corresponding to the current block is determined based on the weights of the first prediction block and the first prediction mode.
[0020] Fifthly, embodiments of this application provide an encoder, which includes a first memory and a first processor; wherein,
[0021] A first memory for storing computer programs that can run on a first processor;
[0022] A first processor is configured to execute the method described in the second aspect when running the computer program.
[0023] Sixthly, embodiments of this application provide a decoder, the decoder comprising:
[0024] The second determination part is configured to determine multiple angle prediction modes corresponding to the current block; if the current block meets the PDP mode requirements and the first prediction mode among the multiple angle prediction modes is a mode that does not allow the use of weight matrices for intra-frame prediction, a second prediction mode is determined based on the first prediction mode; wherein, the second prediction mode is a mode that allows the use of weight matrices for intra-frame prediction; the weight matrix of the PDP mode is determined based on the second prediction mode, and the first prediction block corresponding to the current block is determined based on the weight matrix of the PDP mode; the prediction block corresponding to the current block is determined based on the weights of the first prediction block and the first prediction mode.
[0025] In a seventh aspect, embodiments of this application provide a decoder, which includes a second memory and a second processor; wherein,
[0026] The second memory is used to store computer programs that can run on the second processor;
[0027] A second processor is configured to execute the method described in the first aspect when running the computer program.
[0028] Eighthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by at least one processor, implements the method described in the first aspect or the method described in the second aspect.
[0029] In a ninth aspect, embodiments of this application provide a computer-readable storage medium for storing a bitstream generated by the encoding method described in the second aspect.
[0030] This application provides an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium. The encoder / decoder determines multiple angle prediction modes corresponding to the current block. If the current block meets the PDP mode requirements, and the first prediction mode among the multiple angle prediction modes is a mode that does not allow intra-frame prediction using a weight matrix, a second prediction mode is determined based on the first prediction mode. The second prediction mode is a mode that allows intra-frame prediction using a weight matrix. A weight matrix for the PDP mode is determined based on the second prediction mode, and a first prediction block corresponding to the current block is determined based on the weight matrix of the PDP mode. The prediction block corresponding to the current block is determined based on the weights of the first prediction block and the first prediction mode. In other words, in the embodiments of this application, for any angle prediction mode in the current block that is not applicable to the PDP mode, it can be extended to the PDP mode to determine the corresponding effective intra-frame prediction mode, and intra-frame prediction is performed using the extended effective intra-frame prediction mode. Therefore, in this application, for angle prediction modes that are not effective under the PDP mode, intra-frame prediction under the PDP mode can be achieved through PDP mode extension, resulting in more accurate prediction results and thus improving encoding / decoding performance. Attached Figure Description
[0031] Figure 1 is a schematic diagram of intra-frame prediction;
[0032] Figure 2 is a schematic diagram of the intra-frame prediction mode;
[0033] Figure 3 is a schematic diagram of the intra-frame prediction mode;
[0034] Figure 4 is a schematic diagram of the intra-frame prediction mode;
[0035] Figure 5 is a schematic diagram of the intra-frame prediction mode;
[0036] Figure 6 is a schematic diagram of the intra-frame prediction mode;
[0037] Figure 7 is a schematic diagram of the intra-frame prediction mode;
[0038] Figure 8 is a schematic diagram of the intra-frame prediction mode;
[0039] Figure 9 is a schematic diagram of the intra-frame prediction mode;
[0040] Figure 10 is a schematic diagram of the intra-frame prediction mode;
[0041] Figure 11 is a schematic diagram of the angle prediction mode;
[0042] Figure 12 is a schematic diagram of the implementation of PDP mode;
[0043] Figure 13 is a schematic diagram of the OBIC mode implementation;
[0044] Figure 14 is a schematic diagram of the OBIC mode implementation;
[0045] Figure 15 is a flowchart illustrating a decoding method provided in an embodiment of this application;
[0046] Figure 16 is a flowchart illustrating an encoding method provided in an embodiment of this application;
[0047] Figure 17 is a schematic diagram of the legality verification of the PDP mode;
[0048] Figure 18 is a schematic diagram of the composition structure of an encoder provided in an embodiment of this application;
[0049] Figure 19 is a schematic diagram of the specific hardware structure of an encoder provided in an embodiment of this application;
[0050] Figure 20 is a schematic diagram of the composition structure of a decoder provided in an embodiment of this application;
[0051] Figure 21 is a schematic diagram of the specific hardware structure of a decoder provided in an embodiment of this application;
[0052] Figure 22 is a schematic diagram of the composition structure of an encoding / decoding system provided in an embodiment of this application. Detailed Implementation
[0053] In order to gain a more detailed understanding of the features and technical content of the embodiments of this application, the implementation of the embodiments of this application will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for reference and illustration only and are not intended to limit the embodiments of this application.
[0054] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0055] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0056] It should also be noted that the terms "first, second, and third" used in the embodiments of this application are only used to distinguish similar objects and do not represent a specific order of objects. It is understood that "first, second, and third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0057] In video images, a first color component, a second color component, and a third color component are generally used to represent a coding block (CB). These three color components are a luma component, a blue chroma component, and a red chroma component, respectively. Specifically, the luma component is usually represented by the symbol Y, the blue chroma component is usually represented by the symbol Cb or U, and the red chroma component is usually represented by the symbol Cr or V. Thus, video images can be represented in YCbCr format or YUV format.
[0058] Video codec standards can employ a block-based hybrid coding framework. Specifically, each image in the video is divided into largest coding units (LCUs) or coding tree units (CTUs) of the same size (e.g., 128x128, 64x64, etc.). Each LCU or CTU can be further subdivided into rectangular coding units (CUs) according to rules. Coding units may also be further divided into prediction units (PUs), transform units (TUs), etc.
[0059] Specifically, the hybrid coding framework includes a prediction module 11, a transform and quantization module 12, an entropy coding module 13, an inverse quantization and inverse transform module 14, a loop filtering module 15, and a decoded image buffer module 16. The prediction module 11 may include an intra-frame prediction module 11a and an inter-frame prediction module 11b. The inter-frame prediction module 11b may include a motion estimation module and a motion compensation module. Because there is a strong correlation between adjacent pixels in an image of a video, intra-frame prediction is used in video coding and decoding technology to eliminate spatial redundancy between adjacent pixels. Furthermore, because there is a strong similarity between adjacent images in a video, inter-image prediction is used in video coding and decoding technology to eliminate temporal redundancy between adjacent images, thereby improving coding efficiency.
[0060] Furthermore, the transformation converts the predicted image patch to the frequency domain, redistributing energy. Combined with quantization, information insensitive to the human eye can be removed, thus eliminating visual redundancy. Entropy coding can eliminate character redundancy based on the current context model and the probability information of the binary bitstream.
[0061] The basic workflow of a video codec is as follows: At the encoding end, after reading a black-and-white or color image, it is divided into blocks. Intra-frame prediction or inter-frame prediction is used on the current block to generate a prediction block. The original block of the current block is subtracted from the prediction block to obtain a residual block. The residual block is transformed and quantized to obtain a quantization coefficient matrix. The quantization coefficient matrix is entropy encoded and output to the bitstream. At the decoding end, intra-frame prediction or inter-frame prediction is used on the current block to generate a prediction block. On the other hand, the bitstream is parsed to obtain the quantization coefficient matrix. The quantization coefficient matrix is inverse quantized and inverse transformed to obtain a residual block. The prediction block and the residual block are added to obtain a reconstructed block. The reconstructed blocks form a reconstructed image. Based on the image or based on the blocks, loop filtering is performed on the reconstructed image to obtain the decoded image.
[0062] The encoding end requires similar operations to the decoding end to obtain the decoded image. The decoded image can be used as a reference image for inter-frame prediction of subsequent images.
[0063] The block partitioning information, prediction, transform, quantization, entropy coding, loop filtering, and other mode or parameter information determined at the encoding end need to be written into the bitstream if necessary. The decoding end determines the same block partitioning information, prediction, transform, quantization, entropy coding, loop filtering, and other mode or parameter information as the encoding end by parsing the bitstream and analyzing the existing information, thereby ensuring that the decoded image obtained by the encoding end is the same as the decoded image obtained by the decoding end.
[0064] During prediction, the current block can be divided into prediction units, and during transformation, it can be divided into transformation units. The division of prediction units and transformation units can be different. The above is the basic flow of a video codec under a block-based hybrid coding framework. With the development of technology, some modules or steps of this framework or flow may be optimized. The embodiments of this application are applicable to the basic flow of a video codec under this block-based hybrid coding framework, but are not limited to this framework and flow.
[0065] Furthermore, in this embodiment, the current block (CB) can be the current block, the current prediction unit, or the current transformation unit, etc. Due to the need for parallel processing, an image can be divided into slices, etc. Slices within the same image can be processed in parallel, meaning they have no data dependency. A "frame" is a commonly used term, generally understood as an image. In this embodiment, the term "frame" can also be replaced with an image or a slice, etc.
[0066] The following section provides a detailed introduction to several prediction techniques related to this technology.
[0067] (1) Intra-frame prediction
[0068] There is a strong spatial correlation between adjacent samples in an image. Intra-frame prediction is a prediction method that utilizes the spatial correlation between the already encoded / decoded samples around the current block and the samples within the current block. Figure 1 is a schematic diagram of intra-frame prediction. As shown in Figure 1, the white 4x4 block is the current block, and the gray samples in the left column and top row of the current block are the reference samples for the current block. Intra-frame prediction uses these reference samples to predict the current block. These reference samples may all be available, i.e., all have been encoded / decoded. Some may also be unavailable. For example, if the current block is the leftmost part of the entire frame, then the reference samples to the left of the current block are unavailable. Or, if the lower left part of the current block has not yet been encoded / decoded, then the reference samples to the lower left are also unavailable. In cases where reference samples are unavailable, available reference samples, certain values, or certain methods can be used to fill the gaps, or no filling can be performed.
[0069] Intra-frame prediction has multiple prediction modes. Figures 2 to 10 illustrate these modes, including nine modes for intra-frame prediction of a 4x4 block. As shown in Figure 2, Mode 0 copies the samples above the current block vertically as the predicted value. As shown in Figure 3, Mode 1 copies the reference samples on the left horizontally as the predicted value. As shown in Figure 4, Mode 2 (DC) uses the average of points A to D and I to L as the predicted value for all points. As shown in Figures 5 to 10, Modes 3 to 8 copy the reference samples to the corresponding positions in the current block at a specific angle. Because some positions in the current block may not perfectly correspond to the reference samples, a weighted average of the reference samples, or interpolated subsamples of the reference samples, may be needed.
[0070] In addition to these, there are Plane, Planar, and other modes. With technological advancements and increased block size, angle prediction modes are becoming increasingly common. In the reference software, traditional intra-frame prediction modes include the following:
[0071] • PLANAR mode: Intra-prediction mode 0,
[0072] • DC mode: Intra-frame prediction mode 1,
[0073] • Angle mode: Intra-frame prediction mode 2-66.
[0074] Figure 11 is a schematic diagram of the angle prediction modes. As shown in Figure 11, there are intra-frame prediction modes 2 to 66 for angles, and wide angles of -1 to 14 and 67 to 80 degrees. The arrows in the figure point to the directions of the angle prediction modes present in VVC. These are prediction modes 2 to 66 used during encoding and decoding. When the current prediction block is a non-square block, some angle directions are replaced with wide angles, such as -1 to -14 and 67 to 80 degrees in the figure.
[0075] (2) Decoder intra mode derivation (DIMD)
[0076] The decoder intra mode derivation (DIMD) technology is a technology that derives the prediction method of the current block through the existing encoded information at the decoder side. This technology usually only needs to encode a block-level flag bit to indicate whether the DIMD mode is used for the current block, and does not need to further encode the specific prediction method used (such as a specific angular prediction). The coding gain is achieved by saving the number of encoded bits. For example:
[0077] In the reference software, the DIMD mode is derived by calculating the gradient between samples. Here, the prediction method refers to the angular prediction mode (excluding the DC and Planar modes), and any one of the prediction modes 2 to 66 can be derived (the same as the modes 2-66 in VVC. These modes can be replaced by the corresponding wide-angle modes during actual prediction, for example, 2 is replaced by 67).
[0078] An embodiment of DIMD is as follows: When the cu_dimd_flag of the current block is true, the DIMD mode is used for prediction. First, the prediction mode is derived based on the adjacent samples p[x][y]. For example, the value ranges of x and y of the adjacent samples p[x][y] are -3 <= x < cbWidth, -3 <= y < -1 and -3 <= x < -1, -3 <= y < cbHeight. x and y are the coordinate values relative to the upper left corner of the current block. For each sample position (x, y) corresponding to a 3x3 window in the adjacent region, the horizontal and vertical gradient values Gx and Gy can be calculated. Gx and Gy are obtained by convolving the 3x3 horizontal gradient operator M_x and the vertical gradient operator M_y with the sample values within the window position respectively.
[0079] Based on Gx and Gy at each position, the corresponding angular direction O at each position is calculated, and the amplitude value G of the gradient of each position corresponding angle is calculated.
[0080] In some embodiments, the calculation process of atan can be simplified and completed by looking up a table or some transformations.
[0081] A method for deriving the angular direction O and the corresponding angular mode is as follows:
[0082] Define mapHgV = {{2,1},{1,2}}, mapVgH = {{3,4},{4,3}}, and angOffset = {18,18,50,50} to map the gradient derivation results to the actual angle modes. 18 and 50 correspond to the horizontal and vertical modes, respectively. Define angTable = {0,2048,4096,6144,8192,12288,16384,20480,24576,28672,32768,36864,40960,47104,53248,59392,65536} to derive the angle direction based on the gradient information. Construct an array HoG
[0067] to store the amplitude of each mode, with an initial value of 0.
[0083] For each neighboring sample p[x][y], we can calculate:
[0084] Horizontal gradient 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]
[0085] Vertical gradient 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]
[0086] Further calculation: 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]) / abs(gVer[x][y])
[0087] grad[x][y] = round(grad[x][y] × 65536) (The division process can be replaced by a lookup table-based division process) angIdx[x][y] = argmin_i(abs(angTable[i] - grad[x][y])
[0088] The traditional intra-frame prediction mode (or angle mode, excluding DC and Planar) is derived as follows: ipm[x][y]=angOffset[region[x][y]]+angIdx[x][y]
[0089] If both gHor[x][y] and gVer[x][y] are zero, skip the sample; if gHor[x][y] is 0, then ipm[x][y] = 18; if gVer[x][y] is 0, then ipm[x][y] = 50.
[0090] The amplitude can be defined as amp[x][y] = abs(gHor[x][y] + gVer[x][y]), and HoG[ipm[x][y]] = HoG[ipm[x][y]] + amp[x][y].
[0091] Through the above steps, we can obtain the HoG, which statistically summarizes the traditional intra-frame prediction modes and their sums of magnitudes corresponding to each sample location. The mode derived from DIMD can be defined as argmax_i(HoG[i]).
[0092] The magnitude value G of the gradient at each position is accumulated on its derived traditional intra-prediction mode to obtain a HoG. Finally, the traditional intra-prediction mode with the largest accumulated magnitude value is selected as the mode derived from DIMD.
[0093] Based on the HoG framework described above, the prediction block of DIMD can be obtained by fusing prediction blocks from multiple traditional intra-prediction modes. The selected traditional intra-prediction mode and its weights can be calculated from the magnitude of that mode in HoG. For example: IntraPredModeD1[xCb][yCb]=argmax_i(HoG[i]) IntraPredModeD2[xCb][yCb]=argmax_i(HoG[i]),i≠IntraPredModeD1[xCb][yCb] IntraPredModeD3[xCb][yCb]=PLANAR (planar mode) dimdWeight3=21 tmpWeight1=HoG[IntraPredModeD1[xCb][yCb]] tmpWeight2=HoG[IntraPredModeD2[xCb][yCb]] dimdWeight1=round(43×tmpWeight1 / (tmpWeight1+tmpWeight2)) dimdWeight2=round(43×tmpWeight2 / (tmpWeight1+tmpWeight2))
[0094] Adjust dimdWeight1 and dimdWeight2 so that dimdWeight1 + dimdWeight2 equals 43.
[0095] A special case is that HoG[i] are all 0, so IntraPredModeD1[xCb][yCb], IntraPredModeD1[xCb][yCb], and IntraPredModeD1[xCb][yCb] can all be equal to PLANAR, and dimdWeight1, dimdWeight1, and dimdWeight1 can be 64, 0, and 0 respectively.
[0096] Based on the above process, the final DIMD prediction block is: pred[x][y]=(pred1[x][y]×dimdWeight1+pred1[x][y]×dimdWeight1+pred1[x][y]×dimdWeight1+ 32)>>6
[0097] Where pred1[x][y], pred2[x][y], and pred3[x][y] are the prediction blocks obtained from the intra-prediction modes IntraPredModeD1[xCb][yCb], IntraPredModeD1[xCb][yCb], and IntraPredModeD1[xCb][yCb], respectively.
[0098] (3) Matrix-based Position Dependent Intra Prediction (PDP)
[0099] PDP is an intra-frame prediction mode that uses a predefined weight matrix to achieve intra-frame prediction. One implementation involves determining the predefined weight matrix for a specific block shape and intra-frame prediction angle, and then replacing the original traditional intra-frame angle with the PDP prediction based on this weight matrix. The predefined weight matrix is multiplied with a neighboring reference template to derive the prediction result value that replaces the traditional intra-frame angle prediction. Figure 12 is a schematic diagram of the PDP mode implementation. As shown in Figure 12, the weight matrix is applied to L-shaped neighborhood samples.
[0100] The reference sample in the neighborhood is denoted as r, and F(x,y) is the weight matrix. Then, the formula for predicting P(x,y) can be derived: P(x,y)=∑ k F(x,y,k)×r(k) (1)
[0101] In implementation, the PDP mode is applied to blocks of a specific size to control complexity. For example, it's applied to blocks with a width and height no greater than 32 (except for 4x32, 32x4, 8x32, and 32x8). Furthermore, different template sizes can be set for blocks of different sizes, and different angle predictions can be used. For example:
[0102] • For blocks with a width and height of no more than 16, the template size of the neighboring reference template (e.g., template width T1 and / or template width T2 in Figure 12) is set to 2 samples, and the original intra-frame angle prediction mode replaced by the PDP mode is 0, 1, (2+2k), k = 0..32.
[0103] • For other block sizes (i.e., 32x16, 16x32, 32x32), the template size of the neighboring reference template (e.g., template width T1 and / or template width T2 in Figure 12) is set to 1 sample, and the original intra-frame angle prediction mode replaced by the PDP mode is 0, 1, (2+4k), k = 0..16.
[0104] PDP uses the weight matrix to predict only the 16x16 position, with the remaining sample values generated through bilinear interpolation. For all block sizes, it leverages the symmetry between block shape and mode.
[0105] For traditional angle prediction models in the range of 18-50, the reference length of the neighboring reference template (e.g., the template length of the L-shaped neighboring template in Figure 12) is set to W and H respectively, otherwise it is set to 2W and 2H respectively.
[0106] Using the aforementioned PDP prediction technique, the encoder and decoder can replace the original prediction process (calculating the predicted value based on the position of the sample to be predicted, the reference sample value in the corresponding direction, etc.) with the weight matrix-based method when performing intra-frame prediction (intra-frame angle prediction, DC, Planar, etc.). Different modes can choose whether to replace the intra-frame prediction process with PDP prediction. For example, DIMD mode requires multiple intra-frame angle predictions and one Planar prediction, where intra-frame angle prediction uses PDP prediction, and Planar prediction can use the original method (calculating the predicted value based on the position of the sample to be predicted, the corresponding reference sample value, etc.).
[0107] (4) Occurrence-based intra coding (OBIC)
[0108] OBIC, or Occurrence-based Intra-frame Coding, derives the intra-prediction mode of the current block based on the occurrence of intra-patterns in the spatial neighborhood of the current block. In its implementation, it examines adjacent and non-adjacent spatially adjacent blocks and records and collects the intra-prediction modes of the blocks into an "occurrence-frequency histogram".
[0109] Unlike gradient histograms (HoGs) in DIDM, the OBIC method uses a frequency-based histogram. It consists of intra-frame patterns and their sample-level occurrence frequencies. The occurrence frequency is calculated based on the number of samples encoded in a neighborhood using a certain internal prediction pattern. For example, if a uiWidth×uiHeight block is encoded using the IPM pattern, then the number of occurrences of the pattern in that block is calculated using the following formula: Histogram[IPM]+=uiWidth×uiHeight (2)
[0110] Where uiWidth and uiHeight are the width and height of a spatial adjacent block, respectively. The occurrence frequency of existing patterns of spatial adjacent blocks is accumulated in the occurrence frequency histogram.
[0111] Figure 13 is a schematic diagram of the implementation of the OBIC mode. As shown in Figure 13, non-adjacent spatial adjacent blocks are used in the histogram generation of the OBIC mode.
[0112] The intra-prediction method used by a neighboring block may employ multiple intra-angle prediction modes. In this case, the intra-prediction modes used by these blocks will be recorded to create a histogram of OBIC occurrence frequencies.
[0113] • DIMD: Use up to 5 angle modes
[0114] • TIMD: Use up to 2 angle modes
[0115] • SGPM: Uses 2-angle mode
[0116] • OBIC: Use up to 5 angle modes
[0117] For neighborhood blocks with patterns such as MIP, IntraTMP, and EIP, virtual intra-frame angle patterns will be recorded using a method similar to a DIMD gradient histogram.
[0118] OBIC selects up to five of the most frequently occurring angular patterns and planar patterns or block vector-based predictions (similar to the DIMD patterns in ECM) from the histogram for the final prediction. The pattern prediction results are then weighted and fused. That is: Pred_final=Σpred_i×weight_i (3)
[0119] Where pred_i is the predicted value obtained from intra-frame angular prediction mode i or planar mode, and weight_i represents the corresponding fusion weight. In ECM OBIC, the fusion weight weight_i is calculated based on the frequency of occurrence of each mode in the neighborhood block.
[0120] Figure 14 illustrates the implementation of the OBIC mode. As shown in Figure 14, the OBIC mode is used as a sub-mode of the DIMD tool and is applied only to luma blocks. Furthermore, this mode is disabled for blocks with fewer than 64 samples.
[0121] Currently, DIMD uses N intra-frame predicted angle patterns obtained from gradient histogram statistics. Meanwhile, in the PDP method based on matrix weighted prediction, for valid coded blocks, some traditional angle patterns are replaced with reference region-based weighted predictions. The PDP prediction results using the matrix weighted method are often more accurate. However, most traditional angle patterns cannot be replaced with PDP patterns; therefore, the accuracy of intra-frame prediction results needs further improvement.
[0122] In other words, the common prediction modes currently available suffer from low prediction accuracy, which affects encoding and decoding performance.
[0123] Based on this, embodiments of this application provide an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium. The encoder / decoder determines multiple angle prediction modes corresponding to the current block. If the current block meets the PDP mode requirements, and the first prediction mode among the multiple angle prediction modes is a mode that does not allow intra-frame prediction using a weight matrix, a second prediction mode is determined based on the first prediction mode. The second prediction mode is a mode that allows intra-frame prediction using a weight matrix. A weight matrix for the PDP mode is determined based on the second prediction mode, and a first prediction block corresponding to the current block is determined based on the weight matrix of the PDP mode. The prediction block corresponding to the current block is determined based on the weights of the first prediction block and the first prediction mode. In other words, in embodiments of this application, for any angle prediction mode in the current block that is not applicable to the PDP mode, it can be extended to a PDP mode to determine a corresponding effective intra-frame prediction mode for the PDP mode, and intra-frame prediction is performed using the extended effective intra-frame prediction mode. Therefore, in this application, for angle prediction modes that are not effective for the PDP mode, intra-frame prediction of the PDP mode can be achieved through PDP mode extension, obtaining more accurate prediction results and thus improving encoding / decoding performance.
[0124] The embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0125] The encoder 100 may include a transform and quantization unit 101, an intra-frame estimation unit 102, an intra-frame prediction unit 103, a motion compensation unit 104, a motion estimation unit 105, an inverse transform and inverse quantization unit 106, a filter control and analysis unit 107, a filtering unit 108, an encoding unit 109, and a decoded image buffer unit 110, etc. The filtering unit 108 can implement deblocking filtering and Sample Adaptive Offset (SAO) filtering, and the encoding unit 109 can implement header information encoding and Context-based Adaptive Binary Arithmetic Coding (CABAC). For the input raw video signal, the encoding tree unit (Coding Tree) performs the encoding... The partitioning of a video coding unit (CTU) yields a video coding block. The residual sample information obtained after intra-frame or inter-frame prediction is then transformed by the transform and quantization unit 101. This transformation includes converting the residual information from the sample domain to the transform domain and quantizing the resulting transform coefficients to further reduce the bit rate. Intra-frame estimation unit 102 and intra-frame prediction unit 103 perform intra-frame prediction on the video coding block. Specifically, intra-frame estimation unit 102 and intra-frame prediction unit 103 determine the intra-frame prediction mode to be used to encode the video coding block. Motion compensation unit 104 and motion estimation unit 105 perform inter-frame prediction coding of the received video coding block relative to one or more blocks in one or more reference frames to provide temporal prediction information. The motion estimation performed by motion estimation unit 105 is a process of generating motion vectors, which can estimate the motion of the video coding block. Then, motion compensation unit 104 uses the motion vectors determined by motion estimation unit 105 to generate motion vectors. The motion compensation is performed. After determining the intra-prediction mode, the intra-prediction unit 103 is also used to provide the selected intra-prediction data to the coding unit 109, and the motion estimation unit 105 also sends the calculated motion vector data to the coding unit 109. In addition, the inverse transform and inverse quantization unit 106 is used to reconstruct the video coding block, reconstruct the residual block in the sample domain, and remove the block artifacts by the filter control analysis unit 107 and the filtering unit 108. Then, the reconstructed residual block is added to a predictive block in the frame of the decoding image buffer unit 110 to generate the reconstructed video coding block. The coding unit 109 is used to encode various coding parameters and quantized transform coefficients. In the CABAC-based coding algorithm, the context content can be based on adjacent coding blocks and can be used to encode information indicating the determined intra-prediction mode and output the bitstream of the video signal. The decoding image buffer unit 110 is used to store the reconstructed video coding block for prediction reference.As video image encoding proceeds, new reconstructed video encoding blocks are continuously generated, and these reconstructed video encoding blocks are stored in the decoding image buffer unit 110.
[0126] The decoder 200 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra-frame prediction unit 203, a motion compensation unit 204, a filtering unit 205, and a decoded image buffer unit 206. The decoding unit 201 can perform header information decoding and CABAC decoding, while the filtering unit 205 can perform deblocking filtering and SAO filtering. After the input video signal undergoes the encoding processing shown in Figure 14, the output video signal bitstream is generated. This bitstream is input into the decoder 200, first passing through the decoding unit 201 to obtain the decoded transform coefficients. These transform coefficients are then processed by the inverse transform and inverse quantization unit 202 to generate residual blocks in the sample domain. The intra-frame prediction unit 203 can generate prediction data for the current video decoding block based on the determined intra-frame prediction mode and data from previously decoded blocks in the current frame or image. The motion compensation unit 204 determines the prediction information for the video decoding block by analyzing motion vectors and other associated syntax elements, and uses... The prediction information is used to generate a predictive block of the video block being decoded; the decoded video block is formed by summing the residual block from the inverse transform and inverse quantization unit 202 with the corresponding predictive block generated by the intra-prediction unit 203 or the motion compensation unit 204; the decoded video signal is passed through the filtering unit 205 to remove block artifacts, which can improve video quality; then the decoded video block is stored in the decoding image buffer unit 206, which stores reference images for subsequent intra-prediction or motion compensation, and is also used for the output of the video signal, thus obtaining the recovered original video signal.
[0127] In the embodiments of this application, a network architecture for a video encoding / decoding system including decoding and encoding methods is provided. The decoder or encoder in these embodiments can be the aforementioned electronic device. That is, the electronic device in these embodiments has video encoding / decoding capabilities and generally includes a video encoder (i.e., encoder) and a video decoder (i.e., decoder).
[0128] It should also be noted that the embodiments of this application are mainly applied to the intra-frame prediction part. That is to say, the embodiments of this application can be applied to the encoder, the decoder, or even to both the encoder and the decoder.
[0129] It should also be noted that when the embodiments of this application are applied to an encoder, "current block" specifically refers to the encoded block to be predicted; when the embodiments of this application are applied to a decoder, "current block" specifically refers to the decoded block to be predicted.
[0130] In one embodiment of this application, FIG15 is a schematic flowchart of a decoding method provided in this application embodiment. As shown in FIG15, the decoding method of the decoder may include:
[0131] Step 1501: Determine the multiple angle prediction modes corresponding to the current block.
[0132] It should be noted that in the embodiments of this application, the decoding method is applied to the decoder. Specifically, based on the composition structure of the decoder 200, the decoding method of the embodiments of this application can be applied to the intra-frame prediction part, mainly including a DIMD matrix prediction mode extension method, which can improve the accuracy of intra-frame prediction.
[0133] In the embodiments of this application, multiple angle prediction modes corresponding to the current block can be determined first. The number of angle prediction modes corresponding to the current block can be more than one; this application does not specifically limit the number of angle prediction modes for the current block.
[0134] Furthermore, in the embodiments of this application, one or more methods can be selected to determine the multiple angle prediction modes corresponding to the current block. For example, the DIMD mode can be used to derive the multiple angle prediction modes corresponding to the current block, or the OBIC mode can be used to derive the multiple angle prediction modes corresponding to the current block. Of course, other modes can also be used to derive the multiple angle prediction modes corresponding to the current block, and this application does not make specific limitations.
[0135] For example, in some embodiments, when using DIMD mode to derive multiple angle prediction modes corresponding to the current block, an amplitude histogram (HoG) can be established first, and then one or more intra-frame prediction modes and their corresponding amplitude values can be recorded based on the amplitude histogram. Finally, one or more intra-frame prediction modes with the largest cumulative amplitude value are selected as the prediction modes derived by DIMD. The prediction modes derived by DIMD may include angle prediction modes.
[0136] For example, in some embodiments, the intra-prediction mode of the current block can be derived directly using adjacent or non-adjacent regions, or the reference region corresponding to the current block can be determined first based on the position information and size information of the current block; and then the intra-prediction mode corresponding to the current block can be determined based on the reference region.
[0137] It is understood that, in the embodiments of this application, the size of the reference region may be related to the size message and / or position information of the current block. For example, based on the position and size of the current block (x, y, cbWidth, cbHeight) and the block vector (bvHor, bvVer), the position and size of the reference region (x+bvHor-offsetX, y+bvVer-offsetY, cbWidth+dW, cbHeight+dH) can be obtained, where offsetX, offsetY, dW, and dH can take any integer values.
[0138] Furthermore, in the embodiments of this application, when determining the intra-prediction mode corresponding to the current block based on the reference region, the sampling window can be determined first; then, based on the sampling window and the sample position in the reference region, the angle direction corresponding to the sample position and the gradient magnitude value corresponding to the angle direction can be determined; finally, the intra-prediction mode corresponding to the current block can be determined based on the angle direction and the gradient magnitude value.
[0139] In the embodiments of this application, the size of the sampling window can be set to any size, and this application does not impose any specific limitation. For example, a 3x3 sampling window can be set.
[0140] For example, in some embodiments, assuming the sampling window is a 3x3 window, when determining the angular direction and gradient magnitude corresponding to the sample position based on the sample position in the sampling window and the reference region, for any sampling window in the reference region with a corresponding sample position of (x, y), the horizontal and vertical gradient values Gx and Gy can be calculated. Gx and Gy are obtained by convolving the 3x3 horizontal gradient operator M_x and the vertical gradient operator M_y with the sample values within the window position, respectively. The technical methods for the horizontal gradient operator M_x and the vertical gradient operator M_y are illustrated in the following formula:
[0141] Based on Gx and Gy at each sample location, the angular direction O corresponding to each sample location is calculated using the following formula, and the magnitude G of the gradient at each location is also calculated: G=|G x |+|G y | (6)
[0142] In some embodiments, the calculation process for atan can be simplified by using a lookup table or some variations.
[0143] Finally, the magnitude value G of the gradient at each reference position is accumulated on its derived conventional intra-prediction mode to obtain a HoG. Finally, one or more conventional intra-prediction modes with the largest accumulated magnitude value are selected as the intra-prediction mode corresponding to the current block.
[0144] For example, in some embodiments, multiple angle prediction modes can be obtained through DIMD gradient histogram statistics, including dimdMode and dimdBlendMode[N]. Here, dimdMode can refer to the angle prediction mode with the largest amplitude value, and dimdBlendMode[N] can refer to N angle prediction modes with large amplitude values other than dimdMode. N is an integer greater than or equal to 0.
[0145] Furthermore, in the embodiments of this application, when determining the multiple angle prediction modes corresponding to the current block, multiple weights corresponding to the multiple angle prediction modes can also be determined. Different angle prediction modes can correspond to different weights.
[0146] For example, in some embodiments, when using the DIMD mode to derive multiple angle prediction modes corresponding to the current block, the derived intra-prediction mode and its corresponding weight can be related to the magnitude of the mode in HoG.
[0147] In other words, in the embodiments of this application, multiple angle prediction modes corresponding to the current block can be determined by the amplitude in HoG, and multiple weights corresponding to multiple angle prediction modes can also be determined by the amplitude in HoG.
[0148] Step 1502: If the current block meets the PDP mode requirements and the first prediction mode among multiple angle prediction modes is a mode that does not allow the use of weight matrices for intra-frame prediction, determine the second prediction mode based on the first prediction mode; wherein the second prediction mode is a mode that allows the use of weight matrices for intra-frame prediction.
[0149] In the embodiments of this application, after determining the multiple angle prediction modes corresponding to the current block, if the current block meets the PDP mode requirements and the first prediction mode among the multiple angle prediction modes is a mode that does not allow the use of weight matrices for intra-frame prediction, then a second prediction mode can be further determined based on the first prediction mode.
[0150] It is understood that, in the embodiments of this application, the first prediction mode can be any one of the multiple angle prediction modes corresponding to the current block. The prohibition of using a weight matrix for intra-frame prediction can be understood as not being a valid PDP mode, i.e., the first prediction mode is not a valid PDP mode.
[0151] For example, in some embodiments, assuming that multiple angle prediction modes include dimdMode and dimdBlendMode[N], then the first prediction mode can be dimdMode or dimdBlendMode[i], i = 0..N-2, and this application does not make specific limitations.
[0152] It is understood that, in the embodiments of this application, the second prediction mode can be a prediction mode among at least one of the prediction modes that allow intra-frame prediction using a weight matrix corresponding to the current block. Here, allowing intra-frame prediction using a weight matrix can be understood as a valid PDP mode, i.e., the second prediction mode is a valid PDP mode.
[0153] Furthermore, in the embodiments of this application, a validity check can be performed on the current block first to determine whether the current block meets the PDP mode requirements. The validity check is used to verify whether the current block can be used for PDP prediction; the PDP mode requirements may include, but are not limited to, requirements for the size parameters of the current block and requirements for the reference area corresponding to the current block.
[0154] It is understood that, in the embodiments of this application, when performing a validity check on the current block, it is necessary to check whether the size parameters of the current block meet the PDP mode requirements, that is, to perform a sizeAvailable check on the current block size; at the same time, it is also necessary to check whether the reference area of the current block meets the PDP mode requirements, that is, to perform a reference area availability check.
[0155] Furthermore, in the embodiments of this application, considering that the PDP mode will be applied to blocks with a width and height of no more than 32 (except for 4x32, 32x4, 8x32 and 32x8), when performing the sizeAvailable check of the current block size, the size parameters of the current block, namely the width w and height h of the current block, can be selected to perform the sizeAvailable check.
[0156] Furthermore, in the embodiments of this application, considering that sufficient available reference areas are needed for matrix weighted prediction, when performing the reference area availability check (refAvailable), the current block boundary can be analyzed to determine whether the reconstructed samples of the reference area of the current block are available, and the number of available samples can be counted.
[0157] In the embodiments of this application, the order in which the size validity check (sizeAvailable) and the reference area availability check (refAvailable) of the current block are performed is not specifically limited. For example, the size validity check (sizeAvailable) of the current block can be performed first. If it is determined that the size parameters of the current block meet the PDP mode requirements, then the reference area availability check (refAvailable) of the current block can be further performed.
[0158] Furthermore, in the embodiments of this application, if the size parameters of the current block and the reference area both meet the PDP mode requirements, it can be determined that the current block meets the PDP mode requirements.
[0159] In embodiments of this application, the validity of the PDP mode of the first prediction mode among multiple angle prediction modes of the current block can also be checked to determine whether the first prediction mode is a mode that allows intra-frame prediction using a weight matrix.
[0160] In other words, in the embodiments of this application, the PDP mode validity check can be used to determine whether any angle prediction mode is applicable to the PDP mode, that is, to determine whether any angle prediction mode is a mode that allows intra-frame prediction using a weight matrix.
[0161] Furthermore, in the embodiments of this application, the mode that allows intra-frame prediction using the weight matrix is determined based on the size parameter of the current block, that is, it can be determined whether any angle prediction mode corresponding to the current block is applicable to the PDP mode based on the size parameter of the current block.
[0162] For example, in some embodiments, for image patches whose width and height are both no greater than 16, the PDP mode only replaces specific intra-frame angle prediction modes. Besides the special 0 and 1 modes, the effective set of angle modes for the PDP mode is (2+2k), k = 0..32.
[0163] For example, in some embodiments, for other image block sizes (such as 32x16, 16x32, 32x32), the effective set of angle patterns for PDP mode is (2+4k), k = 0..16.
[0164] In other words, in the embodiments of this application, it can be further determined whether the first prediction mode is a mode that allows intra-frame prediction using a weight matrix based on the size parameters of the current block. Specifically, if the width and height of the current block are both no greater than 16, then it can be determined whether the first prediction mode is any one of mode 0, mode 1, or mode 2+2k (k = 0..32), that is, whether the first prediction mode belongs to a mode set including mode 0, mode 1, and mode 2+2k. If so, then the first prediction mode can be determined to be a mode that allows intra-frame prediction using a weight matrix; otherwise, the first prediction mode is determined to be a mode that does not allow intra-frame prediction using a weight matrix.
[0165] Accordingly, in some embodiments, for image blocks of other sizes (such as 32x16, 16x32, 32x32), it can be determined whether the first prediction mode is (2+4k), k = any one of 0..16, that is, whether the first prediction mode belongs to the mode set including the 2+4k mode. If so, it can be determined that the first prediction mode is a mode that allows intra-frame prediction using the weight matrix; otherwise, it can be determined that the first prediction mode is a mode that does not allow intra-frame prediction using the weight matrix.
[0166] In related technologies, PDP mode is used for intra-frame prediction only for modes that allow the use of weight matrices. Considering that PDP mode can replace angle prediction mode to obtain better prediction results, in the embodiments of this application, for angle prediction modes that do not allow the use of PDP mode, such as the first prediction mode, the range of PDP mode replacement angle prediction modes can be further expanded to determine the corresponding second prediction mode suitable for PDP mode to use PDP mode for intra-frame prediction, thereby improving the accuracy of intra-frame prediction.
[0167] In an embodiment of this application, when determining the second prediction mode based on the first prediction mode, one implementation method is: first, determine the candidate prediction mode based on the first prediction mode and the offset value; then, determine the second prediction mode based on the candidate prediction mode.
[0168] It is understood that, in the embodiments of this application, the offset value can be understood as the offset amount corresponding to the offset of the first prediction mode. The offset value may include the offset step size and the offset direction.
[0169] In other words, in the embodiments of this application, if the first prediction mode is a mode that does not allow the use of weight matrices for intra-frame prediction, then the first prediction mode can be offset by an offset value to obtain a corresponding second prediction mode that allows the use of weight matrices for intra-frame prediction.
[0170] Furthermore, in embodiments of this application, the offset value may include a first offset value and / or a second offset value. The first offset value is the offset value corresponding to the first prediction mode belonging to a first prediction mode set; the second offset value is the offset value corresponding to the first prediction mode belonging to a second prediction mode set.
[0171] For example, in some embodiments, it is assumed that the offset value includes a first offset value and a second offset value, wherein the first offset value is +1 and the second offset value is -1, the first prediction mode set includes angle prediction modes 18 to 33 and angle prediction modes 50 to 66, that is, the first prediction mode set refers to the interval of mode index in [18,33] and mode index in [50,66], and the second prediction mode set includes angle prediction modes 2 to 17 and angle prediction modes 34 to 49, that is, the first prediction mode set refers to the interval of mode index in [2,17] and mode index in [34,49]. If the first prediction mode is angle prediction mode 48, then the first prediction mode belongs to the set of second prediction modes. At this time, the offset value can be determined as the second offset value -1, where the offset direction of the second offset value is -, that is, the offset direction is towards a smaller angle mode (counterclockwise offset), and the offset step size is 1. If the first prediction mode is angle prediction mode 22, then the first prediction mode belongs to the set of first prediction modes. At this time, the offset value can be determined as the first offset value +1, where the offset direction of the first offset value is +, that is, the offset direction is towards a larger angle mode (clockwise offset), and the offset step size is 1.
[0172] In other words, in the embodiments of this application, the corresponding offset value can be determined based on the set of prediction modes to which the first prediction mode belongs, specifically by determining the corresponding offset direction and offset step size.
[0173] For example, in some embodiments, it is assumed that the offset value includes a first offset value, wherein the first offset value is +1, and the first prediction mode set includes angle prediction mode 2 to angle prediction mode 66, that is, the first prediction mode set refers to the interval of mode index [2, 66]. In this case, the first prediction mode belongs to the first prediction mode set, so the offset value can be determined to be the first offset value +1, wherein the offset direction of the first offset value is +, that is, the offset direction is towards the larger angle mode (clockwise offset), and the offset step size is 1.
[0174] In other words, in the embodiments of this application, the same offset value, namely the first offset value, can be used for any prediction mode to offset the angle prediction mode.
[0175] For example, in some embodiments, it is assumed that the offset value includes a second offset value, wherein the second offset value is -1, and the second prediction mode set includes angle prediction mode 2 to angle prediction mode 66, that is, the second prediction mode set refers to the interval of mode index [2, 66]. In this case, the second prediction mode belongs to the second prediction mode set, so the offset value can be determined to be the second offset value -1, wherein the offset direction of the second offset value is -, that is, the offset direction is towards the smaller angle mode (counterclockwise offset), and the offset step size is 1.
[0176] In other words, in the embodiments of this application, the same offset value, namely the second offset value, can be used for the offset of the angle prediction mode for any prediction mode.
[0177] In the embodiments of this application, the offset step size of the first offset value and the second offset value may be the same or different, and this application does not impose specific limitations.
[0178] Furthermore, in the embodiments of this application, the offset value can be determined by the angle offset index corresponding to the first prediction mode. Specifically, the angle offset index corresponding to the first prediction mode can be determined first, and then the corresponding offset value can be determined based on the angle offset index.
[0179] For example, in some embodiments, when determining the angle offset index intervalIndex corresponding to the first prediction mode, the following formula can be used: intervalIndex=(mode-2) / 16 (8)
[0180] Here, mode is the mode index of the first prediction mode. That is, the corresponding angle offset index can be determined by performing calculations using the mode index of the first prediction mode.
[0181] For example, if the first prediction mode is mode 32, i.e., mode = 32, the corresponding angle offset index intervalIndex = (32-2) / 16 = 1 can be determined based on the mode index of the first prediction mode, i.e., the angle offset index is determined to be an odd number.
[0182] Furthermore, in the embodiments of this application, when determining the offset value corresponding to the first prediction mode based on the angle offset index, if the angle offset index intervalIndex is odd, then the offset value can be determined to be the first offset value + 1, wherein the offset direction of the first offset value is +, that is, the offset direction is offset towards the larger angle mode (clockwise offset), and the offset step size is 1.
[0183] Furthermore, in the embodiments of this application, when determining the offset value corresponding to the first prediction mode based on the angle offset index, if the angle offset index intervalIndex is even, then the offset value can be determined to be the second offset value -1, wherein the offset direction of the second offset value is -, that is, the offset direction is offset towards a smaller angle mode (counterclockwise offset), and the offset step size is 1.
[0184] In other words, in the embodiments of this application, when the angle offset index is odd, the offset value is a first offset value, used to indicate the first offset direction and the first offset step; when the angle offset index is even, the offset value is a second offset value, used to indicate the second offset direction and the second offset step.
[0185] It is understood that in the embodiments of this application, after offsetting the first prediction mode by the offset value, a corresponding intra-frame prediction mode can be obtained, i.e., a candidate prediction mode can be obtained. Then, the legality of the candidate prediction mode and the validity of the PDP mode can be further checked and verified to finally obtain the corresponding second prediction mode. The candidate prediction mode obtained after offsetting the first prediction mode may or may not be a valid PDP mode. Therefore, in addition to verifying the legality of the candidate prediction mode, it is also necessary to verify the validity of the candidate prediction mode's PDP mode.
[0186] Furthermore, in the embodiments of this application, when determining the second prediction mode based on the candidate prediction mode, if the candidate prediction mode belongs to the first angle mode set and the candidate prediction mode is a mode that allows intra-frame prediction using a weight matrix, the candidate prediction mode can be selected as the second prediction mode.
[0187] It is understood that, in the embodiments of this application, for any prediction mode corresponding to the current block, the legality of the prediction mode can be checked by using a first angle mode set. The first angle mode set can be predefined and can be used to determine whether the prediction mode is within a legal intra-frame angle range.
[0188] For example, in some embodiments, if the legal intra-frame angle range is greater than or equal to 2 and less than or equal to NUM_LUMA_MODE-1, that is, it does not include DC mode and planar mode, then the first angle mode set can be predefined to include angle prediction mode 2 to angle prediction mode 66, that is, the first angle mode set refers to the interval of mode index in [2, 66].
[0189] For example, in some embodiments, the first prediction mode can be legally checked by the first angle mode set. If the first prediction mode belongs to the first angle mode set, then the first prediction mode can be determined to be legal, and then it can be further determined whether the first prediction mode is a valid PDP mode.
[0190] For example, in some embodiments, the legality of candidate prediction modes corresponding to the first prediction mode can be checked by the first angle mode set. If the candidate prediction mode belongs to the first angle mode set, then the candidate prediction mode can be determined to be legal.
[0191] It is understood that, in the embodiments of this application, for any prediction mode corresponding to the current block, the validity of the PDP mode can be checked by using the set of valid angle modes of the PDP mode. The set of valid angle modes of the PDP mode is determined based on the size parameters of the current block.
[0192] For example, in some embodiments, it can be further determined whether the candidate prediction mode is a mode that allows intra-frame prediction using a weight matrix based on the size parameters of the current block. Specifically, if the width and height of the current block are both no greater than 16, then it can be determined whether the candidate prediction mode is any one of mode 0, mode 1, or mode 2+2k (k = 0..32), that is, whether the candidate prediction mode belongs to a mode set including mode 0, mode 1, and mode 2+2k. If so, then the candidate prediction mode can be determined to be a mode that allows intra-frame prediction using a weight matrix; otherwise, the candidate prediction mode is determined to be a mode that does not allow intra-frame prediction using a weight matrix.
[0193] For example, in some embodiments, for image blocks of other sizes (such as 32x16, 16x32, 32x32), it can be determined whether the candidate prediction mode is (2+4k), k = any one of 0..16, that is, whether the candidate prediction mode belongs to the mode set including the 2+4k mode. If so, it can be determined that the candidate prediction mode is a mode that allows intra-frame prediction using the weight matrix; otherwise, it can be determined that the candidate prediction mode is a mode that does not allow intra-frame prediction using the weight matrix.
[0194] Furthermore, in the embodiments of this application, when determining the second prediction mode based on the candidate prediction mode, if the candidate prediction mode determined based on the first offset value does not belong to the first angle mode set or is a mode that does not allow the use of the weight matrix for intra-frame prediction, it is possible to continue to determine the second prediction mode according to the second offset value; if the candidate prediction mode determined based on the second offset value does not belong to the first angle mode set or is a mode that does not allow the use of the weight matrix for intra-frame prediction, it is possible to continue to determine the second prediction mode according to the first offset value.
[0195] In other words, in the embodiments of this application, if the candidate prediction mode after mode offset does not belong to the first angle mode set, or if the candidate prediction mode is a mode that does not allow intra-frame prediction using a weight matrix, then mode offset can be performed according to different offset values to obtain a new candidate prediction mode. The legality of the new candidate prediction mode and the validity of the PDP mode are checked and verified according to the above method, and finally the corresponding second prediction mode is obtained.
[0196] It is understood that in the embodiments of this application, if the candidate prediction mode obtained based on the first offset value fails the legality or PDP mode validity check and verification, then the second offset value can be used to perform mode shifting to obtain a new candidate prediction mode; correspondingly, if the candidate prediction mode obtained based on the second offset value fails the legality or PDP mode validity check and verification, then the first offset value can be used to perform mode shifting to obtain a new candidate prediction mode.
[0197] Accordingly, in the embodiments of this application, if the candidate prediction modes obtained based on different offset values, such as the first offset value and the second offset value, do not pass the legality or validity check or verification of the PDP mode, then it is possible to choose not to replace the first prediction mode with the PDP mode.
[0198] For example, in some embodiments, it is assumed that the offset value may include a first offset value and a second offset value, wherein the first offset value is +1 and the second offset value is -1. If the first prediction mode belongs to the first prediction mode set ([18,33] and [50,66]), then the first offset value +1 can be used for mode offset. For the first prediction mode mode, the corresponding candidate prediction mode is determined as nextMode = mode +1, that is, the next prediction mode of the first prediction mode is taken as the candidate prediction mode. Then, it can be further determined whether nextMode is within the legal intra-frame angle range, and further checked whether nextMode is a valid PDP mode. If nextMode passes the checks of legality and PDP mode validity, then nextMode can be determined as the corresponding second prediction mode. If nextMode fails the validity or PDP mode validity check, then the second offset value -1 can be used for mode offset. For the first prediction mode mode, the new candidate prediction mode is determined as prevMode = mode - 1, that is, the previous prediction mode of the first prediction mode is taken as the candidate prediction mode. Then, it can be further determined whether prevMode is within the legal intra-frame angle range, and whether prevMode is a valid PDP mode can be further checked. If prevMode passes the validity and PDP mode validity checks, then prevMode can be determined as the corresponding second prediction mode.
[0199] For example, in some embodiments, it is assumed that the offset value may include a first offset value and a second offset value, wherein the first offset value is +1 and the second offset value is -1. If the first prediction mode belongs to the set of second prediction modes ([2,17] and [34,49]), then the second offset value -1 can be used for mode offset first. For the first prediction mode mode, the corresponding candidate prediction mode is determined to be prevMode = mode-1, that is, the previous prediction mode of the first prediction mode is taken as the candidate prediction mode. Then, it can be further determined whether prevMode is within the legal intra-frame angle range, and further checked whether prevMode is a valid PDP mode. If prevMode passes the checks of legality and PDP mode validity, then prevMode can be determined as the corresponding second prediction mode. If prevMode fails the validity or PDP mode validity check, then the first offset value + 1 can be used for mode offset. For the first prediction mode mode, the determined new candidate prediction mode is nextMode = mode + 1, that is, the next prediction mode of the first prediction mode is taken as the candidate prediction mode. Then, it can be further determined whether nextMode is within the legal intra-frame angle range, and whether nextMode is a valid PDP mode can be further checked. If nextMode passes the validity and PDP mode validity check, then nextMode can be determined as the corresponding second prediction mode.
[0200] For example, in some embodiments, it is assumed that the offset value may include a first offset value and a second offset value, wherein the first offset value is +1 and the second offset value is -1. If the angle offset index intervalIndex corresponding to the first prediction mode is odd, then the first offset value +1 can be used for mode offset. For the first prediction mode mode, the corresponding candidate prediction mode is determined to be nextMode = mode + 1, that is, the next prediction mode of the first prediction mode is taken as the candidate prediction mode. Then, it can be further determined whether nextMode is within the legal intra-frame angle range, and further checked whether nextMode is a valid PDP mode. If nextMode passes the checks of legality and PDP mode validity, then nextMode can be determined as the corresponding second prediction mode. If nextMode fails the validity or PDP mode validity check, then the second offset value -1 can be used for mode offset. For the first prediction mode mode, the new candidate prediction mode is determined as prevMode = mode - 1, that is, the previous prediction mode of the first prediction mode is taken as the candidate prediction mode. Then, it can be further determined whether prevMode is within the legal intra-frame angle range, and whether prevMode is a valid PDP mode can be further checked. If prevMode passes the validity and PDP mode validity checks, then prevMode can be determined as the corresponding second prediction mode.
[0201] For example, in some embodiments, it is assumed that the offset value may include a first offset value and a second offset value, wherein the first offset value is +1 and the second offset value is -1. If the angle offset index intervalIndex corresponding to the first prediction mode is even, then the second offset value -1 can be used for mode offset first. For the first prediction mode mode, the corresponding candidate prediction mode is determined to be prevMode = mode - 1, that is, the previous prediction mode of the first prediction mode is taken as the candidate prediction mode. Then, it can be further determined whether prevMode is within the legal intra-frame angle range, and further checked whether prevMode is a valid PDP mode. If prevMode passes the checks of legality and PDP mode validity, then prevMode can be determined as the corresponding second prediction mode. If prevMode fails the validity or PDP mode validity check, then the first offset value + 1 can be used for mode offset. For the first prediction mode mode, the determined new candidate prediction mode is nextMode = mode + 1, that is, the next prediction mode of the first prediction mode is taken as the candidate prediction mode. Then, it can be further determined whether nextMode is within the legal intra-frame angle range, and whether nextMode is a valid PDP mode can be further checked. If nextMode passes the validity and PDP mode validity check, then nextMode can be determined as the corresponding second prediction mode.
[0202] Therefore, in the embodiments of this application, when determining the second prediction mode based on the first prediction mode, for the first prediction mode mode among multiple angle prediction modes (e.g., dimdMode and dimdBlendMode[N]), when the offset step size is 1, it is possible to check whether its adjacent angle mode (mode±1) is a valid PDP mode. If so, the original mode mode is replaced with the adjacent PDP mode.
[0203] Furthermore, in the embodiments of this application, in determining the second prediction mode based on the first prediction mode, in order to ensure that the derived angle prediction mode is not repeated, the includedMode array can be used to record the angle prediction mode corresponding to the current block, thereby tracking all included angle prediction modes in the PDP expansion process.
[0204] It is understood that, in the embodiments of this application, the valid identifier of the intra-prediction mode in the second angle mode set can be initialized to a first value. The first value can be any numerical value, such as 0, and this application does not impose any specific limitation.
[0205] In embodiments of this application, the second angle mode set may include intra-frame prediction mode n, n = 0..NUM_LUMA_MODE-1, that is, the intra-frame prediction modes in the second angle mode set include modes 0-66.
[0206] For example, in some embodiments, assuming the first value is 0, the includedMode array can be initialized first, and the valid identifier includedMode[i] of the intra-prediction mode in the second angle mode set can be set to 0, i = 0..NUM_LUMA_MODE-1. That is, for the intra-prediction modes that can be derived, such as the intra-prediction modes of modes 0-66, the valid identifier includedMode corresponding to each prediction mode can be initialized to 0 first.
[0207] Furthermore, in embodiments of this application, when the first prediction mode is a mode that allows intra-frame prediction using a weight matrix, the valid identifier of the first prediction mode can be set to a second value, i.e., the includedMode array is updated to record the first prediction mode. The first value is different from the second value; that is, the second value can be any value other than the first value, such as 1. This application does not impose specific limitations.
[0208] For example, in some embodiments, assuming the second value is 1, the first prediction mode is mode m, m = 2..NUM_LUMA_MODE-1, and if the first prediction mode is a valid PDP mode, then includedMode[m] = 1 can be set.
[0209] Furthermore, in the embodiments of this application, if the first prediction mode is not a valid PDP mode, then after determining a valid PDP mode, such as the second prediction mode, based on the offset value, it is possible to set the valid identifier of the second prediction mode to a second value, that is, update the includedMode array to record the second prediction mode.
[0210] For example, in some embodiments, assuming the second value is 1 and the second prediction mode is mode m+1, since the second prediction mode is a valid PDP mode, then includedMode[m+1] can be set to 1.
[0211] It is understood that, in the embodiments of this application, the valid identifier can be used to determine whether one or more intra-prediction modes are included in the PDP extension process. For example, a first value indicates that the prediction mode is not included, while a second value indicates that the prediction mode is included.
[0212] Accordingly, in the embodiments of this application, after offsetting the first prediction mode by offsetting the first prediction mode to obtain the candidate prediction mode, during the process of checking and verifying the legality of the candidate prediction mode and the validity of the PDP mode, it is also possible to simultaneously determine whether the candidate prediction mode has been included based on the valid identifier. In order to ensure that the angle prediction mode is not repeated, it is possible to select the candidate prediction mode as the second prediction mode if the candidate prediction mode obtained by offset is not included.
[0213] Furthermore, in the embodiments of this application, when determining the second prediction mode based on the candidate prediction mode, if the candidate prediction mode belongs to the first angle mode set, and the valid identifier of the candidate prediction mode is the first value, and the candidate prediction mode is a mode that allows intra-frame prediction using a weight matrix, the candidate prediction mode is determined as the second prediction mode.
[0214] In other words, in the embodiments of this application, if the candidate prediction mode obtained based on the offset value passes the checks and verifications of legality and PDP mode validity, and the valid identifier of the candidate prediction mode is the first value (i.e., the candidate prediction mode is not repeated), then the candidate prediction mode can be selected as the second prediction mode.
[0215] For example, in some embodiments, assuming that a first offset value + 1 is used for mode offset, for a first prediction mode mode, the corresponding candidate prediction mode is determined to be nextMode = mode + 1. Then, it is determined whether nextMode is within the legal intra-frame angle range and whether nextMode is a valid PDP mode. At the same time, based on the valid identifier includedMode of the candidate prediction mode, it is determined whether the candidate prediction mode has been included. If nextMode passes the legality and PDP mode validity checks, and the valid identifier includedMode of the candidate prediction mode takes the second value, that is, the candidate prediction mode has been included, then the second offset value - 1 can be used for mode offset. For the first prediction mode mode, the new candidate prediction mode is determined to be prevMode = mode - 1, that is, the previous prediction mode of the first prediction mode is taken as the candidate prediction mode. If prevMode passes the legality and PDP mode validity checks, and the corresponding valid identifier includedMode takes the first value, then prevMode can be determined as the corresponding second prediction mode.
[0216] In an embodiment of this application, another method for determining the second prediction mode based on the first prediction mode is to first determine a candidate prediction mode based on the size parameters of the current block and the first prediction mode; and then determine the second prediction mode based on the candidate prediction mode.
[0217] It is understood that, in the embodiments of this application, the corresponding second prediction mode can be determined by combining the size parameters of the current block and the first prediction mode.
[0218] Furthermore, in the embodiments of this application, when determining a candidate prediction mode based on the size parameters of the current block and the first prediction mode, the mode determination parameters can be determined first based on the size parameters and the first prediction mode; and then the candidate prediction mode can be determined based on the mode determination parameters.
[0219] It is understood that, in the embodiments of this application, the mode determination parameter can be understood as a specific parameter value used to derive the second prediction mode. The mode determination parameter can be determined based on the first prediction mode and the size parameter of the current block. For different first prediction modes and different size parameters, the corresponding mode determination parameter is different.
[0220] For example, in some embodiments, assuming the first prediction mode is uiMode, if the current block's size parameter indicates that the width and height of the current block are both no greater than 16, then the mode determination parameter K based on the first prediction mode can be determined with reference to the formula:
[0221] For example, in some embodiments, assuming the first prediction mode is uiMode, if the current block's size parameter indicates that the current block's width or height is greater than 16 (i.e., 32x16, 16x32, 32x32), then the mode determination parameter K based on the first prediction mode can be determined with reference to the formula:
[0222] In other words, in the embodiments of this application, the method of determining parameter K based on the first prediction mode uiMode derivation mode is different for different size parameters.
[0223] For example, in some embodiments, if the size parameter of the current block indicates that the width and height of the current block are not greater than 16, then the neighboring PDP mode pdpMode (candidate prediction mode) determined based on the mode determination parameter K can refer to the formula: pdpMode=K×2+2 (11)
[0224] For example, in some embodiments, if the size parameter of the current block indicates that the width or height of the current block is greater than 16 (i.e., 32x16, 16x32, 32x32), then the determination of the neighboring PDP mode pdpMode (candidate prediction mode) based on the mode determination parameter K can refer to the formula: pdpMode=K×4+2 (12)
[0225] In other words, in the embodiments of this application, the method of determining the candidate prediction mode based on the mode determination parameter K is different for different size parameters.
[0226] It is understood that, in the embodiments of this application, after determining the candidate prediction mode based on the size parameters of the current block and the first prediction mode, the legality of the candidate prediction mode can be further checked and verified to finally obtain the corresponding second prediction mode. The candidate prediction mode obtained based on the size parameters of the current block and the first prediction mode can be a valid PDP mode; therefore, only the legality of the candidate prediction mode needs to be verified, and the validity of the PDP mode of the candidate prediction mode is no longer verified.
[0227] Furthermore, when determining the second prediction mode based on the candidate prediction mode, if the candidate prediction mode belongs to the first angle mode set, the candidate prediction mode is determined as the second prediction mode.
[0228] It is understood that, in the embodiments of this application, for any prediction mode corresponding to the current block, the legality of the prediction mode can be checked by using a first angle mode set. The first angle mode set can be predefined and can be used to determine whether the prediction mode is within a legal intra-frame angle range.
[0229] For example, in some embodiments, if the legal intra-frame angle range is greater than or equal to 2 and less than or equal to NUM_LUMA_MODE-1, then the first angle mode set can be predefined to include angle prediction mode 2 to angle prediction mode 66, that is, the first angle mode set refers to the interval of mode index in [2, 66].
[0230] For example, in some embodiments, the legality of candidate prediction modes corresponding to the first prediction mode can be checked by the first angle mode set. If the candidate prediction mode belongs to the first angle mode set, then the candidate prediction mode can be determined to be legal.
[0231] Furthermore, in the embodiments of this application, when determining the second prediction mode based on the candidate prediction mode, if the candidate prediction mode does not belong to the first angle mode set, the candidate prediction mode is re-determined based on the size parameter and the mode determination parameter; the second prediction mode is determined based on the re-determined candidate prediction mode.
[0232] In other words, in the embodiments of this application, if the obtained candidate prediction mode does not belong to the first angle mode set, then the parameters can be re-determined according to the current block size parameters and mode to obtain a new candidate prediction mode, and the legality of the new candidate prediction mode is checked and verified according to the above method to finally obtain the corresponding second prediction mode.
[0233] For example, in some embodiments, if the first determined candidate prediction mode does not belong to the first angle mode set, i.e., the first determined candidate prediction mode is invalid, then other nearby pdpModes can be further calculated, i.e., the candidate modes are re-determined. For example, when obtaining new candidate prediction modes according to the current block size parameters and mode determination parameters, if the current block size parameters indicate that the width and height of the current block are not greater than 16, the pdpMode corresponding to K-1 can be checked first, i.e., the PDP mode pdpMode (new candidate prediction mode) determined based on the mode determination parameter K, referring to the formula: pdpMode=(K-1)×2+2 (13)
[0234] Accordingly, if the pdpMode corresponding to K-1 belongs to the first angle mode set, that is, the candidate prediction mode determined again is valid, then the mode expansion process can be terminated and the pdpMode corresponding to K-1 is determined as the second prediction mode; if the pdpMode corresponding to K-1 does not belong to the first angle mode set, that is, the candidate prediction mode determined again is invalid, the pdpMode corresponding to K+1 can be checked, that is, the PDP mode pdpMode (new candidate prediction mode) determined again based on the mode determination parameter K, referring to the formula: pdpMode=(K+1)×2+2 (14)
[0235] For example, in some embodiments, if the first determined candidate prediction mode does not belong to the first angle mode set, i.e., the first determined candidate prediction mode is invalid, then other nearby pdpModes can be further calculated, i.e., the candidate modes are re-determined. For example, when obtaining new candidate prediction modes according to the current block size parameters and mode determination parameters, if the current block size parameters indicate that the width or height of the current block is greater than 16 (i.e., 32x16, 16x32, 32x32), the pdpMode corresponding to K+1 can be checked first, i.e., the PDP mode pdpMode (new candidate prediction mode) determined based on the mode determination parameter K, referring to the formula: pdpMode=(K+1)×4+2 (15)
[0236] Accordingly, if the pdpMode corresponding to K+1 belongs to the first angle mode set, that is, the candidate prediction mode determined again is valid, then the mode expansion process can be terminated, and the pdpMode corresponding to K+1 is determined as the second prediction mode; if the pdpMode corresponding to K+1 does not belong to the first angle mode set, that is, the candidate prediction mode determined again is invalid, the pdpMode corresponding to K-1 can be checked again, that is, the PDP mode pdpMode (new candidate prediction mode) determined again based on the mode determination parameter K, referring to the formula: pdpMode=(K-1)×4+2 (16)
[0237] Accordingly, in the embodiments of this application, if the parameters are determined based on different modes, such as one or more of K, K-1, K+1, and none of the obtained candidate prediction modes pass the legality check or verification, then it is possible to choose not to replace the first prediction mode with the PDP mode.
[0238] Therefore, in the embodiments of this application, when determining the second prediction mode based on the first prediction mode, if the first prediction mode mode among multiple angle prediction modes (e.g., dimdMode and dimdBlendMode[N]) is not a valid PDP mode, the nearest PDP mode can be determined based on the current block size parameter and the first prediction mode. If the nearest PDP mode meets the validity requirements, the original mode mode can be replaced with the nearest PDP mode.
[0239] In the embodiments of this application, similarly, if the first prediction mode is not a valid PDP mode, then after determining a valid PDP mode, such as the second prediction mode, based on the current block size parameter and the first prediction mode, it is possible to set the valid identifier of the second prediction mode to a second value, that is, update the includedMode array to record the second prediction mode.
[0240] For example, in some embodiments, assuming the second value is 1 and the second prediction mode is mode m+1, since the second prediction mode is a valid PDP mode, then includedMode[m+1] can be set to 1.
[0241] It is understood that, in the embodiments of this application, after determining the candidate prediction mode based on the current block size parameters and the first prediction mode, during the process of checking and verifying the legality of the candidate prediction mode, it is also possible to simultaneously determine whether a candidate prediction mode has already been included based on a valid identifier. Specifically, to ensure that the angle prediction mode is not repeated, it is possible to select a candidate prediction mode that does not include the candidate prediction mode obtained by offset as the second prediction mode.
[0242] Furthermore, in the embodiments of this application, when determining the second prediction mode based on the candidate prediction mode, if the candidate prediction mode belongs to the first angle mode set and the valid identifier of the candidate prediction mode is a first value, the candidate prediction mode is determined as the second prediction mode.
[0243] In other words, in the embodiments of this application, if the candidate prediction mode obtained based on the size parameter and the first prediction mode passes the legality check and verification, and the valid identifier of the candidate prediction mode is the first value (i.e., the candidate prediction mode is not repeated), then the candidate prediction mode can be selected as the second prediction mode.
[0244] For example, in some embodiments, assuming that the candidate prediction mode of the first prediction mode determined according to the size parameter and the first prediction mode is pdpMode, then it is determined whether pdpMode is within the legal intra-frame angle range. At the same time, it is determined whether the candidate prediction mode has been included based on the valid identifier includedMode of the candidate prediction mode. If pdpMode passes the legality verification and the value of the valid identifier includedMode of the candidate prediction mode is the second value, that is, the candidate prediction mode has been included, then the candidate prediction mode pdpMode can be further re-determined based on the size parameter and the mode determination parameter. If the re-determined pdpMode passes the legality verification and the value of the corresponding valid identifier includedMode is the first value, then the re-determined pdpMode can be determined as the corresponding second prediction mode.
[0245] Step 1503: Determine the weight matrix of the PDP mode based on the second prediction mode, and determine the first prediction block corresponding to the current block based on the weight matrix of the PDP mode.
[0246] In the embodiments of this application, if the current block meets the PDP mode requirements, and the first prediction mode among multiple angle prediction modes is a mode that does not allow the use of weight matrices for intra-frame prediction, then after determining the second prediction mode that allows the use of weight matrices for intra-frame prediction based on the first prediction mode, the weight matrix of the PDP mode can be further determined based on the second prediction mode, and the first prediction block corresponding to the current block can be determined based on the weight matrix of the PDP mode.
[0247] It is understood that, in the embodiments of this application, during intra-frame prediction using PDP mode, a predefined weight matrix can be used to achieve intra-frame prediction. The weight matrix corresponding to the current block is predefined based on the shape and angle prediction modes of the current block. That is, different angle prediction modes for the current block correspond to different weight matrices used to achieve PDP mode prediction.
[0248] It is understood that in the embodiments of this application, if the first prediction mode is a mode that does not allow the use of weight matrices for intra-frame prediction, then after extending the first prediction mode to PDP mode and determining the corresponding second prediction mode that is effective in PDP mode, the weight matrix of the PDP mode corresponding to the second prediction mode can be used to perform intra-frame prediction in PDP mode.
[0249] In the embodiments of this application, the corresponding prediction block (i.e., the first prediction block) can be determined using the weight matrix of the PDP mode determined based on the second prediction mode, and then the first prediction block can be used as the intra-frame prediction result corresponding to the first prediction mode. That is, the first prediction block obtained based on the weight matrix of the PDP mode corresponding to the second prediction mode is used to replace the original traditional intra-frame angle prediction block of the first prediction mode.
[0250] Furthermore, in the embodiments of this application, for multiple angle prediction modes corresponding to the current block, the proposed PDP mode extension scheme can be implemented on some or all of the angle prediction modes. That is, the validity of the PDP mode can be determined for any number of angle prediction modes. If it is not a valid PDP mode, the corresponding valid prediction mode can be determined based on the offset value. Alternatively, the corresponding valid prediction mode can be determined based on the size parameter of the current block and the invalid prediction mode of the PDP mode (i.e., the mode that does not allow intra-frame prediction using the weight matrix). This realizes the PDP mode extension of the invalid prediction mode of the PDP mode.
[0251] Furthermore, in the embodiments of this application, the first prediction mode can be used for intra-frame prediction of the block to be reconstructed in the current image. That is, for the current block, the derived first prediction mode can be used for subsequent intra-frame prediction processing. For example, intra-frame prediction can be performed on the next block to be reconstructed based on the first prediction mode.
[0252] Furthermore, in the embodiments of this application, the second prediction mode is used for intra-frame prediction of the block to be reconstructed in the current image. That is, for the current block, for the first prediction mode that is not applicable to the PDP mode, after determining the corresponding second prediction mode through PDP mode extension, the second prediction mode obtained by extension can be used for subsequent intra-frame prediction processing. For example, intra-frame prediction can be performed on the next block to be reconstructed based on the second prediction mode.
[0253] In other words, in the embodiments of this application, the angle prediction mode that is not applicable to the PDP mode and the corresponding extended intra-frame prediction mode that is applicable to the PDP mode for the current block can be saved for reference in subsequent coding blocks.
[0254] In the embodiments of this application, the bitstream can be decoded to determine the first syntax element identification information. If the first syntax element identification information indicates that the current block uses DIMD for intra-frame prediction, the first prediction block can be determined by the second prediction mode.
[0255] It is understood that, in the embodiments of this application, the first syntax element identification information can be used to indicate whether the current block uses the DIMD method. If the current block uses the DIMD method, the PDP mode extension scheme proposed in this application can be selected to extend the angle prediction mode that is not applicable to the PDP mode in the angle prediction mode derived based on the DIMD mode to the PDP mode, and then use the extended effective PDP mode for intra-frame prediction processing, resulting in higher accuracy of the final predicted block.
[0256] For example, in some embodiments, if the value of the first syntax element identification information is a first value, it is determined that the first syntax element identification information indicates that the current block uses the DIMD method; if the value of the first syntax element identification information is a second value, it is determined that the first syntax element identification information indicates that the current block does not use the DIMD method.
[0257] Here, the first value is different from the second value, and both the first and second values can be in parameter form or in numeric form. Specifically, the first syntax element identification information can be a parameter written in the profile or a flag value; no specific limitation is made here. For example, the first value can be 1 and the second value can be 0; or, the first value can be 0 and the second value can be 1; or, the first value can be true and the second value can be false; or, the first value can be false and the second value can be true.
[0258] It is understood that, in the embodiments of this application, the first syntax element identification information can be represented as cu_dimd_flag.
[0259] In one specific embodiment, taking a first value of 1 and a second value of 0 as an example, if the value of cu_dimd_flag obtained by decoding is 1, then it can be determined that the first syntax element identification information indicates that the current block uses the DIMD method; if the value of cu_dimd_flag obtained by decoding is 0, then it can be determined that the first syntax element identification information indicates that the current block does not use the DIMD method.
[0260] Furthermore, in the embodiments of this application, if the current block is not intra-prediction using the DIMD method, then when using the DIMD method to derive the intra-prediction mode, the derivation process is the same as the DIMD derivation process of the DIMD coded block, but PDP extension is not performed on the derived mode.
[0261] In the embodiments of this application, the bitstream can be decoded to determine the second syntax element identification information. If the second syntax element identification information indicates that the current block uses OBIC for intra-frame prediction, the first prediction block can be determined through the second prediction mode.
[0262] It is understood that, in the embodiments of this application, the second syntax element identification information can be used to indicate whether the current block uses the OBIC method. If the current block uses the OBIC method, the PDP mode extension scheme proposed in this application can be selected to extend the angle prediction mode that is not applicable to the PDP mode in the angle prediction mode derived based on the OBIC mode to the PDP mode, and then use the extended effective PDP mode for intra-frame prediction processing, resulting in higher accuracy of the final predicted block.
[0263] For example, in some embodiments, if the value of the second syntax element identification information is a first value, it is determined that the second syntax element identification information indicates that the current block uses the OBIC method; if the value of the second syntax element identification information is a second value, it is determined that the second syntax element identification information indicates that the current block does not use the OBIC method.
[0264] Here, the first value and the second value are different, and both can be in parameter form or numeric form. Specifically, the second syntax element identification information can be a parameter written in the profile or a flag value; no specific limitation is made here. For example, the first value can be 1 and the second value can be 0; or, the first value can be 0 and the second value can be 1; or, the first value can be true and the second value can be false; or, the first value can be false and the second value can be true.
[0265] It is understood that, in the embodiments of this application, the second syntax element identification information can be represented as cu_obic_flag.
[0266] In one specific embodiment, taking a first value of 1 and a second value of 0 as an example, if the value of cu_obic_flag obtained by decoding is 1, then it can be determined that the second syntax element identification information indicates that the current block uses the OBIC method; if the value of cu_obic_flag obtained by decoding is 0, then it can be determined that the second syntax element identification information indicates that the current block does not use the OBIC method.
[0267] Furthermore, in the embodiments of this application, if the current block is not intra-prediction using the OBIC method, then when using the OBIC method to derive the intra-prediction mode, the derivation process is the same as the OBIC derivation process of the OBIC coded block, but PDP extension is not performed on the derived mode.
[0268] Step 1504: Determine the prediction block corresponding to the current block based on the weights of the first prediction block and the first prediction mode.
[0269] In the embodiments of this application, after determining the weight matrix of the PDP mode based on the second prediction mode and determining the first prediction block corresponding to the current block based on the weight matrix of the PDP mode, the prediction block corresponding to the current block can be further determined based on the weights of the first prediction block and the first prediction mode.
[0270] It is understood that, in the embodiments of this application, after completing the PDP mode extension of any number of angle prediction modes corresponding to the current block and replacing the original traditional intra-frame angle prediction blocks with the prediction blocks of the corresponding PDP modes, the prediction blocks of the current block can be further determined based on the prediction blocks corresponding to the multiple angle prediction modes corresponding to the current block and the corresponding weights.
[0271] Furthermore, in the embodiments of this application, when determining the prediction block corresponding to the current block based on the weights of the first prediction block and the first prediction mode, multiple prediction blocks corresponding to multiple angle prediction modes can be determined, and then the prediction block corresponding to the current block can be determined based on the multiple prediction blocks and the multiple weights of the multiple angle prediction modes. The multiple prediction blocks corresponding to the multiple angle prediction modes may include the first prediction block corresponding to the first prediction mode; the multiple weights corresponding to the multiple angle prediction modes may include the weights of the first prediction mode.
[0272] It is understood that, in the embodiments of this application, predicted blocks derived from multiple angle prediction modes corresponding to the current block and their corresponding weights can be weighted and fused to finally obtain the predicted block of the current block. Specifically, for angle prediction modes that use other effective prediction modes for PDP mode extension, such as a first prediction mode that uses a second prediction mode for PDP mode extension, although the weight matrix of the PDP mode corresponding to the second prediction mode is used to determine the first predicted block, the weights used by the first predicted block in the final weighted fusion process are still the weights corresponding to the first prediction mode. That is, the predicted value may change, but the weights will not change.
[0273] For example, in some embodiments, it is assumed that the current block corresponds to 5 angle prediction modes, namely angle prediction mode 1, angle prediction mode 2, angle prediction mode 3, angle prediction mode 4, and angle prediction mode 5, and the corresponding original intra-frame angle prediction values are pred_1, pred_2, pred_3, pred_4, and pred_5, respectively, and the corresponding weights are weight_1, weight_2, weight_3, weight_4, and weight_5, respectively. Among them, angle prediction mode 3 and angle prediction mode 5 are not valid PDP modes. It is possible to select only to perform PDP mode extension on angle prediction mode 3, and determine the prediction value of the corresponding PDP mode as pred_3'. Finally, the prediction value Pred_final of the current block is obtained by weighted fusion of the prediction values and weights corresponding to the 5 angle prediction modes: Pred_final=pred_1×weight_1+pred_2×weight_2+pred_3'×weight_3+pred_4×weight_4+pred_5×weight_5 (17)
[0274] For example, in some embodiments, it is assumed that the current block corresponds to three angle prediction modes, namely angle prediction mode 1, angle prediction mode 2, and angle prediction mode 3, and the corresponding original intra-frame angle prediction values are pred_1, pred_2, and pred_3, respectively, and the corresponding weights are weight_1, weight_2, and weight_3, respectively. Among them, angle prediction mode 1 and angle prediction mode 3 are not valid PDP modes. It is possible to simultaneously perform PDP mode extension on angle prediction mode 1 and angle prediction mode 3 to determine the prediction values of the corresponding PDP modes as pred_1' and pred_3', respectively. Finally, the prediction value Pred_final of the current block is obtained by weighted fusion of the prediction values and weights corresponding to the three angle prediction modes: Pred_final = pred_1' × weight_1 + pred_2 × weight_2 + pred_3' × weight_3 (18)
[0275] Therefore, it can be seen that after the PDP mode extension scheme proposed in this application extends one or more angle prediction modes that are not applicable to PDP mode, the corresponding prediction values will be adjusted, but the corresponding weights will not change.
[0276] It is understandable that, in another implementation, in order to obtain more accurate prediction results, after extending the PDP mode, one can choose to adjust the corresponding predicted values while also making adaptive adjustments to some or all of the corresponding weights. This application does not impose specific limitations.
[0277] For example, in some embodiments, in order to obtain more accurate prediction results, after PDP mode expansion, it is possible to adaptively adjust some or all of the corresponding weights based on the first prediction mode and / or the second prediction mode, as well as the amplitude corresponding to the first prediction mode and / or the amplitude corresponding to the second prediction mode.
[0278] Furthermore, in the embodiments of this application, this application proposes a PDP mode extension method, including but not limited to a PDP mode extension method based on the angle prediction mode obtained from the DIMD mode. This method can replace the angle prediction mode derived from the gradient histogram of the DIMD mode with an effective intra-frame prediction mode of the adjacent PDP mode, thereby improving the accuracy of prediction.
[0279] Furthermore, this application proposes a PDP mode extension method, including a scheme to adjust an intra-frame angle prediction mode that is not applicable to PDP mode to an intra-frame prediction mode applicable to PDP mode, including checking and extending the neighboring modes mode±1 of the current mode mode, and checking and extending the neighboring PDP modes (i.e., the PDP modes corresponding to K, K-1, and K+1).
[0280] For example, in some embodiments, the PDP mode extension method proposed in this application was tested on test software, and the test results are shown in Table 1.
[0281] Table 1
[0282] Furthermore, in the embodiments of this application, the DIMD mode can be used to derive multiple angle prediction modes corresponding to the current block, or other methods can be used to derive multiple angle prediction modes corresponding to the current block. For example, the OBIC mode derives the intra-frame prediction mode of the current block based on the occurrence of intra-frame modes in the spatial neighborhood of the block. For the OBIC mode list obicmode[n] obtained by histogram statistics based on the occurrence frequency, one or any number of modes or copied extended modes can still be checked and extended according to the PDP mode extension method proposed in this application.
[0283] This application provides a decoding method in which a decoder determines multiple angle prediction modes corresponding to the current block. If the current block meets the PDP mode requirements, and the first prediction mode among the multiple angle prediction modes is a mode that does not allow intra-frame prediction using a weight matrix, a second prediction mode is determined based on the first prediction mode. The second prediction mode is a mode that allows intra-frame prediction using a weight matrix. A weight matrix for the PDP mode is determined based on the second prediction mode, and a first prediction block corresponding to the current block is determined based on the weight matrix of the PDP mode. Finally, the prediction block corresponding to the current block is determined based on the weights of the first prediction block and the first prediction mode. In other words, in the embodiments of this application, for any angle prediction mode in the current block that is not applicable to the PDP mode, it can be extended to a PDP mode to determine the corresponding effective intra-frame prediction mode, and intra-frame prediction is performed using the extended effective intra-frame prediction mode. Therefore, in this application, for angle prediction modes that are not effective under the PDP mode, intra-frame prediction under the PDP mode can be achieved through PDP mode extension, resulting in more accurate prediction results and thus improving encoding and decoding performance.
[0284] In one embodiment of this application, FIG16 is a flowchart illustrating an encoding method provided in this application embodiment. As shown in FIG16, the encoding method of the encoder may include:
[0285] Step 1601: Determine the multiple angle prediction modes corresponding to the current block.
[0286] It should be noted that, in the embodiments of this application, the encoding method is applied to the encoder. Specifically, based on the composition structure of the encoder 100, the encoding method of the embodiments of this application can be applied to the intra-frame prediction part, mainly including a DIMD matrix prediction mode extension method, which can improve the accuracy of intra-frame prediction.
[0287] In the embodiments of this application, multiple angle prediction modes corresponding to the current block can be determined first. The number of angle prediction modes corresponding to the current block can be more than one; this application does not specifically limit the number of angle prediction modes for the current block.
[0288] Furthermore, in the embodiments of this application, one or more methods can be selected to determine the multiple angle prediction modes corresponding to the current block. For example, the DIMD mode can be used to derive the multiple angle prediction modes corresponding to the current block, or the OBIC mode can be used to derive the multiple angle prediction modes corresponding to the current block. Of course, other modes can also be used to derive the multiple angle prediction modes corresponding to the current block, and this application does not make specific limitations.
[0289] For example, in some embodiments, when using DIMD mode to derive multiple angle prediction modes corresponding to the current block, an amplitude histogram (HoG) can be established first, and then one or more intra-frame prediction modes and their corresponding amplitude values can be recorded based on the amplitude histogram. Finally, one or more intra-frame prediction modes with the largest cumulative amplitude value are selected as the prediction modes derived by DIMD. The prediction modes derived by DIMD may include angle prediction modes.
[0290] For example, in some embodiments, the intra-prediction mode of the current block can be derived directly using adjacent or non-adjacent regions, or the reference region corresponding to the current block can be determined first based on the position information and size information of the current block; and then the intra-prediction mode corresponding to the current block can be determined based on the reference region.
[0291] It is understood that, in the embodiments of this application, the size of the reference region may be related to the size message and / or position information of the current block. For example, based on the position and size of the current block (x, y, cbWidth, cbHeight) and the block vector (bvHor, bvVer), the position and size of the reference region (x+bvHor-offsetX, y+bvVer-offsetY, cbWidth+dW, cbHeight+dH) can be obtained, where offsetX, offsetY, dW, and dH can take any integer values.
[0292] Furthermore, in the embodiments of this application, when determining the intra-prediction mode corresponding to the current block based on the reference region, the sampling window can be determined first; then, based on the sampling window and the sample position in the reference region, the angle direction corresponding to the sample position and the gradient magnitude value corresponding to the angle direction can be determined; finally, the intra-prediction mode corresponding to the current block can be determined based on the angle direction and the gradient magnitude value.
[0293] In the embodiments of this application, the size of the sampling window can be set to any size, and this application does not impose any specific limitation. For example, a 3x3 sampling window can be set.
[0294] For example, in some embodiments, assuming the sampling window is a 3x3 window, when determining the angle direction and gradient magnitude value corresponding to the sample position based on the sample position in the sampling window and the reference region, for any sampling window in the reference region, the corresponding sample position is (x, y), and the gradient values Gx and Gy in the horizontal and vertical directions can be calculated. Gx and Gy are obtained by convolving the 3x3 horizontal gradient operator M_x and the vertical gradient operator M_y with the sample values within the window position, respectively. Examples of the technical methods for the horizontal gradient operator M_x and the vertical gradient operator M_y are shown in formulas (4) and (5).
[0295] Based on Gx and Gy at each sample location, the corresponding angular direction O at each sample location is calculated according to the following formulas, and the magnitude value G of the gradient of the corresponding angle at each location is calculated, for example, formulas (6) and (7).
[0296] In some embodiments, the calculation process for atan can be simplified by using a lookup table or some variations.
[0297] Finally, the magnitude value G of the gradient at each reference position is accumulated on its derived conventional intra-prediction mode to obtain a HoG. Finally, one or more conventional intra-prediction modes with the largest accumulated magnitude value are selected as the intra-prediction mode corresponding to the current block.
[0298] For example, in some embodiments, multiple angle prediction modes can be obtained through DIMD gradient histogram statistics, including dimdMode and dimdBlendMode[N]. Here, dimdMode can refer to the angle prediction mode with the largest amplitude value, and dimdBlendMode[N] can refer to N angle prediction modes with large amplitude values other than dimdMode. N is an integer equal to or equal to 0.
[0299] Furthermore, in the embodiments of this application, when determining the multiple angle prediction modes corresponding to the current block, multiple weights corresponding to the multiple angle prediction modes can also be determined. Different angle prediction modes can correspond to different weights.
[0300] For example, in some embodiments, when using the DIMD mode to derive multiple angle prediction modes corresponding to the current block, the derived intra-prediction mode and its corresponding weight can be related to the magnitude of the mode in HoG.
[0301] In other words, in the embodiments of this application, multiple angle prediction modes corresponding to the current block can be determined by the amplitude in HoG, and multiple weights corresponding to multiple angle prediction modes can also be determined by the amplitude in HoG.
[0302] Step 1602: If the current block meets the PDP mode requirements and the first prediction mode among the multiple angle prediction modes is a mode that does not allow the use of weight matrices for intra-frame prediction, determine the second prediction mode based on the first prediction mode; wherein the second prediction mode is a mode that allows the use of weight matrices for intra-frame prediction.
[0303] In the embodiments of this application, after determining the multiple angle prediction modes corresponding to the current block, if the current block meets the PDP mode requirements and the first prediction mode among the multiple angle prediction modes is a mode that does not allow the use of weight matrices for intra-frame prediction, then a second prediction mode can be further determined based on the first prediction mode.
[0304] It is understood that, in the embodiments of this application, the first prediction mode can be any one of the multiple angle prediction modes corresponding to the current block. The prohibition of using a weight matrix for intra-frame prediction can be understood as not being a valid PDP mode, i.e., the first prediction mode is not a valid PDP mode.
[0305] For example, in some embodiments, assuming that multiple angle prediction modes include dimdMode and dimdBlendMode[N], then the first prediction mode can be dimdMode or dimdBlendMode[i], i = 0..N-2, and this application does not make specific limitations.
[0306] It is understood that, in the embodiments of this application, the second prediction mode can be any one of at least one prediction mode that allows intra-frame prediction using a weight matrix corresponding to the current block. Here, allowing intra-frame prediction using a weight matrix can be understood as a valid PDP mode, i.e., the second prediction mode is a valid PDP mode.
[0307] Furthermore, in the embodiments of this application, a validity check can be performed on the current block first to determine whether the current block meets the PDP mode requirements. The validity check is used to verify whether the current block can be used for PDP prediction; the PDP mode requirements may include, but are not limited to, requirements for the size parameters of the current block and requirements for the reference area corresponding to the current block.
[0308] It is understood that, in the embodiments of this application, when performing a validity check on the current block, it is necessary to check whether the size parameters of the current block meet the PDP mode requirements, that is, to perform a sizeAvailable check on the current block size; at the same time, it is also necessary to check whether the reference area of the current block meets the PDP mode requirements, that is, to perform a reference area availability check.
[0309] Furthermore, in the embodiments of this application, considering that the PDP mode will be applied to blocks with a width and height of no more than 32 (except for 4x32, 32x4, 8x32 and 32x8), when performing the sizeAvailable check of the current block size, the size parameters of the current block, namely the width w and height h of the current block, can be selected to perform the sizeAvailable check.
[0310] Furthermore, in the embodiments of this application, considering that sufficient available reference areas are needed for matrix weighted prediction, when performing the reference area availability check (refAvailable), the current block boundary can be analyzed to determine whether the reconstructed samples of the reference area of the current block are available, and the number of available samples can be counted.
[0311] In the embodiments of this application, the order in which the size validity check (sizeAvailable) and the reference area availability check (refAvailable) of the current block are performed is not specifically limited. For example, the size validity check (sizeAvailable) of the current block can be performed first. If it is determined that the size parameters of the current block meet the PDP mode requirements, then the reference area availability check (refAvailable) of the current block can be further performed.
[0312] Furthermore, in the embodiments of this application, if the size parameters of the current block and the reference area both meet the PDP mode requirements, it can be determined that the current block meets the PDP mode requirements.
[0313] In embodiments of this application, the validity of the PDP mode of the first prediction mode among multiple angle prediction modes of the current block can also be checked to determine whether the first prediction mode is a mode that allows intra-frame prediction using a weight matrix.
[0314] In other words, in the embodiments of this application, the PDP mode validity check can be used to determine whether any angle prediction mode is applicable to the PDP mode, that is, to determine whether any angle prediction mode is a mode that allows intra-frame prediction using a weight matrix.
[0315] Furthermore, in the embodiments of this application, the mode that allows intra-frame prediction using the weight matrix is determined based on the size parameter of the current block, that is, it can be determined whether any angle prediction mode corresponding to the current block is applicable to the PDP mode based on the size parameter of the current block.
[0316] For example, in some embodiments, for image patches whose width and height are both no greater than 16, the PDP mode only replaces specific intra-frame angle prediction modes. Besides the special 0 and 1 modes, the effective set of angle modes for the PDP mode is (2+2k), k = 0..32.
[0317] For example, in some embodiments, for other image block sizes (such as 32x16, 16x32, 32x32), the effective set of angle patterns for PDP mode is (2+4k), k = 0..16.
[0318] In other words, in the embodiments of this application, it can be further determined whether the first prediction mode is a mode that allows intra-frame prediction using a weight matrix based on the size parameters of the current block. Specifically, if the width and height of the current block are both no greater than 16, then it can be determined whether the first prediction mode is any one of mode 0, mode 1, or mode 2+2k (k = 0..32), that is, whether the first prediction mode belongs to a mode set including mode 0, mode 1, and mode 2+2k. If so, then the first prediction mode can be determined to be a mode that allows intra-frame prediction using a weight matrix; otherwise, the first prediction mode is determined to be a mode that does not allow intra-frame prediction using a weight matrix.
[0319] Accordingly, in some embodiments, for image blocks of other sizes (such as 32x16, 16x32, 32x32), it can be determined whether the first prediction mode is (2+4k), k = any one of 0..16, that is, whether the first prediction mode belongs to the mode set including the 2+4k mode. If so, it can be determined that the first prediction mode is a mode that allows intra-frame prediction using the weight matrix; otherwise, it can be determined that the first prediction mode is a mode that does not allow intra-frame prediction using the weight matrix.
[0320] In related technologies, PDP mode is used for intra-frame prediction only for modes that allow the use of weight matrices. Considering that PDP mode can replace angle prediction mode to obtain better prediction results, in the embodiments of this application, for angle prediction modes that do not allow the use of PDP mode, such as the first prediction mode, the range of PDP mode replacement angle prediction modes can be further expanded to determine the corresponding second prediction mode suitable for PDP mode to use PDP mode for intra-frame prediction, thereby improving the accuracy of intra-frame prediction.
[0321] In an embodiment of this application, when determining the second prediction mode based on the first prediction mode, one implementation method is: first, determine the candidate prediction mode based on the first prediction mode and the offset value; then, determine the second prediction mode based on the candidate prediction mode.
[0322] It is understood that, in the embodiments of this application, the offset value can be understood as the offset amount corresponding to the offset of the first prediction mode. The offset value may include the offset step size and the offset direction.
[0323] In other words, in the embodiments of this application, if the first prediction mode is a mode that does not allow the use of weight matrices for intra-frame prediction, then the first prediction mode can be offset by an offset value to obtain a corresponding second prediction mode that allows the use of weight matrices for intra-frame prediction.
[0324] Furthermore, in embodiments of this application, the offset value may include a first offset value and / or a second offset value. The first offset value is the offset value corresponding to the first prediction mode belonging to a first prediction mode set; the second offset value is the offset value corresponding to the first prediction mode belonging to a second prediction mode set.
[0325] For example, in some embodiments, it is assumed that the offset value includes a first offset value and a second offset value, wherein the first offset value is +1 and the second offset value is -1, the first prediction mode set includes angle prediction mode 18 to angle prediction mode 33 and angle prediction mode 50 to angle prediction mode 66, that is, the first prediction mode set refers to the interval of mode index in [18,33] and mode index in [50,66], and the second prediction mode set includes angle prediction mode 2 to angle prediction mode 17 and angle prediction mode 34 to angle prediction mode 49, that is, the first prediction mode set refers to the interval of mode index in [2,17] and mode index in [34,49]. If the first prediction mode is angle prediction mode 48, then the first prediction mode belongs to the set of second prediction modes. At this time, the offset value can be determined as the second offset value -1, where the offset direction of the second offset value is -, that is, the offset direction is towards a smaller angle mode (counterclockwise offset), and the offset step size is 1. If the first prediction mode is angle prediction mode 22, then the first prediction mode belongs to the set of first prediction modes. At this time, the offset value can be determined as the first offset value +1, where the offset direction of the first offset value is +, that is, the offset direction is towards a larger angle mode (clockwise offset), and the offset step size is 1.
[0326] In other words, in the embodiments of this application, the corresponding offset value can be determined based on the set of prediction modes to which the first prediction mode belongs, specifically by determining the corresponding offset direction and offset step size.
[0327] For example, in some embodiments, it is assumed that the offset value includes a first offset value, wherein the first offset value is +1, and the first prediction mode set includes angle prediction mode 2 to angle prediction mode 66, that is, the first prediction mode set refers to the interval of mode index [2, 66]. In this case, the first prediction mode belongs to the first prediction mode set, so the offset value can be determined to be the first offset value +1, wherein the offset direction of the first offset value is +, that is, the offset direction is towards the larger angle mode (clockwise offset), and the offset step size is 1.
[0328] In other words, in the embodiments of this application, the same offset value, namely the first offset value, can be used for any prediction mode to offset the angle prediction mode.
[0329] For example, in some embodiments, it is assumed that the offset value includes a second offset value, wherein the second offset value is -1, and the second prediction mode set includes angle prediction mode 2 to angle prediction mode 66, that is, the second prediction mode set refers to the interval of mode index [2, 66]. In this case, the second prediction mode belongs to the second prediction mode set, so the offset value can be determined to be the second offset value -1, wherein the offset direction of the second offset value is -, that is, the offset direction is towards the smaller angle mode (counterclockwise offset), and the offset step size is 1.
[0330] In other words, in the embodiments of this application, the same offset value, namely the second offset value, can be used for the offset of the angle prediction mode for any prediction mode.
[0331] In the embodiments of this application, the offset step size of the first offset value and the second offset value may be the same or different, and this application does not impose specific limitations.
[0332] Furthermore, in the embodiments of this application, the offset value can be determined by the angle offset index corresponding to the first prediction mode. Specifically, the angle offset index corresponding to the first prediction mode can be determined first, and then the corresponding offset value can be determined based on the angle offset index.
[0333] For example, in some embodiments, when determining the angle offset index intervalIndex corresponding to the first prediction mode, formula (8) can be referred to.
[0334] Here, mode is the mode index of the first prediction mode. That is, the corresponding angle offset index can be determined by performing calculations using the mode index of the first prediction mode.
[0335] For example, if the first prediction mode is mode 35, i.e., mode = 35, the corresponding angle offset index intervalIndex = (35-2) / 16 = 2 can be determined based on the mode index of the first prediction mode, i.e., the angle offset index is determined to be an even number.
[0336] Furthermore, in the embodiments of this application, when determining the offset value corresponding to the first prediction mode based on the angle offset index, if the angle offset index intervalIndex is odd, then the offset value can be determined to be the first offset value + 1, wherein the offset direction of the first offset value is +, that is, the offset direction is offset towards the larger angle mode (clockwise offset), and the offset step size is 1.
[0337] Furthermore, in the embodiments of this application, when determining the offset value corresponding to the first prediction mode based on the angle offset index, if the angle offset index intervalIndex is even, then the offset value can be determined to be the second offset value -1, wherein the offset direction of the second offset value is -, that is, the offset direction is offset towards a smaller angle mode (counterclockwise offset), and the offset step size is 1.
[0338] In other words, in the embodiments of this application, when the angle offset index is odd, the offset value is a first offset value, used to indicate the first offset direction and the first offset step; when the angle offset index is even, the offset value is a second offset value, used to indicate the second offset direction and the second offset step.
[0339] It is understood that in the embodiments of this application, after offsetting the first prediction mode by the offset value, a corresponding intra-frame prediction mode can be obtained, i.e., a candidate prediction mode can be obtained. Then, the legality of the candidate prediction mode and the validity of the PDP mode can be further checked and verified to finally obtain the corresponding second prediction mode. The candidate prediction mode obtained after offsetting the first prediction mode may or may not be a valid PDP mode. Therefore, in addition to verifying the legality of the candidate prediction mode, it is also necessary to verify the validity of the candidate prediction mode's PDP mode.
[0340] Furthermore, in the embodiments of this application, when determining the second prediction mode based on the candidate prediction mode, if the candidate prediction mode belongs to the first angle mode set and the candidate prediction mode is a mode that allows intra-frame prediction using a weight matrix, the candidate prediction mode can be selected as the second prediction mode.
[0341] It is understood that, in the embodiments of this application, for any prediction mode corresponding to the current block, the legality of the prediction mode can be checked by using a first angle mode set. The first angle mode set can be predefined and can be used to determine whether the prediction mode is within a legal intra-frame angle range.
[0342] For example, in some embodiments, if the legal intra-frame angle range is greater than or equal to 3 and less than or equal to NUM_LUMA_MODE-2, that is, it does not include DC mode and planar mode, then the first angle mode set can be predefined to include angle prediction mode 3 to angle prediction mode 65, that is, the first angle mode set refers to the interval of mode index in [3, 65].
[0343] For example, in some embodiments, the first prediction mode can be legally checked by the first angle mode set. If the first prediction mode belongs to the first angle mode set, then the first prediction mode can be determined to be legal, and then it can be further determined whether the first prediction mode is a valid PDP mode.
[0344] For example, in some embodiments, the legality of candidate prediction modes corresponding to the first prediction mode can be checked by the first angle mode set. If the candidate prediction mode belongs to the first angle mode set, then the candidate prediction mode can be determined to be legal.
[0345] It is understood that, in the embodiments of this application, for any prediction mode corresponding to the current block, the validity of the PDP mode can be checked by using the set of valid angle modes of the PDP mode. The set of valid angle modes of the PDP mode is determined based on the size parameters of the current block.
[0346] For example, in some embodiments, it can be further determined whether the candidate prediction mode is a mode that allows intra-frame prediction using a weight matrix based on the size parameters of the current block. Specifically, if the width and height of the current block are both no greater than 16, then it can be determined whether the candidate prediction mode is any one of mode 0, mode 1, or mode 2+2k (k = 0..32), that is, whether the candidate prediction mode belongs to a mode set including mode 0, mode 1, and mode 2+2k. If so, then the candidate prediction mode can be determined to be a mode that allows intra-frame prediction using a weight matrix; otherwise, the candidate prediction mode is determined to be a mode that does not allow intra-frame prediction using a weight matrix.
[0347] For example, in some embodiments, for image blocks of other sizes (such as 32x16, 16x32, 32x32), it can be determined whether the candidate prediction mode is (2+4k), k = any one of 0..16, that is, whether the candidate prediction mode belongs to the mode set including the 2+4k mode. If so, it can be determined that the candidate prediction mode is a mode that allows intra-frame prediction using the weight matrix; otherwise, it can be determined that the candidate prediction mode is a mode that does not allow intra-frame prediction using the weight matrix.
[0348] Furthermore, in the embodiments of this application, when determining the second prediction mode based on the candidate prediction mode, if the candidate prediction mode determined based on the first offset value does not belong to the first angle mode set or is a mode that does not allow the use of the weight matrix for intra-frame prediction, it is possible to continue to determine the second prediction mode according to the second offset value; if the candidate prediction mode determined based on the second offset value does not belong to the first angle mode set or is a mode that does not allow the use of the weight matrix for intra-frame prediction, it is possible to continue to determine the second prediction mode according to the first offset value.
[0349] In other words, in the embodiments of this application, if the candidate prediction mode after mode offset does not belong to the first angle mode set, or if the candidate prediction mode is a mode that does not allow intra-frame prediction using a weight matrix, then mode offset can be performed according to different offset values to obtain a new candidate prediction mode. The legality of the new candidate prediction mode and the validity of the PDP mode are checked and verified according to the above method, and finally the corresponding second prediction mode is obtained.
[0350] It is understood that in the embodiments of this application, if the candidate prediction mode obtained based on the first offset value fails the legality or PDP mode validity check and verification, then the second offset value can be used to perform mode shifting to obtain a new candidate prediction mode; correspondingly, if the candidate prediction mode obtained based on the second offset value fails the legality or PDP mode validity check and verification, then the first offset value can be used to perform mode shifting to obtain a new candidate prediction mode.
[0351] Accordingly, in the embodiments of this application, if the candidate prediction modes obtained based on different offset values, such as the first offset value and the second offset value, do not pass the legality or validity check or verification of the PDP mode, then it is possible to choose not to replace the first prediction mode with the PDP mode.
[0352] For example, in some embodiments, it is assumed that the offset value may include a first offset value and a second offset value, wherein the first offset value is +1 and the second offset value is -1. If the first prediction mode belongs to the first prediction mode set ([18,33] and [50,66]), then the first offset value +1 can be used for mode offset. For the first prediction mode mode, the corresponding candidate prediction mode is determined as nextMode = mode +1, that is, the next prediction mode of the first prediction mode is taken as the candidate prediction mode. Then, it can be further determined whether nextMode is within the legal intra-frame angle range, and further checked whether nextMode is a valid PDP mode. If nextMode passes the checks of legality and PDP mode validity, then nextMode can be determined as the corresponding second prediction mode. If nextMode fails the validity or PDP mode validity check, then the second offset value -1 can be used for mode offset. For the first prediction mode mode, the new candidate prediction mode is determined as prevMode = mode - 1, that is, the previous prediction mode of the first prediction mode is taken as the candidate prediction mode. Then, it can be further determined whether prevMode is within the legal intra-frame angle range, and whether prevMode is a valid PDP mode can be further checked. If prevMode passes the validity and PDP mode validity checks, then prevMode can be determined as the corresponding second prediction mode.
[0353] For example, in some embodiments, it is assumed that the offset value may include a first offset value and a second offset value, wherein the first offset value is +1 and the second offset value is -1. If the first prediction mode belongs to the set of second prediction modes ([2,17] and [34,49]), then the second offset value -1 can be used for mode offset first. For the first prediction mode mode, the corresponding candidate prediction mode is determined to be prevMode = mode-1, that is, the previous prediction mode of the first prediction mode is taken as the candidate prediction mode. Then, it can be further determined whether prevMode is within the legal intra-frame angle range, and further checked whether prevMode is a valid PDP mode. If prevMode passes the checks of legality and PDP mode validity, then prevMode can be determined as the corresponding second prediction mode. If prevMode fails the validity or PDP mode validity check, then the first offset value + 1 can be used for mode offset. For the first prediction mode mode, the determined new candidate prediction mode is nextMode = mode + 1, that is, the next prediction mode of the first prediction mode is taken as the candidate prediction mode. Then, it can be further determined whether nextMode is within the legal intra-frame angle range, and whether nextMode is a valid PDP mode can be further checked. If nextMode passes the validity and PDP mode validity check, then nextMode can be determined as the corresponding second prediction mode.
[0354] For example, in some embodiments, it is assumed that the offset value may include a first offset value and a second offset value, wherein the first offset value is +1 and the second offset value is -1. If the angle offset index intervalIndex corresponding to the first prediction mode is odd, then the first offset value +1 can be used for mode offset. For the first prediction mode mode, the corresponding candidate prediction mode is determined to be nextMode = mode + 1, that is, the next prediction mode of the first prediction mode is taken as the candidate prediction mode. Then, it can be further determined whether nextMode is within the legal intra-frame angle range, and further checked whether nextMode is a valid PDP mode. If nextMode passes the checks of legality and PDP mode validity, then nextMode can be determined as the corresponding second prediction mode. If nextMode fails the validity or PDP mode validity check, then the second offset value -1 can be used for mode offset. For the first prediction mode mode, the new candidate prediction mode is determined as prevMode = mode - 1, that is, the previous prediction mode of the first prediction mode is taken as the candidate prediction mode. Then, it can be further determined whether prevMode is within the legal intra-frame angle range, and whether prevMode is a valid PDP mode can be further checked. If prevMode passes the validity and PDP mode validity checks, then prevMode can be determined as the corresponding second prediction mode.
[0355] For example, in some embodiments, it is assumed that the offset value may include a first offset value and a second offset value, wherein the first offset value is +1 and the second offset value is -1. If the angle offset index intervalIndex corresponding to the first prediction mode is even, then the second offset value -1 can be used for mode offset first. For the first prediction mode mode, the corresponding candidate prediction mode is determined to be prevMode = mode - 1, that is, the previous prediction mode of the first prediction mode is taken as the candidate prediction mode. Then, it can be further determined whether prevMode is within the legal intra-frame angle range, and further checked whether prevMode is a valid PDP mode. If prevMode passes the checks of legality and PDP mode validity, then prevMode can be determined as the corresponding second prediction mode. If prevMode fails the validity or PDP mode validity check, then the first offset value + 1 can be used for mode offset. For the first prediction mode mode, the determined new candidate prediction mode is nextMode = mode + 1, that is, the next prediction mode of the first prediction mode is taken as the candidate prediction mode. Then, it can be further determined whether nextMode is within the legal intra-frame angle range, and whether nextMode is a valid PDP mode can be further checked. If nextMode passes the validity and PDP mode validity check, then nextMode can be determined as the corresponding second prediction mode.
[0356] Therefore, in the embodiments of this application, when determining the second prediction mode based on the first prediction mode, for the first prediction mode mode among multiple angle prediction modes (e.g., dimdMode and dimdBlendMode[N]), when the offset step size is 1, it is possible to check whether its adjacent angle mode (mode±1) is a valid PDP mode. If so, the original mode mode is replaced with the adjacent PDP mode.
[0357] Furthermore, in the embodiments of this application, in determining the second prediction mode based on the first prediction mode, in order to ensure that the derived angle prediction mode is not repeated, the includedMode array can be used to record the angle prediction mode corresponding to the current block, thereby tracking all included angle prediction modes in the PDP expansion process.
[0358] It is understood that, in the embodiments of this application, the valid identifier of the intra-prediction mode in the second angle mode set can be initialized to a first value. The first value can be any numerical value, such as 0, and this application does not impose any specific limitation.
[0359] In embodiments of this application, the second angle mode set may include intra-frame prediction mode n, n = 0..NUM_LUMA_MODE-1, that is, the intra-frame prediction modes in the second angle mode set include modes 0-66.
[0360] For example, in some embodiments, assuming the first value is 0, the includedMode array can be initialized first, and the valid identifier includedMode[i] of the intra-prediction mode in the second angle mode set can be set to 0, i = 0..NUM_LUMA_MODE-1. That is, for the intra-prediction modes that can be derived, such as the intra-prediction modes of modes 0-66, the valid identifier includedMode corresponding to each prediction mode can be initialized to 0 first.
[0361] Furthermore, in embodiments of this application, when the first prediction mode is a mode that allows intra-frame prediction using a weight matrix, the valid identifier of the first prediction mode can be set to a second value, i.e., the includedMode array is updated to record the first prediction mode. The first value is different from the second value; that is, the second value can be any value other than the first value, such as 1. This application does not impose specific limitations.
[0362] For example, in some embodiments, assuming the second value is 1, the first prediction mode is mode m, m = 2..NUM_LUMA_MODE-1, and if the first prediction mode is a valid PDP mode, then includedMode[m] = 1 can be set.
[0363] Furthermore, in the embodiments of this application, if the first prediction mode is not a valid PDP mode, then after determining a valid PDP mode, such as the second prediction mode, based on the offset value, it is possible to set the valid identifier of the second prediction mode to a second value, that is, update the includedMode array to record the second prediction mode.
[0364] For example, in some embodiments, assuming the second value is 1 and the second prediction mode is mode m+1, since the second prediction mode is a valid PDP mode, then includedMode[m+1] can be set to 1.
[0365] It is understood that, in the embodiments of this application, the valid identifier can be used to determine whether one or more intra-prediction modes are included in the PDP extension process. For example, a first value indicates that the prediction mode is not included, while a second value indicates that the prediction mode is included.
[0366] Accordingly, in the embodiments of this application, after offsetting the first prediction mode by offsetting the first prediction mode to obtain the candidate prediction mode, during the process of checking and verifying the legality of the candidate prediction mode and the validity of the PDP mode, it is also possible to simultaneously determine whether the candidate prediction mode has been included based on the valid identifier. In order to ensure that the angle prediction mode is not repeated, it is possible to select the candidate prediction mode as the second prediction mode if the candidate prediction mode obtained by offset is not included.
[0367] Furthermore, in the embodiments of this application, when determining the second prediction mode based on the candidate prediction mode, if the candidate prediction mode belongs to the first angle mode set, and the valid identifier of the candidate prediction mode is the first value, and the candidate prediction mode is a mode that allows intra-frame prediction using a weight matrix, the candidate prediction mode is determined as the second prediction mode.
[0368] In other words, in the embodiments of this application, if the candidate prediction mode obtained based on the offset value passes the checks and verifications of legality and PDP mode validity, and the valid identifier of the candidate prediction mode is the first value (i.e., the candidate prediction mode is not repeated), then the candidate prediction mode can be selected as the second prediction mode.
[0369] For example, in some embodiments, assuming that a first offset value + 1 is used for mode offset, for a first prediction mode mode, the corresponding candidate prediction mode is determined to be nextMode = mode + 1. Then, it is determined whether nextMode is within the legal intra-frame angle range and whether nextMode is a valid PDP mode. At the same time, based on the valid identifier includedMode of the candidate prediction mode, it is determined whether the candidate prediction mode has been included. If nextMode passes the legality and PDP mode validity checks, and the valid identifier includedMode of the candidate prediction mode takes the second value, that is, the candidate prediction mode has been included, then the second offset value - 1 can be used for mode offset. For the first prediction mode mode, the new candidate prediction mode is determined to be prevMode = mode - 1, that is, the previous prediction mode of the first prediction mode is taken as the candidate prediction mode. If prevMode passes the legality and PDP mode validity checks, and the corresponding valid identifier includedMode takes the first value, then prevMode can be determined as the corresponding second prediction mode.
[0370] In an embodiment of this application, another method for determining the second prediction mode based on the first prediction mode is to first determine a candidate prediction mode based on the size parameters of the current block and the first prediction mode; and then determine the second prediction mode based on the candidate prediction mode.
[0371] It is understood that, in the embodiments of this application, the corresponding second prediction mode can be determined by combining the size parameters of the current block and the first prediction mode.
[0372] Furthermore, in the embodiments of this application, when determining a candidate prediction mode based on the size parameters of the current block and the first prediction mode, the mode determination parameters can be determined first based on the size parameters and the first prediction mode; and then the candidate prediction mode can be determined based on the mode determination parameters.
[0373] It is understood that, in the embodiments of this application, the mode determination parameter can be understood as a specific parameter value used to derive the second prediction mode. The mode determination parameter can be determined based on the first prediction mode and the size parameter of the current block. For different first prediction modes and different size parameters, the corresponding mode determination parameter is different.
[0374] For example, in some embodiments, assuming the first prediction mode is uiMode, if the size parameter of the current block indicates that the width and height of the current block are not greater than 16, then the mode determination parameter K based on the first prediction mode can refer to formula (9).
[0375] For example, in some embodiments, assuming the first prediction mode is uiMode, if the current block size parameter indicates that the width or height of the current block is greater than 16 (i.e., 32x16, 16x32, 32x32), then the mode determination parameter K based on the first prediction mode can refer to formula (10).
[0376] In other words, in the embodiments of this application, the method of determining parameter K based on the first prediction mode uiMode derivation mode is different for different size parameters.
[0377] For example, in some embodiments, if the size parameter of the current block indicates that the width and height of the current block are not greater than 16, then the determination of the neighboring PDP mode pdpMode (candidate prediction mode) based on the mode determination parameter K can refer to formula (11).
[0378] For example, in some embodiments, if the size parameter of the current block indicates that the width or height of the current block is greater than 16 (i.e., 32x16, 16x32, 32x32), then the determination of the neighboring PDP mode pdpMode (candidate prediction mode) based on the mode determination parameter K can refer to formula (12).
[0379] In other words, in the embodiments of this application, the method of determining the candidate prediction mode based on the mode determination parameter K is different for different size parameters.
[0380] It is understood that, in the embodiments of this application, after determining the candidate prediction mode based on the size parameters of the current block and the first prediction mode, the legality of the candidate prediction mode can be further checked and verified to finally obtain the corresponding second prediction mode. The candidate prediction mode obtained based on the size parameters of the current block and the first prediction mode can be a valid PDP mode; therefore, only the legality of the candidate prediction mode needs to be verified, and the validity of the PDP mode of the candidate prediction mode is no longer verified.
[0381] Furthermore, when determining the second prediction mode based on the candidate prediction mode, if the candidate prediction mode belongs to the first angle mode set, the candidate prediction mode is determined as the second prediction mode.
[0382] It is understood that, in the embodiments of this application, for any prediction mode corresponding to the current block, the legality of the prediction mode can be checked by using a first angle mode set. The first angle mode set can be predefined and can be used to determine whether the prediction mode is within a legal intra-frame angle range.
[0383] For example, in some embodiments, if the legal intra-frame angle range is greater than or equal to 2 and less than or equal to NUM_LUMA_MODE-1, then the first angle mode set can be predefined to include angle prediction mode 2 to angle prediction mode 66, that is, the first angle mode set refers to the interval of mode index in [2, 66].
[0384] For example, in some embodiments, the legality of candidate prediction modes corresponding to the first prediction mode can be checked by the first angle mode set. If the candidate prediction mode belongs to the first angle mode set, then the candidate prediction mode can be determined to be legal.
[0385] Furthermore, in the embodiments of this application, when determining the second prediction mode based on the candidate prediction mode, if the candidate prediction mode does not belong to the first angle mode set, the candidate prediction mode is re-determined based on the size parameter and the mode determination parameter; the second prediction mode is determined based on the re-determined candidate prediction mode.
[0386] In other words, in the embodiments of this application, if the obtained candidate prediction mode does not belong to the first angle mode set, then the parameters can be re-determined according to the current block size parameters and mode to obtain a new candidate prediction mode, and the legality of the new candidate prediction mode is checked and verified according to the above method to finally obtain the corresponding second prediction mode.
[0387] For example, in some embodiments, if the first determined candidate prediction mode does not belong to the first angle mode set, that is, the first determined candidate prediction mode is invalid, then other nearby pdpModes can be calculated, that is, the candidate modes are re-determined. For example, when obtaining new candidate prediction modes according to the current block size parameters and mode determination parameters, if the current block size parameters indicate that the width and height of the current block are not greater than 16, the pdpMode corresponding to K-1 can be checked first, that is, the PDP mode pdpMode (new candidate prediction mode) determined based on the mode determination parameter K, referring to formula (13).
[0388] Accordingly, if the pdpMode corresponding to K-1 belongs to the first angle mode set, that is, the candidate prediction mode determined again is legal, then the mode expansion process can be terminated and the pdpMode corresponding to K-1 is determined as the second prediction mode; if the pdpMode corresponding to K-1 does not belong to the first angle mode set, that is, the candidate prediction mode determined again is illegal, the pdpMode corresponding to K+1 can be checked, that is, the PDP mode pdpMode (new candidate prediction mode) determined again based on the mode determination parameter K, refer to formula (14).
[0389] For example, in some embodiments, if the first determined candidate prediction mode does not belong to the first angle mode set, that is, the first determined candidate prediction mode is invalid, then other nearby pdpModes can be calculated, that is, the candidate modes are re-determined. For example, when obtaining new candidate prediction modes according to the current block size parameters and mode determination parameters, if the current block size parameters indicate that the width or height of the current block is greater than 16 (i.e., 32x16, 16x32, 32x32), the pdpMode corresponding to K+1 can be checked first, that is, the PDP mode pdpMode (new candidate prediction mode) determined based on the mode determination parameter K, referring to formula (15).
[0390] Accordingly, if the pdpMode corresponding to K+1 belongs to the first angle mode set, that is, the candidate prediction mode determined again is legal, then the mode expansion process can be terminated and the pdpMode corresponding to K+1 is determined as the second prediction mode; if the pdpMode corresponding to K+1 does not belong to the first angle mode set, that is, the candidate prediction mode determined again is illegal, the pdpMode corresponding to K-1 can be checked again, that is, the PDP mode pdpMode (new candidate prediction mode) determined again based on the mode determination parameter K, refer to formula (16).
[0391] Accordingly, in the embodiments of this application, if the parameters are determined based on different modes, such as one or more of K, K-1, K+1, and none of the obtained candidate prediction modes pass the legality check or verification, then it is possible to choose not to replace the first prediction mode with the PDP mode.
[0392] Therefore, in the embodiments of this application, when determining the second prediction mode based on the first prediction mode, if the first prediction mode mode among multiple angle prediction modes (e.g., dimdMode and dimdBlendMode[N]) is not a valid PDP mode, the nearest PDP mode can be determined based on the current block size parameter and the first prediction mode. If the nearest PDP mode meets the validity requirements, the original mode mode can be replaced with the nearest PDP mode.
[0393] In the embodiments of this application, similarly, if the first prediction mode is not a valid PDP mode, then after determining a valid PDP mode, such as the second prediction mode, based on the current block size parameter and the first prediction mode, it is possible to set the valid identifier of the second prediction mode to a second value, that is, update the includedMode array to record the second prediction mode.
[0394] For example, in some embodiments, assuming the second value is 1 and the second prediction mode is mode m+1, since the second prediction mode is a valid PDP mode, then includedMode[m+1] can be set to 1.
[0395] It is understood that, in the embodiments of this application, after determining the candidate prediction mode based on the current block size parameters and the first prediction mode, during the process of checking and verifying the legality of the candidate prediction mode, it is also possible to simultaneously determine whether a candidate prediction mode has already been included based on a valid identifier. Specifically, to ensure that the angle prediction mode is not repeated, it is possible to select a candidate prediction mode that does not include the candidate prediction mode obtained by offset as the second prediction mode.
[0396] Furthermore, in the embodiments of this application, when determining the second prediction mode based on the candidate prediction mode, if the candidate prediction mode belongs to the first angle mode set and the valid identifier of the candidate prediction mode is a first value, the candidate prediction mode is determined as the second prediction mode.
[0397] In other words, in the embodiments of this application, if the candidate prediction mode obtained based on the size parameter and the first prediction mode passes the legality check and verification, and the valid identifier of the candidate prediction mode is the first value (i.e., the candidate prediction mode is not repeated), then the candidate prediction mode can be selected as the second prediction mode.
[0398] For example, in some embodiments, assuming that the candidate prediction mode of the first prediction mode determined according to the size parameter and the first prediction mode is pdpMode, then it is determined whether pdpMode is within the legal intra-frame angle range. At the same time, it is determined whether the candidate prediction mode has been included based on the valid identifier includedMode of the candidate prediction mode. If pdpMode passes the legality verification and the value of the valid identifier includedMode of the candidate prediction mode is the second value, that is, the candidate prediction mode has been included, then the candidate prediction mode pdpMode can be further re-determined based on the size parameter and the mode determination parameter. If the re-determined pdpMode passes the legality verification and the value of the corresponding valid identifier includedMode is the first value, then the re-determined pdpMode can be determined as the corresponding second prediction mode.
[0399] Step 1603: Determine the weight matrix of the PDP mode based on the second prediction mode, and determine the first prediction block corresponding to the current block based on the weight matrix of the PDP mode.
[0400] In the embodiments of this application, if the current block meets the PDP mode requirements, and the first prediction mode among multiple angle prediction modes is a mode that does not allow the use of weight matrices for intra-frame prediction, then after determining the second prediction mode that allows the use of weight matrices for intra-frame prediction based on the first prediction mode, the weight matrix of the PDP mode can be further determined based on the second prediction mode, and the first prediction block corresponding to the current block can be determined based on the weight matrix of the PDP mode.
[0401] It is understood that, in the embodiments of this application, during intra-frame prediction using PDP mode, a predefined weight matrix can be used to achieve intra-frame prediction. The weight matrix corresponding to the current block is predefined based on the shape and angle prediction modes of the current block. That is, different angle prediction modes for the current block correspond to different weight matrices used to achieve PDP mode prediction.
[0402] It is understood that in the embodiments of this application, if the first prediction mode is a mode that does not allow the use of weight matrices for intra-frame prediction, then after extending the first prediction mode to PDP mode and determining the corresponding second prediction mode that is effective in PDP mode, the weight matrix of the PDP mode corresponding to the second prediction mode can be used to perform intra-frame prediction in PDP mode.
[0403] In the embodiments of this application, the corresponding prediction block (i.e., the first prediction block) can be determined using the weight matrix of the PDP mode determined based on the second prediction mode, and then the first prediction block can be used as the intra-frame prediction result corresponding to the first prediction mode. That is, the first prediction block obtained based on the weight matrix of the PDP mode corresponding to the second prediction mode is used to replace the original traditional intra-frame angle prediction block of the first prediction mode.
[0404] Furthermore, in the embodiments of this application, for multiple angle prediction modes corresponding to the current block, the proposed PDP mode extension scheme can be implemented on some or all of the angle prediction modes. That is, the validity of the PDP mode can be determined for any number of angle prediction modes. If it is not a valid PDP mode, the corresponding valid prediction mode can be determined based on the offset value. Alternatively, the corresponding valid prediction mode can be determined based on the size parameters of the current block and the invalid prediction mode of the PDP mode (i.e., the mode that does not allow intra-frame prediction using the weight matrix), thereby realizing the PDP mode extension of the invalid prediction mode of the PDP mode.
[0405] Furthermore, in the embodiments of this application, the first prediction mode can be used for intra-frame prediction of the block to be reconstructed in the current image. That is, for the current block, the derived first prediction mode can be used for subsequent intra-frame prediction processing. For example, intra-frame prediction can be performed on the next block to be reconstructed based on the first prediction mode.
[0406] Furthermore, in the embodiments of this application, the second prediction mode is used for intra-frame prediction of the block to be reconstructed in the current image. That is, for the current block, for the first prediction mode that is not applicable to the PDP mode, after determining the corresponding second prediction mode through PDP mode extension, the second prediction mode obtained by extension can be used for subsequent intra-frame prediction processing. For example, intra-frame prediction can be performed on the next block to be reconstructed based on the second prediction mode.
[0407] In other words, in the embodiments of this application, the angle prediction mode that is not applicable to the PDP mode and the corresponding extended intra-frame prediction mode that is applicable to the PDP mode for the current block can be saved for reference in subsequent coding blocks.
[0408] In the embodiments of this application, when it is determined that the current block uses DIMD for intra-frame prediction, the first prediction block is determined through a second prediction mode. Furthermore, first syntax element identification information can be written into the bitstream; wherein the first syntax element identification information indicates that the current block uses DIMD for intra-frame prediction.
[0409] It is understood that, in the embodiments of this application, the first syntax element identification information can be used to indicate whether the current block uses the DIMD method. If the current block uses the DIMD method, the PDP mode extension scheme proposed in this application can be selected to extend the angle prediction mode that is not applicable to the PDP mode in the angle prediction mode derived based on the DIMD mode to the PDP mode, and then use the extended effective PDP mode for intra-frame prediction processing, resulting in higher accuracy of the final predicted block.
[0410] For example, in some embodiments, if the value of the first syntax element identification information is a first value, it is determined that the first syntax element identification information indicates that the current block uses the DIMD method; if the value of the first syntax element identification information is a second value, it is determined that the first syntax element identification information indicates that the current block does not use the DIMD method.
[0411] Here, the first value is different from the second value, and both the first and second values can be in parameter form or in numeric form. Specifically, the first syntax element identification information can be a parameter written in the profile or a flag value; no specific limitation is made here. For example, the first value can be 1 and the second value can be 0; or, the first value can be 0 and the second value can be 1; or, the first value can be true and the second value can be false; or, the first value can be false and the second value can be true.
[0412] It is understood that, in the embodiments of this application, the first syntax element identification information can be represented as cu_dimd_flag.
[0413] In one specific embodiment, taking a first value of 1 and a second value of 0 as an example, if the value of cu_dimd_flag is 1, then it can be determined that the first syntax element identification information indicates that the current block uses the DIMD method; if the value of cu_dimd_flag is 0, then it can be determined that the first syntax element identification information indicates that the current block does not use the DIMD method.
[0414] Furthermore, in the embodiments of this application, if the current block is not intra-prediction using the DIMD method, then when using the DIMD method to derive the intra-prediction mode, the derivation process is the same as the DIMD derivation process of the DIMD coded block, but PDP extension is not performed on the derived mode.
[0415] In the embodiments of this application, when it is determined that the current block uses OBIC for intra-frame prediction, the first prediction block is determined through a second prediction mode. Furthermore, second syntax element identification information can be written into the bitstream; wherein the second syntax element identification information indicates that the current block uses OBIC for intra-frame prediction.
[0416] It is understood that, in the embodiments of this application, the second syntax element identification information can be used to indicate whether the current block uses the OBIC method. If the current block uses the OBIC method, the PDP mode extension scheme proposed in this application can be selected to extend the angle prediction mode that is not applicable to the PDP mode in the angle prediction mode derived based on the OBIC mode to the PDP mode, and then use the extended effective PDP mode for intra-frame prediction processing, resulting in higher accuracy of the final predicted block.
[0417] For example, in some embodiments, if the value of the second syntax element identification information is a first value, it is determined that the second syntax element identification information indicates that the current block uses the OBIC method; if the value of the second syntax element identification information is a second value, it is determined that the second syntax element identification information indicates that the current block does not use the OBIC method.
[0418] Here, the first value and the second value are different, and both can be in parameter form or numeric form. Specifically, the second syntax element identification information can be a parameter written in the profile or a flag value; no specific limitation is made here. For example, the first value can be 1 and the second value can be 0; or, the first value can be 0 and the second value can be 1; or, the first value can be true and the second value can be false; or, the first value can be false and the second value can be true.
[0419] It is understood that, in the embodiments of this application, the second syntax element identification information can be represented as cu_obic_flag.
[0420] In one specific embodiment, taking a first value of 1 and a second value of 0 as an example, if the value of cu_obic_flag is 1, then it can be determined that the second syntax element identification information indicates that the current block uses the OBIC method; if the value of cu_obic_flag is 0, then it can be determined that the second syntax element identification information indicates that the current block does not use the OBIC method.
[0421] Furthermore, in the embodiments of this application, if the current block is not intra-prediction using the OBIC method, then when using the OBIC method to derive the intra-prediction mode, the derivation process is the same as the OBIC derivation process of the OBIC coded block, but PDP extension is not performed on the derived mode.
[0422] Step 1604: Determine the prediction block corresponding to the current block based on the weights of the first prediction block and the first prediction mode.
[0423] In the embodiments of this application, after determining the weight matrix of the PDP mode based on the second prediction mode and determining the first prediction block corresponding to the current block based on the weight matrix of the PDP mode, the prediction block corresponding to the current block can be further determined based on the weights of the first prediction block and the first prediction mode.
[0424] It is understood that, in the embodiments of this application, after completing the PDP mode extension of any number of angle prediction modes corresponding to the current block and replacing the original traditional intra-frame angle prediction blocks with the prediction blocks of the corresponding PDP modes, the prediction blocks of the current block can be further determined based on the prediction blocks corresponding to the multiple angle prediction modes corresponding to the current block and the corresponding weights.
[0425] Furthermore, in the embodiments of this application, when determining the prediction block corresponding to the current block based on the weights of the first prediction block and the first prediction mode, multiple prediction blocks corresponding to multiple angle prediction modes can be determined, and then the prediction block corresponding to the current block can be determined based on the multiple prediction blocks and the multiple weights of the multiple angle prediction modes. The multiple prediction blocks corresponding to the multiple angle prediction modes may include the first prediction block corresponding to the first prediction mode; the multiple weights corresponding to the multiple angle prediction modes may include the weights of the first prediction mode.
[0426] It is understood that, in the embodiments of this application, predicted blocks derived from multiple angle prediction modes corresponding to the current block and their corresponding weights can be weighted and fused to finally obtain the predicted block of the current block. Specifically, for angle prediction modes that use other effective prediction modes for PDP mode extension, such as a first prediction mode that uses a second prediction mode for PDP mode extension, although the weight matrix of the PDP mode corresponding to the second prediction mode is used to determine the first predicted block, the weights used by the first predicted block in the final weighted fusion process are still the weights corresponding to the first prediction mode. That is, the predicted value may change, but the weights will not change.
[0427] For example, in some embodiments, it is assumed that the current block corresponds to 5 angle prediction modes, namely angle prediction mode 1, angle prediction mode 2, angle prediction mode 3, angle prediction mode 4, and angle prediction mode 5, and the corresponding original intra-frame angle prediction values are pred_1, pred_2, pred_3, pred_4, and pred_5, respectively, and the corresponding weights are weight_1, weight_2, weight_3, weight_4, and weight_5, respectively. Among them, angle prediction mode 3 and angle prediction mode 5 are not valid PDP modes. It is possible to select only angle prediction mode 3 to perform PDP mode extension, and determine the prediction value of the corresponding PDP mode as pred_3'. Finally, the prediction value Pred_final of the current block is obtained by weighted fusion of the prediction values and weights corresponding to the 5 angle prediction modes, as shown in formula (17).
[0428] For example, in some embodiments, it is assumed that the current block corresponds to three angle prediction modes, namely angle prediction mode 1, angle prediction mode 2, and angle prediction mode 3, and the corresponding original intra-frame angle prediction values are pred_1, pred_2, and pred_3, respectively, and the corresponding weights are weight_1, weight_2, and weight_3, respectively. Among them, angle prediction mode 1 and angle prediction mode 3 are not valid PDP modes. It is possible to simultaneously perform PDP mode extension on angle prediction mode 1 and angle prediction mode 3 to determine the prediction values of the corresponding PDP modes as pred_1' and pred_3', respectively. Finally, the prediction value Pred_final of the current block is obtained by weighted fusion of the prediction values and weights corresponding to the three angle prediction modes, as shown in formula (18).
[0429] Therefore, it can be seen that after the PDP mode extension scheme proposed in this application extends one or more angle prediction modes that are not applicable to PDP mode, the corresponding prediction values will be adjusted, but the corresponding weights will not change.
[0430] For example, in some embodiments, in order to obtain more accurate prediction results, after PDP mode expansion, it is possible to adaptively adjust some or all of the corresponding weights based on the first prediction mode and / or the second prediction mode, as well as the amplitude corresponding to the first prediction mode and / or the amplitude corresponding to the second prediction mode.
[0431] It is understandable that, in another implementation, in order to obtain more accurate prediction results, after extending the PDP mode, one can choose to adjust the corresponding predicted values while also making adaptive adjustments to some or all of the corresponding weights. This application does not impose specific limitations.
[0432] Furthermore, in the embodiments of this application, this application proposes a PDP mode extension method, including but not limited to a PDP mode extension method based on the angle prediction mode obtained from the DIMD mode. This method can replace the angle prediction mode derived from the gradient histogram of the DIMD mode with an effective intra-frame prediction mode of the adjacent PDP mode, thereby improving the accuracy of prediction.
[0433] Furthermore, this application proposes a PDP mode extension method, including a scheme to adjust an intra-frame angle prediction mode that is not applicable to PDP mode to an intra-frame prediction mode applicable to PDP mode, including checking and extending the neighboring modes mode±1 of the current mode mode, and checking and extending the neighboring PDP modes (i.e., the PDP modes corresponding to K, K-1, and K+1).
[0434] For example, in some embodiments, the PDP mode extension method proposed in this application was tested on test software, and the test results are shown in Table 1.
[0435] Furthermore, in the embodiments of this application, the DIMD mode can be used to derive multiple angle prediction modes corresponding to the current block, or other methods can be used to derive multiple angle prediction modes corresponding to the current block. For example, the OBIC mode derives the intra-frame prediction mode of the current block based on the occurrence of intra-frame modes in the spatial neighborhood of the block. For the OBIC mode list obicmode[n] obtained by histogram statistics based on the occurrence frequency, one or any number of modes or copied extended modes can still be checked and extended according to the PDP mode extension method proposed in this application.
[0436] This application provides an encoding method in which the encoder determines multiple angle prediction modes corresponding to the current block; if the current block meets the PDP mode requirements, and the first prediction mode among the multiple angle prediction modes is a mode that does not allow intra-frame prediction using a weight matrix, a second prediction mode is determined based on the first prediction mode; wherein the second prediction mode is a mode that allows intra-frame prediction using a weight matrix; the weight matrix of the PDP mode is determined based on the second prediction mode, and the first prediction block corresponding to the current block is determined based on the weight matrix of the PDP mode; the prediction block corresponding to the current block is determined based on the weights of the first prediction block and the first prediction mode. That is, in the embodiments of this application, for any angle prediction mode in the current block that is not applicable to the PDP mode, it can be extended to the PDP mode to determine the corresponding effective intra-frame prediction mode of the PDP mode, and the extended effective intra-frame prediction mode of the PDP mode is used for intra-frame prediction. Therefore, in this application, for angle prediction modes that are not effective in the PDP mode, intra-frame prediction of the PDP mode can be achieved through the PDP mode extension method, obtaining more accurate prediction results, thereby improving encoding and decoding performance.
[0437] Based on the above embodiments, another embodiment of this application proposes an encoding and decoding method. Compared with the traditional intra-frame angle prediction modes derived from the matrix weighting method, the PDP prediction results are often more accurate. Therefore, it is possible to consider extending the intra-frame angle prediction derivation process to the PDP mode. Specifically, the N intra-frame prediction angle modes (angle prediction modes) derived from the matrix weighting method are checked. If any angle prediction mode is not applicable to the PDP mode, other prediction modes that conform to the PDP mode can be determined. The angle prediction mode that is not applicable to the PDP mode is replaced with the corresponding prediction mode that conforms to the PDP mode standard, thereby improving the prediction accuracy.
[0438] In the embodiments of this application, one or more methods can be selected to determine the multiple angle prediction modes corresponding to the current block. For example, the DIMD mode can be used to derive the multiple angle prediction modes corresponding to the current block, or the OBIC mode can be used to derive the multiple angle prediction modes corresponding to the current block. Of course, other modes can also be used to derive the multiple angle prediction modes corresponding to the current block. This application does not make specific limitations.
[0439] The following example illustrates the extension method of PDP mode proposed in this application.
[0440] This application proposes an extension mechanism for PDP mode that can be introduced during the intra-frame angle prediction derivation process of DIMD.
[0441] 1. Check if the current block meets the PDP mode requirements.
[0442] In the embodiments of this application, it can be first determined whether the current block meets the PDP mode requirements, that is, a PDP mode validity check can be performed on the current block. The PDP mode validity check process for the current block includes, but is not limited to:
[0443] • Check the sizeAvailable property of the encoded block size
[0444] • Reference area availability check (refAvailable)
[0445] In the validity check of the current block size, the first step in the validity check of PDP prediction is to verify whether a certain coding unit (e.g., the current block) can be predicted using PDP. Since the PDP mode will be applied to blocks with a width and height of no more than 32 (except for 4x32, 32x4, 8x32, and 32x8), the CU size validity check can be performed directly based on the size combination, i.e., width w and height h.
[0446] For example, to simplify conditional judgments, a key-value lookup table operation can be used. The specific process is as follows:
[0447] It is necessary to ensure that the current component is the luminance component (Y component).
[0448] Get the width and height of the current block, denoted as width and height, or W and H respectively.
[0449] Calculate the size key value sizeKey, which has the value (width<<8)+height, and use it for subsequent table lookup operations.
[0450] The system checks if the sizeKey exists in the list of valid block sizes, g_size, by looking up the table. If it exists, the corresponding table entry index, sizeIdx, is retrieved; otherwise, sizeIdx is set to -1.
[0451] Check if sizeIdx is a valid value, such as sizeIdx >= 0. If sizeIdx is an invalid value, such as sizeIdx = -1, then directly determine that sizeAvailable is invalid.
[0452] The predefined list g_size contains sizeIdx corresponding to different sizeKeys. For example, (sizeKey=1028, sizeIdx=0), (sizeKey=1032, sizeIdx=1), etc. On one hand, the existence of the current block's sizeKey in g_size determines whether the coded block size is valid; on the other hand, the weight matrix used for PDP prediction can be determined by the current intra-frame prediction mode and sizeIdx.
[0453] Furthermore, once `sizeAvailable` is valid—that is, after determining the validity of the PDP mode for the coding unit size—it is necessary to examine the surrounding neighborhood of the current block to determine if there is a sufficient available reference region for matrix-weighted prediction. This involves checking whether the reference region of the current block meets the PDP mode requirements. This process involves examining the L-shaped template regions on the top and left sides of the block.
[0454] For example, Figure 17 is a schematic diagram of the legality verification of the PDP mode. As shown in Figure 17, the reconstructed samples of the current prediction block (current block) are determined by analyzing the boundary of the current block, and the reconstructed samples of the upper left corner C, upper D, upper right E, left side B, and lower left A of the current block are used. The number of usable samples is then counted. Let the coordinate of the upper left corner of the current block be (0, 0). The adjacent samples of region C are p[x][y], x = -T2..-1, y = -T1..-1, region D is p[x][y], x = 0..W-1, y = -T1..-1, region B is p[x][y], x = -T2..-1, y = 0..H-1, region E is p[x][y], x = W..2×W-1, y = -T1..-1, and region A is p[x][y], x = -T2..-1, y = H..2×H-1. Where W and H represent the width and height of the current block, and T1 and T2 represent the current block size, the height of the upper part of the PDP mode template in the current intra-prediction mode, and the width of the left part of the template.
[0455] If any reference region is found to be unavailable, refAvailable will be false, meaning the reference region availability check will fail.
[0456] When all neighboring region samples are reconstructed and can be legally accessed by the current CU, the reference region availability check is considered passed, and refAvailable is true.
[0457] 2. Check the effectiveness of the PDP mode in the angle prediction model.
[0458] Understandably, PDP mode improves prediction accuracy by replacing some of the original intra-frame angle prediction modes. In order to determine whether the current intra-frame angle prediction mode is applicable to PDP mode, it is necessary to perform a validity check on the current intra-frame angle.
[0459] During the execution of PDP mode extension, it is necessary to check the validity of the PDP mode of the angle prediction mode, that is, to determine whether any angle prediction mode is a valid PDP mode, or in other words, to determine whether any angle prediction mode is a mode that allows intra-frame prediction using the weight matrix.
[0460] When checking the validity of the PDP mode for angle prediction patterns, for blocks with a width and height no greater than 16, the PDP mode only replaces specific intra-frame angle prediction patterns. Apart from the special 0 and 1 modes, the valid set of angle patterns for the PDP mode is (2+2k), k = 0..32. Similarly, for blocks of other sizes (e.g., 32x16, 16x32, 32x32), the valid set of angle patterns for the PDP mode is (2+4k), k = 0..16.
[0461] Therefore, based on the size of the current block, it is possible to directly check whether the current intra-frame angle prediction mode modeIdx is within the corresponding (2+2k) or (2+4k) set range.
[0462] For example, to simplify the cost of conditional judgments, a key-value lookup table operation can be used. The specific process is as follows:
[0463] The block size index `sizeIdx` obtained using the above scheme is used to determine the step size `s` and margin `m` of the replacement pattern. The value of `sizeIdx` depends on the design of the legal block size list `g_size` (e.g., `sizeIdx < 12` indicates a block whose width and height are both no greater than 16). Specifically, when `sizeIdx` represents a block whose width and height are both no greater than 16, `s` = 2 and `m` = 0; when `sizeIdx` represents a block of other sizes (such as 32x16, 16x32, 32x32, etc.), `s` = 4 and `m` = 2.
[0464] For the array g_pdpFilters defined by the PDP method, which stores the PDP filter weight matrices for different block sizes and intra-prediction modes, check whether g_pdpFilters[modeIdx][sizeIdx] is not empty. If not, it means that the current intra-prediction mode modeIdx is not a valid PDP mode under the current block size; if so, further check whether the subsequent intra-angles are within the valid PDP angle set.
[0465] Check if the intra-frame angle is within the valid PDP angle set. If modeIdx%s==m, it can be determined that the current intra-frame angle prediction mode is a valid PDP prediction mode.
[0466] III. PDP Mode Expansion
[0467] Furthermore, if the PDP mode validity check of the current block passes, at least one of the following extension schemes can be used to extend the PDP mode:
[0468] Extended Solution 1: Check the intra-prediction angle derived from DIMD. When it does not conform to the PDP mode standard, check the adjacent angle modes of this mode. If it is a valid PDP mode, replace the intra-prediction angle that does not conform to the PDP mode standard with the corresponding angle mode that conforms to the PDP mode standard (hereinafter referred to as PDP mode).
[0469] Extended Solution 2: Force conversion of the intra-prediction angle mode derived by DIMD, converting the intra-prediction angle that does not conform to the PDP mode standard into the closest angle mode that conforms to the PDP mode standard (hereinafter referred to as PDP mode).
[0470] 1. Extension Scheme 1: PDP Extension of Adjacent Angle Modes for Intra-Predicted Angles Derived by DIMD
[0471] Furthermore, the method involved in the extended scheme can be understood as offsetting the angular prediction pattern that is not applicable to the PDP mode based on a determined offset value in order to find the adjacent prediction pattern that is applicable to the PDP mode.
[0472] For example, for the intra-predicted angle modes dimdMode and dimdBlendMode[N] obtained by statistical analysis of the DIMD gradient histogram, assuming the first prediction mode is mode, mode is not applicable to PDP mode, check whether its adjacent angle modes (mode±1) are valid PDP modes (detecting adjacent modes with an offset step size of 1; of course, the offset compensation can also be other values). If so, the original mode is replaced with the adjacent PDP mode.
[0473] Extension scheme one can extend the PDP mode to one or more modes of dimdMode and dimdBlendMode[N]. Extension scheme one can be implemented in the following two ways:
[0474] • Allows repeating patterns in DIMD derivation angles
[0475] • Repeated patterns are not allowed in DIMD derivation angles.
[0476] 1.1 Allows repeating patterns in DIMD derivation angles.
[0477] PDP expansion is performed on the N intra-frame angle patterns derived from DIMD. The PDP expansion check process is as follows:
[0478] ① Initialization
[0479] Determine the current mode, mode = dimdMode or dimdBlendMode[i], i = 0..N-2. Check if mode is within the legal intra-frame angle range (mode is greater than or equal to 2 and less than or equal to NUM_LUMA_MODE-1, i.e., excluding DC mode and planar mode).
[0480] ② If the current mode is a valid PDP mode, terminate the PDP extension process of the current mode directly, and do not perform the following check steps.
[0481] ③ Calculate intervalIndex = (mode - 2) / 16 to determine the angle interval of the current mode. Different mode intervals will adopt different nearest-neighbor mode priority checks, as described in ④ and ⑤.
[0482] ④ If intervalIndex is odd (i.e., the mode is in the interval [18,33] or [50,66]), first check mode+1.
[0483] a) Calculate nextMode = mode + 1
[0484] b) Check if nextMode is within a valid intra-frame angle range, i.e., the mode is within the [2, 66] interval. If so, check if nextMode is a valid PDP mode.
[0485] c) If nextMode is valid, update and replace mode with nextMode, and end the check process.
[0486] d) If the nextMode mode is not valid, then check the prevMode = mode-1 mode, and repeat steps b)-c) above for prevMode.
[0487] ⑤ If intervalIndex is even (i.e., the mode is in the interval [2,17] or [34,49]), first check mode-1.
[0488] a) Calculate prevMode = mode - 1
[0489] b) Check if prevMode is within a valid intra-frame angle range, i.e., the mode is within the [2, 66] interval. If so, check if prevMode is a valid PDP mode.
[0490] c) If prevMode is valid, update and replace mode with prevMode, and end the check process.
[0491] d) If the prevMode mode is not valid, then check the nextMode = mode + 1 mode, and repeat steps b)-c) above for nextMode.
[0492] 1.2 Repeated patterns are not allowed in the DIMD derivation angle.
[0493] The `includedMode` array is initialized, with `includedMode[i] = 0` and `i = 0..NUM_LUMA_MODE-1`, to track all included modes during PDP expansion. Then, PDP expansion is performed on the N intra-frame angle modes derived from DIMD. The PDP expansion check process is as follows:
[0494] ① Initialization
[0495] Determine the current mode, mode = dimdMode or dimdBlendMode[i], i = 0..N-2. Check if mode is within the legal intra-frame angle range (mode is greater than or equal to 2 and less than or equal to NUM_LUMA_MODE-1, i.e., excluding DC mode and planar mode).
[0496] ② If the current mode is a valid PDP mode, terminate the PDP extension process of the current mode directly, update the includedMode array to record the current mode, set includedMode[mode] = 1, and do not perform the following check steps.
[0497] ③ Calculate intervalIndex = (mode - 2) / 16 to determine the angle interval of the current mode. Different mode intervals will adopt different nearest-neighbor mode priority checks, as described in ④ and ⑤.
[0498] ④ If intervalIndex is odd (i.e., the mode is in the interval [18,33] or [50,66]), first check mode+1.
[0499] a) Calculate nextMode = mode + 1
[0500] b) Check if nextMode is within a valid range, i.e., the mode is in the interval [2, 66], and ensure that it is not included in includedMode, i.e., includeMode[pdpMode] == 0. If it is, check if nextMode is a valid PDP mode.
[0501] c) If nextMode is valid, update and replace mode with nextMode, update the includedMode array to record nextMode, and end the check process.
[0502] d) If the nextMode mode is not valid, then check the prevMode = mode-1 mode, and repeat steps b)-c) above for prevMode.
[0503] ⑤ If intervalIndex is even (i.e., the mode is in the interval [2,17] or [34,49]), first check mode-1.
[0504] a) Calculate prevMode = mode - 1
[0505] b) Check if prevMode is within a valid range, i.e., the mode is in the range [2,66], and ensure that it is not included in includedMode. If so, check if prevMode is a valid PDP mode.
[0506] c) If prevMode is valid, update and replace mode with prevMode, update the includedMode array to record prevMode, and end the check process.
[0507] d) If the prevMode mode is not valid, then check the nextMode = mode + 1 mode, and repeat steps b)-c) above for nextMode.
[0508] 2. Extension Scheme Two: Forced PDP Extension of Adjacent Angle Modes of Intra-Predicted Angles Derived by DIMD
[0509] Before performing PDP expansion for DIMD prediction, a PDP mode validity check for the current block is first performed. Only if both sizeAvailable and refAvailable are true will the next step, checking whether the angle prediction mode is a valid PDP mode, proceed.
[0510] For the intra-prediction angle modes dimdMode and dimdBlendMode[N] obtained through DIMD gradient histogram statistics, we will check whether they are valid PDP modes. If they are not valid PDP modes, the original mode will be directly replaced with the most recent PDP mode.
[0511] Extension scheme one can extend the PDP mode to one or more modes in dimdMode and dimdBlendMode[N]. Extension scheme two can be implemented in the following two ways:
[0512] • Allows repeating patterns in DIMD derivation angles
[0513] • Repeated patterns are not allowed in DIMD derivation angles.
[0514] 2.1 Allows repeating patterns in DIMD derivation angles.
[0515] PDP expansion is performed on the N intra-frame angle patterns derived from DIMD. The PDP expansion check process is as follows:
[0516] ① Initialization
[0517] Determine the current mode uiMode, uiMode = dimdMode or dimdBlendMode[i], i = 0..N-2, and check whether uiMode is within the legal intra-frame angle range (uiMode is greater than or equal to 2 and less than or equal to NUM_LUMA_MODE-1, i.e., excluding DC mode and planar mode).
[0518] ② If the current mode uiMode is a valid PDP mode, the PDP extension process of the current mode is terminated directly, and the following check steps are not performed.
[0519] ③ Calculate the neighboring PDP patterns
[0520] a) For blocks whose width and height are no greater than 16, the neighboring PDP mode pdpMode is calculated based on the current mode uiMode. The calculation formulas are (9) and (11).
[0521] b) For blocks of other sizes (i.e., 32x16, 16x32, 32x32), the neighboring PDP mode pdpMode is calculated based on the current mode uiMode, and the calculation formulas are formula (10) and formula (12).
[0522] ④ Valid range check. Check if pdpMode is within the valid intra-frame angle prediction range (2 ≤ pdpMode < NUM_LUMA_MODE).
[0523] ⑤ Proximity mode selection
[0524] If pdpMode is invalid in step ④, then try to calculate other nearby pdpModes (i.e., let K equal the pdpModes corresponding to K-1 and K+1).
[0525] a) For blocks whose width and height are both no greater than 16, first check the pdpMode corresponding to K-1, as shown in formula (13).
[0526] Next, check the pdpMode corresponding to K+1, as shown in formula (14).
[0527] b) For blocks of other sizes (i.e., 32x16, 16x32, 32x32), first check the pdpMode corresponding to K-1, as shown in formula (15).
[0528] Next, check the pdpMode corresponding to K+1, as shown in formula (16).
[0529] c) As described in a) and b), the extended pdpMode is subjected to the valid range check in step ④. The mode extension process is terminated when pdpMode is within the valid range. It should be noted that either the PDP mode corresponding to K-1 or the PDP mode corresponding to K+1 can be checked first, and both approaches are feasible.
[0530] ⑥ Return Results
[0531] If a valid pdpMode is obtained, the original uiMode will be replaced with it; otherwise, no replacement will be performed.
[0532] 2.2 Repeated patterns are not allowed in the DIMD derivation angle.
[0533] When replacing the DIMD-derived mode with a neighboring PDP mode, the includedMode array is initialized, with includedMode[i] = 0 and i = 0..NUM_LUMA_MODE-1, to track all included modes during PDP expansion. Then, PDP expansion is performed on the N intra-frame angle modes derived from DIMD. The PDP expansion check process is as follows:
[0534] ① Initialization
[0535] Determine the current mode uiMode, uiMode = dimdMode or dimdBlendMode[i], i = 0..N-2, and check whether uiMode is within the legal intra-frame angle range (uiMode is greater than or equal to 2 and less than or equal to NUM_LUMA_MODE-1, i.e., excluding DC mode and planar mode).
[0536] ② If the current mode uiMode is a valid PDP mode, directly terminate the PDP extension process of the current mode, update the includedMode array to record the current mode, set includedMode[uiMode] = 1, and do not perform the following check steps.
[0537] a) Calculate the neighboring PDP mode. For blocks with a width and height of no more than 16, the neighboring PDP mode pdpMode is calculated based on the current mode uiMode. The calculation formulas are formula (9) and formula (11).
[0538] b) For blocks of other sizes (i.e., 32x16, 16x32, 32x32), the neighboring PDP mode pdpMode is calculated based on the current mode uiMode, and the calculation formulas are formula (10) and formula (12).
[0539] ③ Valid range check. Check whether pdpMode is within the valid intra-frame angle prediction range (2≤pdpMode<NUM_LUMA_MODE) and is not included in includedMode, i.e., includeMode[pdpMode]==0.
[0540] ④ Proximity mode selection
[0541] If pdpMode is invalid in step ③, then try to calculate other nearby pdpModes (i.e., let K equal the pdpModes corresponding to K-1 and K+1).
[0542] a) For blocks whose width and height are both no greater than 16, first check the pdpMode corresponding to K-1, as shown in formula (13).
[0543] Next, check the pdpMode corresponding to K+1, as shown in formula (14).
[0544] b) For blocks of other sizes (i.e., 32x16, 16x32, 32x32), first check the pdpMode corresponding to K-1, as shown in formula (15).
[0545] Next, check the pdpMode corresponding to K+1, as shown in formula (16).
[0546] c) As described in a) and b), the extended pdpMode is subjected to a valid range check as described in ③. The mode extension process is terminated when pdpMode is within the valid range. It should be noted that either the PDP mode corresponding to K-1 or the PDP mode corresponding to K+1 can be checked first. Both approaches are feasible, and this application does not impose any specific limitations.
[0547] ⑤ Return Results
[0548] If a valid pdpMode is obtained, the original uiMode will be replaced with it; otherwise, no replacement will be performed.
[0549] Furthermore, while deriving the DIMD modes, the corresponding fusion weights are calculated based on the amplitude of the mode in HoG. For example, N modes ipm[i], i = 0..N-1 are derived, and the corresponding weights weight[i], i = 0..N-1 are also derived. However, by using the PDP mode extension scheme proposed in this application, ipm[i] can be adjusted, but its corresponding weight[i] remains unchanged.
[0550] Of course, in another implementation, in order to obtain more accurate prediction results, after extending the PDP mode, one can choose to adjust some or all of the corresponding weights while adjusting the corresponding prediction values. This application does not impose specific limitations.
[0551] For example, in some embodiments, the PDP mode extension method proposed in this application is used to extend the angle prediction mode obtained by DIMD derivation into a PDP mode. Specifically, if the current block is encoded and decoded using the DIMD method, PDP mode extension can be further performed if the validity check of the current block's PDP mode passes. Otherwise, the original DIMD prediction process remains unchanged.
[0552] The syntax elements are as follows:
[0553] Here, cu_dimd_flag is the enable flag for the DIMD method at the coding unit level. If it is true, it means that the DIMD method is used for the current luma block (current block). If it is false, it is not used. If this syntax element does not exist in the bitstream, it is false by default.
[0554] The decoding process is as follows:
[0555] 1. Decode the syntax elements. If the cu_dimd_flag of the current block is true, then the current block is predicted using the DIMD method.
[0556] 2. If the current block uses the DIMD method for prediction, then initialize a gradient histogram HoG, and initialize the corresponding magnitude of each intra-frame prediction mode to 0;
[0557] 3. Based on the DIMD derivation method, select and determine the N angle prediction modes dimdMode and dimdBlendMode[i] obtained from the DIMD derivation according to the histogram amplitude, i=0..N-2;
[0558] 4. Perform a check on the validity of the current block's PDP to determine whether the current block can be used for PDP prediction;
[0559] 5. If the PDP validity check of the current block passes, perform the PDP mode extension process for dimdMode and dimdBlendMode, such as extension scheme one or extension scheme two, and check the validity of the PDP mode.
[0560] 6. Based on dimdMode and dimdBlendMode, perform the DIMD prediction process to obtain the luminance prediction value (the prediction block of the current block).
[0561] The encoding process is as follows:
[0562] 1. The encoder performs initialization and checks. In the intra-frame prediction coding mode of the luma block, if cu_dimd_flag is set to true, the current block is predicted using the DIMD method.
[0563] 2. When the current block is predicted using the DIMD method, a gradient histogram (HoG) is initialized, and the corresponding magnitude of each intra-frame prediction mode is initialized to 0.
[0564] 3. Based on the DIMD derivation method, select and determine the N angle prediction modes dimdMode and dimdBlendMode[i] obtained from the DIMD derivation according to the histogram amplitude, i=0..N-2;
[0565] 4. Perform a check on the validity of the current block's PDP to determine whether the current block can be used for PDP prediction;
[0566] 5. If the PDP validity check of the current block passes, perform the PDP mode extension process for dimdMode and dimdBlendMode, such as extension scheme one or extension scheme two, and check the validity of the PDP mode.
[0567] 6. Based on dimdMode and dimdBlendMode, perform the DIMD prediction process to obtain the luminance prediction value.
[0568] 7. The cu_dimd_flag value is encoded into the bitstream, and the encoder continues to process the next coding unit (image block).
[0569] For example, in some embodiments, the PDP mode extension method proposed in this application is used to extend the angle prediction mode obtained by DIMD derivation into a PDP mode. Specifically, if the current block is encoded and decoded using the DIMD method, PDP mode extension can be further performed if the validity check of the current block's PDP mode passes. Otherwise, the original DIMD prediction process remains unchanged.
[0570] In this embodiment, the original DIMD derivation mode remains unchanged. Simultaneously, the PDP mode extension method proposed in this application is applied to extend the prediction process of the DIMD block using the PDP mode extension. Both the original DIMD derivation mode and the PDP-extended mode of the current block can be saved for reference in subsequent coded blocks. Furthermore, if the current block is not encoded or decoded using the DIMD method, when using the DIMD method to derive the intra-prediction mode, the derivation process is the same as the DIMD derivation process for the DIMD coded block, but PDP extension is not performed on the derived mode.
[0571] The syntax elements are as follows:
[0572] Here, cu_dimd_flag is the enable flag for the DIMD method at the coding unit level. If it is true, it means that the DIMD method is used for the current luma block. If it is false, it is not used. If this syntax element does not exist in the bitstream, it is false by default.
[0573] The decoding process is as follows:
[0574] 1. Decode the syntax elements. If the cu_dimd_flag of the current block is true, then the current block is predicted using the DIMD method.
[0575] 2. If the current block uses the DIMD method for prediction, then initialize a gradient histogram HoG, and initialize the corresponding magnitude of each intra-frame prediction mode to 0;
[0576] 3. According to the DIMD derivation method, select and determine the N prediction modes dimdMode and dimdBlendMode[i], i=0..N-2, obtained from the DIMD derivation based on the histogram amplitude;
[0577] 4. Perform a check on the validity of the current block PDP to determine whether the current coding unit can perform PDP prediction;
[0578] 5. If the validity check of the current block PDP passes, perform the PDP mode extension process of dimdMode and dimdBlendMode as in extension scheme one or extension scheme two and check the validity of the PDP mode to obtain the corresponding extended modes dimdMode_offset and dimdBlendMode_offset[i], i = 0..N-2. At the same time, retain the original derived modes dimdMode and dimdBlendMode.
[0579] 6. Based on the offset dimdMode_offset and dimdBlendMode_offset, perform the DIMD prediction process to obtain the brightness prediction value;
[0580] 7. If the cu_dimd_flag of the current block is false, then the DIMD method is not used for prediction of the current block;
[0581] 8. When deriving the intra-prediction mode of the current non-DIMD coded block using the DIMD method, the same process as steps 2 and 3 is used to derive M prediction modes dimdMode and dimdBlendMode[i], i = 0..M-2. Based on dimdMode and dimdBlendMode, the prediction process of the current non-DIMD coded block is completed;
[0582] 9. When referencing an already encoded DIMD block, the current non-DIMD coded block can refer to the original derived modes dimdMode and dimdBlendMode of that DIMD coded block, or the modes dimdMode_offset and dimdBlendMode_offset after PDP extension. For example, when constructing the most probable intra-frame mode list (MPM) for the current non-DIMD coded block, the dimdMode_offset mode of that DIMD coded block is added to the MPM as a candidate; for example, when constructing a histogram based on occurrence frequency using the OBIC method for the current non-DIMD coded block, the dimdMode and dimdBlendMode modes of that DIMD coded block are included in the histogram. That is, Histogram[ipm] + = uiWidth × uiHeight, where uiWidth and uiHeight are the width and height of the DIMD coded block, and ipm = dimdMode or dimdBlendMode[i], i = 0..N-2. In addition, only modes with a fusion weight greater than 0 in the DIMD block can be included.
[0583] The encoding process is as follows:
[0584] 1. The encoder performs initialization and checks. In the intra-frame prediction coding mode of the luma block, if cu_dimd_flag is set to true, the current block is predicted using the DIMD method.
[0585] 2. When the current block is predicted using the DIMD method, a gradient histogram (HoG) is initialized, and the corresponding magnitude of each intra-frame prediction mode is initialized to 0.
[0586] 3. Based on the DIMD derivation method, select and determine the N angle prediction modes dimdMode and dimdBlendMode[i] obtained from the DIMD derivation according to the histogram amplitude, i=0..N-2;
[0587] 4. Perform a check on the validity of the current block PDP to determine whether the current coding unit can perform PDP prediction;
[0588] 5. If the validity check of the current block PDP passes, perform the PDP mode extension process of dimdMode and dimdBlendMode as in extension scheme one or extension scheme two and check the validity of the PDP mode to obtain the corresponding extended modes dimdMode_offset and dimdBlendMode_offset[i], i = 0..N-2. At the same time, retain the original derived modes dimdMode and dimdBlendMode.
[0589] 6. Based on the offset dimdMode_offset and dimdBlendMode_offset, perform the DIMD prediction process to obtain the brightness prediction value;
[0590] 7. If the cu_dimd_flag of the current block is false, then the DIMD method is not used for prediction of the current block;
[0591] 8. When deriving the intra-prediction mode of the current non-DIMD coded block using the DIMD method, the same process as steps 2 and 3 is used to derive M prediction modes dimdMode and dimdBlendMode[i], i = 0..M-2. Based on dimdMode and dimdBlendMode, the prediction process of the current non-DIMD coded block is completed;
[0592] 9. When referencing an already encoded DIMD block, the current non-DIMD coded block can refer to the original derived modes dimdMode and dimdBlendMode of that DIMD coded block, or the modes dimdMode_offset and dimdBlendMode_offset after PDP extension. For example, when constructing the most probable intra-frame mode list (MPM) for the current non-DIMD coded block, the dimdMode_offset mode of that DIMD coded block is added to the MPM as a candidate; for example, when constructing a histogram based on occurrence frequency using the OBIC method for the current non-DIMD coded block, the dimdMode and dimdBlendMode modes of that DIMD coded block are included in the histogram. That is, Histogram[ipm] + = uiWidth × uiHeight, where uiWidth and uiHeight are the width and height of the DIMD coded block, and ipm = dimdMode or dimdBlendMode[i], i = 0..N-2. In addition, only modes with a fusion weight greater than 0 in the DIMD block can be included.
[0593] 10. The cu_dimd_flag value is encoded into the bitstream, and the encoder continues to process the next encoding unit.
[0594] Furthermore, in the embodiments of this application, this application proposes a PDP mode extension method, including but not limited to a PDP mode extension method based on the angle prediction mode obtained from the DIMD mode. This method can replace the angle prediction mode derived from the gradient histogram of the DIMD mode with an effective intra-frame prediction mode of the adjacent PDP mode, thereby improving the accuracy of prediction.
[0595] Furthermore, this application proposes a PDP mode extension method, including a scheme to adjust an intra-frame angle prediction mode that is not applicable to PDP mode to an intra-frame prediction mode applicable to PDP mode, including checking and extending the neighboring modes mode±1 of the current mode mode, and checking and extending the neighboring PDP modes (i.e., the PDP modes corresponding to K, K-1, and K+1).
[0596] For example, in some embodiments, the PDP mode extension method proposed in this application was tested on test software, and the test results are shown in Table 1.
[0597] This application provides an encoding / decoding method in which the codec determines multiple angle prediction modes corresponding to the current block. If the current block meets the PDP mode requirements, and the first prediction mode among the multiple angle prediction modes is a mode that does not allow intra-frame prediction using a weight matrix, a second prediction mode is determined based on the first prediction mode. The second prediction mode is a mode that allows intra-frame prediction using a weight matrix. A weight matrix for the PDP mode is determined based on the second prediction mode, and a first prediction block corresponding to the current block is determined based on the weight matrix of the PDP mode. Finally, the prediction block corresponding to the current block is determined based on the weights of the first prediction block and the first prediction mode. In other words, in the embodiments of this application, for any angle prediction mode in the current block that is not applicable to the PDP mode, it can be extended to a PDP mode to determine the corresponding effective intra-frame prediction mode, and intra-frame prediction is performed using the extended effective intra-frame prediction mode. Therefore, in this application, for angle prediction modes that are not effective under the PDP mode, intra-frame prediction under the PDP mode can be achieved through PDP mode extension, resulting in more accurate prediction results and thus improving encoding / decoding performance.
[0598] Based on the above embodiments, in another embodiment of this application, based on the same inventive concept as the foregoing embodiments, FIG18 is a schematic diagram of the composition structure of an encoder provided in an embodiment of this application. As shown in FIG18, the encoder 100 may include a first determining portion 1101, wherein:
[0599] The first determining part 1101 is configured to determine multiple angle prediction modes corresponding to the current block; if the current block meets the PDP mode requirements and the first prediction mode among the multiple angle prediction modes is a mode that does not allow the use of weight matrices for intra-frame prediction, a second prediction mode is determined based on the first prediction mode; wherein, the second prediction mode is a mode that allows the use of weight matrices for intra-frame prediction; the weight matrix of the PDP mode is determined based on the second prediction mode, and the first prediction block corresponding to the current block is determined based on the weight matrix of the PDP mode; the prediction block corresponding to the current block is determined based on the weights of the first prediction block and the first prediction mode.
[0600] Understandably, in the embodiments of this application, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular component. Furthermore, the components in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit described above can be implemented in hardware or as a software functional module.
[0601] If the integrated unit is implemented as a software functional module and not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0602] Therefore, this application provides a computer-readable storage medium applied to an encoder 100, the computer-readable storage medium storing a computer program that, when executed by a first processor, implements the method described in any of the foregoing embodiments.
[0603] Based on the composition of the encoder 100 described above and the computer-readable storage medium, Figure 19 is a schematic diagram of the specific hardware structure of an encoder provided in an embodiment of this application. As shown in Figure 19, the encoder 100 may include: a first communication interface 1201, a first memory 1202, and a first processor 1203; the various components are coupled together through a first bus system 1204. It is understood that the first bus system 1204 is used to realize the connection and communication between these components. In addition to a data bus, the first bus system 1204 also includes a power bus, a control bus, and a status signal bus. However, for clarity, all buses are labeled as the first bus system 1204 in the figure.
[0604] The first communication interface 1201 is used for receiving and sending signals during the process of sending and receiving information with other external network elements;
[0605] The first memory 1202 is used to store computer programs that can run on the first processor 1203;
[0606] The first processor 1203 is configured to, when running the computer program, perform the following: determine multiple angle prediction modes corresponding to the current block; if the current block meets the PDP mode requirements and the first prediction mode among the multiple angle prediction modes is a mode that does not allow intra-frame prediction using a weight matrix, determine a second prediction mode based on the first prediction mode; wherein the second prediction mode is a mode that allows intra-frame prediction using a weight matrix; determine the weight matrix of the PDP mode based on the second prediction mode, and determine the first prediction block corresponding to the current block based on the weight matrix of the PDP mode; and determine the prediction block corresponding to the current block based on the weights of the first prediction block and the first prediction mode.
[0607] It is understood that the first memory 1202 in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The first memory 1202 of the system and method described in this application is intended to include, but is not limited to, these and any other suitable types of memory.
[0608] The first processor 1203 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the first processor 1203 or by instructions in software form. The first processor 1203 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in the first memory 1202. The first processor 1203 reads the information in the first memory 1202 and completes the steps of the above method in conjunction with its hardware.
[0609] It is understood that the embodiments described in this application can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application, or combinations thereof. For software implementation, the technology described in this application can be implemented through modules (e.g., procedures, functions, etc.) that perform the functions described in this application. Software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.
[0610] Alternatively, as another embodiment, the first processor 1203 is further configured to perform the method described in any of the foregoing embodiments when running the computer program.
[0611] In another embodiment of this application, based on the same inventive concept as the foregoing embodiments, FIG20 is a schematic diagram of the composition structure of a decoder provided in an embodiment of this application. As shown in FIG20, the decoder 200 may include a second determining part 2101, wherein:
[0612] The second determining part 2101 is configured to determine multiple angle prediction modes corresponding to the current block; if the current block meets the PDP mode requirements and the first prediction mode among the multiple angle prediction modes is a mode that does not allow the use of weight matrices for intra-frame prediction, a second prediction mode is determined based on the first prediction mode; wherein, the second prediction mode is a mode that allows the use of weight matrices for intra-frame prediction; the weight matrix of the PDP mode is determined based on the second prediction mode, and the first prediction block corresponding to the current block is determined based on the weight matrix of the PDP mode; the prediction block corresponding to the current block is determined based on the weights of the first prediction block and the first prediction mode.
[0613] Understandably, in this embodiment, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular component. Furthermore, the components in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional module.
[0614] If the integrated unit is implemented as a software functional module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, this embodiment provides a computer-readable storage medium applied to the decoder 200. This computer-readable storage medium stores a computer program, which, when executed by a second processor, implements the method described in any of the foregoing embodiments.
[0615] Based on the composition of the decoder 200 and the computer-readable storage medium described above, Figure 21 is a schematic diagram of the specific hardware structure of a decoder provided in an embodiment of this application. As shown in Figure 21, the decoder 200 may include: a second communication interface 2201, a second memory 2202, and a second processor 2203; the various components are coupled together through a second bus system 2204. It is understood that the second bus system 2204 is used to realize the connection and communication between these components. In addition to a data bus, the second bus system 2204 also includes a power bus, a control bus, and a status signal bus. However, for clarity, all buses are labeled as the second bus system 2204 in the figure.
[0616] The second communication interface 2201 is used for receiving and sending signals during the process of sending and receiving information with other external network elements;
[0617] The second memory 2202 is used to store computer programs that can run on the second processor 2203;
[0618] The second processor 2203, when running the computer program, performs the following: determining multiple angle prediction modes corresponding to the current block; if the current block meets the PDP mode requirements and the first prediction mode among the multiple angle prediction modes is a mode that does not allow intra-frame prediction using a weight matrix, determining a second prediction mode based on the first prediction mode; wherein the second prediction mode is a mode that allows intra-frame prediction using a weight matrix; determining the weight matrix of the PDP mode based on the second prediction mode, and determining the first prediction block corresponding to the current block based on the weight matrix of the PDP mode; and determining the prediction block corresponding to the current block based on the weights of the first prediction block and the first prediction mode.
[0619] Alternatively, as another embodiment, the second processor 2203 is also configured to perform the method described in any of the foregoing embodiments when running the computer program.
[0620] It is understood that the second memory 2202 has similar hardware functions to the first memory 1202, and the second processor 2203 has similar hardware functions to the first processor 1203; details will not be elaborated here.
[0621] In another embodiment of this application, FIG22 is a schematic diagram of the composition structure of an encoding and decoding system provided in an embodiment of this application. As shown in FIG22, the encoding and decoding system 300 may include an encoder 100 and a decoder 200.
[0622] In the embodiments of this application, the encoder 100 may be any one of the encoders described in the foregoing embodiments, and the decoder 200 may be any one of the decoders described in the foregoing embodiments.
[0623] Furthermore, embodiments of this application also propose a bitstream, wherein the bitstream is generated by bit encoding based on information to be encoded; wherein the information to be encoded includes at least: first syntax element identification information and second syntax element identification information.
[0624] Furthermore, this embodiment provides a computer-readable storage medium for storing a bitstream generated by any of the encoding methods in the foregoing embodiments.
[0625] It should be noted that, in this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0626] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0627] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0628] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0629] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method or device embodiments.
[0630] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims. Industrial applicability
[0631] This application provides an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium. The encoder / decoder determines multiple angle prediction modes corresponding to the current block. If the current block meets the PDP mode requirements, and the first prediction mode among the multiple angle prediction modes is a mode that does not allow intra-frame prediction using a weight matrix, a second prediction mode is determined based on the first prediction mode. The second prediction mode is a mode that allows intra-frame prediction using a weight matrix. A weight matrix for the PDP mode is determined based on the second prediction mode, and a first prediction block corresponding to the current block is determined based on the weight matrix of the PDP mode. The prediction block corresponding to the current block is determined based on the weights of the first prediction block and the first prediction mode. In other words, in the embodiments of this application, for any angle prediction mode in the current block that is not applicable to the PDP mode, it can be extended to the PDP mode to determine the corresponding effective intra-frame prediction mode, and intra-frame prediction is performed using the extended effective intra-frame prediction mode. Therefore, in this application, for angle prediction modes that are not effective under the PDP mode, intra-frame prediction under the PDP mode can be achieved through PDP mode extension, resulting in more accurate prediction results and thus improving encoding / decoding performance.
Claims
1. A decoding method applied to a decoder, the method comprising: Determine multiple angle prediction modes corresponding to the current block; If the current block meets the PDP mode requirements and the first prediction mode among the multiple angle prediction modes is a mode that does not allow intra-frame prediction using a weight matrix, a second prediction mode is determined based on the first prediction mode; wherein, the second prediction mode is a mode that allows intra-frame prediction using a weight matrix. The weight matrix of the PDP mode is determined based on the second prediction mode, and the first prediction block corresponding to the current block is determined based on the weight matrix of the PDP mode. Based on the weights of the first prediction block and the first prediction mode, the prediction block corresponding to the current block is determined.
2. The method according to claim 1, wherein, Determining the second prediction mode based on the first prediction mode includes: Based on the first prediction mode and the offset value, candidate prediction modes are determined; The second prediction mode is determined based on the candidate prediction modes.
3. The method according to claim 2, wherein, The offset value includes a first offset value and / or a second offset value; wherein... The first offset value is the offset value corresponding to the first prediction mode belonging to the first prediction mode set; The second offset value is the offset value corresponding to the case where the first prediction mode belongs to the second prediction mode set.
4. The method according to claim 2, wherein, The offset value is determined by the angle offset index corresponding to the first prediction mode; wherein, When the angle offset index is odd, the offset value is a first offset value, used to indicate the first offset direction and the first offset step size; When the angle offset index is even, the offset value is a second offset value, used to indicate the second offset direction and the second offset step size.
5. The method according to claim 2, wherein, Determining the second prediction mode based on the candidate prediction modes includes: If the candidate prediction mode belongs to the first angle mode set and the candidate prediction mode is a mode that allows intra-frame prediction using a weight matrix, then the candidate prediction mode is determined as the second prediction mode.
6. The method according to claim 3 or 4, wherein, The method further includes: If the candidate prediction mode determined based on the first offset value does not belong to the first angle mode set or is a mode that does not allow intra-frame prediction using a weight matrix, the second prediction mode is determined according to the second offset value. If the candidate prediction mode determined based on the second offset value does not belong to the first angle mode set or is a mode that does not allow intra-frame prediction using a weight matrix, the second prediction mode is determined according to the first offset value.
7. The method according to claim 1, wherein, Determining the second prediction mode based on the first prediction mode includes: Based on the size parameters of the current block and the first prediction mode, a candidate prediction mode is determined; The second prediction mode is determined based on the candidate prediction modes.
8. The method according to claim 7, wherein, The step of determining candidate prediction modes based on the size parameters of the current block and the first prediction mode includes: Based on the size parameters and the first prediction mode, the mode determination parameters are determined; Based on the pattern, parameters are determined, and candidate prediction patterns are identified.
9. The method according to claim 7, wherein, Determining the second prediction mode based on the candidate prediction modes includes: If the candidate prediction pattern belongs to the first angle pattern set, the candidate prediction pattern is determined as the second prediction pattern.
10. The method according to claim 8, wherein, Determining the second prediction mode based on the candidate prediction modes includes: If the candidate prediction mode does not belong to the first angle mode set, the candidate prediction mode is re-determined based on the size parameter and the mode determination parameter. The second prediction mode is determined based on the redefined candidate prediction mode.
11. The method according to claim 2 or 7, wherein, The method further includes: The valid identifier of the intra-prediction mode in the second angle mode set is initialized to the first value.
12. The method according to claim 11, wherein, The method further includes: When the first prediction mode is a mode that allows intra-frame prediction using a weight matrix, the valid identifier of the first prediction mode is set to a second value; wherein the first value is different from the second value.
13. The method according to claim 11, wherein, The method further includes: Set the valid identifier of the second prediction mode to the second value.
14. The method according to claim 11, wherein, Determining the second prediction mode based on the candidate prediction modes includes: If the candidate prediction mode belongs to the first angle mode set, the valid identifier of the candidate prediction mode is a first value, and the candidate prediction mode is a mode that allows intra-frame prediction using a weight matrix, then the candidate prediction mode is determined as the second prediction mode.
15. The method according to claim 11, wherein, Determining the second prediction mode based on the candidate prediction modes includes: If the candidate prediction mode belongs to the first angle mode set and the valid identifier of the candidate prediction mode is a first value, the candidate prediction mode is determined as the second prediction mode.
16. The method according to claim 1, wherein, Determining the prediction block corresponding to the current block based on the weights of the first prediction block and the first prediction mode includes: Determine multiple prediction blocks corresponding to the multiple angle prediction modes; wherein, the multiple prediction blocks include the first prediction block; Based on the multiple prediction blocks and the multiple angle prediction modes, the prediction block corresponding to the current block is determined; wherein, the multiple weights include the weights of the first prediction mode.
17. The method according to any one of claims 1-5, 7-10, 12-16, wherein, The mode that allows intra-frame prediction using a weight matrix is determined based on the size parameter of the current block.
18. The method according to claim 1, wherein, The method further includes: Decode the bitstream to determine the first syntax element identifier information; When the first syntax element identification information indicates that the current block uses DIMD for intra-frame prediction, the first prediction block is determined by the second prediction mode.
19. The method according to claim 1, wherein, The method further includes: Decode the bitstream to determine the identification information of the second syntax element; When the second syntax element identification information indicates that the current block uses OBIC for intra-frame prediction, the first prediction block is determined by the second prediction mode.
20. The method according to claim 1, wherein, The method further includes: The first prediction mode is used for intra-frame prediction of the block to be reconstructed in the current image; and / or, The second prediction mode is used for intra-frame prediction of the block to be reconstructed in the current image.
21. An encoding method applied to an encoder, the method comprising: Determine multiple angle prediction modes corresponding to the current block; If the current block meets the PDP mode requirements and the first prediction mode among the multiple angle prediction modes is a mode that does not allow intra-frame prediction using a weight matrix, a second prediction mode is determined based on the first prediction mode; wherein, the second prediction mode is a mode that allows intra-frame prediction using a weight matrix. The weight matrix of the PDP mode is determined based on the second prediction mode, and the first prediction block corresponding to the current block is determined based on the weight matrix of the PDP mode. Based on the weights of the first prediction block and the first prediction mode, the prediction block corresponding to the current block is determined.
22. The method according to claim 21, wherein, Determining the second prediction mode based on the first prediction mode includes: Based on the first prediction mode and the offset value, candidate prediction modes are determined; The second prediction mode is determined based on the candidate prediction modes.
23. The method according to claim 22, wherein, The offset value includes a first offset value and / or a second offset value; wherein... The first offset value is the offset value corresponding to the first prediction mode belonging to the first prediction mode set; The second offset value is the offset value corresponding to the case where the first prediction mode belongs to the second prediction mode set.
24. The method according to claim 22, wherein, The offset value is determined by the angle offset index corresponding to the first prediction mode; wherein, When the angle offset index is odd, the offset value is a first offset value, used to indicate the first offset direction and the first offset step size; When the angle offset index is even, the offset value is a second offset value, used to indicate the second offset direction and the second offset step size.
25. The method according to claim 22, wherein, Determining the second prediction mode based on the candidate prediction modes includes: If the candidate prediction mode belongs to the first angle mode set and the candidate prediction mode is a mode that allows intra-frame prediction using a weight matrix, then the candidate prediction mode is determined as the second prediction mode.
26. The method according to claim 23 or 24, wherein, The method further includes: if the candidate prediction mode determined based on the offset value does not belong to the first angle mode set or is a mode that does not allow intra-frame prediction using a weight matrix, then the second prediction mode is determined according to the second offset value. If the candidate prediction mode determined based on the two offset values does not belong to the first angle mode set or is a mode that does not allow intra-frame prediction using a weight matrix, the second prediction mode is determined according to the first offset value.
27. The method according to claim 21, wherein, Determining the second prediction mode based on the first prediction mode includes: Based on the size parameters of the current block and the first prediction mode, a candidate prediction mode is determined; The second prediction mode is determined based on the candidate prediction modes.
28. The method according to claim 27, wherein, The step of determining candidate prediction modes based on the size parameters of the current block and the first prediction mode includes: Based on the size parameters and the first prediction mode, the mode determination parameters are determined; Based on the pattern, parameters are determined, and candidate prediction patterns are identified.
29. The method according to claim 27, wherein, Determining the second prediction mode based on the candidate prediction modes includes: If the candidate prediction pattern belongs to the first angle pattern set, the candidate prediction pattern is determined as the second prediction pattern.
30. The method according to claim 28, wherein, Determining the second prediction mode based on the candidate prediction modes includes: If the candidate prediction mode does not belong to the first angle mode set, the candidate prediction mode is re-determined based on the size parameter and the mode determination parameter. The second prediction mode is determined based on the redefined candidate prediction mode.
31. The method according to claim 22 or 27, wherein, The method further includes: The valid identifier of the intra-prediction mode in the second angle mode set is initialized to the first value.
32. The method according to claim 31, wherein, The method further includes: When the first prediction mode is a mode that allows intra-frame prediction using a weight matrix, the valid identifier of the first prediction mode is set to a second value; wherein the first value is different from the second value.
33. The method according to claim 31, wherein, The method further includes: Set the valid identifier of the second prediction mode to the second value.
34. The method according to claim 31, wherein, Determining the second prediction mode based on the candidate prediction modes includes: If the candidate prediction mode belongs to the first angle mode set, the valid identifier of the candidate prediction mode is a first value, and the candidate prediction mode is a mode that allows intra-frame prediction using a weight matrix, then the candidate prediction mode is determined as the second prediction mode.
35. The method according to claim 31, wherein, Determining the second prediction mode based on the candidate prediction modes includes: If the candidate prediction mode belongs to the first angle mode set and the valid identifier of the candidate prediction mode is a first value, the candidate prediction mode is determined as the second prediction mode.
36. The method according to claim 21, wherein, Determining the prediction block corresponding to the current block based on the weights of the first prediction block and the first prediction mode includes: Determine multiple prediction blocks corresponding to the multiple angle prediction modes; wherein, the multiple prediction blocks include the first prediction block; Based on the multiple prediction blocks and the multiple angle prediction modes, the prediction block corresponding to the current block is determined; wherein, the multiple weights include the weights of the first prediction mode.
37. The method according to any one of claims 21-25, 27-30, 32-36, wherein, The mode that allows intra-frame prediction using a weight matrix is determined based on the size parameter of the current block.
38. The method according to claim 21, wherein, The method further includes: If it is determined that the current block uses DIMD for intra-frame prediction, the first prediction block is determined by the second prediction mode; Write the first syntax element identification information into the bitstream; wherein the first syntax element identification information indicates that the current block uses DIMD for intra-frame prediction.
39. The method according to claim 21, wherein, The method further includes: If it is determined that the current block uses OBIC for intra-frame prediction, the first prediction block is determined by the second prediction mode; Write the second syntax element identification information into the bitstream; wherein the second syntax element identification information indicates that the current block uses OBIC for intra-frame prediction.
40. The method according to claim 21, wherein, The method further includes: The first prediction mode is used for intra-frame prediction of the block to be reconstructed in the current image; and / or, The second prediction mode is used for intra-frame prediction of the block to be reconstructed in the current image.
41. A bitstream, wherein, The bitstream is generated by bit encoding based on the information to be encoded; wherein the information to be encoded includes at least one of the following: first syntax element identification information and second syntax element identification information.
42. An encoder, wherein, The encoder includes: The first determining part is configured to determine multiple angle prediction modes corresponding to the current block; if the current block meets the PDP mode requirements and the first prediction mode among the multiple angle prediction modes is a mode that does not allow intra-frame prediction using a weight matrix, a second prediction mode is determined based on the first prediction mode; wherein, the second prediction mode is a mode that allows intra-frame prediction using a weight matrix; a weight matrix of the PDP mode is determined based on the second prediction mode, and a first prediction block corresponding to the current block is determined based on the weight matrix of the PDP mode; a prediction block corresponding to the current block is determined based on the weights of the first prediction block and the first prediction mode.
43. An encoder, wherein, The encoder includes: a first memory and a first processor; wherein, A first memory for storing computer programs that can run on a first processor; A first processor is configured to, while running the computer program, perform the method as described in any one of claims 21-40.
44. A decoder, wherein, The decoder includes: The second determining part is configured to determine multiple angle prediction modes corresponding to the current block; if the current block meets the PDP mode requirements and the first prediction mode among the multiple angle prediction modes is a mode that does not allow intra-frame prediction using a weight matrix, a second prediction mode is determined based on the first prediction mode; wherein, the second prediction mode is a mode that allows intra-frame prediction using a weight matrix; a weight matrix of the PDP mode is determined based on the second prediction mode, and a first prediction block corresponding to the current block is determined based on the weight matrix of the PDP mode; a prediction block corresponding to the current block is determined based on the weights of the first prediction block and the first prediction mode.
45. A decoder, wherein, The decoder includes: a second memory and a second processor; wherein... The second memory is used to store computer programs that can run on the second processor; A second processor is configured to, while running the computer program, perform the method as described in any one of claims 1-20.
46. A computer-readable storage medium storing a computer program that, when executed, implements the decoding method as described in any one of claims 1-20, or the encoding method as described in any one of claims 21-40.
47. A computer-readable storage medium for storing a bitstream generated by the encoding method of any one of claims 21-40.