Image prediction method, encoder, decoder and storage medium
By simplifying the shift offset and quantity parameter acquisition of the MIP mode, the encoding and decoding complexity and storage space in H.266/VVC are reduced, the encoding and decoding efficiency is improved, and the implementation difficulty of MIP technology on devices with limited computing power is solved.
Patent Information
- Application Number
- CN202411073130.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2019-10-04
- Filing Date
- 2020-08-21
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2040-08-21
AI Technical Summary
The matrix-based intra prediction (MIP) technology in H.266/VVC is highly complex, resulting in increased storage space and computational complexity during the encoding and decoding process. It is difficult to implement on devices with low computing power or small storage capacity, resulting in low encoding and decoding efficiency.
By simplifying the acquisition process of the shift offset parameter and the shift quantity parameter, a fixed constant value is determined, the calculation of the MIP weight matrix is simplified, the encoding and decoding complexity is reduced, and the storage space requirement is reduced.
On the basis of ensuring the encoding and decoding performance, the encoding and decoding complexity is reduced, the storage space requirement is reduced, and the encoding and decoding efficiency is improved.
Smart Images

Figure CN118945379B_ABST
Abstract
Description
[0001] Description of the case
[0002] This application is a divisional application based on the Chinese patent with application date of August 21, 2020, application number 202010852469.3, and invention name “Image prediction method, encoder, decoder and storage medium”.
[0003] CROSS-REFERENCE TO RELATED APPLICATIONS
[0004] Prior U.S. provisional patent application No. 62 / 911,166, filed on October 4, 2019, in the name of Junyan Huo, and entitled “Video Encoding and Decoding Methods and Apparatuses Therefor.” Technical Field
[0005] The embodiments of the present application relate to the field of video coding and decoding technology, and in particular to an image prediction method, an encoder, a decoder, and a storage medium. Background Art
[0006] As demand for video display quality increases, new video applications such as HD and UHD video have emerged. H.265 / High Efficiency Video Coding (HEVC) is no longer able to meet the demands of rapidly evolving video applications. Consequently, the Joint Video Exploration Team (JVET) has proposed the next-generation video coding standard, H.266 / Versatile Video Coding (VVC).
[0007] In H.266 / VVC, the matrix-based intra prediction (MIP) process is highly complex. Therefore, while MIP technology improves codec performance, it also significantly increases the storage space and computational complexity required during the codec process, thereby reducing codec efficiency. Summary of the Invention
[0008] The present application provides an image prediction method, an encoder, a decoder, and a storage medium, which can reduce complexity and the storage space required in the encoding and decoding process while ensuring encoding and decoding performance, thereby effectively improving encoding and decoding efficiency.
[0009] The technical solution of this application can be implemented as follows:
[0010] In a first aspect, an embodiment of the present application provides an image prediction method, applied to an encoder, the method comprising:
[0011] Determining prediction parameters of the current block, wherein the prediction parameters include: prediction mode parameters;
[0012] When the prediction mode parameter indicates that a matrix-based intra prediction MIP mode is used to determine an intra prediction value of the current block, determining a MIP input sample value of the current block according to adjacent sample values of the current block;
[0013] Determining, according to a value of a shift offset parameter, a product of a sum of the MIP input sample values and the shift offset parameter, wherein the value of the shift offset parameter is a fixed constant;
[0014] Determining a first constant value according to a value of a shift quantity parameter, wherein the value of the shift quantity parameter is a fixed constant;
[0015] Setting the value of the first offset to the difference between the first constant value and the product;
[0016] Determining a MIP weighting matrix for the current block according to the prediction parameters;
[0017] Determining a MIP prediction value of the current block according to the MIP weighting matrix, the MIP input sample value, the shift quantity parameter, and the first offset, wherein the MIP prediction value is a prediction value of some sampling points in the current block;
[0018] Filter the MIP prediction value to obtain an intra-frame prediction value of the current block.
[0019] In a second aspect, an embodiment of the present application provides an image prediction method, applied to a decoder, the method comprising:
[0020] Parsing the bitstream to obtain prediction parameters of the current block, wherein the prediction parameters include: prediction mode parameters;
[0021] When the prediction mode parameter indicates that a matrix-based intra prediction MIP mode is used to determine an intra prediction value of the current block, determining a MIP input sample value of the current block according to adjacent sample values of the current block;
[0022] Determining, according to a value of a shift offset parameter, a product of a sum of the MIP input sample values and the shift offset parameter, wherein the value of the shift offset parameter is a fixed constant;
[0023] Determining a first constant value according to a value of a shift quantity parameter, wherein the value of the shift quantity parameter is a fixed constant;
[0024] Setting the value of the first offset to the difference between the first constant value and the product;
[0025] Determining a MIP weighting matrix for the current block according to the prediction parameters;
[0026] Determining a MIP prediction value of the current block according to the MIP weighting matrix, the MIP input sample value, the shift quantity parameter, and the first offset, wherein the MIP prediction value is a prediction value of some sampling points in the current block;
[0027] Filter the MIP prediction value to obtain an intra-frame prediction value of the current block.
[0028] In a third aspect, an embodiment of the present application provides an encoder, which includes a first determination unit, a first calculation unit, and a first prediction unit; wherein,
[0029] The first determining unit is configured to determine prediction parameters of the current block, wherein the prediction parameters include: prediction mode parameters; and when the prediction mode parameters indicate that a matrix-based intra prediction MIP mode is used to determine an intra prediction value of the current block, determine the MIP input sample value of the current block according to adjacent sample values of the current block;
[0030] The first calculation unit is configured to determine, based on a value of a shift offset parameter, a product of a sum of the MIP input sample values and the shift offset parameter, wherein the value of the shift offset parameter is a fixed constant; determine a first constant value based on a value of a shift amount parameter, wherein the value of the shift amount parameter is a fixed constant; and set the value of the first offset to be the difference between the first constant value and the product;
[0031] The first determining unit is further configured to determine a MIP weighting matrix of the current block according to the prediction parameter;
[0032] The first prediction unit is configured to determine the MIP prediction value of the current block based on the MIP weighting matrix, the MIP input sample value, the shift quantity parameter and the first offset, wherein the MIP prediction value is the prediction value of some sampling points in the current block; and filter the MIP prediction value to obtain the intra-frame prediction value of the current block.
[0033] In a fourth aspect, an embodiment of the present application provides an encoder, comprising a first memory and a first processor; wherein,
[0034] The first memory is used to store a computer program that can be run on the first processor;
[0035] The first processor is configured to execute the steps of the method described in the first aspect when running the computer program.
[0036] In a fifth aspect, an embodiment of the present application provides a decoder, comprising a parsing unit, a second determining unit, a second calculating unit, and a second predicting unit; wherein,
[0037] The parsing unit is configured to parse the code stream to obtain prediction parameters of the current block, wherein the prediction parameters include: prediction mode parameters;
[0038] The second determining unit is configured to determine the MIP input sample value of the current block according to the adjacent sample values 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;
[0039] The second calculation unit is configured to determine, according to a value of a shift offset parameter, a product of a sum of the MIP input sample values and the shift offset parameter, wherein the value of the shift offset parameter is a fixed constant; and determine a first constant value according to a value of a shift amount parameter, wherein the value of the shift amount parameter is a fixed constant; and set the value of the first offset to the difference between the first constant value and the product;
[0040] The second determining unit is further configured to determine a MIP weighting matrix of the current block according to the prediction parameter;
[0041] The second prediction unit is configured to determine the MIP prediction value of the current block based on the MIP weighting matrix, the MIP input sample value, the shift quantity parameter and the first offset, wherein the MIP prediction value is the prediction value of some sampling points in the current block; and filter the MIP prediction value to obtain the intra-frame prediction value of the current block.
[0042] In a sixth aspect, an embodiment of the present application provides a decoder, the decoder comprising a second memory and a second processor; wherein,
[0043] The second memory is used to store a computer program that can be run on the second processor;
[0044] The second processor is configured to execute the method according to the second aspect when running the computer program.
[0045] In a seventh aspect, an embodiment of the present application provides a computer storage medium storing a computer program, which implements the method described in the first aspect when executed by a first processor, or implements the method described in the second aspect when executed by a second processor.
[0046] The embodiment of the present application provides an image prediction method, an encoder, a decoder, and a storage medium for determining prediction parameters of a current block, wherein the prediction parameters include: a prediction mode parameter; when the prediction mode parameter indicates that a matrix-based intra-frame prediction MIP mode is used to determine an intra-frame prediction value of the current block, determining the MIP input sampling value of the current block according to adjacent sampling values of the current block; determining the product of the sum of the MIP input sampling values and the shift offset parameter according to the value of the shift offset parameter, wherein the value of the shift offset parameter is a fixed constant; and determining the product of the sum of the MIP input sampling values and the shift offset parameter according to the shift amount. The first constant value is determined by taking the value of the parameter, wherein the value of the shift quantity parameter is a fixed constant; the value of the first offset is set to the difference between the first constant value and the product; the MIP weighting matrix of the current block is determined according to the prediction parameter; the MIP prediction value of the current block is determined according to the MIP weighting matrix, the MIP input sample value, the shift quantity parameter and the first offset, wherein the MIP prediction value is the prediction value of some sampling points in the current block; the MIP prediction value is filtered to obtain the intra-frame prediction value of the current block. In this way, for the MIP mode, since the acquisition process of the shift offset parameter and the shift quantity parameter is simplified, it is possible to reduce the complexity and the storage space required in the decoding process while ensuring the decoding performance, thereby effectively improving the decoding efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 A schematic diagram of the process framework of a MIP prediction process provided for related technical solutions;
[0048] Figure 2 A schematic diagram of the system composition of an encoder provided in an embodiment of the present application;
[0049] Figure 3 A schematic diagram of the system composition of a decoder provided in an embodiment of the present application;
[0050] Figure 4 A schematic diagram of a flow chart of an image prediction method provided in an embodiment of the present application;
[0051] Figure 5 A schematic diagram of a process framework for obtaining a prediction block using the MIP mode provided in an embodiment of the present application;
[0052] Figure 6 A schematic diagram of a flow chart of another image prediction method provided in an embodiment of the present application;
[0053] Figure 7 A schematic diagram of the structure of an encoder provided in an embodiment of the present application;
[0054] Figure 8 A schematic diagram of the specific hardware structure of an encoder provided in an embodiment of the present application;
[0055] Figure 9 A schematic diagram of the structure of a decoder provided in an embodiment of the present application;
[0056] Figure 10 A schematic diagram of the specific hardware structure of a decoder provided in an embodiment of the present application;
[0057] Figure 11 A schematic diagram of the structure of a sending device provided in an embodiment of the present application;
[0058] Figure 12 A schematic diagram of the structure of a target device provided in an embodiment of the present application;
[0059] Figure 13 A schematic diagram of the structure of a communication system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0060] The following will be combined with the accompanying drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. It should be understood that the specific embodiments described herein are only used to explain the related applications and are not intended to limit the applications. It should also be noted that for ease of description, only the parts relevant to the related applications are shown in the drawings.
[0061] Currently, the International Telecommunication Union-Telecommunication (ITU-T) and the International Organization for Standardization (ISO) / International Electrotechnical Commission (IEC) have launched a standardization project called VVC to develop a new generation of video coding standards. Its purpose is to improve coding performance when encoding high-quality videos with one or more of the following characteristics: high resolution, high frame rate, high bit depth, high dynamic range, wide color gamut, and omnidirectional viewing angle.
[0062] In H.266 / VVC, matrix-based intra prediction (MIP) technology is an intra prediction mode. Through the MIP technology, an encoder or decoder can obtain an intra prediction block of a current block.
[0063] The following describes the relevant technical solutions for the prediction process of the MIP mode.
[0064] The input data of the MIP mode include: the position of the current block (xTbCmp, yTbCmp), the MIP mode index value applied to the current block (which can be represented by modeId), the height of the current block (represented by nTbH), the width of the current block (represented by nTbW), and a transposition processing indication flag indicating whether transposition is required (represented by isTransposed), etc.
[0065] The output data of the MIP mode includes: the intra-frame prediction block of the current block. The prediction value corresponding to the pixel coordinate [x][y] in the intra-frame prediction block is predSamples[x][y]; where x = 0, 1, ..., nTbW-1; y = 0, 1, ..., nTbH-1.
[0066] like Figure 1 As shown, the MIP prediction process may include four steps:
[0067] S101: Configure core parameters.
[0068] For S101, the MIP core parameters may include the type of the current block (represented by mipSizeId), the number of reference samples for each edge (represented by boundySize), the number of MIP input samples (represented by inSize), and the MIP prediction block size output by matrix multiplication (arranged as predSize × predSize). The current block can be divided into three categories based on its size, and the type of the current block is recorded by mipSizeId. Here, mipSizeId can be equal to 0, 1, or 2. Furthermore, the number of reference sample points and the MIP prediction block size output by matrix multiplication are different for different types of current blocks.
[0069] S102: Acquire reference pixels.
[0070] For S102, when predicting the current block, the upper block and the left block of the current block are both encoded blocks. The reference pixels of the MIP technology are the reconstructed values of the upper row of pixels and the left column of pixels of the current block. The process of obtaining the reference pixels adjacent to the upper side (represented by refT) and the reference pixels adjacent to the left side (represented by refL) of the current block is the reference pixel acquisition process.
[0071] S103: Construct input samples.
[0072] For S103, this step is used for input of matrix multiplication, and may specifically include:
[0073] S1031: Obtain reference samples;
[0074] S1032: Construct a reference sampling buffer;
[0075] S1033: Derive matrix multiplication input samples.
[0076] In S1031, the process of obtaining the reference sample is to downsample the reference pixel. In S1032, there are two filling methods in the construction of the reference sample buffer: a filling method when transposition is not required and a filling method when transposition is required.
[0077] S104: Generate a predicted value.
[0078] For S104, this step is used to obtain the MIP prediction value of the current block, which may specifically include:
[0079] S1041: Constructing a MIP prediction block of matrix multiplication output samples;
[0080] S1042: Performing a bit embedding operation on the MIP prediction block of the matrix multiplication output sample;
[0081] S1043: performing a transposition operation on the MIP prediction block of the matrix multiplication output sample;
[0082] S1044: Generate a final MIP prediction value.
[0083] In S1041, the process of constructing the MIP prediction block requires obtaining not only the weight matrix but also the shift offset parameter and the shift quantity parameter. A matrix multiplication operation is then performed to obtain the MIP prediction block of the matrix multiplication output samples. In S1044, generating the final MIP prediction value involves two scenarios: generating a prediction value that does not require upsampling, and generating a prediction value that requires upsampling.
[0084] In this way, after the above four steps S101 to S104, the predicted value of at least one pixel in the current block can be obtained.
[0085] exist Figure 1 In the MIP prediction process shown, the MIP pattern is highly complex, especially when it comes to obtaining the shift and offset factors. In related art, different matrices have different shift and offset factors, resulting in significant storage space and computational complexity required to obtain these factors. Therefore, while MIP technology improves codec performance, it also significantly increases the storage space and computational complexity required during the codec process, reducing codec efficiency.
[0086] Furthermore, due to the computational complexity and storage cost required by the MIP model, it is difficult to implement on devices with relatively low computing power or limited storage capacity. Consequently, the MIP model in related technologies cannot be widely adopted and is difficult to implement in codec implementations and dynamic video streaming.
[0087] Based on this, an embodiment of the present application provides an image prediction method, the basic idea of which is to: determine the prediction parameters of the current block, wherein the prediction parameters include: a prediction mode parameter; when the prediction mode parameter indicates that the intra-frame prediction value of the current block is determined using a matrix-based intra-frame prediction MIP mode, the MIP input sampling value of the current block is determined according to the adjacent sampling values of the current block; according to the value of the shift offset parameter, the sum of the MIP input sampling values and the product of the shift offset parameter is determined, wherein the value of the shift offset parameter is a fixed constant; according to the shift amount The first constant value is determined by taking the value of the parameter, wherein the value of the shift quantity parameter is a fixed constant; the value of the first offset is set to the difference between the first constant value and the product; the MIP weighting matrix of the current block is determined according to the prediction parameter; the MIP prediction value of the current block is determined according to the MIP weighting matrix, the MIP input sample value, the shift quantity parameter and the first offset, wherein the MIP prediction value is the prediction value of some sampling points in the current block; the MIP prediction value is filtered to obtain the intra-frame prediction value of the current block. In this way, for the MIP mode, since the acquisition process of the shift offset parameter and the shift quantity parameter is simplified, it is possible to reduce the complexity and the storage space required in the decoding process while ensuring the decoding performance, thereby effectively improving the decoding efficiency.
[0088] See also Figure 2 , which shows an example of a system composition block diagram of an encoder provided by an embodiment of the present application. Figure 2 As shown, the encoder 200 may include: a segmentation unit 201, a prediction unit 202, a first adder 207, a transform unit 208, a quantization unit 209, an inverse quantization unit 210, an inverse transform unit 211, a second adder 212, a filtering unit 213, a decoded picture buffer (DPB) unit 214 and an entropy coding unit 215.
[0089] Among them, the segmentation unit 201 divides the picture in the input video into one or more coding tree units (CTUs). The segmentation unit 201 divides the picture into multiple tiles, and can further divide a tile into one or more bricks, where a tile or a brick may include one or more complete and / or partial CTUs. In addition, the segmentation unit 201 can form one or more slices, where a slice can include one or more tiles arranged in a grid order in the picture, or one or more tiles covering a rectangular area in the picture. The segmentation unit 201 can also form one or more sub-pictures, where a sub-picture can include one or more slices, tiles or bricks.
[0090] In encoder 200, segmentation unit 201 transmits the CTU to prediction unit 202. Prediction unit 202 may generally consist of a block segmentation unit 203, a motion estimation (ME) unit 204, a motion compensation (MC) unit 205, and an intra-prediction unit 206. Specifically, block segmentation unit 203 iteratively divides the input CTU into smaller coding units (CUs) using quadtree, binary, and ternary tree partitioning. Prediction unit 202 may use ME unit 204 and MC unit 205 to obtain inter-prediction blocks for the CU. Intra-prediction unit 206 may use various intra-prediction modes, including MIP mode, to obtain intra-prediction blocks for the CU. In an example, a rate-distortion-optimized motion estimation approach may be used by ME unit 204 and MC unit 205 to obtain inter-prediction blocks, and a rate-distortion-optimized mode determination approach may be used by intra-prediction unit 206 to obtain intra-prediction blocks.
[0091] The prediction unit 202 outputs the prediction block of the CU, and the first adder 207 calculates the difference between the CU in the output of the partition unit 201 and the prediction block of the CU, i.e., the residual CU. The transform unit 208 reads the residual CU and performs one or more transform operations on the residual CU to obtain coefficients. The quantization unit 209 quantizes the coefficients and outputs the quantized coefficients (i.e., levels). The inverse quantization unit 210 performs a scaling operation on the quantized coefficients to output reconstructed coefficients. The inverse transform unit 211 performs one or more inverse transforms corresponding to the transform in the transform unit 208 and outputs the reconstructed residual. The second adder 212 calculates the reconstructed CU by adding the reconstructed residual and the prediction block of the CU from the prediction unit 202. The second adder 212 also sends its output to the prediction unit 202 for use as an intra-frame prediction reference. After all CUs in the picture or sub-picture are reconstructed, the filtering unit 213 performs loop filtering on the reconstructed picture or sub-picture. Here, the filtering unit 213 includes one or more filters, such as a deblocking filter, a sample adaptive offset (SAO) filter, an adaptive loop filter (ALF), a luminance mapping and chroma scaling (LMCS) filter, and a neural network-based filter. Alternatively, when the filtering unit 213 determines that a CU is not used as a reference for encoding other CUs, the filtering unit 213 performs loop filtering on one or more target pixels in the CU.
[0092] The output of the filtering unit 213 is a decoded picture or sub-picture, which is cached in the DPB unit 214. The DPB 214 outputs the decoded picture or sub-picture based on the timing and control information. Here, the picture stored in the DPB 214 can also be used as a reference for the prediction unit 202 to perform inter-frame prediction or intra-frame prediction. Finally, the entropy coding unit 215 converts the parameters required for decoding the picture from the encoder 200 (such as control parameters and supplementary information, etc.) into binary form and writes this binary form into the code stream according to the syntax structure of each data unit. That is, the encoder 200 finally outputs the code stream.
[0093] Furthermore, the encoder 200 may be a first memory having a first processor and a computer program. When the first processor reads and runs the computer program, the encoder 200 reads the input video and generates a corresponding bitstream. In addition, the encoder 200 may also be a computing device having one or more chips. These units implemented as integrated circuits on the chip have the same Figure 1 Similar connection and data exchange functions to the corresponding units in the
[0094] See also Figure 3, which shows an example of a system composition block diagram of a decoder provided in an embodiment of the present application. Figure 3 As shown, the decoder 300 may include: a parsing unit 301, a prediction unit 302, a scaling unit 305, a transform unit 306, an adder 307, a filtering unit 308 and a decoded picture cache unit 309.
[0095] The input codestream to decoder 300 may be the codestream output by encoder 200. Parsing unit 301 parses the input codestream and obtains syntax element values from the input codestream. Parsing unit 301 converts the binary representation of the syntax elements into digital values and sends the digital values to units within decoder 300 to obtain one or more decoded pictures. Parsing unit 301 may also parse one or more syntax elements from the input codestream to display decoded pictures.
[0096] In the decoder 300 , the parsing unit 301 sends the values of the syntax elements and one or more variables set or determined according to the values of the syntax elements and used to obtain one or more decoded pictures to the units in the decoder 300 .
[0097] The prediction unit 302 determines a prediction block for a current decoding block (eg, a CU). Here, the prediction unit 302 may include a motion compensation unit 303 and an intra prediction unit 304.
[0098] Specifically, when the inter-frame decoding mode is indicated to be used to decode the current decoding block, the prediction unit 302 passes the relevant parameters from the parsing unit 301 to the motion compensation unit 303 to obtain an inter-frame prediction block; when the intra-frame prediction mode (including the MIP mode based on the MIP flag) is indicated to be used to decode the current decoding block, the prediction unit 302 transmits the relevant parameters from the parsing unit 301 to the intra-frame prediction unit 304 to obtain an intra-frame prediction block.
[0099] The scaling unit 305 has the same function as the inverse quantization unit 210 in the encoder 200. The scaling unit 305 performs a scaling operation on the quantization coefficients (ie, levels) from the parsing unit 301 to obtain reconstructed coefficients.
[0100] The transform unit 306 has the same function as the inverse transform unit 211 in the encoder 200. The transform unit 306 performs one or more transform operations (ie, inverse operations of one or more transform operations performed by the inverse transform unit 211 in the encoder 200) to obtain a reconstructed residual.
[0101] The adder 307 performs an addition operation on its input (the prediction block from the prediction unit 302 and the reconstructed residual from the transform unit 306) to obtain a reconstructed block of the current decoded block. The reconstructed block is also sent to the prediction unit 302 to be used as a reference for other blocks encoded in the intra prediction mode.
[0102] After all CUs in the picture or sub-picture are reconstructed, the filtering unit 308 performs loop filtering on the reconstructed picture or sub-picture. The filtering unit 308 includes one or more filters, such as a deblocking filter, a sample adaptive offset filter, an adaptive loop filter, a luminance mapping and chroma scaling filter, and a neural network-based filter. Alternatively, when the filtering unit 308 determines that the reconstructed block is not used as a reference for decoding other blocks, the filtering unit 308 performs loop filtering on one or more target pixels in the reconstructed block. Here, the output of the filtering unit 308 is a decoded picture or sub-picture, which is cached to the DPB 309. The DPB 309 outputs the decoded picture or sub-picture based on timing and control information. The picture stored in the DPB 309 can also be used as a reference for performing inter-frame prediction or intra-frame prediction by the prediction unit 302.
[0103] Furthermore, the decoder 300 may be a second processor and a second memory for recording a computer program. When the first processor reads and runs the computer program, the decoder 300 reads the input code stream and generates a corresponding decoded video. In addition, the decoder 300 may also be a computing device having one or more chips. These units implemented as integrated circuits on the chip have the same Figure 3 Similar connection and data exchange functions to the corresponding units in the
[0104] It should be understood that the image prediction method provided in the embodiment of the present application mainly acts on the intra-frame prediction unit 206 of the encoder 200 and the intra-frame prediction unit 304 of the decoder 300. In other words, the image prediction method in the embodiment of the present application can be applied to both the encoder and the decoder, and can even be applied to both the encoder and the decoder at the same time, but there is no limitation. Here, if the encoder 200 can obtain a better prediction effect and improve the encoding performance through the image prediction method provided in the embodiment of the present application, then, correspondingly, the decoder 300 can also improve the video decoding recovery quality, thereby improving the decoding performance.
[0105] Based on this, the technical solution of this application is further described in detail below with reference to the accompanying drawings and embodiments. Before proceeding with the detailed description, it should be noted that the terms "first", "second", "third", etc. mentioned throughout the specification are only used to distinguish different features and do not have the function of defining priority, sequence, size relationship, etc.
[0106] The present invention provides an image prediction method for use in a video encoding device, such as an encoder. The functions implemented by the method can be implemented by a first processor in the encoder invoking a computer program. The computer program can also be stored in a first memory. Therefore, the encoder includes at least a first processor and a first memory.
[0107] See also Figure 4 , which shows a flow chart of an image prediction method according to an embodiment of the present application. Figure 4 As shown, the method may include:
[0108] S401: Determine prediction parameters of a current block, wherein the prediction parameters include prediction mode parameters.
[0109] It should be noted that the image to be encoded can be divided into multiple image blocks, each of which can be referred to as a coding block. Here, each coding block can include a first image component, a second image component, and a third image component. The current block is the coding block in the video image for which prediction of the first image component, the second image component, or the third image component is currently being performed.
[0110] Assume that a first image component prediction is performed on the current block, and the first image component is the luminance component. That is, the image component to be predicted is the luminance component, and the current block can also be called a luminance block. Alternatively, assume that a second image component prediction is performed on the current block, and the second image component is the chrominance component, that is, the image component to be predicted is the chrominance component, and the current block can also be called a chrominance block.
[0111] It should also be noted that the prediction mode parameter is used to indicate the prediction mode used for the current block, and different prediction modes correspond to different prediction mode parameters. Here, the prediction mode parameters can be determined using a simple decision-making strategy, such as determining based on the magnitude of the distortion value; or a complex decision-making strategy, such as determining based on the results of rate distortion optimization (RDO), which is not limited in this embodiment of the present application. Generally speaking, the RDO method can be used to determine the prediction mode parameters for the current block.
[0112] Specifically, in some embodiments, for S401, determining the prediction parameters of the current block may include:
[0113] Performing precoding processing on the current block using multiple prediction modes to obtain rate-distortion cost values corresponding to the multiple prediction modes;
[0114] A minimum rate-distortion cost value is selected from the obtained multiple rate-distortion cost values, and prediction mode parameters in the prediction mode corresponding to the minimum rate-distortion cost value are determined as prediction mode parameters of the current block.
[0115] That is to say, on the encoder side, multiple prediction modes can be used for the current block to perform pre-encoding processing on the current block respectively. Here, the multiple prediction modes generally include inter-frame prediction mode, traditional intra-frame prediction mode and non-traditional intra-frame prediction mode. Among them, the traditional intra-frame prediction mode may include direct current (DC) mode, planar (PLANAR) mode and angle mode, etc. The non-traditional intra-frame prediction mode may include MIP mode, cross-component linear model prediction (CCLM) mode, intra block copy (IBC) mode and PLT (Palette) mode, etc. The inter-frame prediction mode may include traditional inter-frame prediction mode and geometrical partitioning for inter blocks (GEO) mode, etc.
[0116] In this way, after pre-encoding the current block using multiple prediction modes, rate-distortion cost values corresponding to the multiple prediction modes can be obtained. Then, a minimum rate-distortion cost value is selected from the multiple obtained rate-distortion cost values, and the prediction mode parameters under the prediction mode corresponding to the minimum rate-distortion cost value are determined as the prediction mode parameters of the current block.
[0117] In addition, after pre-encoding the current block using multiple prediction modes, distortion values corresponding to the multiple prediction modes can be obtained. A minimum distortion value is then selected from the obtained multiple distortion values, and the prediction mode parameters for the prediction mode corresponding to the minimum distortion value are determined as the prediction mode parameters for the current block. In this manner, the current block is ultimately predictively encoded using the determined prediction mode parameters. In the prediction mode corresponding to the prediction mode parameters, the prediction residual can be reduced, thereby improving coding efficiency.
[0118] S402: When the prediction mode parameter indicates that a matrix-based intra prediction MIP mode is used to determine an intra prediction value of a current block, determine a MIP input sample value of the current block according to adjacent sample values of the current block.
[0119] 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 it is necessary to determine the MIP input sampling value of the current block based on the adjacent sampling values of the current block.
[0120] It should be understood that for the MIP mode, the MIP core parameters need to be configured first. Here, the MIP core parameters may include the type of the current block (represented by mipSizeId), the number of reference samples for each side (represented by boundySize), the number of MIP input samples (represented by inSize), and the MIP prediction block size output by matrix multiplication (arranged as predSize×predSize). Among them, the MIP mode can divide the current block into three categories according to the width and height of the current block, and mipSizeId can be equal to 0, 1 or 2. Here, mipSizeId represents the type of the current block, that is, the block size index value of the current block in the embodiment of the present application. For different mipSizeId, the number of reference samples (boundySize reference sampling points are required for each side), the number of MIP input samples (inSize), and the MIP prediction block size output by matrix multiplication (arranged as predSize×predSize) are also different.
[0121] It should also be noted that, in addition to the prediction mode parameters, the prediction parameters may also include: a size parameter of the current block. Here, based on the size parameter of the current block, the block size index value (ie, mipSizeId) of the current block can be determined.
[0122] In a possible implementation, determining the block size index value of the current block according to the size parameter of the current block may include:
[0123] 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;
[0124] On the contrary, 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;
[0125] On the contrary, if the current block is a block of another size, the block size index value of the current block may be set to 2.
[0126] In another possible implementation, determining the block size index value of the current block according to the size parameter of the current block may include:
[0127] 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;
[0128] On the contrary, if one of the width and height of the current block is equal to 4, the block size index value of the current block can be set to 1;
[0129] On the contrary, if the current block is a block of another size, the block size index value of the current block may be set to 2.
[0130] Thus, according to the block size index value of the current block, the number of adjacent boundary reference samples (variable boundarySize) and the size of the MIP prediction block (variable predSize, the size of the MIP prediction block is predSize × predSize) can be determined according to the look-up table (LUT) shown in Table 1, and the number of MIP input sample values (expressed as inSize) used for the MIP matrix multiplication operation process can be calculated. The calculation formula is as follows:
[0131] inSize=(2×boundarySize)-(mipSizeId==2)? 1:0 (1)
[0132] The operation rules of the operators in formula (1) are the same as those defined in the ITU-T H.265 standard. For example, “==” is a logical “equal to” operator.
[0133] Table 1
[0134] mipSizeId boundarySize predSize 0 2 4 1 4 4 2 4 8
[0135] Thus, according to Table 1, when the value of mipSizeId is 0, the value of boundarySize can be 2, and the value of predSize can be 4. That is, at this time, the reference pixel selects two pixels for each edge, and the matrix multiplication output is a 4×4 MIP prediction block.
[0136] When the value of mipSizeId is 1, the value of boundarySize can be 4, and the value of predSize can be 4. That is, at this time, the reference pixel selects four pixels for each edge, and the matrix multiplication output is a 4×4 MIP prediction block.
[0137] When the value of mipSizeId is 2, the value of boundarySize can be 4, and the value of predSize can be 8; that is, at this time, the reference pixel selects four pixels for each edge, and the matrix multiplication output is an 8×8 MIP prediction block.
[0138] In addition, the values of boundarySize, inSize, and predSize can also be determined according to the block size index value of the current block and the lookup table shown in Table 2.
[0139] Table 2
[0140] mipSizeId boundarySize inSize predSize 0 2 4 4 1 4 8 4 2 4 7 8
[0141] Thus, according to Table 2, when the value of mipSizeId 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, the reference pixel selects two pixel points for each edge, the number of matrix multiplication input sampling points is four, and the matrix multiplication output is a 4×4 MIP prediction block.
[0142] When the value of mipSizeId 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, the reference pixel selects four pixels for each edge, the number of matrix multiplication input sampling points is eight, and the matrix multiplication output is a 4×4 MIP prediction block.
[0143] When the value of mipSizeId 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, the reference pixel selects four pixels for each edge, the number of matrix multiplication input sampling points is seven, and the matrix multiplication output is an 8×8 MIP prediction block.
[0144] Furthermore, after configuring the MIP core parameters, it is necessary to obtain reference pixels. Then, based on the reference pixels and the MIP core parameters, the MIP input sample values are constructed. The reference pixels here are the adjacent sample values of the current block, which may include the left adjacent sample values of the current block and the upper adjacent sample values of the current block. In other words, the MIP input sample values of the current block can be determined based on the left adjacent sample values and the upper adjacent sample values of the current block.
[0145] In some embodiments, determining the MIP input sample value of the current block based on the neighboring sample values of the current block may include:
[0146] Performing downsampling filtering on adjacent sample values of the current block to obtain a first temporary reference value;
[0147] When the size parameter value of the current block is within a preset range, determining a second constant value according to the bit depth of adjacent sample values of the current block;
[0148] Setting the value corresponding to index number 0 in the MIP input sample value to be equal to the difference between the second constant value and the value corresponding to index number 0 in the first temporary reference value;
[0149] Setting the value corresponding to index number i in the MIP input sample value to be equal to the difference between the value corresponding to index number i in the first temporary reference value and the value corresponding to index number 0 in the first temporary reference value, where i is an integer greater than 0;
[0150] When the size parameter value of the current block is not within a preset range, the value corresponding to the index number j in the MIP input sampling value is set to be equal to the difference between the value corresponding to the index number j+1 in the first temporary reference value and the value corresponding to the index number 0 in the first temporary reference value, where j is an integer greater than or equal to 0.
[0151] It should be noted that after downsampling and filtering the adjacent sample values of the current block, a first temporary reference value can be obtained. Specifically, the first temporary reference value can be cached in a buffer (denoted by pTemp) after downsampling and filtering the adjacent sample values of the current block. The value corresponding to index 0 in the first temporary reference value is pTemp[0], and the value corresponding to index i in the first temporary reference value is pTemp[i].
[0152] It should also be noted that, based on the block size index value of the current block (represented by mipSizeId), it can be determined whether the size parameter value of the current block is within the preset range. Specifically, when mipSizeId = 0 or 1, it indicates that the size parameter value of the current block is within the preset range; when mipSizeId = 2, it indicates that the size parameter value of the current block is not within the preset range.
[0153] That is to say, the MIP input sampling value is determined by the buffer (represented by pTemp), the block size index value of the current block (represented by MipSizeId), and the bit depth of the adjacent sampling value of the current block (represented by BitDepth), and the number of input samples contained in the MIP input sampling value is only related to the block size index value of the current block. Finally, the value corresponding to the index number x in the MIP input sampling value can be obtained (represented by p[x]).
[0154] Furthermore, in some embodiments, determining the second constant value according to the bit depth of the adjacent sample values of the current block may include:
[0155] The second constant value is set to be equal to an integer exponent power of 2, wherein the exponent of the power is equal to the bit depth of the adjacent sample values of the current block minus 1.
[0156] Alternatively, in some embodiments, determining the second constant value according to the bit depth of the adjacent sample values of the current block may include:
[0157] Perform a binary bit left shift on "1" to obtain the second constant value, wherein the number of bits of the bit left shift is equal to the bit depth of the adjacent sample values of the current block minus 1.
[0158] That is, after obtaining the bit depth BitDepth of the adjacent sample values of the current block, the second constant value can be expressed as 1<<(BitDepth-1) or 2^(BitDepth-1). In this way, when the size parameter value of the current block is within the preset range, the second constant value can be combined to determine the MIP input sample value of the current block.
[0159] It should also be noted that the MIP input sample is a matrix vector used for matrix multiplication. The current related technical solution is determined by the buffer (represented by pTemp), the type of the current block (i.e., the block size index value of the current block, represented by mipSizeId), the bit depth of the adjacent sample values of the current block (represented by BitDepth), and the number of MIP input samples. The final value corresponding to the index number x in the MIP input sample value is obtained (represented by p[x]).
[0160] Specifically, the construction process of the x-th input sample value p[x] is as follows:
[0161] In a possible implementation, when the size parameter value of the current block is within a preset range, the construction process may include:
[0162] Calculate the difference between the second constant value and the value corresponding to the index number 0 in the first temporary reference value to obtain the value corresponding to the index number 0 in the MIP input sample value;
[0163] Subtract the value corresponding to index number i in the first temporary reference value from the value corresponding to index number 0 in the first temporary reference value to obtain the value corresponding to index number i in the MIP input sampling value; wherein i is a positive integer greater than 0 and less than N, and N represents the number of elements contained in the input sampling matrix.
[0164] Furthermore, for calculating the difference between the second constant value and the value corresponding to index 0 in the first temporary reference value, the method may further include:
[0165] Setting the minuend in the calculation of the difference to be equal to the value corresponding to the index number 0 in the first temporary reference value;
[0166] The subtrahend in the calculation of the difference is set equal to the second constant value.
[0167] That is, when mipSizeId = 0 or 1, when x is equal to 0, the value corresponding to index number 0 in the MIP input sample value (represented by p[0]) can be obtained by subtracting the second constant value (i.e., 1<<(BitDepth-1)) from the value corresponding to index number 0 in the first temporary reference value (i.e., pTemp[0]). When x is not equal to 0, the value corresponding to index number x in the MIP input sample value (represented by p[x]) needs to be obtained by subtracting the value corresponding to index number 0 in the first temporary reference value (i.e., pTemp[0]) from the value corresponding to index number x in the first temporary reference value (i.e., pTemp[x]).
[0168] The details are as follows:
[0169]
[0170] Alternatively, the method may further include:
[0171] setting the minuend in the calculation of the difference to be equal to a second constant value;
[0172] The subtrahend in the calculation of the difference is set to be equal to the value corresponding to the index number 0 in the first temporary reference value.
[0173] That is, when mipSizeId=0 or 1, p[0] can be obtained by subtracting pTemp[0] from 1<<(BitDepth-1); and when x is not equal to 0, p[x] can be obtained by subtracting pTemp[0] from pTemp[x].
[0174]
[0175] In another possible implementation, when the size parameter value of the current block is not within a preset range, the construction process may include:
[0176] Perform a subtraction operation on the value corresponding to the index number i+1 in the first temporary reference value and the value corresponding to the index number 0 in the first temporary reference value to obtain the value corresponding to the index number i in the MIP input sampling value; where i is a positive integer greater than or equal to 0 and less than N, and N represents the number of elements contained in the input sampling matrix.
[0177] That is, when mipSizeId=2, the value corresponding to index 0 in the first temporary reference value, i.e., pTemp[0], can be ignored. Then, the value corresponding to index x in the MIP input sample value (represented by p[x]) can be obtained by subtracting the value corresponding to index 0 in the first temporary reference value (i.e., pTemp[0]) from the value corresponding to index x+1 in the first temporary reference value (i.e., pTemp[x+1]). Here, x is a positive integer greater than or equal to 0. Specifically, as shown below,
[0178] p[x]=pTemp[x+1]-pTemp[0] for x=0,...,inSize-1 (4)
[0179] Thus, still taking the 4×4 current block as an example, the buffer pTemp stores four values, namely, the first temporary reference value includes: the value corresponding to the index number 0 (i.e., pTemp[0]), the value corresponding to the index number 1 (i.e., pTemp[1]), the value corresponding to the index number 2 (i.e., pTemp[2]), and the value corresponding to the index number 3 (i.e., pTemp[3]); at this time, according to formula (2), formula (3), or formula (4), four MIP input sample values can be determined, represented by p[x], where x = 0, 1, 2, 3. Here, for these four MIP input sample values, they can also be combined into a 1×4 MIP input sample matrix.
[0180] S403: Determine, according to the value of the shift offset parameter, the product of the sum of the MIP input sample values and the shift offset parameter.
[0181] It should be noted that the shift offset parameter may also be referred to as an offset factor and may be represented by f0. In the embodiment of the present application, the value of the shift offset parameter may be set to a fixed constant, such as 46, 56, 66, or 32. The value of the shift offset parameter may also be set to be related to a shift offset parameter table, and the value of the shift offset parameter may be determined by looking up the table, which is not limited herein.
[0182] S404: Determine a first constant value according to the value of the shift quantity parameter.
[0183] S405: Setting the value of the first offset to the difference between the first constant value and the product.
[0184] It should be noted that the shift quantity parameter may also be referred to as a shift factor, number of shift bits, weight shift value, etc., and may be represented by sW, shift, or weight shift. In the embodiment of the present application, the shift quantity parameter is represented by sW. In addition, the first offset may be represented by oW, and the first offset is related to both the shift quantity parameter and the shift offset parameter.
[0185] In the embodiment of the present application, the value of the shift quantity parameter can be set to a fixed constant, such as 5, 6, or 7. The value of the shift quantity parameter can also be set to be related to a shift quantity parameter table, and the value of the shift quantity parameter can be determined by looking up the table, which is not limited here.
[0186] S406: Determine a MIP weighting matrix of the current block according to the prediction parameters.
[0187] It should be noted that the prediction parameters may include prediction mode parameters and may also include the size parameters of the current block. Among the prediction parameters, when the prediction mode parameters indicate the use of a MIP mode to determine the intra-frame prediction value of the current block, a weight matrix table may be pre-established and stored in a memory or storage unit. The memory or storage unit may be integrated into the encoder or may be separately provided. Thus, based on the block size index value (mipSizeId) and the MIP mode index value (modeId) of the current block, the MIP weight matrix (or MIP weight matrix, or simply MIP matrix) required for the current block can be determined by table lookup, represented by mWeight[x][y]. The block size index value (mipSizeId) of the current block is determined by the size parameter of the current block, while 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.
[0188] In the MIP weighting matrix shown in Table 3, the number of columns is the number inSize of matrix multiplication input samples, and the number of rows is the number predSized×predSized of matrix multiplication output samples, so that the MIP weighting matrix of the current block can be determined.
[0189] Table 3
[0190] mipSizeId Number of columns Number of lines 0 4 16 1 8 16 2 7 64
[0191] Furthermore, a shift quantity parameter table may be pre-established in the encoder, and the shift quantity parameter table may also be stored in a memory or storage unit. The memory or storage unit may be integrated into the encoder or may be separately provided. In the embodiment of the present application, the determination of the shift quantity parameter (sW) may include the following methods:
[0192] In one possible implementation, for different block sizes and different MIP mode index values, the shift amount parameter may be different. In some embodiments, the method may further include:
[0193] When the prediction mode parameter indicates that the intra prediction value of the current block is determined using the MIP mode, determining the MIP mode index value of the current block;
[0194] According to the MIP mode index value, querying a value corresponding to the MIP mode index value from a first preset lookup table, wherein the first preset lookup table is used to record a correspondence between the MIP mode index value and the value of the shift quantity parameter;
[0195] The queried value is determined as the value of the shift quantity parameter.
[0196] It should be noted that the value of the shift amount parameter can be queried based on the block size index value (represented by mipSizeId) and the MIP mode index value (modeId) of the current block. As shown in Table 4, the first preset lookup table can be used to determine the shift amount parameter required for matrix multiplication for different mipSizeId and modeId.
[0197] Table 4
[0198]
[0199] However, on the encoder side, Table 4 needs to be stored in a memory or storage unit in the form of a lookup table; however, storage has a cost, and the lookup process also has a cost; since the value of the shift amount parameter in Table 4 is related to the block size and MIP mode index value of the current block, it increases memory usage and also increases computational complexity.
[0200] In order to reduce memory usage and computational complexity, the embodiment of the present application may simplify the method for determining the shift quantity parameter.
[0201] In another possible implementation, the value of the shift amount parameter can be set to a fixed constant, and is a fixed constant that is independent of the block size index value and the MIP mode index value. For example, for different block size index values and different MIP mode index values, the value of the shift amount parameter can be set to 5; or, for different block size index values and different MIP mode index values, the value of the shift amount parameter can be set to 6; or, for different block size index values and different MIP mode index values, the value of the shift amount parameter can be set to 7. In the embodiment of the present application, preferably, the value of the shift amount parameter is equal to 6, but this is not limited to any particular value.
[0202] In another possible implementation, regarding the value of the shift quantity parameter, the method may further include:
[0203] Determining a block size index value of the current block according to a size parameter of the current block;
[0204] The value of the shift quantity parameter is determined according to the block size index value of the current block.
[0205] 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.
[0206] In a possible implementation, determining the block size index value of the current block according to the size parameter of the current block may include:
[0207] 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;
[0208] 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;
[0209] When the width and height of the current block do not meet the aforementioned conditions, the block size index value of the current block is set to 2.
[0210] In this way, after the block size index value of the current block is determined, the value of the shift amount parameter can be further determined according to the block size index value of the current block.
[0211] Optionally, in some embodiments, determining the value of the shift quantity parameter according to the block size index value of the current block may include:
[0212] The value of the shift amount parameter is set to be equal to the ratio between the width or height of the current block and a first preset value of a block size index value corresponding to the current block.
[0213] Here, the first preset value represents the number of MIP input sample values obtained from the boundary of the current block. In this case, the method may further include:
[0214] When the block size index values of the current block are respectively equal to 0, 1, and 2, it is determined that the first preset values corresponding to the block size index values of the current block are respectively equal to 2, 4, and 4.
[0215] 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, 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 value of the shift quantity parameter can be determined according to the ratio between the width or height of the current block and the corresponding first preset value.
[0216] Optionally, in some embodiments, determining the value of the shift quantity parameter according to the block size index value of the current block may include:
[0217] The value of the shift amount parameter is set to be equal to the ratio between the width or height of the current block and a second preset value of the block size index value corresponding to the current block.
[0218] Here, the second preset value represents the size of the MIP prediction block of the current block obtained by directly using the MIP weighting matrix. In this case, the method may further include:
[0219] When the block size index values of the current block are respectively equal to 0, 1, and 2, it is determined that the second preset values corresponding to the block size index values of the current block are respectively equal to 4, 4, and 8.
[0220] That is to say, when the second preset value represents the size of the MIP prediction block of the current block obtained by directly using the MIP weighting matrix, 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 value of the shift quantity parameter can be determined according to the ratio between the width or height of the current block and the corresponding second preset value.
[0221] In another possible implementation, the shift quantity parameter table can be minimized, and the value of the shift quantity parameter can still be determined using a lookup table. Optionally, in some embodiments, determining the value of the shift quantity parameter based on the block size index value of the current block can include:
[0222] According to the block size index value, querying a value corresponding to the block size index value from a second preset lookup table, wherein the second preset lookup table is used to record a correspondence between the block size index value and the value of the shift quantity parameter;
[0223] The queried value is determined as the value of the shift quantity parameter.
[0224] It should be noted that the value of the shift amount parameter can be queried based solely on the block size index value (represented by mipSizeId) of the current block. As shown in Table 5, the second preset lookup table can correspond to a fixed value for each block size index value. That is, each block size or each block size set can have a fixed shift amount parameter value as shown in Table 5.
[0225] Table 5
[0226] mipSizeId sW 0 5 1 6 2 5
[0227] According to Table 5, when the block size index values of the current block are respectively equal to 0, 1, and 2, it can be determined that the values of the shift quantity parameter corresponding to the block size index values are respectively equal to 5, 6, and 5.
[0228] In the above-mentioned embodiment, by simplifying the method of determining the shift quantity parameter, especially minimizing the shift quantity parameter table or fixing the value of the shift quantity parameter, the storage of the lookup table can be minimized, thereby reducing the memory occupied by the shift quantity parameter table storage in the MIP mode without increasing the computational complexity.
[0229] In the encoder, a shift offset parameter table may also be pre-established, and the shift offset parameter table is also stored in a memory or storage unit. The memory or storage unit here may be integrated into the encoder or may be set separately. In the embodiment of the present application, the determination of the shift offset parameter (fO) may include the following methods:
[0230] In one possible implementation, for different block sizes and different MIP mode index values, the shift offset parameter may also be different. In some embodiments, the method may further include:
[0231] When the prediction mode parameter indicates that the intra prediction value of the current block is determined using the MIP mode, determining the MIP mode index value of the current block;
[0232] According to the MIP mode index value, querying a value corresponding to the MIP mode index value from a third preset lookup table, wherein the third preset lookup table is used to record the correspondence between the MIP mode index value and the value of the shift offset parameter;
[0233] The queried value is determined as the value of the shift offset parameter.
[0234] It should be noted that the value of the shift offset parameter can be queried based on the block size index value (represented by MipSizeId) and the MIP mode index value (modeId) of the current block. As shown in Table 6, the third preset lookup table can be used to determine the shift offset parameter required for matrix multiplication for different mipSizeId and modeId.
[0235] Table 6
[0236]
[0237] However, on the encoder side, Table 6 also needs to be stored in a memory or storage unit in the form of a lookup table; however, storage requires a cost, and the lookup process also requires a cost; since the value of the shift offset parameter in Table 6 is related to the block size and MIP mode index value of the current block, it increases memory usage and also increases computational complexity.
[0238] In order to reduce memory usage and computational complexity, the embodiment of the present application may also simplify the method for determining the shift offset parameter.
[0239] In another possible implementation, the value of the shift offset parameter can be set to a fixed constant, and it is a fixed constant that is independent of the block size index value and the MIP mode index value. Typically, the value range of the fixed constant is 0 to 100. For example, for different block size index values and different MIP mode index values, the value of the shift offset parameter can be set to 32; or, for different block size index values and different MIP mode index values, the value of the shift offset parameter can be set to 46; or, for different block size index values and different MIP mode index values, the value of the shift offset parameter can be set to 56; or, for different block size index values and different MIP mode index values, the value of the shift offset parameter can be set to 66. In the embodiment of the present application, preferably, the value of the shift offset parameter is equal to 32, but this is not limited to any limit.
[0240] In another possible implementation, for determining the value of the shift offset parameter, the method may further include:
[0241] Determining a block size index value of the current block according to a size parameter of the current block;
[0242] The value of the shift offset parameter is determined according to the block size index value of the current block.
[0243] 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; and then according to the block size index value of the current block, the value of the shift offset parameter can be further determined.
[0244] Specifically, the shift offset parameter table can be minimized, and the offset factor can still be determined by using a lookup table. Optionally, in some embodiments, determining the value of the shift offset parameter based on the block size index value of the current block can include:
[0245] According to the block size index value, querying a value corresponding to the block size index value from a fourth preset lookup table, wherein the fourth preset lookup table is used to record a correspondence between the block size index value and the value of the shift offset parameter;
[0246] The queried value is determined as the value of the shift offset parameter.
[0247] It should be noted that the value of the shift offset parameter can be queried based solely on the block size index value (represented by mipSizeId) of the current block. As shown in Table 7, the fourth preset lookup table may correspond to a fixed value for each block size index value. That is, each block size or each block size set may have a fixed shift offset parameter value as shown in Table 7.
[0248] Table 7
[0249] mipSizeId fO 0 34 1 23 2 46
[0250] According to Table 7, when the block size index values of the current block are respectively equal to 0, 1, and 2, it can be determined that the values of the shift offset parameters corresponding to the block size index values are respectively equal to 34, 23, and 46.
[0251] In the above-mentioned embodiment, by simplifying the method of determining the shift offset parameter, especially minimizing the shift offset parameter table or fixing the value of the shift offset parameter, the storage of the lookup table can be minimized, thereby reducing the memory occupied by the shift offset parameter table storage in the MIP mode without increasing the computational complexity.
[0252] Thus, after determining the shift offset parameter (fO) and the shift quantity parameter (sW), for the first constant value, optionally, in some embodiments, determining the first constant value according to the value of the shift quantity parameter may include:
[0253] The first constant value is set to an integer exponent power of 2, where the exponent of the power is equal to the value of the shift amount parameter minus 1.
[0254] Optionally, in some embodiments, determining the first constant value according to the value of the shift quantity parameter may include:
[0255] Perform a binary bit left shift on "1" to obtain the first constant value, wherein the number of bits of the bit left shift is equal to the value of the shift quantity parameter minus 1.
[0256] That is, after obtaining the shift amount parameter (sW), the first constant value can be expressed as 1<<(sW-1) or 2^(sW-1). In this case, when the shift amount parameter is set to 6, the first constant value can be equal to 32.
[0257] Here, if the first offset is represented by oW, the product of the sum of the MIP input sample values and the shift offset parameter (fO) can be calculated according to the shift offset parameter, which is Then the value of oW can be set to
[0258]
[0259] In this way, in the MIP mode, the MIP weighting matrix, the MIP input sample value, the shift quantity parameter and the first offset can be obtained, so as to subsequently determine the MIP prediction value of the current block.
[0260] S407: Determine a MIP prediction value of the current block according to the MIP weighting matrix, the MIP input sample value, the shift quantity parameter, and the first offset.
[0261] Here, the MIP prediction value is the prediction value of some sampling points in the current block.
[0262] It should be noted that determining the MIP prediction value of the current block according to the MIP weighting matrix, the MIP input sample value, the shift quantity parameter, and the first offset may include:
[0263] Calculating a first weighted sum of the MIP weight matrix and the MIP input sample value;
[0264] Calculating a first sum of the first weighted sum and the first offset;
[0265] Performing a binary bit right shift on the first sum value to obtain a first right-shifted value, wherein the number of bits of the right shift is equal to the value of the shift quantity parameter;
[0266] The MIP prediction value of the current block is set to be equal to the sum of the first right shift value and the value corresponding to the index number 0 in the first temporary reference value.
[0267] Specifically, in MIP mode, the MIP weighting matrix (represented by mWeight), the shift quantity parameter (represented by sW), and the shift offset parameter (represented by fO) can be determined according to the block size index value of the current block (represented by mipSizeId) and the MIP mode index value (represented by modeId); then the MIP input sampling value (represented by p[x]), mWeight, sW, and fO are input into the matrix multiplication process to obtain the MIP prediction value output by the matrix multiplication (represented by predMip[x][y]), and the sampling points in predMip[x][y] are arranged into a matrix form according to predSize×predSize. The calculation formula is as follows,
[0268]
[0269] Where [x][y] represents the position coordinates of the pixel point, x represents the horizontal direction, and y represents the vertical direction; inSize represents the number of input samples, p[i] represents the value corresponding to index number i in the MIP input sample value; pTemp[0] represents the value corresponding to index number 0 in the first temporary reference value; ">>" represents the binary right shift operator, and "<<" represents the binary left shift operator; incH, predC, and incW represent parameters used to obtain matrix values from the MIP weight matrix. Thus, according to the above formula (5), predMip[x][y] can be calculated to obtain the MIP prediction block.
[0270] In some embodiments, if sW is fixed at 6 and fO is fixed at 32, then the calculation formula is as follows:
[0271]
[0272] or,
[0273]
[0274] Furthermore, it is also necessary to perform embedding processing on the predicted values of the sampling points in the MIP prediction block to obtain the MIP prediction block of the current block; then determine whether to perform transposition processing on the MIP prediction block; if the judgment result is yes, then it is also necessary to perform transposition processing on the predicted sampling values in the MIP prediction block, and determine the transposed MIP prediction block as the MIP prediction block of the current block; if the judgment result is no, then there is no need to perform transposition processing on the predicted sampling values in the MIP prediction block, and the MIP prediction block can be directly determined as the MIP prediction block of the current block to obtain the MIP prediction value of the current block, and the MIP prediction value is the prediction value of some sampling points in the current block.
[0275] S408: Filter the MIP prediction value to obtain an intra-frame prediction value of the current block.
[0276] It should be noted that the filtering process on the MIP prediction value to determine the intra prediction value of the current block may include:
[0277] Determine whether the size of the MIP prediction block is the same as the size of the current block;
[0278] When the size of the MIP prediction block is the same as the size of the current block, setting the intra prediction block of the current block to be equal to the MIP prediction block; wherein the MIP prediction block includes predicted sample values of all pixel positions in the current block;
[0279] When the size of the MIP prediction block is different from the size of the current block, filtering is performed on the MIP prediction block to obtain a filtered prediction block, and the filtered prediction block is set as the intra prediction block of the current block.
[0280] Here, the filtering process may include an up-sampling filtering process or a low-pass filtering process.
[0281] It should be noted that a MIP prediction block is composed of MIP prediction values. After obtaining a MIP prediction block, since there are only two sizes of MIP prediction blocks: 4×4 MIP prediction blocks and 8×8 MIP prediction blocks, the size of the current block may or may not be the same as the size of the MIP prediction block. In other words, the sample values corresponding to the MIP prediction block may not be able to fill the current block. Therefore, the generation of the final prediction value may require upsampling the MIP prediction block. In other words, the determination of whether to upsample the MIP prediction block is based on whether the size of the MIP prediction block is the same as the size of the current block.
[0282] It should also 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 the same as the current block, it indicates that there is no need to upsample 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 pixels 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.
[0283] predSamples[x][y]=predMip[x][y] (8)
[0284] Where [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 formula (8), the MIP prediction block predMip[x][y] can be directly used as the intra-frame prediction block predSamples[x][y] of the current block, that is, the intra-frame prediction value of at least one pixel point in the current block.
[0285] It should also be noted that when the size of the MIP prediction block is different from the size 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, that is, there are empty pixels in the filled current block, indicating that the MIP prediction block needs to be filtered. In other words, if upsampling is required in both the horizontal and vertical directions, the MIP prediction block can be first sampled horizontally and then vertically to obtain a first upsampled block, which can be represented by predSamples[x][y]; then the MIP prediction block can be sampled vertically and then horizontally to obtain a second upsampled block, which can be represented by predSamplesTemp[x][y]; finally, the weighted average of predSamples[x][y] and predSamplesTemp[x][y] is calculated to obtain the intra-frame prediction block of the current block.
[0286] For example, if the side length nTbS of the current block (where S can be replaced by W and H, respectively) is equal to the side length predSize of predMip (where predSize is only related to blocksizeIdx of the current block), then the MIP prediction block can be directly set as the intra prediction block of the current block; otherwise, the MIP prediction block needs to be filtered to obtain the intra prediction block of the current block. Here, taking a 4×4 current block as an example, if the current block and the MIP prediction block have the same size, then there is no need to filter the MIP prediction block. In this case, the MIP prediction block can be directly set as the intra prediction block of the current block, thereby obtaining the intra prediction value of at least one pixel in the current block.
[0287] The following will be combined Figure 2 The encoder 200 shown specifically illustrates the image prediction method of the embodiment of the present application.
[0288] It should be understood that when the intra-frame prediction unit 206 determines that the MIP mode is used to encode the current block (or CU), or when the intra-frame prediction unit 206 uses the rate-distortion optimization method to evaluate the MIP mode for encoding the CU, the intra-frame prediction unit 206 will obtain the intra-frame prediction block of the current block; wherein the intra-frame prediction block of the current block includes the intra-frame prediction value of at least one pixel in the current block.
[0289] Specifically, the intra prediction unit 206 uses the MIP mode to obtain the intra prediction block, and the steps are as follows:
[0290] First, the intra-frame prediction unit 206 obtains one or more reference pixels from the adjacent pixels of the current block, for example, by downsampling the adjacent pixels or directly extracting from the adjacent pixels.
[0291] The intra-frame prediction unit 206 then uses the obtained reference pixels, the MIP matrix, and the shift parameters to determine one or more partial prediction pixels corresponding to the pixel positions within the current block. Here, the pixel positions may be preset pixel positions within the current block. For example, the pixel positions may have uniform horizontal and vertical coordinate values. The shift parameters include a shift amount parameter and a shift offset parameter, which may be used for the offset operation in the process of obtaining the partial prediction pixels.
[0292] Finally, the intra-frame prediction unit 206 obtains the predicted pixel points corresponding to the remaining pixels in the current block except for the partial pixels. For example, the intra-frame prediction unit 206 can use an interpolation filter to obtain the predicted pixel points corresponding to the remaining pixels, where the input of the interpolation filter can be the partial pixels and the adjacent pixels.
[0293] like Figure 5 , which shows an example of a flow chart of obtaining a prediction block using the MIP mode in an embodiment of the present application. This flow can be implemented on the encoder 200.
[0294] Step 501: The intra-frame prediction unit 206 obtains the adjacent pixels of the current block. For example, the adjacent pixels are marked as Figure 5 The gray filled squares adjacent to the current block in step 501 are shown. The intra-frame prediction unit 206 obtains one or more reference pixels from the adjacent pixels. Figure 5 In the example of step 501, the intra-frame prediction unit 206 may optionally calculate the average value of two adjacent pixels and use the average value as a reference pixel. Alternatively, the intra-frame prediction unit 206 selects an adjacent pixel as a reference pixel for every other adjacent pixel. For example, Figure 5In the example of step 501 , the intra prediction unit 206 selects 4 reference pixels from the 8 upper adjacent pixels of the current block, and selects another 4 reference pixels from the 8 left adjacent pixels of the current block.
[0295] Step 502: The intra-frame prediction unit 206 obtains a portion of predicted pixel points corresponding to one or more pixel points in the current block. Figure 5 In the example shown in step 502, the partially predicted pixels are the pixels in the current block marked with gray filled squares. The input to prediction module 501 is the reference pixels obtained in step 501. Prediction module 501 calculates the partially predicted pixels using the MIP weighting matrix and shift parameters; here, the shift parameters include a shift amount parameter and a shift offset parameter.
[0296] In a possible implementation, the prediction module 501 may set its coordinates to be equal to (x, y) and obtain the predicted pixel point represented by predMip[x][y]. Then the calculation formula of predMip[x][y] is as shown in Formula (5) or Formula (6).
[0297] In equation (5) or (6), mWeight[i][j] is the MIP weighting matrix; here, the matrix elements can be predetermined constant values; or, they can be adaptively updated using, for example, a training method, the input of which is one or more coded pictures or blocks or pictures in other code streams provided to the encoder 200 by an external device; fO is a shift offset parameter for determining oW; sW is a shift quantity parameter; p[i] is a MIP input sample value calculated using a reference pixel point; pTemp[0] represents the value corresponding to index number 0 in the first temporary reference value; ">>" is a binary right shift operator as defined in VVC; incH, predC and incW are parameters for obtaining matrix values from the MIP weighting matrix.
[0298] Exemplarily, the prediction module 501 calculates p[i] based on the size parameter of the current block and the bit depth value of the color component of the pixel in the current block. The bit depth value is a parameter that specifies how many binary bits are used to represent the value of the color component. Here, the color component can be one of the RGB components, one of the YUV components, one of the YCbCr components, or one of the XYZ components.
[0299] In a possible implementation, if the size parameter of the current block is within a preset range, the prediction module 501 may calculate p[0] using the following formula:
[0300] p[0]=pTemp[0]-(1<<(BitDepth-1)) (9)
[0301] or,
[0302] p[0]=(1<<(BitDepth-1))-pTemp[0] (10)
[0303] Here, BitDepthY is the bit depth value of the Y component of the pixel point in the current block, and p[i] is calculated as follows; where i is an integer greater than 0.
[0304] p[i]=pTemp[i]-pTemp[0] (11)
[0305] Otherwise, if the size parameter of the current block is not within the preset range, the prediction module 501 may calculate p[i] using the following formula; wherein i is an integer greater than or equal to 0.
[0306] p[i]=pTemp[i+1]-pTemp[0] (12)
[0307] The prediction module 501 may determine the values of sW and fO according to the size of the current block and the MIP mode used for the current block. In one example, the prediction module 501 obtains the values of sW and fO using a lookup table.
[0308] In some embodiments, the prediction module 501 may use Table 4 above to determine sW based on the size parameter and MIP mode of the current block. In Table 4, modeId represents a variable indicating a mode index value when the current block uses the MIP mode, and MipSizeId represents a variable obtained based on the size parameter of the current block. For example, if the size parameter of the current block is equal to 4×4, then MipSizeId may be set to 0; if the size parameter of the current block is equal to 4×8, 8×4, or 8×8, then MipSizeId may be set to 1; if the size of the current block is greater than 8×8, then MipSizeId may be set to 2.
[0309] In some embodiments, the prediction module 501 may also determine sW according to the size parameter of the current block using the above Table 5. Here, the example of determining mipSizeId is the same as the above-mentioned determination of mipSizeId.
[0310] In some embodiments, the prediction module 501 may also directly set sW to a constant value. For example, for blocks of various size parameters and different MIP modes, the prediction module 501 may set sW to 5; or, for blocks of various size parameters and different MIP modes, the prediction module 501 may set sW to 6; or, for blocks of various size parameters and different MIP modes, the prediction module 501 may set sW to 7.
[0311] In some embodiments, the prediction module 501 may determine f0 according to the size parameter of the current block and the MIP mode using Table 6. modeId represents a variable indicating a mode index value when the current block uses the MIP mode. The example for determining MipSizeId is the same as that for determining MipSizeId mentioned above.
[0312] In some embodiments, the prediction module 501 may also determine f0 according to the size parameter of the current block using the above-mentioned Table 7. Here, the example of determining MipSizeId is the same as the above-mentioned determination of MipSizeId.
[0313] In some embodiments, the prediction module 501 may also directly set fO to a constant value. For example, for blocks of various size parameters and different MIP modes, the prediction module 501 may set fO to 46; or, the prediction module 501 may set fO to 56; or, the prediction module 501 may set fO to 66.
[0314] Step 503: The intra-frame prediction unit 206 obtains the predicted pixel points corresponding to the remaining pixel points in the current block except for some pixel points. Figure 5 In step 502, the intra prediction unit 206 may use the filtering module 502 to obtain the predicted pixel points corresponding to the remaining pixel points in the current block except for some pixel points. The input of the filtering module 502 is the pixel points marked as gray-filled squares in step 502. The filtering module 502 may use one or more interpolation filters to use the input to obtain the predicted pixel points corresponding to the remaining pixel points in the current block except for some pixel points. For example, the input may include the reference pixel points and the partial predicted pixel points of one or more pixel point positions in the current block; or the input may include the adjacent pixel points and the partial predicted pixel points of one or more pixel point positions in the current block; or the input may include the reference pixel points, the adjacent pixel points and the partial predicted pixel points of one or more pixel point positions in the current block.
[0315] So, according to Figure 5 As shown in the flowchart, after step 503 , the intra prediction unit 206 may obtain an intra prediction block of the current block (ie, CU), ie, determine an intra prediction value of at least one pixel in the current block.
[0316] This embodiment provides an image prediction method, which is applied to an encoder. The method comprises determining prediction parameters of a current block, wherein the prediction parameters include: a prediction mode parameter; when the prediction mode parameter indicates that a matrix-based intra prediction (MIP) mode is used to determine an intra prediction value of the current block, determining a MIP input sample value of the current block based on adjacent sample values of the current block; determining a product of a sum of the MIP input sample values and the shift offset parameter based on a value of a shift offset parameter, wherein the value of the shift offset parameter is a fixed constant; determining a first constant value based on a value of a shift amount parameter, wherein the value of the shift amount parameter is a fixed constant; setting a value of the first offset to be a difference between the first constant value and the product; determining a MIP weighting matrix of the current block based on the prediction parameters; determining a MIP prediction value of the current block based on the MIP weighting matrix, the MIP input sample values, the shift amount parameter, and the first offset, wherein the MIP prediction value is a prediction value of a portion of sampling points in the current block; and filtering the MIP prediction value to obtain an intra prediction value of the current block. In this way, since the acquisition process of the shift offset parameter and the shift amount parameter is simplified, the complexity can be reduced while ensuring the encoding and decoding performance, the storage space required in the encoding and decoding process can be reduced, and the encoding and decoding efficiency can be effectively improved.
[0317] The present application also provides an image prediction method, which is applied to a video decoding device, such as a decoder. The functions implemented by the method can be implemented by a second processor in the decoder calling a computer program. Of course, the computer program can be stored in a second memory. Therefore, the decoder includes at least a second processor and a second memory.
[0318] See also Figure 6 , which shows a flow chart of another image prediction method according to an embodiment of the present application. Figure 6 As shown, the method may include:
[0319] S601: Parse the code stream to obtain prediction parameters of the current block, wherein the prediction parameters include prediction mode parameters.
[0320] It should be noted that the image to be decoded can be divided into multiple image blocks, each of which can be referred to as a decoding block. Here, each decoding block can include a first image component, a second image component, and a third image component; and the current block is a decoding block in the video image for which prediction of the first image component, the second image component, or the third image component is currently being performed.
[0321] It should also be noted that the prediction mode parameters are used to indicate the prediction mode adopted by the current block, and different prediction modes correspond to different prediction mode parameters. Among them, the prediction modes generally include inter-frame prediction mode, traditional intra-frame prediction mode and non-traditional intra-frame prediction mode, while non-traditional intra-frame prediction mode includes MIP mode, CCLM mode, IBC mode and PLT mode. In other words, the encoder will select the optimal prediction mode to pre-encode the current block. In this process, the prediction mode of the current block can be determined, thereby obtaining the corresponding prediction mode parameters. The prediction parameters including the prediction mode parameters under the prediction mode are then written into the bitstream and transmitted from the encoder to the decoder.
[0322] In this way, at the decoder side, prediction parameters of the current block can be obtained by parsing the code stream, and the prediction mode parameters included in the prediction parameters obtained through parsing can be used to determine whether the current block uses the MIP mode.
[0323] S602: When the prediction mode parameter indicates that a matrix-based intra prediction MIP mode is used to determine an intra prediction value of a current block, determine a MIP input sample value of the current block according to adjacent sample values of the current block.
[0324] 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 it is necessary to determine the MIP input sample value of the current block based on the adjacent sample values of the current block. The adjacent sample values of the current block may include the left adjacent sample value of the current block and the upper adjacent sample value of the current block. In other words, the MIP input sample value of the current block can be determined based on the left adjacent sample value and the upper adjacent sample value of the current block.
[0325] In some embodiments, determining the MIP input sample value of the current block according to the adjacent sample values of the current block may include:
[0326] Performing downsampling filtering on adjacent sample values of the current block to obtain a first temporary reference value;
[0327] When the size parameter value of the current block is within a preset range, determining a second constant value according to the bit depth of adjacent sample values of the current block; setting the value corresponding to index number 0 in the MIP input sample value to be equal to the difference between the second constant value and the value corresponding to index number 0 in the first temporary reference value; and setting the value corresponding to index number i in the MIP input sample value to be equal to the difference between the value corresponding to index number i in the first temporary reference value and the value corresponding to index number 0 in the first temporary reference value, where i is an integer greater than 0;
[0328] When the size parameter value of the current block is not within a preset range, the value corresponding to the index number j in the MIP input sampling value is set to be equal to the difference between the value corresponding to the index number j+1 in the first temporary reference value and the value corresponding to the index number 0 in the first temporary reference value, where j is an integer greater than or equal to 0.
[0329] It should be noted that after downsampling and filtering the adjacent sample values of the current block, a first temporary reference value can be obtained. Specifically, the first temporary reference value can be cached in a buffer (denoted by pTemp) after downsampling and filtering the adjacent sample values of the current block. The value corresponding to index 0 in the first temporary reference value is pTemp[0], and the value corresponding to index i in the first temporary reference value is pTemp[i].
[0330] It should also be noted that, in addition to the prediction mode parameters, the prediction parameters may also include: a size parameter of the current block. Here, based on the size parameter of the current block, the block size index value (ie, mipSizeId) of the current block can be determined.
[0331] In this way, based on the block size index value of the current block (represented by MipSizeId), it can be determined whether the size parameter value of the current block is within the preset range. Specifically, when mipSizeId = 0 or 1, it indicates that the size parameter value of the current block is within the preset range; when mipSizeId = 2, it indicates that the size parameter value of the current block is not within the preset range.
[0332] Furthermore, in some embodiments, determining the second constant value according to the bit depth of the adjacent sample values of the current block may include:
[0333] The second constant value is set to be equal to an integer exponent power of 2, wherein the exponent of the power is equal to the bit depth of the adjacent sample values of the current block minus 1.
[0334] Alternatively, in some embodiments, determining the second constant value according to the bit depth of the adjacent sample values of the current block may include:
[0335] Perform a binary bit left shift on "1" to obtain the second constant value, wherein the number of bits of the bit left shift is equal to the bit depth of the adjacent sample values of the current block minus 1.
[0336] That is, after obtaining the bit depth BitDepth of the adjacent sample values of the current block, the second constant value can be expressed as 1<<(BitDepth-1) or 2^(BitDepth-1). In this way, when the size parameter value of the current block is within the preset range, the second constant value can be combined to determine the MIP input sample value of the current block.
[0337] It should also be noted that the MIP input sample is a matrix vector used for matrix multiplication. The current related technical solution is determined by the buffer (represented by pTemp), the current block type (i.e., the block size index value of the current block, represented by mipSizeId), the bit depth of the adjacent sample values of the current block (represented by BitDepth), and the number of MIP input samples. The final value corresponding to the index number x in the MIP input sample value is obtained (represented by p[x]).
[0338] In a possible implementation, when the size parameter value of the current block is within a preset range, i.e., mipSizeId=0 or 1, when x is equal to 0, the value corresponding to index number 0 in the MIP input sample value (represented by p[0]) can be obtained by subtracting a second constant value (i.e., 1<<(BitDepth-1)) from the value corresponding to index number 0 in the first temporary reference value (i.e., pTemp[0]); and then, when x is not equal to 0, the value corresponding to index number x in the MIP input sample value (represented by p[x]) needs to be obtained by subtracting the value corresponding to index number 0 in the first temporary reference value (i.e., pTemp[0]) from the value corresponding to index number x in the first temporary reference value (i.e., pTemp[x]). This is specifically shown in the above formula (2).
[0339] In another possible implementation, the value corresponding to index 0 in the first temporary reference value, i.e., pTemp[0], can be ignored. Then, the value corresponding to index x in the MIP input sample value (denoted by p[x]) can be obtained by subtracting the value corresponding to index 0 in the first temporary reference value (i.e., pTemp[0]) from the value corresponding to index x+1 in the first temporary reference value (i.e., pTemp[x+1]). Here, x is a positive integer greater than or equal to 0. Specifically, as shown in the above formula (4).
[0340] Thus, still taking the 4×4 current block as an example, it is assumed that four values are stored in the buffer pTemp, that is, the first temporary reference value includes: the value corresponding to the index number 0 (i.e., pTemp[0]), the value corresponding to the index number 1 (i.e., pTemp[1]), the value corresponding to the index number 2 (i.e., pTemp[2]), and the value corresponding to the index number 3 (i.e., pTemp[3]); at this time, according to formula (2) or formula (3) or formula (4), four MIP input sampling values can be determined, represented by p[x], where x=0, 1, 2, 3.
[0341] S603: Determine, according to the value of the shift offset parameter, the product of the sum of the MIP input sample values and the shift offset parameter.
[0342] It should be noted that the shift offset parameter may also be referred to as an offset factor and may be represented by f0. In the embodiment of the present application, the value of the shift offset parameter may be set to a fixed constant, such as 46, 56, 66, or 32. Alternatively, the value of the shift offset parameter may be set to be related to a shift offset parameter table, and the value of the shift offset parameter may be determined by looking up the table. This is not limited herein.
[0343] S604: Determine a first constant value according to the value of the shift quantity parameter.
[0344] S605: Setting the value of the first offset to the difference between the first constant value and the product.
[0345] It should be noted that the shift quantity parameter may also be referred to as a shift factor, number of shift bits, weight shift value, etc., and may be represented by sW, shift, or weight shift. In the embodiments of the present application, the shift quantity parameter is typically represented by sW. In addition, the first offset may be represented by oW, and the first offset is related to both the shift quantity parameter and the shift offset parameter.
[0346] In an embodiment of the present application, the value of the shift quantity parameter can be set to a fixed constant, such as 5, 6, 7, etc.; the value of the shift quantity parameter can also be set to be related to the shift quantity parameter table, and the value of the shift quantity parameter can be determined by looking up the table. No limitation is made here.
[0347] S606: Determine a MIP weighting matrix of the current block according to the prediction parameters.
[0348] It should be noted that the prediction parameters may include prediction mode parameters and may also include size parameters of the current block. In the prediction parameters, when the prediction mode parameters indicate the use of the MIP mode to determine the intra-frame prediction value of the current block, a weight matrix table may be pre-established at this time, and the weight matrix table may be stored in a memory or storage unit, where the memory or storage unit may be integrated in the encoder, or may be set separately. In this way, based on the block size index value (mipSizeId) and the MIP mode index value (modeId) of the current block, the MIP weighting matrix required for the current block may be determined by looking up the table, which is represented by mWeight[x][y].
[0349] It should also be noted that a shift quantity parameter table may be pre-established in the decoder, and the shift quantity parameter table may also be stored in a memory or storage unit. The memory or storage unit here may be integrated into the encoder or may be separately provided. In the embodiment of the present application, the determination of the shift quantity parameter (sW) may include the following methods:
[0350] In one possible implementation, for different block sizes and different MIP mode index values, the shift amount parameter may be different. In some embodiments, the method may further include:
[0351] When the prediction mode parameter indicates that the intra prediction value of the current block is determined using the MIP mode, determining the MIP mode index value of the current block;
[0352] According to the MIP mode index value, querying a value corresponding to the MIP mode index value from a first preset lookup table, wherein the first preset lookup table is used to record a correspondence between the MIP mode index value and the value of the shift quantity parameter;
[0353] The queried value is determined as the value of the shift quantity parameter.
[0354] It should be noted that the value of the shift amount parameter can be queried based on the block size index value (represented by mipSizeId) and the MIP mode index value (modeId) of the current block. As shown in the first preset lookup table in Table 4 above, for different mipSizeId and modeId, the shift amount parameter required for matrix multiplication can be determined by lookup table.
[0355] However, on the decoder side, Table 4 needs to be stored in a memory or storage unit 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 the block size and MIP mode index value of the current block, it increases memory usage and also increases computational complexity.
[0356] In order to reduce memory usage and computational complexity, the embodiment of the present application simplifies the method for determining the shift factor.
[0357] In another possible implementation, the value of the shift amount parameter can be set to a fixed constant, and is a fixed constant that is independent of the block size index value and the MIP mode index value. For example, for different block size index values and different MIP mode index values, the value of the shift amount parameter can be set to 5; or, for different block size index values and different MIP mode index values, the value of the shift amount parameter can be set to 6; or, for different block size index values and different MIP mode index values, the value of the shift amount parameter can be set to 7. In the embodiment of the present application, preferably, the value of the shift amount parameter is equal to 6, but this is not limited to any particular value.
[0358] In another possible implementation, regarding the value of the shift quantity parameter, the method may further include:
[0359] Determining a block size index value of the current block according to a size parameter of the current block;
[0360] The value of the shift quantity parameter is determined according to the block size index value of the current block.
[0361] It should be noted that, based on the size parameter of the current block, the block size index value of the current block can be determined. In a possible implementation, the determining the block size index value of the current block based on the size parameter of the current block can include:
[0362] 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;
[0363] 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;
[0364] When the width and height of the current block do not meet the aforementioned conditions, the block size index value of the current block is set to 2.
[0365] In this way, after the block size index value of the current block is determined, the value of the shift amount parameter can be further determined according to the block size index value of the current block.
[0366] Optionally, in some embodiments, determining the value of the shift quantity parameter according to the block size index value of the current block may include:
[0367] The value of the shift amount parameter is set to be equal to the ratio between the width or height of the current block and a first preset value of a block size index value corresponding to the current block.
[0368] Here, the first preset value represents the number of MIP input sample values obtained from the boundary of the current block. In this case, the method may further include:
[0369] When the block size index values of the current block are respectively equal to 0, 1, and 2, it is determined that the first preset values corresponding to the block size index values of the current block are respectively equal to 2, 4, and 4.
[0370] 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, 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 value of the shift quantity parameter can be determined according to the ratio between the width or height of the current block and the corresponding first preset value.
[0371] Optionally, in some embodiments, determining the value of the shift quantity parameter according to the block size index value of the current block may include:
[0372] The value of the shift amount parameter is set to be equal to the ratio between the width or height of the current block and a second preset value of the block size index value corresponding to the current block.
[0373] Here, the second preset value represents the size of the MIP prediction block of the current block obtained by directly using the MIP weighting matrix. In this case, the method may further include:
[0374] When the block size index values of the current block are respectively equal to 0, 1, and 2, it is determined that the second preset values corresponding to the block size index values of the current block are respectively equal to 4, 4, and 8.
[0375] That is to say, when the second preset value represents the size of the MIP prediction block of the current block obtained by directly using the MIP weighting matrix, 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 value of the shift quantity parameter can be determined according to the ratio between the width or height of the current block and the corresponding second preset value.
[0376] In another possible implementation, the shift quantity parameter table can be minimized, and the value of the shift quantity parameter can still be determined using a lookup table. Optionally, in some embodiments, determining the value of the shift quantity parameter based on the block size index value of the current block can include:
[0377] According to the block size index value, querying a value corresponding to the block size index value from a second preset lookup table, wherein the second preset lookup table is used to record a correspondence between the block size index value and the value of the shift quantity parameter;
[0378] The queried value is determined as the value of the shift quantity parameter.
[0379] It should be noted that the value of the shift amount parameter can be queried based solely on the block size index value (represented by mipSizeId) of the current block. As shown in the second preset lookup table in Table 5 above, each block size index value can correspond to a fixed value. That is, each block size or each block size set can have a fixed shift amount parameter value as shown in Table 5.
[0380] According to Table 5 above, when the block size index values of the current block are respectively equal to 0, 1, and 2, it can be determined that the values of the shift quantity parameters corresponding to the block size index values are respectively equal to 5, 6, and 5.
[0381] In this way, by simplifying the method of determining the shift quantity parameter, especially minimizing the shift quantity parameter table or fixing the value of the shift quantity parameter, the storage of the lookup table can be minimized, thereby reducing the memory occupied by the shift factor table storage in the MIP mode without increasing the computational complexity.
[0382] Furthermore, in the decoder, a shift offset parameter table may be pre-established, and the shift offset parameter table is also stored in a memory or storage unit. The memory or storage unit here may be integrated into the encoder or may be set separately. In the embodiment of the present application, the determination of the shift offset parameter (fO) may include the following methods:
[0383] In one possible implementation, for different block sizes and different MIP mode index values, the shift offset parameter may also be different. In some embodiments, the method may further include:
[0384] When the prediction mode parameter indicates that the intra prediction value of the current block is determined using the MIP mode, determining the MIP mode index value of the current block;
[0385] According to the MIP mode index value, querying a value corresponding to the MIP mode index value from a third preset lookup table, wherein the third preset lookup table is used to record the correspondence between the MIP mode index value and the value of the shift offset parameter;
[0386] The queried value is determined as the value of the shift offset parameter.
[0387] It should be noted that the value of the shift offset parameter can be queried based on the block size index value (represented by mipSizeId) and the MIP mode index value (modeId) of the current block. As shown in the third preset lookup table in Table 6 above, for different mipSizeId and modeId, the shift offset parameter required for matrix multiplication can be determined by lookup table.
[0388] However, on the decoder side, Table 6 also needs to be stored in a memory or storage unit in the form of a lookup table; however, storage comes at a cost, and the lookup process also comes at a cost; since the values of the shift offset parameters in Table 6 are related to the block size and MIP mode index value of the current block, this increases memory usage and computational complexity.
[0389] In order to reduce memory usage and computational complexity, the embodiment of the present application also simplifies the method for determining the shift offset parameter.
[0390] In another possible implementation, the value of the shift offset parameter can be set to a fixed constant, and it is a fixed constant that is independent of the block size index value and the MIP mode index value. Typically, the value range of the fixed constant is 0 to 100. For example, for different block size index values and different MIP mode index values, the value of the shift offset parameter can be set to 32; or, for different block size index values and different MIP mode index values, the value of the shift offset parameter can be set to 46; or, for different block size index values and different MIP mode index values, the value of the shift offset parameter can be set to 56; or, for different block size index values and different MIP mode index values, the value of the shift offset parameter can be set to 66. In the embodiment of the present application, preferably, the value of the shift offset parameter is equal to 32, but this is not limited to any limit.
[0391] In another possible implementation, for determining the value of the shift offset parameter, the method may further include:
[0392] Determining a block size index value of the current block according to a size parameter of the current block;
[0393] The value of the shift offset parameter is determined according to the block size index value of the current block.
[0394] 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; and then according to the block size index value of the current block, the value of the shift offset parameter can be further determined.
[0395] Specifically, the shift offset parameter table can be minimized, and the offset factor can still be determined by using a lookup table. Optionally, in some embodiments, determining the value of the shift offset parameter based on the block size index value of the current block can include:
[0396] According to the block size index value, querying a value corresponding to the block size index value from a fourth preset lookup table, wherein the fourth preset lookup table is used to record a correspondence between the block size index value and the value of the shift offset parameter;
[0397] The queried value is determined as the value of the shift offset parameter.
[0398] It should be noted that the value of the shift offset parameter can be queried based solely on the block size index value (represented by mipSizeId) of the current block. As shown in the fourth preset lookup table in Table 7 above, each block size index value may correspond to a fixed value. That is, each block size or each block size set may have a fixed shift offset parameter value as shown in Table 7.
[0399] According to Table 7 above, when the block size index values of the current block are respectively equal to 0, 1, and 2, it can be determined that the values of the shift offset parameters corresponding to the block size index values are respectively equal to 34, 23, and 46.
[0400] In this way, by simplifying the method of determining the shift offset parameters, especially minimizing the shift offset parameter table or fixing the values of the shift offset parameters, the storage of the lookup table can be minimized, thereby reducing the memory occupied by the shift offset parameter table storage in the MIP mode without increasing the computational complexity.
[0401] Thus, after determining the shift offset parameter (fO) and the shift quantity parameter (sW), for the first constant value, optionally, in some embodiments, determining the first constant value according to the value of the shift quantity parameter may include:
[0402] The first constant value is set to an integer exponent power of 2, where the exponent of the power is equal to the value of the shift amount parameter minus 1.
[0403] Optionally, in some embodiments, determining the first constant value according to the value of the shift quantity parameter may include:
[0404] Perform a binary bit left shift on "1" to obtain the first constant value, wherein the number of bits of the bit left shift is equal to the value of the shift quantity parameter minus 1.
[0405] That is, after obtaining the shift amount parameter (sW), the first constant value can be expressed as 1<<(sW-1) or 2^(sW-1). In this case, when the shift amount parameter is set to 6, the first constant value can be equal to 32.
[0406] Here, if the first offset is represented by oW, the product of the sum of the MIP input sample values and the shift offset parameter (fO) can be calculated according to the shift offset parameter, which is Then the value of oW can be set to
[0407]
[0408] In this way, in the MIP mode, the MIP weighting matrix, the MIP input sample value, the shift quantity parameter and the first offset can be obtained, so as to subsequently determine the MIP prediction value of the current block.
[0409] S607: Determine a MIP prediction value of the current block according to the MIP weighting matrix, the MIP input sample value, the shift quantity parameter, and the first offset.
[0410] Here, the MIP prediction value is the prediction value of some sampling points in the current block.
[0411] It should be noted that determining the MIP prediction value of the current block according to the MIP weighting matrix, the MIP input sample value, the shift quantity parameter, and the first offset may include:
[0412] Calculating a first weighted sum of the MIP weight matrix and the MIP input sample value;
[0413] Calculating a first sum of the first weighted sum and the first offset;
[0414] Performing a binary bit right shift on the first sum value to obtain a first right-shifted value, wherein the number of bits of the right shift is equal to the value of the shift quantity parameter;
[0415] The MIP prediction value of the current block is set to be equal to the sum of the first right shift value and the value corresponding to the index number 0 in the first temporary reference value.
[0416] Specifically, in MIP mode, the MIP weight matrix (represented by mWeight), the shift quantity parameter (represented by sW), and the shift offset parameter (represented by fO) can be determined according to the block size index value of the current block (represented by mipSizeId) and the MIP mode index value (represented by modeId); then the MIP input sample value (represented by p[x]), mWeight, sW, and fO are input into the matrix multiplication process to obtain the MIP prediction value output by the matrix multiplication (represented by predMip[x][y]), and the sample points in predMip[x][y] are arranged into a matrix form according to predSize×predSize. The calculation formula is shown in the above formula (5) or formula (6).
[0417] S608: Filter the MIP prediction value to obtain an intra-frame prediction value of the current block.
[0418] It should be noted that the MIP prediction block is composed of MIP prediction values. After the MIP prediction block is obtained, it is possible to determine whether the size of the MIP prediction block is the same as the size of the current block in order to further determine the intra-frame prediction value 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, the intra-frame prediction block of the current block is set to be equal to the MIP prediction block; at this time, the MIP prediction block contains the predicted sampling values of all pixel positions in the current block; when the size of the MIP prediction block is different from the size of the current block, the MIP prediction block is filtered to obtain a filtered prediction block, and the filtered prediction block is set as the intra-frame prediction block of the current block. Here, the filtering process can include upsampling filtering or low-pass filtering.
[0419] The following will be combined Figure 3 The decoder 300 shown specifically illustrates the image prediction method of the embodiment of the present application.
[0420] It should be understood that when the MIP mode is indicated for decoding the current block, the intra prediction unit 304 will obtain an intra prediction block of the current block; wherein the intra prediction block of the current block includes an intra prediction value of at least one pixel in the current block.
[0421] Specifically, the intra prediction unit 304 uses the MIP mode to obtain the intra prediction block, and the steps are as follows:
[0422] First, the intra-frame prediction unit 304 obtains one or more reference pixels from adjacent pixels of the current block, for example, by downsampling the adjacent pixels or directly extracting from the adjacent pixels.
[0423] The intra-frame prediction unit 304 then uses the obtained reference pixels, the MIP matrix, and the shift parameters to determine one or more partial prediction pixels corresponding to the pixel positions within the current block. Here, the pixel positions may be preset pixel positions within the current block. For example, the pixel positions may have uniform horizontal and vertical coordinate values. The shift parameters include a shift amount parameter and a shift offset parameter, which may be used for the offset operation in the process of obtaining the partial prediction pixels.
[0424] Finally, the intra-frame prediction unit 304 obtains the predicted pixel points corresponding to the remaining pixels in the current block except for the partial pixels. For example, the intra-frame prediction unit 304 can use an interpolation filter to obtain the predicted pixel points corresponding to the remaining pixels, where the input of the interpolation filter can be the partial pixels and the adjacent pixels.
[0425] See also Figure 2 , which shows an example flow chart of obtaining a prediction block using the MIP mode, which can also be implemented on the decoder 300.
[0426] Step 501: The intra-frame prediction unit 304 obtains the adjacent pixels of the current block. For example, the adjacent pixels are marked as Figure 5 The gray filled squares adjacent to the current block in step 501 are shown. The intra-frame prediction unit 304 obtains one or more reference pixels from the adjacent pixels. Figure 5 In the example of step 501, the intra-frame prediction unit 304 may optionally calculate the average value of two adjacent pixels and use the average value as a reference pixel. Alternatively, the intra-frame prediction unit 304 may select an adjacent pixel as a reference pixel for every other adjacent pixel. Figure 5 In the example shown in step 501 , the intra prediction unit 304 selects 4 reference pixels from the 8 upper adjacent pixels of the current block, and selects another 4 reference pixels from the 8 left adjacent pixels of the current block.
[0427] Step 502: The intra-frame prediction unit 304 obtains a portion of predicted pixel points corresponding to one or more pixel points in the current block. Figure 5 In the example shown in step 502, the partially predicted pixels are the pixels in the current block marked with gray filled squares. The input to prediction module 501 is the reference pixels obtained in step 501. Prediction module 501 calculates the partially predicted pixels using the MIP weighting matrix and shift parameters; here, the shift parameters include a shift amount parameter and a shift offset parameter.
[0428] In a possible implementation, the prediction module 501 may represent a pixel point with coordinates (x, y), and the predicted pixel point is represented by predMip[x][y]. Then the calculation formula of predMip[x][y] is as shown in Formula (5) or Formula (6).
[0429] In equation (5) or (6), mWeight[i][j] is the MIP weighting matrix; here, the matrix elements can be predetermined constant values; or, they can be adaptively updated using, for example, a training method, the input of which is one or more coded pictures or blocks or pictures in other code streams provided to the encoder 200 by an external device; mWeight[i][j] can be determined based on the MIP mode indicated by the corresponding one or more parameters from the parsing unit 301; fO is a shift offset parameter for determining oW; sW is a shift quantity parameter; p[i] is calculated using reference pixels, i.e., the MIP input sample value in the embodiment of the present application; pTemp[0] represents the first pixel in the reference pixel, i.e., the value corresponding to the index number 0 in the first temporary reference value in the embodiment of the present application; ">>" is a binary right shift operator as defined in VVC; incH, predC, and incW are parameters for obtaining matrix values from the MIP weighting matrix.
[0430] Exemplarily, the prediction module 501 calculates p[i] based on the size parameter of the current block and the bit depth value of the color component of the pixel in the current block. The bit depth value is a parameter that specifies how many binary bits are used to represent the value of the color component, and can be indicated by one or more corresponding parameters from the parsing unit 301. Here, the color component can be one of the RGB components, one of the YUV components, one of the YCbCr components, or one of the XYZ components.
[0431] In one possible implementation, if the size parameter of the current block indicated by one or more corresponding parameters from the parsing unit 301 is within a preset range, the prediction module 501 may calculate p[0] using the above formula (9) or formula (10);
[0432] Here, BitDepthY is the bit depth value of the Y component of the pixel point in the current block; and p[i] is calculated using the above formula (11); where i is an integer greater than 0.
[0433] Otherwise, if the size of the current block is not within the preset range, the prediction module 501 may calculate p[i] using the above formula (12); wherein i is an integer greater than or equal to 0.
[0434] The prediction module 501 may determine the values of sW and fO according to the size of the current block and the MIP mode used for the current block. In one example, the prediction module 501 obtains the values of sW and fO using a lookup table.
[0435] In some embodiments, the prediction module 501 may use Table 4 above to determine sW based on the size parameter and MIP mode of the current block. In Table 4, modeId represents a variable indicating a mode index value when the current block uses the MIP mode, and MipSizeId represents a variable obtained based on the size parameter of the current block. For example, if the size parameter of the current block is equal to 4×4, then MipSizeId may be set to 0; if the size parameter of the current block is equal to 4×8, 8×4, or 8×8, then MipSizeId may be set to 1; if the size of the current block is greater than 8×8, then MipSizeId may be set to 2.
[0436] In some embodiments, the prediction module 501 may also determine sW according to the size parameter of the current block using the above Table 5. Here, the example of determining MipSizeId is the same as the above-mentioned determination of MipSizeId.
[0437] In some embodiments, the prediction module 501 may also directly set sW to a constant value. For example, for blocks of various size parameters and different MIP modes, the prediction module 501 may set sW to 5; or, for blocks of various size parameters and different MIP modes, the prediction module 501 may set sW to 6; or, for blocks of various size parameters and different MIP modes, the prediction module 501 may set sW to 7.
[0438] In some embodiments, the prediction module 501 may determine f0 according to the size parameter of the current block and the MIP mode using Table 6. modeId represents a variable indicating a mode index value when the current block uses the MIP mode. The example for determining MipSizeId is the same as that for determining MipSizeId mentioned above.
[0439] In some embodiments, the prediction module 501 may also determine f0 according to the size parameter of the current block using the above-mentioned Table 7. Here, the example of determining MipSizeId is the same as the above-mentioned determination of MipSizeId.
[0440] In some embodiments, the prediction module 501 may also directly set fO to a constant value. For example, for blocks of various size parameters and different MIP modes, the prediction module 501 may set fO to 46; or, the prediction module 501 may set fO to 56; or, the prediction module 501 may set fO to 66.
[0441] Step 503: The intra-frame prediction unit 304 obtains the predicted pixel points corresponding to the remaining pixel points in the current block except for some pixel points. Figure 5 In step 502, the intra prediction unit 304 may use the filtering module 502 to obtain the predicted pixel points corresponding to the remaining pixel points in the current block except for some pixel points. The input of the filtering module 502 is the pixel points marked as gray-filled squares in step 502. The filtering module 502 may use one or more interpolation filters to use the input to obtain the predicted pixel points corresponding to the remaining pixel points in the current block except for some pixel points. For example, the input may include the reference pixel points and the partial predicted pixel points of one or more pixel point positions in the current block; or the input may include the adjacent pixel points and the partial predicted pixel points of one or more pixel point positions in the current block; or the input may include the reference pixel points, the adjacent pixel points and the partial predicted pixel points of one or more pixel point positions in the current block.
[0442] So, according to Figure 5 As shown in the flowchart, after step 503 , the intra prediction unit 304 may obtain an intra prediction block of the current block (ie, CU), ie, determine an intra prediction value of at least one pixel in the current block.
[0443] This embodiment provides an image prediction method, which is applied to a decoder. The method includes parsing a bitstream to obtain prediction parameters of a current block, wherein the prediction parameters include: a prediction mode parameter; when the prediction mode parameter indicates that a matrix-based intra prediction (MIP) mode is used to determine an intra prediction value of the current block, determining a MIP input sample value of the current block based on adjacent sample values of the current block; determining a product of a sum of the MIP input sample values and the shift offset parameter based on a value of a shift offset parameter, wherein the value of the shift offset parameter is a fixed constant; determining a first constant value based on a value of a shift amount parameter, wherein the value of the shift amount parameter is a fixed constant; setting a value of the first offset to be the difference between the first constant value and the product; determining a MIP weighting matrix for the current block based on the prediction parameters; determining a MIP prediction value of the current block based on the MIP weighting matrix, the MIP input sample values, the shift amount parameter, and the first offset, wherein the MIP prediction value is a prediction value of a portion of sampling points in the current block; and filtering the MIP prediction value to obtain an intra prediction value for the current block. In this way, after obtaining the prediction parameters of the current block, if it is determined that the current block uses the MIP mode, the process of obtaining the shift offset parameters and the shift quantity parameters is simplified, thereby reducing the complexity and the storage space required in the encoding and decoding process while ensuring the encoding and decoding performance, thereby effectively improving the encoding and decoding efficiency.
[0444] Based on the same inventive concept as the above embodiments, see Figure 7 , which shows a schematic diagram of the structure of an encoder 70 provided in an embodiment of the present application. Figure 7 As shown, the encoder 70 may include: a first determining unit 701, a first calculating unit 702 and a first predicting unit 703; wherein,
[0445] The first determining unit 701 is configured to determine prediction parameters of a current block, wherein the prediction parameters include: a prediction mode parameter; and when the prediction mode parameter indicates that a matrix-based intra prediction MIP mode is used to determine an intra prediction value of the current block, determine a MIP input sample value of the current block according to adjacent sample values of the current block;
[0446] The first calculation unit 702 is configured to determine, according to a value of a shift offset parameter, a product of a sum of the MIP input sample values and the shift offset parameter, wherein the value of the shift offset parameter is a fixed constant; determine a first constant value according to a value of a shift amount parameter, wherein the value of the shift amount parameter is a fixed constant; and set a value of the first offset to the difference between the first constant value and the product;
[0447] The first determining unit 701 is further configured to determine a MIP weighting matrix of the current block according to the prediction parameters;
[0448] The first prediction unit 703 is configured to determine the MIP prediction value of the current block according to the MIP weighting matrix, the MIP input sample value, the shift quantity parameter and the first offset, wherein the MIP prediction value is the prediction value of some sampling points in the current block; and filter the MIP prediction value to obtain the intra-frame prediction value of the current block.
[0449] In some embodiments, the adjacent sample values of the current block include left adjacent sample values and upper adjacent sample values of the current block.
[0450] In some embodiments, the prediction parameters further include: a size parameter of the current block.
[0451] In some embodiments, the first determining unit 701 is further configured to perform downsampling filtering on adjacent sample values of the current block to obtain a first temporary reference value; and when the size parameter value of the current block is within a preset range, determine a second constant value according to the bit depth of the adjacent sample values of the current block; set the value corresponding to index 0 in the MIP input sample value to be equal to the difference between the second constant value and the value corresponding to index 0 in the first temporary reference value; set the value corresponding to index i in the MIP input sample value to be equal to the difference between the value corresponding to index i in the first temporary reference value and the value corresponding to index 0 in the first temporary reference value, where i is an integer greater than 0; and when the size parameter value of the current block is not within the preset range, set the value corresponding to index j in the MIP input sample value to be equal to the difference between the value corresponding to index j+1 in the first temporary reference value and the value corresponding to index 0 in the first temporary reference value, where j is an integer greater than or equal to 0.
[0452] In some embodiments, the first determining unit 701 is further configured to set the second constant value to be equal to an integer exponent power of 2, wherein the exponent of the power is equal to the bit depth of the adjacent sample values of the current block minus 1.
[0453] In some embodiments, the first determining unit 701 is further configured to perform a binary bit left shift on "1" to obtain the second constant value, wherein the number of bits of the bit left shift is equal to the bit depth of the adjacent sample values of the current block minus 1.
[0454] In some embodiments, the value of the shift offset parameter is a fixed constant that is independent of the block size index value and the MIP mode index value.
[0455] In some embodiments, the value of the shift amount parameter is a fixed constant that is independent of the block size index value and the MIP mode index value.
[0456] In some embodiments, the first calculation unit 702 is further configured to set the first constant value to be equal to an integer exponent power of 2, wherein the exponent of the power is equal to the value of the shift quantity parameter minus 1.
[0457] In some embodiments, the first calculation unit 702 is further configured to perform a binary bit left shift on "1" to obtain the first constant value, wherein the number of bits of the bit left shift is equal to the value of the shift quantity parameter minus 1.
[0458] In some embodiments, the value of the shift amount parameter is set to be equal to 6.
[0459] In some embodiments, the first calculation unit 702 is further configured to calculate a first weighted sum of the MIP weighting matrix and the MIP input sampling value; and calculate a first sum value of the first weighted sum and the first offset; and perform a binary bit right shift on the first sum value to obtain a first right-shifted value, wherein the number of bits of the right shift is equal to the value of the shift quantity parameter; and set the MIP prediction value of the current block to be equal to the sum value of the first right-shifted value and the value corresponding to the index number 0 in the first temporary reference value.
[0460] In some embodiments, the first determining unit 701 is further configured to determine a block size index value of the current block according to a size parameter of the current block; and determine a value of the shift quantity parameter according to the block size index value of the current block.
[0461] In some embodiments, the first determining unit 701 is further configured to, when the width and height of the current block are both equal to 4, set the block size index value of the current block to 0; and 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, set the block size index value of the current block to 1; and when the width and height of the current block do not meet the aforementioned conditions, set the block size index value of the current block to 2.
[0462] In some embodiments, the first determining unit 701 is further configured to determine that the values of the shift quantity parameter corresponding to the block size index value of the current block are equal to 5, 6 and 5 respectively when the block size index value of the current block is equal to 0, 1 and 2 respectively.
[0463] In some embodiments, see Figure 7 , the encoder 70 may further include a first query unit 704; wherein,
[0464] The first determining unit 701 is further configured to determine a MIP mode 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;
[0465] The first query unit 704 is configured to query a value corresponding to the MIP mode index value from a first preset lookup table based on the MIP mode index value, wherein the first preset lookup table is used to record the correspondence between the MIP mode index value and the value of the shift quantity parameter; and determine the queried value as the value of the shift quantity parameter.
[0466] In some embodiments, the first query unit 704 is further configured to query a value corresponding to the block size index value from a second preset lookup table based on the block size index value, wherein the second preset lookup table is used to record the correspondence between the block size index value and the value of the shift quantity parameter; and determine the queried value as the value of the shift quantity parameter.
[0467] In some embodiments, the first determining unit 701 is further configured to determine a block size index value of the current block according to a size parameter of the current block; and determine a value of the shift offset parameter according to the block size index value of the current block.
[0468] In some embodiments, the first determining unit 701 is further configured to determine a MIP mode 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;
[0469] The first query unit 704 is also configured to query a value corresponding to the MIP mode index value from a third preset lookup table based on the MIP mode index value, wherein the third preset lookup table is used to record the correspondence between the MIP mode index value and the value of the shift offset parameter; and determine the queried value as the value of the shift offset parameter.
[0470] In some embodiments, the first query unit 704 is further configured to query a value corresponding to the block size index value from a fourth preset lookup table based on the block size index value, wherein the fourth preset lookup table is used to record the correspondence between the block size index value and the value of the shift offset parameter; and determine the queried value as the value of the shift offset parameter.
[0471] In some embodiments, the first determining unit 701 is further configured to determine that when the block size index value of the current block is equal to 0, 1 and 2 respectively, the value of the shift offset parameter corresponding to the block size index value of the current block is equal to 34, 23 and 46 respectively.
[0472] It is understandable that in the embodiments of the present application, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and of course it can also be a module, or it can be non-modular. Moreover, the various components in this embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional modules.
[0473] If the integrated unit is implemented as a software functional module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment, or the portion that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0474] Therefore, an embodiment of the present application provides a computer storage medium, which is applied to the encoder 70. The computer storage medium stores a computer program, and when the computer program is executed by the first processor, it implements the method described in any one of the above embodiments.
[0475] Based on the composition of the encoder 70 and the computer storage medium, see Figure 8 , which shows a specific hardware structure example of the encoder 70 provided in an embodiment of the present application, which may include: a first communication interface 801, a first memory 802 and a first processor 803; each component is coupled together via a first bus system 804. It is understood that the first bus system 804 is used to achieve connection and communication between these components. In addition to the data bus, the first bus system 804 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, Figure 8 In FIG, various buses are labeled as a first bus system 804.
[0476] The first communication interface 801 is used to receive and send signals during the process of sending and receiving information between other external network elements;
[0477] A first memory 802 is used to store computer programs that can be run on the first processor 803;
[0478] The first processor 803 is configured to, when running the computer program, execute:
[0479] Determining prediction parameters for a current block, wherein the prediction parameters include: a prediction mode parameter; when the prediction mode parameter indicates that a matrix-based intra prediction (MIP) mode is used to determine an intra prediction value of the current block, determining a MIP input sample value of the current block based on adjacent sample values of the current block; determining a product of a sum of the MIP input sample values and the shift offset parameter based on a value of a shift offset parameter, wherein the value of the shift offset parameter is a fixed constant; determining a first constant value based on a value of a shift amount parameter, wherein the value of the shift amount parameter is a fixed constant; setting the value of the first offset to be the difference between the first constant value and the product; determining a MIP weighting matrix for the current block based on the prediction parameters; determining a MIP prediction value for the current block based on the MIP weighting matrix, the MIP input sample values, the shift amount parameter, and the first offset, wherein the MIP prediction value is a prediction value of a portion of the sampling points in the current block; and filtering the MIP prediction value to obtain an intra prediction value for the current block.
[0480] It is understood that the first memory 802 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can 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 can be a random access memory (RAM), which is used as an external cache. By way of example and 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 (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DRRAM). The first memory 802 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0481] The first processor 803 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits or software instructions in the first processor 803. The above-mentioned first processor 803 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The various methods, steps, and logic block diagrams disclosed in the embodiments of this application can be implemented or executed. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium mature in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the first memory 802 , and the first processor 803 reads the information in the first memory 802 and completes the steps of the above method in combination with its hardware.
[0482] It is understood that these embodiments described in the present application can be implemented with 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 (Application Specific Integrated Circuits, ASIC), digital signal processors (Digital Signal Processing, DSP), digital signal processing equipment (DSP Device, DSPD), programmable logic device (Programmable Logic Device, PLD), field programmable gate array (Field-Programmable Gate Array, FPGA), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing functions described in the present application or a combination thereof. For software implementation, the technology described in the present application can be realized by the module (such as process, function etc.) that performs 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 in a processor or outside a processor.
[0483] Optionally, as another embodiment, the first processor 803 is further configured to execute the method described in any one of the aforementioned embodiments when running the computer program.
[0484] This embodiment provides an encoder that may include a first determination unit, a first calculation unit, and a first prediction unit. Thus, after obtaining prediction parameters for a current block, if it is determined that the current block uses a MIP mode, the process of obtaining a shift offset parameter and a shift amount parameter is simplified. This reduces complexity and the storage space required for the encoding and decoding process, while ensuring encoding and decoding performance, thereby effectively improving encoding and decoding efficiency.
[0485] Based on the same inventive concept as the above embodiments, see Figure 9 , which shows a schematic diagram of the structure of a decoder 90 provided in an embodiment of the present application. Figure 9 As shown, the decoder 90 may include: a parsing unit 901, a second determining unit 902, a second calculating unit 903 and a second predicting unit 904; wherein,
[0486] The parsing unit 901 is configured to parse the code stream and obtain prediction parameters of the current block, wherein the prediction parameters include: prediction mode parameters;
[0487] A second determining unit 902 is configured to determine, when the prediction mode parameter indicates that a matrix-based intra prediction MIP mode is used to determine an intra prediction value of the current block, a MIP input sample value of the current block according to adjacent sample values of the current block;
[0488] The second calculation unit 903 is configured to determine, according to a value of a shift offset parameter, a product of a sum of the MIP input sample values and the shift offset parameter, wherein the value of the shift offset parameter is a fixed constant; and determine a first constant value according to a value of a shift amount parameter, wherein the value of the shift amount parameter is a fixed constant; and set the value of the first offset to be the difference between the first constant value and the product;
[0489] The second determining unit 902 is further configured to determine a MIP weighting matrix of the current block according to the prediction parameters;
[0490] The second prediction unit 904 is configured to determine the MIP prediction value of the current block based on the MIP weighting matrix, the MIP input sample value, the shift quantity parameter and the first offset, wherein the MIP prediction value is the prediction value of some sampling points in the current block; and filter the MIP prediction value to obtain the intra-frame prediction value of the current block.
[0491] In some embodiments, the adjacent sample values of the current block include left adjacent sample values and upper adjacent sample values of the current block.
[0492] In some embodiments, the prediction parameters further include: a size parameter of the current block.
[0493] In some embodiments, the second determining unit 902 is further configured to perform downsampling filtering on the adjacent sample values of the current block to obtain a first temporary reference value; and when the size parameter value of the current block is within a preset range, determine a second constant value according to the bit depth of the adjacent sample values of the current block; set the value corresponding to index 0 in the MIP input sample value to be equal to the difference between the second constant value and the value corresponding to index 0 in the first temporary reference value; set the value corresponding to index i in the MIP input sample value to be equal to the difference between the value corresponding to index i in the first temporary reference value and the value corresponding to index 0 in the first temporary reference value, where i is an integer greater than 0; and when the size parameter value of the current block is not within the preset range, set the value corresponding to index j in the MIP input sample value to be equal to the difference between the value corresponding to index j+1 in the first temporary reference value and the value corresponding to index 0 in the first temporary reference value, where j is an integer greater than or equal to 0.
[0494] In some embodiments, the second determining unit 902 is further configured to set the second constant value to be equal to an integer exponent power of 2, wherein the exponent of the power is equal to the bit depth of the adjacent sample values of the current block minus 1.
[0495] In some embodiments, the second determining unit 902 is further configured to perform a binary bit left shift on "1" to obtain the second constant value, wherein the number of bits of the bit left shift is equal to the bit depth of the adjacent sample values of the current block minus 1.
[0496] In some embodiments, the value of the shift offset parameter is a fixed constant that is independent of the block size index value and the MIP mode index value.
[0497] In some embodiments, the value of the shift amount parameter is a fixed constant that is independent of the block size index value and the MIP mode index value.
[0498] In some embodiments, the second calculation unit 903 is further configured to set the first constant value to be equal to an integer exponent power of 2, wherein the exponent of the power is equal to the value of the shift quantity parameter minus 1.
[0499] In some embodiments, the second calculation unit 903 is further configured to perform a binary bit left shift on "1" to obtain the first constant value, wherein the number of bits of the bit left shift is equal to the value of the shift quantity parameter minus 1.
[0500] In some embodiments, the value of the shift amount parameter is set to be equal to 6.
[0501] In some embodiments, the second calculation unit 903 is further configured to calculate a first weighted sum of the MIP weighting matrix and the MIP input sampling value; and calculate a first sum value of the first weighted sum and the first offset; and perform a binary bit right shift on the first sum value to obtain a first right-shifted value, wherein the number of bits of the right shift is equal to the value of the shift quantity parameter; and set the MIP prediction value of the current block to be equal to the sum value of the first right-shifted value and the value corresponding to the index number 0 in the first temporary reference value.
[0502] In some embodiments, the second determining unit 902 is further configured to determine a block size index value of the current block according to a size parameter of the current block; and determine a value of the shift quantity parameter according to the block size index value of the current block.
[0503] In some embodiments, the second determining unit 902 is further configured to, when the width and height of the current block are both equal to 4, set the block size index value of the current block to 0; and 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, set the block size index value of the current block to 1; and when the width and height of the current block do not meet the aforementioned conditions, set the block size index value of the current block to 2.
[0504] In some embodiments, the second determining unit 902 is further configured to determine that the values of the shift quantity parameter corresponding to the block size index value of the current block are equal to 5, 6 and 5 respectively when the block size index value of the current block is equal to 0, 1 and 2 respectively.
[0505] In some embodiments, see Figure 9 , the decoder 90 may further include a second query unit 905; wherein,
[0506] The second determining unit 902 is further configured to determine a MIP mode 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;
[0507] The second query unit 905 is configured to query the value corresponding to the MIP mode index value from the first preset lookup table according to the MIP mode index value, wherein the first preset lookup table is used to record the correspondence between the MIP mode index value and the value of the shift quantity parameter; and determine the queried value as the value of the shift quantity parameter.
[0508] In some embodiments, the second query unit 905 is further configured to query a value corresponding to the block size index value from a second preset lookup table based on the block size index value, wherein the second preset lookup table is used to record the correspondence between the block size index value and the value of the shift quantity parameter; and determine the queried value as the value of the shift quantity parameter.
[0509] In some embodiments, the second determining unit 902 is further configured to determine a block size index value of the current block according to a size parameter of the current block; and determine a value of the shift offset parameter according to the block size index value of the current block.
[0510] In some embodiments, the second determining unit 902 is further configured to determine a MIP mode 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;
[0511] The second query unit 905 is also configured to query the value corresponding to the MIP mode index value from a third preset lookup table based on the MIP mode index value, wherein the third preset lookup table is used to record the correspondence between the MIP mode index value and the value of the shift offset parameter; and determine the queried value as the value of the shift offset parameter.
[0512] In some embodiments, the second query unit 905 is further configured to query a value corresponding to the block size index value from a fourth preset lookup table based on the block size index value, wherein the fourth preset lookup table is used to record the correspondence between the block size index value and the value of the shift offset parameter; and determine the queried value as the value of the shift offset parameter.
[0513] In some embodiments, the second determining unit 902 is further configured to determine that when the block size index value of the current block is equal to 0, 1 and 2 respectively, the value of the shift offset parameter corresponding to the block size index value of the current block is equal to 34, 23 and 46 respectively.
[0514] It is understood that in this embodiment, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular system. Furthermore, the various components in this embodiment can be integrated into a single processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit. The aforementioned integrated units can be implemented in the form of hardware or software functional modules.
[0515] If the integrated unit is implemented as a software functional module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, this embodiment provides a computer storage medium, which is applied to the decoder 90 and stores a computer program. When the computer program is executed by the second processor, it implements any of the methods in the aforementioned embodiments.
[0516] Based on the above-mentioned components of the decoder 90 and the computer storage medium, see Figure 10 , which shows a specific hardware structure example of the decoder 90 provided in an embodiment of the present application, which may include: a second communication interface 1001, a second memory 1002, and a second processor 1003; each component is coupled together via a second bus system 1004. It is understood that the second bus system 1004 is used to achieve connection and communication between these components. In addition to the data bus, the second bus system 1004 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, in Figure 10 In FIG, various buses are labeled as a second bus system 1004.
[0517] The second communication interface 1001 is used to receive and send signals during the process of sending and receiving information with other external network elements;
[0518] The second memory 1002 is used to store computer programs that can be run on the second processor 1003;
[0519] The second processor 1003 is configured to, when running the computer program, execute:
[0520] Parsing a bitstream to obtain prediction parameters of a current block, wherein the prediction parameters include: a prediction mode parameter; when the prediction mode parameter indicates that a matrix-based intra prediction (MIP) mode is used to determine an intra prediction value of the current block, determining a MIP input sample value of the current block based on adjacent sample values of the current block; determining a product of a sum of the MIP input sample values and the shift offset parameter based on a value of a shift offset parameter, wherein the value of the shift offset parameter is a fixed constant; determining a first constant value based on a value of a shift amount parameter, wherein the value of the shift amount parameter is a fixed constant; setting the value of the first offset to be the difference between the first constant value and the product; determining a MIP weighting matrix for the current block based on the prediction parameters; determining a MIP prediction value of the current block based on the MIP weighting matrix, the MIP input sample values, the shift amount parameter, and the first offset, wherein the MIP prediction value is a prediction value of a portion of sampling points in the current block; and filtering the MIP prediction value to obtain an intra prediction value of the current block.
[0521] Optionally, as another embodiment, the second processor 1003 is further configured to execute any one of the methods described in the foregoing embodiments when running the computer program.
[0522] It can be understood that the hardware functions of the second memory 1002 and the first memory 802 are similar, and the hardware functions of the second processor 1003 and the first processor 803 are similar; they will not be described in detail here.
[0523] This embodiment provides a decoder that may include a parsing unit, a second determining unit, a second calculating unit, and a second prediction unit. Thus, after obtaining prediction parameters for a current block, if it is determined that the current block uses a MIP mode, the process of obtaining a shift quantity parameter and a shift offset parameter is simplified. This reduces complexity and the storage space required for the encoding and decoding process, while ensuring encoding and decoding performance, thereby effectively improving encoding and decoding efficiency.
[0524] In some embodiments, see Figure 11 , which shows a schematic diagram of the structure of a sending device provided in an embodiment of the present application. Figure 11, which shows an exemplary transmitting device 500. The acquisition unit 1101 acquires a video signal and transmits the video signal to the encoder 1102. The acquisition unit 1101 may be a device comprising one or more cameras (including a depth camera). The acquisition unit 1101 may be a device that partially or completely decodes a bitstream to acquire video. The acquisition unit 1101 may also include one or more components for capturing audio signals. A specific implementation of the encoder 1102 is the encoder 200 described in the aforementioned embodiment, which encodes the video signal from the acquisition unit 1101 as its input video and generates a video bitstream. The encoder 1102 may also include one or more audio encoders to encode the audio signal and generate an audio bitstream. The storage / transmission unit 1103 receives the video bitstream from the encoder 1102. The storage / transmission unit 1103 may also receive the audio bitstream from the encoder 1102 and compress the video bitstream and the audio bitstream together to form a media file (e.g., an ISO-based media file format) or a transport stream.
[0525] Optionally, the storage / transmission unit 1103 writes the media file or transport stream to a storage unit, such as a hard disk, a DVD disk, a cloud, or a portable storage device.
[0526] Optionally, the storage / transmission unit 1103 transmits the bit stream to a transmission network, such as the Internet, a wired network, a cellular network, a wireless local area network, etc.
[0527] In some embodiments, see Figure 12 , which shows a schematic diagram of the composition structure of a target device provided by an embodiment of the present application. Figure 12 , which illustrates an exemplary target device 600. A receiving unit 1201 receives a media file or transport stream from a network, or reads a media file or transport stream from a storage device. The receiving unit 1201 separates the video stream and the audio stream from the media file or transport stream. The receiving unit 1201 can also generate a new video stream by extracting the video stream. The receiving unit 1201 can also generate a new audio stream by extracting the audio stream. The decoder 1202 includes one or more video decoders, such as the decoder 300 described in the preceding embodiment.
[0528] Decoder 1202 may also include one or more audio decoders. Decoder 1202 decodes the video and audio streams from receiving unit 1201 to obtain decoded video and one or more decoded audio channels corresponding to one or more audio channels. Rendering unit 1203 performs operations on the reconstructed video to make it suitable for display. Such operations may include one or more of the following to improve perceptual quality: noise reduction, synthesis, color space conversion, upsampling, downsampling, etc. Rendering unit 1203 may also perform operations on the decoded audio to improve the perceptual quality of the displayed audio signal.
[0529] In some embodiments, see Figure 13 , which shows a schematic diagram of the structure of a communication system provided by an embodiment of the present application. Figure 13 FIG. 1 shows an exemplary communication system 700. The source device 1301 may be Figure 11 The output of the storage / transmission unit 1103 is processed by the storage medium / transmission network 1302 to store or transmit the code stream. The target device 1303 can be Figure 12 Target device 600 is shown. Here, receiving unit 1201 can obtain a bitstream from storage medium / transmission network 1302. Receiving unit 1201 can extract a new video bitstream from a media file or transport stream. Receiving unit 1201 can also extract a new audio bitstream from a media file or transport stream. Thus, the image prediction method of the embodiment of the present application can improve the performance of the MIP mode by reducing the computational complexity of obtaining intra-frame prediction blocks.
[0530] It should be noted that, in this application, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0531] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0532] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0533] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0534] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0535] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. An image prediction method, applied to a decoder, comprising: Decode the code stream and determine the prediction mode parameters of the current block; When the prediction mode parameter indicates that a matrix-based intra prediction MIP mode is used to determine an intra prediction value of the current block, determining a MIP mode index of the current block; Determining a MIP input sampling value of the current block according to adjacent sampling values of the current block; Determining a block size index of the current block according to a size parameter of the current block; wherein the adjacent sample values of the current block include a left-adjacent sample value and an upper-adjacent sample value of the current block, and the number of input sample values included in the MIP input sample value is determined according to the block size index of the current block; Determining a MIP weighting matrix for the current block according to the MIP mode index of the current block and the block size index of the current block; determining a MIP prediction value of the current block according to a MIP input sample value of the current block, a MIP weighting matrix of the current block, a shift offset parameter, and a shift amount parameter, wherein for a block having any MIP mode index and any block size index, the value of the shift offset parameter is 32; for a block having any MIP mode index and any block size index, the value of the shift amount parameter is 6; Performing filtering on the MIP prediction value to determine an intra-frame prediction value of the current block; The determining of the MIP prediction value of the current block according to the MIP input sample value of the current block, the MIP weighting matrix of the current block, the shift offset parameter, and the shift quantity parameter includes: The MIP prediction value of the current block is determined according to the following formula: Wherein, P[] is the MIP input sampling value; inSize is the number of MIP input samples; mWeight is the MIP weighting matrix of the current block; oW is determined according to the shift offset parameter, the shift quantity parameter and the MIP input sample value; pTemp[] is a temporary reference value; predSize is used to determine the number of MIP prediction values.
2. The method according to claim 1, characterized in that The determining, according to the size parameter of the current block, a block size index of the current block includes: When the width and height of the current block are both equal to 4, the block size index of the current block is equal 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, the block size index of the current block is equal to 1; Otherwise, the block size index of the current block is equal to 2.
3. The method according to any one of claims 1 to 2, characterized in that The method further comprises: The number inSize of the MIP input sample values and the value of predSize used to determine the number of the MIP prediction values are determined according to the block size index of the current block.
4. An image prediction method, applied to an encoder, comprising: Determining prediction mode parameters for the current block; When the prediction mode parameter indicates that a matrix-based intra prediction MIP mode is used to determine an intra prediction value of the current block, determining a MIP mode index of the current block; Determining a MIP input sampling value of the current block according to adjacent sampling values of the current block; Determining a block size index of the current block according to a size parameter of the current block; wherein the adjacent sample values of the current block include a left-adjacent sample value and an upper-adjacent sample value of the current block, and the number of input sample values included in the MIP input sample value is determined according to the block size index of the current block; Determining a MIP weighting matrix for the current block according to the MIP mode index of the current block and the block size index of the current block; determining a MIP prediction value of the current block according to a MIP input sample value of the current block, a MIP weighting matrix of the current block, a shift offset parameter, and a shift amount parameter, wherein for a block having any MIP mode index and any block size index, the value of the shift offset parameter is 32; for a block having any MIP mode index and any block size index, the value of the shift amount parameter is 6; Performing filtering on the MIP prediction value to determine an intra-frame prediction value of the current block; The determining of the MIP prediction value of the current block according to the MIP input sample value of the current block, the MIP weighting matrix of the current block, the shift offset parameter, and the shift quantity parameter includes: The MIP prediction value of the current block is determined according to the following formula: Wherein, P[] is the MIP input sampling value; inSize is the number of MIP input samples; mWeight is the MIP weighting matrix of the current block; oW is determined according to the shift offset parameter, the shift quantity parameter and the MIP input sample value; pTemp[] is a temporary reference value; predSize is used to determine the number of MIP prediction values.
5. The method according to claim 4, characterized in that The determining, according to the size parameter of the current block, a block size index of the current block includes: When the width and height of the current block are both equal to 4, the block size index of the current block is equal 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, the block size index of the current block is equal to 1; Otherwise, the block size index of the current block is equal to 2.
6. The method according to any one of claims 4 to 5, characterized in that The method further comprises: The number inSize of the MIP input sample values and the value of predSize used to determine the number of the MIP prediction values are determined according to the block size index of the current block.
7. An encoder comprising a first determining unit and a first predicting unit; wherein: The first determining unit is configured to determine a prediction mode parameter of the current block; when the prediction mode parameter indicates that a matrix-based intra prediction MIP mode is used to determine an intra prediction value of the current block, determine a MIP mode index of the current block; and determine a MIP input sample value of the current block based on adjacent sample values of the current block; The first determining unit is further configured to determine a block size index of the current block according to a size parameter of the current block; and determine a MIP weighting matrix of the current block according to the MIP mode index of the current block and the block size index of the current block; wherein the adjacent sample values of the current block include left-adjacent sample values and upper-adjacent sample values of the current block, and the number of input sample values included in the MIP input sample values is determined according to the block size index of the current block; The first prediction unit is configured to determine a MIP prediction value of the current block according to a MIP input sample value of the current block, a MIP weighting matrix of the current block, a shift offset parameter, and a shift amount parameter, wherein when the current block pair has any MIP mode index prediction mode parameter and any block size index size parameter, the value of the shift offset parameter is 32; when the current block pair has any MIP mode index prediction mode parameter and any block size index size parameter, the value of the shift amount parameter is 6; and perform filtering processing on the MIP prediction value to determine an intra-frame prediction value of the current block; The first prediction unit is further configured to determine the MIP prediction value of the current block according to the following formula: Wherein, P[] is the MIP input sampling value; inSize is the number of MIP input samples; mWeight is the MIP weighting matrix of the current block; oW is determined according to the shift offset parameter, the shift quantity parameter and the MIP input sample value; pTemp[] is a temporary reference value; predSize is used to determine the number of MIP prediction values.
8. An encoder comprising a first memory and a first processor; wherein: The first memory is used to store a computer program that can be run on the first processor; The first processor is configured to execute the method according to any one of claims 4 to 6 when running the computer program.
9. A decoder comprising a parsing unit, a second determining unit, and a second predicting unit; wherein: The parsing unit is configured to decode the code stream and determine the prediction mode parameters of the current block; The second determining unit is configured to, when the prediction mode parameter indicates that a matrix-based intra prediction MIP mode is used to determine an intra prediction value of the current block, determine a MIP mode index of the current block; and determine a MIP input sample value of the current block according to adjacent sample values of the current block; The second determining unit is further configured to determine a block size index of the current block according to a size parameter of the current block; and determine a MIP weighting matrix of the current block according to the MIP mode index of the current block and the block size index of the current block; wherein the adjacent sample values of the current block include left-adjacent sample values and upper-adjacent sample values of the current block, and the number of input sample values included in the MIP input sample values is determined according to the block size index of the current block; The second prediction unit is configured to determine a MIP prediction value of the current block based on a MIP input sample value of the current block, a MIP weighting matrix of the current block, a shift offset parameter, and a shift amount parameter, wherein for a block having any MIP mode index and any block size index, the shift offset parameter takes a value of 32; for a block having any MIP mode index and any block size index, the shift amount parameter takes a value of 6; and perform filtering processing on the MIP prediction value to determine an intra-frame prediction value of the current block; The second prediction unit is further configured to determine the MIP prediction value of the current block according to the following formula: Wherein, P[] is the MIP input sampling value; inSize is the number of MIP input samples; mWeight is the MIP weighting matrix of the current block; oW is determined according to the shift offset parameter, the shift quantity parameter and the MIP input sample value; pTemp[] is a temporary reference value; predSize is used to determine the number of MIP prediction values.
10. A decoder comprising a second memory and a second processor; wherein: The second memory is used to store a computer program that can be run on the second processor; The second processor is configured to execute the method according to any one of claims 1 to 3 when running the computer program.
11. A computer storage medium, characterized in that The computer storage medium stores a computer program, which implements the method according to any one of claims 4 to 6 when executed by a first processor, or implements the method according to any one of claims 1 to 3 when executed by a second processor.
12. A computer storage medium having a code stream stored thereon, wherein: The code stream is generated by a processor executing the method according to any one of claims 4 to 6.
Citation Information
Patent Citations
Method of and apparatus for encoding and decoding data
CN103533364A
Image-encoding apparatus and method, transform-encoding apparatus and method, apparatus and method for generating a transform base, and image-decoding apparatus and method used in same
US20120307895A1