Encoding method, decoding method, encoder, decoder, and storage medium
By merging the reference regions indicated by the block vector parameters and selecting adaptive gradient filters, the high complexity and redundancy problems in BVG-DIMD technology are solved, thus improving the efficiency of video coding.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
- Filing Date
- 2024-12-23
- Publication Date
- 2026-07-02
AI Technical Summary
Block Vector Indication-based Intra-Frame Mode Derivation (BVG-DIMD) technology suffers from high complexity and reference region redundancy in video coding, which reduces the efficiency of the derivation process.
By determining the vector parameters of the current block, merging reference regions to reduce redundancy, and selecting a gradient filter that fits the current block size, complexity is reduced and encoding/decoding efficiency is improved.
It reduces the complexity of the video encoding process, improves encoding and decoding efficiency, reduces redundancy in the reference area, and enhances the efficiency of intra-frame mode derivation.
Smart Images

Figure CN2024141592_02072026_PF_FP_ABST
Abstract
Description
Encoding / decoding methods, encoders, decoders, and storage media Technical Field
[0001] This application relates to the field of video encoding and decoding technology, and in particular to an encoding and decoding method, a bitstream, an encoder, a decoder, and a storage medium. Background Technology
[0002] In video coding standards, Block Vector Guided-Decoder Intra Mode Derivation (BVG-DIMD) is an extension of DIMD. It uses block vector-guided reference regions to derive the prediction angle of the current block, achieving higher accuracy in some cases compared to using neighboring samples. However, considering that the reference region is typically larger than the adjacent reconstructed regions, the intra-mode derivation process in BVG-DIMD is highly complex. Furthermore, the reference regions determined from multiple block vectors may contain redundancies, reducing the efficiency of the derivation process. Summary of the Invention
[0003] This application provides an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium, which can improve encoding / decoding efficiency.
[0004] The technical solution of this application embodiment can be implemented as follows:
[0005] In a first aspect, embodiments of this application provide a decoding method applied to a decoder, the method comprising:
[0006] Determine one or more vector parameters for the current block;
[0007] At least one second reference region is determined based on a first reference region indicated by one or more vector parameters; wherein the second reference region is obtained by merging the first reference regions indicated by at least some of the vector parameters.
[0008] Based on at least one second reference region, determine one or more prediction modes for the current block; wherein the one or more prediction modes are determined based on gradient information derived from at least one second reference region;
[0009] Determine the prediction samples for the current block based on one or more prediction patterns.
[0010] Secondly, embodiments of this application provide an encoding method applied to an encoder, the method comprising:
[0011] Determine one or more vector parameters for the current block;
[0012] At least one second reference region is determined based on a first reference region indicated by one or more vector parameters; wherein the second reference region is obtained by merging the first reference regions indicated by at least some of the vector parameters.
[0013] Based on at least one second reference region, determine one or more prediction modes for the current block; wherein the one or more prediction modes are determined based on gradient information derived from at least one second reference region;
[0014] Determine the prediction samples for the current block based on one or more prediction patterns.
[0015] Thirdly, embodiments of this application provide an encoder, which includes a first determining unit and a first predicting unit, wherein:
[0016] The first determining unit is configured to: determine one or more vector parameters of the current block; determine at least one second reference region based on a first reference region indicated by the one or more vector parameters; wherein the second reference region is obtained by merging the first reference regions indicated by at least some of the one or more vector parameters; and determine one or more prediction modes of the current block based on the at least one second reference region; wherein the one or more prediction modes are determined based on gradient information derived from the at least one second reference region.
[0017] The first prediction unit is configured to determine the prediction sample for the current block based on one or more prediction modes.
[0018] Fourthly, embodiments of this application provide an encoder, which includes a first memory and a first processor, wherein:
[0019] A first memory for storing computer programs that can run on a first processor;
[0020] A first processor is configured to execute the encoding method described in the second aspect when running a computer program.
[0021] Fifthly, embodiments of this application provide a decoder, which includes a second determining unit and a second predicting unit, wherein:
[0022] The second determining unit is configured to: determine one or more vector parameters of the current block; determine at least one second reference region based on a first reference region indicated by the one or more vector parameters; wherein the second reference region is obtained by merging the first reference regions indicated by at least some of the one or more vector parameters; and determine one or more prediction modes of the current block based on the at least one second reference region; wherein the one or more prediction modes are determined based on gradient information derived from the at least one second reference region.
[0023] The second prediction unit is configured to determine the prediction samples for the current block based on one or more prediction modes.
[0024] Sixthly, embodiments of this application provide a decoder, which includes a second memory and a second processor; wherein,
[0025] The second memory is used to store computer programs that can run on the second processor;
[0026] The second processor is used to execute the decoding method as described in the first aspect when running a computer program.
[0027] In a seventh aspect, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the decoding method as described in the first aspect or the encoding method as described in the second aspect.
[0028] Eighthly, embodiments of this application provide a computer-readable storage medium having a bitstream stored thereon, the bitstream being generated by performing the steps of the encoding method as described in the second aspect.
[0029] In a ninth aspect, embodiments of this application provide a computer program product, including a computer program or instructions, which, when executed by a processor, implement the decoding method as described in the first aspect or the encoding method as described in the second aspect.
[0030] This application provides an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium. Whether at the encoding or decoding end, the method involves: determining one or more vector parameters of the current block; determining at least one second reference region based on a first reference region indicated by the one or more vector parameters; merging the first reference regions indicated by at least some of the vector parameters in the one or more vector parameters; determining one or more prediction modes of the current block based on the at least one second reference region; and determining prediction samples of the current block based on the one or more prediction modes. By merging the first reference regions indicated by at least some of the vector parameters after determining one or more vector parameters of the current block, redundancy between reference regions can be removed, reducing complexity. Compared to the first reference regions indicated by one or more vector parameters, the size of the reference regions used to derive one or more prediction modes is reduced, thereby improving the efficiency of the derivation process. Furthermore, when deriving the corresponding gradient information based on at least one second reference region, different gradient filters can be adaptively selected according to the size of the current block, further reducing complexity. Thus, when the current block is predicted using the BVG-DIMD mode, complexity can be reduced, thereby improving encoding / decoding efficiency. Attached Figure Description
[0031] Figure 1 is a schematic diagram of the reference sample for the current block;
[0032] Figure 2 illustrates nine modes for intra-frame prediction in the current block;
[0033] Figure 3 shows a schematic diagram of the intra-frame prediction angle mode and the wide-angle mode;
[0034] Figure 4 is a schematic diagram of gradient calculation for adjacent samples of the current block;
[0035] Figure 5 is a schematic diagram of the cumulative amplitude value in at least one angular direction;
[0036] Figure 6 is a schematic diagram of the fusion of multiple prediction blocks corresponding to the BVG-DIMD mode;
[0037] Figure 7 is a schematic diagram of the relationship between the current block and the reference region;
[0038] Figure 8 is a schematic diagram of the available search area for the current block;
[0039] Figure 9A is a schematic diagram of template matching in sparse search;
[0040] Figure 9B is a schematic diagram of template matching for fine-grained search;
[0041] Figure 10 is a schematic diagram of the aggregation process based on the refined window;
[0042] Figure 11 is a schematic diagram of a video encoding and decoding network architecture provided in an embodiment of this application;
[0043] Figure 12 is a schematic block diagram of an encoder provided in an embodiment of this application;
[0044] Figure 13 is a schematic block diagram of a decoder provided in an embodiment of this application;
[0045] Figure 14 is a schematic flowchart of a decoding method provided in an embodiment of this application;
[0046] Figure 15 is a schematic flowchart of a decoding method provided in an embodiment of this application;
[0047] Figure 16 is a schematic flowchart of a decoding method provided in an embodiment of this application;
[0048] Figure 17A is a schematic diagram of the application of a 3×3 gradient filter in a reference region according to an embodiment of this application;
[0049] Figure 17B is a schematic diagram of the application of a 2×2 gradient filter in the reference region according to an embodiment of this application;
[0050] Figure 18 is a flowchart illustrating an encoding method provided in an embodiment of this application;
[0051] Figure 19 is a schematic flowchart of an encoding method provided in an embodiment of this application;
[0052] Figure 20 is a schematic diagram of the composition structure of an encoder provided in an embodiment of this application;
[0053] Figure 21 is a schematic diagram of the hardware structure of an encoder provided in an embodiment of this application;
[0054] Figure 22 is a schematic diagram of the composition structure of a decoder provided in an embodiment of this application;
[0055] Figure 23 is a schematic diagram of the hardware structure of a decoder provided in an embodiment of this application;
[0056] Figure 24 is a schematic diagram of the composition structure of an encoding and decoding system provided in an embodiment of this application. Detailed Implementation
[0057] In order to gain a more detailed understanding of the features and technical content of the embodiments of this application, the implementation of the embodiments of this application will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for reference and illustration only and are not intended to limit the embodiments of this application.
[0058] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0059] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0060] It should also be noted that the terms "first, second, and third" used in the embodiments of this application are only used to distinguish similar objects and do not represent a specific order of objects. It is understood that "first, second, and third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0061] Before providing a further detailed description of the embodiments of this application, the nouns and terms used in the embodiments of this application will be explained. The nouns and terms used in the embodiments of this application shall be interpreted as follows:
[0062] H.266 / Versatile Video Coding (VVC);
[0063] Joint Video Experts Team (JVET);
[0064] Enhanced Compression Model (ECM) is a reference software test platform for enhanced compression.
[0065] Intra-template matching prediction (IntraTMP);
[0066] Coding Unit (CU);
[0067] Coding Tree Unit (CTU);
[0068] Largest Coding Unit (LCU);
[0069] Prediction Unit (PU);
[0070] Transform Unit (TU);
[0071] Block Vector (BV);
[0072] Motion Vector (MV);
[0073] Sum of Absolute Difference (SAD);
[0074] Sum of Absolute Transformed Difference (SATD)
[0075] Sequence Parameter Set (SPS);
[0076] Intra Block Copy (IBC);
[0077] Matrix-weighted intra-prediction (MIP);
[0078] Low-Frequency Non-Separable Transform (LFNST);
[0079] Non-Separable Primary Transform (NSPT);
[0080] Multiple Transform Selection (MTS);
[0081] Interpolation filtering intra-prediction (EIP);
[0082] Occurrence-Based Intra Coding (OBIC);
[0083] Decoder-side Intra Mode Derivation (DIMD);
[0084] Template-based intra-mode derivation (TIMD);
[0085] Spatial geometry partitioning mode (SGPM).
[0086] It is understandable that video codec standards can adopt a block-based hybrid coding framework. For example, each image in a video is divided into square maximum coding units (MCUs) or coding tree units of the same size (e.g., 128×128, 64×64, etc.). Each MCU or coding tree unit can be further divided into rectangular coding units according to rules. Coding units may also be divided into prediction units, transform units, etc. The hybrid coding framework includes modules such as prediction, transform, quantization, entropy coding, inv.quantization, inv.transform, and in-loop filtering. The prediction module can include intra-frame prediction and inter-frame prediction. Inter-frame prediction can include motion estimation and motion compensation. In video codec technology, intra-frame prediction can be used to eliminate spatial redundancy between adjacent samples, and inter-frame prediction can be used to eliminate temporal redundancy between adjacent images, thereby improving coding efficiency. Transformation converts the predicted image patch to the frequency domain, redistributing energy. Combined with quantization, it removes information insensitive to the human eye, thus eliminating visual redundancy. Entropy coding can eliminate character redundancy based on the current context model and the probability information of the binary bitstream.
[0087] In this embodiment, after reading a black-and-white or color image, the encoding end divides it into blocks and uses intra-frame prediction or inter-frame prediction to generate a prediction block for the current block. The original block is subtracted from the prediction block to obtain a residual block. The residual block is transformed and quantized to obtain a quantization coefficient matrix. The quantization coefficient matrix is then entropy-encoded and output to the bitstream. The decoding end uses intra-frame prediction or inter-frame prediction to generate a prediction block for the current block, decodes the bitstream to obtain a quantization coefficient matrix, and performs inverse quantization and inverse transform on the quantization coefficient matrix to obtain a residual block. The prediction block and the residual block are added together to obtain a reconstructed block. The reconstructed block can be used to compose a reconstructed image. The decoding end performs loop filtering on the reconstructed image based on the image or based on the blocks to obtain a decoded image. Furthermore, the block division information, prediction, transform, quantization, entropy coding, loop filtering, and other mode or parameter information determined by the encoding end may be written into the bitstream if necessary. The decoding end determines the same block partitioning information, prediction, transform, quantization, entropy coding, loop filtering, and other mode or parameter information as the encoding end by parsing and analyzing existing information. This ensures that the decoded image obtained by the encoding end is identical to the decoded image obtained by the decoding end. The encoding end also needs similar operations to the decoding end to obtain the decoded image. The decoded image can be used as a reference image for subsequent inter-frame prediction.
[0088] The above describes the basic flow of a video codec under a block-based hybrid coding framework. With technological advancements, some modules or steps of the framework may be optimized. The embodiments in this application apply to the basic flow of this block-based hybrid coding framework for video codecs, but are not limited to this framework and flow.
[0089] In this embodiment, the current block (CB) can be the current coding unit, the current prediction unit, or the current transform unit, etc. Due to the need for parallel processing, an image can be divided into slices, etc. Slices within the same image can be processed in parallel, meaning they have no data dependency. A "frame" is a common term, generally understood as an image. In this embodiment, the frame can also be replaced with an image or a slice, etc. Additionally, a sample in this document can also be called a sample, which includes location information and values.
[0090] The following section introduces several prediction and transformation techniques in related technologies.
[0091] (1) Intra-frame prediction.
[0092] There is a strong spatial correlation between adjacent samples in an image. Intra-frame prediction is a prediction method that utilizes the spatial correlation between the already encoded / decoded samples around the current block and the samples within the current block. An example is shown in Figure 1. The white-filled 4×4 block is the current block. The grid-filled samples in the left column and top row of the current block are the reference samples for the current block. Intra-frame prediction uses these reference samples to predict the current block. These reference samples may all be available, i.e., all have been encoded / decoded. Some may also be unavailable. For example, if the current block is at the far left of the frame, then the reference samples to the left of the current block are unavailable. Or, if the lower left part of the current block has not yet been encoded / decoded, then the reference samples to the lower left are also unavailable. In cases where reference samples are unavailable, available reference samples, certain values, or certain methods can be used to fill the gaps, or no filling can be performed.
[0093] Intra-frame prediction has multiple prediction modes, as shown in Figure 2. Here are nine modes for intra-frame prediction of a 4×4 current block in H.264. Mode 0 (Vertical Mode) copies the samples above the current block vertically as the predicted values. Mode 1 (Horizontal Mode) copies the reference samples from the left side horizontally as the predicted values. Mode 2 (DC Mode) uses the average of points A-D and I-L as the predicted values for all points. Modes 3-8 copy the reference samples to the corresponding positions in the current block at a specific angle. Because some positions in the current block may not perfectly correspond to the reference samples, a weighted average of the reference samples, or interpolated subsamples of the reference samples, may be needed.
[0094] In addition to these, there are Plane and Planar modes, and with the development of technology and the expansion of blocks, angle prediction modes are becoming increasingly common. In the reference software ECM, traditional intra-prediction modes (here referred to as "traditional intra-prediction modes" to distinguish them from newly introduced intra-prediction modes such as DIMD and IntraTMP, which will be discussed later) include:
[0095] •Planar mode: Intra-prediction mode 0;
[0096] • DC mode: Intra-frame prediction mode 1;
[0097] • Angle mode: Intra-frame prediction mode 2-66.
[0098] As shown in Figure 3, the arrows in Figure 3 point to the angle pattern prediction directions that exist in VVC. These are the angle patterns 2 to 66 used during encoding and decoding. When the current block is a non-square block, some angle directions will be replaced with wide angles (such as -1 to -14 and 67 to 80 in Figure 3).
[0099] (2) Block vector guided-Decoder intra mode derivation (BVG-DIMD).
[0100] The DIMD technology is a technology that derives the prediction method of the current block through existing coding information at the decoder end. The block vector guided-Decoder intra mode derivation (BVG-DIMD) is an extended technology based on the DIMD method, which derives the prediction mode according to the reference samples indicated by the block vector information rather than the adjacent samples.
[0101] For the DIMD mode, in the ECM reference software, the DIMD method derives the prediction mode by calculating the gradient between samples. Here, the prediction method refers to the angular prediction mode (excluding the DC and Planar modes), and any one of the prediction modes 2 to 66 in the ECM can be derived (the same as the modes 2 to 66 in the VVC, and these modes can be replaced by the corresponding wide-angle modes during actual prediction, for example, 2 is replaced by 67). An implementation method of the DIMD mode is as follows: the value of the syntax element cu_dimd_flag of the current block is true, indicating that the current block uses the DIMD method to derive one or more intra modes for prediction. First, the prediction mode is derived according to the adjacent samples p[x][y].
[0102] Exemplarily, as shown in Figure 4, for the adjacent samples p[x][y], the value ranges of x and y are -3 <= x < cbWidth, -3 <= y < -1 and -and -3 <= x < -1, -3 <= y < cbHeight. x and y are the coordinate information relative to the upper left corner of the current block. The horizontal and vertical gradient values of each 3×3 window in the adjacent region can be calculated. Gx and Gy are respectively obtained by convolving the 3×3 horizontal gradient operator M
[0104] , , and the vertical gradient operator M y with the sample values within the window position. Among them, the horizontal gradient operator M x and the vertical gradient operator are as follows: and
[0103] For Gx and Gy at each position, the corresponding angular direction O at each position can be calculated according to the following formula, and the gradient magnitude G of each position corresponding angle can be calculated: G = |G x | + |G y | (2)
[0104] In some embodiments, the calculation of atan can be simplified by using a lookup table or some modifications. One method for deriving the angle direction O and the corresponding angle pattern is as follows:
[0105] Define mapHgV = {{2,1},{1,2}}, mapVgH = {{3,4},{4,3}}, and angOffset = {18,18,50,50} to map the gradient derivation results to the actual angle patterns. 18 and 50 correspond to the horizontal and vertical patterns, respectively. Define angTable = {0,2048,4096,6144,8192,12288,16384,20480,24576,28672,32768,36864,40960,47104,53248,59392,65536} to derive the angle direction based on the gradient information, so as to construct the Histogram of Gradient (HOG). For example, construct an array HoG
[0067] to store the magnitude of each pattern, with the initial value being 0.
[0106] For each neighboring sample p[x][y], we can calculate:
[0107] Horizontal gradient: gHor[x][y]=p[x-1][y-1]+2*p[x-1][y]+p[x-1][y+1]-p[x+1][y-1]-2*p[x+1][y]-p[x+1][y+1];
[0108] Vertical gradient: gVer[x][y]=p[x-1][y-1]+2*p[x][y-1]+p[x+1][y-1]-p[x-1][y+1]-2*p[x][y+1]-p[x+1][y+1];
[0109] Further calculation: signH[x][y]=gHor[x][y]<0?1:0 signV[x][y]=gVer[x][y]<0?1:0 HgV[x][y]=abs(gHor[x][y])>abs(gVer[x][y])? 1:0 region[x][y]=(HgV[x][y]==1)? mapHgV[signH[x][y]][signV[x][y]]:mapVgH[signH[x][y]][signV[x][y]] grad[x][y]=((HgV[x][y]==1)?(abs(gVer[x][y] / abs(gHor[x][y])):(abs(gHor[x][y]) / abs(gVer[x][y]) grad[x][y]=round(grad[x][y]*65536)(The division process can be replaced by a lookup table-based division process) angIdx[x][y]=argmin i (abs(angTable[i]-grad[x][y]).
[0110] The traditional intra-frame prediction mode (or angle mode, excluding DC mode and Planar mode) is derived as follows: ipm[x][y]=angOffset[region[x][y]]+angIdx[x][y];
[0111] If both gHor[x][y] and gVer[x][y] are zero, the sample is skipped; if gHor[x][y] is 0, then ipm[x][y] = 18; if gVer[x][y] is 0, then ipm[x][y] = 50.
[0112] The amplitude can be defined as amp[x][y] = abs(gHor[x][y] + gVer[x][y]), and HoG[ipm[x][y]] = HoG[ipm[x][y]] + amp[x][y].
[0113] Through the above steps, the HoG (Honor of King) can be obtained, which statistically summarizes the traditional intra-frame prediction modes and their sums of magnitudes corresponding to each sample location. Figure 5 shows a schematic diagram of the cumulative magnitude values in at least one angular direction. The mode derived from DIMD can be defined as argmax. i (HoG[i]) accumulates the gradient magnitude G at each position on its derived traditional intra-prediction mode to obtain a HoG. Finally, the traditional intra-prediction mode with the largest accumulated magnitude value is selected as the mode derived by the DIMD method.
[0114] Based on the HoG framework described above, the prediction block of DIMD can be obtained by fusing prediction blocks from multiple traditional intra-prediction modes. The selected traditional intra-prediction mode and its weights can be calculated from the magnitude of that mode in HoG.
[0115] For BVG-DIMD mode, which is an extension of DIMD, it can include multiple steps such as obtaining block vectors, determining reference regions and deriving prediction modes, and generating prediction blocks. Based on the block vectors or intra-frame prediction modes in the above steps, prediction blocks are obtained. Finally, the prediction block of the current block can be a fusion of multiple prediction blocks, as shown in Figure 6. It can be a fusion of prediction blocks from directional predictors and non-directional predictors.
[0116] Step 1, Obtain the block vector: BVG-DIMD mode determines the intra-frame prediction mode or generates prediction blocks based on the block vector, so it is necessary to obtain the block vector.
[0117] One possible implementation is inheritance from adjacent coded blocks. First, adjacent blocks are identified based on the position and size information of the current block. For example, adjacent positions are determined based on the current block's position and width / height (x, y, cbWidth, cbHeight), such as (x-1, y), (x, y-1), (x-1, y+cbHeight-1), (x+cbWidth-1, y-1), (x-1, y-1), etc. Taking (x1, y1) as an example, it is determined whether the coding unit to which position (x1, y1) belongs contains block vector information (e.g., whether the adjacent CU is IBC, IntraTMP, or other BVG mode encoding, or whether the IBC flag of the coding information motionInfo[x1][y1] at that position is true). If a block vector is contained, it is determined whether that block vector is available for the current block. If available, the block vector is used as the block vector to indicate the reference region. Here, the block vector is available if all samples of the reference block pointed to by the current block based on this block vector are within the intra-frame reconstruction range based on the current block.
[0118] Another possible implementation is to construct a block vector list, similar to the merging pattern of methods such as IBC and IntraTMP. The block vector list of BVG-DIMD can include one or more of the following candidates:
[0119] a) Adjacent block vector candidates: refers to the block vectors used by coded blocks in the row or column positions adjacent to the current block;
[0120] b) Non-adjacent block vector candidates: refers to the block vectors used by coded blocks in rows or columns that are not adjacent to the current block;
[0121] c) Historical block vector candidates: refers to the block vectors used by blocks that have been decoded before the current block in the decoding order, stored in a cache.
[0122] d) Temporal block vector candidate: refers to the block vector obtained from the reference frame (which can be a decoded image or a co-located image) when the current frame is an inter-coded frame;
[0123] e) Predefined block vector candidates: These refer to the block vectors or zero vectors obtained based on the current block size;
[0124] f) Average block vector candidate: refers to the block vector obtained by averaging the existing block vectors in the current list;
[0125] g) Candidate block vectors for relocation: Candidate block vectors are constructed from existing block vectors in the current list and the block vectors contained in the reference positions they point to.
[0126] When constructing the block vector list, the candidate block vectors (not necessarily in the order of a to g) are checked sequentially. When a candidate block vector is available for the current block, it is added to the block vector list. The block vector list can have a maximum length; if the list exceeds this length, no further candidates are added. Each type of candidate can have its own maximum length, for example, no more than M adjacent candidates, no more than N non-adjacent candidates, etc. The block vector list can be further reordered based on template error.
[0127] Another possible implementation is to determine one or more block vectors through intra-template matching search (defining the search region and template matching). The IntraTMP search process can be summarized as follows: determine the search region (or the range of values for candidate block vectors), and for each possible block vector, calculate its template error value. Based on the template error values of each block vector throughout the search process, determine the N block vectors with the best template error values as the block vectors required by this method. The intra-template matching search method used can include one or more of the following:
[0128] a) Search within a predefined area
[0129] b) Phased search. For example, the first phase searches within a predefined region with a step size S to obtain the optimal N block vectors; the second phase searches the neighborhood of these N block vectors with a step size s.
[0130] c) Different template types. Searches can be performed based on L-shaped templates, left templates, or top templates;
[0131] d) Merge list search. A merge list of block vectors can be constructed to search in the neighboring regions of each candidate block vector;
[0132] e) Merge search window. The neighboring search regions can be combined to obtain a new search region, thereby improving the search efficiency.
[0133] A special case when obtaining block vectors is that this solution requires N block vectors, while the above method only obtains n block vectors (n < N). The n block vectors can be used to fill the total number of block vectors to N. For example, the remaining N - n block vectors are all equal to the first block vector.
[0134] Step 2, determine the reference region and derive the prediction mode: For the current block, although theoretically all the blocks before the encoding / decoding scan order have been reconstructed, the information of these reconstructed blocks can be used to encode / decide the current block. However, usually considering the actual encoding / decoding complexity and implementation cost, it is usually specified that only the information of the reconstructed blocks within a range in the reconstruction area can be used to encode / decide the current block, and such a range is called the intra-frame prediction range here. To determine whether the obtained block vector is available, one or more of the following methods can be included. One method is to determine whether the reference block pointed to by the block vector BV = (bvHor, bvVer) has been reconstructed and is in the same slice / title / image as the current block, and all the reconstructed samples of the reference block are also within the intra-frame prediction range of the current block and have been reconstructed. Because video coding usually adopts raster scan, that is, the block coding method from left to right and from top to bottom, it can be determined whether the obtained block vector is available by determining whether the two sample positions (xCb + bvHor, yCb + bvVer) and (xCb + bvHor + cbWidth - 1, yCb + bvVer + cbHeight - 1) are within the intra-frame prediction range of the current block. Further, the intra-frame prediction range can be all the previously reconstructed regions of the current block, or the reference range can be limited from the entire image to a predefined partial region within the image, and this region can be related to the position and size of the current block, the size of the current frame CTU, etc. <![CDATA[
[0135] ]]One possible implementation is to determine whether the indicated reference region is located within the image and has been reconstructed. The size of the reference region can be related to the size of the current block. For example, based on the position and size of the current block (xCb, yCb, cbWidth, cbHeight) and the block vector (bvHor, bvVer), the position and size of the reference region (xCb+bvHor-offsetX, yCb+bvVer-offsetY, cbWidth+dW, cbHeight+dH) can be obtained, where offsetX, offsetY, dW, and dH can take any integer values. As shown in Figure 7, the width and height of the current block are cbWidth and cbHeight, respectively. The reference region pointed to by the block vector BV is filled with diagonal lines, and the width and height of the reference region are cbWidth+dW and cbHeight+dH, respectively.
[0136] Here, it is necessary to determine whether the samples within the aforementioned reference area (for example, only the samples in the upper left and lower right positions) are located within the image (or within the predefined referenceable intra-frame prediction range) and have been reconstructed.
[0137] For block vector-based prediction mode derivation, the BVG-DIMD method needs to derive the intra-frame prediction mode based on the block vectors after obtaining them. One possible implementation is to derive it within a reference region within the image indicated by the block vectors. The horizontal and vertical gradient values of each 3×3 window in this reference region can be calculated, where Gx and Gy are derived from the 3×3 horizontal gradient operator M... x and vertical gradient operator M y It is obtained by convolving with the sample values within the window position. Wherein, the horizontal gradient operator M... x The vertical gradient operator is shown in the above formula (1).
[0138] For each position, Gx and Gy can be calculated according to the above formulas (2) and (3) to obtain the corresponding angle direction O and the corresponding intra-frame prediction mode, and the amplitude value G of the prediction mode corresponding to each position can be calculated.
[0139] In some embodiments, the calculation process for atan can be simplified by using a lookup table or some variations.
[0140] One possible implementation is to obtain prediction blocks based on block vectors and derive the prediction mode from these blocks. The prediction process based on block vectors can include the following methods:
[0141] a) A reference block obtained based on a single block vector;
[0142] b) Fusion of reference blocks of multiple block vectors.
[0143] One method to simplify the derivation process is to downsample when determining the computation window. For example, if the center position of the current window is (x, y), then the center position of the next window in the horizontal direction can be (x + lenHor, y), and the center position of the next window in the vertical direction can be (x, y + lenVer). Here, lenHor and lenVer can take any integer values to determine the sampling interval. Another method to simplify the derivation process is to determine the reference region and derive the intra-frame prediction mode based on only n of the acquired N block vectors, such as the first n. The values of N and n can be related to the block size.
[0144] Step 3, Generate Prediction Blocks: The BVG-DIMD mode obtains block vectors and intra-prediction modes through the above process. The final prediction block can be a combination of prediction blocks obtained by these prediction methods. For example, using the N prediction modes with the largest derived amplitude G, N intra-angle prediction blocks are generated; using the obtained M block vectors, a block copy prediction block obtained by fusing M reference blocks is generated. These intra-angle prediction blocks and block copy prediction blocks are further fused to obtain the final prediction block. The fusion between prediction blocks can be weighted according to the amplitude corresponding to their mode, the template error corresponding to the mode (block vector), etc. For example, let the total weight corresponding to the angle prediction block be a, for example, a equals 32. Let the weight of the block copy prediction block be b, for example, b equals 32. Further, for the N intra-prediction modes, their amplitudes in HoG are IntraPredModeD... i For any i ≤ N, its weight value is dimWeight. i It can be determined using the following formula: tmpWeight i =HoG[IntraPredModeD i (4)
[0145] You can choose to adjust dimWeight i , making It equals a. For example, When diff > 0, start from the non-zero minimum dimWeight. i Start by decreasing dimWeight i Until dimWeight i It equals 0 or the sum of dimdWeight equals a. When diff < 0, it starts from the non-zero maximum dimdWeight. i Start, when dimWeight iWhen +(-diff) < a, let dimdWeight i = dimdWeight i + (-diff).
[0146] Similarly, the reference block obtained from the M block vectors can be judged whether to be used for fusion and the corresponding weight value according to its template error. Exemplarily, the template error of the i-th block vector BVi is SADi. When SADi < minSAD, BVi can be used for the fusion process. minSAD represents the minimum template error among the M block vectors. After confirming that m block vectors can be used for fusion, the corresponding weight value is calculated as follows: SADi = (SADi == 0)? 1 : SADi (6) Wi = (SUM - SADi) / ((n - 1) * SUM) (8)
[0147] Determine the angle prediction block, block copy prediction block and the corresponding weights according to the above process. The final prediction block of the current block can be expressed as:
[0148] where, pred_bv represents the fused block copy prediction block, equal to (Wi * pred_bv i + (1 << (shift_1 - 1))) >> shift_1, pred_bv i represents the prediction block of the i-th block vector among the m block vectors, pred i represents the i-th among the N angle prediction blocks, dimdWeight i , b, Wi are weight values, and shift and shift_1 represent the operation precision.
[0149] In addition, other related extensions of BVG-DIMD are as follows:
[0150] Transform kernel selection: One possible method is to correspond the prediction block to a preset MTS, NSPT, LFNST or some other different transform kernels of primary transform (separable or non-separable) or secondary transform (separable or non-separable) according to the traditional intra prediction mode with the largest derived amplitude. Another possible method is to derive an angle mode based on the final prediction block and correspond the preset transform kernel according to this mode. A simplified method is to set the corresponding preset transform kernel for this scheme according to a preset traditional intra prediction mode, such as Planar mode.
[0151] For intra-frame mode derivation, MPM construction, and Intra-merging modes: The BVG-DIMD method can obtain one or more intra-frame prediction modes during implementation, which can be saved for reference in subsequent coded blocks. For example, if the current block is coded using the OBIC method and its neighboring blocks are coded using the BVG-DIMD method, all or part of the intra-frame prediction modes with non-zero amplitudes of the BVG-DIMD block can be added to the HoG of the current block. Exemplarily, if the current block needs to construct an Intra-Frame Prediction Mode Candidate List (MPM), when its reference coded block is coded using the BVG-DIMD method, all or part of the traditional intra-frame prediction modes with non-zero amplitudes of that coded block can be added to the candidate list. For example, if the current block is coded using the intra-frame merging mode, the intra-frame prediction modes used when generating intra-frame predictions from the reference block and their respective weight combinations can be added to the candidate list of intra-frame merging modes. Furthermore, the angle modes derived from the final prediction block of the current BVG-DIMD coded block can be saved and used for the other modes mentioned above.
[0152] Block vector information storage: During implementation, the BVG-DIMD method can obtain one or more block vectors, which can be stored for reference in subsequent encoded blocks. For example, when constructing a block vector list, if an adjacent block is encoded using BVG-DIMD, all or part of the block vectors of that BVG-DIMD block can be added to the block vector candidate list. Similarly, when the codec constructs a historical cache of block vectors, all or part of the block vectors of that BVG-DIMD block can be added to the block vector candidate list. For instance, when the current chroma block is encoded using a Direct Block Vector (DBV) method, if the luma block at its reference position is encoded using BVG-DIMD, all or part of the block vectors of that BVG-DIMD block can be used as the block vector of the DBV block.
[0153] Matrix-based intra-prediction: Among related techniques, matrix-based position-dependent intra-prediction (PDP) proposes multiplying a pre-trained weight matrix with a reference sample of the current block template region to obtain the predicted block. This prediction method can be called PDP prediction. The weight matrix of PDP prediction is related to the size of the current block and the current intra-prediction mode (angle prediction mode, DC mode, Planar mode, etc.). When the conditions for using PDP prediction are met, the corresponding intra-prediction process will be replaced by the PDP prediction process. The BVG-DIMD method involves predicting these modes (angle prediction mode, DC mode, Planar mode, etc.). Some or all of the intra-prediction modes that meet the conditions can be implemented by PDP prediction.
[0154] (3)LFNST / NSPT.
[0155] Different angle prediction modes are suitable for using different transformations, including the first-order transformation MTS, NSPT, and the second-order transformation LFNST.
[0156] MTS includes some traditional transforms, such as DCT transform and DST transform. NSPT and LFNST are a series of transform coefficients obtained from a universal training set based on the optimal transform. The difference between NSPT and LFNST is that NSPT is directly used to transform the residual coefficients, while LFNST further transforms the transform coefficients after DCT2 transform.
[0157] For traditional prediction modes (Planar, DC, and Angular modes), methods such as Inseparable Single Transform (NSPT) or Inseparable Double Transform (LFNST) pre-defined transform sets can be mapped to different transform kernels based on a mapping relationship, such as a lookup table. In the reference software, NSPT and LFNST divide traditional intra-frame prediction modes into 35 groups, each with 3 selectable transform kernels. Table 1 shows the correspondence between traditional intra-frame prediction modes and transform kernel groups.
[0158] Table 1
[0159] In addition, the basic transform can also be divided into multiple groups according to different traditional intra-frame prediction modes, and the transform kernel of the corresponding group can be selected according to the traditional intra-frame prediction mode.
[0160] Non-traditional intra-prediction modes in related technologies can match their prediction blocks to traditional intra-prediction modes (e.g., planar mode or angular direction 2-66) based on predefined rules or derivation processes. Then, the matched traditional intra-prediction mode maps the prediction blocks to preset transform kernels such as MTS, NSPT, LFNST, or other single-transform (separable or indivisible) or double-transform (separable or indivisible) kernels. For example, DIMD mode selects a transform kernel based on its derived optimal angular mode; MIP, IntraTMP, and other modes derive the optimal traditional prediction mode based on the predicted values on their prediction blocks using a gradient derivation method similar to DIMD, and select a transform kernel accordingly.
[0161] In related technologies, specialized LFNST and NSPT transform kernels can be trained for non-traditional intra-prediction modes, distinct from those used in traditional intra-prediction modes, thereby improving coding efficiency. One implementation first determines the LFNST (or NSPT) category based on the prediction mode of the current block. For example, DIMD, TIMD, SGPM, and EIP modes are category one; IntraTMP and inter-frame prediction are category two; otherwise, they are category three. Within the corresponding category of transform kernels, the transform set of the corresponding group is selected based on the intra-prediction mode matching the prediction block. Then, a selection is made from the current transform kernel group based on syntax elements such as the LFNST index.
[0162] (4) Intra Template Matching Prediction (IntraTMP).
[0163] Intra-Template Matching Prediction (IntraTMP) is a special intra-frame predictive coding tool. IntraTMP primarily works through the following process: selecting reconstructed L-shaped samples adjacent to the current block as templates; searching for the most similar template within the given reconstructed region of the current frame; and using the reconstructed block corresponding to the most similar template as the matching block, which is then used as the prediction block for the current block. As shown in Figure 8, R1 to R4 are the available IntraTMP search regions. Matching blocks are then searched point-by-point within these regions in raster scan order.
[0164] The codec uses the intra_tmp_flag flag to indicate whether the current coded block is encoded in IntraTMP mode. If IntraTMP mode is used, the same template matching process is performed at the decoder to obtain the same predicted block, without the need for additional encoding of the block vector information from the current coded block to the matching block.
[0165] One way to search for IntraTMP is to divide the search process into two steps: first is the sparse search, and then the refinement search. The sparse search is to perform template matching with a step size S (that is, every S points in the horizontal and vertical directions, S > 1). For example, in the search area, instead of searching for matching blocks point by point, it searches at intervals in the horizontal and vertical directions. Exemplarily, if the current block vector for template matching is (X0, Y0), then the next block vector for template matching should be (X0 + S, Y0), and the ordinate of the block vector for template matching in the next row should be Y0 + S. The refinement search is to perform template matching with a smaller step size S' in the adjacent area of the best matching block vector according to the search results of the sparse search. Among them, Figure 9A is a schematic diagram of template matching for the sparse search, that is, the current block performs template matching with a step size S (S > 1); Figure 9B is a schematic diagram of template matching for the refinement search, that is, the current block performs template matching with a step size S' (1 ≤ S' < S).
[0166] IntraTMP can be combined with the Merge List (IntraTMP with Merge Candidates) to expand the search process of IntraTMP or the IntraTMP candidate block vector list according to the block vector information in the Merge List. Exemplarily, according to the sparse search, a Sparse list is obtained, a Merge list is constructed and merged with the Sparse list to obtain a larger candidate block vector list. The refinement search is performed according to this new list to improve the search effect.
[0167] Furthermore, to address the issue of potentially redundant search regions in the fine-grained search, the IntraTMP merge candidate clustering based on refinement window technique proposes a method to cluster refinement windows based on the refinement windows corresponding to sparse block vector candidates, thereby removing redundancy during the search. The refinement window represents the block vector search range in the subsequent fine-grained search stage and is determined by the optimal block vectors obtained in the sparse search stage. As shown in Figure 10, when the two refinement windows indicated by BV1 and BV2 overlap, if the template error of BV1 is less than that of BV2, then BV1 is added to the sparse search candidate list based on its template error. Simultaneously, the refinement window corresponding to BV1 is adjusted to a window that includes both the original refinement window of BV1 and the refinement window of BV2. As shown in Figure 10, the process of clustering the refinement window is provided here. The left side shows that the refinement window is clustered during the sparse list construction process. When the refinement window of the candidate block vector BV2 overlaps with the refinement window of BV1 in the sparse list, the refinement window of BV1 is adjusted to include both original windows. The right side shows that in the fine search stage, a fine search is performed based on the refinement window of BV1 in the sparse list.
[0168] Therefore, existing BVG-DIMD techniques utilize block vectors to indicate reference regions to derive the prediction angle of the current block, achieving higher accuracy in some cases compared to using neighboring samples. However, the reference region is typically larger than the adjacent reconstructed regions, increasing the complexity of the intra-frame mode derivation process in BVG-DIMD. Furthermore, the potential redundancy between reference regions determined from multiple block vectors further reduces the efficiency of the derivation process.
[0169] Based on this, embodiments of this application provide an encoding / decoding method that determines one or more vector parameters of a current block; determines at least one second reference region based on a first reference region indicated by the one or more vector parameters; wherein the second reference region is obtained by merging the first reference regions indicated by at least some of the one or more vector parameters; determines one or more prediction modes of the current block based on the at least one second reference region; wherein the one or more prediction modes are determined based on gradient information derived from the at least one second reference region; and determines prediction samples of the current block based on the one or more prediction modes.
[0170] In this way, after determining one or more vector parameters of the current block, redundancy between reference regions can be removed and complexity reduced by merging the first reference regions indicated by at least some of the vector parameters. Compared with the first reference regions indicated by one or more vector parameters, the size of the reference regions used to derive one or more prediction modes is reduced, which can also reduce the efficiency of the derivation process. Moreover, when deriving the corresponding gradient information based on at least one second reference region, different gradient filters can be adaptively selected according to the size of the current block, further reducing complexity. Thus, when the current block is predicted using the BVG-DIMD mode, complexity can be reduced, compression efficiency can be improved, and encoding and decoding performance can be enhanced.
[0171] The embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0172] Figure 11 is a schematic diagram of a video encoding and decoding network architecture provided in an embodiment of this application. As shown in Figure 11, the network architecture includes one or more electronic devices 13 to 1N and a communication network 01, wherein the electronic devices 13 to 1N can perform video interaction through the communication network 01. The electronic devices can be various types of devices with video encoding and decoding capabilities, such as mobile phones, tablets, personal computers, personal digital assistants, navigators, digital phones, video phones, televisions, sensing devices, servers, etc., and this embodiment of the application does not limit the scope of the application.
[0173] This application provides a network architecture for a video encoding / decoding system that includes decoding and encoding methods. The decoder or encoder in this application can be the aforementioned electronic device. That is, the electronic device in this application has video encoding / decoding capabilities and generally includes a video / image encoder (referred to as an encoder) and a video / image decoder (referred to as a decoder).
[0174] Figure 12 is a schematic block diagram of an encoder provided in an embodiment of this application. As shown in Figure 12, the encoder 100 may include a transform and quantization unit 101, an intra-frame estimation unit 102, an intra-frame prediction unit 103, a motion compensation unit 104, a motion estimation unit 105, an inverse transform and inverse quantization unit 106, a filter control and analysis unit 107, a filtering unit 108, an encoding unit 109, and a decoded image buffer unit 110, etc. Among them, the filtering unit 108 can implement deblocking filtering and sample adaptive offset (SAO) filtering, and the encoding unit 109 can implement header information encoding and context-based adaptive binary arithmetic coding (CABAC).For the input raw video signal, a video coding block can be obtained by partitioning it through a Coding Tree Unit (CTU). Then, the residual sample information obtained after intra-frame or inter-frame prediction is transformed by the transform and quantization unit 101, including transforming the residual information from the sample domain to the transform domain and quantizing the resulting transform coefficients to further reduce the bit rate. The intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to perform intra-frame prediction on the video coding block. Specifically, the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to determine the intra-frame prediction mode to be used to encode the video coding block. The motion compensation unit 104 and the motion estimation unit 105 are used to perform inter-frame prediction coding of the received video coding block relative to one or more blocks in one or more reference frames to provide time prediction information. The motion estimation performed by the motion estimation unit 105 is a process of generating motion vectors, which can estimate the motion of the video coding block. Then, the motion compensation unit 104 is used to perform the motion estimation based on the motion vectors determined by the motion estimation unit 105. The motion compensation is performed. After determining the intra-prediction mode, the intra-prediction unit 103 is also used to provide the selected intra-prediction data to the coding unit 109, and the motion estimation unit 105 also sends the calculated motion vector data to the coding unit 109. In addition, the inverse transform and inverse quantization unit 106 is used to reconstruct the video coding block, reconstruct the residual block in the sample domain, and remove the block artifacts by the filter control analysis unit 107 and the filtering unit 108. Then, the reconstructed residual block is added to a predictive block in the frame of the decoding image buffer unit 110 to generate the reconstructed video coding block. The coding unit 109 is used to encode various coding parameters and quantized transform coefficients. In the CABAC-based coding algorithm, the context content can be based on adjacent coding blocks and can be used to encode information indicating the determined intra-prediction mode and output the bitstream of the video signal. The decoding image buffer unit 110 is used to store the reconstructed video coding block for prediction reference. As video image encoding proceeds, new reconstructed video encoding blocks are continuously generated, and these reconstructed video encoding blocks are stored in the decoding image buffer unit 110.
[0175] Figure 13 is a schematic block diagram of a decoder provided in an embodiment of this application. As shown in Figure 13, the decoder 200 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra-frame prediction unit 203, a motion compensation unit 204, a filtering unit 205, and a decoded image buffer unit 206, etc. The decoding unit 201 can perform header information decoding and CABAC decoding, and the filtering unit 205 can perform deblocking filtering and SAO filtering. After the input video signal undergoes the encoding processing shown in Figure 12, the bitstream of the video signal is output. This bitstream is input into the decoder 200, first passing through the decoding unit 201 to obtain the decoded transform coefficients. The transform coefficients are then processed by the inverse transform and inverse quantization unit 202 to generate residual blocks in the sample domain. The intra-frame prediction unit 203 can be used to generate prediction data for the current video decoding block based on the determined intra-frame prediction mode and data from previously decoded blocks in the current frame or image. The motion compensation unit 204 determines the prediction information for the video decoding block by analyzing motion vectors and other associated syntax elements, and uses... The prediction information is used to generate a predictive block of the video block being decoded; the decoded video block is formed by summing the residual block from the inverse transform and inverse quantization unit 202 with the corresponding predictive block generated by the intra-prediction unit 203 or the motion compensation unit 204; the decoded video signal is passed through the filtering unit 205 to remove block artifacts, which can improve video quality; then the decoded video block is stored in the decoding image buffer unit 206, which stores reference images for subsequent intra-prediction or motion compensation, and is also used for the output of the video signal, thus obtaining the recovered original video signal.
[0176] It should be noted that the method in this application embodiment affects the intra-frame prediction and transform parts in the video coding hybrid framework. For example, it mainly acts on the transform and quantization unit 101, the inverse transform and inverse quantization unit 106, the intra-frame estimation unit 102, and the intra-frame prediction unit 103 as shown in FIG12, and the inverse transform and inverse quantization unit 202 and the intra-frame prediction unit 203 as shown in FIG13. That is to say, this method can be applied to the encoder, the decoder, or even to both the encoder and the decoder simultaneously, without any limitation.
[0177] It should also be noted that when the embodiments of this application are applied to the encoder 100, the "current block" can refer to the block to be encoded in the video image (also known as the "encoded block"); when the embodiments of this application are applied to the decoder 200, the "current block" can refer to the block to be decoded in the video image (also known as the "decoded block").
[0178] In one embodiment of this application, Figure 14 is a schematic flowchart of a decoding method provided in this application. As shown in Figure 14, the method may include:
[0179] S1401, determines one or more vector parameters of the current block.
[0180] It should be noted that in this embodiment, the method is applied to the decoder. Based on the composition structure of the decoder 200 shown in Figure 13, the decoding method of this embodiment can be applied to the intra-frame prediction and transform part, mainly as an improved scheme for the block vector indication DIMD method (i.e., BVG-DIMD), which can reduce the complexity of gradient calculation.
[0181] It should also be noted that, in the embodiments of this application, the vector parameters here may include block vector parameters and motion vector parameters. This article mainly uses block vector parameters as an example for related description.
[0182] In this embodiment, the vector parameters of the current block can be determined first. The number of vector parameters can be one or more; no specific limit is placed on the number of vector parameters here.
[0183] In the embodiments of this application, one or more implementation methods can be selected to determine the vector parameters of the current block. For example, the vector parameters of the current block can be determined by the reconstructed adjacent blocks corresponding to the current block, by constructing a vector candidate list, or by intra-frame template matching search. No specific limitation is made here.
[0184] In one possible implementation, when determining the vector parameters of the current block, the decoded neighboring blocks of the current block can be determined first; then, based on the vector parameters of the decoded neighboring blocks, one or more vector parameters of the current block can be determined.
[0185] It is understood that, in the embodiments of this application, adjacent blocks can be determined first based on the position and size information of the current block. For example, the positions of adjacent blocks can be determined based on the position of the current block and its width and height (x, y, cbWidth, cbHeight). For example, the positions of adjacent blocks can be (x-1, y), (x, y-1), (x-1, y+cbHeight-1), (x+cbWidth-1, y-1), (x-1, y-1), etc.
[0186] It is also understood that, in the embodiments of this application, after determining the adjacent blocks, the vector parameters of the adjacent blocks can be further determined, and then the vector parameters of the current block can be determined based on the vector parameters of the adjacent blocks. Taking (x1, y1) as an example, it is determined whether the coding unit to which the position (x1, y1) belongs contains vector parameters (for example, determining whether the adjacent block is IBC, IntraTMP or other BVG mode decoding, or determining whether the IBC flag bit of the decoding information motionInfo[x1][y1] at this position is true).
[0187] It is also understood that, in the embodiments of this application, when determining the vector parameters of the current block based on the vector parameters of neighboring blocks, an availability judgment of the vector parameters can also be performed. Specifically, if a neighboring block contains vector parameters, it is determined whether the vector parameters are available for the current block. If available, the vector parameters are used as the vector parameters of the current block. It should be noted that the availability of vector parameters means that all samples of the reference block referred to by the current block based on these vector parameters are within the intra-frame reconstruction range based on the current block.
[0188] In another possible implementation, when determining the vector parameters of the current block, a list of vector candidates can be constructed first, and then one or more vector parameters of the current block can be determined based on the list of vector candidates.
[0189] It is understood that, in the embodiments of this application, the candidate vector parameters in the vector candidate list include at least one of the following:
[0190] Vector parameters of decoded adjacent blocks;
[0191] Vector parameters of decoded non-adjacent blocks;
[0192] History vector parameters of decoded blocks;
[0193] Temporal vector parameters of the decoded image;
[0194] Predefined vector parameters;
[0195] The average vector parameter is obtained based on one or more candidate vector parameters in the vector candidate list;
[0196] Relocation vector parameters are obtained based on one or more candidate vector parameters from the vector candidate list.
[0197] For example, the vector parameters of the decoded adjacent blocks include the vector parameters used by the decoded blocks in the row or column positions adjacent to the current block; the vector parameters of the decoded non-adjacent blocks include the vector parameters used by the decoded blocks in the row or column positions not adjacent to the current block; the historical vector parameters of the decoded blocks include the vector parameters used by blocks that have been decoded before the current block in the decoding order, stored in a cache; the vector parameters corresponding to the reference image of the current image include the vector parameters obtained from the reference image of the current image (which may be a referenced decoded image or a co-located image) when the current image is an inter-frame prediction frame; the predefined vector parameters include the vector parameters and / or zero vector parameters obtained according to the current block size; the average vector parameters obtained based on one or more candidate vector parameters in the vector candidate list include the vector parameters obtained by averaging the existing vector parameters in the constructed vector candidate list; the relocation vector parameters obtained based on one or more candidate vector parameters in the vector candidate list include the vector candidates constructed by the existing vector parameters in the constructed vector candidate list and the vector parameters contained in the reference positions they point to.
[0198] It should be noted that, in the embodiments of this application, when constructing the vector candidate list, the availability of the candidate vector parameters can be judged, and the order and / or number of the candidate vector parameters in the vector candidate list can be adjusted.
[0199] For example, when constructing the vector candidate list, candidate vector parameters can be checked in any order, and when a candidate vector parameter is available for the current block, it is added to the vector candidate list.
[0200] For example, the vector candidate list can be defined with a maximum length, and when the vector candidate list exceeds the maximum length, no further candidate vector parameters are added to the vector candidate list.
[0201] For example, each type of candidate vector parameter can have a maximum length, such as no more than 5 vector parameters for decoded adjacent blocks, no more than 3 vector parameters for decoded non-adjacent blocks, etc.
[0202] For example, the constructed list of candidate vectors can be further reordered based on template error.
[0203] In another possible implementation, when determining the vector parameters of the current block, the search region and the template type of the current block can be determined; then, a search is performed within the search region according to the template type of the current block to determine the template error corresponding to at least one candidate vector parameter; finally, one or more vector parameters of the current block can be determined based on the template error.
[0204] In other words, in this embodiment of the application, one or more vector parameters of the current block can be determined by intra-frame template matching search. The IntraTMP search process may include: first determining the search region and the template type of the current block; then calculating the template error value for each possible candidate vector parameter. Based on the template error values of each candidate vector parameter throughout the search process, one or more candidate vector parameters with the smallest template error value can be determined as one or more vector parameters of the current block.
[0205] For example, the IntraTMP search step may include one or more of the following:
[0206] a) Search within a predefined region;
[0207] b) Phased search. For example, the first phase searches within a predefined region with a step size S to obtain at least one optimal vector parameter; the second phase searches within the neighborhood of this at least one vector parameter with a step size s.
[0208] c) Different template types. Searches can be performed based on L-shaped templates, left templates, or top templates;
[0209] d) Merged list-based search. A merged list of vector parameters can be constructed, and a search can be performed in the neighborhood of each candidate vector parameter;
[0210] e) Merge search windows. Neighboring search areas can be combined to create new search areas, thereby improving search efficiency.
[0211] In another possible implementation, when determining the vector parameters of the current block, k2 vector parameters can be determined based on the k1 vector parameters already obtained; then the k1 and k2 vector parameters are determined as one or more vector parameters of the current block; where k1 and k2 are both positive integers, n = k1 + k2, and n represents the number of one or more vector parameters.
[0212] It is understood that, in the embodiments of this application, after determining the vector parameters of the current block using one or more of the methods described above, the vector parameters can be expanded based on the already determined vector parameters to determine a larger number of vector parameters for the current block.
[0213] It is also understood that, in the embodiments of this application, when expanding based on the already determined vector parameters, one or more already determined vector parameters can be directly reused, or new vector parameters can be generated based on one or more already determined vector parameters, without specific limitations.
[0214] In some embodiments, the method may further include: determining a total number n of one or more vector parameters of the current block based on the size information and / or the position information of the current block.
[0215] Exemplarily, assume that there are n vector parameters of the current block, and k1 vector parameters (0 < k1 < n) are initially obtained by using one or more of the above methods. At this time, the k1 vector parameters can be used to fill the total number of vector parameters from k1 to n, that is, n = k1 + k2. For example, the remaining k2 vector parameters are all equal to any one of the k1 vector parameters or equal to new vector parameters derived from one or more of the k1 vector parameters.
[0216] S1402. Determining at least one second reference region according to the first reference region indicated by one or more vector parameters; wherein, the second reference region is obtained by merging the first reference regions indicated by at least some of the one or more vector parameters.
[0217] It should be noted that in the embodiments of the present application, in order to reduce complexity, the first reference regions indicated by at least some of the one or more vector parameters can be merged to obtain a target reference region (or can be called "aggregated reference region"). In some embodiments, the method may include: when there is an overlap between the first reference regions indicated by at least some of the one or more vector parameters, merging the first reference regions indicated by at least some of the vector parameters to determine the second reference region.
[0218] That is to say, in the embodiments of the present application, if there is an overlap between the first reference regions indicated by multiple vector parameters, a second reference region can be constructed to replace the original multiple first reference regions, avoiding multiple gradient derivations at the same position and improving the derivation efficiency.
[0219] In some embodiments, determining at least one second reference region according to the first reference region indicated by one or more vector parameters may include: determining whether the i-th vector parameter is marked as having been used for reference region merging; when the i-th vector parameter is not marked as having been used for reference region merging, determining the current reference region indicated by the i-th vector parameter; and determining at least one second reference region according to the current reference region and the one or more first reference regions indicated by the one or more vector parameters that have not been used for reference region merging.
[0220] In the embodiments of the present application, i is an integer greater than 0 and less than or equal to n, and n represents the number of one or more vector parameters.
[0221] It should also be noted that, in this embodiment, n vector parameters are checked sequentially. If the i-th vector parameter is marked as being used for reference region merging, then the check of the (i+1)-th vector parameter is performed. For example, the processing of the first reference region indicated by the i-th vector parameter can be skipped to determine whether the (i+1)-th vector parameter is marked as being used for reference region merging. If the i-th vector parameter is not marked as being used for reference region merging, then the first reference region indicated by the i-th vector parameter is taken as the current reference region, and a reference region merging operation is performed based on the current reference region and one or more first reference regions not used for reference region merging indicated by one or more vector parameters. These steps are repeated until i equals n, that is, when all one or more vector parameters have been traversed, at least one second reference region can be obtained.
[0222] In some embodiments, taking the generation of one of the second reference regions as an example, the method may include, based on the current reference region and one or more first reference regions not used for reference region merging, indicated by one or more vector parameters, as shown in Figure 15:
[0223] S1501, determine whether the j-th vector parameter has been marked as used for reference region merging.
[0224] S1502, when the j-th vector parameter is not marked as being used for reference region merging, obtain the first reference region indicated by the j-th vector parameter.
[0225] S1503, if the first reference region indicated by the j-th vector parameter overlaps with the current reference region, then the first reference region indicated by the j-th vector parameter and the current reference region are merged to obtain a new reference region.
[0226] S1504, if a new reference region is available, update the current reference region of the current block using the new reference region, and mark the j-th vector parameter as having been used for reference region merging.
[0227] S1505, determine if j is equal to n.
[0228] S1506, if j is less than n, then j = j + 1.
[0229] S1507: After traversing n vector parameters, the current reference region obtained at the end is determined as the second reference region.
[0230] In this embodiment, j is an integer greater than i and less than or equal to n. That is, if the current reference region is determined based on the i-th vector parameter, then the next reference region can be determined, i.e., j = i + 1. In this case, the first reference region indicated by the j-th vector parameter is the next reference region.
[0231] It is understood that, in the embodiments of this application, when checking the j-th vector parameter, for step S1501, it is determined whether the j-th vector parameter is marked as being used for reference region merging, that is, whether the index corresponding to the j-th vector parameter is marked as being used for reference region merging. If the j-th vector parameter is marked as being used for reference region merging, then step S1506 can be executed, that is, continue to check the (j+1)-th vector parameter. For example, the j-th vector parameter can be skipped, and at this time, the first reference region indicated by the j-th vector parameter is no longer processed.
[0232] It is also understood that, in the embodiments of this application, if the j-th vector parameter is not marked as being used for reference region merging, then steps S1502 to S1504 can be executed. At this time, the first reference region indicated by the j-th vector parameter is obtained, and then it is determined whether the first reference region indicated by the j-th vector parameter overlaps with the current reference region. If the first reference region indicated by the j-th vector parameter overlaps with the current reference region, then the first reference region indicated by the j-th vector parameter and the current reference region can be merged to obtain a new reference region. And if the new reference region is available, the new reference region is used as the current reference region of the current block, and the j-th vector parameter is marked as being used for reference region merging. Then, the (j+1)-th vector parameter is checked until all one or more vector parameters are traversed, and the finally obtained current reference region is determined as the second reference region.
[0233] In some embodiments, determining whether the first reference region indicated by the j-th vector parameter overlaps with the current reference region may include the following four judgment conditions:
[0234] Is the left side of the current reference region to the right of the right side of the first reference region indicated by the j-th vector parameter?
[0235] Is the right side of the current reference region to the left of the left side of the first reference region indicated by the j-th vector parameter?
[0236] Is the upper side of the current reference region below the lower side of the first reference region indicated by the j-th vector parameter?
[0237] Is the lower side of the current reference region above the upper side of the first reference region indicated by the j-th vector parameter?
[0238] In one possible implementation, the method may further include: if any one of the four judgment conditions is satisfied, then it is determined that the first reference region indicated by the j-th vector parameter does not overlap with the current reference region.
[0239] In this embodiment, for the first reference region indicated by the j-th vector parameter, the first top-left vector parameter pointing to the top-left corner is (nextTL_x, nextTL_y), and the first bottom-right vector parameter pointing to the bottom-right corner is (nextBR_x, nextBR_y); for the current reference region, the second top-left vector parameter pointing to the top-left corner is (currTL_x, currTL_y), and the second bottom-right vector parameter pointing to the bottom-right corner is (currBR_x, currBR_y). The judgment condition at this time can be:
[0240] a) The left side of the current reference region is to the right of the right side of the first reference region indicated by the j-th vector parameter, i.e., currTL_x>nextBR_x;
[0241] b) The right side of the current reference region is to the left of the left side of the first reference region indicated by the j-th vector parameter, i.e., currBR_x <nextTL_x;
[0242] c) The upper side of the current reference region is below the lower side of the first reference region indicated by the j-th vector parameter, i.e., currTL_y>nextBR_y;
[0243] d) The lower edge of the current reference region is above the upper edge of the first reference region indicated by the j-th vector parameter, i.e., currBR_y <nextTL_y。
[0244] If any one of the four judgment conditions a) to d) is satisfied, then it can be determined that the first reference region indicated by the j-th vector parameter does not overlap with the current reference region.
[0245] In another possible implementation, the method may further include: if all four judgment conditions are not met, then it is determined that the first reference region indicated by the j-th vector parameter overlaps with the current reference region.
[0246] In the embodiments of this application, if all four judgment conditions a) to d) are not satisfied, that is, currTL_x≤nextBR_x, currBR_x≥nextTL_x, currTL_y≤nextBR_y, and currBR_y≥nextTL_y, then it can be determined that the first reference region indicated by the j-th vector parameter does not overlap with the current reference region.
[0247] In some embodiments, if the first reference region indicated by the j-th vector parameter does not overlap with the current reference region, then the (j+1)-th vector parameter is checked. That is, if the j-th vector parameter is not marked as being used for reference region merging, but the first reference region indicated by the j-th vector parameter does not overlap with the current reference region, then the (j+1)-th vector parameter is checked until j = n, i.e., all these one or more vector parameters are traversed to obtain the merged second reference region.
[0248] In some embodiments, taking the merging of the first reference region indicated by the j-th vector parameter with the current reference region as an example, the method may include: determining the first upper-left corner vector parameter and the first lower-right corner vector parameter corresponding to the first reference region indicated by the j-th vector parameter, and determining the second upper-left corner vector parameter and the second lower-right corner vector parameter corresponding to the current reference region; determining the third upper-left corner vector parameter based on the first upper-left corner vector parameter and the second upper-left corner vector parameter; determining the third lower-right corner vector parameter based on the first lower-right corner vector parameter and the second lower-right corner vector parameter; and obtaining a new reference region based on the third upper-left corner vector parameter and the third lower-right corner vector parameter.
[0249] In this embodiment of the application, for the new reference region, the third upper-left corner vector parameter pointing to the upper-left corner is (tempTL_x, tempTL_y), and the third lower-right corner vector parameter pointing to the lower-right corner is (tempBR_x, tempBR_y), where: tempTL_x = currTL_x <nextTL_x?currTL_x:nextTL_x; tempTL_y=currTL_y<nextTL_y?currTL_y:nextTL_y; tempBR_x=currBR_x> nextBR_x? currBR_x:nextBR_x; tempBR_y=currBR_y>nextBR_y? currBR_y:nextBR_y.
[0250] In this embodiment, after obtaining the new reference region determined by (tempTL_x, tempTL_y) and (tempBR_x, tempBR_y), it can be determined whether the new reference region is usable. For example, the sample located at (x0+tempBR_x, y0+tempBR_y) pointed to by the third lower right corner vector parameter should have been reconstructed, where (x0, y0) are the coordinates of the upper left corner of the current block.
[0251] In one possible implementation, the method may include determining whether a new reference region is available if the new reference region is located within a predefined region.
[0252] It should be noted that, in the embodiments of this application, the predefined region may include regions in the current image that have already been reconstructed. The predefined region includes, but is not limited to: reconstructed regions determined based on the location information and / or size information of the current block; reconstructed regions determined based on the size information of the coding tree unit to which the current block belongs; and all or part of the reconstructed regions in the current image to which the current block belongs.
[0253] In another possible implementation, the method may further include determining whether a new reference region is available if the size of the new reference region does not exceed the maximum allowable size.
[0254] It should also be noted that, in the embodiments of this application, since the current reference area may be adjusted multiple times, resulting in the final reference area being too large, it is necessary to limit the size of the new reference area, for example, by setting a maximum allowable size (i.e., the maximum value of the reference area).
[0255] In some embodiments, the maximum allowed size may be a fixed value. Alternatively, in other embodiments, the maximum allowed size may be related to preset parameters, which may include at least: the size of the current block, and / or, the number of times the current reference region has been merged.
[0256] In other words, in this embodiment, additional judgments can be added to limit the size of the new reference region. For example, a maximum allowed size can be set to K. If the size of the new reference region, size = (tempBR_x - tempTL_x + 1) × (tempBR_y - tempTL_y + 1), is greater than K, then the new reference region is considered unusable. Here, K can be a fixed value, or a value related to the current block size, the number of times it has been merged, etc. For example, K = (q + 2) × width × height, where q is the number of times the current reference region has been merged, that is, the number of times it has been adjusted through merging.
[0257] It should also be noted that when a new reference region is available, the current reference region is set to equal the new reference region, i.e., currTL = tempTL, currBR = tempBR. Thus, for the resulting second reference region, the top-left corner coordinates are (x0 + currTL_x, y0 + currTL_y), the width is currBR_x - currTL_x + 1, and the height is currBR_y - currTL_y + 1. The DIMD gradient operator can be applied within this reference region to construct the gradient histogram of the current block.
[0258] In the embodiments of this application, the above steps can be repeated until i = n, that is, after traversing one or more vector parameters, at least one second reference region can be obtained, and all of these at least one second reference regions participate in the construction of the gradient histogram.
[0259] For example, assuming n = 5, that is, after determining the 5 vector parameters (BVi, i = 1, 2, ... 5) of the current block, firstly, i = 1, that is, check the first vector parameter BV1. If BV1 is not marked as being used for reference region merging, then the first reference region indicated by BV1 is taken as the current reference region. Then check whether the second vector parameter BV2 is marked as being used for reference region merging. If BV2 is not marked as being used for reference region merging, and the first reference region indicated by BV2 does not overlap with the current reference region, then continue to check whether the third vector parameter BV3 is marked as being used for reference region merging. If BV3 is not marked as being used for reference region merging, and the first reference region indicated by BV3 overlaps with the current reference region, then the first reference region indicated by BV3 is taken as the current reference region. A reference region is merged with the current reference region to obtain a new reference region. If the new reference region is available, it can be designated as the current reference region, and BV3 is marked as used for reference region merging. The process continues to check whether the fourth vector parameter BV4 is marked as used for reference region merging. If BV4 is not marked as used for reference region merging, and the first reference region indicated by BV4 does not overlap with the current reference region, the process continues to check whether the fifth vector parameter BV5 is marked as used for reference region merging. If BV5 is not marked as used for reference region merging, and the first reference region indicated by BV5 does not overlap with the current reference region, after traversing these 5 vector parameters, the final current reference region is designated as the first second reference region.
[0260] Then, i=2, that is, check the second vector parameter BV2. If BV2 is not marked as being used for reference region merging, then the first reference region indicated by BV2 is taken as the current reference region. Then check whether the third vector parameter BV3 is marked as being used for reference region merging. If BV3 is marked as being used for reference region merging, then continue to check whether the fourth vector parameter BV4 is marked as being used for reference region merging. If BV4 is not marked as being used for reference region merging, and the first reference region indicated by BV4 overlaps with the current reference region, then merge the first reference region indicated by BV4 with the current reference region to obtain a new reference region. If the new reference region is available, then the new reference region can be determined as the current reference region, and BV4 is marked as being used for reference region merging. Continue to check whether the fifth vector parameter BV5 is marked as being used for reference region merging. If BV5 is not marked as being used for reference region merging, and the first reference region indicated by BV5 does not overlap with the current reference region, then after traversing these 5 vector parameters, the final current reference region is determined as the second second reference region.
[0261] Then i=3, that is, check the third vector parameter BV3. If BV3 is marked as used for reference region merging, then i=4, that is, check the fourth vector parameter BV4. If BV4 is marked as used for reference region merging, then i=5, that is, check the fifth vector parameter BV5. If BV5 is not marked as used for reference region merging, then the first reference region indicated by BV5 can be determined as the third second reference region to obtain three second reference regions for gradient histogram construction.
[0262] In some embodiments, the number of repetitions described above is related to the number of second reference regions. Embodiments of this application may also limit the number of repetitions, i.e., limit the number of second reference regions ultimately used for gradient histogram construction. In one possible implementation, the number of second reference regions is a preset constant. For example, only the second reference regions determined based on the first vector parameter BV1 are used for gradient derivation, and the remaining unmerged vector parameters are not used for gradient derivation.
[0263] In this way, by merging the overlapping parts of the first reference regions indicated by one or more vector parameters, it is possible to avoid performing multiple DIMD derivations at the same location, thus solving the problem of redundancy between the first reference regions determined by multiple vector parameters, thereby reducing the complexity of gradient derivation and improving the efficiency of the derivation process.
[0264] S1403, determine one or more prediction modes for the current block based on at least one second reference region; wherein the one or more prediction modes are determined based on gradient information derived from at least one second reference region.
[0265] In this embodiment, after obtaining at least one second reference region, these at least one second reference region are used for gradient derivation to determine one or more prediction modes for the current block. In some embodiments, referring to FIG16, the method may include:
[0266] S1601, determine the gradient filter for the current block.
[0267] S1602, determine the gradient information of the current block based on at least one second reference region and gradient filter; wherein the gradient information includes at least one candidate prediction mode and the magnitude accumulation value corresponding to at least one candidate prediction mode.
[0268] S1603, construct the gradient histogram of the current block based on at least one candidate prediction mode and the magnitude accumulation value corresponding to at least one candidate prediction mode.
[0269] S1604, Based on the gradient histogram, determine one or more prediction modes for the current block.
[0270] It should be noted that, in this embodiment, the gradient filter for the current block can be determined based on the size of the current block. In other words, different gradient filters are adaptively selected based on the size of the current block, thereby further reducing the complexity of gradient calculation.
[0271] In one possible implementation, determining the gradient filter for the current block based on its size may include: if the size of the current block is less than a size threshold, determining the gradient filter for the current block as a first shape filter; if the size of the current block is greater than the size threshold, determining the gradient filter for the current block as a second shape filter.
[0272] In this embodiment, considering that the DIMD mode can adaptively select gradient operators (or "gradient filters") of different sizes based on the size of the block, the BVG-DIMD mode can also adaptively select gradient filters based on the size of the block. For example, if the size of the current block is smaller than a size threshold, for example, a size threshold set to 32, then a first shape filter, such as a 2×2 gradient filter, is used, as shown below: and
[0273] If the size of the current block is larger than the size threshold (e.g., set to 32), then a second shape filter is used, such as a 3×3 gradient filter, as shown below: and
[0274] It should be noted that in the embodiments of this application, if the size of the current block is equal to the size threshold, then the gradient filter of the current block can be a first shape filter, such as the formula (10) above; or the gradient filter of the current block can also be a second shape filter, such as the formula (11) above, without specific limitation here.
[0275] It should also be noted that, in this embodiment, the gradient filter for the current block is determined based on its size and applied to samples within the second reference region. Dx (corresponding to the vertical gradient value Gy) and Dy (corresponding to the horizontal gradient value Gx) at different positions are calculated to determine the corresponding angle prediction mode and gradient magnitude, thereby completing the construction of the gradient histogram. Figure 17A is a schematic diagram of the application of a 3×3 gradient filter in the reference region provided in this embodiment, and Figure 17B is a schematic diagram of the application of a 2×2 gradient filter in the reference region provided in this embodiment. As can be seen from Figures 17A and 17B, the application range within the reference region differs due to the different sizes of the gradient filters.
[0276] In some embodiments, determining the gradient information of the current block based on at least one second reference region and a gradient filter may include: determining the angle prediction mode and gradient magnitude corresponding to each reference sample in at least one second reference region based on the reference samples in at least one second reference region and the gradient filter; determining at least one candidate prediction mode based on the angle prediction mode and gradient magnitude corresponding to each reference sample in at least one second reference region; and performing an accumulation operation on the gradient magnitudes belonging to the same candidate prediction mode to obtain the magnitude accumulation value corresponding to at least one candidate prediction mode.
[0277] In this embodiment of the application, for each reference sample in the second reference region, the angle prediction mode and gradient magnitude corresponding to each reference sample can be calculated according to the aforementioned formulas (2) and (3). Then, for this at least one candidate prediction mode (e.g., prediction angles 2 to 66), the gradient magnitudes belonging to the same candidate prediction mode are accumulated to obtain the magnitude accumulation value (or "cumulative magnitude value") corresponding to at least one candidate prediction mode, thereby constructing a gradient histogram.
[0278] In another possible implementation, the derivation process can be simplified during the construction of the gradient histogram. For example, when calculating the gradient of reference samples within the second reference region based on the gradient filter, the gradient filter is treated as a computation window, and downsampling is performed when determining the computation window. For instance, if the center position of the current computation window is (x, y), then the center position of the next computation window in the horizontal direction can be (x + lenHor, y), and the center position of the next computation window in the vertical direction can be (x, y + lenVer). Here, lenHor and lenVer can take any integer values to determine the sampling interval, thereby further reducing computational complexity.
[0279] Thus, after obtaining the gradient histogram, one or more prediction modes for the current block can be determined based on the gradient histogram. In some embodiments, the method may further include: determining the top m candidate prediction modes with the highest cumulative magnitude values in the gradient histogram as one or more prediction modes for the current block; where m is a positive integer.
[0280] In this embodiment of the application, for the cumulative magnitude value corresponding to each candidate prediction mode in the gradient histogram, it can be sorted from high to low, and the top m candidate prediction modes are used as one or more prediction modes of the current block to determine the prediction samples of the current block.
[0281] S1404, Determine the prediction sample for the current block based on one or more prediction modes.
[0282] In this embodiment, some indication information in the form of syntax elements, or flags, can be written into the bitstream. Thus, by parsing the values of the syntax elements in the bitstream, the prediction mode used by the current block can be determined. For example, the first syntax element can be used to indicate whether the current block uses the intra-frame mode derivation of the block vector indication for prediction, i.e., whether the current block uses the BVG-DIMD mode for prediction.
[0283] In some embodiments, the method may further include: parsing a first syntax element in the bitstream; and when the first syntax element indicates that the current block is predicted using the intra-mode derivation of the decoding end indicated by the block vector, executing the decoding method of this application embodiment, that is, executing the step of determining one or more vector parameters of the current block.
[0284] In this embodiment, the first syntax element can be represented by cu_bvgdimd_flag. The first syntax element serves as an enable flag for the block-level BVG-DIMD mode, indicating whether the current block uses the BVG-DIMD mode for prediction.
[0285] In some embodiments, if the value of the first syntax element is a first value, then the current block is predicted using the BVG-DIMD mode; if the value of the first syntax element is a second value, then the current block is not predicted using the BVG-DIMD mode.
[0286] It should be noted that, in the embodiments of this application, the first value and the second value are different. For example, the first value can be 1 and the second value can be 0; or, the first value can be true and the second value can be false; no limitation is made here.
[0287] In one possible implementation, if the value of the first syntax element is true, it means that the BVG-DIMD mode is used for prediction of the current block; if the value of the first syntax element is false, the BVG-DIMD mode is not used for prediction; if the first syntax element does not exist in the bitstream, it is assumed that the value of the first syntax element is false, that is, the BVG-DIMD mode is not used for prediction of the current block.
[0288] It should also be noted that, in this embodiment of the application, if the current block is predicted using the BVG-DIMD mode, the gradient histogram can be initialized so that the cumulative magnitude value corresponding to each candidate prediction mode is initialized to 0. Then, according to the aforementioned derivation process, the gradient histogram can be constructed, and one or more prediction modes for the current block can be determined accordingly.
[0289] In some embodiments, determining the prediction sample of the current block based on one or more prediction modes may include: determining one or more first prediction blocks based on one or more prediction modes; determining one or more second prediction blocks based on one or more vector parameters; and determining the prediction sample of the current block by weighted fusion of one or more first prediction blocks and one or more second prediction blocks.
[0290] In other words, in this embodiment of the application, the BVG-DIMD mode obtains n vector parameters and one or more prediction modes through the above process, and the final prediction block can be a combination of prediction blocks obtained by these prediction methods. For example, using the m prediction modes with the largest amplitude accumulation value obtained by gradient derivation, m first prediction blocks are generated; using the obtained n vector parameters, n second prediction blocks are obtained, and the block copy prediction block is obtained by fusing these n second prediction blocks. Further, the m first prediction blocks and the block copy prediction block are fused to obtain the final prediction sample. Here, the weighted fusion between these prediction blocks can determine the weight value according to the amplitude accumulation value corresponding to the prediction mode, the template error corresponding to the prediction mode (vector parameter), etc. For example, let the total weight corresponding to the first prediction block be a, for example, a equals 32; let the weight value of the block copy prediction block be b, for example, b equals 32; then combine the aforementioned formulas (4) to (8) to determine the corresponding weight, and finally, according to the weighted fusion of formula (10), the final prediction sample of the current block can be obtained.
[0291] In some embodiments, the method may further include: determining a transform set for the current block; determining a transform kernel for the current block based on the transform set; and performing an inverse transform on the inverse quantization coefficients of the current block based on the transform kernel to determine the residual samples of the current block.
[0292] In this embodiment, the quantization coefficients of the current block in the bitstream are parsed; the inverse quantization coefficients of the current block are dequantized to determine the inverse quantization coefficients of the current block. Then, the inverse quantization coefficients of the current block are inversely transformed (e.g., LFNST, NSPT, etc.) according to the transform kernel to obtain the residual sample of the current block.
[0293] In some embodiments, determining the transform set of the current block may include: determining the transform set category of the current block; and determining the transform set of the current block based on the transform set category.
[0294] It should be noted that, in the embodiments of this application, the transform set category of the current block can be the same as that of the conventional intra-prediction mode. For example, the transform set of the current block can be determined based on a preset intra-prediction mode; or, the transform set of the current block can be determined based on an intra-prediction mode derived from at least one second reference region; or, the transform set of the current block can be determined based on an intra-prediction mode derived from the prediction samples of the current block.
[0295] It should also be noted that, in the embodiments of this application, the transform set category of the current block can also use a special transform set category, that is, a different transform set category than the traditional intra-frame prediction mode.
[0296] In one possible implementation, when the current block is predicted using the decoder intra-mode derivation indicated by the block vector, the transform set category of the current block is determined to be a first category; wherein the first category is the transform set category corresponding to at least one of the decoder intra-predictive mode derivation (DIMD) mode and template-based intra-mode derivation (TIMD) mode.
[0297] In another possible implementation, when the current block is predicted using the intra-mode derivation at the decoding end indicated by the block vector, the transform set category of the current block is determined to be a second category; wherein the second category is the transform set category corresponding to at least one of the IntraTMP mode, the IntraBlock Copy (IBC) mode, and the Inter-Frame Prediction mode.
[0298] In other words, in this embodiment, the prediction block of BVG-DIMD mode is a combination of the prediction block of traditional intra-frame prediction mode and block copy prediction. Therefore, when combined with technologies such as LFNST and NSPT, its transform kernel category (or transform set, set of transform kernels, etc.) can be different from that of traditional intra-frame prediction mode. One possible implementation is that the BVG-DIMD decoding block and the DIMD decoding block (or TIMD decoding block) use the same transform set category. Another possible implementation is that the BVG-DIMD decoding block and the IntraTMP decoding block (or IBC decoding block, inter-frame prediction decoding block) use the same transform set category. Based on the above transform set classification method, when the residual samples (or residual coefficients) of the BVG-DIMD decoding block are transformed (which can be a single transformation, such as MTS, NSPT, or a two-stage transformation, such as LFNST), the corresponding transform set is selected; then the corresponding transform kernel is determined according to the transform set.
[0299] In some embodiments, the method may further include: parsing the transform kernel index in the bitstream; and determining the transform kernel of the current block based on the transform set and the transform kernel index.
[0300] In this embodiment, the transform set may include multiple candidate transform kernels, such as 3, 4, or 5 candidate transform kernels. Here, the transform kernel index can be represented by lfnstIdx, indicating the index number of the transform kernel of the current block in the transform set of the current block. Thus, after determining the transform set of the current block, the selected transform kernel can be determined from the transform set for use in the transform process of the current block.
[0301] It is also understood that, in the embodiments of this application, after obtaining the residual sample and the predicted sample of the current block, the reconstruction sample of the current block can be determined based on the residual sample and the predicted sample of the current block. For example, by performing an addition operation on the residual sample and the predicted sample of the current block, the reconstruction sample of the current block can be determined, thereby completing the reconstruction process of the current block.
[0302] In some embodiments, the method may further include: one or more prediction modes corresponding to the current block being used as references for subsequent decoded blocks; and / or one or more vector parameters corresponding to the current block being used as references for subsequent decoded blocks.
[0303] For example, after deriving one or more prediction modes based on one or more vector parameters corresponding to the current block, these prediction modes can be saved and used as a reference for subsequent decoding blocks.
[0304] For example, after obtaining one or more vector parameters corresponding to the current block based on various methods, these vector parameters can be saved, that is, they can be saved for reference in subsequent decoding blocks.
[0305] For example, when the current block is decoded using methods such as IBC, IntraTMP, SGPM, and DIMD, if an adjacent block is decoded using a vector parameter pattern derivation method, all or part of the vector parameters obtained by that adjacent block can be added to the vector candidate list when constructing the vector candidate list.
[0306] For example, when the decoder builds a historical cache of vector parameters, if an adjacent block is decoded using the vector parameter pattern derivation method, all or part of the vector parameters obtained from that adjacent block can be added to the vector candidate list as historical vector parameters.
[0307] For example, when the current chroma block is decoded using methods such as DBV, if the luminance block at its reference position is decoded using a vector parameter mode derivation method, all or part of the vector parameters obtained from the luminance block at that reference position can be used as the vector parameters of the DBV block.
[0308] This application provides a decoding method, which can be an improvement on the DIMD method for block vector indication. After determining one or more vector parameters of the current block, by merging at least some of the first reference regions indicated by the vector parameters, redundancy between reference regions can be removed, reducing complexity. Compared to the first reference regions indicated by one or more vector parameters, the size of the reference region ultimately used to derive one or more prediction modes is reduced, thereby further reducing the efficiency of the derivation process. Moreover, when deriving the corresponding gradient information based on at least one second reference region, different gradient filters can be adaptively selected according to the size of the current block, further reducing complexity. Thus, when the current block is predicted using the BVG-DIMD mode, the complexity of gradient derivation can be reduced, thereby improving encoding and decoding efficiency.
[0309] In another embodiment of this application, Figure 18 is a schematic flowchart of an encoding method provided in an embodiment of this application. As shown in Figure 18, the method may include:
[0310] S1801 determines one or more vector parameters for the current block.
[0311] It should be noted that in this embodiment, the method is applied to the encoder. Based on the structure of the encoder 100 shown in Figure 12, the encoding method of this embodiment can be applied to the intra-frame prediction and transform part, mainly as an improved scheme for the block vector indication DIMD method (i.e., BVG-DIMD), which can reduce the complexity of gradient calculation.
[0312] It should also be noted that, in the embodiments of this application, the vector parameters here may include block vector parameters and motion vector parameters. This article mainly uses block vector parameters as an example for related description.
[0313] In this embodiment, the vector parameters of the current block can be determined first. The number of vector parameters can be one or more; no specific limit is placed on the number of vector parameters here.
[0314] In the embodiments of this application, one or more implementation methods can be selected to determine the vector parameters of the current block. For example, the vector parameters of the current block can be determined by the reconstructed adjacent blocks corresponding to the current block, by constructing a vector candidate list, or by intra-frame template matching search. No specific limitation is made here.
[0315] In one possible implementation, when determining the vector parameters of the current block, the coded neighboring blocks of the current block can be determined first; then, based on the vector parameters of the coded neighboring blocks, one or more vector parameters of the current block can be determined.
[0316] It is understood that, in the embodiments of this application, adjacent blocks can be determined first based on the position and size information of the current block. For example, the positions of adjacent blocks can be determined based on the position of the current block and its width and height (x, y, cbWidth, cbHeight). For example, the positions of adjacent blocks can be (x-1, y), (x, y-1), (x-1, y+cbHeight-1), (x+cbWidth-1, y-1), (x-1, y-1), etc.
[0317] It is also understood that, in the embodiments of this application, after determining the adjacent blocks, the vector parameters of the adjacent blocks can be further determined, and then the vector parameters of the current block can be determined based on the vector parameters of the adjacent blocks. Taking (x1, y1) as an example, it is determined whether the coding unit to which the position (x1, y1) belongs contains vector parameters (for example, determining whether the adjacent block is IBC, IntraTMP or other BVG mode coding, or determining whether the IBC flag bit of the coding information motionInfo[x1][y1] at this position is true).
[0318] It is also understood that, in the embodiments of this application, when determining the vector parameters of the current block based on the vector parameters of neighboring blocks, an availability judgment of the vector parameters can also be performed. Specifically, if a neighboring block contains vector parameters, it is determined whether the vector parameters are available for the current block. If available, the vector parameters are used as the vector parameters of the current block. It should be noted that the availability of vector parameters means that all samples of the reference block referred to by the current block based on these vector parameters are within the intra-frame reconstruction range based on the current block.
[0319] In another possible implementation, when determining the vector parameters of the current block, a list of vector candidates can be constructed first, and then one or more vector parameters of the current block can be determined based on the list of vector candidates.
[0320] It is understood that, in the embodiments of this application, the candidate vector parameters in the vector candidate list include at least one of the following:
[0321] Vector parameters of already encoded adjacent blocks;
[0322] Vector parameters of non-adjacent blocks that have already been encoded;
[0323] Historical vector parameters of encoded blocks;
[0324] Temporal vector parameters of the encoded image;
[0325] Predefined vector parameters;
[0326] The average vector parameter is obtained based on one or more candidate vector parameters in the vector candidate list;
[0327] Relocation vector parameters are obtained based on one or more candidate vector parameters from the vector candidate list.
[0328] For example, the vector parameters of the encoded adjacent blocks include the vector parameters used by the encoded blocks in the row or column positions adjacent to the current block; the vector parameters of the encoded non-adjacent blocks include the vector parameters used by the encoded blocks in the row or column positions not adjacent to the current block; the historical vector parameters of the encoded blocks include the vector parameters used by blocks that have been encoded before the current block in the encoding order, stored in a cache; the vector parameters corresponding to the reference image of the current image include the vector parameters obtained from the reference image of the current image (which may be a referenced encoded image or a co-located image) when the current image is an inter-frame prediction frame; the predefined vector parameters include the vector parameters and / or zero vector parameters obtained according to the current block size; the average vector parameters obtained based on one or more candidate vector parameters in the vector candidate list include the vector parameters obtained by averaging the existing vector parameters in the constructed vector candidate list; the relocation vector parameters obtained based on one or more candidate vector parameters in the vector candidate list include the vector candidates constructed by the existing vector parameters in the constructed vector candidate list and the vector parameters contained in the reference positions they point to.
[0329] It should be noted that, in the embodiments of this application, when constructing the vector candidate list, the availability of the candidate vector parameters can be judged, and the order and / or number of the candidate vector parameters in the vector candidate list can be adjusted.
[0330] For example, when constructing the vector candidate list, candidate vector parameters can be checked in any order, and when a candidate vector parameter is available for the current block, it is added to the vector candidate list.
[0331] For example, the vector candidate list can be defined with a maximum length, and when the vector candidate list exceeds the maximum length, no further candidate vector parameters are added to the vector candidate list.
[0332] For example, each type of candidate vector parameter can have a maximum length, such as no more than 5 vector parameters for encoded adjacent blocks, no more than 3 vector parameters for encoded non-adjacent blocks, etc.
[0333] For example, the constructed list of candidate vectors can be further reordered based on template error.
[0334] In another possible implementation, when determining the vector parameters of the current block, the search region and the template type of the current block can be determined; then, a search is performed within the search region according to the template type of the current block to determine the template error corresponding to at least one candidate vector parameter; finally, one or more vector parameters of the current block can be determined based on the template error.
[0335] In other words, in this embodiment of the application, one or more vector parameters of the current block can be determined by intra-frame template matching search. The IntraTMP search process may include: first determining the search region and the template type of the current block; then calculating the template error value for each possible candidate vector parameter. Based on the template error values of each candidate vector parameter throughout the search process, one or more candidate vector parameters with the smallest template error value can be determined as one or more vector parameters of the current block.
[0336] For example, the IntraTMP search step may include one or more of the following:
[0337] a) Search within a predefined region;
[0338] b) Phased search. For example, the first phase searches within a predefined region with a step size S to obtain at least one optimal vector parameter; the second phase searches within the neighborhood of this at least one vector parameter with a step size s.
[0339] c) Different template types. Searches can be performed based on L-shaped templates, left templates, or top templates;
[0340] d) Merged list-based search. A merged list of vector parameters can be constructed, and a search can be performed in the neighborhood of each candidate vector parameter;
[0341] e) Merge search windows. Neighboring search areas can be combined to create new search areas, thereby improving search efficiency.
[0342] In another possible implementation, when determining the vector parameters of the current block, k2 vector parameters can be determined based on the k1 vector parameters already obtained; then the k1 and k2 vector parameters are determined as one or more vector parameters of the current block; where k1 and k2 are both positive integers, n = k1 + k2, and n represents the number of one or more vector parameters.
[0343] It is understood that, in the embodiments of this application, after determining the vector parameters of the current block using one or more of the methods described above, the vector parameters can be expanded based on the already determined vector parameters to determine a larger number of vector parameters for the current block.
[0344] It can also be understood that in the embodiments of the present application, when expanding based on the already determined vector parameters, one or more already determined vector parameters can be directly reused, or new vector parameters can be generated based on one or more already determined vector parameters, which is not specifically limited herein.
[0345] In some embodiments, the method may further include: determining the total number n of one or more vector parameters of the current block based on the size information and / or position information of the current block.
[0346] Exemplarily, assume that there are n vector parameters for the current block, and k1 vector parameters (0 < k1 < n) are initially obtained by using one or more of the above methods. At this time, these k1 vector parameters can be used to fill the total number of vector parameters from k1 to n, that is, n = k1 + k2. For example, the remaining k2 vector parameters are all equal to any one of the k1 vector parameters or equal to new vector parameters derived from one or more of the k1 vector parameters.
[0347] S1802. Determine at least one second reference region according to the first reference regions indicated by one or more vector parameters; wherein, the second reference region is obtained by merging the first reference regions indicated by at least some of the one or more vector parameters.
[0348] It should be noted that in the embodiments of the present application, in order to reduce complexity, at least some of the first reference regions indicated by one or more vector parameters can be merged to obtain a target reference region (or can be called an "aggregated reference region"). In some embodiments, the method may include: when there is an overlap between at least some of the first reference regions indicated by one or more vector parameters, merging the at least some of the first reference regions indicated by the vector parameters to determine the second reference region.
[0349] That is to say, in the embodiments of the present application, if there is an overlap between the first reference regions indicated by multiple vector parameters, a second reference region can be constructed to replace the original multiple first reference regions, avoiding multiple gradient derivations at the same position and improving the derivation efficiency.
[0350] In some embodiments, determining at least one second reference region according to the first reference regions indicated by one or more vector parameters may include: determining whether the i-th vector parameter is marked as having been used for reference region merging; when the i-th vector parameter is not marked as having been used for reference region merging, determining the current reference region indicated by the i-th vector parameter; and determining at least one second reference region according to the current reference region and one or more first reference regions indicated by the one or more vector parameters that have not been used for reference region merging.
[0351] In the embodiments of this application, i is an integer greater than 0 and less than or equal to n, where n represents the number of one or more vector parameters.
[0352] It should also be noted that, in this embodiment, n vector parameters are checked sequentially. If the i-th vector parameter is marked as being used for reference region merging, then the check of the (i+1)-th vector parameter is performed. For example, the processing of the first reference region indicated by the i-th vector parameter can be skipped to determine whether the (i+1)-th vector parameter is marked as being used for reference region merging. If the i-th vector parameter is not marked as being used for reference region merging, then the first reference region indicated by the i-th vector parameter is taken as the current reference region, and a reference region merging operation is performed based on the current reference region and one or more first reference regions not used for reference region merging indicated by one or more vector parameters. These steps are repeated until i equals n, that is, when all one or more vector parameters have been traversed, at least one second reference region can be obtained.
[0353] In some embodiments, taking the generation of one of the second reference regions as an example, determining the second reference region based on the current reference region and one or more first reference regions indicated by one or more vector parameters that are not used for reference region merging may include: when the j-th vector parameter is checked, determining whether the j-th vector parameter is marked as used for reference region merging; if the j-th vector parameter is not marked as used for reference region merging, obtaining the first reference region indicated by the j-th vector parameter; if the first reference region indicated by the j-th vector parameter overlaps with the current reference region, merging the first reference region indicated by the j-th vector parameter with the current reference region to obtain a new reference region; if the new reference region is available, updating the current reference region of the current block using the new reference region, and marking the j-th vector parameter as used for reference region merging; continuing to check the (j+1)-th vector parameter until one or more vector parameters are traversed, and finally determining the current reference region obtained as the second reference region.
[0354] In this embodiment, j is an integer greater than i and less than or equal to n. That is, if the current reference region is determined based on the i-th vector parameter, then the next reference region can be determined, i.e., j = i + 1. In this case, the first reference region indicated by the j-th vector parameter is the next reference region.
[0355] It is understood that, in the embodiments of this application, when checking the j-th vector parameter, it is determined whether the j-th vector parameter has been marked as used for reference region merging, that is, whether the index corresponding to the j-th vector parameter has been marked as used for reference region merging. If the j-th vector parameter has been marked as used for reference region merging, then the (j+1)-th vector parameter is checked. For example, the j-th vector parameter can be skipped. At this time, the first reference region indicated by the j-th vector parameter is no longer processed.
[0356] It is also understood that, in the embodiments of this application, if the j-th vector parameter is not marked as being used for reference region merging, then the first reference region indicated by the j-th vector parameter can be obtained, and then it can be determined whether the first reference region indicated by the j-th vector parameter overlaps with the current reference region; if the first reference region indicated by the j-th vector parameter overlaps with the current reference region, then the first reference region indicated by the j-th vector parameter and the current reference region can be merged to obtain a new reference region; and if the new reference region is available, the new reference region is used as the current reference region of the current block, and the j-th vector parameter is marked as being used for reference region merging; then the (j+1)-th vector parameter is checked until all one or more vector parameters are traversed, and the finally obtained current reference region is determined as the second reference region.
[0357] In some embodiments, determining whether the first reference region indicated by the j-th vector parameter overlaps with the current reference region may include the following four judgment conditions:
[0358] Is the left side of the current reference region to the right of the right side of the first reference region indicated by the j-th vector parameter?
[0359] Is the right side of the current reference region to the left of the left side of the first reference region indicated by the j-th vector parameter?
[0360] Is the upper side of the current reference region below the lower side of the first reference region indicated by the j-th vector parameter?
[0361] Is the lower side of the current reference region above the upper side of the first reference region indicated by the j-th vector parameter?
[0362] In one possible implementation, the method may further include: if any one of the four judgment conditions is satisfied, then it is determined that the first reference region indicated by the j-th vector parameter does not overlap with the current reference region.
[0363] In this embodiment, for the first reference region indicated by the j-th vector parameter, the first top-left vector parameter pointing to the top-left corner is (nextTL_x, nextTL_y), and the first bottom-right vector parameter pointing to the bottom-right corner is (nextBR_x, nextBR_y); for the current reference region, the second top-left vector parameter pointing to the top-left corner is (currTL_x, currTL_y), and the second bottom-right vector parameter pointing to the bottom-right corner is (currBR_x, currBR_y). The judgment condition at this time can be:
[0364] a) The left side of the current reference region is to the right of the right side of the first reference region indicated by the j-th vector parameter, i.e., currTL_x>nextBR_x;
[0365] b) The right side of the current reference region is to the left of the left side of the first reference region indicated by the j-th vector parameter, i.e., currBR_x <nextTL_x;
[0366] c) The upper side of the current reference region is below the lower side of the first reference region indicated by the j-th vector parameter, i.e., currTL_y>nextBR_y;
[0367] d) The lower edge of the current reference region is above the upper edge of the first reference region indicated by the j-th vector parameter, i.e., currBR_y <nextTL_y。
[0368] If any one of the four judgment conditions a) to d) is satisfied, then it can be determined that the first reference region indicated by the j-th vector parameter does not overlap with the current reference region.
[0369] In another possible implementation, the method may further include: if all four judgment conditions are not met, then it is determined that the first reference region indicated by the j-th vector parameter overlaps with the current reference region.
[0370] In the embodiments of this application, if all four judgment conditions a) to d) are not satisfied, that is, currTL_x≤nextBR_x, currBR_x≥nextTL_x, currTL_y≤nextBR_y, and currBR_y≥nextTL_y, then it can be determined that the first reference region indicated by the j-th vector parameter does not overlap with the current reference region.
[0371] In some embodiments, if the first reference region indicated by the j-th vector parameter does not overlap with the current reference region, then the (j+1)-th vector parameter is checked. That is, if the j-th vector parameter is not marked as being used for reference region merging, but the first reference region indicated by the j-th vector parameter does not overlap with the current reference region, then the (j+1)-th vector parameter is checked until j = n, i.e., all these one or more vector parameters are traversed to obtain the merged second reference region.
[0372] In some embodiments, taking the merging of the first reference region indicated by the j-th vector parameter with the current reference region as an example, the method may include: determining the first upper-left corner vector parameter and the first lower-right corner vector parameter corresponding to the first reference region indicated by the j-th vector parameter, and determining the second upper-left corner vector parameter and the second lower-right corner vector parameter corresponding to the current reference region; determining the third upper-left corner vector parameter based on the first upper-left corner vector parameter and the second upper-left corner vector parameter; determining the third lower-right corner vector parameter based on the first lower-right corner vector parameter and the second lower-right corner vector parameter; and obtaining a new reference region based on the third upper-left corner vector parameter and the third lower-right corner vector parameter.
[0373] In this embodiment of the application, for the new reference region, the third upper-left corner vector parameter pointing to the upper-left corner is (tempTL_x, tempTL_y), and the third lower-right corner vector parameter pointing to the lower-right corner is (tempBR_x, tempBR_y), where: tempTL_x = currTL_x <nextTL_x?currTL_x:nextTL_x; tempTL_y=currTL_y<nextTL_y?currTL_y:nextTL_y; tempBR_x=currBR_x> nextBR_x? currBR_x:nextBR_x; tempBR_y=currBR_y>nextBR_y? currBR_y:nextBR_y.
[0374] In this embodiment, after obtaining the new reference region determined by (tempTL_x, tempTL_y) and (tempBR_x, tempBR_y), it can be determined whether the new reference region is usable. For example, the sample located at (x0+tempBR_x, y0+tempBR_y) pointed to by the third lower right corner vector parameter should have been reconstructed, where (x0, y0) are the coordinates of the upper left corner of the current block.
[0375] In one possible implementation, the method may include determining whether a new reference region is available if the new reference region is located within a predefined region.
[0376] It should be noted that, in the embodiments of this application, the predefined region may include regions in the current image that have already been reconstructed. The predefined region includes, but is not limited to: reconstructed regions determined based on the location information and / or size information of the current block; reconstructed regions determined based on the size information of the coding tree unit to which the current block belongs; and all or part of the reconstructed regions in the current image to which the current block belongs.
[0377] In another possible implementation, the method may further include determining whether a new reference region is available if the size of the new reference region does not exceed the maximum allowable size.
[0378] It should also be noted that, in the embodiments of this application, since the current reference area may be adjusted multiple times, resulting in the final reference area being too large, it is necessary to limit the size of the new reference area, for example, by setting a maximum allowable size (i.e., the maximum value of the reference area).
[0379] In some embodiments, the maximum allowed size may be a fixed value. Alternatively, in other embodiments, the maximum allowed size may be related to preset parameters, which may include at least: the size of the current block, and / or, the number of times the current reference region has been merged.
[0380] In other words, in this embodiment, additional judgments can be added to limit the size of the new reference region. For example, a maximum allowed size can be set to K. If the size of the new reference region, size = (tempBR_x - tempTL_x + 1) × (tempBR_y - tempTL_y + 1), is greater than K, then the new reference region is considered unusable. Here, K can be a fixed value, or a value related to the current block size, the number of times it has been merged, etc. For example, K = (q + 2) × width × height, where q is the number of times the current reference region has been merged, that is, the number of times it has been adjusted through merging.
[0381] It should also be noted that when a new reference region is available, the current reference region is set to equal the new reference region, i.e., currTL = tempTL, currBR = tempBR. Thus, for the resulting second reference region, the top-left corner coordinates are (x0 + currTL_x, y0 + currTL_y), the width is currBR_x - currTL_x + 1, and the height is currBR_y - currTL_y + 1. The DIMD gradient operator can be applied within this reference region to construct the gradient histogram of the current block.
[0382] In the embodiments of this application, the above steps can be repeated until i = n, that is, after traversing one or more vector parameters, at least one second reference region can be obtained, and all of these at least one second reference regions participate in the construction of the gradient histogram.
[0383] For example, assuming n = 5, that is, after determining the 5 vector parameters (BVi, i = 1, 2, ... 5) of the current block, firstly, i = 1, that is, check the first vector parameter BV1. If BV1 is not marked as being used for reference region merging, then the first reference region indicated by BV1 is taken as the current reference region. Then check whether the second vector parameter BV2 is marked as being used for reference region merging. If BV2 is not marked as being used for reference region merging, and the first reference region indicated by BV2 does not overlap with the current reference region, then continue to check whether the third vector parameter BV3 is marked as being used for reference region merging. If BV3 is not marked as being used for reference region merging, and the first reference region indicated by BV3 overlaps with the current reference region, then the first reference region indicated by BV3 is taken as the current reference region. A reference region is merged with the current reference region to obtain a new reference region. If the new reference region is available, it can be designated as the current reference region, and BV3 is marked as used for reference region merging. The process continues to check whether the fourth vector parameter BV4 is marked as used for reference region merging. If BV4 is not marked as used for reference region merging, and the first reference region indicated by BV4 does not overlap with the current reference region, the process continues to check whether the fifth vector parameter BV5 is marked as used for reference region merging. If BV5 is not marked as used for reference region merging, and the first reference region indicated by BV5 does not overlap with the current reference region, after traversing these 5 vector parameters, the final current reference region is designated as the first second reference region.
[0384] Then, i=2, that is, check the second vector parameter BV2. If BV2 is not marked as being used for reference region merging, then the first reference region indicated by BV2 is taken as the current reference region. Then check whether the third vector parameter BV3 is marked as being used for reference region merging. If BV3 is marked as being used for reference region merging, then continue to check whether the fourth vector parameter BV4 is marked as being used for reference region merging. If BV4 is not marked as being used for reference region merging, and the first reference region indicated by BV4 overlaps with the current reference region, then merge the first reference region indicated by BV4 with the current reference region to obtain a new reference region. If the new reference region is available, then the new reference region can be determined as the current reference region, and BV4 is marked as being used for reference region merging. Continue to check whether the fifth vector parameter BV5 is marked as being used for reference region merging. If BV5 is not marked as being used for reference region merging, and the first reference region indicated by BV5 does not overlap with the current reference region, then after traversing these 5 vector parameters, the final current reference region is determined as the second second reference region.
[0385] Then i=3, that is, check the third vector parameter BV3. If BV3 is marked as used for reference region merging, then i=4, that is, check the fourth vector parameter BV4. If BV4 is marked as used for reference region merging, then i=5, that is, check the fifth vector parameter BV5. If BV5 is not marked as used for reference region merging, then the first reference region indicated by BV5 can be determined as the third second reference region to obtain three second reference regions for gradient histogram construction.
[0386] In some embodiments, the number of repetitions described above is related to the number of second reference regions. Embodiments of this application may also limit the number of repetitions, i.e., limit the number of second reference regions ultimately used for gradient histogram construction. In one possible implementation, the number of second reference regions is a preset constant. For example, only the second reference regions determined based on the first vector parameter BV1 are used for gradient derivation, and the remaining unmerged vector parameters are not used for gradient derivation.
[0387] In this way, by merging the overlapping parts of the first reference regions indicated by one or more vector parameters, it is possible to avoid performing multiple DIMD derivations at the same location, thus solving the problem of redundancy between the first reference regions determined by multiple vector parameters, thereby reducing the complexity of gradient derivation and improving the efficiency of the derivation process.
[0388] S1803, determine one or more prediction modes for the current block based on at least one second reference region; wherein the one or more prediction modes are determined based on gradient information derived from at least one second reference region.
[0389] In embodiments of this application, after obtaining at least one second reference region, these at least one second reference region are used for gradient derivation to determine one or more prediction modes of the current block. In some embodiments, this may include: determining a gradient filter for the current block; determining gradient information of the current block based on at least one second reference region and the gradient filter; wherein the gradient information includes at least one candidate prediction mode and an amplitude accumulation value corresponding to at least one candidate prediction mode; constructing a gradient histogram of the current block based on at least one candidate prediction mode and an amplitude accumulation value corresponding to at least one candidate prediction mode; and determining one or more prediction modes of the current block based on the gradient histogram.
[0390] It should be noted that, in this embodiment, the gradient filter for the current block can be determined based on the size of the current block. In other words, different gradient filters are adaptively selected based on the size of the current block, thereby further reducing the complexity of gradient calculation.
[0391] In one possible implementation, determining the gradient filter for the current block based on its size may include: if the size of the current block is less than a size threshold, determining the gradient filter for the current block as a first shape filter; if the size of the current block is greater than the size threshold, determining the gradient filter for the current block as a second shape filter.
[0392] In this embodiment, considering that the DIMD mode can adaptively select gradient operators (or "gradient filters") of different sizes according to the size of the block, the BVG-DIMD mode can also adaptively select gradient filters according to the size of the block. For example, if the size of the current block is less than the size threshold, for example, the size threshold is set to 32, then the first shape filter is used, for example, a 2×2 gradient filter, as shown in the aforementioned formula (10).
[0393] If the size of the current block is greater than the size threshold (e.g., set to 32), then a second shape filter is used, such as a 3×3 gradient filter, as shown in the aforementioned formula (11).
[0394] It should be noted that in the embodiments of this application, if the size of the current block is equal to the size threshold, then the gradient filter of the current block can be a first shape filter, such as the aforementioned formula (10); or the gradient filter of the current block can also be a second shape filter, such as the aforementioned formula (11), without specific limitations here.
[0395] It should also be noted that, in this embodiment, the gradient filter for the current block is determined based on its size and applied to samples within the second reference region. Dx (corresponding to the vertical gradient value Gy) and Dy (corresponding to the horizontal gradient value Gx) at different positions are calculated to determine the corresponding angle prediction mode and gradient magnitude, thereby completing the construction of the gradient histogram. Figure 17A is a schematic diagram of the application of a 3×3 gradient filter in the reference region provided in this embodiment, and Figure 17B is a schematic diagram of the application of a 2×2 gradient filter in the reference region provided in this embodiment. As can be seen from Figures 17A and 17B, the application range within the reference region differs due to the different sizes of the gradient filters.
[0396] In some embodiments, determining the gradient information of the current block based on at least one second reference region and a gradient filter may include: determining the angle prediction mode and gradient magnitude corresponding to each reference sample in at least one second reference region based on the reference samples in at least one second reference region and the gradient filter; determining at least one candidate prediction mode based on the angle prediction mode and gradient magnitude corresponding to each reference sample in at least one second reference region; and performing an accumulation operation on the gradient magnitudes belonging to the same candidate prediction mode to obtain the magnitude accumulation value corresponding to at least one candidate prediction mode.
[0397] In this embodiment of the application, for each reference sample in the second reference region, the angle prediction mode and gradient magnitude corresponding to each reference sample can be calculated according to the aforementioned formulas (2) and (3). Then, for this at least one candidate prediction mode (e.g., prediction angles 2 to 66), the gradient magnitudes belonging to the same candidate prediction mode are accumulated to obtain the magnitude accumulation value (or "cumulative magnitude value") corresponding to at least one candidate prediction mode, thereby constructing a gradient histogram.
[0398] In another possible implementation, the derivation process can be simplified during the construction of the gradient histogram. For example, when calculating the gradient of reference samples within the second reference region based on the gradient filter, the gradient filter is treated as a computation window, and downsampling is performed when determining the computation window. For instance, if the center position of the current computation window is (x, y), then the center position of the next computation window in the horizontal direction can be (x + lenHor, y), and the center position of the next computation window in the vertical direction can be (x, y + lenVer). Here, lenHor and lenVer can take any integer values to determine the sampling interval, thereby further reducing computational complexity.
[0399] Thus, after obtaining the gradient histogram, one or more prediction modes for the current block can be determined based on the gradient histogram. In some embodiments, the method may further include: determining the top m candidate prediction modes with the highest cumulative magnitude values in the gradient histogram as one or more prediction modes for the current block; where m is a positive integer.
[0400] In this embodiment of the application, for the cumulative magnitude value corresponding to each candidate prediction mode in the gradient histogram, it can be sorted from high to low, and the top m candidate prediction modes are used as one or more prediction modes of the current block to determine the prediction samples of the current block.
[0401] S1804, Determine the prediction sample for the current block based on one or more prediction modes.
[0402] In this embodiment, some indication information in the form of syntax elements, or flags, can be written into the bitstream. This allows the subsequent decoding end to determine the prediction mode used by the current block by parsing the values of the syntax elements in the bitstream. For example, the first syntax element can be used to indicate whether the current block uses the intra-frame mode derivation indicated by the block vector for prediction, i.e., whether the current block uses the BVG-DIMD mode for prediction.
[0403] In some embodiments, the method may further include: determining the value of a first syntax element; encoding the value of the first syntax element; and writing the obtained encoded bits into a bitstream.
[0404] In this embodiment of the application, when the current block is predicted using the intra-frame mode derivation of the decoding end indicated by the block vector, the encoding method of this embodiment of the application is executed, that is, the step of determining one or more vector parameters of the current block is executed.
[0405] In addition, in this embodiment, the first syntax element can be represented by cu_bvgdimd_flag. The first syntax element serves as an enable flag for the block-level BVG-DIMD mode and can be used to indicate whether the current block uses the BVG-DIMD mode for prediction.
[0406] In some embodiments, if the current block is predicted using BVG-DIMD mode, then the value of the first syntax element is determined to be a first value; if the current block is not predicted using BVG-DIMD mode, then the value of the first syntax element is determined to be a second value.
[0407] It should be noted that, in the embodiments of this application, the first value and the second value are different. For example, the first value can be 1 and the second value can be 0; or, the first value can be true and the second value can be false; no limitation is made here.
[0408] In one possible implementation, if the current block is predicted using BVG-DIMD mode, the value of the first syntax element can be determined to be true, and the value of the first syntax element is written to the bitstream. If the first syntax element does not exist in the bitstream, it is assumed to be false, meaning the current block is not predicted using BVG-DIMD mode.
[0409] It should also be noted that, in this embodiment of the application, if the current block is predicted using the BVG-DIMD mode, the gradient histogram can be initialized so that the cumulative magnitude value corresponding to each candidate prediction mode is initialized to 0. Then, according to the aforementioned derivation process, the gradient histogram can be constructed, and one or more prediction modes for the current block can be determined accordingly.
[0410] In some embodiments, determining the prediction sample of the current block based on one or more prediction modes may include: determining one or more first prediction blocks based on one or more prediction modes; determining one or more second prediction blocks based on one or more vector parameters; and determining the prediction sample of the current block by weighted fusion of one or more first prediction blocks and one or more second prediction blocks.
[0411] In other words, in this embodiment of the application, the BVG-DIMD mode obtains n vector parameters and one or more prediction modes through the above process, and the final prediction block can be a combination of prediction blocks obtained by these prediction methods. For example, using the m prediction modes with the largest amplitude accumulation value obtained by gradient derivation, m first prediction blocks are generated; using the obtained n vector parameters, n second prediction blocks are obtained, and the block copy prediction block is obtained by fusing these n second prediction blocks. Further, the m first prediction blocks and the block copy prediction block are fused to obtain the final prediction sample. Here, the weighted fusion between these prediction blocks can determine the weight value according to the amplitude accumulation value corresponding to the prediction mode, the template error corresponding to the prediction mode (vector parameter), etc. For example, let the total weight corresponding to the first prediction block be a, for example, a equals 32; let the weight value of the block copy prediction block be b, for example, b equals 32; then combine the aforementioned formulas (4) to (8) to determine the corresponding weight, and finally, according to the weighted fusion of formula (10), the final prediction sample of the current block can be obtained.
[0412] S1805, Determine the residual sample of the current block based on the prediction sample of the current block.
[0413] In this embodiment, after determining the predicted sample of the current block, the residual sample of the current block can be determined based on the original sample and the predicted sample of the current block. For example, the residual sample of the current block can be determined by subtracting the original sample and the predicted sample of the current block.
[0414] In some embodiments, after obtaining the residual sample of the current block, referring to Figure 19, the method may further include:
[0415] S1901, determine the transformation set of the current block.
[0416] S1902, determine the transform kernel of the current block based on the transform set.
[0417] S1903, transform the residual samples of the current block according to the transformation kernel, and determine the transformation coefficients of the current block.
[0418] S1904 quantizes the transform coefficients of the current block to determine the quantization coefficients of the current block.
[0419] S1905: Encode the quantization coefficients of the current block and write the resulting encoded bits into the bitstream.
[0420] In this embodiment, the residual sample of the current block is transformed according to the transform kernel, such as LFNST, NSPT, etc., to obtain the transform coefficients of the current block. After quantization, the quantization coefficients of the current block can be written into the bitstream.
[0421] In some embodiments, determining the transform set of the current block may include: determining the transform set category of the current block; and determining the transform set of the current block based on the transform set category.
[0422] It should be noted that, in the embodiments of this application, the transform set category of the current block can be the same as that of the conventional intra-prediction mode. For example, the transform set of the current block can be determined based on a preset intra-prediction mode; or, the transform set of the current block can be determined based on an intra-prediction mode derived from at least one second reference region; or, the transform set of the current block can be determined based on an intra-prediction mode derived from the prediction samples of the current block.
[0423] It should also be noted that, in the embodiments of this application, the transform set category of the current block can also use a special transform set category, that is, a different transform set category than the traditional intra-frame prediction mode.
[0424] In one possible implementation, when the current block is predicted using the decoder intra-mode derivation indicated by the block vector, the transform set category of the current block is determined to be a first category; wherein the first category is the transform set category corresponding to at least one of the decoder intra-predictive mode derivation (DIMD) mode and template-based intra-mode derivation (TIMD) mode.
[0425] In another possible implementation, when the current block is predicted using the intra-mode derivation at the decoding end indicated by the block vector, the transform set category of the current block is determined to be a second category; wherein the second category is the transform set category corresponding to at least one of the IntraTMP mode, the IntraBlock Copy (IBC) mode, and the Inter-Frame Prediction mode.
[0426] In other words, in this embodiment, the prediction block of BVG-DIMD mode is a combination of the prediction block of traditional intra-frame prediction mode and block copy prediction. Therefore, when combined with technologies such as LFNST and NSPT, its transform kernel category (or transform set, set of transform kernels, etc.) can be different from that of traditional intra-frame prediction mode. One possible implementation is that BVG-DIMD coded blocks and DIMD coded blocks (or TIMD coded blocks) use the same transform set category. Another possible implementation is that BVG-DIMD coded blocks and IntraTMP coded blocks (or IBC coded blocks, inter-frame prediction coded blocks) use the same transform set category. Based on the above transform set classification method, when the residual samples (or residual coefficients) of BVG-DIMD coded blocks are transformed (which can be a single transform, such as MTS, NSPT, or a two-stage transform, such as LFNST, etc.), the corresponding transform set is selected; then the corresponding transform kernel is determined according to the transform set.
[0427] In some embodiments, determining the transform kernel of the current block based on the transform set may include: calculating the encoding cost of the current block based on at least two candidate transform kernels in the transform set, and determining the cost results corresponding to the at least two candidate transform kernels; determining the minimum cost result from the cost results corresponding to the at least two candidate transform kernels; and determining the candidate transform kernel corresponding to the minimum cost result as the transform kernel of the current block.
[0428] In the embodiments of this application, the encoding cost calculation here may be rate-distortion cost calculation, or it may be other distortion cost calculation, such as mean square error (MSE), etc., without any limitation.
[0429] In some embodiments, the method may further include: determining the transform kernel index of the current block; encoding the transform kernel index of the current block and writing the obtained encoded bits into the bitstream.
[0430] In this embodiment, the transform set may include multiple candidate transform kernels, such as 3, 4, or 5 candidate transform kernels. Here, the transform kernel index of the current block can be represented by lfnstIdx, indicating the index number of the transform kernel in the transform set of the current block. Thus, after determining the transform set of the current block, the selected transform kernel can be determined from the transform set for use in the transform process of the current block.
[0431] In some embodiments, the method may further include: using one or more prediction modes corresponding to the current block for reference in subsequent coding blocks; and / or using one or more vector parameters corresponding to the current block for reference in subsequent coding blocks.
[0432] For example, after deriving one or more prediction patterns based on one or more vector parameters corresponding to the current block, these prediction patterns can be saved and used as a reference for subsequent coded blocks.
[0433] For example, after obtaining one or more vector parameters corresponding to the current block based on various methods, these vector parameters can be saved, that is, they can be saved for reference in subsequent encoded blocks.
[0434] For example, if the current block is encoded using methods such as IBC, IntraTMP, SGPM, or DIMD, when constructing its vector candidate list, if adjacent blocks are encoded using a vector parameter pattern derivation method, all or part of the vector parameters obtained by the adjacent blocks can be added to the vector candidate list.
[0435] For example, when the encoder builds a historical cache of vector parameters, if an adjacent block is encoded using the vector parameter pattern derivation method, all or part of the vector parameters obtained from that adjacent block can be added to the vector candidate list as historical vector parameters.
[0436] For example, when the current chroma block is encoded using methods such as DBV, if the luminance block at its reference position is encoded using a vector parameter pattern derivation method, all or part of the vector parameters obtained from the luminance block at that reference position can be used as the vector parameters of the DBV block.
[0437] This application provides an encoding method, which can be an improvement on the DIMD method for block vector indication. After determining one or more vector parameters of the current block, by merging at least some of the first reference regions indicated by the vector parameters, redundancy between reference regions can be removed, reducing complexity. Compared to the first reference regions indicated by one or more vector parameters, the size of the reference region ultimately used to derive one or more prediction modes is reduced, thereby further reducing the efficiency of the derivation process. Moreover, when deriving the corresponding gradient information based on at least one second reference region, different gradient filters can be adaptively selected according to the size of the current block, further reducing complexity. Thus, when the current block is predicted using the BVG-DIMD mode, the complexity of gradient derivation can be reduced, thereby improving encoding efficiency.
[0438] In another embodiment of this application, based on the encoding and decoding method of the foregoing embodiments, taking the block vector as the vector parameter as an example, an optimization method for BVG-DIMD is proposed, which may include: merging the reference regions of multiple block vectors to obtain a new reference region (or aggregating the reference region); and adaptively selecting a gradient filter according to the size of the current block.
[0439] In some embodiments, the optimization method for BVG-DIMD may include:
[0440] (1) Reference Region Merging. The BVG-DIMD mode obtains one or more block vectors, represented as BVi, i = 1..n, by methods such as inheriting from adjacent coded blocks, constructing a block vector candidate list, and intra-frame template matching search. When reference regions corresponding to different BVs overlap, a new reference region can be constructed to replace the original multiple reference regions, avoiding multiple DIMD derivations at the same location. One possible implementation is to sequentially traverse these block vectors, identify the reference region, and perform DIMD derivation. The specific process is as follows:
[0441] Step 1: Sequentially check block vectors BVi, i = 1..n. If BVi is marked as already used for reference region merging, continue checking block vector BVi+1. At this point, no processing is performed on the reference region pointed to by BVi. If BVi is not marked as already used for reference region merging, determine the current reference region for the current block vector BVi(BVi_x, BVi_y), which can be represented as block vector currTL pointing to the top-left corner and block vector currBR pointing to the bottom-right corner. The size of this reference region can be equal to the size of the current block. For example, currTL_x = BVi_x, currTL_y = BVi_y, currBR_x = BVi_x + width - 1, currBR_y = BVi_y + height - 1, where width and height are the width and height of the current block.
[0442] Step 2: Sequentially check subsequent block vectors BVj, j = i + 1..n. If BVj is marked as already used for reference region merging, continue checking the next block vector; otherwise, determine the j-th reference region of BVj (called the next region), which can be represented as the block vector nextTL(BVj_x, BVj_y) pointing to the top left corner and the block vector nextBR(BVj_x + width - 1, BVj_y + height - 1) pointing to the bottom right corner. Determine whether the current reference region and the next region corresponding to BVj overlap. Specific judgment conditions include:
[0443] a) The left side of the current reference region is to the right of the right side of the next region, i.e., currTL_x > nextBR_x;
[0444] b) The right side of the current reference region is to the left of the left side of the next region, i.e., currBR_x <nextTL_x;
[0445] c) The upper edge of the current reference region is below the lower edge of the next region, i.e., currTL_y > nextBR_y;
[0446] d) The lower edge of the current reference region is above the upper edge of the next region, i.e., currBR_y <nextTL_y。
[0447] If BVj satisfies any one of the judgment conditions from a) to d), it means that the current reference region and the next region do not overlap, and then we can continue to check the next vector BVj+1.
[0448] Step 3: If BVj does not satisfy any of the judgment conditions in a) to d), then a new reference region is determined, which can be represented as a block vector tempTL pointing to the upper left corner and a block vector tempBR pointing to the lower right corner, where: tempTL_x = tempTL_x <nextTL_x?currTL_x:nextTL_x; tempTL_y=currTL_y<nextTL_y?currTL_y:nextTL_y; tempBR_x=currBR_x> nextBR_x? currBR_x:nextBR_x; tempBR_y=currBR_y>nextBR_y? currBR_y:nextBR_y.
[0449] Determine whether the new reference region determined by tempTL and tempBR is available. For example, the sample pointed to by tempBR and located at (x0+tempBR_x, y0+tempBR_y) should be reconstructed. x0 and y0 are the coordinates of the upper left corner of the current block.
[0450] Step 4: If the new reference region determined in Step 3 is available, then set the current reference region to the new reference region, i.e., currTL = tempTL, currBR = tempBR, and mark BVj as having been used for reference region merging. Continue to Step 2 to check the next vector block BVj+1;
[0451] Step 5: Repeat steps 2 through 4 until BVj is traversed, j = i + 1...n. Determine the final reference region, with the top-left corner coordinates, width, and height as x0 + currTL_x, y0 + currTL_y, currBR_x - currTL_x + 1, and currBR_y - currTL_y + 1, respectively. Apply the DIMD gradient operator within this reference region, derive the pattern, and statistically analyze it in the gradient histogram (HoG).
[0452] Step 6: Repeat steps 1 to 5 above, traversing Bvi, i = 1..n. This completes the construction of the HoG based on block vectors.
[0453] In one possible implementation, steps 2 through 4 above may involve multiple adjustments to the current reference region, resulting in an excessively large final reference region. A simplified approach is to add an additional check in step 3. For example, a maximum reference region value K is set. If the size of the new reference region, size = (tempBR_x - tempTL_x + 1) × (tempBR_y - tempTL_y + 1), is greater than K, then the new reference region is considered unusable. Here, K can be a fixed value or a value related to the current block size, the number of adjustments, etc. For example, K = (q + 2) × width × height, where q is the number of adjustments made to the current reference region.
[0454] In another possible implementation, a simplification method is to limit the number of repetitions of steps 1 through 5, i.e., limit the final number of reference regions used for HoG construction. For example, only the final reference regions determined based on BV1 are used for pattern derivation, and the remaining unmerged BVs are not used for pattern derivation.
[0455] (2) Adaptive selection of gradient filter.
[0456] The DIMD mode derives the prediction mode through gradient derivation between samples, and the gradient calculation can be implemented in different ways. The DIMD mode in related technologies can adaptively select different sized gradient operators (or gradient filters) according to the size of the block. Therefore, the BVG-DIMD mode can also adaptively select the gradient filter according to the size of the block. If the size of the current block is less than or equal to N, for example, N = 32, then a 2×2 gradient filter is used, as shown in the above formula (10);
[0457] Otherwise, a 3×3 gradient filter can be used, as shown in the above formula (11).
[0458] The gradient filter for the current block is determined based on its size and applied to samples within the reference region. Dx (corresponding to the vertical gradient value Gy) and Dy (corresponding to the horizontal gradient value Gx) are calculated at different locations to determine the corresponding angular prediction mode and gradient magnitude, thus completing the HoG construction. Because the size of the gradient filter varies, its application range within the reference region also differs, as shown in Figures 17A and 17B.
[0459] (3) Selection of transformation kernel type (transformation set).
[0460] Transform techniques in related technologies propose non-traditional intra-prediction modes such as DIMD, TIMD, IntraTMP, or inter-prediction modes, which can use a dedicated transform kernel (or transform set, or collection of transform sets) instead of the same transform kernel used in traditional intra-prediction modes.
[0461] For example, the prediction block in BVG-DIMD mode is a combination of the prediction blocks of traditional intra-prediction mode and block copy prediction. Therefore, when combined with techniques such as NSPT and LFNST, its transform kernel category can be different from that of traditional intra-prediction mode. One possible implementation is that the BVG-DIMD coded block and the DIMD coded block (or TIMD coded block) are of the same category. Another possible implementation is that the BVG-DIMD coded block and the IntraTMP coded block (or IBC coded block, inter-frame coded block) are of the same category. Based on the above classification methods, when the residual block (or coefficient block) of the BVG-DIMD coded block undergoes a transform (which can be a single transform, such as MTS, NSPT; or a two-stage transform, such as LFNST), the corresponding transform kernel category is selected. Furthermore, based on the intra-prediction mode derived from the reference region (or the intra-prediction mode derived from the prediction block) of the current block, the mtsIdx, lfnstIdx, and other syntax elements of the current block determine the selected transform kernel in the current transform kernel category for use in the transform process.
[0462] In one possible implementation, the BVG-DIMD method is improved by applying the encoding / decoding method proposed in this technical solution. If the decoded syntax element determines that the current block is predicted using the BVG-DIMD mode, one or more block vectors are obtained by constructing a block vector candidate list and performing intra-frame template matching search. The reference regions pointed to by the block vectors are merged according to the aforementioned method, and the prediction mode is derived and HoG is constructed based on the adjusted reference regions. During the derivation of the prediction mode, the gradient filter can be adaptively selected based on the size of the current block. The subsequent prediction process is the same as the existing BVG-DIMD technology.
[0463] For example, the relevant syntax elements are shown in Table 2.
[0464] Table 2
[0465] Here, cu_bvgdimd_flag is the enable flag for the block-level BVG-DIMD method. If the value is true, it means that the BVG-DIMD method is used for the current block; if the value is false, it is not used. If the syntax element does not exist in the bitstream, it defaults to false.
[0466] In one possible implementation, the decoding process at the decoding end can be as follows:
[0467] Step 1: Decode the first syntax element. If the value of cu_bvgdimd_flag in the current block is true, then the current block is predicted using the BVG-DIMD mode.
[0468] Step 2: If the current block is predicted using the BVG-DIMD mode, initialize a gradient histogram (HoG), and initialize the cumulative magnitude value of each candidate prediction mode to 0; according to the aforementioned intra-frame template matching search method, obtain at most n block vectors BVi, i = 1..n, where n can be any integer greater than 0. These n block vectors are sorted in ascending order of template error.
[0469] Step 3: Derive the traditional intra-frame prediction mode based on the n block vectors obtained in Step 2. First, determine the reference region. The current reference region is determined by BV1, and then BV2 is merged into the reference region in BVn that meets the conditions according to the aforementioned process. For example, when merging reference regions, the maximum value of the reference region K should be satisfied as K = (q + 2) × width × height.
[0470] Step 4: Adaptively determine the gradient filter based on the size of the current block, apply it to the reference region obtained in Step 3, and obtain the angle prediction mode and gradient magnitude at each position. The results are accumulated in HoG.
[0471] Step 5: Based on the HoG obtained in Step 4, derive the m prediction modes with the largest cumulative amplitude values, combine them with the n block vectors obtained in Step 2, obtain the corresponding prediction blocks (reference blocks), and weighted combine them to obtain the final prediction samples.
[0472] Step 6: Based on the above steps, complete the prediction of the current block. Determine the transform kernel of the current block according to the aforementioned scheme. The remaining steps are the same as related technologies: scale (inverse quantization) and inverse transform the quantization coefficients of the current block to obtain the residual sample of the current block. Combining this residual sample with the predicted block can complete the reconstruction of the current block.
[0473] Step 7: Complete the decoding of the current block according to the above steps, and save the decoding information such as the angle prediction mode, block vector and its corresponding weight value used for the current block for reference in subsequent decoding blocks.
[0474] In another possible implementation, the corresponding encoding process at the encoding end can be as follows:
[0475] Step 1: Based on the high-level mode enable flag, the size and position of the current block, determine whether the current block can be encoded in BVG-DIMD mode. If it is determined that the current block uses BVG-DIMD mode, the value of encoding cu_bvgdimd_flag is true;
[0476] Step 2, similar to the previous steps, derive the n block vectors, angle prediction mode, weights, etc., of the current block to complete the prediction of the current block. Based on the aforementioned scheme, determine the transform kernel of the current block, and further complete the residual calculation, transformation and scaling, and encoding of other coding information for the current block to complete the encoding reconstruction of the current block.
[0477] Step 3: After traversing all coding units, the bitstream is output after passing through techniques such as loop filtering and entropy coding.
[0478] In summary, this technical solution proposes an optimization method for the BVG-DIMD mode. Firstly, it can merge the reference regions of the block vector, remove redundancy between reference regions, and control the size of the reference regions to reduce complexity. Based on ECM reference software, the performance changes of the BVG-DIMD mode that merges reference regions and retains only one reference region compared to the mode that does not merge and uses all reference regions are shown in Table 3. This demonstrates that there is no loss of coding gain while reducing complexity. Secondly, it can adaptively select different DIMD gradient filters according to the current block size, further reducing the complexity of gradient calculation.
[0479] Table 3
[0480] In the embodiments of this application, the specific implementation of the aforementioned embodiments is described in detail through the above embodiments. It can be seen that, according to the technical solutions of the aforementioned embodiments, on the one hand, the BVG-DIMD mode can merge the reference regions indicated by the block vector, and on the other hand, the BVG-DIMD mode can adaptively select different DIMD gradient filters according to the size of the current block. This can reduce the complexity when the current block is predicted using the BVG-DIMD mode, thereby improving the encoding and decoding efficiency.
[0481] In another embodiment of this application, based on the same inventive concept as the foregoing embodiments, FIG20 is a schematic diagram of the composition structure of an encoder provided in an embodiment of this application. As shown in FIG20, the encoder 200 may include a first determining unit 2001 and a first predicting unit 2002, wherein:
[0482] The first determining unit 2001 is configured to: determine one or more vector parameters of the current block; determine at least one second reference region based on a first reference region indicated by the one or more vector parameters; wherein the second reference region is obtained by merging the first reference regions indicated by at least some of the one or more vector parameters; and determine one or more prediction modes of the current block based on the at least one second reference region; wherein the one or more prediction modes are determined based on gradient information derived from the at least one second reference region.
[0483] The first prediction unit 2002 is configured to determine the prediction sample of the current block based on one or more prediction modes.
[0484] In some embodiments, referring to FIG20, the encoder 200 may further include a first merging unit 2003 configured to merge the first reference regions indicated by at least some of the vector parameters in one or more vector parameters when there is an overlap, thereby determining a second reference region.
[0485] In some embodiments, the first determining unit 2001 is further configured to determine whether the i-th vector parameter is marked as having been used for reference region merging; when the i-th vector parameter is not marked as having been used for reference region merging, determine the current reference region indicated by the i-th vector parameter; and determine at least one second reference region based on the current reference region and one or more first reference regions not used for reference region merging indicated by one or more vector parameters; wherein i is an integer greater than 0 and less than or equal to n, and n represents the number of one or more vector parameters.
[0486] In some embodiments, the number of second reference regions is a preset constant.
[0487] In some embodiments, the first merging unit 2003 is further configured to, when the j-th vector parameter is detected, determine whether the j-th vector parameter has been marked as used for reference region merging; if the j-th vector parameter has not been marked as used for reference region merging, obtain the first reference region indicated by the j-th vector parameter; if the first reference region indicated by the j-th vector parameter overlaps with the current reference region, merge the first reference region indicated by the j-th vector parameter with the current reference region to obtain a new reference region; if the new reference region is available, update the current reference region of the current block using the new reference region, and mark the j-th vector parameter as used for reference region merging; continue to check the (j+1)-th vector parameter until one or more vector parameters are traversed, and determine the last obtained current reference region as the second reference region; where j is an integer greater than i and less than or equal to n.
[0488] In some embodiments, the first merging unit 2003 is further configured to continue checking the (j+1)th vector parameter when the j-th vector parameter is marked as having been used for reference region merging.
[0489] In some embodiments, the first determining unit 2001 is further configured to determine whether the first reference region indicated by the j-th vector parameter overlaps with the current reference region, including the following four judgment conditions: whether the left side of the current reference region is to the right of the right side of the first reference region indicated by the j-th vector parameter; whether the right side of the current reference region is to the left of the left side of the first reference region indicated by the j-th vector parameter; whether the upper side of the current reference region is below the lower side of the first reference region indicated by the j-th vector parameter; and whether the lower side of the current reference region is above the upper side of the first reference region indicated by the j-th vector parameter.
[0490] In some embodiments, the first determining unit 2001 is further configured to determine that the first reference region indicated by the j-th vector parameter does not overlap with the current reference region if any one of the four determination conditions is satisfied.
[0491] If none of the four judgment conditions are met, then it is determined that the first reference region indicated by the j-th vector parameter overlaps with the current reference region.
[0492] In some embodiments, the first merging unit 2003 is further configured to continue checking the (j+1)th vector parameter if the first reference region indicated by the j-th vector parameter does not overlap with the current reference region.
[0493] In some embodiments, the first merging unit 2003 is further configured to determine the first upper-left corner vector parameter and the first lower-right corner vector parameter corresponding to the first reference region indicated by the j-th vector parameter, and to determine the second upper-left corner vector parameter and the second lower-right corner vector parameter corresponding to the current reference region; determine the third upper-left corner vector parameter based on the first upper-left corner vector parameter and the second upper-left corner vector parameter; determine the third lower-right corner vector parameter based on the first lower-right corner vector parameter and the second lower-right corner vector parameter; and obtain a new reference region based on the third upper-left corner vector parameter and the third lower-right corner vector parameter.
[0494] In some embodiments, the first determining unit 2001 is further configured to determine that a new reference region is available when the new reference region is located within a predefined region; wherein the predefined region includes at least one of the following: a reconstructed region determined based on the location information and / or the size information of the current block; a reconstructed region determined based on the size information of the coding tree unit to which the current block belongs; or all or part of the reconstructed region in the current image to which the current block belongs.
[0495] In some embodiments, the first determining unit 2001 is further configured to determine that a new reference region is available when the size of the new reference region does not exceed the maximum permissible size.
[0496] In some embodiments, the maximum permissible size is a fixed value.
[0497] In some embodiments, the maximum allowed size is related to preset parameters, which include at least: the size of the current block, and / or the number of times the current reference region has been merged.
[0498] In some embodiments, the first determining unit 2001 is further configured to: determine the gradient filter of the current block; determine the gradient information of the current block based on at least one second reference region and the gradient filter; wherein the gradient information includes at least one candidate prediction mode and the amplitude accumulation value corresponding to at least one candidate prediction mode; construct the gradient histogram of the current block based on at least one candidate prediction mode and the amplitude accumulation value corresponding to at least one candidate prediction mode; and determine one or more prediction modes of the current block based on the gradient histogram.
[0499] In some embodiments, the first determining unit 2001 is further configured to determine the angle prediction mode and gradient magnitude corresponding to each of the reference samples in at least one second reference region based on the reference samples and gradient filters in at least one second reference region; determine at least one candidate prediction mode based on the angle prediction mode and gradient magnitude corresponding to each of the reference samples in at least one second reference region; and perform an accumulation operation on the gradient magnitudes belonging to the same candidate prediction mode to obtain an amplitude accumulation value corresponding to at least one candidate prediction mode.
[0500] In some embodiments, the first determining unit 2001 is further configured to determine the gradient filter of the current block based on the size of the current block.
[0501] In some embodiments, the first determining unit 2001 is further configured to determine the gradient filter of the current block as a first shape filter when the size of the current block is less than a size threshold, and to determine the gradient filter of the current block as a second shape filter when the size of the current block is greater than a size threshold.
[0502] In some embodiments, the first determining unit 2001 is further configured to determine the top m candidate prediction modes with the highest cumulative magnitude values in the gradient histogram as one or more prediction modes of the current block; where m is a positive integer.
[0503] In some embodiments, the first determining unit 2001 is further configured to determine the transform set of the current block; determine the transform kernel of the current block based on the transform set; and transform the residual samples of the current block based on the transform kernel to determine the transform coefficients of the current block.
[0504] In some embodiments, the first determining unit 2001 is further configured to determine the transform set category of the current block; and to determine the transform set of the current block based on the transform set category.
[0505] In some embodiments, the first determining unit 2001 is further configured to determine the transform set category of the current block as a first category when the current block is predicted using the decoder-side intra-mode derivation indicated by the block vector; wherein the first category is the transform set category corresponding to at least one of the decoder-side intra-prediction mode derivation mode and the template-based intra-mode derivation mode; or, when the current block is predicted using the decoder-side intra-mode derivation indicated by the block vector, determine the transform set category of the current block as a second category; wherein the second category is the transform set category corresponding to at least one of the intra-template matching prediction mode, the intra-block copy mode, and the inter-frame prediction mode.
[0506] In some embodiments, referring to FIG20, the encoder 200 may further include an encoding unit 2004, wherein: the first determining unit 2001 is further configured to determine the value of a first syntax element; wherein the first syntax element is used to indicate whether the current block is predicted using the block vector-indicated intra-frame mode derivation at the decoding end; the encoding unit 2004 is configured to encode the value of the first syntax element and write the obtained encoded bits into the bitstream.
[0507] In some embodiments, the first prediction unit 2002 is further configured to determine one or more first prediction blocks based on one or more prediction modes; determine one or more second prediction blocks based on one or more vector parameters; and determine the prediction sample of the current block by performing weighted fusion of one or more first prediction blocks and one or more second prediction blocks.
[0508] In some embodiments, the first determining unit 2001 is further configured to use one or more prediction modes corresponding to the current block for reference in subsequent coding blocks; and / or, one or more vector parameters corresponding to the current block for reference in subsequent coding blocks.
[0509] Understandably, in the embodiments of this application, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular one. Furthermore, the components in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit described above can be implemented in hardware or as a software functional module.
[0510] In another embodiment of this application, FIG21 is a schematic diagram of the hardware structure of an encoder provided in an embodiment of this application. As shown in FIG21, the encoder 200 may include: a first communication interface 2101, a first memory 2102, and a first processor 2103; the various components are coupled together through a first bus system 2104. It is understood that the first bus system 2104 is used to realize the connection and communication between these components. In addition to a data bus, the first bus system 2104 also includes a power bus, a control bus, and a status signal bus. However, for clarity, all buses are labeled as the first bus system 2104 in FIG21. The first communication interface 2101 is used for receiving and sending signals during the process of sending and receiving information with other external network elements;
[0511] The first memory 2102 is used to store computer programs that can run on the first processor 2103;
[0512] The first processor 2103 is configured to, when running the computer program, perform the following actions: determining one or more vector parameters of the current block; determining at least one second reference region based on a first reference region indicated by the one or more vector parameters; wherein the second reference region is obtained by merging the first reference regions indicated by at least some of the one or more vector parameters; determining one or more prediction modes of the current block based on the at least one second reference region; wherein the one or more prediction modes are determined based on gradient information derived from the at least one second reference region; and determining prediction samples of the current block based on the one or more prediction modes.
[0513] It is understood that the first memory 2102 in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The first memory 2102 of the system and method described in this application is intended to include, but is not limited to, these and any other suitable types of memory.
[0514] The first processor 2103 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the first processor 2103 or by instructions in software form. The first processor 2103 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in the first memory 2102. The first processor 2103 reads the information in the first memory 2102 and completes the steps of the above method in conjunction with its hardware.
[0515] It is understood that the embodiments described in this application can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application, or combinations thereof. For software implementation, the technology described in this application can be implemented through modules (e.g., procedures, functions, etc.) that perform the functions described in this application. Software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.
[0516] Alternatively, as another embodiment, the first processor 2103 is further configured to perform the method described in any of the foregoing embodiments when running the computer program.
[0517] This embodiment provides an encoder that, after determining one or more vector parameters of the current block, can remove redundancy between reference regions and reduce complexity by merging at least some of the first reference regions indicated by the vector parameters. Compared to the first reference regions indicated by one or more vector parameters, the size of the reference regions ultimately used to derive one or more prediction modes is reduced, thereby also reducing the efficiency of the derivation process. Furthermore, when deriving the corresponding gradient information based on at least one second reference region, different gradient filters can be adaptively selected according to the size of the current block, further reducing complexity and thus improving coding efficiency.
[0518] In another embodiment of this application, based on the same inventive concept as the foregoing embodiments, FIG22 is a schematic diagram of the composition structure of a decoder provided in an embodiment of this application. As shown in FIG22, the decoder 220 may include a second determining unit 2201 and a second predicting unit 2202, wherein:
[0519] The second determining unit 2201 is configured to: determine one or more vector parameters of the current block; determine at least one second reference region based on a first reference region indicated by the one or more vector parameters; wherein the second reference region is obtained by merging the first reference regions indicated by at least some of the one or more vector parameters; and determine one or more prediction modes of the current block based on the at least one second reference region; wherein the one or more prediction modes are determined based on gradient information derived from the at least one second reference region.
[0520] The second prediction unit 2202 is configured to determine the prediction sample of the current block based on one or more prediction modes.
[0521] In some embodiments, referring to FIG22, the decoder 220 may further include a second merging unit 2203, configured to merge the first reference regions indicated by at least some of the vector parameters in one or more vector parameters when there is an overlap, to determine a second reference region.
[0522] In some embodiments, the second determining unit 2201 is further configured to determine whether the i-th vector parameter is marked as having been used for reference region merging; when the i-th vector parameter is not marked as having been used for reference region merging, determine the current reference region indicated by the i-th vector parameter; and determine at least one second reference region based on the current reference region and one or more first reference regions not used for reference region merging indicated by one or more vector parameters; wherein i is an integer greater than 0 and less than or equal to n, and n represents the number of one or more vector parameters.
[0523] In some embodiments, the number of second reference regions is a preset constant.
[0524] In some embodiments, the second merging unit 2203 is further configured to, when the j-th vector parameter is detected, determine whether the j-th vector parameter has been marked as used for reference region merging; if the j-th vector parameter has not been marked as used for reference region merging, obtain the first reference region indicated by the j-th vector parameter; if the first reference region indicated by the j-th vector parameter overlaps with the current reference region, merge the first reference region indicated by the j-th vector parameter with the current reference region to obtain a new reference region; if the new reference region is available, update the current reference region of the current block using the new reference region, and mark the j-th vector parameter as used for reference region merging; continue to check the (j+1)-th vector parameter until one or more vector parameters are traversed, and determine the last obtained current reference region as the second reference region; where j is an integer greater than i and less than or equal to n.
[0525] In some embodiments, the second merging unit 2203 is further configured to continue checking the (j+1)th vector parameter when the j-th vector parameter is marked as having been used for reference region merging.
[0526] In some embodiments, the second determining unit 2201 is further configured to determine whether the first reference region indicated by the j-th vector parameter overlaps with the current reference region, including the following four judgment conditions: whether the left side of the current reference region is to the right of the right side of the first reference region indicated by the j-th vector parameter; whether the right side of the current reference region is to the left of the left side of the first reference region indicated by the j-th vector parameter; whether the upper side of the current reference region is below the lower side of the first reference region indicated by the j-th vector parameter; and whether the lower side of the current reference region is above the upper side of the first reference region indicated by the j-th vector parameter.
[0527] In some embodiments, the second determining unit 2201 is further configured to determine that the first reference region indicated by the j-th vector parameter does not overlap with the current reference region if any one of the four determination conditions is satisfied; and to determine that the first reference region indicated by the j-th vector parameter overlaps with the current reference region if all four determination conditions are not satisfied.
[0528] In some embodiments, the second merging unit 2203 is further configured to continue checking the (j+1)th vector parameter if the first reference region indicated by the j-th vector parameter does not overlap with the current reference region.
[0529] In some embodiments, the second merging unit 2203 is further configured to determine the first upper-left corner vector parameter and the first lower-right corner vector parameter corresponding to the first reference region indicated by the j-th vector parameter, and to determine the second upper-left corner vector parameter and the second lower-right corner vector parameter corresponding to the current reference region; determine the third upper-left corner vector parameter based on the first upper-left corner vector parameter and the second upper-left corner vector parameter; determine the third lower-right corner vector parameter based on the first lower-right corner vector parameter and the second lower-right corner vector parameter; and obtain a new reference region based on the third upper-left corner vector parameter and the third lower-right corner vector parameter.
[0530] In some embodiments, the second determining unit 2201 is further configured to determine that a new reference region is available when the new reference region is located within a predefined region; wherein the predefined region includes at least one of the following: a reconstructed region determined based on the location information and / or size information of the current block; a reconstructed region determined based on the size information of the coding tree unit to which the current block belongs; or all or part of the reconstructed region in the current image to which the current block belongs.
[0531] In some embodiments, the second determining unit 2201 is further configured to determine that a new reference region is available when the size of the new reference region does not exceed the maximum permissible size.
[0532] In some embodiments, the maximum permissible size is a fixed value.
[0533] In some embodiments, the maximum allowed size is related to preset parameters, which include at least: the size of the current block, and / or the number of times the current reference region has been merged.
[0534] In some embodiments, the second determining unit 2201 is further configured to: determine the gradient filter of the current block; determine the gradient information of the current block based on at least one second reference region and the gradient filter; wherein the gradient information includes at least one candidate prediction mode and the amplitude accumulation value corresponding to at least one candidate prediction mode; construct the gradient histogram of the current block based on at least one candidate prediction mode and the amplitude accumulation value corresponding to at least one candidate prediction mode; and determine one or more prediction modes of the current block based on the gradient histogram.
[0535] In some embodiments, the second determining unit 2201 is further configured to determine the angle prediction mode and gradient magnitude corresponding to each of the reference samples in at least one second reference region based on the reference samples and gradient filters in at least one second reference region; determine at least one candidate prediction mode based on the angle prediction mode and gradient magnitude corresponding to each of the reference samples in at least one second reference region; and perform an accumulation operation on the gradient magnitudes belonging to the same candidate prediction mode to obtain an amplitude accumulation value corresponding to at least one candidate prediction mode.
[0536] In some embodiments, the second determining unit 2201 is further configured to determine the gradient filter of the current block based on the size of the current block.
[0537] In some embodiments, the second determining unit 2201 is further configured to determine the gradient filter of the current block as a first shape filter when the size of the current block is less than a size threshold; and to determine the gradient filter of the current block as a second shape filter when the size of the current block is greater than a size threshold.
[0538] In some embodiments, the second determining unit 2201 is further configured to determine the top m candidate prediction modes with the highest cumulative magnitude values in the gradient histogram as one or more prediction modes of the current block; where m is a positive integer.
[0539] In some embodiments, the second determining unit 2201 is further configured to determine the transform set of the current block; determine the transform kernel of the current block based on the transform set; and perform an inverse transform on the inverse quantization coefficients of the current block based on the transform kernel to determine the residual sample of the current block.
[0540] In some embodiments, the second determining unit 2201 is further configured to determine the transform set category of the current block; and to determine the transform set of the current block based on the transform set category.
[0541] In some embodiments, the second determining unit 2201 is further configured to determine the transform set category of the current block as a first category when the current block is predicted using the decoder-side intra-mode derivation indicated by the block vector; wherein the first category is the transform set category corresponding to at least one of the decoder-side intra-prediction mode derivation mode and the template-based intra-mode derivation mode; or, when the current block is predicted using the decoder-side intra-mode derivation indicated by the block vector, determine the transform set category of the current block as a second category; wherein the second category is the transform set category corresponding to at least one of the intra-template matching prediction mode, the intra-block copy mode, and the inter-frame prediction mode.
[0542] In some embodiments, referring to FIG22, the decoder 220 may further include a decoding unit 2204 configured to parse a first syntax element in the bitstream; and when the first syntax element indicates that the current block is predicted using the decoder-side intra-mode derivation indicated by the block vector, to perform a step of determining one or more vector parameters of the current block.
[0543] In some embodiments, the second prediction unit 2202 is further configured to determine one or more first prediction blocks based on one or more prediction modes; determine one or more second prediction blocks based on one or more vector parameters; and determine the prediction sample of the current block by performing weighted fusion of one or more first prediction blocks and one or more second prediction blocks.
[0544] In some embodiments, the second determining unit 2201 is further configured to use one or more prediction modes corresponding to the current block for reference in subsequent decoding blocks; and / or, one or more vector parameters corresponding to the current block for reference in subsequent decoding blocks.
[0545] Understandably, in this embodiment, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular component. Furthermore, the components in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional module.
[0546] In another embodiment of this application, FIG23 is a schematic diagram of the hardware structure of a decoder provided in an embodiment of this application. As shown in FIG23, the decoder 220 may include: a second communication interface 2301, a second memory 2302, and a second processor 2303; the various components are coupled together through a second bus system 2304. It is understood that the second bus system 2304 is used to realize the connection and communication between these components. In addition to the data bus, the second bus system 2304 also includes a power bus, a control bus, and a status signal bus. However, for clarity, all buses are labeled as the second bus system 2304 in FIG23. The second communication interface 2301 is used for receiving and sending signals during the process of sending and receiving information with other external network elements;
[0547] The second memory 2302 is used to store computer programs that can run on the second processor 2303;
[0548] The second processor 2303 is configured to, when running the computer program, perform the following actions: determining one or more vector parameters of the current block; determining at least one second reference region based on a first reference region indicated by the one or more vector parameters; wherein the second reference region is obtained by merging the first reference regions indicated by at least some of the one or more vector parameters; determining one or more prediction modes of the current block based on the at least one second reference region; wherein the one or more prediction modes are determined based on gradient information derived from the at least one second reference region; and determining prediction samples of the current block based on the one or more prediction modes.
[0549] Alternatively, as another embodiment, the second processor 2303 is also configured to execute the method described in any of the foregoing embodiments when running the computer program.
[0550] It is understood that the second memory 2302 has similar hardware functions to the first memory 2102, and the second processor 2303 has similar hardware functions to the first processor 2103; details will not be elaborated here.
[0551] This embodiment provides a decoder that, after determining one or more vector parameters of the current block, can remove redundancy between reference regions and reduce complexity by merging at least some of the first reference regions indicated by the vector parameters. Compared to the first reference regions indicated by one or more vector parameters, the size of the reference regions ultimately used to derive one or more prediction modes is reduced, thereby also reducing the efficiency of the derivation process. Furthermore, when deriving the corresponding gradient information based on at least one second reference region, different gradient filters can be adaptively selected according to the size of the current block, further reducing complexity and thus improving decoding efficiency.
[0552] In another embodiment of this application, FIG24 is a schematic diagram of the composition structure of an encoding and decoding system provided in an embodiment of this application. As shown in FIG24, the encoding and decoding system 240 may include an encoder 2401 and a decoder 2402.
[0553] In this embodiment, encoder 2401 can be any of the encoders described in the foregoing embodiments, and decoder 2402 can be any of the decoders described in the foregoing embodiments.
[0554] In some embodiments, this application also provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the method as described in any of the foregoing embodiments. Specifically, when executed by a first processor, the computer program implements the encoding method as described in any of the foregoing embodiments, or when executed by a second processor, it implements the decoding method as described in any of the foregoing embodiments.
[0555] In some embodiments, this application also provides a computer program product, including a computer program or instructions. When executed by a processor, the computer program or instructions implement the method as described in any of the foregoing embodiments. Specifically, when executed by a first processor, the computer program or instructions implement the encoding method as described in any of the foregoing embodiments, or when executed by a second processor, they implement the decoding method as described in any of the foregoing embodiments.
[0556] In some embodiments, this application also provides a computer program that, when executed by a processor, implements the method as described in any of the foregoing embodiments. Specifically, when executed by a first processor, the computer program or instructions implement the encoding method as described in any of the foregoing embodiments, or when executed by a second processor, implement the decoding method as described in any of the foregoing embodiments.
[0557] In some embodiments, this application also provides a computer-readable storage medium storing a bitstream thereon. The bitstream is generated by performing the steps of the encoding method as described in any of the foregoing embodiments.
[0558] In this embodiment of the application, the information to be encoded in the encoding method includes at least one of the following: the quantization coefficients of the current block, the transform kernel index, and the value of the first syntax element. Here, this information to be encoded is encoded and written into the bitstream.
[0559] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0560] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described apparatus and unit can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0561] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0562] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0563] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0564] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0565] It should be noted that, in this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0566] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0567] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0568] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0569] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method or device embodiments.
[0570] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims. Industrial applicability
[0571] In this embodiment, both the encoding and decoding ends, after determining one or more vector parameters of the current block, determine at least one second reference region based on the first reference region indicated by the one or more vector parameters; determine one or more prediction modes of the current block based on the at least one second reference region; wherein the second reference region is obtained by merging the first reference regions indicated by at least some of the vector parameters, and the one or more prediction modes are determined based on gradient information derived from the at least one second reference region; and determine the prediction samples of the current block based on the one or more prediction modes. Thus, by merging the first reference regions indicated by at least some vector parameters, redundancy between reference regions can be removed, reducing complexity; compared to the first reference regions indicated by one or more vector parameters, the size of the reference region ultimately used to derive one or more prediction modes is reduced, thereby further reducing the efficiency of the derivation process. Moreover, when deriving the corresponding gradient information based on at least one second reference region, different gradient filters can be adaptively selected according to the size of the current block, further reducing complexity; thus, when the current block is predicted using the BVG-DIMD mode, complexity can be reduced, thereby improving encoding and decoding efficiency.
Claims
1. A decoding method applied to a decoder, the method comprising: Determine one or more vector parameters for the current block; At least one second reference region is determined based on a first reference region indicated by one or more vector parameters; wherein the second reference region is obtained by merging the first reference regions indicated by at least some of the vector parameters. Based on the at least one second reference region, one or more prediction modes of the current block are determined; wherein the one or more prediction modes are determined based on gradient information derived from the at least one second reference region; Based on the one or more prediction patterns, determine the prediction sample for the current block.
2. The method according to claim 1, wherein, Determining at least one second reference region based on the first reference region indicated by the one or more vector parameters includes: When the first reference regions indicated by at least some of the vector parameters overlap, the first reference regions indicated by the at least some vector parameters are merged to determine the second reference region.
3. The method according to claim 1, wherein, Determining at least one second reference region based on the first reference region indicated by the one or more vector parameters includes: Determine whether the i-th vector parameter has been marked as used for reference region merging; When the i-th vector parameter is not marked as having been used for reference region merging, the current reference region indicated by the i-th vector parameter is determined; The at least one second reference region is determined based on the current reference region and one or more first reference regions not used for reference region merging, indicated by the one or more vector parameters; Where i is an integer greater than 0 and less than or equal to n, and n represents the number of the one or more vector parameters.
4. The method according to claim 3, wherein, The number of the second reference regions is a preset constant.
5. The method according to claim 3, wherein, Determining the at least one second reference region based on the current reference region and one or more first reference regions not used for reference region merging indicated by the one or more vector parameters includes: When the j-th vector parameter is detected, determine whether the j-th vector parameter has been marked as used for reference region merging; When the j-th vector parameter is not marked as having been used for reference region merging, the first reference region indicated by the j-th vector parameter is obtained; If the first reference region indicated by the j-th vector parameter overlaps with the current reference region, then the first reference region indicated by the j-th vector parameter and the current reference region are merged to obtain a new reference region; If the new reference region is available, update the current reference region of the current block using the new reference region, and mark the j-th vector parameter as having been used for reference region merging; Continue to check the (j+1)th vector parameter until the one or more vector parameters are traversed, and finally determine the current reference region as the second reference region; Where j is an integer greater than i and less than or equal to n.
6. The method according to claim 5, wherein, The method further includes: When the j-th vector parameter is marked as having been used for reference region merging, the (j+1)-th vector parameter is checked.
7. The method according to claim 5, wherein, The method further includes: Determining whether the first reference region indicated by the j-th vector parameter overlaps with the current reference region includes the following four judgment conditions: Is the left side of the current reference region to the right of the right side of the first reference region indicated by the j-th vector parameter? Is the right side of the current reference region to the left of the left side of the first reference region indicated by the j-th vector parameter? Is the upper side of the current reference region below the lower side of the first reference region indicated by the j-th vector parameter? Is the lower side of the current reference region above the upper side of the first reference region indicated by the j-th vector parameter? 8. The method according to claim 7, wherein, The method further includes: If any one of the four judgment conditions is satisfied, then it is determined that the first reference region indicated by the j-th vector parameter does not overlap with the current reference region; If none of the four judgment conditions are met, then it is determined that the first reference region indicated by the j-th vector parameter overlaps with the current reference region.
9. The method according to claim 5, wherein, The method further includes: If the first reference region indicated by the j-th vector parameter does not overlap with the current reference region, then continue to check the (j+1)-th vector parameter.
10. The method according to claim 5, wherein, The step of merging the first reference region indicated by the j-th vector parameter with the current reference region to obtain a new reference region includes: Determine the first top-left vector parameter and the first bottom-right vector parameter corresponding to the first reference region indicated by the j-th vector parameter, and determine the second top-left vector parameter and the second bottom-right vector parameter corresponding to the current reference region; The third top-left corner vector parameter is determined based on the first top-left corner vector parameter and the second top-left corner vector parameter; The third lower right corner vector parameter is determined based on the first lower right corner vector parameter and the second lower right corner vector parameter; The new reference region is obtained based on the third upper left corner vector parameter and the third lower right corner vector parameter.
11. The method according to claim 5, wherein, The method further includes: When the new reference region is located within a predefined region, the new reference region is determined to be available. The predefined region includes at least one of the following: The reconstructed area determined based on the location information and / or size information of the current block; The reconstructed region is determined based on the size information of the coding tree unit to which the current block belongs; The current block refers to all or part of the reconstructed area in the current image.
12. The method according to claim 5, wherein, The method further includes: The new reference area is deemed usable if its size does not exceed the maximum allowable size.
13. The method according to claim 12, wherein, The maximum allowable size is a fixed value.
14. The method according to claim 12, wherein, The maximum allowable size is related to preset parameters, which include at least: the size of the current block, and / or the number of times the current reference region has been merged.
15. The method according to any one of claims 1 to 14, wherein, Determining one or more prediction modes for the current block based on the at least one second reference region includes: Determine the gradient filter for the current block; The gradient information of the current block is determined based on the at least one second reference region and the gradient filter; wherein the gradient information includes at least one candidate prediction mode and the magnitude accumulation value corresponding to the at least one candidate prediction mode; Construct the gradient histogram of the current block based on the at least one candidate prediction mode and the magnitude accumulation value corresponding to the at least one candidate prediction mode; Based on the gradient histogram, one or more prediction modes for the current block are determined.
16. The method according to claim 15, wherein, Determining the gradient information of the current block based on the at least one second reference region and the gradient filter includes: Based on the reference samples in the at least one second reference region and the gradient filter, determine the angle prediction mode and gradient magnitude corresponding to each reference sample in the at least one second reference region; Based on the angle prediction mode and gradient magnitude corresponding to the reference samples in the at least one second reference region, the at least one candidate prediction mode is determined, and the gradient magnitudes belonging to the same candidate prediction mode are accumulated to obtain the magnitude accumulation value corresponding to the at least one candidate prediction mode.
17. The method according to claim 15, wherein, The step of determining the gradient filter for the current block includes: The gradient filter for the current block is determined based on the size of the current block.
18. The method according to claim 17, wherein, The step of determining the gradient filter for the current block based on the size of the current block includes: If the size of the current block is less than a size threshold, the gradient filter of the current block is determined to be a first shape filter; If the size of the current block is greater than a size threshold, the gradient filter of the current block is determined to be a second shape filter.
19. The method according to claim 15, wherein, Determining one or more prediction modes for the current block based on the gradient histogram includes: The top m candidate prediction modes with the highest cumulative magnitude values in the gradient histogram are determined as one or more prediction modes for the current block; where m is a positive integer.
20. The method according to any one of claims 1 to 19, wherein, The method further includes: Determine the transformation set of the current block; The transform kernel of the current block is determined based on the transform set; The inverse transformation of the inverse quantization coefficients of the current block is performed according to the transformation kernel to determine the residual sample of the current block.
21. The method according to claim 20, wherein, Determining the transformation set of the current block includes: Determine the transformation set category of the current block; The transformation set of the current block is determined based on the transformation set category.
22. The method according to claim 21, wherein, The method further includes: When the current block is predicted using the decoder's intra-mode derivation indicated by the block vector, the transform set category of the current block is determined to be a first category; wherein, the first category is the transform set category corresponding to at least one of the decoder's intra-prediction mode derivation mode and the template-based intra-mode derivation mode; or... When the current block is predicted using the intra-mode derivation at the decoding end indicated by the block vector, the transform set category of the current block is determined to be the second category; wherein, the second category is the transform set category corresponding to at least one of the intra-template matching prediction mode, intra-block copy mode, and inter-frame prediction mode.
23. The method according to claim 1, wherein, The method further includes: Parse the first syntax element in the bitstream; When the first syntax element indicates that the current block is predicted using the decoder intra-mode derivation indicated by the block vector, the step of determining one or more vector parameters of the current block is performed.
24. The method according to claim 1, wherein, Determining the prediction sample for the current block based on the one or more prediction modes includes: Based on the one or more prediction modes, determine one or more first prediction blocks; Based on the one or more vector parameters, determine one or more second prediction blocks; The prediction sample of the current block is determined by weighted fusion of the one or more first prediction blocks and the one or more second prediction blocks.
25. The method according to any one of claims 1 to 24, wherein, The method further includes: One or more prediction modes corresponding to the current block are used for reference in subsequent decoded blocks; and / or, One or more vector parameters corresponding to the current block are used as references for subsequent decoded blocks.
26. An encoding method applied to an encoder, the method comprising: Determine one or more vector parameters for the current block; At least one second reference region is determined based on a first reference region indicated by one or more vector parameters; wherein the second reference region is obtained by merging the first reference regions indicated by at least some of the vector parameters. Based on the at least one second reference region, one or more prediction modes of the current block are determined; wherein the one or more prediction modes are determined based on gradient information derived from the at least one second reference region; Based on the one or more prediction patterns, determine the prediction sample for the current block.
27. The method according to claim 26, wherein, Determining at least one second reference region based on the first reference region indicated by the one or more vector parameters includes: When the first reference regions indicated by at least some of the vector parameters overlap, the first reference regions indicated by the at least some vector parameters are merged to determine the second reference region.
28. The method according to claim 26, wherein, Determining at least one second reference region based on the first reference region indicated by the one or more vector parameters includes: Determine whether the i-th vector parameter has been marked as used for reference region merging; When the i-th vector parameter is not marked as having been used for reference region merging, the current reference region indicated by the i-th vector parameter is determined; The at least one second reference region is determined based on the current reference region and one or more first reference regions not used for reference region merging, indicated by the one or more vector parameters; Where i is an integer greater than 0 and less than or equal to n, and n represents the number of the one or more vector parameters.
29. The method of claim 28, wherein, The number of the second reference regions is a preset constant.
30. The method of claim 28, wherein, Determining the at least one second reference region based on the current reference region and one or more first reference regions not used for reference region merging indicated by the one or more vector parameters includes: When the j-th vector parameter is detected, determine whether the j-th vector parameter has been marked as used for reference region merging; When the j-th vector parameter is not marked as having been used for reference region merging, the first reference region indicated by the j-th vector parameter is obtained; If the first reference region indicated by the j-th vector parameter overlaps with the current reference region, then the first reference region indicated by the j-th vector parameter and the current reference region are merged to obtain a new reference region; If the new reference region is available, update the current reference region of the current block using the new reference region, and mark the j-th vector parameter as having been used for reference region merging; Continue to check the (j+1)th vector parameter until the one or more vector parameters are traversed, and finally determine the current reference region as the second reference region; Where j is an integer greater than i and less than or equal to n.
31. The method of claim 30, wherein, The method further includes: When the j-th vector parameter is marked as having been used for reference region merging, the (j+1)-th vector parameter is checked.
32. The method of claim 30, wherein, The method further includes: Determining whether the first reference region indicated by the j-th vector parameter overlaps with the current reference region includes the following four judgment conditions: Is the left side of the current reference region to the right of the right side of the first reference region indicated by the j-th vector parameter? Is the right side of the current reference region to the left of the left side of the first reference region indicated by the j-th vector parameter? Is the upper side of the current reference region below the lower side of the first reference region indicated by the j-th vector parameter? Is the lower side of the current reference region above the upper side of the first reference region indicated by the j-th vector parameter? 33. The method of claim 32, wherein, The method further includes: If any one of the four judgment conditions is satisfied, then it is determined that the first reference region indicated by the j-th vector parameter does not overlap with the current reference region; If none of the four judgment conditions are met, then it is determined that the first reference region indicated by the j-th vector parameter overlaps with the current reference region.
34. The method of claim 30, wherein, The method further includes: If the first reference region indicated by the j-th vector parameter does not overlap with the current reference region, then continue to check the (j+1)-th vector parameter.
35. The method of claim 30, wherein, The step of merging the first reference region indicated by the j-th vector parameter with the current reference region to obtain a new reference region includes: Determine the first top-left vector parameter and the first bottom-right vector parameter corresponding to the first reference region indicated by the j-th vector parameter, and determine the second top-left vector parameter and the second bottom-right vector parameter corresponding to the current reference region; The third top-left corner vector parameter is determined based on the first top-left corner vector parameter and the second top-left corner vector parameter; The third lower right corner vector parameter is determined based on the first lower right corner vector parameter and the second lower right corner vector parameter; The new reference region is obtained based on the third upper left corner vector parameter and the third lower right corner vector parameter.
36. The method of claim 30, wherein, The method further includes: When the new reference region is located within a predefined region, the new reference region is determined to be available. The predefined region includes at least one of the following: The reconstructed area determined based on the location information and / or size information of the current block; The reconstructed region is determined based on the size information of the coding tree unit to which the current block belongs; The current block refers to all or part of the reconstructed area in the current image.
37. The method of claim 30, wherein, The method further includes: The new reference area is deemed usable if its size does not exceed the maximum allowable size.
38. The method of claim 37, wherein, The maximum allowable size is a fixed value.
39. The method of claim 37, wherein, The maximum allowable size is related to preset parameters, which include at least: the size of the current block, and / or the number of times the current reference region has been merged.
40. The method of any one of claims 26 to 39, wherein, Determining one or more prediction modes for the current block based on the at least one second reference region includes: Determine the gradient filter for the current block; The gradient information of the current block is determined based on the at least one second reference region and the gradient filter; wherein the gradient information includes at least one candidate prediction mode and the magnitude accumulation value corresponding to the at least one candidate prediction mode; Construct the gradient histogram of the current block based on the at least one candidate prediction mode and the magnitude accumulation value corresponding to the at least one candidate prediction mode; Based on the gradient histogram, one or more prediction modes for the current block are determined.
41. The method of claim 40, wherein, Determining the gradient information of the current block based on the at least one second reference region and the gradient filter includes: Based on the reference samples in the at least one second reference region and the gradient filter, determine the angle prediction mode and gradient magnitude corresponding to each reference sample in the at least one second reference region; Based on the angle prediction mode and gradient magnitude corresponding to the reference samples in the at least one second reference region, the at least one candidate prediction mode is determined, and the gradient magnitudes belonging to the same candidate prediction mode are accumulated to obtain the magnitude accumulation value corresponding to the at least one candidate prediction mode.
42. The method of claim 40, wherein, The step of determining the gradient filter for the current block includes: The gradient filter for the current block is determined based on the size of the current block.
43. The method of claim 42, wherein, The step of determining the gradient filter for the current block based on the size of the current block includes: If the size of the current block is less than a size threshold, the gradient filter of the current block is determined to be a first shape filter; If the size of the current block is greater than a size threshold, the gradient filter of the current block is determined to be a second shape filter.
44. The method of claim 40, wherein, Determining one or more prediction modes for the current block based on the gradient histogram includes: The top m candidate prediction modes with the highest cumulative magnitude values in the gradient histogram are determined as one or more prediction modes for the current block; where m is a positive integer.
45. The method of any one of claims 26 to 44, wherein, The method further includes: Determine the transformation set of the current block; The transform kernel of the current block is determined based on the transform set; The transformation coefficients of the current block are determined by transforming the residual samples of the current block according to the transformation kernel.
46. The method of claim 45, wherein, Determining the transformation set of the current block includes: Determine the transformation set category of the current block; The transformation set of the current block is determined based on the transformation set category.
47. The method of claim 46, wherein, The method further includes: When the current block is predicted using the decoder's intra-mode derivation indicated by the block vector, the transform set category of the current block is determined to be a first category; wherein, the first category is the transform set category corresponding to at least one of the decoder's intra-prediction mode derivation mode and the template-based intra-mode derivation mode; or... When the current block is predicted using the intra-mode derivation at the decoding end indicated by the block vector, the transform set category of the current block is determined to be the second category; wherein, the second category is the transform set category corresponding to at least one of the intra-template matching prediction mode, intra-block copy mode, and inter-frame prediction mode.
48. The method of claim 26, wherein, The method further includes: Determine the value of the first syntax element; wherein the first syntax element is used to indicate whether the current block is predicted using the intra-frame mode derivation of the decoding end indicated by the block vector; The value of the first syntax element is encoded, and the resulting encoded bits are written into the bitstream.
49. The method according to claim 26, wherein, Determining the prediction sample for the current block based on the one or more prediction modes includes: Based on the one or more prediction modes, determine one or more first prediction blocks; Based on the one or more vector parameters, determine one or more second prediction blocks; The prediction sample of the current block is determined by weighted fusion of the one or more first prediction blocks and the one or more second prediction blocks.
50. The method of any one of claims 26 to 49, wherein, The method further includes: One or more prediction patterns corresponding to the current block are used for reference in subsequent coded blocks; and / or, One or more vector parameters corresponding to the current block are used as references for subsequent encoded blocks.
51. An encoder, the encoder comprising a first determining unit and a first predicting unit, wherein: The first determining unit is configured to: determine one or more vector parameters of the current block; determine at least one second reference region based on a first reference region indicated by the one or more vector parameters; wherein the second reference region is obtained by merging the first reference regions indicated by at least some of the one or more vector parameters; and determine one or more prediction modes of the current block based on the at least one second reference region; wherein the one or more prediction modes are determined based on gradient information derived from the at least one second reference region. The first prediction unit is configured to determine the prediction sample of the current block based on the one or more prediction modes.
52. An encoder, the encoder comprising a first memory and a first processor, wherein: The first memory is used to store computer programs that can run on the first processor; The first processor is configured to perform the method as described in any one of claims 26 to 50 when running the computer program.
53. A decoder, the decoder comprising a second determining unit and a second predicting unit, wherein: The second determining unit is configured to: determine one or more vector parameters of the current block; determine at least one second reference region based on a first reference region indicated by the one or more vector parameters; wherein the second reference region is obtained by merging the first reference regions indicated by at least some of the one or more vector parameters; and determine one or more prediction modes of the current block based on the at least one second reference region; wherein the one or more prediction modes are determined based on gradient information derived from the at least one second reference region. The second prediction unit is configured to determine the prediction sample of the current block based on the one or more prediction modes.
54. A decoder, the decoder comprising a second memory and a second processor, wherein: The second memory is used to store computer programs that can run on the second processor; The second processor is configured to perform the method as described in any one of claims 1 to 25 when running the computer program.
55. A computer readable storage medium having stored thereon a computer program, wherein, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 25, or the method as described in any one of claims 26 to 50.
56. A computer-readable storage medium having a code stream stored thereon, wherein, The bitstream is generated by performing the steps of the encoding method as described in any one of claims 26 to 50.