Encoding method, decoding method, encoder, decoder, and storage medium
By combining MIP mode and LFNST technology in H.266/VVC, video encoding is optimized, and the problem of low encoding and decoding efficiency is solved, and a more efficient encoding and decoding process is achieved.
Patent Information
- Application Number
- CN202411829188.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2020-01-08
- Filing Date
- 2020-12-29
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2040-12-29
AI Technical Summary
The matrix-based intra prediction mode (MIP) and low-frequency inseparable secondary transformation (LFNST) technology in H.266/VVC have a negative impact on the encoding and decoding efficiency.
On the encoder side, by determining the prediction parameters of the current block, intra-prediction of the chrominance components is performed using the MIP mode, and transforming the prediction residuals in combination with LFNST to encode and generate a code stream. On the decoder side, the code stream is parsed, the transform coefficient block is reconstructed, and the reconstruction block is determined based on the intra prediction value and the reconstruction residual block.
Improves encoding and decoding efficiency, reduces complexity, and reduces the storage space required during the encoding and decoding process.
Smart Images

Figure CN119653081A_ABST
Abstract
Description
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to prior U.S. provisional patent application No. 62 / 958,582, filed on January 8, 2020, in the name of Junyan Huo, Shuai Wan, and Yanzhuo Ma, entitled “VIDEO ENCODING AND DECODING METHOD, APPARATUS AND COMMUNICATION SYSTEM,” the entire contents of which are incorporated herein by reference. Technical Field
[0003] The embodiments of the present application relate to the field of video coding and decoding technology, and in particular to an encoding method, a decoding method, an encoder, a decoder, and a storage medium. Background Art
[0004] 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).
[0005] In H.266 / VVC, matrix-based intra prediction (MIP) is an intra prediction mode used to obtain an intra prediction block for the current block. Low-Frequency Non-Separable Transform (LFNST) is then used to determine the prediction residual for the current block. However, LFNST has a negative impact on VVC's codec efficiency when applied to MIP prediction. Summary of the Invention
[0006] The embodiments of the present application provide an encoding method, a decoding method, an encoder, a decoder, and a storage medium, which can improve encoding and decoding efficiency.
[0007] The technical solution of the embodiment of the present application can be implemented as follows:
[0008] In a first aspect, an embodiment of the present application provides an encoding method, applied to an encoder, the method comprising:
[0009] Determining prediction parameters of the current block, wherein the prediction parameters include prediction mode parameters;
[0010] When the prediction mode parameter indicates that a matrix-based intra prediction MIP mode is used to determine an intra prediction value for the chrominance component of the current block, obtaining adjacent sample values of the current block, and determining a MIP input sample value of the current block according to the adjacent sample values of the current block;
[0011] Determining a MIP prediction value of a chrominance component of the current block according to the MIP input sample value, a MIP weighting matrix, and a shift parameter; wherein the MIP prediction value is a prediction value of some sampling points in the chrominance component of the current block;
[0012] Performing filtering on the MIP prediction value to determine an intra-frame prediction value of the chrominance component of the current block;
[0013] Determining a prediction residual value of the chrominance component of the current block according to the intra-frame prediction value of the chrominance component of the current block;
[0014] Performing a low-frequency non-separable secondary transform (LFNST) on the prediction residual value to determine LFNST parameters;
[0015] The LFNST parameters are encoded and written into the bitstream.
[0016] In a second aspect, an embodiment of the present application provides a decoding method, applied to a decoder, the method comprising:
[0017] Parse the bitstream to obtain prediction parameters and LFNST parameters of the current block, wherein the prediction parameters include prediction mode parameters;
[0018] When the prediction mode parameter indicates that a matrix-based intra prediction MIP mode is used to determine an intra prediction value for the chrominance component of the current block, obtaining adjacent sample values of the current block, and determining a MIP input sample value of the current block according to the adjacent sample values of the current block;
[0019] Determining a MIP prediction value of a chrominance component of the current block according to the MIP input sample value, a MIP weighting matrix, and a shift parameter; wherein the MIP prediction value is a prediction value of some sampling points in the chrominance component of the current block;
[0020] Performing filtering on the MIP prediction value to determine an intra-frame prediction value of the chrominance component of the current block;
[0021] When the LFNST parameter indicates that LFNST is to be performed on the current block, determining a reconstructed transform coefficient block of the current block, and performing LFNST on at least part of the reconstructed transform coefficients in the reconstructed transform coefficient block to obtain a second transform coefficient block;
[0022] Performing a first transform on the second transform coefficient block to obtain a reconstructed residual block of the chrominance component of the current block;
[0023] A reconstructed block of the chrominance component of the current block is determined according to the intra-frame prediction value of the chrominance component of the current block and the reconstructed residual block.
[0024] In a third aspect, an embodiment of the present application provides an encoder, which includes a first determination unit, a first prediction unit, a first transformation unit, and an encoding unit; wherein,
[0025] The first determining unit is configured to determine prediction parameters of the current block, wherein the prediction parameters include prediction mode parameters;
[0026] The first determining unit is further configured to, when the prediction mode parameter indicates that a matrix-based intra prediction MIP mode is used to determine an intra prediction value for the chrominance component of the current block, obtain adjacent sample values of the current block, and determine a MIP input sample value of the current block according to the adjacent sample values of the current block;
[0027] The first prediction unit is configured to determine a MIP prediction value of the chrominance component of the current block based on the MIP input sample value, the MIP weighting matrix, and the shift parameter; wherein the MIP prediction value is a prediction value of some sampling points in the chrominance component of the current block; and perform filtering processing on the MIP prediction value to determine an intra-frame prediction value of the chrominance component of the current block;
[0028] The first transform unit is configured to determine a prediction residual value of the chrominance component of the current block according to the intra-frame prediction value of the chrominance component of the current block; and perform a low-frequency non-separable secondary transform LFNST on the prediction residual value to determine an LFNST parameter;
[0029] The encoding unit is configured to encode the LFNST parameters and write them into a bitstream.
[0030] In a fourth aspect, an embodiment of the present application provides an encoder, comprising a first memory and a first processor; wherein,
[0031] The first memory is used to store a computer program that can be run on the first processor;
[0032] The first processor is configured to execute the method according to the first aspect when running the computer program.
[0033] In a fifth aspect, an embodiment of the present application provides a decoder, comprising a parsing unit, a second determining unit, a second prediction unit, and a second transforming unit; wherein,
[0034] The parsing unit is configured to parse the bitstream to obtain prediction parameters and LFNST parameters of the current block, wherein the prediction parameters include prediction mode parameters;
[0035] 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 for the chrominance component of the current block, obtain adjacent sample values of the current block, and determine a MIP input sample value of the current block according to the adjacent sample values of the current block;
[0036] The second prediction unit is configured to determine a MIP prediction value of the chrominance component of the current block according to the MIP input sample value, the MIP weighting matrix and the shift parameter; wherein the MIP prediction value is a prediction value of some sampling points in the chrominance component of the current block; and determine an intra-frame prediction value of the chrominance component of the current block by filtering the MIP prediction value;
[0037] The second transform unit is configured to, when the LFNST parameter indicates that LFNST is to be performed on the current block, determine a reconstructed transform coefficient block for the current block, perform LFNST on at least part of the reconstructed transform coefficients in the reconstructed transform coefficient block to obtain a second transform coefficient block; and perform a first transform on the second transform coefficient block to obtain a reconstructed residual block of the chrominance component of the current block;
[0038] The second determining unit is further configured to determine a reconstructed block of the chrominance component of the current block according to the intra-frame prediction value of the chrominance component of the current block and the reconstructed residual block.
[0039] In a sixth aspect, an embodiment of the present application provides a decoder, the decoder comprising a second memory and a second processor; wherein,
[0040] The second memory is used to store a computer program that can be run on the second processor;
[0041] The second processor is configured to execute the method according to the second aspect when running the computer program.
[0042] 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.
[0043] Embodiments of the present application provide an encoding method, a decoding method, an encoder, a decoder, and a storage medium. On the encoder side, after determining the prediction parameters of the current block, when the prediction mode parameters indicate that the matrix-based intra-frame prediction MIP mode is used to determine the intra-frame prediction value of the chroma component of the current block, the adjacent sampling values of the current block are obtained, and the MIP input sampling values of the current block are determined based on the adjacent sampling values of the current block; the MIP prediction value of the chroma component of the current block is determined based on the MIP input sampling value, the MIP weighting matrix, and the shift parameter; the MIP prediction value is filtered to determine the intra-frame prediction value of the chroma component of the current block; the prediction residual value of the chroma component of the current block is determined based on the intra-frame prediction value of the chroma component of the current block; a low-frequency non-separable secondary transform LFNST is performed on the prediction residual value to determine the LFNST parameters; the LFNST parameters are encoded and written into the bitstream. On the decoder side, after parsing the bitstream and obtaining the prediction parameters and LFNST parameters of the current block, when the prediction mode parameter indicates that the MIP mode is used to determine the intra-frame prediction value of the chroma component of the current block, the adjacent sample values of the current block are obtained, and the MIP input sample values of the current block are determined based on the adjacent sample values of the current block; the MIP prediction value of the chroma component of the current block is determined based on the MIP input sample value, the MIP weighting matrix and the shift parameter; the MIP prediction value is filtered to determine the intra-frame prediction value of the chroma component of the current block; when the LFNST parameter indicates that LFNST is performed on the current block, a reconstructed transform coefficient block of the current block is determined, and LFNST is performed on at least part of the reconstructed transform coefficients in the reconstructed transform coefficient block to obtain a second transform coefficient block; a first transform is performed on the second transform coefficient block to obtain a reconstructed residual block of the chroma component of the current block; and a reconstructed block of the chroma component of the current block is determined based on the intra-frame prediction value of the chroma component of the current block and the reconstructed residual block. In this way, for the MIP mode, the complexity can be reduced while ensuring the encoding and decoding performance, while reducing the storage space required during the encoding and decoding process, effectively improving the encoding and decoding efficiency. In addition, when LFNST technology is applied to MIP mode prediction, the introduction of MIP parameters makes the LFNST transformation more flexible, further improving the encoding and decoding efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A schematic diagram of the structure of an encoder provided in an embodiment of the present application;
[0045] Figure 2A schematic diagram of the structure of a decoder provided in an embodiment of the present application;
[0046] Figure 3 A schematic diagram of a flow chart of an encoding method provided in an embodiment of the present application;
[0047] Figure 4 A flowchart of another encoding method provided in an embodiment of the present application;
[0048] Figure 5 A schematic diagram of a flow chart of an MPI prediction process provided in an embodiment of the present application;
[0049] Figure 6 This is a schematic diagram of a process of obtaining an intra-frame prediction block using the MIP mode in an embodiment of the present application;
[0050] Figure 7 A schematic diagram of a process framework for executing LFNST provided in an embodiment of the present application;
[0051] Figure 8 A schematic diagram of a process for encoding LFNST parameters provided in an embodiment of the present application;
[0052] Figure 9 A flowchart of a decoding method provided in an embodiment of the present application;
[0053] Figure 10 A schematic diagram of a process for parsing LFNST parameters provided in an embodiment of the present application;
[0054] Figure 11 A schematic diagram of another process framework for executing LFNST provided in an embodiment of the present application;
[0055] Figure 12 A schematic diagram of the structure of another encoder provided in an embodiment of the present application;
[0056] Figure 13 A schematic diagram of the specific hardware structure of an encoder provided in an embodiment of the present application;
[0057] Figure 14 A schematic diagram of the structure of another decoder provided in an embodiment of the present application;
[0058] Figure 15 A schematic diagram of the specific hardware structure of a decoder provided in an embodiment of the present application;
[0059] Figure 16 A schematic diagram of the structure of a sending device provided in an embodiment of the present application;
[0060] Figure 17A schematic diagram of the structure of a target device provided in an embodiment of the present application;
[0061] Figure 18 A schematic diagram of the structure of a communication system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0062] In order to enable a more detailed understanding of the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application is described in detail below with reference to the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present application.
[0063] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0064] In the following description, reference is made to "some embodiments," which describe a subset of all possible embodiments. However, it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict. It should also be noted that the terms "first, second, and third" in the embodiments of the present application are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It is understood that the specific order or sequence of "first, second, and third" may be interchanged where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0065] With the advancement of video compression technology, the International Telecommunication Union-Telecommunication (ITU-T) and the International Organization for Standardization (ISO) / International Electrotechnical Commission (IEC) launched a standardization project called VVC to develop a next-generation video coding standard. Its goal is to improve VVC performance by approximately 50% compared to the H.265 / HEVC standard when encoding high-quality video 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. The Joint Video Exploration Team (JVET) of ITU-T SG 16WP 3 and ISO / IEC JTC 1 / SC 29 / WG 11 is responsible for this standardization project. Various intra-frame prediction modes and inter-frame prediction modes have been proven to achieve high compression efficiency when encoding high-quality video, and therefore have been adopted in the VVC Working Draft (WD).
[0066] Here, the matrix-based intra prediction (MIP) mode is an intra prediction mode. In VVC, the encoder or decoder can call the MIP mode to obtain the intra prediction block of the current block. Then, the low-frequency non-separable transform (LFNST) as a secondary transform (or second transform) can be applied to the prediction residual of the current block.
[0067] In the related art, although LFNST can be applied to MIP mode prediction with a fixed configuration of LFNST transform kernel candidate set and LFNST transposition indication parameters, this has a negative impact on the encoding and decoding efficiency of VVC.
[0068] Based on this, an embodiment of the present application provides an encoding method, the basic idea of which is: determining prediction parameters of a current block, wherein the prediction parameters include prediction mode parameters; when the prediction mode parameters indicate that a matrix-based intra-frame prediction MIP mode is used to determine an intra-frame prediction value for the chroma component of the current block, obtaining adjacent sampling values of the current block, and determining the MIP input sampling value of the current block based on the adjacent sampling values of the current block; determining the MIP prediction value of the chroma component of the current block based on the MIP input sampling value, the MIP weighting matrix and the shift parameter; filtering the MIP prediction value to determine the intra-frame prediction value of the chroma component of the current block; determining the prediction residual value of the chroma component of the current block based on the intra-frame prediction value of the chroma component of the current block; performing a low-frequency non-separable secondary transform LFNST on the prediction residual value to determine the LFNST parameter; encoding the LFNST parameter and writing it into the bitstream. Another embodiment of the present application provides a decoding method, the basic idea of which is: parsing a code stream to obtain prediction parameters and LFNST parameters of a current block, wherein the prediction parameters include prediction mode parameters; when the prediction mode parameters indicate that a matrix-based intra-frame prediction MIP mode is used to determine an intra-frame prediction value for the chrominance component of the current block, obtaining adjacent sample values of the current block, and determining the MIP input sample value of the current block based on the adjacent sample values of the current block; determining the chrominance component of the current block based on the MIP input sample value, the MIP weighting matrix and the shift parameter MIP prediction value; filtering the MIP prediction value to determine the intra-frame prediction value of the chrominance component of the current block; when the LFNST parameter indicates to perform LFNST on the current block, determining the reconstructed transform coefficient block of the current block, performing LFNST on at least part of the reconstructed transform coefficients in the reconstructed transform coefficient block to obtain a second transform coefficient block; performing a first transform on the second transform coefficient block to obtain a reconstructed residual block of the chrominance component of the current block; determining the reconstructed block of the chrominance component of the current block based on the intra-frame prediction value of the chrominance component of the current block and the reconstructed residual block. In this way, for the MIP mode, it is possible to reduce complexity while ensuring codec performance, while reducing the storage space required in the codec process, and effectively improving codec efficiency; in addition, when LFNST technology is applied to MIP mode prediction, the introduction of MIP parameters makes the LFNST transform more flexible, further improving codec efficiency.
[0069] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0070] See also Figure 1 , which shows an example of a system composition block diagram of an encoder provided by an embodiment of the present application. Figure 1As shown, the encoder 100 may include: a segmentation unit 101, a prediction unit 102, a first adder 107, a transform unit 108, a quantization unit 109, an inverse quantization unit 110, an inverse transform unit 111, a second adder 112, a filtering unit 113, a decoded picture buffer (DPB) unit 114, and an entropy coding unit 115. Here, the input of the encoder 100 may be a video consisting of a series of pictures or a static picture, and the output of the encoder 100 may be a bitstream (also referred to as a "codestream") for representing a compressed version of the input video.
[0071] Among them, the segmentation unit 101 divides the picture in the input video into one or more coding tree units (CTUs). The segmentation unit 101 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 101 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 101 can also form one or more sub-pictures, where a sub-picture can include one or more slices, tiles or bricks.
[0072] During the encoding process of encoder 100, segmentation unit 101 transmits the CTU to prediction unit 102. Generally, prediction unit 102 may be composed of block segmentation unit 103, motion estimation (ME) unit 104, motion compensation (MC) unit 105, and intra prediction unit 106. Specifically, block segmentation unit 103 iteratively uses quadtree segmentation, binary tree segmentation, and ternary tree segmentation to further divide the input CTU into smaller coding units (CUs). Prediction unit 102 may use ME unit 104 and MC unit 105 to obtain inter-frame prediction blocks for the CU. Intra-frame prediction unit 106 may use various intra-frame prediction modes, including MIP mode, to obtain intra-frame prediction blocks for the CU. In an example, a rate-distortion optimized motion estimation method may be used by ME unit 104 and MC unit 105 to obtain inter-frame prediction blocks, and a rate-distortion optimized mode determination method may be used by intra-frame prediction unit 106 to obtain intra-frame prediction blocks.
[0073] The prediction unit 102 outputs the prediction block of the CU, and the first adder 107 calculates the difference between the CU in the output of the segmentation unit 101 and the prediction block of the CU, i.e., the residual CU. The transform unit 108 reads the residual CU and performs one or more transform operations on the residual CU to obtain coefficients. The quantization unit 109 quantizes the coefficients and outputs the quantized coefficients (i.e., levels). The inverse quantization unit 110 performs a scaling operation on the quantized coefficients to output reconstructed coefficients. The inverse transform unit 111 performs one or more inverse transforms corresponding to the transform in the transform unit 108 and outputs the reconstructed residual. The second adder 112 calculates the reconstructed CU by adding the reconstructed residual and the prediction block of the CU from the prediction unit 102. The second adder 112 also sends its output to the prediction unit 102 for use as an intra-frame prediction reference. After all CUs in the picture or sub-picture are reconstructed, the filtering unit 113 performs loop filtering on the reconstructed picture or sub-picture. Here, the filtering unit 113 includes one or more filters, such as a deblocking filter, a sample adaptive offset (SAO) filter, an adaptive loop filter (ALF), a luma mapping and chroma scaling (LMCS) filter, and a neural network-based filter. Alternatively, when the filtering unit 113 determines that a CU is not used as a reference for encoding other CUs, the filtering unit 113 performs loop filtering on one or more target pixels in the CU.
[0074] The output of the filtering unit 113 is a decoded picture or sub-picture, which is cached to the DPB unit 114. The DPB unit 114 outputs the decoded picture or sub-picture based on the timing and control information. Here, the picture stored in the DPB unit 114 can also be used as a reference for the prediction unit 102 to perform inter-frame prediction or intra-frame prediction. Finally, the entropy coding unit 115 converts the parameters required for decoding the picture from the encoder 100 (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 100 finally outputs the code stream.
[0075] Furthermore, the encoder 100 may be a first processor and a first memory that records a computer program. When the first processor reads and runs the computer program, the encoder 100 reads the input video and generates a corresponding bitstream. In addition, the encoder 100 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
[0076] See also Figure 2, which shows an example of a system composition block diagram of a decoder provided in an embodiment of the present application. Figure 2 As shown, the decoder 200 may include: a parsing unit 201, a prediction unit 202, a scaling unit 205, a transform unit 206, an adder 207, a filtering unit 208, and a decoded picture buffer unit 209. Here, the input of the decoder 200 is a bit stream representing a compressed version of a video or a still picture, and the output of the decoder 200 may be a decoded video consisting of a series of pictures or a decoded still picture.
[0077] The input codestream to decoder 200 may be the codestream generated by encoder 100. Parsing unit 201 parses the input codestream and obtains syntax element values from the input codestream. Parsing unit 201 converts the binary representation of the syntax elements into digital values and sends the digital values to units within decoder 200 to obtain one or more decoded pictures. Parsing unit 201 may also parse one or more syntax elements from the input codestream to display decoded pictures.
[0078] During the decoding process of the decoder 200 , the parsing unit 201 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 200 .
[0079] The prediction unit 202 determines a prediction block for the current decoding block (e.g., CU). Here, the prediction unit 202 may include a motion compensation unit 203 and an intra-frame prediction unit 204. Specifically, when the inter-frame decoding mode is indicated for decoding the current decoding block, the prediction unit 202 passes the relevant parameters from the parsing unit 201 to the motion compensation unit 203 to obtain an inter-frame prediction block; when the intra-frame prediction mode (including the MIP mode indicated based on the MIP mode index value) is indicated for decoding the current decoding block, the prediction unit 202 passes the relevant parameters from the parsing unit 201 to the intra-frame prediction unit 204 to obtain an intra-frame prediction block.
[0080] The scaling unit 205 has the same function as the inverse quantization unit 110 in the encoder 100. The scaling unit 205 performs a scaling operation on the quantization coefficients (ie, levels) from the parsing unit 201 to obtain reconstructed coefficients.
[0081] The transform unit 206 has the same function as the inverse transform unit 111 in the encoder 100. The transform unit 206 performs one or more transform operations (ie, inverse operations of one or more transform operations performed by the inverse transform unit 111 in the encoder 100) to obtain a reconstructed residual.
[0082] The adder 207 performs an addition operation on its input (the prediction block from the prediction unit 202 and the reconstructed residual from the transform unit 206) to obtain a reconstructed block of the current decoded block. The reconstructed block is also sent to the prediction unit 202 to be used as a reference for other blocks encoded in the intra prediction mode.
[0083] After all CUs in the picture or sub-picture are reconstructed, the filtering unit 208 performs loop filtering on the reconstructed picture or sub-picture. The filtering unit 208 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 208 determines that the reconstructed block is not used as a reference for decoding other blocks, the filtering unit 208 performs loop filtering on one or more target pixels in the reconstructed block. Here, the output of the filtering unit 208 is a decoded picture or sub-picture, which is cached to the DPB unit 209. The DPB unit 209 outputs the decoded picture or sub-picture based on timing and control information. The picture stored in the DPB unit 209 can also be used as a reference for performing inter-frame prediction or intra-frame prediction by the prediction unit 202.
[0084] Furthermore, the decoder 200 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 200 reads the input bitstream and generates a corresponding decoded video. In addition, the decoder 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 2 Similar connection and data exchange functions to the corresponding units in the
[0085] It should be noted that the encoding method provided in the embodiment of the present application is mainly applied to the intra-frame prediction unit 106 and the transform unit 108 of the encoder 100, and the decoding method provided in the embodiment of the present application is mainly applied to the intra-frame prediction unit 204 and the transform unit 206 of the decoder 200. In other words, the embodiment of the present application can be applied to both the encoder and the decoder, or even to both the encoder and the decoder simultaneously, but this is not limited here.
[0086] It should also be noted that when the embodiment of the present application is applied to the encoder 100, the "current block" specifically refers to the current image block to be encoded in the intra-frame prediction (also referred to as the "encoding block"); when the embodiment of the present application is applied to the decoder 200, the "current block" specifically refers to the current image block to be decoded in the intra-frame prediction (also referred to as the "decoding block").
[0087] In addition, if the encoder 100 can obtain a better prediction effect through the encoding method provided in the embodiment of the present application to improve the encoding performance; then, correspondingly, the decoder 200 can also improve the video decoding recovery quality through the decoding method provided in the embodiment of the present application, thereby improving the decoding performance.
[0088] In one embodiment of this application, see Figure 3 , which shows a schematic flow chart of an encoding method provided by an embodiment of the present application. Figure 3 As shown, the method may include:
[0089] S301: Determine prediction parameters of a current block, wherein the prediction parameters include prediction mode parameters.
[0090] 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.
[0091] Here, assuming 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, then the current block can also be called a luminance block to obtain the predicted value of the luminance component of the current block. Alternatively, assuming 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, then the current block can also be called a chrominance block to obtain the predicted value of the luminance component of the current block.
[0092] It should also be noted that the prediction parameters may include prediction mode parameters, where the prediction mode parameters are used to indicate the prediction mode used by the current block, and different prediction modes correspond to different prediction mode parameters. Here, for determining the prediction mode parameters, a simple decision-making strategy can be adopted, such as determining based on the size of the distortion value; or a complex decision-making strategy can be adopted, such as determining based on the results of rate distortion optimization (RDO), which is not limited in any way in the embodiments of the present application. Generally speaking, the RDO method can be used to determine the prediction mode parameters of the current block, that is, to determine the prediction parameters of the current block.
[0093] Specifically, in some embodiments, determining the prediction parameters of the current block may include:
[0094] Performing precoding processing on the current block using multiple prediction modes to obtain rate-distortion cost values corresponding to the multiple prediction modes;
[0095] An optimal rate-distortion cost value is selected from the obtained multiple rate-distortion cost values, and prediction parameters in the prediction mode corresponding to the optimal rate-distortion cost value are determined as prediction parameters of the current block.
[0096] 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 intra-frame prediction mode. Non-traditional intra-frame prediction modes may include MIP mode, cross-component linear model prediction (CCLM) mode, intra-frame block copy (IBC) mode and PLT (Palette) mode. Inter-frame prediction modes may include traditional inter-frame prediction mode and inter-frame geometric partitioning prediction (GEO) mode.
[0097] 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, an optimal rate-distortion cost value is selected from the multiple obtained rate-distortion cost values (usually, the minimum rate-distortion cost value is the optimal rate-distortion cost value), and the prediction parameters under the prediction mode corresponding to the optimal rate-distortion cost value are determined as the prediction parameters of the current block.
[0098] In addition, the current block can be pre-encoded using multiple prediction modes to obtain distortion values corresponding to the multiple prediction modes. The optimal distortion value is then selected from the obtained multiple distortion values, and the prediction parameters under the prediction mode corresponding to the optimal distortion value are determined as the prediction parameters for the current block. In this way, the encoder ultimately uses the prediction mode indicated by the prediction mode parameter in the determined prediction parameters to perform predictive encoding on the current block, which can reduce the prediction residual and improve coding efficiency.
[0099] S302: When the prediction mode parameter indicates that a matrix-based intra-frame prediction MIP mode is used to determine an intra-frame prediction value for the chrominance component of the current block, adjacent sampling values of the current block are obtained, and the MIP input sampling value of the current block is determined based on the adjacent sampling values of the current block.
[0100] It should be noted that, for the current block, the embodiment of the present application uses the MIP mode to perform intra-frame prediction on the chrominance components of the current block. In this process, it is first necessary to obtain the adjacent sample values of the current block; then, based on the adjacent sample values of the current block, the MIP input sample values of the current block are determined.
[0101] 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. 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" shown 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.
[0102] It should also be noted that, in addition to the prediction mode parameters, the prediction parameters may also include the size parameters of the current block. These size parameters may include the width (expressed as nTbW) and height (expressed as nTbH) of the current block. Furthermore, the block size index value (i.e., mipSizeId) of the current block can be determined based on the size parameters of the current block.
[0103] 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:
[0104] 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;
[0105] 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;
[0106] 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.
[0107] 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:
[0108] 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;
[0109] 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;
[0110] 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.
[0111] 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:
[0112] inSize=(2×boundarySize)-(mipSizeId==2)? 1:0 (1)
[0113] 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.
[0114] Table 1
[0115] mipSizeId boundarySize predSize 0 2 4 1 4 4 2 4 8
[0116] 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.
[0117] 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.
[0118] 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.
[0119] 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.
[0120] Table 2
[0121] mipSizeId boundarySize inSize predSize 0 2 4 4 1 4 8 4 2 4 7 8
[0122] 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.
[0123] 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.
[0124] 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.
[0125] 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.
[0126] 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:
[0127] Determining a block size index value of the current block according to a size parameter of the current block;
[0128] Performing downsampling filtering on adjacent sample values of the current block to obtain a first temporary reference value;
[0129] When the block size index 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;
[0130] When the block size index value of the current block is outside 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.
[0131] Furthermore, when the block size index value of the current block is within a preset range, the method may further include:
[0132] Determine a second constant value according to the bit depth of the adjacent sampling values of the current block; set the value corresponding to the index number 0 in the MIP input sampling value to be equal to the difference between the value corresponding to the index number 0 in the first temporary reference value and the second constant value; set the value corresponding to the index number i in the MIP input sampling value to be equal to the difference between the value corresponding to the index number i in the first temporary reference value and the value corresponding to the index number equal to 0 in the first temporary reference value, where i is an integer greater than 0.
[0133] 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].
[0134] It should also be noted that whether the size parameter value of the current block is within the preset range can be determined based on whether the block size index value of the current block (represented by mipSizeId) is within the preset range. Specifically, when mipSizeId=0 or 1, it indicates that the block size index value of the current block is within the preset range, that is, the size parameter value of the current block is within the preset range; when mipSizeId=2, it indicates that the block size index value of the current block is outside the preset range, that is, the size parameter value of the current block is not within the preset range.
[0135] 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]).
[0136] 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:
[0137] 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.
[0138] 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:
[0139] 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.
[0140] That is, after obtaining the bit depth (expressed as 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.
[0141] 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]).
[0142] Specifically, the construction process of the x-th input sample value p[x] is as follows:
[0143] In a possible implementation, when the block size index value of the current block is within a preset range, the construction process may include:
[0144] 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;
[0145] 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.
[0146] In an embodiment of the present application, the minuend in the calculation of the difference is set equal to the second constant value, and the subtrahend in the calculation of the difference is set equal to the value corresponding to the index number 0 in the first temporary reference value.
[0147] 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].
[0148]
[0149] In another possible implementation, when the block size index value of the current block is within a preset range, the construction process may include:
[0150] Calculate the difference between the value corresponding to the index number 0 in the first temporary reference value and the second constant value to obtain the value corresponding to the index number 0 in the MIP input sample value;
[0151] 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.
[0152] In an embodiment of the present application, the minuend in the calculation of the difference is set equal to the value corresponding to the index number 0 in the first temporary reference value, and the subtrahend in the calculation of the difference is set equal to the second constant value.
[0153] 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]).
[0154] The details are as follows:
[0155]
[0156] In yet another possible implementation, when the block size index value of the current block is outside a preset range, the construction process may include:
[0157] 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.
[0158] 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,
[0159] p[x]=pTemp[x+1]-pTemp[0] for x=0,...,inSize-1 (4)
[0160] 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.
[0161] In addition, embodiments of the present application can also use a unified calculation method to obtain the value of p[x] without having to determine the value of mipSizeId. In some embodiments, determining the MIP input sample value of the current block based on the adjacent sample values of the current block may include:
[0162] Performing downsampling filtering on adjacent sample values of the current block to obtain a first temporary reference value;
[0163] determining a second constant value according to a bit depth of adjacent sample values of the current block, and caching the second constant value in a data unit following the first temporary reference value to obtain a second temporary reference value;
[0164] The value corresponding to the index number j in the MIP input sample value is set to be equal to the difference between the value corresponding to the index number j+1 in the second temporary reference value and the value corresponding to the index number 0 in the second temporary reference value, where j is an integer greater than or equal to 0.
[0165] That is to say, the embodiment of the present application can add a second constant value (i.e., (1<<(BitDepth-1))) as an additional element at the end of the buffer pTemp. At this time, the size parameter of the current block is no longer considered (i.e., there is no need to consider the value of mipSizeId), and p[x] can be directly set to be equal to pTemp[x+1]-pTemp[0], x=0,…,inSize-1.
[0166] In this way, after the MIP input sample value of the current block is determined according to the adjacent sample values of the current block, the MIP prediction value of the current block can be further determined.
[0167] S303: Determine a MIP prediction value of the chrominance component of the current block according to the MIP input sample value, the MIP weighting matrix and the shift parameter.
[0168] The MIP prediction value is the prediction value of some sampling points in the chrominance component of the current block.
[0169] It should be noted that the shift parameters may include a shift offset parameter and a shift quantity parameter. Figure 4 As shown, for S303, the following steps may be included:
[0170] S303-1: Determine the product of the sum of the MIP input sample 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.
[0171] It should be noted that the shift offset parameter may also be referred to as a shift compensation parameter or 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 32, 46, 56, or 66. 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, and this is not limited here.
[0172] S303-2: Determine a first constant value according to the value of the shift quantity parameter.
[0173] S303-3: Set the value of the first offset to the difference between the first constant value and the product.
[0174] It should be noted that the shift quantity parameter may also be referred to as a shift factor, number of shift bits, or weight shift value, 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.
[0175] 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.
[0176] S303-4: Determine the MIP weighting matrix of the current block according to the prediction parameters.
[0177] It should be noted that the prediction parameters may include prediction mode parameters and the size parameters of the current block. Among the prediction parameters, when the prediction mode parameters indicate that the chrominance components of the current block use the MIP mode to determine intra-frame prediction values, 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 parameters 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.
[0178] 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.
[0179] Table 3
[0180] mipSizeId Number of columns Number of lines 0 4 16 1 8 16 2 7 64
[0181] It is understood that 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 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:
[0182] In one possible implementation, for different block size index values and different MIP mode index values, the shift amount parameter may be different. In some embodiments, the method may further include:
[0183] When the chrominance component of the current block uses the MIP mode to determine the intra-frame prediction value, determining the MIP mode index value of the current block;
[0184] 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;
[0185] The queried value is determined as the value of the shift quantity parameter.
[0186] 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.
[0187] Table 4
[0188]
[0189] 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.
[0190] 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.
[0191] 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 set to 6, but this is not limited to any particular value.
[0192] In another possible implementation, regarding the value of the shift quantity parameter, the method may further include:
[0193] Determining a block size index value of the current block according to a size parameter of the current block;
[0194] The value of the shift quantity parameter is determined according to the block size index value of the current block.
[0195] 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 some embodiments, the determining the block size index value of the current block based on the size parameter of the current block can include:
[0196] 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;
[0197] 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;
[0198] 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.
[0199] 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.
[0200] 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:
[0201] When the block size index values are respectively equal to 0, 1, and 2, it is determined that the values of the shift quantity parameter corresponding to the block size index value of the current block are respectively equal to 5, 6, and 5.
[0202] 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:
[0203] 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.
[0204] 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:
[0205] 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.
[0206] 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.
[0207] 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:
[0208] 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.
[0209] 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:
[0210] 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.
[0211] 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.
[0212] 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:
[0213] 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;
[0214] The queried value is determined as the value of the shift quantity parameter.
[0215] 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.
[0216] Table 5
[0217] mipSizeId sW 0 5 1 6 2 5
[0218] 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.
[0219] 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.
[0220] 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:
[0221] 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:
[0222] When the chrominance component of the current block uses the MIP mode to determine the intra-frame prediction value, determining the MIP mode index value of the current block;
[0223] 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;
[0224] The queried value is determined as the value of the shift offset parameter.
[0225] 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.
[0226] Table 6
[0227]
[0228] 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.
[0229] 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.
[0230] 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 set to 32, but this is not limited to any limitation.
[0231] In another possible implementation, for determining the value of the shift offset parameter, the method may further include:
[0232] Determining a block size index value of the current block according to a size parameter of the current block;
[0233] The value of the shift offset parameter is determined according to the block size index value of the current block.
[0234] 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.
[0235] Optionally, in some embodiments, determining the value of the shift offset parameter according to the block size index value of the current block may include:
[0236] When the block size index values are respectively equal to 0, 1, and 2, it is determined that the values of the shift offset parameter corresponding to the block size index value of the current block are respectively equal to 34, 23, and 46.
[0237] Alternatively, in some embodiments, the shift offset parameter table may be minimized, and the offset factor may still be determined using a lookup table. Alternatively, in some embodiments, determining the value of the shift offset parameter based on the block size index value of the current block may include:
[0238] 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;
[0239] The queried value is determined as the value of the shift offset parameter.
[0240] 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.
[0241] Table 7
[0242] mipSizeId fO 0 34 1 23 2 46
[0243] 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.
[0244] 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.
[0245] 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:
[0246] The first constant value is set to be equal to an integer exponent power of 2, wherein the exponent of the power is equal to the value of the shift amount parameter minus 1.
[0247] Optionally, in some embodiments, determining the first constant value according to the value of the shift quantity parameter may include:
[0248] 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.
[0249] 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.
[0250] 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
[0251] 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.
[0252] S303-5: Determine a MIP prediction value of the chrominance component of the current block according to the MIP weighting matrix, the MIP input sample value, the shift quantity parameter and the first offset.
[0253] Here, the MIP prediction value represents the prediction value of some sampling points in the chrominance component of the current block.
[0254] 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:
[0255] Calculating a first weighted sum of the MIP weight matrix and the MIP input sample value;
[0256] Calculating a first sum of the first weighted sum and the first offset;
[0257] 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;
[0258] 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; wherein the first temporary reference value is obtained based on downsampling filtering processing of adjacent sample values of the current block.
[0259] 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 / array form according to predSize×predSize. The calculation formula is as follows,
[0260]
[0261] 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 i in the MIP input sample value; pTemp[0] represents the value corresponding to index 0 in the first temporary reference value; ">>" represents the binary right shift operator, and "<<" represents the binary left shift operator; x=0,…,predSize-1,y=0,…,predSize-1. Thus, according to the above formula (5), predMip[x][y] can be calculated to obtain the MIP prediction block.
[0262] In some embodiments, if sW is fixed at 6 and fO is fixed at 32, then the calculation formula is as follows:
[0263]
[0264] 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.
[0265] S304: Filter the MIP prediction value to determine an intra-frame prediction value of the chrominance component of the current block.
[0266] 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:
[0267] Determine whether the size parameters of the MIP prediction block are the same as the size parameters of the current block;
[0268] When the size parameter of the MIP prediction block is the same as the size parameter 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;
[0269] When the size parameter of the MIP prediction block is different from the size parameter 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.
[0270] Here, the filtering process may include an up-sampling filtering process or a low-pass filtering process.
[0271] 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 size parameters for the MIP prediction block: 4×4 MIP prediction block and 8×8 MIP prediction block, the size parameters of the current block may or may not be the same as the size parameters of the MIP prediction block. In other words, the sample values corresponding to the MIP prediction block may not fully fill the current block, so 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 parameters of the MIP prediction block are the same as those of the current block.
[0272] It should also be noted that when the size parameters of the MIP prediction block are the same as the size parameters of the current block, that is, the width and height of the MIP prediction block are the same as those of 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.
[0273] predSamples[x][y]=predMip[x][y] (7)
[0274] 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 (7), 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.
[0275] It should also be noted that when the size parameters of the MIP prediction block are different from the size parameters 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 filtering is required for the MIP prediction block. 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, a weighted average of predSamples[x][y] and predSamplesTemp[x][y] is calculated to obtain the intra-frame prediction value of the chrominance component of the current block, that is, the intra-frame prediction block of the current block.
[0276] 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-frame prediction block of the current block; otherwise, the MIP prediction block needs to be filtered to obtain the intra-frame prediction block of the current block. Here, taking a 4×4 current block as an example, if the size parameters of the current block and the MIP prediction block are the same, 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-frame prediction block of the current block, thereby obtaining the intra-frame prediction value of at least one pixel in the current block.
[0277] In short, for the prediction process of the MIP mode, the input data of the MIP mode may 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 indicator indicating whether transposition processing is required (i.e., the MIP transposition indicator parameter, which can be represented by isTransposed). The output data of the MIP mode may include: the intra-frame prediction block of the current block. The predicted value corresponding to the pixel coordinates [x][y] in the intra-frame prediction block is predSamples[x][y]; where x = 0, 1, ..., nTbW-1; y = 0, 1, ..., nTbH-1.
[0278] like Figure 5 As shown in Figure 2, the MIP prediction process specifically includes the following steps:
[0279] S501: Configure core parameters.
[0280] For S501, 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 samples and the MIP prediction block size output by matrix multiplication are different for different types of current blocks.
[0281] S502: Acquire reference pixels.
[0282] In step S502, when predicting the current block, the upper and left adjacent blocks of the current block are both coded blocks, and the reference pixels in the MIP mode are the reconstructed values of the pixels in the upper row and left column adjacent to the current block. In other words, the process of obtaining the reference pixels adjacent to the upper side (denoted by refT) and the reference pixels adjacent to the left side (denoted by refL) of the current block is the reference pixel acquisition process.
[0283] S503: Construct input samples.
[0284] For S503, this step is used for input of matrix multiplication, and may specifically include:
[0285] S5031: Obtain reference samples;
[0286] S5032: Construct a reference sampling buffer;
[0287] S5033: Derive matrix multiplication input samples.
[0288] In S5031, the process of obtaining the reference sample is the process of downsampling the reference pixel. In S5032, there are two filling methods in the construction of the reference sample buffer, which may include:
[0289] S5032-1: How to fill the buffer when transposition is not required;
[0290] S5032-2: How to fill the buffer when transposition is required.
[0291] S504: Generate intra-frame prediction values.
[0292] For S504, this step is used to obtain the MIP prediction value of the current block, which may specifically include:
[0293] S5041: Constructing a MIP prediction block of matrix multiplication output samples;
[0294] S5042: Performing embedding processing on the MIP prediction block of the matrix multiplication output sample;
[0295] S5043: performing transposition processing on the MIP prediction block of the matrix multiplication output sample;
[0296] S5044: Generate MIP prediction value.
[0297] In S5041, the process of constructing the MIP prediction block may specifically include:
[0298] S5041-1: Get weight matrix;
[0299] S5041-2: Get shift parameters;
[0300] S5041-3: Matrix multiplication operation.
[0301] That is, in the process of constructing the MIP prediction block, it is necessary not only to obtain the weight matrix but also the shift parameters (including the shift offset parameter and the shift amount parameter); then, a matrix multiplication operation is performed to obtain the MIP prediction block of the matrix multiplication output samples. For S5044, generating the final MIP prediction value includes two cases, specifically including:
[0302] S5044-1: Generate prediction values that do not require upsampling and filtering;
[0303] S5044-2: Generate prediction values that require upsampling and filtering.
[0304] In this way, after the above four steps S501 to S504, the embodiment of the present application can obtain the intra-frame prediction value of at least one pixel in the chrominance component of the current block.
[0305] S305: Determine a prediction residual value of the chrominance component of the current block according to the intra-frame prediction value of the chrominance component of the current block.
[0306] It should be noted that after obtaining the intra-frame prediction value of the chrominance component of the current block, the difference between the true value of the chrominance component of the current block and the intra-frame prediction value of the chrominance component of the current block can be calculated to obtain the predicted residual value of the chrominance component of the current block, that is, to obtain the residual block of the current block.
[0307] S306: Perform low-frequency non-separable secondary transform (LFNST) on the prediction residual value to determine LFNST parameters.
[0308] It should be noted that for Figure 1 For the transform unit 108 shown in , the transform unit 108 may perform a first transform on the residual block of the current block, such as an integer transform initially designed based on the Discrete Cosine Transform (DCT); and may also perform a second transform on the residual block of the current block, such as a Low-Frequency Non-Separable Transform (LFNST). Specifically, in some embodiments, performing the Low-Frequency Non-Separable Transform (LFNST) on the prediction residual value and determining the LFNST parameters may include:
[0309] Determining a residual block of the current block according to the prediction residual value, and performing a first transform on the residual block to obtain a first transform coefficient block;
[0310] determining whether to perform LFNST on at least a portion of transform coefficients in the first transform coefficient block;
[0311] If the determination result is yes, LFNST is performed on at least part of the transform coefficients in the first transform coefficient block to determine the LFNST parameters.
[0312] In an embodiment of the present application, the encoder may perform a first transform (also referred to as a "core transform" or "primary transform" or "main transform") on the prediction residual values in the residual block to obtain a first transform coefficient block after the first transform; and then perform an LFNST transform (also referred to as a "secondary transform" or "secondary transform") on some or all of the transform coefficients in the first transform coefficient block to determine LFNST parameters. It should be noted that the first transform here is a transform different from the LFNST.
[0313] It should also be noted that not all current blocks can be subjected to LFNST. After the first transform, it is necessary to check certain conditions (such as the minimum value of the size parameter of the current block, the block size index value of the current block, etc.) to determine whether to perform LFNST on at least some of the transform coefficients in the first transform coefficient block. Optionally, in some embodiments, determining whether to perform LFNST on at least some of the transform coefficients in the first transform coefficient block may include:
[0314] When the chrominance component of the current block uses the MIP mode to determine the intra-frame prediction value, determining the minimum value among the size parameters of the current block;
[0315] According to the minimum value, it is determined whether to perform LFNST on at least part of the transform coefficients in the first transform coefficient block.
[0316] Further, the determining, based on the minimum value, whether to perform LFNST on at least part of the transform coefficients in the first transform coefficient block may include:
[0317] If the minimum value is greater than or equal to a first preset threshold, it is determined to perform LFNST on at least part of the transform coefficients in the first transform coefficient block.
[0318] Here, the first preset threshold value may be used to represent a preset threshold value for measuring whether to perform LFNST. In the embodiment of the present application, the first preset threshold value may be set to 8, but is not specifically limited thereto.
[0319] That is to say, when the MIP mode is used to perform intra-frame prediction on the chrominance component of the current block, the minimum value of the size parameters of the current block can be determined at this time; for example, when the minimum value of the width and height is greater than or equal to 8, it can be determined that LFNST is performed on at least part of the transform coefficients in the first transform coefficient block.
[0320] Optionally, in some embodiments, the determining whether to perform LFNST on at least part of the transform coefficients in the first transform coefficient block may include:
[0321] When the chrominance component of the current block uses the MIP mode to determine the intra-frame prediction value, determining the block size index value of the current block according to the size parameter of the current block;
[0322] Whether to perform LFNST on at least part of the transform coefficients in the first transform coefficient block is determined according to the block size index value.
[0323] Further, the determining, according to the block size index value, whether to perform LFNST on at least part of the transform coefficients in the first transform coefficient block may include:
[0324] If the block size index value is equal to a second preset threshold, it is determined to perform LFNST on at least part of the transform coefficients in the first transform coefficient block.
[0325] Here, the second preset threshold value can also be used to represent a preset threshold value for measuring whether to perform LFNST. In the embodiment of the present application, the second preset threshold value can be set to a preset value (e.g., 2), or one of multiple preset values (e.g., 1, 2), but is not specifically limited.
[0326] That is to say, when the MIP mode is used to perform intra-frame prediction on the chrominance component of the current block, the block size index value (mipSizeId) of the current block can be determined based on the size parameter of the current block; for example, when the value of mipSizeId is equal to 2, it can be determined that LFNST is performed on at least part of the transform coefficients in the first transform coefficient block.
[0327] Optionally, in some embodiments, the determining whether to perform LFNST on at least part of the transform coefficients in the first transform coefficient block may include:
[0328] calculating a first cost result without performing LFNST on at least part of the transform coefficients in the first transform coefficient block;
[0329] calculating a second cost result while performing LFNST on at least part of the transform coefficients in the first transform coefficient block;
[0330] Determining whether to perform LFNST on at least part of the transform coefficients in the first transform coefficient block is determined according to the first cost result and the second cost result.
[0331] Further, the determining, based on the first cost result and the second cost result, whether to perform LFNST on at least part of the transform coefficients in the first transform coefficient block may include:
[0332] If the first cost result is greater than the second cost result, it is determined to perform LFNST on at least part of the transform coefficients in the first transform coefficient block.
[0333] It should be noted that the embodiments of the present application can adopt a traditional rate-distortion optimization method. First, a first cost result is calculated without performing LFNST on at least part of the transform coefficients in the first transform coefficient block; then, a second cost result is calculated while performing LFNST on at least part of the transform coefficients in the first transform coefficient block; the first cost result is compared with the second cost result. When the first cost result is greater than the second cost result, it can be determined that LFNST is performed on at least part of the transform coefficients in the first transform coefficient block.
[0334] In this way, when the determination result is yes, that is, it is determined that LFNST needs to be performed on at least part of the transform coefficients in the first transform coefficient block, LFNST can be performed on at least part of the transform coefficients in the first transform coefficient block and LFNST parameters can be determined.
[0335] S307: Encode the LFNST parameters and write them into the bitstream.
[0336] It should be noted that the LFNST parameter includes an LFNST index number, which can be represented by lfnst_index. In some embodiments, determining the LFNST parameter may include:
[0337] If it is determined that LFNST is performed on at least part of the transform coefficients in the first transform coefficient block, setting the value of the LFNST index sequence number to be greater than zero;
[0338] If it is determined not to perform LFNST on at least part of the transform coefficients in the first transform coefficient block, the value of the LFNST index sequence number is set to zero.
[0339] Furthermore, for S307, encoding the LFNST parameters and writing them into the bitstream may include:
[0340] The LFNST index number is encoded and written into the bitstream.
[0341] That is, after determining the LFNST parameter, i.e., lfnst_index, if lfnst_index is equal to 0, LFNST is not performed; if lfnst_index is greater than 0, LFNST is required. During the encoding process, Context-based Adaptive Binary Arithmetic Coding (CABAC) with the descriptor "ae(v)" can be used to encode lfnst_index.
[0342] For example, see Table 8, which shows an example of a syntax structure description of an LFNST parameter provided by the related art. At this time, the judgment conditions for determining whether to perform LFNST on at least a portion of the transform coefficient block in the first transform coefficient block may include at least one of the following: treeType == DUAL_TREE_CHROMA, IntraMipFlag[x0][y0], Min(lfnstWidth, lfnstHeight)>=16.
[0343] Table 8
[0344]
[0345] Referring to Tables 9A and 9B, which respectively illustrate an example of a syntax structure description of an LFNST parameter provided in an embodiment of the present application, the judgment condition for determining whether to perform LFNST on at least a portion of the transform coefficient block in the first transform coefficient block may include at least one of the following: intra_mip_flag[x0][y0]==1&&Min(lfnstWidth,lfnstHeight)>=8, intra_mip_flag[x0][y0]==1&&mipSizeId==2.
[0346] Specifically, as shown in the syntax structure of Table 9A, when the minimum value of the size parameter of the current block is greater than or equal to 8 (i.e., both the width and height are greater than or equal to 8), the lfnst_index of the current block can be encoded using the MIP mode (i.e., when intra_mip_flag[x0][y0] == 1). Alternatively, the judgment condition can be set to: both the width and height are greater than or equal to a first value (e.g., 8), and the sum of the width and height is greater than or equal to a second value (e.g., 16). As shown in the syntax structure of Table 9B, when the block size index value (mipSizeId) of the current block is equal to 2, the lfnst_index of the current block can be encoded using the MIP mode (i.e., when intra_mip_flag[x0][y0] == 1). Alternatively, the judgment condition can be set to: mipSizeId is equal to one of multiple preset values (e.g., 1, 2).
[0347] Table 9A
[0348] coding_unit(x0,y0,cbWidth,cbHeight,cqtDepth,treeType,modeType){ Descriptor …… if(…&&(intra_mip_flag[x0][y0]===1&&Min(lfnstWidth,lfnstHeight)>=8)&&…){ …… lfnst_idx ae(v) } …… }
[0349] Table 9B
[0350] coding_unit(x0,y0,cbWidth,cbHeight,cqtDepth,treeType,modeType){ Descriptor …… if(…&&(intra_mip_flag[x0][y0]==1&&mipSizeId==2)&&…){ …… lfnst_idx ae(v) } …… }
[0351] It should also be noted that when determining that LFNST can be performed on the current block, it is also necessary to determine the LFNST transform kernel (represented by kernel) used for the current block. In some embodiments, performing LFNST on the prediction residual value and determining LFNST parameters may include: determining the LFNST transform kernel used for the current block; and performing LFNST on the prediction residual value using the LFNST transform kernel to determine the LFNST parameters.
[0352] In the embodiment of the present application, there are four transform kernel candidate sets in LFNST, which may include set0, set1, set2, and set3. Here, the embodiment of the present application may use MIP parameters to determine the LFNST transform kernel candidate set, and then select the LFNST transform kernel used for the current block from the LFNST transform kernel candidate set. Therefore, in some embodiments, the method may further include:
[0353] When the chrominance component of the current block uses the MIP mode to determine the intra prediction value, determining the MIP parameters from the prediction parameters of the current block;
[0354] Determine a LFNST transform kernel candidate set according to the MIP parameters;
[0355] In the LFNST transform core candidate set, the transform core indicated by the LFNST index number is set as the LFNST transform core used by the current block;
[0356] Setting the value of the LFNST index number to indicate that LFNST is performed on the current block and the index number of the LFNST transform core in the LFNST transform core candidate set;
[0357] The LFNST transform kernel candidate set includes two or more preset LFNST transform kernels.
[0358] It should be noted that the MIP parameters may include at least one of the following: a MIP mode index value (represented by modeId) and a MIP transposition indication parameter (represented by isTransposed). Specifically, for the LFNST transform kernel used by the current block, when the value of the MIP transposition indication parameter indicates that the sampling point input vector used by the MIP mode is transposed, it is also necessary to perform matrix transposition processing on the selected transform kernel to obtain the LFNST transform kernel used by the current block.
[0359] Furthermore, in some embodiments, determining the LFNST transform kernel candidate set according to the MIP parameters may include:
[0360] Determine the value of the LFNST intra prediction mode index number according to the MIP mode index value;
[0361] Determining the index value of the LFNST transform kernel candidate set through a fifth preset lookup table according to the value of the LFNST intra prediction mode index sequence number;
[0362] The LFNST transform kernel candidate set is selected from a plurality of candidate LFNST transform kernel candidate sets according to the index value of the LFNST transform kernel candidate set.
[0363] Here, the LFNST intra prediction mode index number can be represented by predModeIntra, and the index value of the LFNST transform kernel candidate set can be represented by lfnstTrSetIdx.
[0364] It should be noted that the fifth preset lookup table is shown in Table 10. According to the MIP mode index value (i.e., the value of modeId), the value of predModeIntra can be determined; then, according to the value of predModeIntra, the value of lfnstTrSetIdx can be directly determined in combination with Table 10, that is, the LFNST transform core candidate set selected for the current block is determined. Here, the value of lfnstTrSetIdx indicates the transform core candidate set used during LFNST; since the value of modeId can include 0, 1, 2, 3, 4, 5, the value of predModeIntra is also 0, 1, 2, 3, 4, 5; its corresponding relationship with lfnstTrSetIdx is as follows,
[0365] Table 10
[0366]
[0367]
[0368] In a specific embodiment, determining the value of the LFNST intra prediction mode index number according to the MIP mode index value may include: setting the value of the LFNST intra prediction mode index number to be equal to the MIP mode index value.
[0369] That is, in an embodiment of the present application, the value of predModeIntra may be set equal to the value of modeId, and then, based on the value of predModeIntra, the value of lfnstTrSetIdx may be directly determined in combination with Table 10, thereby determining the candidate set of LFNST transform kernels selected for the current block. It should also be noted that, in another specific embodiment, the embodiment of the present application may also directly map the value of modeId to the value of the PLANAR mode, and then use the value of predModeIntra corresponding to the PLANAR mode to determine the value of lfnstTrSetIdx, thereby determining the candidate set of LFNST transform kernels selected for the current block.
[0370] In some embodiments, the LFNST parameters may further include LFNST coefficients. Determining the LFNST parameters may include:
[0371] performing LFNST on at least part of the transform coefficients in the first transform coefficient block to obtain the LFNST coefficients;
[0372] Accordingly, encoding the LFNST parameters and writing them into the code stream includes:
[0373] quantizing the LFNST coefficients to obtain quantized coefficients;
[0374] The quantized coefficients are encoded and written into a bitstream.
[0375] It should be noted that when lfnst_index is not equal to 0, that is, it is determined to perform LFNST on the current block, the LFNST coefficients can be obtained by performing LFNST on at least part of the transform coefficients in the first transform coefficient block; then the LFNST coefficients are quantized and encoded and written into the bitstream.
[0376] It should be noted that d[x][y] is assumed to be the first transform coefficient block, where x = 0, ..., nTbW-1, y = 0, ..., nTbH-1, where nTbW and nTbH represent the width and height of the current block, respectively. It is assumed that v[x] represents a block including LFNST coefficients, where x = 0, ..., nLfnstOutSize-1, where nLfnstOutSize = (nTbW>=8 && nTbH>=8)? 48:16.
[0377] In a possible implementation, LFNST can be performed directly on at least part of the transform coefficients in the first transform coefficient block using a horizontal scanning order to obtain LFNST coefficients. Specifically,
[0378]
[0379] Among them, log2LfnstSize is determined as follows:
[0380] Log2LfnstSize=(nTbW>=8&&nTbH>=8)? 3:2 (9)
[0381] In another possible implementation, the scanning order may include a horizontal scanning order and a vertical scanning order. Here, the determination of the scanning order is related to the value of the MIP transposition indication parameter (indicated by isTransposed).
[0382] Optionally, in some embodiments, performing LFNST on at least part of the transform coefficients in the first transform coefficient block to obtain the LFNST coefficients may include:
[0383] When the value of the MIP transposition indication parameter indicates that a transposition process is to be performed on the sampling point input vector used in the MIP mode, performing LFNST on at least part of the transform coefficients in the first transform coefficient block according to a vertical scanning order to obtain the LFNST coefficients;
[0384] When the value of the MIP transposition indication parameter indicates that the sampling point input vector used by the MIP mode is not to be transposed, LFNST is performed on at least part of the transform coefficients in the first transform coefficient block according to a horizontal scanning order to obtain the LFNST coefficients.
[0385] Specifically, when the value of isTransposed is equal to 0, the sampling point input vector used by the MIP mode is not transposed, then LFNST can be performed on at least part of the transform coefficients in the first transform coefficient block according to the horizontal scanning order, as follows:
[0386]
[0387] When the value of isTransposed is equal to 1, the sampling point input vector used by the MIP mode is transposed, and then LFNST can be performed on at least part of the transform coefficients in the first transform coefficient block according to the vertical scanning order, as follows:
[0388]
[0389] The determination of log2LfnstSize is shown in the above formula (9).
[0390] Optionally, in some embodiments, performing LFNST on at least part of the transform coefficients in the first transform coefficient block to obtain the LFNST coefficients may include:
[0391] When the value of the MIP transposition indication parameter indicates that a transposition process is to be performed on the sampling point input vector used in the MIP mode, performing LFNST on at least part of the transform coefficients in the first transform coefficient block according to a horizontal scanning order to obtain the LFNST coefficients;
[0392] When the value of the MIP transposition indication parameter indicates that the sampling point input vector used by the MIP mode is not to be transposed, LFNST is performed on at least part of the transform coefficients in the first transform coefficient block according to a vertical scanning order to obtain the LFNST coefficients.
[0393] Specifically, when the value of isTransposed is equal to 1, the sampling point input vector used in the MIP mode is transposed, and LFNST can be performed on at least part of the transform coefficients in the first transform coefficient block according to the horizontal scanning order, as shown in the above formula (10).
[0394] When the value of isTransposed is equal to 0, the sampling point input vector used by the MIP mode is not transposed. Then, LFNST can be performed on at least part of the transform coefficients in the first transform coefficient block according to the vertical scanning order, as shown in the above formula (11).
[0395] The determination of log2LfnstSize is shown in the above formula (9).
[0396] In addition, the LFNST in the embodiment of the present application can be applied to traditional intra prediction modes (such as angular intra prediction mode, DC mode, and PLANAR mode) in addition to the MIP mode. Its specific implementation is similar to that of the MIP mode.
[0397] In some embodiments, determining the LFNST transform kernel candidate set according to the MIP parameters may include:
[0398] Determine the value of the LFNST intra prediction mode index number according to the index value of the traditional intra prediction mode;
[0399] Determining an index value of an LFNST transform kernel candidate set through a sixth preset lookup table according to the value of the LFNST intra prediction mode index sequence number;
[0400] The LFNST transform kernel candidate set is selected from a plurality of candidate LFNST transform kernel candidate sets according to the index value of the LFNST transform kernel candidate set.
[0401] It should be noted that the sixth preset lookup table is shown in Table 11. The value of predModeIntra can be determined based on the index value of the traditional intra prediction mode. Then, based on the value of predModeIntra, the value of lfnstTrSetIdx can be directly determined in conjunction with Table 11, thereby determining the candidate set of LFNST transform kernels selected for the current block. Here, the index value of the traditional intra prediction mode can be assigned to predModeIntra to determine the value of lfnstTrSetIdx.
[0402] Table 11
[0403] predModeIntra lfnstTrSetIdx predModeIntra<0 1 0<=predModeIntra<=1 0 2<=predModeIntra<=12 1 13<=predModeIntra<=23 2 24<=predModeIntra<=44 3 45<=predModeIntra<=55 2 56<=predModeIntra<=80 1
[0404] The following will be combined Figure 1 The encoder 100 shown specifically illustrates the encoding method of the embodiment of the present application.
[0405] It should be understood that the current block (or referred to as "coding block") in the embodiment of the present application can be a CU or a partition of a CU (e.g., a transform block). Specifically, when the intra-frame prediction unit 106 determines that the MIP mode is used to encode the current block, or when the intra-frame prediction unit 106 uses the rate-distortion optimization method to evaluate the MIP mode for encoding the current block, the intra-frame prediction unit 106 will obtain an intra-frame prediction block of the current block; wherein the intra-frame prediction block of the current block includes an intra-frame prediction value of at least one pixel (samples) in the current block.
[0406] Specifically, the intra prediction unit 106 uses the MIP mode to obtain the intra prediction block, and the steps are as follows:
[0407] First, the intra-frame prediction unit 106 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.
[0408] The intra-frame prediction unit 106 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, and the shift parameters may be used for an offset operation during the process of obtaining the intra-frame prediction values for the partial pixels.
[0409] Finally, if the predicted pixels corresponding to some of the pixels in the current block are obtained, the intra-frame prediction unit 106 also needs to obtain the predicted pixels corresponding to the remaining pixels in the current block excluding the partial pixels. For example, the intra-frame prediction unit 106 can use an interpolation filter to obtain the predicted pixels corresponding to the remaining pixels, where the input of the interpolation filter can be the partial pixels and the adjacent pixels.
[0410] like Figure 6 , which shows an example of a flow chart of obtaining an intra-frame prediction block using the MIP mode in an embodiment of the present application. The flow can be implemented on the encoder 100, where the "current block" refers to the "encoding block".
[0411] Step 601: The intra-frame prediction unit 106 obtains the adjacent pixels of the current block. For example, the adjacent pixels are marked as Figure 6 The gray filled squares adjacent to the current block in step 601 are shown. The intra-frame prediction unit 106 obtains one or more reference pixels from the adjacent pixels. Figure 6 In the example of step 601, the intra-frame prediction unit 106 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 106 may select an adjacent pixel as a reference pixel for every other adjacent pixel. For example, Figure 6 In the example of step 601 , the intra prediction unit 106 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.
[0412] The specific process of step 601 is as follows:
[0413] The intra-frame prediction unit 106 obtains the width and height of the current block from the block segmentation unit 103, with the width and height being represented by variables cbWidth and cbHeight, respectively. As an example, the intra-frame prediction unit 106 uses a rate-distortion optimized mode determination method to determine an intra-frame prediction mode, where the current block is divided into one or more transform blocks. Let variables nTbW and nTbH be the width and height of the transform blocks, respectively. When MIP mode is used as the intra-frame prediction mode to obtain an intra-frame prediction value for the current block, the intra-frame prediction unit 106 determines the block size index value of the MIP, which is represented by a variable mipSizeId.
[0414] Optionally, the intra prediction unit 106 determines the value of mipSizeId as follows:
[0415] - If nTbW and nTbH are both equal to 4, mipSizeId is set equal to 0;
[0416] - Otherwise, if cbWidth or cbHeight is equal to 4, mipSizeId is set equal to 1;
[0417] Otherwise, mipSizeId is set equal to 2.
[0418] Specifically, when the size parameter of the current block is 8×8 (ie, both cbWidth and cbHeight are equal to 8), mipSizeId is set to be equal to 2.
[0419] Optionally, the intra prediction unit 106 determines the value of mipSizeId as follows:
[0420] - If nTbW and nTbH are both equal to 4, mipSizeId is set equal to 0;
[0421] Otherwise, if cbWidth or cbHeight is equal to 4, or if both cbWidth and cbHeight are equal to 8, mipSizeId is set equal to 1.
[0422] Otherwise, mipSizeId is set equal to 2.
[0423] Specifically, when the size parameter of the current block is 8×8, mipSizeId is set to be equal to 1.
[0424] Furthermore, the intra prediction unit 106 obtains the values of boundarySize and predSize according to mipSizeId, as follows:
[0425] -If mipSizeId is equal to 0, boundarySize is set equal to 2 and predSize is set equal to 4;
[0426] Otherwise, if mipSizeId is equal to 1, boundarySize is set equal to 4 and predSize is set equal to 4;
[0427] - Otherwise (if mipSizeId is equal to 2), boundarySize is set equal to 4 and predSize is set equal to 8;
[0428] Wherein, boundarySize represents the number of reference pixels obtained from each side of the adjacent reference pixels on the upper side and the adjacent reference pixels on the left side of the current block.
[0429] The intra-frame prediction unit 106 can also obtain the variable isTransposed to indicate the order of reference pixels stored in the buffer pTemp. For example, isTransposed is equal to 0, which means that the intra-frame prediction unit 106 first presents the reference pixels obtained from the reference pixels adjacent to the upper side of the current block, and then presents the reference pixels obtained from the reference pixels adjacent to the left side; otherwise, isTransposed is equal to 1, which means that the intra-frame prediction unit 106 first presents the reference pixels obtained from the reference pixels adjacent to the left side of the current block, and then presents the reference pixels obtained from the reference pixels adjacent to the upper side. Here, the value of isTransposed will be sent to the entropy coding unit 115 as one of the parameters of the MIP mode that needs to be encoded and written into the code stream.
[0430] The intra prediction unit 106 obtains the value of inSize to indicate the number of reference pixels used when using the MIP mode, as shown in the above equation (1).
[0431] The intra prediction unit 106 calls the following process to obtain a set of reference pixels (stored as an array p[x], where x is 0, . . . , inSize-1) using the reference pixels adjacent to the current block.
[0432] The intra-frame prediction unit 106 obtains nTbW reference pixels from the reference pixels adjacent to the upper side of the current block (for example, stored in the array refT), and obtains nTbH reference pixels from the reference pixels adjacent to the left side of the current block (for example, stored in the array refL). The intra-frame prediction unit 106 performs a downsampling process on refT to obtain a boundarySize reference pixels, and stores the boundarySize reference pixels in refT. The intra-frame prediction unit 106 performs a downsampling process on refL to obtain a boundarySize reference pixels, and stores the boundarySize reference pixels in refL.
[0433] The intra-frame prediction unit 106 can also obtain a variable isTransposed to indicate the order of reference pixels stored in the buffer pTemp. For example, isTransposed is equal to 0 (or FALSE) to indicate that the intra-frame prediction unit 106 first presents the reference pixels obtained from the upper adjacent reference pixels of the current block, and then presents the reference pixels obtained from the left adjacent reference pixels; otherwise, isTransposed is equal to 1 (or TRUE) to indicate that the intra-frame prediction unit 106 first presents the reference pixels obtained from the left adjacent reference pixels of the current block, and then presents the reference pixels obtained from the upper adjacent reference pixels. The intra-frame prediction unit 106 can use a rate-distortion optimization method or determine the value of isTransposed based on a correlation comparison between adjacent reference pixels and the current block. The value of isTransposed will be sent to the entropy coding unit 115 as one of the parameters of the MIP mode that needs to be encoded and written into the bitstream.
[0434] The intra prediction unit 106 places the elements in refT and refL into the buffer pTemp in the order indicated by isTransposed.
[0435] Optionally, the intra prediction unit 106 obtains p[x], where x=0, ..., inSize-1, as follows:
[0436] If mipSizeId is 2, then p[x] = pTemp[x+1] - pTemp[0];
[0437] Otherwise (mipSizeId is less than 2), p[0] = pTemp[0] - (1 << (BitDepth - 1)), p[x] = pTemp[x] - pTemp[0];
[0438] Wherein, BitDepth is the bit depth of the color component of the pixel in the current block. Here, the color component can be one of the RGB components, or one of the YUV components, or one of the YCbCr components, for example, the Y component.
[0439] Alternatively, the intra prediction unit 106 may obtain p[x], where x=0, ..., inSize-1, as follows:
[0440] If mipSizeId is 2, then p[x] = pTemp[x+1] - pTemp[0];
[0441] -Otherwise (mipSizeId is less than 2), p[0] = (1 << (BitDepth - 1)) - pTemp[0], p[x] = pTemp[x] - pTemp[0].
[0442] Alternatively, the intra prediction unit 106 may use a unified calculation method to obtain the value of p[x] without determining the value of mipSizeId. For example, (1<<(BitDepth-1)) is appended to the buffer pTemp. In this case, the intra prediction unit 106 calculates p[x] as pTemp[x+1]-pTemp[0].
[0443] In step 602, the intra prediction unit 106 obtains a MIP prediction value for the current block using a set of reference pixels and a MIP weighting matrix. The MIP weighting matrix is selected from a set of predefined MIP weighting matrices based on a MIP mode index value (denoted as ModeId) corresponding to the MIP mode and a MIP block size index value (denoted as mipSizeId).
[0444] The intra-frame prediction unit 106 obtains the MIP prediction value (expressed as predMip[x][y]) of some predicted pixel points corresponding to one or more pixel points in the current block. Figure 6 In the example shown in step 602, the partially predicted pixels are the pixels in the current block marked with gray filled squares. The input to prediction module 601 is the reference pixel p[x] obtained in step 601. Prediction module 601 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.
[0445] In a possible implementation, the prediction module 601 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).
[0446] In equation (5) or (6), mWeight[i][j] is a MIP weight matrix; here, the matrix elements may be predetermined constant values; or, they may 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 bitstreams provided to the encoder 100 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; pTemp[0] represents the value corresponding to index 0 in the first temporary reference value; ">>" is a binary right shift operator as defined in VVC. When the MIP mode is finally determined to perform intra-frame prediction on the current block, the intra-frame prediction unit 106 may further send mWeight[i][j] to the entropy coding unit 115. The entropy coding unit 115 may write mWeight[i][j] into one or more data units in the bitstream.
[0447] The prediction module 601 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 601 obtains the values of sW and fO using a lookup table.
[0448] Optionally, the prediction module 601 may use the above Table 4 to determine sW according to the size parameters and MIP mode of the current block.
[0449] Optionally, the prediction module 601 may also use the above Table 5 to determine sW according to the size parameters of the current block.
[0450] Alternatively, the prediction module 601 may directly set sW to a constant value. For example, for blocks of various size parameters and different MIP modes, the prediction module 601 may set sW to 5; or, for blocks of various size parameters and different MIP modes, the prediction module 601 may set sW to 6; or, for blocks of various size parameters and different MIP modes, the prediction module 601 may set sW to 7.
[0451] Optionally, the prediction module 601 may use the above-mentioned Table 6 to determine fO according to the size parameters and MIP mode of the current block.
[0452] Optionally, the prediction module 601 may also use the above-mentioned Table 7 to determine fO according to the size parameters of the current block.
[0453] Optionally, the prediction module 601 may also directly set fO to a constant value (e.g., 0 to 100). For example, for blocks of various size parameters and different MIP modes, the prediction module 601 sets fO to 32; or, the prediction module 601 sets fO to 46; or, the prediction module 601 sets fO to 56; or, the prediction module 601 sets fO to 66.
[0454] The intra prediction unit 106 may perform a transposition operation on the MIP prediction value in predMip. When isTransposed is equal to 1 (or TRUE), the predSize×predSize array predMip[x][y] (where x=0, ..., predSize-1, y=0, ..., predSize-1) is converted to predTemp[y][x]=predMip[x][y], and then predMip=predTemp.
[0455] Exemplarily, optionally, when the size parameter of the current block is 8×8 (ie, both cbWidth and cbHeight are equal to 8), the intra prediction unit 106 determines that mipSizeId is equal to 2 and obtains 8×8 predMip.
[0456] Optionally, when the size parameter of the current block is 8×8 (ie, both cbWidth and cbHeight are equal to 8), the intra prediction unit 106 determines that mipSizeId is equal to 1 and obtains 4×4 predMip.
[0457] In step 603, the intra prediction unit 106 obtains the intra prediction value of the current block (stored in an array as predSamples[x][y], where x=0, ..., nTbW-1, y=0, ..., nTbH-1), as follows:
[0458] - If the intra prediction unit 106 determines that nTbW is greater than predSize or nTbH is greater than predSize, the intra prediction unit 106 calls the upsampling process to obtain predSamples using predMip. The intra prediction unit 106 obtains the predicted pixel points corresponding to the remaining pixel points in the current block except for some pixel points. Figure 6 In step 60, the intra prediction unit 106 may use the filtering module 602 to obtain predicted pixels corresponding to the remaining pixels in the current block except for some pixels. The input of the filtering module 602 is the pixel points marked as gray-filled squares in step 602. The filtering module 602 may use one or more interpolation filters to use the input to obtain predicted pixels corresponding to the remaining pixels in the current block except for some pixels. For example, the input may include the reference pixel point and the predicted pixels at one or more pixel positions in the current block; or the input may include the neighboring pixel points and the predicted pixels at one or more pixel positions in the current block; or the input may include the reference pixel point, the neighboring pixel points, and the predicted pixels at one or more pixel positions in the current block. For example, optionally, when the size of the current block is 8×8 (i.e., both cbWidth and cbHeight are equal to 8), the intra prediction unit 106 determines that mipSizeId is equal to 1, and the intra prediction unit 106 applies the upsampling process to 4×4predMip to obtain an 8×8 intra prediction block for the current block.
[0459] Otherwise, the intra prediction unit 106 sets the intra prediction block of the current block to be equal to the MIP prediction block of the current block, that is, sets predSamples[x][y] (where x=0, ..., nTbW-1, y=0, ..., nTbH-1) to be equal to predMip[x][y]. For example, specifically, when the size parameter of the current block is 8×8 (that is, cbWidth and cbHeight are both equal to 8), the intra prediction unit 106 determines that mipSizeId is equal to 2, and the intra prediction unit 106 obtains predSamples of the current block, whose size is equal to 8×8 (that is, cbWidth and cbHeight are both equal to 8).
[0460] So, according to Figure 6 As shown in the flowchart, after step 603 , the intra prediction unit 106 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.
[0461] The prediction unit 102 outputs an intra-frame prediction block for the current block. The first adder 107 calculates the difference between the current block and the intra-frame prediction block of the current block in the output of the segmentation unit 101, i.e., the residual block (i.e., residual CU). The transform unit 108 reads the residual block and performs one or more transform operations on the residual block to obtain coefficients. The quantization unit 109 quantizes the coefficients and outputs the quantized coefficients (i.e., levels).
[0462] Transform unit 108 performs a first transform on the residual block, for example, an integer transform originally designed based on DCT. Transform unit 108 determines whether to allow a second transform to be applied to the block. If application is allowed, transform unit 108 further determines whether to apply the second transform to the coefficients obtained after performing the first transform. LFNST is an example of a second transform.
[0463] See also Figure 7 , which shows a schematic diagram of a process framework for executing LFNST provided by an embodiment of the present application. Figure 7 , block 701 represents a residual block.
[0464] In step 701 , the transform unit 108 performs a first transform (ie, core transform) on the block 701 , for example, an integer transform initially designed based on DCT, to obtain a block 702 containing transform coefficients corresponding to the first transform (referred to as “first transform coefficients”).
[0465] In step 702 , the transform unit 108 determines whether it is allowed to perform a secondary transform, such as LFNST, on all or part of the first transform coefficients in the block 702 .
[0466] Exemplarily, optionally, if the intra prediction mode of the transform block including LFNST is MIP mode and the minimum value of the width and height of the transform block is greater than or equal to 8, the transform unit 108 is allowed to perform LFNST on the transform block.
[0467] Optionally, if the intra prediction mode of the transform block including LFNST is MIP mode and the value of mipSizeId is equal to a preset value (e.g., 2) or one of multiple preset values (e.g., 1, 2), the transform unit 108 is allowed to perform LFNST on the transform block.
[0468] When the transform unit 108 is allowed to perform LFNST on the transform block, the transform unit 108 determines an LFNST parameter, such as lfnst_index. When lfnst_index is equal to 0, it indicates that the transform unit 108 does not perform LFNST on the transform block. When lfnst_index is greater than 0, it indicates that LFNST is performed on the transform block using a transform kernel from the LFNST transform kernel candidate set.
[0469] The transform unit 108 may use a conventional rate-distortion optimization method to determine the value of lfnst_index. First, the transform unit 108 obtains a first cost result without performing LFNST on the transform block.
[0470] The transform unit 108 selects a candidate set of LFNST transform kernels according to the MIP parameters. The MIP parameters may include at least one of: a MIP mode index value (ie, modeId) and a MIP transposition indication parameter (ie, isTransposed).
[0471] The transform unit 108 sets the value of the variable predModeIntra to the value of modeId. The transform unit 108 selects a portion of the first transform coefficients in block 702, for example, the coefficients in sub-blocks 7001, 7002, and 7003, and determines a transform kernel for performing LFNST on the coefficients in the sub-block. The size of the sub-block can be a preset value, for example, 8×8. The transform unit 108 determines the index value of the LFNST transform kernel candidate set (i.e., lfnstTrSetIdx) based on the value of predModeIntra. For block coding in MIP mode, the transform unit 108 can use a lookup table as shown in Table 10 to obtain the value of lfnstTrSetIdx.
[0472] The transform unit 108 may use a conventional rate-distortion optimization method to determine the value of lfnst_index (i.e., a value greater than 0 indicates that the transform kernel used in the LFNST transform kernel candidate set is indicated by lfnstTrSetIdx). The transform unit 108 sets the value of lfnst_index to the index number of the transform kernel in the LFNST transform kernel candidate set, thereby minimizing the cost function and obtaining a second cost result.
[0473] If the first cost result is greater than the second cost result, the transform unit 108 determines to perform LFNST on the transform block and transmits lfnst_index indicating the index number of the transform kernel to the entropy encoding unit 115. Otherwise, if the transform unit 108 determines not to perform LFNST on the transform block, lfnst_value is set to 0 and lfnst_index indicating that LFNST is not performed is transmitted to the entropy encoding unit 115.
[0474] When lfnst_index is not equal to 0, transform unit 108 performs LFNST on the transform block using coefficients from subblocks 7001, 7002, and 7003, obtains LFNST coefficients, and places the LFNST coefficients into subblocks 7011, 7012, and 7013 of block 703. Assume that d[x][y] is a block of first transform coefficients, where x = 0, ..., nTbW-1, y = 0, ..., nTbH-1, where nTbW and nTbH are the width and height of block 703, respectively. Assume that v[x] is a block of LFNST coefficients, where x = 0, ..., nLfnstOutSize-1, and nLfnstOutSize = (nTbW>=8 && nTbH>=8)?48:16.
[0475] Optionally, the transform unit 108 obtains the block 703 of transform coefficients using the following instructions and transmits the block 703 of LFNST coefficients in d[x][y] to the quantization unit 109, as shown in the above equation (8). Wherein, log2LfnstSize is shown in the above equation (9).
[0476] Optionally, when isTransposed is equal to 0, the transform unit 108 obtains the block 703 of LFNST coefficients using the following instructions and transmits the block 703 of LFNST coefficients in d[x][y] to the quantization unit 109, as shown in the above equation (10);
[0477] When isTransposed is equal to 1, the transform unit 108 obtains the block 703 of LFNST coefficients using the following instructions and transmits the block 703 of LFNST coefficients in d[x][y] to the quantization unit 109, as shown in the above formula (11).
[0478] Optionally, when isTransposed is equal to 1, the transform unit 108 obtains the block 703 of LFNST coefficients using the following instructions and transmits the block 703 of LFNST coefficients in d[x][y] to the quantization unit 109, as shown in the above equation (10);
[0479] When isTransposed is equal to 0, the transform unit 108 obtains the block 703 of LFNST coefficients using the following instructions and transmits the block 703 of LFNST coefficients in d[x][y] to the quantization unit 109, as shown in the above formula (11).
[0480] The determination of log2LfnstSize is shown in the above formula (9).
[0481] In addition, the transform unit 108 may also determine the value of lfnst_index for a transform block encoded in a conventional intra prediction mode (i.e., angular intra prediction mode, DC mode, and PLANAR mode, etc.). Similar to the rate-distortion optimization method for determining the value of lfnst_index for a transform block in MIP mode, the first cost result is determined without performing LFNST on the transform block.
[0482] The transform unit 108 uses a lookup table to determine the value of lfnstTrSetIdx according to the mode index value of the traditional intra prediction mode (assigned to predModeIntra), that is, to determine the LFNST transform kernel candidate set selected for the current block, as shown in Table 11 above.
[0483] Then, the transform unit 108 may use a conventional rate-distortion optimization method to determine the value of lfnst_index (i.e., a value greater than 0 indicates that the transform kernel used in the LFNST transform kernel candidate set is indicated by lfnstTrSetIdx). The transform unit 108 sets the value of lfnst_index to the index number of the transform kernel in the LFNST transform kernel candidate set, thereby minimizing the cost function and obtaining a second cost result.
[0484] If the first cost result is greater than the second cost result, the transform unit 108 determines to perform LFNST on the transform block and transmits lfnst_index indicating the index number of the transform kernel to the entropy encoding unit 115. Otherwise, if the transform unit 108 determines not to perform LFNST on the transform block, lfnst_value is set to 0 and lfnst_index indicating that LFNST is not performed is transmitted to the entropy encoding unit 115.
[0485] When lfnst_index is not equal to 0, transform unit 108 performs LFNST on the transform block using coefficients from subblocks 7001, 7002, and 7003, obtains LFNST coefficients, and places the LFNST coefficients into subblocks 7011, 7012, and 7013 of block 703. Assume that d[x][y] is a block of first transform coefficients, where x = 0, ..., nTbW-1, y = 0, ..., nTbH-1, where nTbW and nTbH are the width and height of block 703, respectively. Assume that v[x] is a block of LFNST coefficients, where x = 0, ..., nLfnstOutSize-1, and nLfnstOutSize = (nTbW>=8 && nTbH>=8)?48:16.
[0486] Optionally, when predModeIntra is less than or equal to 34, the transform unit 108 obtains the block 703 of LFNST coefficients using the following instructions and transmits the block 703 of LFNST coefficients in d[x][y] to the quantization unit 109, as shown in the above equation (10);
[0487] When predModeIntra is greater than 34, the transform unit 108 obtains the block 703 of LFNST coefficients using the following instructions and transmits the block 703 of LFNST coefficients in d[x][y] to the quantization unit 109, as shown in the above formula (11).
[0488] Optionally, when predModeIntra is greater than 34, the transform unit 108 obtains the block 703 of LFNST coefficients using the following instructions and transmits the block 703 of LFNST coefficients in d[x][y] to the quantization unit 109, as shown in the above equation (10);
[0489] When predModeIntra is less than or equal to 34, the transform unit 108 obtains the block 703 of LFNST coefficients using the following instructions and transmits the block 703 of LFNST coefficients in d[x][y] to the quantization unit 109, as shown in the above formula (11).
[0490] The determination of log2LfnstSize is shown in the above formula (9).
[0491] Furthermore, the inverse quantization unit 110 performs a scaling operation on the quantized coefficients to output reconstructed coefficients. The inverse transform unit 111 performs one or more inverse transforms corresponding to the transforms in the transform unit 108 and outputs a reconstructed residual. The second adder 112 calculates a reconstructed CU by adding the reconstructed residual to the intra-frame prediction block of the current block from the prediction unit 102. The second adder 112 also sends its output to the prediction unit 102 for use as an intra-frame prediction reference.
[0492] The output of the filtering unit 113 is a decoded picture or sub-picture, which is sent to the DPB unit 114. The DPB unit 114 outputs the decoded picture according to the timing and control information. The picture stored in the DPB unit 114 can also be used as a reference for the prediction unit 102 to perform inter-frame prediction or intra-frame prediction.
[0493] The entropy coding unit 115 converts the parameters of the units in the encoder 100 (necessary to obtain the decoded picture) as well as the control parameters and supplementary information into binary representations, and writes such binary representations into the generated code stream (or "video bit stream") according to the grammatical structure of each data unit, as shown in Tables 9A and 9B.
[0494] Using the syntax structure in Table 9A, when the minimum value of the width and height of the transform block in the coding unit is greater than or equal to 8 (i.e., both the width and the height are greater than or equal to 8), the entropy coding unit 115 encodes the lfnst_index of the coding unit using the MIP mode. Another optional condition can be set as: the width and the height are greater than or equal to a first value (e.g., 8), and the sum of the width and the height is greater than or equal to a second value (e.g., 16).
[0495] Using the syntax structure in Table 9B, the entropy encoding unit 115 encodes the lfnst_index of the coding unit using MIP mode when the mipSizeId of the coding unit is equal to 2. Another optional condition can be set as: the mipSizeId of the coding unit is equal to one of multiple values (such as 1 and 2).
[0496] See also Figure 8 , which shows a schematic diagram of a process for encoding LFNST parameters provided by an embodiment of the present application. Figure 8 As shown, the process may include:
[0497] S801: The entropy encoding unit 115 checks the above conditions to determine whether to encode the LFNST parameters.
[0498] S802: The entropy coding unit 115 encodes the LFNST parameters using context-based adaptive binary arithmetic coding.
[0499] It should be noted that in step S801, the entropy coding unit 115 checks and determines the LFNST parameters, such as the value of lfnst_index; then in step S802, the value of lfnst_index can be encoded using CABAC with the descriptor "ae(v)" as shown in Tables 9A and 9B.
[0500] In the embodiment of the present application, the encoder 100 may be a computing device having a processor and a storage medium recording an encoding program. When the processor reads and runs the encoding program, the encoder 100 reads the input video and generates a corresponding bitstream. In addition, the encoder 100 may also be a computing device having one or more chips. The units implemented as integrated circuits on the chip are connected to the processor. Figure 1 The corresponding units in the same embodiment have similar connections and data exchange and have similar functions.
[0501] This embodiment provides an encoding method, which determines prediction parameters of a current block, wherein the prediction parameters include prediction mode parameters; when the prediction mode parameters indicate that a matrix-based intra-frame prediction MIP mode is used to determine an intra-frame prediction value for the chroma component of the current block, obtains adjacent sampling values of the current block and determines the MIP input sampling value of the current block based on the adjacent sampling values of the current block; determines the MIP prediction value of the chroma component of the current block based on the MIP input sampling value, a MIP weighting matrix and a shift parameter; filters the MIP prediction value to determine the intra-frame prediction value of the chroma component of the current block; determines the prediction residual value of the chroma component of the current block based on the intra-frame prediction value of the chroma component of the current block; performs a low-frequency non-separable secondary transform (LFNST) on the prediction residual value to determine LFNST parameters; and encodes the LFNST parameters and writes them into a bitstream. In this way, for the MIP mode, the complexity can be reduced while ensuring coding performance, while reducing the storage space required during the coding process, effectively improving coding efficiency. In addition, when LFNST technology is applied to MIP mode prediction, the introduction of MIP parameters makes the LFNST transformation more flexible, further improving coding efficiency.
[0502] In another embodiment of the present application, see Figure 9 , which shows a flowchart of a decoding method provided by an embodiment of the present application. Figure 9 As shown, the method may include:
[0503] S901: Parse the code stream to obtain prediction parameters and LFNST parameters of the current block, wherein the prediction parameters include prediction mode parameters.
[0504] 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.
[0505] It should also be noted that the prediction parameters may include prediction mode parameters, wherein 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 the traditional intra-frame prediction mode may include DC mode, PLANAR mode and angle intra-frame prediction mode, and the non-traditional intra-frame prediction mode may include MIP mode, CCLM mode, IBC mode and PLT mode. In other words, the encoder will select the optimal prediction mode to encode the current block. In this process, the prediction mode of the current block can be determined, thereby obtaining the corresponding prediction mode parameters, and then the prediction parameters including the prediction mode parameters are written into the bitstream, which is transmitted from the encoder to the decoder.
[0506] In this way, in the decoder, the 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.
[0507] S902: When the prediction mode parameter indicates that a matrix-based intra-frame prediction MIP mode is used to determine an intra-frame prediction value for the chrominance component of the current block, adjacent sampling values of the current block are obtained, and the MIP input sampling value of the current block is determined based on the adjacent sampling values of the current block.
[0508] It should be noted that, for the current block, the embodiment of the present application uses the MIP mode to perform intra-frame prediction on the chrominance components of the current block. In this process, it is first necessary to obtain the adjacent sample values of the current block; then, based on the adjacent sample values of the current block, the MIP input sample values of the current block are determined.
[0509] The adjacent sample values of the current block 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.
[0510] 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:
[0511] Determining a block size index value of the current block according to a size parameter of the current block;
[0512] Performing downsampling filtering on adjacent sample values of the current block to obtain a first temporary reference value;
[0513] When the block size index 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;
[0514] When the block size index value of the current block is outside 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.
[0515] Furthermore, when the block size index value of the current block is within a preset range, the method may further include:
[0516] Determine a second constant value according to the bit depth of the adjacent sampling values of the current block; set the value corresponding to the index number 0 in the MIP input sampling value to be equal to the difference between the value corresponding to the index number 0 in the first temporary reference value and the second constant value; set the value corresponding to the index number i in the MIP input sampling value to be equal to the difference between the value corresponding to the index number i in the first temporary reference value and the value corresponding to the index number equal to 0 in the first temporary reference value, where i is an integer greater than 0.
[0517] 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 filtered adjacent sample values can be cached in a buffer (denoted by pTemp). The value corresponding to index 0 in the first temporary reference value is referred to as pTemp[0], and the value corresponding to index i in the first temporary reference value is referred to as pTemp[i].
[0518] In this embodiment of the present application, in addition to the prediction mode parameters, the prediction parameters may also include the size parameters of the current block. The size parameters of the current block may include the width (expressed as nTbW) and height (expressed as nTbH) of the current block. Furthermore, based on the size parameters of the current block, the block size index value (i.e., mipSizeId) of the current block may be determined.
[0519] It should also be noted that whether the size parameter value of the current block is within the preset range can be determined based on whether the block size index value of the current block (represented by mipSizeId) is within the preset range. Specifically, when mipSizeId=0 or 1, it indicates that the block size index value of the current block is within the preset range, that is, the size parameter value of the current block is within the preset range; when mipSizeId=2, it indicates that the block size index value of the current block is outside the preset range, that is, the size parameter value of the current block is not within the preset range.
[0520] 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]).
[0521] 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:
[0522] 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.
[0523] 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:
[0524] 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.
[0525] That is, after obtaining the bit depth (expressed as 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.
[0526] 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]).
[0527] In one possible implementation, when mipSizeId = 0 or 1, p[0] may be obtained by subtracting pTemp[0] from 1<<(BitDepth-1); and when x is not equal to 0, p[x] may be obtained by subtracting pTemp[0] from pTemp[x]. This is specifically shown in equation (2).
[0528] In another possible implementation, when mipSizeId = 0 or 1, p[0] can be obtained by subtracting 1 << (BitDepth - 1) from pTemp[0]; and when x is not equal to 0, p[x] can be obtained by subtracting pTemp[0] from pTemp[x], as shown in the above formula (3).
[0529] In another possible implementation, when mipSizeId=2, p[x] is obtained by subtracting pTemp[0] from pTemp[x+1], as shown in the above formula (4).
[0530] In addition, embodiments of the present application can also use a unified calculation method to obtain the value of p[x] without having to determine the value of mipSizeId. In this case, embodiments of the present application can directly set p[x] to be equal to pTemp[x+1]-pTemp[0], where x=0, ..., inSize-1, by appending 1<<(BitDepth-1) as an additional element to the end of the buffer pTemp.
[0531] In this way, after the MIP input sample value of the current block is determined according to the adjacent sample values of the current block, the MIP prediction value of the current block can be further determined.
[0532] S903: Determine a MIP prediction value of the chrominance component of the current block according to the MIP input sample value, the MIP weighting matrix and the shift parameter.
[0533] The MIP prediction value is the prediction value of some sampling points in the chrominance component of the current block.
[0534] It should be noted that the shift parameter may include a shift offset parameter and a shift amount parameter. At this time, for S903, the determining of the MIP prediction value of the chrominance component of the current block based on the MIP input sample value, the MIP weighting matrix and the shift parameter may include:
[0535] Determining, according to a value of the 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;
[0536] Determining a first constant value according to a value of the shift quantity parameter, wherein the value of the shift quantity parameter is a fixed constant;
[0537] Setting the value of the first offset to the difference between the first constant value and the product;
[0538] Determining a MIP weighting matrix for the current block according to the prediction parameters;
[0539] A MIP prediction value of the chrominance component of the current block is determined according to the MIP weighting matrix, the MIP input sample value, the shift amount parameter and the first offset.
[0540] It should be noted that the shift offset parameter may also be referred to as a shift compensation parameter or 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 32, 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. This is not limited herein.
[0541] It should also be noted that the shift quantity parameter may also be referred to as a shift factor, number of shift bits, or weight shift value, and may be represented by sW, shift, or weight shift. In the embodiment of the present application, the shift quantity parameter is typically represented by sW. In the embodiment of the present application, the value of the shift quantity parameter may be set to a fixed constant, such as 5, 6, or 7. The value of the shift quantity parameter may also be set to be related to a shift quantity parameter table, and the value of the shift quantity parameter may be determined by looking up the table, which is not limited here.
[0542] In addition, the first offset can be expressed as oW, and the first offset is related to both the shift amount parameter and the shift offset parameter.
[0543] It should also be understood that the prediction parameters may include prediction mode parameters and size parameters of the current block. When the prediction mode parameters indicate that the chrominance component of the current block uses the MIP mode to determine the intra-frame prediction value, a weight matrix table can be pre-established at this time, and the weight matrix table is stored in a memory or storage unit. The memory or storage unit here can be integrated in the decoder, or can also 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 weight matrix (or MIP weight matrix, or simply MIP matrix) required for the current block can be determined by looking up the table, represented by mWeight[x][y].
[0544] 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 decoder 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:
[0545] 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:
[0546] When the chrominance component of the current block uses the MIP mode to determine the intra-frame prediction value, parsing the code stream to obtain the MIP mode index value of the current block;
[0547] 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;
[0548] The queried value is determined as the value of the shift quantity parameter.
[0549] 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.
[0550] 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.
[0551] In order to reduce memory usage and computational complexity, the embodiment of the present application simplifies the method for determining the shift factor.
[0552] 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.
[0553] In another possible implementation, regarding the value of the shift quantity parameter, the method may further include:
[0554] Determining a block size index value of the current block according to a size parameter of the current block;
[0555] The value of the shift quantity parameter is determined according to the block size index value of the current block.
[0556] 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:
[0557] 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;
[0558] 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;
[0559] 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.
[0560] 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.
[0561] 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:
[0562] When the block size index values are respectively equal to 0, 1, and 2, it is determined that the values of the shift quantity parameter corresponding to the block size index value of the current block are respectively equal to 5, 6, and 5.
[0563] 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:
[0564] 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.
[0565] 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:
[0566] 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.
[0567] 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.
[0568] 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:
[0569] 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.
[0570] 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:
[0571] 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.
[0572] 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.
[0573] 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:
[0574] 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;
[0575] The queried value is determined as the value of the shift quantity parameter.
[0576] 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.
[0577] 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.
[0578] 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, and the memory occupied by the shift factor table storage in the MIP mode can be reduced without increasing the computational complexity.
[0579] Furthermore, a shift offset parameter table may be pre-established in the decoder, and the shift offset parameter table may also be stored in a memory or storage unit. The memory or storage unit may be integrated into the decoder or may be separately provided. In the embodiment of the present application, the determination of the shift offset parameter (fO) may include the following methods:
[0580] 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:
[0581] When the chrominance component of the current block uses the MIP mode to determine the intra-frame prediction value, parsing the code stream to determine the MIP mode index value of the current block;
[0582] 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;
[0583] The queried value is determined as the value of the shift offset parameter.
[0584] 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.
[0585] 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.
[0586] 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.
[0587] 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.
[0588] In another possible implementation, for determining the value of the shift offset parameter, the method may further include:
[0589] Determining a block size index value of the current block according to a size parameter of the current block;
[0590] The value of the shift offset parameter is determined according to the block size index value of the current block.
[0591] 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.
[0592] Optionally, in some embodiments, determining the value of the shift offset parameter according to the block size index value of the current block may include:
[0593] When the block size index values are respectively equal to 0, 1, and 2, it is determined that the values of the shift offset parameter corresponding to the block size index value of the current block are respectively equal to 34, 23, and 46.
[0594] Alternatively, in some embodiments, the shift offset parameter table may be minimized, and the offset factor may still be determined using a lookup table. Alternatively, in some embodiments, determining the value of the shift offset parameter based on the block size index value of the current block may include:
[0595] 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;
[0596] The queried value is determined as the value of the shift offset parameter.
[0597] 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.
[0598] 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.
[0599] 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.
[0600] 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:
[0601] 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.
[0602] Optionally, in some embodiments, determining the first constant value according to the value of the shift quantity parameter may include:
[0603] 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.
[0604] 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.
[0605] 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
[0606] In this way, in the MIP mode, the MIP weighting matrix, the MIP input sample value, the shift amount parameter, and the first offset can be obtained to subsequently determine the MIP prediction value of the current block. Specifically, in some embodiments, determining the MIP prediction value of the current block based on the MIP weighting matrix, the MIP input sample value, the shift amount parameter, and the first offset may include:
[0607] Calculating a first weighted sum of the MIP weight matrix and the MIP input sample value;
[0608] Calculating a first sum of the first weighted sum and the first offset;
[0609] 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;
[0610] 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; wherein the first temporary reference value is obtained based on downsampling filtering processing of adjacent sample values of the current block.
[0611] That is, 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 / array form according to predSize×predSize. The calculation formula is shown in the above formula (5) or formula (6).
[0612] S904: Filter the MIP prediction value to determine an intra-frame prediction value of the chrominance component of the current block.
[0613] 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 parameter of the MIP prediction block is the same as the size parameter 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 parameter of the MIP prediction block is the same as the size parameter 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 prediction values of all pixel positions in the current block; when the size parameter of the MIP prediction block is different from the size parameter 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.
[0614] S905: When the LFNST parameter indicates to perform LFNST on the current block, determine a reconstructed transform coefficient block of the current block, and perform LFNST on at least part of the reconstructed transform coefficients in the reconstructed transform coefficient block to obtain a second transform coefficient block.
[0615] It should be noted that not all current blocks can be subjected to LFNST, which means that the LFNST parameters may not be present in the bitstream. In this case, it is necessary to check certain conditions (such as the minimum value of the current block size parameter, the block size index value of the current block, etc.) to determine whether the LFNST parameters exist in the bitstream. Therefore, in some embodiments, parsing the bitstream to obtain the LFNST parameters may include:
[0616] Determining whether a LFNST parameter exists in the bitstream;
[0617] When it is determined that the LFNST parameter exists in the code stream, the code stream is parsed to obtain the LFNST parameter.
[0618] That is, it is first necessary to determine whether the LFNST parameter exists in the bitstream. Only when the determination result is yes, that is, the LFNST parameter exists in the bitstream, the step of parsing the bitstream and obtaining the LFNST parameter can be performed.
[0619] Optionally, in some embodiments, determining whether the LFNST parameter exists in the code stream may include:
[0620] When the chrominance component of the current block uses the MIP mode to determine the intra-frame prediction value, determining the minimum value among the size parameters of the current block;
[0621] Determine whether an LFNST parameter exists in the code stream according to the minimum value.
[0622] Furthermore, determining whether the LFNST parameter exists in the code stream according to the minimum value may include:
[0623] If the minimum value is greater than or equal to a first preset threshold, it is determined that the LFNST parameter exists in the code stream.
[0624] Here, the first preset threshold value may be used to represent a preset threshold value for measuring whether to perform LFNST. In the embodiment of the present application, the first preset threshold value may be set to 8, but is not specifically limited thereto.
[0625] That is, when the MIP mode is used for intra-frame prediction of the chroma component of the current block, the minimum value of the size parameters of the current block can be determined at this time; for example, when the minimum value of the width and height is greater than or equal to 8, it is determined that the LFNST parameters exist in the code stream, and the LFNST parameters, such as the value of lfnst_index, can be obtained by parsing the code stream.
[0626] Optionally, in some embodiments, determining whether the LFNST parameter exists in the code stream may include:
[0627] When the chrominance component of the current block uses the MIP mode to determine the intra-frame prediction value, determining the block size index value of the current block according to the size parameter of the current block;
[0628] Determine whether an LFNST parameter exists in the code stream according to the block size index value.
[0629] Furthermore, determining whether an LFNST parameter exists in the code stream according to the block size index value may include:
[0630] If the block size index value is equal to a second preset threshold, it is determined that the LFNST parameter exists in the code stream.
[0631] Here, the second preset threshold value can also be used to represent a preset threshold value for measuring whether to perform LFNST. In the embodiment of the present application, the second preset threshold value can be set to a preset value (e.g., 2), or one of multiple preset values (e.g., 1, 2), but is not specifically limited.
[0632] That is to say, when the MIP mode is used for intra-frame prediction of the chroma component of the current block, the block size index value (mipSizeId) of the current block can be determined according to the size parameter of the current block; for example, when the value of mipSizeId is equal to 2, it is determined that the LFNST parameter exists in the code stream, and the LFNST parameter, such as the value of lfnst_index, can be obtained by parsing the code stream.
[0633] In some embodiments, parsing the code stream to obtain LFNST parameters may include:
[0634] Parse the code stream to obtain the value of the LFNST index number.
[0635] It should be noted that the LFNST index number can be represented by lfnst_index, and the value of the LFNST index number is used to determine whether to perform LFNST on the current block. Specifically, in some embodiments, the method may further include:
[0636] If the value of the LFNST index number is greater than zero, determining to perform LFNST on the current block;
[0637] If the value of the LFNST index sequence number is equal to zero, it is determined not to perform LFNST on the current block.
[0638] That is, after obtaining the value of lfnst_index, if the value of lfnst_index is greater than zero, it is determined that LFNST is performed on the current block; if the value of lfnst_index is equal to zero, it is determined that LFNST is not performed on the current block.
[0639] It should also be noted that after obtaining the LFNST parameter, such as the value of lfnst_index, if lfnst_index is greater than zero, it indicates that the LFNST parameter indicates that LFNST is performed on the current block. In this case, in some embodiments, when the LFNST parameter indicates that LFNST is performed on the current block, determining the reconstructed transform coefficient block of the current block may include:
[0640] Parsing the code stream to obtain the quantization coefficient of the current block;
[0641] Dequantize the quantized coefficients to obtain a reconstructed transform coefficient block of the current block.
[0642] Specifically, the inverse quantization process is a scaling process. In a specific example, the inverse quantization of the quantized coefficients to obtain the reconstructed transform coefficient block of the current block may include: performing a scaling operation on the quantized coefficients to obtain the reconstructed transform coefficient block of the current block.
[0643] In this way, when the LFNST parameter indicates that LFNST is to be performed on the current block, LFNST may be performed on all or part of the reconstructed transform coefficients in the reconstructed transform coefficient block to obtain a second transform coefficient block.
[0644] It should also be noted that when determining that LFNST can be performed on the current block, it is also necessary to determine the LFNST transform kernel (represented by kernel) used for the current block. In some embodiments, performing LFNST on at least a portion of the reconstructed transform coefficients in the reconstructed transform coefficient block to obtain the second transform coefficient block may include: performing LFNST on at least a portion of the reconstructed transform coefficients in the reconstructed transform coefficient block using the LFNST transform kernel to obtain the second transform coefficient block.
[0645] In the embodiment of the present application, there are four transform kernel candidate sets in LFNST, which may include set0, set1, set2, and set3. Here, the embodiment of the present application may use MIP parameters to determine the LFNST transform kernel candidate set, and then select the LFNST transform kernel used for the current block from the LFNST transform kernel candidate set. Therefore, in some embodiments, the method may further include:
[0646] When the chrominance component of the current block uses the MIP mode to determine the intra-frame prediction value, determining the MIP parameter from the prediction mode parameter of the current block;
[0647] Determine a LFNST transform kernel candidate set according to the MIP parameters;
[0648] In the LFNST transform core candidate set, the transform core indicated by the value of the LFNST index number is determined as the LFNST transform core used by the current block; wherein the LFNST transform core candidate set includes two or more preset LFNST transform cores.
[0649] It should be noted that the MIP parameters may include at least one of the following: a MIP mode index value (represented by modeId) and a MIP transposition indication parameter (represented by isTransposed). Specifically, for the LFNST transform kernel used by the current block, when the value of the MIP transposition indication parameter indicates that the sampling point input vector used by the MIP mode is transposed, it is also necessary to perform matrix transposition processing on the selected transform kernel to obtain the LFNST transform kernel used by the current block.
[0650] Furthermore, in some embodiments, determining the LFNST transform kernel candidate set according to the MIP parameters may include:
[0651] Determine the value of the LFNST intra prediction mode index number according to the MIP mode index value;
[0652] Determining the index value of the LFNST transform kernel candidate set through a fifth preset lookup table according to the value of the LFNST intra prediction mode index sequence number;
[0653] The LFNST transform kernel candidate set is selected from a plurality of candidate LFNST transform kernel candidate sets according to the index value of the LFNST transform kernel candidate set.
[0654] Here, the LFNST intra prediction mode index number can be represented by predModeIntra, and the index value of the LFNST transform kernel candidate set can be represented by lfnstTrSetIdx.
[0655] It should be noted that the fifth preset lookup table is shown in Table 10 above. According to the MIP mode index value (i.e., modeId), the value of predModeIntra can be determined; then, according to the value of predModeIntra, the value of lfnstTrSetIdx can be directly determined in combination with Table 10, that is, the LFNST transform kernel candidate set selected for the current block is determined. Here, the value of lfnstTrSetIdx indicates the transform kernel candidate set used during LFNST; since the value of modeId can include 0, 1, 2, 3, 4, and 5, the value of predModeIntra is also 0, 1, 2, 3, 4, and 5; its corresponding relationship with lfnstTrSetIdx is specifically shown in Table 10.
[0656] In a specific embodiment, determining the value of the LFNST intra prediction mode index number according to the MIP mode index value may include: setting the value of the LFNST intra prediction mode index number to be equal to the MIP mode index value.
[0657] That is, in an embodiment of the present application, the value of predModeIntra may be set equal to the value of modeId, and then, based on the value of predModeIntra, the value of lfnstTrSetIdx may be directly determined in combination with Table 10, thereby determining the LFNST transform kernel candidate set selected for the current block. It should also be noted that, in another specific embodiment, the embodiment of the present application may also directly map the MIP mode index value to the value of the PLANAR mode, and then use the value of predModeIntra corresponding to the PLANAR mode to determine the value of lfnstTrSetIdx, thereby determining the LFNST transform kernel candidate set selected for the current block.
[0658] Furthermore, during the LFNST process, the scanning order may include a horizontal scanning order and a vertical scanning order. Here, the determination of the scanning order is related to the value of the MIP transposition indication parameter (indicated by isTransposed).
[0659] Optionally, in some embodiments, performing LFNST on at least part of the reconstructed transform coefficients in the reconstructed transform coefficient block to obtain a second transform coefficient block may include:
[0660] When the value of the MIP transposition indication parameter indicates that a transposition process is to be performed on the sampling point input vector used in the MIP mode, performing LFNST on at least part of the reconstructed transform coefficients in the reconstructed transform coefficient block according to a vertical scanning order to obtain a second transform coefficient block;
[0661] When the value of the MIP transposition indication parameter indicates that the sampling point input vector used by the MIP mode is not to be transposed, LFNST is performed on at least part of the reconstructed transform coefficients in the reconstructed transform coefficient block according to a horizontal scanning order to obtain the second transform coefficient block.
[0662] Specifically, when the value of isTransposed is equal to 0, the sampling point input vector used in the MIP mode is transposed, and LFNST can be performed on at least part of the transform coefficients in the first transform coefficient block according to the horizontal scanning order, as shown in the above formula (10).
[0663] When the value of isTransposed is equal to 1, the sampling point input vector used by the MIP mode is not transposed. Then, LFNST can be performed on at least part of the transform coefficients in the first transform coefficient block according to the vertical scanning order, as shown in the above formula (11).
[0664] The determination of log2LfnstSize is shown in the above formula (9).
[0665] Optionally, in some embodiments, performing LFNST on at least part of the reconstructed transform coefficients in the reconstructed transform coefficient block to obtain a second transform coefficient block may include:
[0666] When the value of the MIP transposition indication parameter indicates that a transposition process is to be performed on the sampling point input vector used in the MIP mode, performing LFNST on at least part of the reconstructed transform coefficients in the reconstructed transform coefficient block according to a horizontal scanning order to obtain a second transform coefficient block;
[0667] When the value of the MIP transposition indication parameter indicates that the sampling point input vector used by the MIP mode is not to be transposed, LFNST is performed on at least part of the reconstructed transform coefficients in the reconstructed transform coefficient block according to a vertical scanning order to obtain the second transform coefficient block.
[0668] Specifically, when the value of isTransposed is equal to 1, the sampling point input vector used in the MIP mode is transposed, and LFNST can be performed on at least part of the transform coefficients in the first transform coefficient block according to the horizontal scanning order, as shown in the above formula (10).
[0669] When the value of isTransposed is equal to 0, the sampling point input vector used by the MIP mode is not transposed. Then, LFNST can be performed on at least part of the transform coefficients in the first transform coefficient block according to the vertical scanning order, as shown in the above formula (11).
[0670] The determination of log2LfnstSize is shown in the above formula (9).
[0671] S906: Perform a first transform on the second transform coefficient block to obtain a reconstructed residual block of the chrominance component of the current block.
[0672] S907: Determine a reconstructed block of the chrominance component of the current block according to the intra-frame prediction value of the chrominance component of the current block and the reconstructed residual block.
[0673] It should be noted that in the decoder, by parsing the bitstream, the quantized value of the LFNST coefficient can be obtained, and the quantized value is dequantized by the dequantization unit (which can be called "Scaling") to obtain a reconstructed transform coefficient block. At least part of the reconstructed transform coefficients in the reconstructed transform coefficient block are subjected to an inverse LFNST transform to obtain a second transform coefficient block; and then the inverse first transform is performed to obtain a reconstructed residual block that restores the chrominance component of the current block. Here, the inverse first transform is the inverse transform corresponding to the "first transform (Core Transform)" in the encoder. It should be noted that the standard only defines the "inverse transform" operation in the decoder, so the "inverse LFNST transform" in the standard can also be referred to as the "LFNST transform."
[0674] It should also be noted that after restoring the reconstructed residual block of the chrominance component of the current block, the intra-frame prediction value of the chrominance component of the current block and the reconstructed residual block can be added to determine the reconstructed block of the chrominance component of the current block.
[0675] The following will be combined Figure 2 The decoder 200 shown specifically illustrates the decoding method of the embodiment of the present application.
[0676] The input codestream of decoder 200 may be a codestream generated by encoder 100. Parsing unit 201 parses the input codestream and obtains syntax element values from the input codestream. Parsing unit 201 converts the binary representation of the syntax elements into digital values and sends the digital values to units in decoder 200 to obtain one or more decoded pictures. Parsing unit 201 can also parse one or more syntax elements from the input codestream to render the decoded pictures.
[0677] See also Figure 10 , which shows a schematic diagram of a process for parsing LFNST parameters provided by an embodiment of the present application. Figure 10 As shown, the process may include:
[0678] S1001: The parsing unit 201 checks to determine whether there is an LFNST parameter in the input code stream.
[0679] It should be noted that the LFNST parameter may refer to the value of lfnst_index. Here, the example of the syntax structure for representing the LFNST parameter may be the same as the example of the syntax structure shown in Table 8 above, or the same as the example of the syntax structure shown in Table 9A and Table 9B above.
[0680] Specifically, when the intra prediction mode of the current block is MIP mode, the parsing unit 201 obtains the coded bits of lfnst_index from the input code stream in the following manner. Optionally, using the syntax structure in Table 9A, when the minimum value of the width and height of the transform block in the current block is greater than or equal to 8 (i.e., both the width and height are greater than or equal to 8), the parsing unit 201 reads the lfnst_index bits using MIP mode. Another optional condition can be set as: the width and height are greater than or equal to a first value (e.g., 8), and the sum of the width and height is greater than or equal to a second value (e.g., 16).
[0681] Optionally, using the syntax structure in Table 9B, the parsing unit 201 uses MIP mode to read the lfnst_index bit when the mipSizeId of the current block is 2. Another optional condition may be set as: the mipSizeId of the current block is equal to one of multiple values (eg, 1 and 2).
[0682] S1002: The parsing unit 201 performs adaptive binary arithmetic decoding on the LFNST parameters to obtain the LFNST parameters.
[0683] Here, since the entropy coding unit 115 on the encoder 100 side uses CABAC with a descriptor of "ae(v)" as shown in Tables 9A and 9B to encode the LFNST parameters (for example, the value of lfnst_index), then on the decoder 200 side, adaptive binary arithmetic decoding is performed by the parsing unit 201, and the value of lfnst_index can be obtained from the lfnst_index bit.
[0684] Parsing unit 201 transmits the values of syntax elements and one or more variables set or determined based on the values of the syntax elements, used to obtain one or more decoded pictures, to units in decoder 200. Prediction unit 202 determines an intra-prediction block for a current block (e.g., a CU). When an inter-decoding mode is indicated for decoding the current decoding block, prediction unit 202 transmits relative parameters from parsing unit 201 to MC unit 203 to obtain an inter-prediction block. When an intra-prediction mode (including a MIP mode indicated based on a MIP mode index value) is indicated for decoding the current block, prediction unit 202 transmits relative parameters from parsing unit 201 to intra-prediction unit 204 to obtain an intra-prediction block.
[0685] It should be understood that the current block (or referred to as a "decoded block") in the embodiment of the present application may be a CU or a partition of a CU (e.g., a transform block). Specifically, when the MIP mode is indicated for decoding the current block, the intra-prediction unit 204 obtains an intra-prediction block of the current block, where the intra-prediction block of the current block includes an intra-prediction value of at least one pixel (samples) within the current block.
[0686] Specifically, the intra prediction unit 204 uses the MIP mode to obtain the intra prediction block, and the steps are as follows:
[0687] First, the intra-frame prediction unit 204 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.
[0688] The intra-frame prediction unit 204 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, and the shift parameters may be used for an offset operation during the process of obtaining the intra-frame prediction values for the partial pixels.
[0689] Finally, if the predicted pixels corresponding to some of the pixels in the current block are obtained, the intra-frame prediction unit 204 also needs to obtain the predicted pixels corresponding to the remaining pixels in the current block excluding the partial pixels. For example, the intra-frame prediction unit 204 can use an interpolation filter to obtain the predicted pixels corresponding to the remaining pixels, where the input of the interpolation filter can be the partial pixels and the adjacent pixels.
[0690] like Figure 6 As shown, the flowchart example of using the MIP mode to obtain the intra-frame prediction block can also be implemented on the decoder 200, wherein the "current block" here refers to the "decoded block".
[0691] Step 601: The intra-frame prediction unit 204 obtains the adjacent pixels of the current block. For example, the adjacent pixels are marked as Figure 6 The gray filled squares adjacent to the current block in step 601 are shown. The intra prediction unit 204 obtains one or more reference pixels from the adjacent pixels. Figure 6 In the example of step 601, the intra-frame prediction unit 204 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 204 may select an adjacent pixel as a reference pixel for every other adjacent pixel. Figure 6 In the example shown in step 601 , the intra prediction unit 204 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.
[0692] The specific process of step 601 is as follows:
[0693] Intra-prediction unit 204 obtains the width and height of the current block from parsing unit 201, denoted by variables cbWidth and cbHeight, respectively. Based on the parameters from parsing unit 201, the current block is divided into one or more transform blocks. Let variables nTbW and nTbH be the width and height of the transform blocks, respectively. When a MIP mode is used as the intra-prediction mode to obtain a prediction for the current block, intra-prediction unit 204 determines the block size index value of the MIP, denoted by a variable mipSizeId.
[0694] Optionally, the intra prediction unit 204 determines the value of mipSizeId as follows:
[0695] - If nTbW and nTbH are both equal to 4, mipSizeId is set equal to 0;
[0696] - Otherwise, if cbWidth or cbHeight is equal to 4, mipSizeId is set equal to 1;
[0697] Otherwise, mipSizeId is set equal to 2.
[0698] Specifically, when the size parameter of the current block is 8×8 (ie, both cbWidth and cbHeight are equal to 8), mipSizeId is set to be equal to 2.
[0699] Optionally, the intra prediction unit 204 determines the value of mipSizeId as follows:
[0700] - If nTbW and nTbH are both equal to 4, mipSizeId is set equal to 0;
[0701] Otherwise, if cbWidth or cbHeight is equal to 4, or if both cbWidth and cbHeight are equal to 8, mipSizeId is set equal to 1.
[0702] Otherwise, mipSizeId is set equal to 2.
[0703] Specifically, when the size parameter of the current block is 8×8, mipSizeId is set to be equal to 1.
[0704] Furthermore, the intra prediction unit 204 obtains the values of boundarySize and predSize according to mipSizeId, as follows:
[0705] -If mipSizeId is equal to 0, boundarySize is set equal to 2 and predSize is set equal to 4;
[0706] Otherwise, if mipSizeId is equal to 1, boundarySize is set equal to 4 and predSize is set equal to 4;
[0707] - Otherwise (if mipSizeId is equal to 2), boundarySize is set equal to 4 and predSize is set equal to 8;
[0708] Wherein, boundarySize represents the number of reference pixels obtained from each side of the adjacent reference pixels on the upper side and the adjacent reference pixels on the left side of the current block.
[0709] The intra prediction unit 204 may also use a parameter indicating the order of reference pixels stored in the buffer pTemp from the parsing unit 201 to obtain reference pixels for calculating the MIP prediction value. The intra prediction unit 204 sets the variable isTransposed to be equal to the parameter indicating the order of reference pixels stored in the buffer pTemp from the parsing unit 201. For example, if isTransposed is equal to 0 (or FALSE), it means that the intra prediction unit 204 first presents the reference pixels obtained from the upper adjacent reference pixels of the current block, and then presents the reference pixels obtained from the left adjacent reference pixels; otherwise, if isTransposed is equal to 1 (or TRUE), it means that the intra prediction unit 204 first presents the reference pixels obtained from the left adjacent reference pixels of the current block, and then presents the reference pixels obtained from the upper adjacent reference pixels.
[0710] The intra prediction unit 204 obtains the value of the variable inSize to indicate the number of reference pixels used when using the MIP mode, as shown in the above equation (1).
[0711] The intra prediction unit 204 calls the following process to obtain a set of reference pixels (stored as an array p[x], where x is 0, . . . , inSize-1) using the reference pixels adjacent to the current block.
[0712] The intra-frame prediction unit 204 obtains nTbW reference pixels from the reference pixels adjacent to the upper side of the current block (for example, stored in the array refT), and obtains nTbH reference pixels from the reference pixels adjacent to the left side of the current block (for example, stored in the array refL). The intra-frame prediction unit 204 performs a downsampling process on refT to obtain a boundarySize reference pixels, and stores the boundarySize reference pixels in refT. The intra-frame prediction unit 204 performs a downsampling process on refL to obtain a boundarySize reference pixels, and stores the boundarySize reference pixels in refL.
[0713] The intra prediction unit 204 may also obtain the order indicated by isTransposed to place the elements in refT and refL into the buffer pTemp.
[0714] Optionally, the intra prediction unit 204 obtains p[x], where x=0, ..., inSize-1, as follows:
[0715] If mipSizeId is 2, then p[x] = pTemp[x+1] - pTemp[0];
[0716] Otherwise (mipSizeId is less than 2), p[0] = pTemp[0] - (1 << (BitDepth - 1)), p[x] = pTemp[x] - pTemp[0];
[0717] Wherein, BitDepth is the bit depth of the color component of the pixel in the current block. Here, the color component can be one of the RGB components, or one of the YUV components, or one of the YCbCr components, for example, the Y component.
[0718] Alternatively, the intra prediction unit 204 may obtain p[x], where x=0, ..., inSize-1, as follows:
[0719] If mipSizeId is 2, then p[x] = pTemp[x+1] - pTemp[0];
[0720] -Otherwise (mipSizeId is less than 2), p[0] = (1 << (BitDepth - 1)) - pTemp[0], p[x] = pTemp[x] - pTemp[0].
[0721] Alternatively, the intra-frame prediction unit 204 may use a unified calculation method to obtain the value of p[x] without determining the value of mipSizeId. For example, (1<<(BitDepth-1)) is appended to the buffer pTemp. In this case, the intra-frame prediction unit 204 calculates p[x] as pTemp[x+1]-pTemp[0].
[0722] In step 602, the intra-frame prediction unit 204 uses a set of reference pixels and a MIP weighting matrix to obtain a MIP prediction value for the current block. The MIP weighting matrix is selected from a set of predefined MIP weighting matrices based on the MIP mode index value (denoted as ModeId) corresponding to the MIP mode and the MIP block size index value (denoted as mipSizeId). The intra-frame prediction unit 204 obtains the value of ModeId from the parsing unit 201.
[0723] The intra-frame prediction unit 204 obtains the MIP prediction value (expressed as predMip[x][y]) of some predicted pixel points corresponding to one or more pixel points in the current block. Figure 6 In the example shown in step 602, the partially predicted pixels are the pixels in the current block marked with gray filled squares. The input to prediction module 601 is the reference pixel p[x] obtained in step 601. Prediction module 601 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.
[0724] In a possible implementation, the prediction module 601 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).
[0725] 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 a training method, the input of which is one or more coded pictures or blocks, or pictures in other code streams provided to the decoder 200 by an external device, or pictures obtained by parsing a special data unit in the input code stream containing the MIP weighting matrix from the parsing unit 201; mWeight[i][j] can be determined according to the MIP mode indicated by the corresponding one or more parameters from the parsing unit 201; fO is a shift offset parameter for determining oW; sW is a shift quantity parameter; p[i] is calculated using a reference pixel, that is, the MIP input sample value in the embodiment of the present application; pTemp[0] represents the first pixel in the reference pixel, that is, 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.
[0726] The prediction module 601 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 601 obtains the values of sW and fO using a lookup table.
[0727] Optionally, the prediction module 601 may use the above Table 4 to determine sW according to the size parameters and MIP mode of the current block.
[0728] Optionally, the prediction module 601 may also use the above Table 5 to determine sW according to the size parameters of the current block.
[0729] Alternatively, the prediction module 601 may directly set sW to a constant value. For example, for blocks of various size parameters and different MIP modes, the prediction module 601 may set sW to 5; or, for blocks of various size parameters and different MIP modes, the prediction module 601 may set sW to 6; or, for blocks of various size parameters and different MIP modes, the prediction module 601 may set sW to 7.
[0730] Optionally, the prediction module 601 may use the above-mentioned Table 6 to determine fO according to the size parameters and MIP mode of the current block.
[0731] Optionally, the prediction module 601 may also use the above-mentioned Table 7 to determine fO according to the size parameters of the current block.
[0732] Optionally, the prediction module 601 may also directly set fO to a constant value (e.g., 0 to 100). For example, for blocks of various size parameters and different MIP modes, the prediction module 601 sets fO to 32; or, the prediction module 601 sets fO to 46; or, the prediction module 601 sets fO to 56; or, the prediction module 601 sets fO to 66.
[0733] The intra prediction unit 204 may perform a transposition operation on the MIP prediction value in predMip. When isTransposed is equal to 1 (or TRUE), the predSize×predSize array predMip[x][y] (where x=0, ..., predSize-1, y=0, ..., predSize-1) is converted to predTemp[y][x]=predMip[x][y], and then predMip=predTemp.
[0734] Exemplarily, optionally, when the size parameter of the current block is 8×8 (ie, both cbWidth and cbHeight are equal to 8), the intra prediction unit 204 determines that mipSizeId is equal to 2 and obtains 8×8 predMip.
[0735] Optionally, when the size parameter of the current block is 8×8 (ie, both cbWidth and cbHeight are equal to 8), the intra prediction unit 204 determines that mipSizeId is equal to 1 and obtains 4×4 predMip.
[0736] In step 603, the intra prediction unit 204 obtains the intra prediction value of the current block (stored in an array as predSamples[x][y], where x=0, ..., nTbW-1, y=0, ..., nTbH-1), as follows:
[0737] - If the intra prediction unit 204 determines that nTbW is greater than predSize or nTbH is greater than predSize, the intra prediction unit 204 calls the upsampling process to obtain predSamples using predMip. The intra prediction unit 204 obtains the predicted pixel points corresponding to the remaining pixel points in the current block except for some pixel points. Figure 6In step 60, the intra prediction unit 204 may use the filtering module 602 to obtain predicted pixels corresponding to the remaining pixels in the current block except for some pixels. The input of the filtering module 602 is the pixel points marked as gray-filled squares in step 602. The filtering module 602 may use one or more interpolation filters to use the input to obtain predicted pixels corresponding to the remaining pixels in the current block except for some pixels. For example, the input may include the reference pixel point and the predicted pixels at one or more pixel positions in the current block; or the input may include the neighboring pixel points and the predicted pixels at one or more pixel positions in the current block; or the input may include the reference pixel point, the neighboring pixel points, and the predicted pixels at one or more pixel positions in the current block. For example, optionally, when the size of the current block is 8×8 (i.e., cbWidth and cbHeight are both equal to 8), the intra prediction unit 204 determines that mipSizeId is equal to 1, and the intra prediction unit 204 applies the upsampling process to 4×4predMip to obtain an 8×8 intra prediction block for the current block.
[0738] Otherwise, the intra prediction unit 204 sets the intra prediction block of the current block to be equal to the MIP prediction block of the current block, that is, sets predSamples[x][y] (where x=0, ..., nTbW-1, y=0, ..., nTbH-1) to be equal to predMip[x][y]. For example, when the size parameter of the current block is 8×8 (that is, cbWidth and cbHeight are both equal to 8), the intra prediction unit 204 obtains predSamples of the current block, whose size is equal to 8×8 (that is, cbWidth and cbHeight are both equal to 8).
[0739] So, according to Figure 6 As shown in the flowchart, after step 603 , the intra prediction unit 204 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.
[0740] The scaling unit 205 has the same function as that of the inverse quantization unit 110 in the encoder 100. The scaling unit 205 performs a scaling operation on the quantization coefficients (ie, levels) from the parsing unit 201 to obtain reconstructed coefficients.
[0741] The transform unit 206 has the same function as the inverse transform unit 111 in the encoder 100. The transform unit 206 performs one or more transform operations (ie, the inverse of the one or more transform operations performed by the inverse transform unit 111 in the encoder 100) to obtain a reconstructed residual.
[0742] When lfnst_index is not equal to 0, the transform unit 206 performs a secondary transform on the reconstructed coefficients to obtain a secondary transform coefficient block, and then performs a first transform on the secondary transform coefficient block, for example, an integer transform originally designed based on DCT, to obtain a reconstructed residual block. LFNST is an example of a secondary transform.
[0743] See also Figure 11 , which shows another process framework diagram of executing LFNST provided by an embodiment of the present application. Figure 11 , block 1101 is a reconstructed transform coefficient block containing reconstructed transform coefficients.
[0744] In step 1101 , the transform unit 206 performs a secondary transform (LFNST) on all or part of the reconstructed transform coefficients in block 1101 .
[0745] When the intra prediction mode of the current block is MIP mode, the transform unit 206 selects a LFNST transform kernel candidate set according to MIP parameters. The MIP parameters may include at least one of the following: a MIP mode index value (ie, modeId) and a MIP transposed indication parameter (ie, isTransposed).
[0746] The transform unit 206 sets the value of the variable predModeIntra to the value of modeId. The transform unit 206 determines the transform kernel for performing LFNST on the coefficients of sub-blocks 11001, 11002, and 11003. The sub-block size can be a preset value, such as 8×8. The transform unit 206 determines the index value of the LFNST transform kernel candidate set (i.e., lfnstTrSetIdx) based on the value of predModeIntra. For block decoding in MIP mode, the transform unit 206 uses a lookup table as shown in Table 10 to obtain the value of lfnstTrSetIdx. The transform unit 206 determines the transform kernel for performing LFNST as the transform kernel indicated by lfnst_index in the LFNST transform kernel candidate set indicated by lfnstTrSetIdx.
[0747] When lfnst_index is not equal to 0, transform unit 206 performs LFNST on the transform block using coefficients from subblocks 11001, 11002, and 11003, obtains LFNST coefficients, and places the LFNST coefficients into subblocks 11011, 11012, and 11013 of block 1102. Assume that d[x][y] is a block of first transform coefficients, where x = 0, ..., nTbW-1, y = 0, ..., nTbH-1, where nTbW and nTbH are the width and height of block 1102, respectively. Assume that v[x] is a block of LFNST coefficients, where x = 0, ..., nLfnstOutSize-1, and nLfnstOutSize = (nTbW>=8 && nTbH>=8)?48:16.
[0748] Optionally, the transform unit 206 obtains the block 1102 of transform coefficients using the following instructions, as specifically shown in the above equation (8): wherein log2LfnstSize is as shown in the above equation (9).
[0749] Optionally, when isTransposed is equal to 0, the transform unit 206 obtains the block 1102 of transform coefficients using the following instructions, as specifically shown in the above equation (10);
[0750] When isTransposed is equal to 1, the transform unit 206 uses the following instructions to obtain the block 1102 of transform coefficients, as shown in the above formula (11).
[0751] Optionally, when isTransposed is equal to 1, the transform unit 206 obtains the block 1102 of transform coefficients using the following instructions, as shown in the above formula (10);
[0752] When isTransposed is equal to 0, the transform unit 206 uses the following instructions to obtain the block 1102 of transform coefficients, as shown in the above formula (11).
[0753] The determination of log2LfnstSize is shown in the above formula (9).
[0754] In addition, when the intra prediction mode of the current block is a conventional intra prediction mode, namely, angular intra prediction mode, DC mode, and planar mode, the transform unit 206 uses the lookup table shown in Table 11 to determine the value of lfnstTrSetIdx according to the mode index value of the conventional intra prediction mode (assigned to predModeIntra), that is, to determine the LFNST transform kernel candidate set selected for the current block. The transform unit 206 determines the transform kernel for performing LFNST as the transform kernel indicated by lfnst_index in the LFNST transform kernel candidate set indicated by lfnstTrSetIdx.
[0755] When lfnst_index is not equal to 0, transform unit 206 performs LFNST on the transform block using coefficients from subblocks 11001, 11002, and 11003, obtains LFNST coefficients, and places the LFNST coefficients into subblocks 11011, 11012, and 11013 of block 1102. Assume that d[x][y] is a block of first transform coefficients, where x = 0, ..., nTbW-1, y = 0, ..., nTbH-1, where nTbW and nTbH are the width and height of block 1102, respectively. Assume that v[x] is a block of LFNST coefficients, where x = 0, ..., nLfnstOutSize-1, and nLfnstOutSize = (nTbW>=8 && nTbH>=8)?48:16.
[0756] Optionally, when predModeIntra is less than or equal to 34, the transform unit 206 obtains the block 1102 of transform coefficients using the following instructions, as specifically shown in the above formula (10);
[0757] When predModeIntra is greater than 34, the transform unit 206 uses the following instructions to obtain the block 1102 of transform coefficients, as specifically shown in the above formula (11).
[0758] Optionally, when predModeIntra is greater than 34, the transform unit 206 obtains the block 1102 of transform coefficients using the following instructions, as specifically shown in the above formula (10);
[0759] When predModeIntra is less than or equal to 34, the transform unit 206 obtains the transform coefficient block 1102 using the following instructions, as specifically shown in the above formula (11).
[0760] The determination of log2LfnstSize is shown in the above formula (9).
[0761] The transform unit 206 performs a first transform (ie, a core transform) on the transform coefficients in the block 1102 , for example, an integer transform initially designed based on DCT, to obtain a reconstructed residual block 1103 of the current block.
[0762] Furthermore, the adder 207 performs an addition operation on its input (the intra-frame prediction block from the prediction unit 202 and the reconstructed residual block from the transform unit 206) to obtain a reconstructed block of the current block. The reconstructed block is also sent to the prediction unit 202 to be used as a reference for other blocks encoded in the intra-frame prediction mode.
[0763] After all CUs in a picture or sub-picture are reconstructed, the filtering unit 208 performs loop filtering on the reconstructed picture or sub-picture. The filtering unit 208 includes one or more filters, such as a deblocking filter, a sample adaptive offset filter, an adaptive loop filter, a luma mapping and chroma scaling filter, and a neural network-based filter. Alternatively, when the filtering unit 208 determines that the reconstructed block is not used as a reference for decoding other blocks, the filtering unit 208 performs loop filtering on one or more target pixels in the reconstructed block.
[0764] The output of the filtering unit 208 is a decoded picture or sub-picture, which is sent to the DPB unit 209. The DPB unit 209 outputs the decoded picture according to the timing and control information. The picture stored in the DPB unit 209 can also be used as a reference for inter-frame prediction or intra-frame prediction performed by the prediction unit 202.
[0765] In the embodiment of the present application, the decoder 200 may be a computing device having a processor and a storage medium recording a decoding program. When the processor reads and runs the decoding program, the decoder 200 reads the input code stream and generates a corresponding decoded video. In addition, the decoder 200 may be a computing device having one or more chips. The units implemented as integrated circuits on the chip are connected to the processor. Figure 2 The corresponding units in the same embodiment have similar connections and data exchange and have similar functions.
[0766] This embodiment provides a coding method, which obtains prediction parameters and LFNST parameters of a current block by parsing a bitstream, wherein the prediction parameters include prediction mode parameters; when the prediction mode parameters indicate that a matrix-based intra-frame prediction MIP mode is used to determine an intra-frame prediction value for a chrominance component of the current block, obtains adjacent sample values of the current block, and determines a MIP input sample value of the current block based on the adjacent sample values of the current block; determines a MIP prediction value of the chrominance component of the current block based on the MIP input sample value, a MIP weighting matrix, and a shift parameter; and The MIP prediction value is filtered to determine the intra-frame prediction value of the chrominance component of the current block; when the LFNST parameter indicates that LFNST is to be performed on the current block, the reconstructed transform coefficient block of the current block is determined, and LFNST is performed on at least part of the reconstructed transform coefficients in the reconstructed transform coefficient block to obtain a second transform coefficient block; the second transform coefficient block is transformed for the first time to obtain a reconstructed residual block of the chrominance component of the current block; based on the intra-frame prediction value of the chrominance component of the current block and the reconstructed residual block, the reconstructed block of the chrominance component of the current block is determined. In this way, for the MIP mode, the complexity can be reduced while ensuring the decoding performance, and the storage space required in the decoding process can be reduced, thereby effectively improving the decoding efficiency; in addition, when the LFNST technology is applied to the MIP mode prediction, the introduction of the MIP parameter makes the LFNST transform more flexible, further improving the decoding efficiency.
[0767] In another embodiment of the present application, based on the same inventive concept as the above embodiment, see Figure 12 , which shows a schematic diagram of the structure of an encoder 120 provided in an embodiment of the present application. Figure 12 As shown, the encoder 120 may include: a first determining unit 1201, a first predicting unit 1202, a first transforming unit 1203 and an encoding unit 1204; wherein,
[0768] A first determining unit 1201 is configured to determine prediction parameters of a current block, wherein the prediction parameters include prediction mode parameters;
[0769] The first determining unit 1201 is further configured to, when the prediction mode parameter indicates that a matrix-based intra prediction MIP mode is used to determine an intra prediction value for the chrominance component of the current block, obtain adjacent sample values of the current block, and determine a MIP input sample value of the current block according to the adjacent sample values of the current block;
[0770] The first prediction unit 1202 is configured to determine a MIP prediction value of the chrominance component of the current block according to the MIP input sample value, the MIP weighting matrix, and the shift parameter; wherein the MIP prediction value is a prediction value of some sampling points in the chrominance component of the current block; and perform filtering processing on the MIP prediction value to determine an intra-frame prediction value of the chrominance component of the current block;
[0771] A first transform unit 1203 is configured to determine a prediction residual value of the chrominance component of the current block according to the intra-frame prediction value of the chrominance component of the current block; and perform a low-frequency non-separable secondary transform LFNST on the prediction residual value to determine an LFNST parameter;
[0772] The encoding unit 1204 is configured to encode the LFNST parameters and write them into a bitstream.
[0773] 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.
[0774] In some embodiments, the shift parameters include a shift offset parameter and a shift amount parameter;
[0775] The first determination unit 1201 is specifically 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, according to a value of a shift quantity parameter, a first constant value, wherein the value of the shift quantity parameter is a fixed constant; and set the value of the first offset to the difference between the first constant value and the product; and determine, according to the prediction parameter, a MIP weighting matrix of the current block; and determine, according to the MIP weighting matrix, the MIP input sample values, the shift quantity parameter and the first offset, a MIP prediction value of the chrominance component of the current block.
[0776] In some embodiments, the prediction parameters further include: a size parameter of the current block.
[0777] In some embodiments, the first determining unit 1201 is further configured to determine a block size index value of the current block according to a size parameter of the current block; and perform downsampling filtering on adjacent sample values of the current block to obtain a first temporary reference value; and when the block size index 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 the 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 the index number 0 in the first temporary reference value; The value corresponding to the index number i in the MIP input sampling value is set to be equal to the difference between the value corresponding to the index number i in the first temporary reference value and the value corresponding to the index number equal to 0 in the first temporary reference value, where i is an integer greater than 0; when the block size index value of the current block is outside the 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 equal to 0 in the first temporary reference value, where j is an integer greater than or equal to 0.
[0778] In some embodiments, the first determination unit 1201 is further configured to determine a second constant value according to the bit depth of the adjacent sampling values of the current block when the block size index value of the current block is within a preset range; set the value corresponding to the index number 0 in the MIP input sampling value to be equal to the difference between the value corresponding to the index number 0 in the first temporary reference value and the second constant value; set the value corresponding to the index number i in the MIP input sampling value to be equal to the difference between the value corresponding to the index number i in the first temporary reference value and the value corresponding to the index number equal to 0 in the first temporary reference value, where i is an integer greater than 0.
[0779] In some embodiments, the first determining unit 1201 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; 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; 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.
[0780] In some embodiments, the first determination unit 1201 is further configured to perform downsampling filtering on the adjacent sampling values of the current block to obtain a first temporary reference value; and determine a second constant value based on the bit depth of the adjacent sampling values of the current block, cache the second constant value in a data unit after the first temporary reference value to obtain a second temporary reference value; and set the value corresponding to the index number j in the MIP input sampling value to be equal to the difference between the value corresponding to the index number j+1 in the second temporary reference value and the value corresponding to the index number 0 in the second temporary reference value, where j is an integer greater than or equal to 0.
[0781] In some embodiments, the first determining unit 1201 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.
[0782] In some embodiments, the first determining unit 1201 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 sampling values of the current block minus 1.
[0783] 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.
[0784] In some embodiments, the value of the shift amount parameter is set to be equal to 6.
[0785] 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.
[0786] In some embodiments, the value of the shift offset parameter is set to be equal to 32.
[0787] In some embodiments, the first determining unit 1201 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.
[0788] In some embodiments, the first determining unit 1201 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.
[0789] In some embodiments, see Figure 12The encoder 120 may further include a first calculation unit 1205 configured to calculate a first weighted sum of the MIP weight matrix and the MIP input sample 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 amount parameter;
[0790] The first determination unit 1201 is also configured to set the MIP prediction value of the chrominance component of the current block 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; wherein the first temporary reference value is obtained based on downsampling filtering processing of adjacent sampling values of the current block.
[0791] In some embodiments, the first transform unit 1203 is configured to determine a residual block of the current block according to the prediction residual value, and perform a first transform on the residual block to obtain a first transform coefficient block;
[0792] The first determining unit 1201 is further configured to determine whether to perform LFNST on at least part of the transform coefficients in the first transform coefficient block;
[0793] The first transform unit 1203 is further configured to, if the determination result is yes, perform LFNST on at least part of the transform coefficients in the first transform coefficient block to determine the LFNST parameters.
[0794] In some embodiments, the first determination unit 1201 is further configured to determine a minimum value among the size parameters of the current block when the chrominance component of the current block uses the MIP mode to determine the intra-frame prediction value; and if the minimum value is greater than or equal to a first preset threshold, determine to perform LFNST on at least part of the transform coefficients in the first transform coefficient block.
[0795] In some embodiments, the LFNST parameter includes an LFNST index number, and the first determining unit 1201 is further configured to set the value of the LFNST index number to be greater than zero if it is determined that LFNST is performed on at least some of the transform coefficients in the first transform coefficient block; and set the value of the LFNST index number to be equal to zero if it is determined that LFNST is not performed on at least some of the transform coefficients in the first transform coefficient block.
[0796] The encoding unit 1204 is further configured to encode the LFNST index number and write it into the bitstream.
[0797] In some embodiments, the LFNST parameters also include LFNST coefficients, see Figure 12 , the encoder 120 may further include a quantization unit 1206; wherein,
[0798] A first transform unit 1203 is configured to perform LFNST on at least part of the transform coefficients in the first transform coefficient block to obtain the LFNST coefficients;
[0799] a quantization unit 1206 configured to quantize the LFNST coefficients to obtain quantized coefficients;
[0800] The encoding unit 1204 is further configured to encode the quantized coefficients and write them into a bitstream.
[0801] 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.
[0802] 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.
[0803] Therefore, an embodiment of the present application provides a computer storage medium, which is applied to the encoder 120. 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.
[0804] Based on the composition of the encoder 120 and the computer storage medium, see Figure 13 , which shows a schematic diagram of the specific hardware structure of the encoder 120 provided in the embodiment of the present application. Figure 13As shown, it may include: a first communication interface 1301, a first memory 1302 and a first processor 1303; each component is coupled together via a first bus system 1304. It is understood that the first bus system 1304 is used to achieve connection and communication between these components. In addition to the data bus, the first bus system 1304 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, Figure 13 In FIG, various buses are labeled as a first bus system 1304.
[0805] The first communication interface 1301 is used to receive and send signals when sending and receiving information with other external network elements;
[0806] A first memory 1302 is used to store computer programs that can be run on the first processor 1303;
[0807] The first processor 1303 is configured to, when running the computer program, execute:
[0808] Determining prediction parameters of the current block, wherein the prediction parameters include prediction mode parameters;
[0809] When the prediction mode parameter indicates that a matrix-based intra prediction MIP mode is used to determine an intra prediction value for the chrominance component of the current block, obtaining adjacent sample values of the current block, and determining a MIP input sample value of the current block according to the adjacent sample values of the current block;
[0810] Determining a MIP prediction value of a chrominance component of the current block according to the MIP input sample value, a MIP weighting matrix, and a shift parameter; wherein the MIP prediction value is a prediction value of some sampling points in the chrominance component of the current block;
[0811] Performing filtering on the MIP prediction value to determine an intra-frame prediction value of the chrominance component of the current block;
[0812] Determining a prediction residual value of the chrominance component of the current block according to the intra-frame prediction value of the chrominance component of the current block;
[0813] Performing a low-frequency non-separable secondary transform (LFNST) on the prediction residual value to determine LFNST parameters;
[0814] The LFNST parameters are encoded and written into the bitstream.
[0815] It is understood that the first memory 1302 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 1302 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0816] The first processor 1303 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 1303. The above-mentioned first processor 1303 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 as a hardware decoding processor, or can be executed 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 1302 , and the first processor 1303 reads the information in the first memory 1302 and completes the steps of the above method in combination with its hardware.
[0817] 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.
[0818] Optionally, as another embodiment, the first processor 1303 is further configured to execute any one of the methods described in the foregoing embodiments when running the computer program.
[0819] This embodiment provides an encoder that may include a first determination unit, a first prediction unit, a first transformation unit, and an encoding unit. This embodiment reduces encoding complexity while ensuring encoding performance for the MIP mode, while also reducing the storage space required during the encoding process, effectively improving encoding efficiency. Furthermore, when LFNST technology is applied to MIP mode prediction, the introduction of MIP parameters makes the LFNST transform more flexible, further improving encoding efficiency.
[0820] In another embodiment of the present application, based on the same inventive concept as the above embodiment, see Figure 14 , which shows a schematic diagram of the structure of a decoder 140 provided in an embodiment of the present application. Figure 14 As shown, the decoder 140 may include: a parsing unit 1401, a second determining unit 1402, a second prediction unit 1403 and a second transforming unit 1404; wherein,
[0821] The parsing unit 1401 is configured to parse the bitstream to obtain prediction parameters and LFNST parameters of the current block, wherein the prediction parameters include prediction mode parameters;
[0822] a second determining unit 1402 configured to, when the prediction mode parameter indicates that a matrix-based intra prediction MIP mode is used to determine an intra prediction value for a chrominance component of the current block, obtain adjacent sample values of the current block, and determine a MIP input sample value of the current block according to the adjacent sample values of the current block;
[0823] a second prediction unit 1403 configured to determine, based on the MIP input sample values, the MIP weighting matrix, and the shift parameter, a MIP prediction value of the chrominance component of the current block; wherein the MIP prediction value is a prediction value of some sampling points in the chrominance component of the current block; and to determine an intra-frame prediction value of the chrominance component of the current block by filtering the MIP prediction value;
[0824] The second transform unit 1404 is configured to, when the LFNST parameter indicates that LFNST is to be performed on the current block, determine a reconstructed transform coefficient block for the current block, perform LFNST on at least part of the reconstructed transform coefficients in the reconstructed transform coefficient block to obtain a second transform coefficient block; and perform a first transform on the second transform coefficient block to obtain a reconstructed residual block of the chrominance component of the current block;
[0825] The second determining unit 1402 is further configured to determine a reconstructed block of the chrominance component of the current block according to the intra-frame prediction value of the chrominance component of the current block and the reconstructed residual block.
[0826] 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.
[0827] In some embodiments, the shift parameters include a shift offset parameter and a shift amount parameter;
[0828] The second determination unit 1402 is specifically configured to 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, wherein the value of the shift offset parameter is a fixed constant; and determine, according to the value of the shift quantity parameter, a first constant value, wherein the value of the shift quantity parameter is a fixed constant; and set the value of the first offset to the difference between the first constant value and the product; and determine, according to the prediction parameter, the MIP weighting matrix of the current block; and determine, according to the MIP weighting matrix, the MIP input sample values, the shift quantity parameter and the first offset, the MIP prediction value of the chrominance component of the current block.
[0829] In some embodiments, the prediction parameters further include: a size parameter of the current block.
[0830] In some embodiments, the second determining unit 1402 is further configured to determine a block size index value of the current block according to the size parameter of the current block; and perform downsampling filtering on the adjacent sample values of the current block to obtain a first temporary reference value; and when the block size index 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 the 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 the index number 0 in the first temporary reference value; The value corresponding to the index number i in the MIP input sampling value is set to be equal to the difference between the value corresponding to the index number i in the first temporary reference value and the value corresponding to the index number equal to 0 in the first temporary reference value, where i is an integer greater than 0; when the block size index value of the current block is outside the 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 equal to 0 in the first temporary reference value, where j is an integer greater than or equal to 0.
[0831] In some embodiments, the second determination unit 1402 is further configured to determine a second constant value according to the bit depth of the adjacent sampling values of the current block when the block size index value of the current block is within a preset range; set the value corresponding to the index number 0 in the MIP input sampling value to be equal to the difference between the value corresponding to the index number 0 in the first temporary reference value and the second constant value; set the value corresponding to the index number i in the MIP input sampling value to be equal to the difference between the value corresponding to the index number i in the first temporary reference value and the value corresponding to the index number equal to 0 in the first temporary reference value, where i is an integer greater than 0.
[0832] In some embodiments, the second determining unit 1402 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; 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; 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.
[0833] In some embodiments, the second determination unit 1402 is further configured to perform downsampling filtering on the adjacent sampling values of the current block to obtain a first temporary reference value; and determine a second constant value based on the bit depth of the adjacent sampling values of the current block, cache the second constant value in a data unit after the first temporary reference value to obtain a second temporary reference value; and set the value corresponding to the index number j in the MIP input sampling value to be equal to the difference between the value corresponding to the index number j+1 in the second temporary reference value and the value corresponding to the index number 0 in the second temporary reference value, where j is an integer greater than or equal to 0.
[0834] In some embodiments, the second determining unit 1402 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.
[0835] In some embodiments, the second determining unit 1402 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.
[0836] 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.
[0837] In some embodiments, the value of the shift amount parameter is set to be equal to 6.
[0838] 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.
[0839] In some embodiments, the value of the shift offset parameter is set to be equal to 32.
[0840] In some embodiments, the second determining unit 1402 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.
[0841] In some embodiments, the second determining unit 1402 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.
[0842] In some embodiments, see Figure 14 The decoder 140 may further include a second calculation unit 1405 configured to calculate a first weighted sum of the MIP weight matrix and the MIP input sample 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 amount parameter;
[0843] The second determination unit 1402 is further configured to set the MIP prediction value of the chrominance component of the current block 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; wherein the first temporary reference value is obtained based on downsampling filtering processing of adjacent sampling values of the current block.
[0844] In some embodiments, the second determining unit 1402 is further configured to determine whether there is a LFNST parameter in the code stream;
[0845] The parsing unit 1401 is further configured to, when it is determined that the LFNST parameter exists in the code stream, parse the code stream to obtain the LFNST parameter.
[0846] In some embodiments, the second determination unit 1402 is further configured to determine a minimum value among the size parameters of the current block when the chroma component of the current block uses the MIP mode to determine the intra-frame prediction value; and if the minimum value is greater than or equal to a first preset threshold, determine that the LFNST parameter exists in the code stream.
[0847] In some embodiments, see Figure 14 , the decoder 140 may further include an inverse quantization unit 1406;
[0848] The parsing unit 1401 is further configured to, when the LFNST parameter indicates that LFNST is performed on the current block, parse the code stream to obtain a quantization coefficient of the current block;
[0849] The inverse quantization unit 1406 is configured to perform inverse quantization on the quantized coefficients to obtain a reconstructed transform coefficient block of the current block.
[0850] In some embodiments, the inverse quantization unit 1406 is specifically configured to perform a scaling operation on the quantized coefficients to obtain a reconstructed transform coefficient block of the current block.
[0851] In some embodiments, the parsing unit 1401 is specifically configured to parse the code stream to obtain a value of an LFNST index number; and if the value of the LFNST index number is greater than zero, determine to perform LFNST on the current block; if the value of the LFNST index number is equal to zero, determine not to perform LFNST on the current block.
[0852] 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.
[0853] 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 for use in decoder 140. The computer storage medium stores a computer program that, when executed by a second processor, implements any of the methods described in the aforementioned embodiments.
[0854] Based on the above-mentioned components of the decoder 140 and the computer storage medium, see Figure 15 , which shows a schematic diagram of the specific hardware structure of the decoder 140 provided in the embodiment of the present application. Figure 15 As shown, it may include: a second communication interface 1501, a second memory 1502, and a second processor 1503; each component is coupled together via a second bus system 1504. It is understood that the second bus system 1504 is used to achieve connection and communication between these components. In addition to the data bus, the second bus system 1504 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 15 In FIG, various buses are labeled as a second bus system 1504.
[0855] The second communication interface 1501 is used to receive and send signals during the process of sending and receiving information between other external network elements;
[0856] The second memory 1502 is used to store computer programs that can be run on the second processor 1503;
[0857] The second processor 1503 is configured to, when running the computer program, execute:
[0858] Parse the bitstream to obtain prediction parameters and LFNST parameters of the current block, wherein the prediction parameters include prediction mode parameters;
[0859] When the prediction mode parameter indicates that a matrix-based intra prediction MIP mode is used to determine an intra prediction value for the chrominance component of the current block, obtaining adjacent sample values of the current block, and determining a MIP input sample value of the current block according to the adjacent sample values of the current block;
[0860] Determining a MIP prediction value of a chrominance component of the current block according to the MIP input sample value, a MIP weighting matrix, and a shift parameter; wherein the MIP prediction value is a prediction value of some sampling points in the chrominance component of the current block;
[0861] Performing filtering on the MIP prediction value to determine an intra-frame prediction value of the chrominance component of the current block;
[0862] When the LFNST parameter indicates that LFNST is to be performed on the current block, determining a reconstructed transform coefficient block of the current block, and performing LFNST on at least part of the reconstructed transform coefficients in the reconstructed transform coefficient block to obtain a second transform coefficient block;
[0863] Performing a first transform on the second transform coefficient block to obtain a reconstructed residual block of the chrominance component of the current block;
[0864] A reconstructed block of the chrominance component of the current block is determined according to the intra-frame prediction value of the chrominance component of the current block and the reconstructed residual block.
[0865] Optionally, as another embodiment, the second processor 1503 is further configured to execute any one of the methods described in the foregoing embodiments when running the computer program.
[0866] It can be understood that the hardware functions of the second memory 1502 are similar to those of the first memory 1302, and the hardware functions of the second processor 1503 are similar to those of the first processor 1303; they will not be described in detail here.
[0867] This embodiment provides a decoder that may include a parsing unit, a second determination unit, a second prediction unit, and a second transformation unit. This embodiment reduces complexity while ensuring decoding performance for the MIP mode, while also reducing the storage space required during the decoding process, effectively improving decoding efficiency. Furthermore, when LFNST technology is applied to MIP mode prediction, the introduction of MIP parameters makes the LFNST transform more flexible, further improving decoding efficiency.
[0868] In another embodiment of the present application, see Figure 16 , which shows a schematic diagram of the structure of a sending device provided by an embodiment of the present application. Figure 16 , which shows an exemplary transmitting device 1600. The capturing unit 1601 acquires a video signal and transmits it to the encoder 1602. The capturing unit 1601 may be a device comprising one or more cameras (including a depth camera). The capturing unit 1601 may be a device that partially or completely decodes a bitstream to acquire video. The capturing unit 1601 may also include one or more components for capturing audio signals. A specific implementation of the encoder 1602 is the encoder 100 or encoder 120 described in the aforementioned embodiments, which encodes the video signal from the capturing unit 1601 as its input video and generates a video bitstream. The encoder 1602 may also include one or more audio encoders to encode the audio signal and generate an audio bitstream. The storage / transmission unit 1603 receives the video bitstream from the encoder 1602. The storage / transmission unit 1603 may also receive the audio bitstream from the encoder 1602 and compress the video bitstream and audio bitstream together to form a media file (e.g., an ISO-based media file format) or a transport stream.
[0869] Optionally, the storage / transmission unit 1603 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.
[0870] Optionally, the storage / transmission unit 1603 transmits the bit stream to a transmission network, such as the Internet, a wired network, a cellular network, a wireless local area network, etc.
[0871] In another embodiment of the present application, see Figure 17 , which shows a schematic diagram of the composition structure of a target device provided by an embodiment of the present application. Figure 17, which shows an exemplary target device 1700. A receiving unit 1701 receives a media file or transport stream from a network, or reads a media file or transport stream from a storage device. Receiving unit 1701 separates the video stream and the audio stream from the media file or transport stream. Receiving unit 1701 can also generate a new video stream by extracting the video stream. Receiving unit 1701 can also generate a new audio stream by extracting the audio stream. Decoder 1702 includes one or more video decoders, such as decoder 200 or decoder 140 described in the aforementioned embodiments.
[0872] Decoder 1702 may also include one or more audio decoders. Decoder 1702 decodes the video and audio streams from receiving unit 1701 to obtain decoded video and one or more decoded audio channels corresponding to one or more channels. Rendering unit 1703 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 1703 may also perform operations on the decoded audio to improve the perceptual quality of the displayed audio signal.
[0873] In another embodiment of the present application, see Figure 18 , which shows a schematic diagram of the structure of a communication system provided by an embodiment of the present application. Figure 18 As shown, an exemplary communication system 1800 is shown. In which, the source device 1801 can be Figure 16 The output of the storage / transmission unit 1603 is processed by the storage medium / transmission network 1802 to store or transmit the code stream. The target device 1803 can be Figure 17 Target device 1700 is shown. Here, receiving unit 1701 can obtain a stream from storage medium / transmission network 1802. Receiving unit 1701 can extract a new video stream from a media file or transport stream. Receiving unit 1701 can also extract a new audio stream from a media file or transport stream.
[0874] 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.
[0875] 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.
[0876] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0877] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0878] 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.
[0879] 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.
[0880] Industrial Applicability
[0881] In an embodiment of the present application, on the encoder side, after determining the prediction parameters of the current block, when the prediction mode parameters indicate that the matrix-based intra-frame prediction MIP mode is used to determine the intra-frame prediction value for the chroma component of the current block, the adjacent sampling values of the current block are obtained, and the MIP input sampling values of the current block are determined based on the adjacent sampling values of the current block; the MIP prediction value of the chroma component of the current block is determined based on the MIP input sampling value, the MIP weighting matrix and the shift parameter; the MIP prediction value is filtered to determine the intra-frame prediction value of the chroma component of the current block; the prediction residual value of the chroma component of the current block is determined based on the intra-frame prediction value of the chroma component of the current block; a low-frequency non-separable secondary transform LFNST is performed on the prediction residual value to determine the LFNST parameters; the LFNST parameters are encoded and written into the bitstream. On the decoder side, after parsing the bitstream and obtaining prediction parameters and LFNST parameters of the current block, when the prediction mode parameter indicates that the matrix-based intra-frame prediction MIP mode is used to determine the intra-frame prediction value of the chroma component of the current block, the decoder obtains the adjacent sample values of the current block and determines the MIP input sample values of the current block based on the adjacent sample values of the current block; determines the MIP prediction value of the chroma component of the current block based on the MIP input sample values, the MIP weighting matrix and the shift parameter; filters the MIP prediction value to determine the intra-frame prediction value of the chroma component of the current block; when the LFNST parameter indicates that LFNST is performed on the current block, determines a reconstructed transform coefficient block of the current block, performs LFNST on at least part of the reconstructed transform coefficients in the reconstructed transform coefficient block to obtain a second transform coefficient block; performs a first transform on the second transform coefficient block to obtain a reconstructed residual block of the chroma component of the current block; and determines a reconstructed block of the chroma component of the current block based on the intra-frame prediction value of the chroma component of the current block and the reconstructed residual block. In this way, for the MIP mode, the complexity can be reduced while ensuring the encoding and decoding performance, while reducing the storage space required during the encoding and decoding process, effectively improving the encoding and decoding efficiency. In addition, when LFNST technology is applied to MIP mode prediction, the introduction of MIP parameters makes the LFNST transformation more flexible, further improving the encoding and decoding efficiency.
Claims
1. A coding method, applied to an encoder, the method comprising: Determining prediction parameters of the current block, wherein the prediction parameters include prediction mode parameters; When the prediction mode parameter indicates that a matrix-based intra prediction MIP is used to determine an intra prediction value for a color component of the current block, determining adjacent sample values of the current block, and determining a MIP input sample value of the current block according to the adjacent sample values of the current block; Determine a MIP prediction value of a color component of the current block according to the MIP input sample value, the MIP weighting matrix, the shift offset parameter and the shift amount parameter; wherein the MIP prediction value is a prediction value of a portion of sampling points of the color component of the current block, the shift offset parameter is a first fixed value, and the shift amount parameter is a second fixed value; Performing filtering on the MIP prediction value to determine an intra-frame prediction value of a color component of the current block; Determining a prediction residual value of a color component of the current block according to an intra-frame prediction value of a color component of the current block; Performing a low frequency non-separable secondary transform LFNST on the prediction residual value to determine LFNST parameters; The LFNST parameters are encoded and written into the bitstream.
2. The method according to claim 1, wherein determining the MIP prediction value of the color component of the current block according to the MIP input sample value, the MIP weighting matrix, the shift offset parameter and the shift amount parameter comprises: Determine the product of the sum of the MIP input sample values and the value of the shift offset parameter; Setting the value of the first offset to the difference between the first constant value and the product; Determining a MIP weighting matrix of the current block according to the prediction parameters; Calculating a first weighted sum of the MIP weighting matrix and the MIP input sample value; Calculating a first sum value of the first weighted sum and the first offset; 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; The MIP prediction value of the color component 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; wherein the first temporary reference value is obtained based on downsampling filtering of adjacent sampling values of the current block.
3. The method according to claim 1, characterized in that The prediction parameter further includes: a size parameter of the current block, and determining the MIP input sample value of the current block according to the adjacent sample values of the current block includes: Determining a block size index value of the current block according to a size parameter of the current block; Performing down-sampling filtering on adjacent sample values of the current block to obtain a first temporary reference value; When the block size index value of the current block is within a preset range, setting the value corresponding to the 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 the index number 0 in the first temporary reference value; setting the value corresponding to the index number i in the MIP input sample value to be equal to the difference between the value corresponding to the index number i in the first temporary reference value and the value corresponding to the index number equal to 0 in the first temporary reference value, where i is an integer greater than 0; When the block size index value of the current block is outside 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.
4. The method according to claim 3, wherein: The second constant value is equal to 1<<(BitDepth-1), where the BitDepth represents the bit depth of the color component of the current block.
5. The method according to claim 2, wherein The value of the shift quantity parameter is equal to 6; The first constant value is equal to 32; and The value of the shift offset parameter is equal to 32.
6. The method according to claim 1, wherein: The performing a low frequency non-separable secondary transform LFNST on the prediction residual value to determine a LFNST parameter comprises: Performing a first transform on the prediction residual value of the current block to obtain a first transform coefficient; determining whether to perform LFNST on at least part of the first transform coefficients; If the determination result is yes, performing LFNST on at least part of the first transform coefficients to determine LFNST coefficients; quantizing the LFNST coefficients to obtain quantized coefficients; The quantized coefficients are encoded, and the encoded quantized coefficients are written into a bit stream.
7. The method according to claim 6, wherein: The LFNST parameter includes a LFNST index number, and the determining of the LFNST parameter further includes: If it is determined that LFNST is performed on at least part of the first transform coefficients, setting the value of the LFNST index number to be greater than zero; If it is determined that LFNST is not to be performed on at least part of the first transform coefficients, setting the value of the LFNST index sequence number to zero; The LFNST index number is encoded and written into the bitstream.
8. A decoding method, applied to a decoder, the method comprising: Parse the bitstream to obtain prediction parameters and LFNST parameters of the current block, wherein the prediction parameters include prediction mode parameters; When the prediction mode parameter indicates that a matrix-based intra prediction MIP is used to determine an intra prediction value for a color component of the current block, determining adjacent sample values of the current block, and determining a MIP input sample value of the current block according to the adjacent sample values of the current block; Determine a MIP prediction value of a color component of the current block according to the MIP input sample value, the MIP weighting matrix, the shift offset parameter and the shift amount parameter; wherein the MIP prediction value is a prediction value of a portion of sampling points of the color component of the current block, the shift offset parameter is a first fixed value, and the shift amount parameter is a second fixed value; Performing filtering on the MIP prediction value to determine an intra-frame prediction value of a color component of the current block; When the LFNST parameter indicates that LFNST is performed on the current block, determining a reconstructed transform coefficient of the current block, and performing LFNST on at least part of the reconstructed transform coefficients to obtain a second transform coefficient; Performing a first transform on the second transform coefficient to obtain a reconstructed residual value of the color component of the current block; A reconstructed value of the color component of the current block is determined according to the intra-frame prediction value of the color component of the current block and the reconstructed residual value.
9. The method according to claim 8, wherein: Determining the MIP prediction value of the color component of the current block according to the MIP input sample value, the MIP weighting matrix, the shift offset parameter and the shift quantity parameter includes: Determine the product of the sum of the MIP input sample values and the value of the shift offset parameter; Setting the value of the first offset to the difference between the first constant value and the product; Determining a MIP weighting matrix of the current block according to the prediction parameters; Calculating a first weighted sum of the MIP weighting matrix and the MIP input sample value; Calculating a first sum value of the first weighted sum and the first offset; 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; The MIP prediction value of the color component 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; wherein the first temporary reference value is obtained based on downsampling filtering of adjacent sampling values of the current block.
10. The method according to claim 8, characterized in that The prediction parameter further includes: a size parameter of the current block, and determining the MIP input sample value of the current block according to the adjacent sample values of the current block includes: Determining a block size index value of the current block according to a size parameter of the current block; Performing down-sampling filtering on adjacent sample values of the current block to obtain a first temporary reference value; When the block size index value of the current block is within a preset range, setting the value corresponding to the 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 the index number 0 in the first temporary reference value; setting the value corresponding to the index number i in the MIP input sample value to be equal to the difference between the value corresponding to the index number i in the first temporary reference value and the value corresponding to the index number equal to 0 in the first temporary reference value, where i is an integer greater than 0; When the block size index value of the current block is outside 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.
11. The method according to claim 10, wherein: The second constant value is equal to 1<<(BitDepth-1), where the BitDepth represents the bit depth of the color component of the current block.
12. The method according to claim 9, wherein: The value of the shift quantity parameter is equal to 6; The first constant value is equal to 32; and The value of the shift offset parameter is equal to 32.
13. The method according to claim 8, wherein: The parsing of the code stream to obtain the LFNST parameters includes: Parse the code stream to obtain the LFNST index number; If the value of the LFNST index number is greater than zero, determining to perform LFNST on the current block; If the value of the LFNST index sequence number is equal to zero, it is determined not to perform LFNST on the current block.
14. The method according to claim 8, wherein: The determining of the reconstructed transform coefficient of the current block comprises: Parsing the bitstream to obtain the quantization coefficient of the current block; A scaling operation is performed on the quantized coefficients to obtain reconstructed transform coefficients of the current block.
15. A decoder comprising at least one processor and a memory, the memory being coupled to the at least one processor and storing at least one computer executable instruction, which when executed by the at least one processor causes the at least one processor to perform the method according to any one of claims 8-14.
16. An encoder comprising at least one processor and a memory, the memory being coupled to the at least one processor and storing at least one computer executable instruction, the at least one computer executable instruction, when executed by the at least one processor, causing the at least one processor to perform the method according to any one of claims 1-7.
Citation Information
Patent Citations
Prediction mode rapid selection method based on intra-frame coding in multipurpose coding
CN110519591A
Transform method in image coding system and apparatus for same
CN110546952A
A method for encoding and decoding video using a processing of an efficent transform
KR1020180085526A
Image decoding method and apparatus in image coding system
US20190230352A1