Image Component Prediction Method, Encoder, Decoder, and Storage Medium
By determining the MIP weight matrix, shift factor and MIP input sampling matrix of the current block in H.266/VVC, the shift factor determination in the matrix multiplication process is simplified, the problem of high computational complexity is solved, and the encoding and decoding efficiency is improved.
Patent Information
- Application Number
- CN202310372089.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2019-07-11
- Filing Date
- 2020-05-15
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2040-05-15
AI Technical Summary
In the matrix multiplication process in H.266/VVC, the determination of the shift factor is related to the block type and the prediction mode index number, resulting in cumbersome prediction process and high computational complexity.
By determining the MIP weight matrix, shift factor and MIP input sampling matrix of the current block, the way to determine the shift factor is simplified, and when determining the shift factor using the lookup table, it reduces the calculation complexity and memory usage of the lookup table storage.
The process of determining the shift factor is simplified, the computational complexity is reduced, and the memory usage of lookup table storage is reduced, thereby improving the encoding and decoding efficiency.
Smart Images

Figure CN116389725B_ABST
Abstract
Description
[0001] Division Explanation
[0002] This application is a divisional application of Chinese Patent Application No. 202080004757.1, with the invention title of "Image Component Prediction Method, Encoder, Decoder and Storage Medium", which enters the Chinese national phase based on the PCT international patent application PCT / CN2020 / 090688 with the filing date of May 15, 2020.
[0003] This application is a divisional application of a Chinese patent with the filing date of May 15, 2020, application number 202110469722.1, and invention title of "Image Component Prediction Method, Encoder, Decoder and Storage Medium".
[0004] Cross - reference to Related Applications
[0005] 1) A prior U.S. Provisional Patent Application titled "Matrix - Based Intra Prediction (MIP) Shift Unification According to Block Size and Mode Index" with the application number 62 / 872,488, filed on July 10, 2019, in the name of Junyan Huo, Yanzhuo Ma, and Wei Zhang;
[0006] 2) A prior U.S. Provisional Patent Application titled "Methods and Apparatuses for Matrix - Based Intra Prediction (MIP) Shift Unification" with the application number 62 / 872,830, filed on July 11, 2019, in the name of Junyan Huo, Yanzhuo Ma, and Wei Zhang;
[0007] 3) A prior U.S. Provisional Patent Application titled "Methods and Apparatuses for Matrix - Based Intra Prediction (MIP) Shift Unification" with the application number 62 / 873,170, filed on July 11, 2019, in the name of Junyan Huo, Yanzhuo Ma, and Wei Zhang. Technical Field
[0008] The embodiments of this application relate to the field of video coding and decoding technologies, and particularly to an image component prediction method, encoder, decoder, and storage medium. Background Art
[0009] With the improvement of people's requirements for video display quality, new video application forms such as high-definition and ultra-high-definition videos have emerged as the times require. H.265 / High Efficiency Video Coding (HEVC) can no longer meet the rapidly developing needs of video applications. The Joint Video Exploration Team (JVET) has proposed the next-generation video coding standard H.266 / Versatile Video Coding (VVC), and its corresponding test model is the VVC Test Model (VTM).
[0010] In H.266 / VVC, the Matrix-based IntraPrediction (MIP) technology has been accepted. This technology adds different numbers of MIP prediction modes during the intra prediction process according to the type of the current intra block. However, during the MIP prediction process, especially the determination of the shift factor in the matrix multiplication process is also related to the type of the current block and the index number of the MIP prediction mode, making the prediction process more cumbersome and increasing the computational complexity. Summary of the Invention
[0011] Embodiments of the present application provide an image component prediction method, an encoder, a decoder, and a storage medium, which can simplify the determination method of the shift factor, and when using a lookup table to determine the shift factor, can also reduce the computational complexity while reducing the memory occupied by the lookup table storage.
[0012] The technical solution of the embodiments of the present application can be implemented as follows:
[0013] In a first aspect, embodiments of the present application provide an image component prediction method, which is applied to an encoder, and the method includes:
[0014] Determine the prediction parameters of the current block, where the prediction parameters include a prediction mode parameter and a size parameter of the current block;
[0015] When the prediction mode parameter indicates using the Matrix-based IntraPrediction (MIP) mode to determine the intra prediction value of the current block, determine the MIP weight matrix of the current block, the shift factor of the current block, and the MIP input sampling matrix of the current block;
[0016] Determine the intra prediction value of the current block according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix.
[0017] Second aspect, an embodiment of the present application provides an image component prediction method, which is applied to a decoder. The method includes:
[0018] Parse the code stream to obtain the prediction parameters of the current block, where the prediction parameters include a prediction mode parameter and the size parameter of the current block;
[0019] When the prediction mode parameter indicates using the matrix-based intra prediction (MIP) mode to determine the intra prediction value of the current block, determine the MIP weight matrix of the current block, the shift factor of the current block, and the MIP input sampling matrix of the current block;
[0020] Determine the intra prediction value of the current block according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix.
[0021] Third aspect, an embodiment of the present application provides an encoder, which includes a first determination unit and a first prediction unit; wherein,
[0022] The first determination unit is configured to determine the prediction parameters of the current block, where the prediction parameters include a prediction mode parameter and the size parameter of the current block;
[0023] The first determination unit is further configured to, when the prediction mode parameter indicates using the matrix-based intra prediction (MIP) mode to determine the intra prediction value of the current block, determine the MIP weight matrix of the current block, the shift factor of the current block, and the MIP input sampling matrix of the current block;
[0024] The first prediction unit is configured to determine the intra prediction value of the current block according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix.
[0025] Fourth aspect, an embodiment of the present application provides an encoder, which includes a first memory and a first processor; wherein,
[0026] The first memory is used to store a computer program that can run on the first processor;
[0027] The first processor is configured to execute the method described in the first aspect when running the computer program.
[0028] Fifth aspect, an embodiment of the present application provides a decoder, which includes a parsing unit, a second determination unit, and a second prediction unit; wherein,
[0029] The parsing unit is configured to parse the code stream to obtain the prediction parameters of the current block, where the prediction parameters include a prediction mode parameter and the size parameter of the current block;
[0030] The second determination unit is configured to determine the MIP weight matrix, the shift factor, and the MIP input sampling matrix of the current block when the prediction mode parameter indicates that the matrix-based intra prediction (MIP) mode is used to determine the intra prediction value of the current block;
[0031] The second prediction unit is configured to determine the intra prediction value of the current block according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix.
[0032] In a sixth aspect, an embodiment of the present application provides a decoder, which includes a second memory and a second processor; wherein,
[0033] The second memory is used to store a computer program that can run on the second processor;
[0034] The second processor is configured to execute the method described in the second aspect when running the computer program.
[0035] In a seventh aspect, an embodiment of the present application provides a computer storage medium, which stores a computer program. When the computer program is executed by a first processor, it implements the method described in the first aspect, or when executed by a second processor, it implements the method described in the second aspect.
[0036] An embodiment of the present application provides an image component prediction method, an encoder, a decoder, and a storage medium. On the encoder side, prediction parameters of a current block are determined, where the prediction parameters include a prediction mode parameter and a size parameter of the current block; when the prediction mode parameter indicates that the matrix-based intra prediction (MIP) mode is used to determine the intra prediction value of the current block, the MIP weight matrix, the shift factor, and the MIP input sampling matrix of the current block are determined; the intra prediction value of the current block is determined according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix. On the decoder side, a bitstream is parsed to obtain the prediction parameters of the current block, where the prediction parameters include a prediction mode parameter and a size parameter of the current block; when the prediction mode parameter indicates that the matrix-based intra prediction (MIP) mode is used to determine the intra prediction value of the current block, the MIP weight matrix, the shift factor, and the MIP input sampling matrix of the current block are determined; the intra prediction value of the current block is determined according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix. In this way, on both the decoder side and the encoder side, the determination method of the shift factor can be simplified, and when a lookup table is used to determine the shift factor, the memory occupied by the lookup table storage can be reduced while reducing the calculation complexity, so as to achieve the purpose of improving the encoding and decoding efficiency. Description of the Drawings
[0037] Figure 1 A flowchart of a MIP prediction process provided for related technical solutions;
[0038] Figure 2A A block diagram of the composition of a video coding system provided for an embodiment of the present application;
[0039] Figure 2B A block diagram of the composition of a video decoding system provided for an embodiment of the present application;
[0040] Figure 3 A schematic flowchart of an image component prediction method provided for an embodiment of the present application;
[0041] Figure 4 A schematic structural diagram of generating an intra prediction value provided for an embodiment of the present application;
[0042] Figure 5 A schematic flowchart of another image component prediction method provided for an embodiment of the present application;
[0043] Figure 6 A schematic structural diagram of the composition of an encoder provided for an embodiment of the present application;
[0044] Figure 7 A schematic structural diagram of the composition of another encoder provided for an embodiment of the present application;
[0045] Figure 8 A schematic diagram of the specific hardware structure of an encoder provided for an embodiment of the present application;
[0046] Figure 9 A schematic structural diagram of the composition of a decoder provided for an embodiment of the present application;
[0047] Figure 10 A schematic structural diagram of the composition of a decoder provided for an embodiment of the present application;
[0048] Figure 11 A schematic diagram of the specific hardware structure of a decoder provided for an embodiment of the present application. Detailed implementation manners
[0049] In order to be able to understand the features and technical content of the embodiments of the present application in more detail, the implementation of the embodiments of the present application will be described in detail below with reference to the accompanying drawings. The accompanying drawings are only for reference and explanation, and are not used to limit the embodiments of the present application.
[0050] In a video image, generally, a coding block (CB) is characterized by a first image component, a second image component, and a third image component; among them, these three image components are respectively a luminance component, a blue chrominance component, and a red chrominance component. Specifically, the luminance component is usually denoted by the symbol Y, the blue chrominance component is usually denoted by the symbol Cb or U, and the red chrominance component is usually denoted by the symbol Cr or V; in this way, the video image can be represented in the YCbCr format or the YUV format.
[0051] In the embodiments of the present application, the first image component may be a luminance component, the second image component may be a blue chrominance component, and the third image component may be a red chrominance component, but the embodiments of the present application do not make specific limitations.
[0052] The related technical solutions for the prediction process of the current MIP technology will be described below.
[0053] The input data for MIP prediction mainly includes: the position of the current block (xTbCmp, yTbCmp), the MIP mode index value when the current block uses MIP prediction (which can be denoted by modeId or modeIdx), the height of the current block (denoted by nTbH), the width of the current block (denoted by nTbW), and the transpose processing indication flag indicating whether transpose is required (which can be denoted by isTransposed), etc.
[0054] The output data of MIP prediction mainly includes the predicted block of the current block, and the predicted value corresponding to the pixel coordinates [x][y] in the predicted block is predSamples[x][y]; where x = 0, 1,..., nTbW - 1; y = 0, 1,..., nTbH - 1.
[0055] Here, as Figure 1As shown in the figure, the MIP prediction process can be divided into four steps: configuring core parameters 11, obtaining reference pixels 12, constructing input samples 13, and generating intra-prediction values 14. Specifically, for configuring core parameters 11, according to the size of the current intra-block, the current block can be divided into three categories, and the mipSizeId or blocksizeIdx is used as the block size index value to record the type of the current block; moreover, for the current blocks corresponding to different block size index values, the number of reference sampling points and the number of matrix multiplication output sampling points are different. For obtaining reference pixels 12, when predicting the current block, at this time the upper block and the left block of the current block are both encoded blocks, and the reference pixels of the MIP technology are the reconstructed values of the pixels in the upper row and the left column of the current block. The process of obtaining the reference pixels adjacent to the upper side of the current block (denoted by refT) and the reference pixels adjacent to the left side (denoted by refL) is the process of obtaining reference pixels. For constructing input samples 13, this step is used for the input of matrix multiplication, and mainly includes: obtaining reference samples 131, constructing a reference sample buffer 132, and deriving matrix multiplication input samples 133; among them, the process of obtaining reference samples is a downsampling process, and constructing the reference sample buffer 132 can further include the filling method 1321 of the buffer when no transposition is required and the filling method 1322 of the buffer when transposition is required. For generating intra-prediction values 14, this step is used to obtain the MIP prediction value of the current block, and mainly includes: constructing a matrix multiplication output sample block 141, matrix multiplication output sample clamping 142, matrix multiplication output sample transposition 143, and generating the MIP final prediction value 144; among them, constructing the matrix multiplication output sample block 141 can further include obtaining a weight matrix 1411, obtaining shift factors and offset factors 1412, and matrix multiplication operations 1413, and generating the MIP final prediction value 144 can further include generating prediction values that do not require upsampling 1441 and generating prediction values that require upsampling 1442. In this way, after these four steps, the intra-prediction value of at least one pixel in the current block can be obtained.
[0056] In the MIP prediction process as shown in Figure 1 the figure, the MIP prediction can be expressed by the following formula,
[0057] P = M × R (1)
[0058] where M is a matrix, R is an input sampling vector derived from reference sample pixels, P is a predicted pixel value derived according to formula (1), that is, MIP is an encoding tool that can be used to derive an intra-prediction signal including matrix multiplication, and each specific matrix M corresponds to a MIP mode.
[0059] However, since the coefficients of the matrix are initially trained as floating-point values. But during computer processing, these coefficients need to be stored and calculated as integer values. A common way to convert floating-point values to integer values is to multiply the floating-point value by a large enough value to retain appropriate precision, which is usually called a shift operation. Specifically, a left shift operation is designed to derive an integer value and can be achieved by the following formula,
[0060] VAL = val × (1 << shift) (2)
[0061] where val is the floating matrix value, shift is the number of shift bits in the shift operation (which can also be simply called the shift factor), VAL is the stored integer value, and "<< " represents the left shift operator.
[0062] In this way, after obtaining the integer matrix, integer matrix multiplication can be performed; finally, a right shift operation is performed on P to obtain the final MIP prediction value. The calculation formula for the whole process is as follows,
[0063] P = (M*(1<<shift) × R)>>shift (3)
[0064] Or,
[0065] P = (M*(1<<shift) × R+(1<<(shift-1)))>>shift (4)
[0066] where (1<<(shift-1)) represents a rounding operation, and ">> " represents the right shift operator. However, in the latest MIP version, for different block size sizes and different MIP modes, the corresponding shift values in the shift operations of the above formula (3) or formula (4) are different. That is to say, the current shift factor is closely related to the index numbers of the current block type and the MIP prediction mode, making the prediction process more cumbersome and increasing the computational complexity.
[0067] The embodiments of the present application provide an image component prediction method, which is applied to an encoder or a decoder. After obtaining the prediction parameters of the current block, when the prediction mode parameter in the prediction parameters indicates using the MIP mode to determine the intra-frame prediction value of the current block, the MIP weight matrix of the current block, the shift factor of the current block, and the MIP input sampling matrix of the current block can be determined; then, according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix, the intra-frame prediction value of the current block is determined. In this way, whether on the decoder side or the encoder side, the determination method of the shift factor can be simplified, and when using a lookup table to determine the shift factor, the memory occupied by the lookup table storage can be reduced while reducing the computational complexity, so as to achieve the purpose of improving the encoding and decoding efficiency.
[0068] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0069] Refer to Figure 2A , which shows an example of a block diagram of the composition of a video coding system provided by an embodiment of the present application; as Figure 2AAs shown, the video encoding system 10 includes a transform and quantization unit 101, an intra prediction estimation unit 102, an intra prediction unit 103, a motion compensation unit 104, a motion estimation unit 105, an inverse transform and inverse quantization unit 106, a filter control analysis unit 107, a filtering unit 108, an encoding unit 109, a decoded image buffer unit 110, etc. Among them, the filtering unit 108 can implement deblocking filtering and sample adaptive offset (SAO) filtering, and the encoding unit 109 can implement header information encoding and context-based adaptive binary arithmetic coding (CABAC). For the input original video signal, a video coding block can be obtained through the division of a coding tree unit (CTU). Then, the residual pixel information obtained after intra-frame or inter-frame prediction is transformed by the transform and quantization unit 101 for the video coding block, including transforming the residual information from the pixel domain to the transform domain and quantizing the obtained transform coefficients to further reduce the bit rate; the intra prediction estimation unit 102 and the intra prediction unit 103 are used for intra-frame prediction of the video coding block; specifically, the intra prediction estimation unit 102 and the intra prediction unit 103 are used to determine the intra-frame prediction mode to be used for encoding the video coding block; the motion compensation unit 104 and the motion estimation unit 105 are used to perform inter-frame predictive coding of the received video coding block relative to one or more blocks in one or more reference frames to provide temporal prediction information; the motion estimation performed by the motion estimation unit 105 is a process of generating a motion vector, and the motion vector can estimate the motion of the video coding block, and then the motion compensation unit 104 performs motion compensation based on the motion vector determined by the motion estimation unit 105; after determining the intra-frame prediction mode, the intra prediction unit 103 is further used to provide the selected intra-frame prediction data to the encoding unit 109, and the motion estimation unit 105 also sends the calculated and determined motion vector data to the encoding unit 109; in addition, the inverse transform and inverse quantization unit 106 is used for the reconstruction of the video coding block, reconstructing the residual block in the pixel domain, and the reconstructed residual block removes block effect artifacts through the filter control analysis unit 107 and the filtering unit 108, and then adds the reconstructed residual block to a predictive block in the frame of the decoded image buffer unit 110 to generate a reconstructed video coding block; the encoding unit 109 is used to encode various coding parameters and the quantized transform coefficients. In the CABAC-based coding algorithm, the context can be based on adjacent coding blocks and can be used to encode information indicating the determined intra-frame prediction mode, and output the bitstream of the video signal; while the decoded image buffer unit 110 is used to store the reconstructed video coding block for prediction reference.As video image encoding progresses, new reconstructed video coding blocks are continuously generated, and these reconstructed video coding blocks are all stored in the decoded picture buffer unit 110.
[0070] See Figure 2B , which shows an example of the block diagram of a video decoding system provided by an embodiment of the present application; as Figure 2B shown, the video decoding system 20 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra prediction unit 203, a motion compensation unit 204, a filtering unit 205, a decoded picture buffer unit 206, etc. Among them, the decoding unit 201 can implement header information decoding and CABAC decoding, and the filtering unit 205 can implement deblocking filtering and SAO filtering. After the input video signal undergoes Figure 2A encoding processing, the bitstream of the video signal is output; the bitstream is input into the video decoding system 20, and first passes through the decoding unit 201 to obtain the decoded transform coefficients; the inverse transform and inverse quantization unit 202 processes the transform coefficients to generate a residual block in the pixel domain; the intra prediction unit 203 can be used to generate prediction data of the current video decoding block based on the determined intra prediction mode and data from previously decoded blocks of the current frame or picture; the motion compensation unit 204 determines the prediction information for the video decoding block by analyzing the motion vector and other associated syntax elements, and uses the prediction information to generate a predictive block of the video decoding block being decoded; by summing the residual block from the inverse transform and inverse quantization unit 202 and the corresponding predictive block generated by the intra prediction unit 203 or the motion compensation unit 204, a decoded video block is formed; the decoded video signal passes through the filtering unit 205 to remove block effect artifacts, which can improve the video quality; then the decoded video block is stored in the decoded picture buffer unit 206, and the decoded picture buffer unit 206 stores the reference image for subsequent intra prediction or motion compensation, and is also used for the output of the video signal, that is, the original video signal is restored.
[0071] The image component prediction method in the embodiments of the present application is mainly applied to the intra prediction unit 103 part as Figure 2A shown and as Figure 2BThe intra prediction unit 203 part shown. That is to say, the image component prediction method in the embodiments of the present application can be applied to a video coding system, a video decoding system, or even both a video coding system and a video decoding system simultaneously, but the embodiments of the present application do not make specific limitations. It should also be noted that when the image component prediction method is applied to the intra prediction unit 103 part, the "current block" specifically refers to the current block to be encoded in intra prediction; when the image component prediction method is applied to the intra prediction unit 203 part, the "current block" specifically refers to the current block to be decoded in intra prediction.
[0072] Based on Figure 2A The application scenario example shown, see Figure 3 , which shows a schematic flowchart of an image component prediction method provided by the embodiments of the present application. As Figure 3 shown, the method may include:
[0073] S301: Determine the prediction parameters of the current block, where the prediction parameters include a prediction mode parameter and a size parameter of the current block;
[0074] It should be noted that this method is applied to an encoder. A video image can be divided into multiple image blocks, and each current image block to be encoded can be called a coding block (CB). Here, each coding block may include a first image component, a second image component, and a third image component; and the current block is the block to be encoded in the video image for which the first image component, the second image component, or the third image component is to be predicted.
[0075] Among them, assuming that the current block performs first image component prediction and the first image component is a luminance component, that is, the image component to be predicted is a luminance component, then the current block can also be called a luminance block; or, assuming that the current block performs second image component prediction and the second image component is a chrominance component, that is, the image component to be predicted is a chrominance component, then the current block can also be called a chrominance block.
[0076] It should also be noted that the prediction parameters indicate the prediction mode adopted by the current block and the parameters related to this prediction mode. Here, for the determination of the prediction parameters, a simple decision strategy can be adopted, such as determining according to the magnitude of the distortion value; or a complex decision strategy can be adopted, such as determining according to the result of rate distortion optimization (RDO), and the embodiments of the present application do not make any limitations. Generally speaking, the RDO method can be used to determine the prediction parameters of the current block.
[0077] Specifically, in some embodiments, for S301, the determination of the prediction parameters of the current block may include:
[0078] The current block is pre - coded using multiple prediction modes to obtain the rate - distortion cost value corresponding to each prediction mode.
[0079] The minimum rate - distortion cost value is selected from the obtained multiple rate - distortion cost values, and the prediction parameters under the prediction mode corresponding to the minimum rate - distortion cost value are determined as the prediction parameters of the current block.
[0080] That is to say, on the encoder side, multiple prediction modes can be used to pre - code the current block respectively. Here, multiple prediction modes usually include inter - frame prediction mode and intra - frame prediction mode. The intra - frame prediction mode can further include traditional intra - frame prediction mode and non - traditional intra - frame prediction mode. Specifically, the traditional intra - frame prediction mode can include Direct Current (DC) mode, PLANAR mode, and angular mode, etc. The non - traditional intra - frame prediction mode can include Matrix - based Intra Prediction (MIP) mode, Cross - component Linear Model Prediction (CCLM) mode, IntraBlock Copy (IBC) mode, and PLT (Palette) mode, etc. And the inter - frame prediction mode can include traditional inter - frame prediction mode and Geometrical partitioning for inter blocks (GEO) mode, etc.
[0081] In this way, after pre - coding the current block using multiple prediction modes respectively, the rate - distortion cost value corresponding to each prediction mode can be obtained; then the minimum rate - distortion cost value is selected from the obtained multiple rate - distortion cost values, and the prediction parameters under the prediction mode corresponding to the minimum rate - distortion cost value are determined as the prediction parameters of the current block. In addition, after pre - coding the current block using multiple prediction modes respectively, the distortion value corresponding to each prediction mode can be obtained; then the minimum distortion value is selected from the obtained multiple distortion values, and the prediction parameters under the prediction mode corresponding to the minimum distortion value are determined as the prediction parameters of the current block. Thus, finally, the current block is encoded using the determined prediction parameters, and in this prediction mode, the prediction residual can be made smaller, which can improve the coding efficiency.
[0082] S302: When the prediction mode parameter indicates using the Matrix - based Intra Prediction (MIP) mode to determine the intra - frame prediction value of the current block, determine the MIP weight matrix of the current block, the shift factor of the current block, and the MIP input sampling matrix of the current block.
[0083] It should be noted that for the current block, if the current block uses the MIP mode to determine the intra-prediction value of the current block, then at this time, it is necessary to determine the MIP input sampling matrix, the MIP weight matrix, and the shift factor of the current block; among them, the shift factor can also be called the shift bit number, the weight shift value, etc., and can be represented by sW, shift, or weight shift.
[0084] It should be understood that for the MIP mode, it is first necessary to configure the MIP core parameters. Here, the MIP mode can divide the current block into three categories according to the width and height of the current block, and use mipSizeId or BlocksizeIdx to represent the type of the current block, that is, the block size index value of the current block. For different block size index values, the number of reference samples (boundySize reference sampling points are required on each side), the number of input samples for matrix multiplication inSize, and the number of output samples for matrix multiplication (arranged in predSize×predSize) are different.
[0085] Optionally, in some embodiments, determining the block size index value of the current block according to the size parameter of the current block may include:
[0086] If the width and height of the current block are both equal to 4, then the block size index value of the current block can be set to 0;
[0087] Conversely, if the width and height of the current block are both equal to 8, or one of the width and height of the current block is equal to 4, then the block size index value of the current block can be set to 1;
[0088] Conversely, if the current block is a block of other sizes, then the block size index value of the current block can be set to 2.
[0089] Optionally, in some embodiments, determining the block size index value of the current block according to the size parameter of the current block may include:
[0090] If the width and height of the current block are both equal to 4, then the block size index value of the current block can be set to 0;
[0091] Conversely, if one of the width and height of the current block is equal to 4, then the block size index value of the current block can be set to 1;
[0092] Conversely, if the current block is a block of other sizes, then the block size index value of the current block can be set to 2.
[0093] Thus, according to the block size index value of the current block, based on the look-up table (LUT) shown in Table 1, the number of adjacent boundary reference samples (the variable is boundarySize) and the size of the MIP prediction block (the variable is predSize, and the size of the MIP prediction block is predSize×predSize) can be determined, and the number of input samples used in the MIP matrix multiplication operation process (denoted by inSize) can be calculated. The calculation formula is as follows.
[0094] inSize = (2×boundarySize)-(mipSizeId == 2)? 1:0 (5)
[0095] Among them, the operation rules of the operators in formula (5) are the same as those defined in the ITU-T H.265 standard. For example, "==" is the logical "equal to" operator.
[0096] Table 1
[0097] BlocksizeIdx boundarySize predSize 0 2 4 1 4 4 2 4 8
[0098] In this way, according to Table 1, when the value of BlocksizeIdx is 0, the value of boundarySize can be 2, and the value of predSize can be 4; that is to say, at this time, two pixel points are selected for each side of the reference pixels, and the matrix multiplication output is a 4×4 MIP prediction block; or, when the value of BlocksizeIdx is 1, the value of boundarySize can be 4, and the value of predSize can be 4; that is to say, at this time, four pixel points are selected for each side of the reference pixels, and the matrix multiplication output is a 4×4 MIP prediction block; or, when the value of BlocksizeIdx is 2, the value of boundarySize can be 4, and the value of predSize can be 8; that is to say, at this time, four pixel points are selected for each side of the reference pixels, and the matrix multiplication output is an 8×8 MIP prediction block.
[0099] In addition, according to the block size index value of the current block, based on the LUT shown in Table 2, the values of boundarySize, inSize, and predSize can also be determined.
[0100] Table 2
[0101] BlocksizeIdx boundarySize inSize predSize 0 2 4 4 1 4 8 4 2 4 7 8
[0102] Thus, according to Table 2, when the value of BlocksizeIdx is 0, the value of boundarySize can be 2, the value of inSize can be 4, and the value of predSize can be 4; that is, at this time, two pixel points are selected for each side as reference pixels, the number of input sampling points for matrix multiplication is four, and the matrix multiplication output is a 4×4 MIP prediction block; or, when the value of BlocksizeIdx is 1, the value of boundarySize can be 4, the value of inSize can be 8, and the value of predSize can be 4; that is, at this time, four pixel points are selected for each side as reference pixels, the number of input sampling points for matrix multiplication is eight, and the matrix multiplication output is a 4×4 MIP prediction block; or, when the value of BlocksizeIdx is 2, the value of boundarySize can be 4, the value of inSize can be 7, and the value of predSize can be 8; that is, at this time, four pixel points are selected for each side as reference pixels, the number of input sampling points for matrix multiplication is seven, and the matrix multiplication output is an 8×8 MIP prediction block.
[0103] Further, after configuring the MIP core parameters, it is also necessary to obtain reference pixels to construct the MIP input sampling matrix. Specifically, in some embodiments, determining the MIP input sampling matrix of the current block may include:
[0104] Determine the adjacent reference sampling set of the current block; wherein, the adjacent reference sampling set includes at least one reference sampling value;
[0105] Cache the adjacent reference sampling set to construct an input reference sample value set;
[0106] Determine the MIP input sampling matrix according to the input reference sample value set.
[0107] It should be noted that the input sampling for matrix multiplication (denoted by P) is the input for the matrix multiplication process; after multiplying with the corresponding matrix, the matrix multiplication output sampling (denoted by predMip) can be obtained. Among them, the matrix multiplication input sampling P is determined by a buffer (denoted by pTemp), the block size index value of the current block (denoted by BlocksizeIdx), and the bit depth value corresponding to the image component to be predicted (denoted by BitDepth), and the number of input reference samplings inSize included in the matrix multiplication input sampling P is only related to the block size index value of the current block. Finally, the x-th input sampling value (denoted by P[x]) in the input sampling matrix can be obtained.
[0108] Here, the specific construction process of the input sampling matrix P[x] is as follows.
[0109] When BlocksizeIdx = 0 or 1, the sample value at the zeroth position in pTemp needs to subtract (1 << (BitDepth - 1)) as the sample value at the zeroth position in the input sampling matrix, denoted as P[0]; then the sample value corresponding to each position in the other positions of the input sampling matrix needs to be obtained by subtracting the value at the zeroth position in pTemp from the sample value at the corresponding position in pTemp, which can be denoted as P[x]; specifically as follows,
[0110]
[0111] When BlocksizeIdx = 2, the sample value corresponding to each position in the other positions of the input sampling matrix is obtained by subtracting the sample value corresponding to the zeroth position in pTemp from the sample value at the position immediately following the corresponding position in pTemp; specifically as follows,
[0112] p[x] = pTemp[x + 1] - pTemp[0] for x = 0,...,inSize - 1 (7)
[0113] In this way, still taking the current 4×4 block as an example, there are four values stored in the buffer pTemp, but the number of input samples is four. At this time, according to Equation (3) or Equation (4), four input sample values can be determined, denoted as p[x], where x = 0, 1, 2, 3; thus, a 1×4 MIP input sampling matrix is obtained.
[0114] Furthermore, in the encoder, a weight matrix table is established in advance and stored in the encoder. In this way, according to the block size index value (BlocksizeIdx) and MIP mode index value (modeIdx) of the current block, the MIP weight matrix required for the current block can be determined by looking up the table, denoted as mWeight[x][y]. Among them, the size of the MIP weight matrix mWeight[x][y] is only related to the block size index value of the current block, as shown in Table 3; in this MIP weight matrix, the number of columns is the number of input samples inSize for matrix multiplication, and the number of rows is the number of output samples predSized×predSized, so that the MIP weight matrix of the current block can be determined.
[0115] Table 3
[0116] mipSizeId Number of columns Number of rows 0 4 16 1 8 16 2 7 64
[0117] Further, in the encoder, a shift table is also pre-established and stored in the encoder. Currently, in the latest MIP version, for different block size magnitudes and different MIP mode index numbers, the number of shift bits (i.e., the shift factor) in the shift operation is different. As shown in Table 4, according to the block size index value (BlocksizeIdx) and the MIP mode index value (modeIdx, which can also be simply referred to as modeId) of the current block, the shift factor required for matrix multiplication can be determined by means of a lookup table.
[0118] Table 4
[0119]
[0120] However, on the encoder side, Table 4 needs to be stored in the computer memory in the form of a lookup table; however, storage comes at a cost, and the lookup process also comes at a cost; since the shift factor in Table 4 is related to both the block size magnitude of the current block and the MIP mode index value, it increases the memory occupancy and also increases the computational complexity.
[0121] To reduce the memory occupancy and lower the computational complexity, the embodiments of the present application simplify the determination method of the shift factor. Specifically, in some embodiments, the shift factor of the current block may include a shift factor with a constant value and a shift factor determined according to prediction parameters.
[0122] In a possible implementation manner, the shift factor can be set to a fixed constant value. For example, for different block size index values and different MIP mode index values, the shift factor can be set to 5; or, for different block size index values and different MIP mode index values, the shift factor can be set to 6; or, for different block size index values and different MIP mode index values, the shift factor can be set to 7. In the embodiments of the present application, preferably, the value of the shift factor with a constant value is equal to 6, but no limitation is made thereto.
[0123] In another possible implementation manner, the shift factor determined according to the prediction parameters may include:
[0124] Determine the block size index value of the current block according to the size parameter of the current block;
[0125] Determine the shift factor according to the block size index value of the current block.
[0126] It should be noted that according to the size parameter of the current block, the block size index value of the current block can be determined. Specifically, the determining the block size index value of the current block according to the size parameter of the current block may include:
[0127] When both the width and height of the current block are equal to 4, set the block size index value of the current block to 0;
[0128] When both the width and height of the current block are equal to 8, or one of the width and height of the current block is equal to 4, set the block size index value of the current block to 1;
[0129] When the width and height of the current block do not meet the foregoing conditions, set the block size index value of the current block to 2.
[0130] In this way, after determining the block size index value of the current block, the shift factor can be further determined according to the block size index value of the current block in combination with the number of MIP input sampling values or the size of the MIP prediction block.
[0131] Optionally, in some embodiments, determining the shift factor according to the block size index value of the current block may include:
[0132] Set the shift factor to be equal to the ratio between the width or height of the current block and a first preset value corresponding to the block size index value of the current block.
[0133] Here, the first preset value represents the number of MIP input sampling values obtained from the boundary of the current block. In this case, the method may further include:
[0134] When the block size index values of the current block are equal to 0, 1, and 2 respectively, determine that the first preset values corresponding to the block size index values of the current block are equal to 2, 4, and 4 respectively.
[0135] That is to say, when the first preset value represents the number of MIP input sampling values obtained from the boundary of the current block, if the block size index value of the current block is equal to 0 at this time, then the corresponding first preset value is equal to 2; if the block size index value of the current block is equal to 1, then the corresponding first preset value is equal to 4; if the block size index value of the current block is equal to 2, then the corresponding first preset value is equal to 4, so that the shift factor can be determined according to the ratio between the width or height of the current block and the corresponding first preset value.
[0136] Optionally, in some embodiments, determining the shift factor according to the block size index value of the current block may include:
[0137] Set the shift factor to be equal to the ratio between the width or height of the current block and a second preset value corresponding to the block size index value of the current block.
[0138] Here, the second preset value represents the size of the MIP prediction block of the current block obtained by directly calculating using the MIP weight matrix. In this case, the method may further include:
[0139] When the block size index values of the current block are equal to 0, 1, and 2 respectively, it is determined that the second preset values corresponding to the block size index values of the current block are equal to 4, 4, and 8 respectively.
[0140] That is to say, when the second preset value represents the size of the MIP prediction block of the current block obtained by directly calculating using the MIP weight matrix, at this time, if the block size index value of the current block is equal to 0, then the corresponding second preset value is equal to 4; if the block size index value of the current block is equal to 1, then the corresponding second preset value is equal to 4; if the block size index value of the current block is equal to 2, then the corresponding second preset value is equal to 8, so that the shift factor can be determined according to the ratio between the width or height of the current block and the corresponding second preset value.
[0141] In another possible implementation manner, the shift table can be minimized, and the shift factor can still be determined by using a lookup table. Optionally, in some embodiments, for S302, the method may further include:
[0142] Determine the block size index value of the current block according to the size parameter of the current block;
[0143] Query the shift factor corresponding to the determined block size index value from the first preset lookup table, where the first preset lookup table is used to record the corresponding values between the block size index value and the shift factor;
[0144] Determine the queried shift factor as the shift factor corresponding to the current block.
[0145] It should be noted that the shift factor can be queried only according to the block size index value (denoted as blocksizeIdx) of the current block. As shown in Table 5 for the first preset lookup table, for each block size index value, a fixed shift factor can be corresponding, that is to say, the size of each block or the set of sizes of each block can have a fixed shift value as shown in Table 5; here, blocksizeIdx is the block size index value corresponding to the current block size or a set of block sizes.
[0146] Table 5
[0147] blocksizeIdx weight shift 0 5 1 6 2 6
[0148] In yet another possible implementation, the shift table can still be minimized, and the shift factor can still be determined by using a look-up table. Optionally, in some embodiments, for S302, the method may further include:
[0149] When the prediction mode parameter indicates using the MIP mode to determine the intra prediction value of the current block, determining the MIP mode type index value of the current block;
[0150] According to the determined MIP mode type index value, querying from a second preset look-up table the shift factor corresponding to the determined MIP mode type index value, where the second preset look-up table is used to record the corresponding values between the MIP mode type index value and the shift factor;
[0151] Determining the shift factor queried as the shift factor corresponding to the current block.
[0152] It should be noted that the shift factor can be queried only according to the MIP mode type index value (denoted as ModeCategoryIdx) of the current block. As shown in Table 6 for the second preset look-up table, for each MIP mode type index value, a fixed shift factor can be corresponding, that is, a fixed shift value as shown in Table 6 can be executed according to ModeCategoryIdx; here, ModeCategoryIdx is the type index value corresponding to the MIP mode or a group of MIP modes.
[0153] Table 6
[0154] ModeCategoryIdx weight shift 0 5 1 6 2 7
[0155] Furthermore, the ModeCategoryIdx can be derived according to the MIP mode index value. Specifically, the determining the MIP mode type index value of the current block may include:
[0156] Determining the block size index value corresponding to the current block and the MIP mode index value when using the MIP mode for prediction;
[0157] According to the block size index value and the MIP mode index value, determining the MIP mode type index value of the current block.
[0158] That is to say, after obtaining the block size index value and the MIP mode index value of the current block, the MIP mode type index value can be calculated by using a hash method, or the MIP mode type index value can also be determined based on conditional judgment.
[0159] Optionally, a hash method is used to calculate the MIP mode type index value. In some embodiments, determining the MIP mode type index value of the current block according to the block size index value and the MIP mode index value may include:
[0160] When the block size index value is equal to 0,
[0161] Right-shift the MIP mode index value by a first preset shift value to obtain the MIP mode type index value of the current block;
[0162] Or, when the block size index value is equal to 1,
[0163] Right-shift the MIP mode index value by a first preset shift value to obtain a right-shifted value;
[0164] Superimpose the right-shifted value and a third preset value to obtain the MIP mode type index value of the current block;
[0165] Or, when the block size index value is equal to 2,
[0166] Right-shift the MIP mode index value by a second preset shift value to obtain the MIP mode type index value of the current block.
[0167] It should be noted that the first preset shift value can be 3, the second preset shift value can be 2, and the third preset value can be 1.
[0168] Exemplarily, when the block size index value (blocksizeIdx) is equal to 0, the MIP mode index value (modeIdx) can be right-shifted by 3 to obtain the MIP mode type index value; when the block size index value (blocksizeIdx) is equal to 1, the MIP mode index value (modeIdx) can be right-shifted by 3 and then superimposed with 1 to obtain the MIP mode type index value; when the block size index value (blocksizeIdx) is equal to 2, the MIP mode index value (modeIdx) can be right-shifted by 2 to obtain the MIP mode type index value. Specifically, it is represented as follows,
[0169] ModeCategoryIdx = ModeIdx >> 3. for blocksizeIdx = 0;
[0170] ModeCategoryIdx = (ModeIdx >> 3) + 1. for blocksizeIdx = 1;
[0171] ModeCategoryIdx = ModeIdx >> 2 for blocksizeIdx = 2.
[0172] Optionally, determine the MIP mode type index value according to a conditional judgment. In some embodiments, determining the MIP mode type index value of the current block according to the block size index value and the MIP mode index value may include:
[0173] When the block size index value is equal to 0,
[0174] if the MIP mode index value is less than or equal to a first threshold value, determine the MIP mode type index value as a fourth preset value;
[0175] if the MIP mode index value is greater than the first threshold value, determine the MIP mode type index value as a fifth preset value;
[0176] Alternatively, when the block size index value is equal to 1,
[0177] if the MIP mode index value is less than or equal to a second threshold value, determine the MIP mode type index value as a sixth preset value;
[0178] if the MIP mode index value is greater than the second threshold value, determine the MIP mode type index value as a seventh preset value;
[0179] Alternatively, when the block size index value is equal to 2,
[0180] if the MIP mode index value is less than or equal to a third threshold value, determine the MIP mode type index value as an eighth preset value;
[0181] if the MIP mode index value is greater than the third threshold value and the MIP mode index value is less than or equal to a fourth threshold value, determine the MIP mode type index value as a ninth preset value;
[0182] if the MIP mode index value is greater than the fourth threshold value, determine the MIP mode type index value as a tenth preset value.
[0183] It should be noted that the first threshold value can be 6, the second threshold value can be 8, the third threshold value can be 3, and the fourth threshold value can be 4; the fourth preset value can be 5, the fifth preset value can be 6, the sixth preset value can be 6, the seventh preset value can be 7, the eighth preset value can be 5, the ninth preset value can be 6, and the tenth preset value is 7.
[0184] Exemplarily, when the block size index value (blocksizeIdx) is equal to 0, if the MIP mode index value (modeIdx) is less than or equal to 6, then the MIP mode type index value is set to 5, otherwise the MIP mode type index value is set to 6; when the block size index value (blocksizeIdx) is equal to 1, if the MIP mode index value (modeIdx) is less than or equal to 8, then the MIP mode type index value is set to 6, otherwise the MIP mode type index value is set to 7; when the block size index value (blocksizeIdx) is equal to 2, if the MIP mode index value (modeIdx) is less than or equal to 3, then the MIP mode type index value is set to 5, otherwise if the MIP mode index value (modeIdx) is less than or equal to 4, then the MIP mode type index value is set to 6, otherwise the MIP mode type index value is set to 7. Specifically, it is represented as follows,
[0185] If ModeIdx <= 6, ModeCategoryIdx = 5,
[0186] otherwise ModeCategoryIdx = 6, for blocksizeIdx = 0;
[0187] If ModeIdx <= 8, ModeCategoryIdx = 6,
[0188] otherwise ModeCategoryIdx = 7, for blocksizeIdx = 1;
[0189] If ModeIdx <= 3, ModeCategoryIdx = 5,
[0190] else if ModeIdx <= 4, ModeCategoryIdx = 6,
[0191] otherwise ModeCategoryIdx = 7, for blocksizeIdx = 2.
[0192] It should also be noted that the first threshold value can be 6, the second threshold value can be 8, the third threshold value can be 3, and the fourth threshold value can be 4; the fourth preset value can be 0, the fifth preset value can be 1, the sixth preset value can be 1, the seventh preset value can be 2, the eighth preset value can be 0, the ninth preset value can be 1, and the tenth preset value is 2.
[0193] Exemplarily, when the block size index value (blocksizeIdx) is equal to 0, if the MIP mode index value (modeIdx) is less than or equal to 6, then the MIP mode type index value is set to 0, otherwise the MIP mode type index value is set to 1; when the block size index value (blocksizeIdx) is equal to 1, if the MIP mode index value (modeIdx) is less than or equal to 8, then the MIP mode type index value is set to 1, otherwise the MIP mode type index value is set to 2; when the block size index value (blocksizeIdx) is equal to 2, if the MIP mode index value (modeIdx) is less than or equal to 3, then the MIP mode type index value is set to 0, otherwise if the MIP mode index value (modeIdx) is less than or equal to 4, then the MIP mode type index value is set to 1, otherwise the MIP mode type index value is set to 2. Specifically, it is represented as follows,
[0194] If ModeIdx <= 6, ModeCategoryIdx = 0,
[0195] otherwise ModeCategoryIdx = 1, for blocksizeIdx = 0;
[0196] If ModeIdx <= 8, ModeCategoryIdx = 1,
[0197] otherwise ModeCategoryIdx = 2, for blocksizeIdx = 1;
[0198] If ModeIdx <= 3, ModeCategoryIdx = 0,
[0199] else if ModeIdx <= 4, ModeCategoryIdx = 1,
[0200] otherwise ModeCategoryIdx = 2, for blocksizeIdx = 2.
[0201] In the above embodiments, by simplifying the determination method of the shift factor, especially minimizing the shift table, the storage of the lookup table can be minimized, so that the memory occupied by the shift table storage in the MIP mode can be reduced without increasing the computational complexity.
[0202] In this way, in the MIP mode, the MIP input sampling matrix, the MIP weight matrix, and the shift factor can be obtained to determine the intra prediction value of the current block subsequently.
[0203] S303: Determine the intra prediction value of the current block according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix.
[0204] It should be noted that after obtaining the MIP input sampling matrix, the MIP weight matrix, and the shift factor, the MIP prediction block of the current block can be determined first, and then the intra prediction value of the current block can be determined. Specifically, in some embodiments, for S303, the step of determining the intra prediction value of the current block according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix may include:
[0205] Perform matrix multiplication on the MIP input sampling matrix, the MIP weight matrix, and the shift factor using a pre-designed calculation model to obtain the MIP prediction block of the current block;
[0206] Perform filtering on the MIP prediction block to obtain the intra prediction value of the current block; wherein, the MIP prediction block contains the prediction values of at least some pixel positions in the current block.
[0207] That is to say, after obtaining the MIP input sampling matrix, the MIP weight matrix, and the shift factor, the MIP prediction block of the current block can be first determined using a pre-designed calculation model, where the MIP prediction block contains the prediction values of at least some pixel positions in the current block.
[0208] Specifically, in the MIP mode, the MIP weight matrix (denoted as mWeight), the shift factor (denoted as sW), and the offset factor (denoted as fO) can be determined according to the block size index value of the current block (denoted as blocksizeIdx) and the MIP mode index value (denoted as modeIdx); then the MIP input sampling matrix (denoted as P[x]), mWeight, sW, and fO are input into the process of matrix multiplication to obtain the MIP prediction block output by matrix multiplication (which can be denoted as predMip[x][y]), and the sampling points in predMip[x][y] are arranged in a matrix form according to predSize×predSize. The pre-designed calculation model is as follows,
[0209]
[0210] Among them, [x][y] represents the position coordinates of a pixel point, x represents the horizontal direction, and y represents the vertical direction; inSize represents the number of input samples, and predSize represents the side length of the MIP prediction block predMip. Here, predSize is only related to the current block type mipSizeId; when mipSizeId = 0 or 1, the output MIP prediction block is 4×4, so predSize is equal to 4; when mipSizeId = 2, the output MIP prediction block is 8×8, so predSize is equal to 8. Thus, according to the above formula (8), the temporary prediction value of at least one pixel in the MIP prediction block predMip can be calculated to obtain the MIP prediction block.
[0211] Further, it is also necessary to clip the predicted sample values in the MIP prediction block to obtain the MIP prediction block of the current block; then determine whether to transpose the MIP prediction block; if the determination result is yes, it is also necessary to transpose the predicted sample values in the MIP prediction block, and determine the transposed MIP prediction block as the MIP prediction block of the current block; if the determination result is no, it is not necessary to transpose the predicted sample values in the MIP prediction block, and the MIP prediction block can be directly determined as the MIP prediction block of the current block.
[0212] Further, in some embodiments, the filtering the MIP prediction block to obtain the intra-frame prediction value of the current block may include:
[0213] Determine whether the size of the MIP prediction block is the same as the size of the current block;
[0214] When the size of the MIP prediction block is the same as the size of the current block, set the intra-frame prediction block of the current block to be equal to the MIP prediction block; where the MIP prediction block contains the predicted sample values of all pixel positions in the current block;
[0215] When the size of the MIP prediction block is different from the size of the current block, filter the MIP prediction block to obtain a filtered prediction block, and set the filtered prediction block as the intra-frame prediction block of the current block.
[0216] Here, the filtering process may include upsampling filtering or low-pass filtering.
[0217] It should be understood that after obtaining the MIP prediction block, since the sizes of the MIP prediction block only include two types: the 4×4 MIP prediction block and the 8×8 MIP prediction block; thus, the size of the current block may be the same as or different from the size of the MIP prediction block; that is to say, the sampled values corresponding to the MIP prediction block may not necessarily fill the current block, such that the generation of the final prediction value may require an upsampling operation on the MIP prediction block, that is, by determining whether the size of the MIP prediction block is the same as the size of the current block to determine whether to perform upsampling processing on the MIP prediction block.
[0218] It should be noted that when the size of the MIP prediction block is the same as the size of the current block, that is, the width and height of the MIP prediction block are both the same as those of the current block, it indicates that no upsampling processing is required for the MIP prediction block. At this time, the MIP prediction block can be directly filled into the current block, that is, there are no empty pixel points in the filled current block. At this time, the intra-frame prediction value of each pixel in the current block can be directly set to the prediction value of each pixel in the MIP prediction block, as shown below.
[0219] predSamples[x][y] = predMip[x][y] (9)
[0220] Among them, [x][y] represents the position coordinates of the pixel point, x represents the horizontal direction, and y represents the vertical direction; predSamples[x][y] represents the intra-frame prediction value corresponding to the pixel point at the position coordinates [x][y] in the current block, and predMip[x][y] represents the prediction value corresponding to the pixel point at the position coordinates [x][y] in the MIP prediction block. Thus, according to Equation (9), the MIP prediction block predMip[x][y] can be directly used as the frame prediction block predSamples[x][y] of the current block.
[0221] It should also be noted that when the size of the MIP prediction block is different from that of the current block, that is, at least one of the width and height of the MIP prediction block is different from the current block, the MIP prediction block cannot fill the current block at this time, that is, there are vacant pixel points in the filled current block, indicating that the MIP prediction block needs to be filtered at this time. That is to say, if upsampling is required in both the horizontal and vertical directions, the MIP prediction block can be upsampled in the horizontal direction first and then in the vertical direction to obtain the first upsampled block, which can be represented by predSamples[x][y]; then the MIP prediction block is upsampled in the vertical direction and then in the horizontal direction to obtain the second upsampled block, which can be represented by predSamplesTemp[x][y]; finally, predSamples[x][y] and predSamplesTemp[x][y] are weighted and averaged to finally obtain the intra prediction block of the current block.
[0222] Exemplarily, when the side lengths nTbS of the current block (here, S can be replaced by W and H respectively) are both equal to the side length predSize of predMip (here, predSize is only related to the blocksizeIdx of the current block), the MIP prediction block can be directly set as the intra prediction block of the current block at this time; otherwise, the MIP prediction block needs to be filtered to obtain the intra prediction block of the current block. Among them, the generation process of the intra prediction block can be seen in Figure 4 As shown, still taking a 4×4 current block as an example, in Figure 4 Since the size of the current block is the same as that of the MIP prediction block, it is not necessary to filter the MIP prediction block at this time, and the MIP prediction block can be directly set as the intra prediction block of the current block, so that the intra prediction value of at least one pixel in the current block can be obtained.
[0223] This embodiment provides an image component prediction method, which is applied to an encoder. By determining the prediction parameters of the current block, where the prediction parameters include a prediction mode parameter and the size parameter of the current block; when the prediction mode parameter indicates using the matrix-based intra prediction MIP mode to determine the intra prediction value of the current block, determining the MIP weight matrix of the current block, the shift factor of the current block, and the MIP input sampling matrix of the current block; and determining the intra prediction value of the current block according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix. In this way, the determination method of the shift factor can be simplified, and when using a lookup table to determine the shift factor, the memory occupied by the lookup table storage can be reduced while reducing the calculation complexity, so as to achieve the purpose of improving the coding efficiency.
[0224] Based on Figure 2BFor an example of the application scenario shown, refer to Figure 5 , which shows a schematic flowchart of another image component prediction method provided by an embodiment of the present application. As Figure 5 shown, the method may include:
[0225] S501: Parse the bitstream to obtain prediction parameters of the current block, where the prediction parameters include a prediction mode parameter and a size parameter of the current block;
[0226] It should be noted that this method is applied to a decoder. A video image can be divided into multiple image blocks, and each currently to-be-decoded image block can be referred to as a decoding block. Here, each decoding block may include a first image component, a second image component, and a third image component; and the current block is a to-be-decoded block in the video image for which the first image component, the second image component, or the third image component prediction is to be performed currently.
[0227] It should also be noted that the prediction parameters are used to indicate the prediction mode adopted by the current block and parameters related to the prediction mode. Among them, the prediction mode generally includes an inter-frame prediction mode, a traditional intra-frame prediction mode, and a non-traditional intra-frame prediction mode, etc., and the non-traditional intra-frame prediction mode further includes an MIP mode, a CCLM mode, an IBC mode, and a PLT mode, etc. That is to say, the encoder will select the optimal prediction mode to pre-code the current block, and during this process, the prediction mode of the current block can be determined, and then the prediction parameters in this prediction mode are written into the bitstream and transmitted from the encoder to the decoder.
[0228] In this way, on the decoder side, the prediction parameters of the current block can be obtained by parsing the bitstream, and the prediction mode parameter included in the parsed prediction parameters can be used to determine whether the current block uses the MIP mode.
[0229] S502: When the prediction mode parameter indicates using the matrix-based intra-frame prediction MIP mode to determine the intra-frame prediction value of the current block, determine the MIP weight matrix of the current block, the shift factor of the current block, and the MIP input sampling matrix of the current block;
[0230] It should be noted that for the current block, if the current block uses the MIP mode to determine the intra-frame prediction value of the current block, then at this time, it is necessary to determine the MIP input sampling matrix of the current block, the MIP weight matrix of the current block, and the shift factor of the current block; among them, the shift factor can also be referred to as the shift bit number, the weight shift value, etc., and can be represented by sW, shift, or weight shift.
[0231] In some embodiments, the shift factor of the current block may include a shift factor with a constant value and a shift factor determined according to the prediction parameters.
[0232] In a possible implementation, the shift factor can be set to a fixed constant value. In the embodiments of the present application, preferably, the value of the shift factor of the constant value is equal to 6, but no limitation is made thereto.
[0233] In another possible implementation, the shift factor determined according to the prediction parameter may include:
[0234] Determine the block size index value of the current block according to the size parameter of the current block;
[0235] Determine the shift factor according to the block size index value of the current block.
[0236] It should be noted that according to the size parameter of the current block, the block size index value of the current block (represented by mipSizeId or blocksizeIdx) can be determined. Specifically, the determining the block size index value of the current block according to the size parameter of the current block may include:
[0237] When both the width and height of the current block are equal to 4, set the block size index value of the current block to 0;
[0238] When both the width and height of the current block are equal to 8, or one of the width and height of the current block is equal to 4, set the block size index value of the current block to 1;
[0239] When the width and height of the current block do not meet the foregoing conditions, the block size index value of the current block is 2.
[0240] In this way, after determining the block size index value of the current block, the shift factor can be further determined according to the block size index value of the current block in combination with the number of MIP input sampling values or the size of the MIP prediction block.
[0241] Optionally, in some embodiments, the determining the shift factor according to the block size index value of the current block may include:
[0242] Set the shift factor to be equal to the ratio between the width or height of the current block and a first preset value corresponding to the block size index value of the current block.
[0243] Here, the first preset value represents the number of MIP input sampling values obtained from the boundary of the current block. In this case, the method may further include:
[0244] When the block size index values of the current block are respectively equal to 0, 1, and 2, determine that the first preset values corresponding to the block size index values of the current block are respectively equal to 2, 4, and 4.
[0245] That is to say, when the first preset value represents the number of MIP input sampling values obtained from the boundary of the current block, if the block size index value of the current block is equal to 0 at this time, the corresponding first preset value is equal to 2; if the block size index value of the current block is equal to 1, the corresponding first preset value is equal to 4; if the block size index value of the current block is equal to 2, the corresponding first preset value is equal to 4. Thus, the shift factor can be determined according to the ratio between the width or height of the current block and the corresponding first preset value.
[0246] Optionally, in some embodiments, the determining the shift factor according to the block size index value of the current block may include:
[0247] Setting the shift factor to be equal to the ratio between the width or height of the current block and a second preset value corresponding to the block size index value of the current block.
[0248] Here, the second preset value represents the size of the MIP prediction block of the current block directly calculated using the MIP weight matrix. In this case, the method may further include:
[0249] When the block size index value of the current block is equal to 0, 1, and 2 respectively, determining that the second preset values corresponding to the block size index value of the current block are equal to 4, 4, and 8 respectively.
[0250] That is to say, when the second preset value represents the size of the MIP prediction block of the current block directly calculated using the MIP weight matrix, if the block size index value of the current block is equal to 0 at this time, the corresponding second preset value is equal to 4; if the block size index value of the current block is equal to 1, the corresponding second preset value is equal to 4; if the block size index value of the current block is equal to 2, the corresponding second preset value is equal to 8. Thus, the shift factor can be determined according to the ratio between the width or height of the current block and the corresponding second preset value.
[0251] In yet another possible implementation, the shift table can be minimized and still use the look-up table method to determine the shift factor. Optionally, in some embodiments, for S502, the method further includes:
[0252] Determining the block size index value of the current block according to the size parameter of the current block;
[0253] Querying, from a first preset look-up table, the shift factor corresponding to the determined block size index value, where the first preset look-up table is used to record the corresponding values between the block size index value and the shift factor;
[0254] Determining the queried shift factor as the shift factor corresponding to the current block.
[0255] It should be noted that in the decoder, a shift table (such as a first preset lookup table or a second preset lookup table) is also established in advance, and the shift table is also stored in the decoder. In this way, when querying the shift factor only according to the block size index value of the current block, the first preset lookup table as shown in Table 5 can be used. In Table 5, for each block size index value, a fixed shift factor can be corresponding, that is to say, the size of each block or the set of sizes of each block can have a fixed shift value as shown in Table 5.
[0256] In yet another possible implementation, the shift table can still be minimized, and the method of using the lookup table is still used to determine the shift factor. Optionally, in some embodiments, for S502, the method may further include:
[0257] When the prediction mode parameter indicates using the MIP mode to determine the intra prediction value of the current block, determining the MIP mode type index value of the current block;
[0258] According to the determined MIP mode type index value, querying the shift factor corresponding to the determined MIP mode type index value from the second preset lookup table, where the second preset lookup table is used to record the corresponding values between the MIP mode type index value and the shift factor;
[0259] Determining the shift factor queried as the shift factor corresponding to the current block.
[0260] It should be noted that when querying the shift factor only according to the MIP mode type index value (represented by ModeCategoryIdx) of the current block, the second preset lookup table as shown in Table 6 can be used. In Table 6, for each MIP mode type index value, a fixed shift factor can be corresponding, that is to say, according to ModeCategoryIdx, the fixed shift value as shown in Table 6 can be executed.
[0261] Furthermore, the ModeCategoryIdx can be deduced according to the MIP mode index value. Specifically, the determining the MIP mode type index value of the current block may include:
[0262] According to the prediction parameter, determining the block size index value corresponding to the current block and the MIP mode index value when using the MIP mode prediction;
[0263] According to the block size index value and the MIP mode index value, determining the MIP mode type index value of the current block.
[0264] That is to say, after obtaining the block size index value and the MIP mode index value of the current block, the MIP mode type index value can be calculated by using a hash method, or the MIP mode type index value can be determined based on a conditional judgment.
[0265] Optionally, the MIP mode type index value is calculated by using a hash method. In some embodiments, determining the MIP mode type index value of the current block according to the block size index value and the MIP mode index value includes:
[0266] When the block size index value is equal to 0,
[0267] Performing a right shift operation on the MIP mode index value by using a first preset shift value to obtain the MIP mode type index value of the current block;
[0268] Or, when the block size index value is equal to 1,
[0269] Performing a right shift operation on the MIP mode index value by using a first preset shift value to obtain a value after the right shift operation;
[0270] Performing a superposition operation on the value after the right shift operation and a third preset value to obtain the MIP mode type index value of the current block;
[0271] Or, when the block size index value is equal to 2,
[0272] Performing a right shift operation on the MIP mode index value by using a second preset shift value to obtain the MIP mode type index value of the current block.
[0273] Exemplarily, the first preset shift value can be 3, the second preset shift value can be 2, and the third preset value can be 1; the specific representation is as follows,
[0274] ModeCategoryIdx = ModeIdx >> 3. for blocksizeIdx = 0;
[0275] ModeCategoryIdx = (ModeIdx >> 3) + 1. for blocksizeIdx = 1;
[0276] ModeCategoryIdx = ModeIdx >> 2. for blocksizeIdx = 2.
[0277] Optionally, the MIP mode type index value is determined based on a conditional judgment. In some embodiments, determining the MIP mode type index value of the current block according to the block size index value and the MIP mode index value includes:
[0278] When the block size index value is equal to 0,
[0279] if the MIP mode index value is less than or equal to a first threshold value, determine that the MIP mode type index value is a fourth preset value;
[0280] if the MIP mode index value is greater than the first threshold value, determine that the MIP mode type index value is a fifth preset value;
[0281] Or, when the block size index value is equal to 1,
[0282] if the MIP mode index value is less than or equal to a second threshold value, determine that the MIP mode type index value is a sixth preset value;
[0283] if the MIP mode index value is greater than the second threshold value, determine that the MIP mode type index value is a seventh preset value;
[0284] Or, when the block size index value is equal to 2,
[0285] if the MIP mode index value is less than or equal to a third threshold value, determine that the MIP mode type index value is an eighth preset value;
[0286] if the MIP mode index value is greater than the third threshold value and the MIP mode index value is less than or equal to a fourth threshold value, determine that the MIP mode type index value is a ninth preset value;
[0287] if the MIP mode index value is greater than the fourth threshold value, determine that the MIP mode type index value is a tenth preset value.
[0288] Exemplarily, the first threshold value can be 6, the second threshold value can be 8, the third threshold value can be 3, and the fourth threshold value can be 4.
[0289] When the fourth preset value can be 5, the fifth preset value can be 6, the sixth preset value can be 6, the seventh preset value can be 7, the eighth preset value can be 5, the ninth preset value can be 6, and the tenth preset value is 7, it is specifically expressed as follows,
[0290] If ModeIdx <= 6, ModeCategoryIdx = 5,
[0291] otherwise ModeCategoryIdx = 6, for blocksizeIdx = 0;
[0292] If ModeIdx <= 8, ModeCategoryIdx = 6,
[0293] otherwise, ModeCategoryIdx = 7 for blocksizeIdx = 1;
[0294] If ModeIdx <= 3, ModeCategoryIdx = 5,
[0295] else if ModeIdx <= 4, ModeCategoryIdx = 6,
[0296] otherwise, ModeCategoryIdx = 7 for blocksizeIdx = 2.
[0297] Alternatively, when the fourth preset value can be 0, the fifth preset value can be 1, the sixth preset value can be 1, the seventh preset value can be 2, the eighth preset value can be 0, the ninth preset value can be 1, and the tenth preset value is 2, it is specifically expressed as follows. If ModeIdx <= 6, ModeCategoryIdx = 0,
[0298] otherwise, ModeCategoryIdx = 1 for blocksizeIdx = 0;
[0299] If ModeIdx <= 8, ModeCategoryIdx = 1,
[0300] otherwise, ModeCategoryIdx = 2 for blocksizeIdx = 1;
[0301] If ModeIdx <= 3, ModeCategoryIdx = 0,
[0302] else if ModeIdx <= 4, ModeCategoryIdx = 1,
[0303] otherwise, ModeCategoryIdx = 2 for blocksizeIdx = 2.
[0304] In the above embodiments, by simplifying the determination method of the shift factor, especially minimizing the shift table, the storage of the lookup table can be minimized, so that the memory occupied by the shift table storage in the MIP mode can be reduced without increasing the computational complexity.
[0305] In this way, in the MIP mode, the MIP input sampling matrix and the MIP weight matrix can also be obtained for subsequent determination of the intra-prediction value of the current block.
[0306] S503: Determine the intra prediction value of the current block according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix.
[0307] It should be noted that after obtaining the MIP input sampling matrix, the MIP weight matrix, and the shift factor, the MIP prediction block of the current block can be determined first, and then the intra prediction value of the current block can be determined. Specifically, in some embodiments, for S503, the step of determining the intra prediction value of the current block according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix may include:
[0308] Perform matrix multiplication processing on the MIP input sampling matrix, the MIP weight matrix, and the shift factor using a pre-designed calculation model to obtain the MIP prediction block of the current block;
[0309] Perform filtering processing on the MIP prediction block to obtain the intra prediction value of the current block; wherein, the MIP prediction block includes prediction values at at least some pixel positions in the current block.
[0310] That is to say, after obtaining the MIP input sampling matrix, the MIP weight matrix, and the shift factor, the MIP prediction block of the current block can be determined first; then, according to the obtained MIP prediction block, it is also possible to further determine the intra prediction value of the current block by judging whether the size of the MIP prediction block is the same as the size of the current block. Specifically, according to the judgment result, when the size of the MIP prediction block is the same as the size of the current block, set the intra prediction block of the current block to be equal to the MIP prediction block; at this time, the MIP prediction block includes the predicted sampling values at all pixel positions in the current block; when the size of the MIP prediction block is different from the size of the current block, perform filtering processing on the MIP prediction block to obtain a filtered prediction block, and set the filtered prediction block as the intra prediction block of the current block. Here, the filtering processing may include upsampling filtering processing or low-pass filtering processing.
[0311] This embodiment provides an image component prediction method, which is applied to a decoder. By parsing the code stream, prediction parameters of the current block are obtained, where the prediction parameters include a prediction mode parameter and a size parameter of the current block; when the prediction mode parameter indicates that the matrix-based intra prediction (MIP) mode is used to determine the intra prediction value of the current block, the MIP weight matrix of the current block, the shift factor of the current block, and the MIP input sampling matrix of the current block are determined; and the intra prediction value of the current block is determined according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix. In this way, the determination method of the shift factor can be simplified, and when the shift factor is determined by using a look-up table, the memory occupied by the look-up table storage can be reduced while reducing the computational complexity, so as to achieve the purpose of improving the decoding efficiency.
[0312] Based on the same inventive concept as the foregoing embodiment, refer to Figure 6 , which shows a schematic structural diagram of an encoder 60 provided in an embodiment of the present application. As Figure 6 shown, the encoder 60 may include: a first determination unit 601 and a first prediction unit 602; where
[0313] The first determination unit 601 is configured to determine prediction parameters of the current block, where the prediction parameters include a prediction mode parameter and a size parameter of the current block;
[0314] The first determination unit 601 is further configured to, when the prediction mode parameter indicates that the matrix-based intra prediction (MIP) mode is used to determine the intra prediction value of the current block, determine the MIP weight matrix of the current block, the shift factor of the current block, and the MIP input sampling matrix of the current block;
[0315] The first prediction unit 602 is configured to determine the intra prediction value of the current block according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix.
[0316] In some embodiments, the shift factor of the current block includes a shift factor with a constant value and a shift factor determined according to the prediction parameters.
[0317] In some embodiments, the value of the shift factor with a constant value is equal to 6.
[0318] In some embodiments, the first determination unit 601 is further configured to determine a block size index value of the current block according to the size parameter of the current block; and determine the shift factor according to the block size index value of the current block.
[0319] In some embodiments, refer to Figure 7, the encoder 60 may further include a first setting unit 603 configured to set the block size index value of the current block to 0 when both the width and height of the current block are equal to 4; set the block size index value of the current block to 1 when both the width and height of the current block are equal to 8 or one of the width and height of the current block is equal to 4; and set the block size index value of the current block to 2 when the width and height of the current block do not meet the foregoing conditions.
[0320] In some embodiments, the first setting unit 603 is further configured to set the shift factor to be equal to the ratio between the width or height of the current block and a first preset value corresponding to the block size index value of the current block.
[0321] In some embodiments, the first preset value represents the number of MIP input sampling values obtained from the boundary of the current block.
[0322] In some embodiments, the first determination unit 601 is further configured to determine that the first preset values corresponding to the block size index values of the current block are equal to 2, 4, and 4 respectively when the block size index values of the current block are equal to 0, 1, and 2 respectively.
[0323] In some embodiments, the first setting unit 603 is further configured to set the shift factor to be equal to the ratio between the width or height of the current block and a second preset value corresponding to the block size index value of the current block.
[0324] In some embodiments, the second preset value represents the size of the MIP prediction block of the current block obtained by directly calculating using the MIP weight matrix.
[0325] In some embodiments, the first determination unit 601 is further configured to determine that the second preset values corresponding to the block size index values of the current block are equal to 4, 4, and 8 respectively when the block size index values of the current block are equal to 0, 1, and 2 respectively.
[0326] In some embodiments, referring to Figure 7 , the encoder 60 may further include a first query unit 604; wherein,
[0327] The first determination unit 601 is further configured to determine the block size index value of the current block according to the size parameter of the current block;
[0328] The first query unit 604 is configured to query, according to the determined block size index value, a shift factor corresponding to the determined block size index value from a first preset look-up table, where the first preset look-up table is used to record the corresponding values between the block size index value and the shift factor; and determine the queried shift factor as the shift factor corresponding to the current block.
[0329] In some embodiments, the first determination unit 601 is further configured to determine the MIP mode type index value of the current block when the prediction mode parameter indicates that the intra prediction value of the current block is determined using the MIP mode;
[0330] The first query unit 604 is further configured to query, according to the determined MIP mode type index value, a shift factor corresponding to the determined MIP mode type index value from a second preset lookup table, where the second preset lookup table is used to record the corresponding values between the MIP mode type index value and the shift factor; and determine the queried shift factor as the shift factor corresponding to the current block.
[0331] In some embodiments, the first determination unit 601 is specifically configured to determine the block size index value corresponding to the current block and the MIP mode index value when predicting using the MIP mode; and determine the MIP mode type index value of the current block according to the block size index value and the MIP mode index value.
[0332] In some embodiments, refer to Figure 7 , the encoder 60 may further include a first calculation unit 605, configured to, when the block size index value is equal to 0, perform a right shift process on the MIP mode index value using a first preset displacement value to obtain the MIP mode type index value of the current block; or, configured to, when the block size index value is equal to 1, perform a right shift process on the MIP mode index value using a first preset displacement value to obtain a value after the right shift process; perform a superposition process on the value after the right shift process and a third preset value to obtain the MIP mode type index value of the current block; or, configured to, when the block size index value is equal to 2, perform a right shift process on the MIP mode index value using a second preset displacement value to obtain the MIP mode type index value of the current block.
[0333] In some embodiments, refer to Figure 7The encoder 60 may further include a first determination unit 606 configured to, when the block size index value is equal to 0, if the MIP mode index value is less than or equal to a first threshold value, determine that the MIP mode type index value is a fourth preset value; if the MIP mode index value is greater than the first threshold value, determine that the MIP mode type index value is a fifth preset value; or, configured to, when the block size index value is equal to 1, if the MIP mode index value is less than or equal to a second threshold value, determine that the MIP mode type index value is a sixth preset value; if the MIP mode index value is greater than the second threshold value, determine that the MIP mode type index value is a seventh preset value; or, configured to, when the block size index value is equal to 2, if the MIP mode index value is less than or equal to a third threshold value, determine that the MIP mode type index value is an eighth preset value; if the MIP mode index value is greater than the third threshold value and the MIP mode index value is less than or equal to a fourth threshold value, determine that the MIP mode type index value is a ninth preset value; if the MIP mode index value is greater than the fourth threshold value, determine that the MIP mode type index value is a tenth preset value.
[0334] In some embodiments, referring to Figure 7 the encoder 60 may further include a pre-coding unit 607 configured to perform pre-coding processing on the current block using multiple prediction modes to obtain rate-distortion cost values corresponding to each prediction mode; select the minimum rate-distortion cost value from the obtained multiple rate-distortion cost values, and determine the prediction parameters in the prediction mode corresponding to the minimum rate-distortion cost value as the prediction parameters of the current block.
[0335] In some embodiments, the first calculation unit 605 is further configured to perform matrix multiplication processing on the MIP input sampling matrix, the MIP weight matrix, and the shift factor using a pre-designed calculation model to obtain the MIP prediction block of the current block;
[0336] The first prediction unit 602 is specifically configured to perform filtering processing on the MIP prediction block to obtain the intra-frame prediction value of the current block; wherein, the MIP prediction block includes prediction values at at least some pixel positions in the current block.
[0337] It can be understood that in the embodiments of the present application, a "unit" may be a part of a circuit, a part of a processor, a part of a program or software, etc. Of course, it may also be a module or non-modular. Moreover, the components in this embodiment may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit. The above integrated unit may be implemented in the form of hardware or in the form of a software function module.
[0338] When the integrated unit is implemented in the form of 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, the technical solution of this embodiment, in essence, or the part that contributes to the prior art, or all or part of this 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 enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the method described in this embodiment. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.
[0339] Therefore, an embodiment of this application provides a computer storage medium, which is applied to an encoder 60. This computer storage medium stores a computer program, and when the computer program is executed by a first processor, it implements the method described in any one of the foregoing embodiments.
[0340] Based on the composition of the foregoing encoder 60 and the computer storage medium, refer to Figure 8 , which shows a specific hardware structure example of the encoder 60 provided by an embodiment of this application. It may include: a first communication interface 801, a first memory 802, and a first processor 803; each component is coupled together through a first bus system 804. It can be understood that the first bus system 804 is used to realize the connection and communication between these components. The first bus system 804 includes, in addition to a data bus, a power bus, a control bus, and a status signal bus. However, for the sake of clear description, in Figure 8 all kinds of buses are labeled as the first bus system 804. Among them,
[0341] The first communication interface 801 is used for receiving and sending signals during the process of receiving and sending information to and from other external network elements;
[0342] The first memory 802 is used to store a computer program that can run on the first processor 803;
[0343] The first processor 803 is used for, when running the computer program, executing:
[0344] Determine the prediction parameters of the current block, where the prediction parameters include a prediction mode parameter and the size parameter of the current block;
[0345] When the prediction mode parameter indicates that the intra prediction value of the current block is determined using the matrix-based intra prediction (MIP) mode, determine the MIP weight matrix of the current block, the shift factor of the current block, and the MIP input sampling matrix of the current block;
[0346] Determine the intra prediction value of the current block according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix.
[0347] It can be understood that the first memory 802 in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a 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 dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchlink dynamic random access memory (SLDRAM), and direct rambus random access memory (DRRAM). The first memory 802 of the systems and methods described in the present application is intended to include but not be limited to these and any other suitable types of memory.
[0348] The first processor 803 may be an integrated circuit chip with signal processing capabilities. In the implementation process, the steps of the above method can be completed by the integrated logic circuit of the hardware in the first processor 803 or instructions in the form of software. The above-mentioned first processor 803 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, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the first memory 802, and the first processor 803 reads the information in the first memory 802 and combines its hardware to complete the steps of the above method.
[0349] It can be understood that the embodiments described in the present 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 the present application, or a combination thereof. For software implementation, the techniques described in the present application can be implemented by modules (such as procedures, functions, etc.) that execute the functions described in the present application. The software code can be stored in a memory and executed by a processor. The memory can be implemented inside or outside the processor.
[0350] Optionally, as another embodiment, the first processor 803 is further configured to execute the method described in any one of the foregoing embodiments when running the computer program.
[0351] This embodiment provides an encoder, which may include a first determination unit and a first prediction unit; wherein, the first determination unit is configured to determine prediction parameters of a current block, and the prediction parameters include a prediction mode parameter and a size parameter of the current block; and is further configured to determine the MIP weight matrix, the shift factor, and the MIP input sampling matrix of the current block when the prediction mode parameter indicates using the matrix-based intra prediction MIP mode to determine the intra prediction value of the current block; the first prediction unit is configured to determine the intra prediction value of the current block according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix. In this way, the determination method of the shift factor can be simplified, and when using a lookup table to determine the shift factor, the memory occupied by the lookup table storage can be reduced while reducing the computational complexity, so as to achieve the purpose of improving the encoding and decoding efficiency.
[0352] Based on the same inventive concept as the foregoing embodiments, refer to Figure 9 , which shows a schematic structural diagram of a decoder 90 provided by an embodiment of the present application. As Figure 9 shown, the decoder 90 may include: a parsing unit 901, a second determination unit 902, and a second prediction unit 903; wherein,
[0353] The parsing unit 901 is configured to parse a bitstream to obtain prediction parameters of a current block, where the prediction parameters include a prediction mode parameter and a size parameter of the current block;
[0354] The second determination unit 902 is configured to determine the MIP weight matrix, the shift factor, and the MIP input sampling matrix of the current block when the prediction mode parameter indicates using the matrix-based intra prediction MIP mode to determine the intra prediction value of the current block;
[0355] The second prediction unit 903 is configured to determine the intra prediction value of the current block according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix.
[0356] In some embodiments, the shift factor of the current block includes a shift factor with a constant value and a shift factor determined according to the prediction parameters.
[0357] In some embodiments, the value of the shift factor with a constant value is equal to 6.
[0358] In some embodiments, the second determination unit 902 is further configured to determine a block size index value of the current block according to the size parameter of the current block; and determine the shift factor according to the block size index value of the current block.
[0359] In some embodiments, referring to Figure 10 , the decoder 90 may further include a second setting unit 904 configured to set the block size index value of the current block to 0 when both the width and height of the current block are equal to 4; set the block size index value of the current block to 1 when both the width and height of the current block are equal to 8, or one of the width and height of the current block is equal to 4; and set the block size index value of the current block to 2 when the width and height of the current block do not meet the foregoing conditions.
[0360] In some embodiments, the second setting unit 904 is further configured to set the shift factor to be equal to the ratio between the width or height of the current block and a first preset value corresponding to the block size index value of the current block.
[0361] In some embodiments, the first preset value represents the number of MIP input sampling values obtained from the boundary of the current block.
[0362] In some embodiments, the second determination unit 902 is further configured to determine that the first preset values corresponding to the block size index values of the current block are equal to 2, 4, and 4 respectively when the block size index value of the current block is equal to 0, 1, and 2 respectively.
[0363] In some embodiments, the second setting unit 904 is further configured to set the shift factor to be equal to the ratio between the width or height of the current block and a second preset value corresponding to the block size index value of the current block.
[0364] In some embodiments, the second preset value represents the size of the MIP prediction block of the current block obtained by directly calculating using the MIP weight matrix.
[0365] In some embodiments, the second determination unit 902 is further configured to determine that the second preset values corresponding to the block size index values of the current block are equal to 4, 4, and 8 respectively when the block size index value of the current block is equal to 0, 1, and 2 respectively.
[0366] In some embodiments, referring to Figure 10 , the decoder 90 may further include a second query unit 905; wherein,
[0367] The second determination unit 902 is further configured to determine a block size index value of the current block according to the size parameter of the current block;
[0368] The second query unit 905 is configured to query, according to the determined block size index value, a shift factor corresponding to the determined block size index value from a first preset lookup table, where the first preset lookup table is used to record the corresponding values between the block size index value and the shift factor; and determine the queried shift factor as the shift factor corresponding to the current block.
[0369] In some embodiments, the second determination unit 902 is further configured to determine a MIP mode type index value of the current block when the prediction mode parameter indicates that the MIP mode is used to determine the intra-prediction value of the current block.
[0370] The second query unit 905 is further configured to query, according to the determined MIP mode type index value, a shift factor corresponding to the determined MIP mode type index value from a second preset lookup table, where the second preset lookup table is used to record the corresponding values between the MIP mode type index value and the shift factor; and determine the queried shift factor as the shift factor corresponding to the current block.
[0371] In some embodiments, the second determination unit 902 is specifically configured to determine the block size index value corresponding to the current block and the MIP mode index value when predicting using the MIP mode according to the prediction parameters; and determine the MIP mode type index value of the current block according to the block size index value and the MIP mode index value.
[0372] In some embodiments, refer to Figure 10 The decoder 90 may further include a second calculation unit 906, configured to, when the block size index value is equal to 0, perform a right shift process on the MIP mode index value by using a first preset displacement value to obtain the MIP mode type index value of the current block; or, configured to, when the block size index value is equal to 1, perform a right shift process on the MIP mode index value by using a first preset displacement value to obtain a value after the right shift process; perform a superposition process on the value after the right shift process and a third preset value to obtain the MIP mode type index value of the current block; or, configured to, when the block size index value is equal to 2, perform a right shift process on the MIP mode index value by using a second preset displacement value to obtain the MIP mode type index value of the current block.
[0373] In some embodiments, refer to Figure 10, the decoder 90 may further include a second determination unit 907, configured to, when the block size index value is equal to 0, if the MIP mode index value is less than or equal to a first threshold value, determine that the MIP mode type index value is a fourth preset value; if the MIP mode index value is greater than the first threshold value, determine that the MIP mode type index value is a fifth preset value; or, configured to, when the block size index value is equal to 1, if the MIP mode index value is less than or equal to a second threshold value, determine that the MIP mode type index value is a sixth preset value; if the MIP mode index value is greater than the second threshold value, determine that the MIP mode type index value is a seventh preset value; or, configured to, when the block size index value is equal to 2, if the MIP mode index value is less than or equal to a third threshold value, determine that the MIP mode type index value is an eighth preset value; if the MIP mode index value is greater than the third threshold value and the MIP mode index value is less than or equal to a fourth threshold value, determine that the MIP mode type index value is a ninth preset value; if the MIP mode index value is greater than the fourth threshold value, determine that the MIP mode type index value is a tenth preset value.
[0374] In some embodiments, the second calculation unit 906 is further configured to perform matrix multiplication processing on the MIP input sampling matrix, the MIP weight matrix, and the shift factor by using a pre-designed calculation model to obtain the MIP prediction block of the current block;
[0375] The second prediction unit 903 is specifically configured to perform filtering processing on the MIP prediction block to obtain the intra-frame prediction value of the current block; wherein, the MIP prediction block includes prediction values of at least some pixel positions in the current block.
[0376] It can be understood that, in this embodiment, the "unit" may be a part of a circuit, a part of a processor, a part of a program or software, etc. Of course, it may also be a module, or non-modular. Moreover, the components in this embodiment may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit. The above integrated unit may be implemented in the form of hardware or in the form of a software functional module.
[0377] When the integrated unit is implemented in the form of a software functional module and is not sold or used as an independent product, it may be stored in a computer-readable storage medium. Based on such an understanding, this embodiment provides a computer storage medium, which is applied to the decoder 90. The computer storage medium stores a computer program, and when the computer program is executed by a second processor, it implements the method described in any one of the foregoing embodiments.
[0378] Based on the composition of the above decoder 90 and the computer storage medium, refer to Figure 11 , which shows a specific hardware structure example of the decoder 90 provided by the embodiments of the present application, and may include: a second communication interface 1101, a second memory 1102, and a second processor 1103; each component is coupled together through a second bus system 1104. It can be understood that the second bus system 1104 is used to realize the connection and communication between these components. In addition to the data bus, the second bus system 1104 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clear illustration, in Figure 11 all kinds of buses are labeled as the second bus system 1104. Among them,
[0379] The second communication interface 1101 is used for receiving and sending signals during the process of receiving and sending information with other external network elements;
[0380] The second memory 1102 is used to store a computer program that can run on the second processor 1103;
[0381] The second processor 1103 is used to execute, when running the computer program:
[0382] Parse the code stream to obtain the prediction parameters of the current block, where the prediction parameters include a prediction mode parameter and the size parameter of the current block;
[0383] When the prediction mode parameter indicates that the matrix-based intra prediction (MIP) mode is used to determine the intra prediction value of the current block, determine the MIP weight matrix of the current block, the shift factor of the current block, and the MIP input sampling matrix of the current block;
[0384] Determine the intra prediction value of the current block according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix.
[0385] Optionally, as another embodiment, the second processor 1103 is further configured to execute the method described in any one of the foregoing embodiments when running the computer program.
[0386] It can be understood that the hardware functions of the second memory 1102 and the first memory 802 are similar, and the hardware functions of the second processor 1103 and the first processor 803 are similar; details are not described herein again.
[0387] This embodiment provides a decoder, which may include a parsing unit, a second determination unit, and a second prediction unit; wherein, the parsing unit is configured to parse a bitstream to obtain prediction parameters of a current block, and the prediction parameters include a prediction mode parameter and a size parameter of the current block; the second determination unit is configured to determine a MIP weight matrix of the current block, a shift factor of the current block, and a MIP input sampling matrix of the current block when the prediction mode parameter indicates using a matrix-based intra prediction (MIP) mode to determine an intra prediction value of the current block; the second prediction unit is configured to determine the intra prediction value of the current block according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix. In this way, the determination method of the shift factor can be simplified, and when using a lookup table to determine the shift factor, the memory occupied by the lookup table storage can be reduced while reducing the calculation complexity, so as to achieve the purpose of improving the encoding and decoding efficiency.
[0388] It should be noted that in this application, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the element.
[0389] The serial numbers of the above-mentioned embodiments of this application are only for description and do not represent the advantages and disadvantages of the embodiments.
[0390] The methods disclosed in several method embodiments provided by this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0391] The features disclosed in several product embodiments provided by this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0392] The features disclosed in several method or device embodiments provided by this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0393] The above is only the specific implementation manner of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by this application, and all should be covered by the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.
[0394] Industrial Applicability
[0395] In the embodiments of the present application, it is applied to an encoder or a decoder. After obtaining the prediction parameters of the current block, when the prediction mode parameter in the prediction parameters indicates that the MIP mode is used to determine the intra prediction value of the current block, the MIP weight matrix of the current block, the shift factor of the current block, and the MIP input sampling matrix of the current block can be determined; then, according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix, the intra prediction value of the current block is determined. In this way, whether on the decoder side or the encoder side, the determination method of the shift factor can be simplified, and when using a lookup table to determine the shift factor, the memory occupied by the lookup table storage can be reduced while reducing the computational complexity, so as to achieve the purpose of improving the encoding and decoding efficiency.
Claims
1. An image component prediction method, applied to an encoder, characterized in that, the method includes: Determine the prediction parameters of the current block, where the prediction parameters include a prediction mode parameter and the size parameter of the current block; When the prediction mode parameter indicates using the matrix-based intra prediction (MIP) mode to determine the intra prediction value of the current block, determine the MIP weight matrix of the current block, the shift factor of the current block, and the MIP input sampling matrix of the current block; Determine the intra prediction value of the current block according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix; wherein, the MIP weight matrix of the current block is determined at least according to the block size index value of the current block; and, the shift factors corresponding to different prediction mode parameters and different size parameters of the current block are fixed constant values.
2. The method according to claim 1, characterized in that, the value of the shift factor is equal to 6.
3. The method according to claim 1 or 2, characterized in that, the step of determining the intra prediction value of the current block according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix includes: Perform matrix multiplication processing on the MIP input sampling matrix, the MIP weight matrix, and the shift factor by using a pre-designed calculation model to obtain the MIP prediction block of the current block; Perform filtering processing on the MIP prediction block to obtain the intra prediction value of the current block; wherein, the MIP prediction block includes prediction values at least at some pixel positions in the current block.
4. The method according to claim 3, characterized in that, the block size index value of the current block is determined according to the size parameter of the current block, and the method further includes: When both the width and height of the current block are equal to 4, set the block size index value of the current block to 0; When both the width and height of the current block are equal to 8 or one of the width and height of the current block is equal to 4, set the block size index value of the current block to 1; When the width and height of the current block do not meet the foregoing conditions, set the block size index value of the current block to 2.
5. An image component prediction method, applied to a decoder, characterized in that, the method includes: Parse the code stream to obtain the prediction parameters of the current block, where the prediction parameters include a prediction mode parameter and the size parameter of the current block; When the prediction mode parameter indicates using the matrix-based intra prediction (MIP) mode to determine the intra prediction value of the current block, determine the MIP weight matrix of the current block, the shift factor of the current block, and the MIP input sampling matrix of the current block; Determine the intra prediction value of the current block according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix; wherein, the shift factor of the current block includes a constant shift factor; wherein, the MIP weight matrix of the current block is determined at least according to the block size index value of the current block; and, the shift factors corresponding to different prediction mode parameters and different size parameters of the current block are fixed constant values.
6. The method according to claim 5, wherein, the value of the shift factor is equal to 6.
7. The method according to claim 5 or 6, wherein, determining the intra prediction value of the current block according to the MIP weight matrix, the shift factor and the MIP input sampling matrix includes: performing matrix multiplication on the MIP input sampling matrix, the MIP weight matrix and the shift factor by using a pre-designed calculation model to obtain the MIP prediction block of the current block; performing filtering processing on the MIP prediction block to obtain the intra prediction value of the current block; wherein, the MIP prediction block includes prediction values of at least some pixel positions in the current block.
8. The method according to claim 7, wherein, the block size index value of the current block is determined according to the size parameter of the current block, and the method further includes: when the width and height of the current block are both equal to 4, setting the block size index value of the current block to 0; when the width and height of the current block are both equal to 8 or one of the width and height of the current block is equal to 4, setting the block size index value of the current block to 1; when the width and height of the current block do not meet the foregoing conditions, setting the block size index value of the current block to 2.
9. An encoder, wherein, the encoder includes a first determination unit and a first prediction unit; wherein, the first determination unit is configured to determine the prediction parameters of the current block, wherein the prediction parameters include a prediction mode parameter and the size parameter of the current block; the first determination unit is further configured to determine the MIP weight matrix of the current block, the shift factor of the current block and the MIP input sampling matrix of the current block when the prediction mode parameter indicates using the matrix-based intra prediction MIP mode to determine the intra prediction value of the current block; the first prediction unit is configured to determine the intra prediction value of the current block according to the MIP weight matrix, the shift factor and the MIP input sampling matrix; the first determination unit is further configured to determine the MIP weight matrix of the current block at least according to the block size index value of the current block; wherein, the shift factor corresponding to different prediction mode parameters and different size parameters of the current block is a fixed constant value.
10. The encoder according to claim 9, wherein, the value of the shift factor is equal to 6.
11. The encoder according to claim 9 or 10, wherein, the encoder further includes a first calculation unit configured to perform matrix multiplication on the MIP input sampling matrix, the MIP weight matrix and the shift factor by using a pre-designed calculation model to obtain the MIP prediction block of the current block; the first prediction unit is configured to perform filtering processing on the MIP prediction block to obtain the intra prediction value of the current block; wherein, the MIP prediction block includes prediction values of at least some pixel positions in the current block.
12. The encoder according to claim 11, wherein, The block size index value of the current block is determined according to the size parameter of the current block; The encoder further includes a first setting unit configured to set the block size index value of the current block to 0 when both the width and height of the current block are equal to 4; set the block size index value of the current block to 1 when both the width and height of the current block are equal to 8 or one of the width and height of the current block is equal to 4; and set the block size index value of the current block to 2 when the width and height of the current block do not meet the foregoing conditions.
13. A decoder, characterized in that, the decoder includes a parsing unit, a second determination unit, and a second prediction unit; wherein, the parsing unit is configured to parse a bitstream to obtain prediction parameters of a current block, where the prediction parameters include a prediction mode parameter and a size parameter of the current block; the second determination unit is configured to determine the MIP weight matrix of the current block, the shift factor of the current block, and the MIP input sampling matrix of the current block when the prediction mode parameter indicates using the matrix-based intra prediction (MIP) mode to determine the intra prediction value of the current block; the second prediction unit is configured to determine the intra prediction value of the current block according to the MIP weight matrix, the shift factor, and the MIP input sampling matrix; wherein, the shift factor of the current block includes a shift factor with a constant value; the second determination unit is further configured to determine the MIP weight matrix of the current block at least according to the block size index value of the current block; wherein, the shift factors corresponding to different prediction mode parameters and different size parameters of the current block are fixed constant values.
14. The decoder according to claim 13, characterized in that, the value of the shift factor is equal to 6.
15. The decoder according to claim 13 or 14, characterized in that, the decoder further includes a second calculation unit configured to perform matrix multiplication processing on the MIP input sampling matrix, the MIP weight matrix, and the shift factor by using a pre-designed calculation model to obtain the MIP prediction block of the current block; the second prediction unit is configured to perform filtering processing on the MIP prediction block to obtain the intra prediction value of the current block; wherein, the MIP prediction block includes prediction values at least at some pixel positions in the current block.
16. The decoder according to claim 15, characterized in that, the block size index value of the current block is determined according to the size parameter of the current block; the decoder further includes a second setting unit configured to set the block size index value of the current block to 0 when both the width and height of the current block are equal to 4; set the block size index value of the current block to 1 when both the width and height of the current block are equal to 8 or one of the width and height of the current block is equal to 4; and set the block size index value of the current block to 2 when the width and height of the current block do not meet the foregoing conditions.
17. A computer storage medium, characterized in that, The computer storage medium stores a computer program, which, when executed by a first processor, implements the method according to any one of claims 1 to 4, or when executed by a second processor, implements the method according to any one of claims 5 to 8.
Citation Information
Patent Citations
Image component prediction methods, encoders, decoders, and storage media
CN113225562B
Intra block copy mode for screen content coding
CN107646195A
Quantization method during video image coding
CN1741612A