Encoding method and decoding method, bitstream, encoder, decoder, and storage medium

By constructing and grouping candidate matching block lists and performing fusion prediction based on index values, the method addresses the accuracy issues in Intra TMP, improving prediction accuracy and encoding/decoding efficiency in video coding.

JP2026511705APending Publication Date: 2026-04-14GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
Filing Date
2023-03-30
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Existing video coding technologies using Intra Template Matching Prediction (Intra TMP) directly utilize reconstructed pixels of the matching block as predicted pixels, leading to large deviations and reduced prediction accuracy in certain scenes.

Method used

Construct a list of first candidate matching blocks, group them into at least two candidate matching block groups, determine an index value for each group, and use this index value to select the appropriate group for fusion prediction, enhancing prediction accuracy and efficiency by limiting the range of index values and combining IntraTMP fusion prediction with multiple candidate prediction modes.

Benefits of technology

Improves prediction accuracy and encoding/decoding performance by optimizing the selection of matching blocks through grouping and fusion prediction, reducing bitrate and enhancing encoding efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2026511705000001_ABST
    Figure 2026511705000001_ABST
Patent Text Reader

Abstract

Embodiments of this application disclose an encoding method, a decoding method, a bitstream, an encoder, a decoder, and a storage medium. Based on template matching, a first candidate matching block list for the current block is constructed, the first candidate matching block list is grouped, at least two candidate matching block groups are determined, and an index value is determined for each candidate matching block group. On the encoding side, the index value of the first candidate matching block group corresponding to the current block is determined, and the index value of the first candidate matching block group is written to the bitstream. On the decoding side, the first candidate matching block group is determined based on the index value, fusion is performed based on the first candidate matching block group, and the predicted block for the current block is determined. In this way, by constructing and grouping candidate matching block lists, indicating the first candidate matching block group by its index value, and performing fusion prediction using the first candidate matching block group, prediction accuracy can be improved, bitrate can be saved, encoding and decoding efficiency can be improved, and encoding and decoding performance can be further improved.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] This application relates to the video coding and decoding technology, and more particularly to coding methods and decoding methods, bitstreams, encoders, decoders, and storage media. [Background technology]

[0002] The Intra Template Matching Prediction (Intra TMP) technique uses a template of coded blocks to search for the matching template with the minimum cost within a predefined search range in the current image, based on a predetermined cost function. The reconstructed block corresponding to the matching template is then used as the matching block, and this is used as the predicted block for the current coded block.

[0003] However, in the actual encoding process, related technologies typically use the reconstructed pixels of the matching block directly as the predicted pixels of the current encoded block. However, this is not adequately considered, leading to problems such as large deviations in certain scenes and reduced prediction accuracy. [Overview of the project]

[0004] This application provides an encoding method and a decoding method, a bitstream, an encoder, a decoder, and a storage medium that can improve prediction accuracy and further enhance encoding and decoding performance.

[0005] The technical solution of this application can be realized as follows:

[0006] In a first embodiment, the embodiment of the present application provides a decoding method performed by a decoder, the method being Based on template matching, construct a list of the first candidate matching blocks for the current block, The first candidate matching block list is grouped to determine at least two candidate matching block groups, and the index value of each candidate matching block group is determined. The index value of the first candidate matching block group corresponding to the current block is determined, Based on the index value of the first candidate matching block group, the first candidate matching block group is determined from at least two candidate matching block groups, This includes merging at least one matching block in the first candidate matching block group to determine the predicted block of the current block.

[0007] In a second embodiment, the embodiment of the present application provides an encoding method performed by an encoder, the method being Based on template matching, construct a list of the first candidate matching blocks for the current block, The first candidate matching block list is grouped to determine at least two candidate matching block groups, and the index value of each candidate matching block group is determined. From at least two candidate matching block groups, determine the index value of the first candidate matching block group corresponding to the current block, This includes encoding the index value of the first candidate matching block group and writing the resulting encoded bits to a bitstream.

[0008] In a third embodiment, the embodiment of the present application provides a bitstream, which is generated by bit encoding based on information to be encoded, where the information to be encoded is: The syntax includes a syntactic element for indicating the prediction mode of the current block, a syntactic element for indicating the index value of the best matching block corresponding to the current block, a syntactic element for indicating the index value of the best matching block corresponding to the current block, a syntactic element for indicating the fusion prediction mode type of the current block, a syntactic element for indicating whether or not to determine the index value of the first candidate matching block group of the current block, the number of matching blocks in the candidate matching block group, a value N for the fusion matching block number, the length of the first candidate matching block list, and the length of the second candidate matching block list.

[0009] In a fourth embodiment, an embodiment of the present application provides an encoder comprising a first determination unit, a first grouping unit, and a first prediction unit. The first decision unit is configured to build a list of first candidate matching blocks for the current block based on template matching. The first grouping unit is configured to group the first candidate matching block list, determine at least two candidate matching block groups, and determine the index value for each candidate matching block group. The first decision unit is further configured to determine the index value of the first candidate matching block group corresponding to the current block. The first decision unit is further configured to determine the first candidate matching block group from among at least two candidate matching block groups based on the index value of the first candidate matching block group. The first prediction unit is configured to merge at least one matching block in the first candidate matching block group and determine the predicted block for the current block.

[0010] In a fifth embodiment, the embodiment of the present application provides an encoder comprising a first memory and a first processor, The first memory stores computer programs that can be executed by the first processor. The first processor executes the method according to the second aspect by executing a computer program.

[0011] In a sixth aspect, an embodiment of the present application provides a decoder including a second determination unit, a second grouping unit, and a second prediction unit. The second determination unit is configured to construct a first candidate matching block list of the current block based on template matching. The second grouping unit is configured to group the first candidate matching block list, determine at least two candidate matching block groups, and determine an index value of each candidate matching block group. The second determination unit is configured to determine an index value of the first candidate matching block group corresponding to the current block. The second determination unit is further configured to determine the first candidate matching block group from at least two candidate matching block groups based on the index value of the first candidate matching block group. The second prediction unit is configured to fuse at least one matching block in the first candidate matching block group and determine a predicted block of the current block.

[0012] In a seventh aspect, an embodiment of the present application provides a decoder including a second memory and a second processor. The second memory stores a computer program executable by the second processor. The second processor executes the method according to the first aspect by executing a computer program.

[0013] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program for realizing the method according to the first aspect or the method according to the second aspect.

[0014] Embodiments of this application provide an encoding method, a decoding method, a bitstream, an encoder, a decoder, and a storage medium. Based on template matching, a first candidate matching block list for the current block is constructed, the first candidate matching block list is grouped, at least two candidate matching block groups are determined, and the index value of each candidate matching block group is determined. On the encoding side, the index value of the first candidate matching block group corresponding to the current block is determined, and the index value of the first candidate matching block group is written to the bitstream. On the decoding side, the first candidate matching block group is determined based on the index value, fusion is performed based on the first candidate matching block group, and the predicted block for the current block is determined. By constructing and grouping candidate matching block lists, indicating the first candidate matching block group by index value, and performing fusion prediction using the first candidate matching block group, prediction accuracy can be improved, bitrate can be saved, encoding and decoding efficiency can be improved, and encoding and decoding performance can be further enhanced. Furthermore, encoding efficiency can be improved by combining the IntraTMP fusion prediction mode and the IntraTMP multiple candidate prediction mode. Furthermore, encoding efficiency can be improved by limiting the range of index values ​​of the candidate matching block groups, saving codewords to encode the index values. For example, by resorting candidate matching block groups, the index values ​​can be kept within a relatively small index range. [Brief explanation of the drawing]

[0015] [Figure 1] This is a schematic diagram of the prediction process for Intra TMP technology. [Figure 2] This is a schematic diagram of the matching block for Intra TMP technology. [Figure 3] This is a schematic diagram of the template type for Intra TMP technology. [Figure 4A] This is a schematic diagram of the rough search process for template matching in Intra TMP technology. [Figure 4B] This is a schematic diagram of the detailed search process for template matching in Intra TMP technology. [Figure 5] This is a schematic diagram of the weighted fusion of IntraTMP fusion prediction technology. [Figure 6A] This is a schematic diagram of the filter's shape. [Figure 6B] This is a schematic diagram illustrating the derivation method for filter coefficients. [Figure 7] This is a schematic diagram of the vertical and horizontal partitioning methods for encoding blocks. [Figure 8A] This is an illustrative block diagram of the encoder configuration according to an embodiment of this application. [Figure 8B] This is an illustrative block diagram of the decoder configuration according to an embodiment of this application. [Figure 9] This is a schematic diagram of the network architecture of the coding and decoding system according to an embodiment of this application. [Figure 10] This is an illustrative flowchart of the decoding method according to the embodiment of this application. [Figure 11] This is an illustrative flowchart of the resorting method in the embodiment of this application. [Figure 12] This is a schematic diagram of the template prediction method in the embodiment of this application. [Figure 13] This is a schematic diagram of another template prediction method in the embodiment of this application. [Figure 14] This is an illustrative flowchart of the fusion method in the embodiment of this application. [Figure 15] This is an illustrative flowchart of the method for determining the fusion matching block in the embodiment of this application. [Figure 16] This is an illustrative flowchart of the encoding method according to the embodiment of this application. [Figure 17] This is an illustrative structural diagram of the encoder configuration according to an embodiment of this application. [Figure 18] This is a schematic diagram of the specific hardware structure of the encoder according to the embodiment of this application. [Figure 19]This is an illustrative structural diagram of the decoder configuration according to an embodiment of this application. [Figure 20] This is a schematic diagram of the specific hardware structure of the decoder according to the embodiment of this application. [Figure 21] This is an illustrative structural diagram of the configuration of the encoding and decoding system according to an embodiment of this application. [Modes for carrying out the invention]

[0016] In order to provide 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 drawings. The drawings are for reference and illustrative purposes only and are not intended to limit the embodiments of this application.

[0017] Unless otherwise specified, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art. The terms used herein are solely for illustrative purposes of the embodiments of this application and are not intended to limit this application.

[0018] In the following description, the term “several embodiments” refers to a subset of all possible embodiments, and as can be understood, “several embodiments” may be the same subset or different subsets of all possible embodiments, and these can be combined with one another without conflict. The terms “first / second / third” as used in the embodiments of this application are merely for distinguishing similar subjects and do not represent a particular order of subjects, and as can be understood, “first / second / third” may, in some cases, be interchangeable with a particular order or precedence, so that the embodiments of this application described herein may be carried out in an order other than the order illustrated or described.

[0019] Before describing the embodiments of this application in further detail, we will first explain the nouns and terms used in the embodiments of this application, which are interpreted as follows.

[0020] Coding Block (CB) Block Matching (BM) Coding Unit (CU) Block Vector (BV) Sum of Absolute Difference (SAD) Sum of Absolute Transformed Difference (SATD) Mean Squared Error (MSE) Sum of Squared Differences (SSD) Mean Absolute Deviation (MAD) Mean Squared Error Sum (MSD) Normalized Cross-Correlation Coefficient (NCC) H.266 / Versatile Video Coding (VVC) VVC Reference Software Test Platform (VTM: VVC Test Model) Intra Template Matching Prediction (Intra TMP) Beyond VVC's reference software testing platform (ECM: Enhanced Compression Model).

[0021] In a video image, an encoded block is generally represented by a first color component, a second color component, and a third color component, where these three color components are one luminance component, one blue difference component, and one red difference component, respectively. Specifically, the luminance component is usually represented by the code Y, the blue difference component is usually represented by the code Cb or U, and the red difference component is usually represented by the code Cr or V. In this way, a video image may be represented in YCbCr format or in YUV format.

[0022] (1) About IntraTMP technology IntraTMP technology is a specialized intra-predictive coding technique, abbreviated as IntraTMP technology, and is a specialized intra-predictive coding tool primarily applied to screen content coding. IntraTMP is mainly implemented through the following process: a portion of the reconstructed pixels adjacent to the current coding block are selected as a template, the most similar template is searched for in the reconstructed region of a given current frame, and the reconstructed block corresponding to the most similar template is used as the matching block and as the prediction block for the current coding block. Here, typically, an adjacent reconstructed region of the current coding block is selected to be used as the template for the coding block.

[0023] As an example, taking the reconstruction region adjacent to the current block as an example, as shown in Figure 1, the grid-patterned region represents the reconstructed region, and within the reconstructed region, R1, R2, R3, and R4 are search regions. Searching is performed sequentially using R1 to R4 to find the matching block, and the region adjacent to the current block becomes the first template (T), and the region adjacent to the matching block (also called the "reference block") becomes the second template (i.e., called the "reference template" or "matching template," T_BEST). As shown in Figure 2, both the encoder and decoder use the template (T) of the encoded block to search a predefined search range within the current image, determine the matching template (T_BEST) with the smallest template error value, and then use the reconstructed block (Ref Block) corresponding to the matching template as the predicted block for the current encoded block (Cur Block). The similarity between templates is represented by the magnitude of the template error value, with a smaller template error value indicating higher similarity. In the embodiments of this application, the template error value may be the sum of absolute differences (SAD), the sum of absolute differences (SATD), the mean squared error (MSE), the sum of squared errors (SSD), the mean absolute error (MAD), the mean squared sum of errors (MSD), the normalized cross-correlation coefficient (NCC), etc., and is not specifically limited thereto.

[0024] As an example, taking the sum of absolute differences (SAD) as an example, the template error value in this case is as follows:

[0025]

number

[0026] Furthermore, the Intra TMP technology uses the adjacent reconstructed pixels of the current block as a template and searches for a matching template within a predefined search area. Here, the adjacent reconstructed pixels may be the upper reference pixels, upper left reference pixels, upper right reference pixels, left reference pixels, and lower left reference pixels of the current block, etc. Therefore, the template type can be classified and the corresponding template type can be determined based on whether or not adjacent reconstructed pixels are available.

[0027] To further explain, the template type can be represented by refTemplateType, and Figure 3 shows a schematic diagram of the template types in Intra TMP technology. As shown in Figure 3, the grid-patterned blocks are current blocks, and the adjacent regions of the current blocks are templates T, where six types of templates are shown.

[0028] For example, these six template types are as follows:

[0029] If the top-left reference pixel, the upper reference pixel, and the left reference pixel are all available, the value of refTemplateType is 1, and the template shape is as shown in Figure 3(a).

[0030] If only the leftmost reference pixel is available, the value of refTemplateType is 2, and the template shape is as shown in Figure 3(b).

[0031] If only the upper reference pixels are available, the value of refTemplateType is 3, and the template shape is as shown in Figure 3(c).

[0032] If only the leftmost and top-leftmost reference pixels are available, the value of refTemplateType is 4, and the template shape is as shown in Figure 3(d).

[0033] If only the leftmost and bottom-leftmost reference pixels are available, the value of refTemplateType is 5, and the template shape is as shown in Figure 3(e).

[0034] When only the upper and upper right reference pixels are available, the value of refTemplateType is 6, and the template shape is as shown in Figure 3(f).

[0035] In Intra TMP technology, the encoder and decoder indicate whether to use Intra TMP mode encoding for the current encoded block using the flag bit intra_tmp_flag. If so, the decoding side performs the same template matching process and obtains the same predicted block, thus eliminating the need to additionally encode block vector information from the current encoded block to the matching block. The following provides an example illustrating Intra TMP technology.

[0036] (2) IntraTMP adaptive technology for camera capture content The IntraTMP adaptation technology for camera-captured content is based on conventional IntraTMP technology and proposes performing template matching with a step size S (i.e., every S points in the horizontal and vertical directions, S>1) (see Figure 4A). For example, instead of searching for matching blocks point by point in the search area using a raster scan, it searches every few points in the horizontal and vertical directions of the search area. For example, if the block vector currently being template-matched is (X0, Y0), the next block vector to be template-matched is (X0+S, Y0), and the vertical coordinate of the block vector to be template-matched in the next row is Y0+S. After template matching is complete, optimization is performed for the optimal matching block within a certain range (as shown in Figure 4B, template matching is performed with a smaller step size S'), and the matching result is optimized. This technology effectively reduces the complexity of the IntraTMP mode while maintaining good encoding efficiency.

[0037] (3) Multiple candidate technologies for IntraTMP The IntraTMP multiple candidate technique obtains N candidate matching blocks within the reference region through a template matching process; in other words, it constructs a candidate block list of length N, where the candidate matching blocks in the list can be sorted according to the magnitude of the template error value with the current block. A candidate block is selected from the list by index to become the final predicted block. For a coded block using the IntraTMP multiple candidate technique, after decoding the true IntraTMP flag bit intra_tmp_flag, intra_tmp_idx is decoded, and the intra_tmp_idx syntactic element can represent the index of the selected candidate block.

[0038] intra_tmp_flag if(intra_tmp_flag) { intra_tmp_idx }

[0039] As an example, the template matching process for constructing a candidate blocklist is as follows:

[0040] In the first step, the first search is performed with a fixed step size, for example, setting both the horizontal and vertical step sizes to 4. N optimal matching blocks (the first N blocks with the smallest template error value) are obtained at regular intervals.

[0041] In the second step, a second search is performed in the adjacent regions of the N matching blocks obtained in the first step. These adjacent regions can be set as multiple non-overlapping regions based on the step size in the first step. From these regions, M optimal matching blocks (which may include the matching blocks obtained in the first step) are obtained.

[0042] By using the same construction process on both the encoding and decoding sides, similar candidate block lists can be obtained.

[0043] Intra_tmp_idx can use fixed-length or variable-length encoding, for example, truncated binary encoding.

[0044] One variable-length coding scheme is as follows:

[0045] The smaller the index (the smaller the intra_tmp_idx value), the smaller the template error value of the corresponding candidate block, and the higher the probability of statistical selection. A shorter codeword can be assigned to a smaller intra_tmp_idx. For example,

[0046] [Table 1]

[0047] If the maximum value N of intra_tmp_idx is relatively large, it is possible to assign codewords of the same length to relatively large intra_tmp_idx. For example, N is 15.

[0048] [Table 2]

[0049] In the table above, x can be obtained using a truncated binary.

[0050] (4) Regarding IntraTMP fusion prediction technology (also known as IntraTMP multiple matching block fusion technology) Intra-template matching allows us to obtain template error values ​​between the reconstructed block and the current encoded block at different locations. These reconstructed blocks can be represented by block vectors pointing from the current encoded block to the reconstructed block. To record block vectors with smaller template error values ​​during the template matching process, a candidate block vector list is constructed. Based on conditions such as the spacing between block vectors and the template error value, one or more block vectors are selected from the candidate block vector list, and the reconstructed block they point to is set as the matching block for the current encoded block. A weight value is determined for each matching block, and these matching blocks are weighted and fused based on their weight values ​​to obtain the final predicted block, thereby realizing IntraTMP combinatorial fusion prediction. This process is shown in Figure 5.

[0051] The number of matching blocks to be merged may be a fixed number, or it may be determined based on the relative magnitudes of the template error values ​​of each matching block. For example, for N available matching blocks, a threshold Threshold = minSAD << 1 may be set, where minSAD is the minimum value among the template error values ​​of these matching blocks. Only matching blocks whose template error values ​​are less than or equal to this threshold will be used in the merging process. This method allows for the determination of which matching blocks to use for merging.

[0052] After determining the matching blocks to be used for fusion, the weights of each matching block can be determined using methods such as a method using predetermined fixed values, a method calculated based on template error values, and a method based on template derivation.

[0053] (5) Regarding IntraTMP filtering Matching blocks (also called reference blocks) obtained through intra-template matching are typically used directly as prediction blocks for the current block. The prediction effect can be improved by filtering the prediction block. Block-level flag bits can be used to indicate whether the current block uses filtering on the prediction block.

[0054] There are multiple possible filter formats, and one possible filter format is as follows:

[0055] PredC = c0C + c1N + c2S + c3E + c4W + c5B

[0056] Here, as shown in Figure 6A, C is the pixel awaiting filtering, N is the pixel above it, S is the pixel below it, W is the pixel to its left, and E is the pixel to its right. B (Bias) is a fixed value, for example, B is the midpoint of the pixel range. c0 to c5 are the filter coefficients.

[0057] One method for determining filter coefficients is to train the filter coefficients using the template of the reference block and the template of the current block. For example, the template region is the reconstructed region of the current block, consisting of the top four rows and the left four columns. For the reference block, an additional row of space above, below, to the left, and to the right of the template region is also required as a reference. As shown in Figure 6B, if part of the additional region is not encoded, it can be copied from the template region.

[0058] One way to train filter coefficients is to calculate a set of coefficients such that the template error between the template of the filtered reference block and the template of the current block is minimized.

[0059] If the current block uses IntraTMP filtering, filtering is performed on the predicted block obtained directly from the reference block. One method is to sequentially filter each pixel from left to right and from top to bottom. The filtered value is taken as the predicted value.

[0060] (6) IntraTMP fusion via template derivation IntraTMP fusion prediction can obtain multiple reference blocks through an intra-template matching process and perform weighted fusion on these reference blocks. Weight values ​​are typically calculated using predefined fixed values ​​or based on the template error of each reference block. For example, if the template error values ​​of the reference blocks are the sum of absolute differences (SAD), and they are SAD1 to SADn respectively, one way to calculate the weights is as follows:

[0061] SADi=(SADi==0)?1:SADi

number

[0062] Here, n is the total number of reference blocks, and Wi is the weight value corresponding to the reference block whose template error value is SADi. The form of the predicted blocks after weighted fusion may be as follows:

[0063]

number

[0064]

number

[0065] (7) Template-based intra-mode derivation technology The Template-Based Intra-Mode Derivation (TIMD) technique uses an L-shaped partially reconstructed pixel adjacent to the current coded block as a template. By traversing the MPM list and calculating the predicted pixels of the template region in different intra-prediction modes, a template error value is obtained between the predicted and reconstructed pixels in different intra-prediction modes, which is expressed as the Sum of Absolute Transformed Difference (SATD). The optimal intra-prediction mode is selected based on the template error value. On the decoding side, the intra-prediction mode is obtained using the same derivation method, thus reducing the number of coded bits for mode information.

[0066] (8) Interintra-connection prediction technology The Combined Inter and Intra Prediction (CIIP) technique combines intra and inter predictions, obtaining the predicted block for the current coded block through a weighted combination of intra-predicted blocks and inter-predicted blocks. In ECM, CIIP is combined with template-based prediction techniques to further improve prediction accuracy by simultaneously assigning different weight values ​​to different regions. Specifically, the intra-predicted block pred_intra is obtained by TIMD mode, and the inter-predicted block pred_inter is obtained by template-based Merge mode. Based on the derived intra-predicted mode and the position of the pixel awaiting prediction, the weight values ​​wIntra and wInter are determined. The final predicted block Pred is calculated as follows.

[0067] Pred=(wIntra×pred_intra+wInter×pred_inter+4)>>3

[0068] Here, wIntra and wInter are determined based on the intra prediction mode intra_dir derived by TIMD. ECM has 65 intra angle prediction modes (2 ≤ intra_dir ≤ 66), where if 2 ≤ intra_dir < 34, the current coded block is divided vertically into four equal parts, and if 34 ≤ intra_dir ≤ 66, the current coded block is divided horizontally into four equal parts. The weight values ​​wIntra and wInter for each region are as follows:

[0069] [Table 3]

[0070] When divided vertically or horizontally into four equal parts, the index of each region is as shown in Figure 7. As an exception, if intra_dir is equal to 0 or 1, it is not divided into sub-regions, and wIntra and wInter are selected from (3,1), (2,2), and (1,3) based on the encoding type (intra or inter) of the two encoding blocks located on the left and above.

[0071] (9) IntraTMP Fusion Intra Prediction The IntraTMP fusion intra-prediction mode obtains one matching block through intra-template matching, and then fuses it with another intra-prediction block to generate one prediction block for the current encoded block. Specifically, one matching block for the current encoded block is obtained as prediction block 1 through intra-template matching, one prediction block 2 for the current encoded block is obtained through an intra-prediction mode other than IntraTMP, weight values ​​are determined for prediction blocks 1 and 2, and these prediction blocks are weighted and fused based on their weight values ​​to obtain the final prediction block, thereby realizing IntraTMP combinatorial fusion prediction. Whether or not to use this fusion prediction mode can be represented by a block-level flag bit.

[0072] Here, the intra-prediction mode can be derived by methods such as TIMD, the weighted fusion process can be similar to the fusion process of the CIIP method, and prediction accuracy can be further improved by using weight values ​​related to the intra-angle and pixel position.

[0073] (10) About Intrablock Copy Technology Intra Block Copy (IBC) is an intra-prediction technique that acquires predicted pixels based on block matching. Similar to inter-prediction, it achieves prediction using block vectors that point from the current block to a reference block, but differs in that the reference block in inter-prediction is from an encoded reconstructed frame, whereas the reference block in IBC is from a reconstructed portion of the current frame. Since the block vector information needs to be transmitted via a bitstream, IBC-AMVP mode and IBC-Merge mode exist, similar to intra-prediction.

[0074] The IBC-AMVP mode obtains a predicted block vector from a constructed list of candidate block vectors, and then obtains the reference block of the current block and its corresponding final block vector through processes such as hash search and full search. Based on the predicted block vector, the final block vector is encoded to improve encoding efficiency.

[0075] IBC-Merge mode predicts based on a constructed list of candidate block vectors, and uses encoding processes such as SATD and RDO to select the optimal block vector from the list as the final block vector. The reconstructed block pointed to by this vector is then used as the reference block for prediction. Encoding efficiency is improved by encoding the index of the block vector in the list, rather than the block vector itself.

[0076] The candidate block vector list can be constructed from coding information such as the block vectors of adjacent coded blocks, past block vectors, and average block vectors.

[0077] However, in actual encoding processes, while each of the above IntraTMP technologies has its advantages, when applied individually, they are not adequately considered, resulting in relatively large discrepancies and low prediction accuracy in some scenarios. The embodiment of this application combines multiple IntraTMP technologies, making IntraTMP technology applicable to a wider range of application scenarios, improving the accuracy of intra-prediction, and enhancing encoding and decoding performance.

[0078] Referring to Figure 8A, an exemplary block diagram of the encoder configuration according to an embodiment of the present application is shown. As shown in Figure 8A, the encoder (specifically, the "video encoder") 100 includes a transform and quantization unit 101, an intra-estimation unit 102, an intra-prediction unit 103, a motion compensation unit 104, a motion estimation unit 105, an inverse transform and inverse quantization unit 106, a filter control analysis unit 107, a filtering unit 108, an encoding unit 109, and a decoded image buffer unit 110, where 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). A single video coding block can be obtained from the input original video signal by dividing it into a coding tree unit (CTU). Then, the video coding block is transformed by a transformation and quantization unit 101 using residual pixel information obtained by intra-prediction or inter-prediction. This involves transforming the residual information from the pixel region to the transformation region and quantizing the resulting transformation coefficients, thereby further reducing the bitrate.The intra-estimation unit 102 and the intra-prediction unit 103 are configured to perform intra-prediction on the video coding block, specifically, the intra-estimation unit 102 and the intra-prediction unit 103 are configured to determine the intra-prediction mode to be used to encode the video coding block; the motion compensation unit 104 and the motion estimation unit 105 are configured to perform inter-prediction coding on one or more blocks in one or more reference frames of the received video coding block to provide time prediction information; the motion estimation performed by the motion estimation unit 105 is a process that generates motion vectors, which are used to estimate the motion of the video coding block; and the motion compensation unit 104 performs motion compensation based on the motion vectors determined by the motion estimation unit 105; after the intra-prediction mode has been determined, the intra-prediction unit 103 is further configured to provide selected intra-prediction data to the coding unit 109; and the motion estimation unit 105 is also configured to transmit the computationally determined motion vector data to the coding unit 109. Furthermore, the inverse transform and inverse quantization unit 106 is configured to reconstruct the video coded block, the residual block is reconstructed in the pixel region, the reconstructed residual block is subjected to blocking artifact removal by the filter control analysis unit 107 and the filtering unit 108, and the reconstructed residual block is added to one prediction block in the frame of the decoding image buffer unit 110 to generate a reconstructed video coded block. The coding unit 109 is configured to encode various coding parameters and quantized transformation coefficients, and in a CABAC-based coding algorithm, the context content is based on adjacent coded blocks and can be used to encode information indicating the determined intra-prediction mode and output a bitstream of the video signal, and the decoding image buffer unit 110 is configured to store the reconstructed video coded block used for prediction reference.As the encoding of the video image progresses, newly reconstructed video encoding blocks are continuously generated, and all of these reconstructed video encoding blocks are stored in the decoded image buffer unit 110.

[0079] Referring to Figure 8B, an exemplary block diagram of the decoder configuration according to an embodiment of the present application is shown. As shown in Figure 8B, the decoder (specifically, the "video decoder") 200 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra prediction unit 203, a motion compensation unit 204, a filtering unit 205, and a decoded image buffer unit 206, where the decoding unit 201 can perform decoding of header information and CABAC decoding, and the filtering unit 205 can perform deblocking filtering and SAO filtering. After the encoding process shown in Figure 4A is performed on the input video signal, the bitstream of the video signal is output and input to the decoder 200. First, the decoding unit 201 processes the decoded transformation coefficients, which are then processed by the inverse transform and inverse quantization unit 202 to generate residual blocks in the pixel region. The intra-prediction unit 203 is configured to generate prediction data for the current video decoded block based on the determined intra-prediction mode and data from previous decoded blocks from the current frame or image. The motion compensation unit 204 is configured to determine prediction information for the video decoded block by analyzing motion vectors and other relevant syntactic elements, and to generate prediction blocks for the video decoded block being decoded using this prediction information. The decoded video block is formed by adding the residual blocks from the inverse transform and inverse quantization unit 202 with the corresponding prediction blocks generated by the intra-prediction unit 203 or the motion compensation unit 204. The decoded video signal can be filtered by the filtering unit 205 to remove blocking artifacts and improve video quality. The decoded video block is stored in the decoded image buffer unit 206, which stores a reference image to be used for subsequent intra-prediction or motion compensation, and is configured to output the video signal to obtain the restored original video signal.

[0080] Furthermore, embodiments of this application further provide a network architecture for an encoding / decoding system including an encoder and a decoder, where Figure 9 shows a schematic diagram of the network architecture of an encoding / decoding system according to embodiments of this application. As shown in Figure 9, the network architecture includes one or more electronic devices 13 to 1N and a communication network 01, where the electronic devices 13 to 1N can perform video interaction via the communication network 01. In the implementation, the electronic devices may be various types of devices equipped with video encoding / decoding functions, and may include, but are not particularly limited to, smartphones, tablet computers, personal computers, personal digital assistants, navigation devices, digital telephones, video phones, televisions, sensor devices, servers, etc. Furthermore, the decoder or encoder in embodiments of this application may be one of the above-mentioned electronic devices.

[0081] The method in the embodiment of this application is mainly applied to the intra-prediction unit 103 shown in Figure 8A and the intra-prediction unit 203 shown in Figure 8B. In other words, the embodiment of this application may be applied to an encoder, or to a decoder, or to both an encoder and a decoder simultaneously, but the embodiment of this application is not limited to these.

[0082] To further explain, when applied to the intra-prediction unit 103, "current block" specifically refers to the currently intra-predicted coded block, and when applied to the intra-prediction unit 203, "current block" refers to the currently intra-predicted decoded block.

[0083] In one embodiment of this application, with reference to Figure 10, an illustrative flowchart of a decoding method according to an embodiment of this application is shown. As shown in Figure 10, the method may include the following steps:

[0084] In step 1001, a list of first candidate matching blocks for the current block is constructed based on template matching.

[0085] Within a predetermined search range, possible matching blocks are searched based on a predetermined search method. A template error value corresponding to each matching block is calculated based on the template of the matching block and the template of the current block. A list of candidate matching blocks is constructed based on the template error value corresponding to each matching block. Exemplaryly, the list of candidate matching blocks may be sorted in ascending order of template error value.

[0086] In step 1002, the first candidate matching block list is grouped to determine at least two candidate matching block groups, and the index value for each candidate matching block group is determined.

[0087] Exemplary, this includes grouping the first candidate matching block list based on at least one grouping rule. Each grouping rule specifically defines the group quantity, the number of matching blocks in each candidate matching block group, and the distance between matching blocks in each candidate matching block group. In embodiments of this application, one or more grouping rules can be used to group the first candidate matching block list and determine at least two candidate matching block groups, each candidate matching block group containing at least one matching block.

[0088] In step 1003, the index value of the first candidate matching block group corresponding to the current block is determined.

[0089] For example, the first candidate matching block group may be a specific candidate matching block group from at least two candidate matching block groups.

[0090] For example, the index value of the first candidate matching block group may be a predetermined index value, an index value determined by decoding the bitstream, or an index value corresponding to a reference block. Based on the index value, the first candidate matching block group is determined, the matching blocks in the first candidate matching block group are used to perform IntraTMP fusion prediction, and the predicted block of the current block is determined.

[0091] In step 1004, the first candidate matching block group is determined from at least two candidate matching block groups based on the index value of the first candidate matching block group.

[0092] In step 1005, at least one matching block in the first candidate matching block group is merged to determine the predicted block of the current block.

[0093] In some embodiments, the method further includes decoding the relevant syntactic elements of the current block. Exemplarily, the relevant syntactic elements are used to indicate the prediction mode of the current block. In some embodiments, the relevant syntactic elements include a first syntactic element and / or a second syntactic element, the first syntactic element used to indicate whether the prediction mode of the current block is a fused prediction mode based on intra-template matching prediction (IntraTMP), and the second syntactic element used to indicate the index value of the first candidate matching block group.

[0094] In some examples, the first syntactic element includes block-level syntactic elements. In some embodiments, the first syntactic element further includes at least one of stripe-level syntactic elements, slice-level syntactic elements, image-level syntactic elements, and sequence-level syntactic elements.

[0095] In some examples, the second syntactic element includes block-level syntactic elements. In some embodiments, the second syntactic element further includes at least one of stripe-level syntactic elements, slice-level syntactic elements, image-level syntactic elements, and sequence-level syntactic elements.

[0096] In some embodiments, the related syntactic elements further include syntactic elements indicating whether the current block is predictable using IntraTMP prediction mode, syntactic elements indicating whether the current block is predicted using IntraTMP fused prediction mode, and syntactic elements indicating whether the current block is predicted using IntraTMP multiple candidate prediction mode. In practical applications, the related syntactic elements may be one or more of block-level syntactic elements, stripe-level syntactic elements, slice-level syntactic elements, image-level syntactic elements, and sequence-level syntactic elements.

[0097] In some embodiments, the method further includes determining that the prediction mode of the current block is the IntraTMP fusion prediction mode. The decoding method of steps 1001 to 1005 in the embodiments of this application is performed.

[0098] In some embodiments, the first syntactic element is decoded. In some embodiments, the second syntactic element is decoded. In some embodiments, the first and second syntactic elements are decoded. Exemplarily, if it is determined that the current block is predictable using IntraTMP prediction mode, the first and second syntactic elements are decoded. Exemplarily, if it is determined that the current block is predictable using IntraTMP fused prediction mode, the first and second syntactic elements are decoded. Note that when it is necessary to decode the first and second syntactic elements, there is no strict restriction on the order in which they are decoded.

[0099] In some embodiments, if the value of the first syntactic element is a first numeric value, it is determined that the prediction mode of the current block is the IntraTMP fusion prediction mode, and based on the second syntactic element, the index value of the first candidate matching block group corresponding to the current block is determined.

[0100] The IntraTMP fusion prediction mode may also be a fusion mode based on at least one matching block, and may also be called the IntraTMP multiple matching block fusion prediction mode. In actual application, the number of fusion matching blocks to be fused can be selected based on the fusion mode, matching block grouping rules, etc.

[0101] In some embodiments, if the value of the first syntactic element is a second numeric value, it is determined that the prediction mode of the current block is one of the IntraTMP prediction modes other than the IntraTMP fusion prediction mode. Exemplarily, the other IntraTMP prediction mode may be an IntraTMP multiple candidate prediction mode based on a single matching block, where one matching block is selected from multiple candidate matching blocks and the selected matching block is used to obtain a prediction block.

[0102] In some embodiments, if the value of the first syntactic element is a second numerical value, it is determined that the prediction mode of the current block is the IntraTMP multiple candidate prediction mode based on a single matching block, and the index value of the optimal matching block corresponding to the current block is determined based on the second syntactic element. That is, the second syntactic element may be used to indicate the index value of the first candidate matching block group, or it may be used to indicate the index value of the optimal matching block corresponding to the current block, and the content indicated by the second syntactic element can be determined based on the prediction mode of the current block. The second syntactic element may have different ranges of index values ​​depending on the application, or it may have the same range of index values.

[0103] For example, the first number may be 1, and the second number may be 0.

[0104] For example, related syntactic elements include the following:

[0105] intra_tmp_flag If(intra_tmp_flag) { intra_tmp_fusion_flag intra_tmp_flu_idx }

[0106] When decoding IntraTMP-related syntactic elements, first, intra_tmp_flag is decoded. If intra_tmp_flag is true, it indicates that the current block will be encoded using IntraTMP mode. Then, intra_tmp_fusion_flag (which acts as the first syntactic element) and intra_tmp_fusion_idx (which also acts as the first syntactic element) are decoded. If intra_tmp_fusion_flag is true, it indicates that the current block will be predicted using IntraTMP fusion prediction mode, and intra_tmp_fusion_idx is used to determine which group's matching block will be used for fusion prediction. If intra_tmp_fusion_flag is false, it indicates that the single matching block IntraTMP multiple candidate prediction mode will be used for the current block, and intra_tmp_fusion_idx determines the optimal matching block to be selected.

[0107] In some embodiments, decoding the relevant syntactic elements of the current block includes decoding a first syntactic element, determining that the prediction mode of the current block is the IntraTMP fusion prediction mode if the value of the first syntactic element is a first numerical value, decoding a second syntactic element, and determining the index value of the first candidate matching block group corresponding to the current block based on the second syntactic element.

[0108] For example, related syntactic elements include the following:

[0109] intra_tmp_flag If(intra_tmp_flag) { intra_tmp_fusion_flag If(intra_tmp_fusion_flag){ intra_tmp_flu_idx } }

[0110] When decoding IntraTMP-related syntactic elements, if intra_tmp_flag is true, it indicates that the current block is encoded using IntraTMP mode, and then intra_tmp_fusion_flag is decoded. If intra_tmp_fusion_flag is true, it indicates that the current block is predicted using IntraTMP fusion prediction mode, and then intra_tmp_fusion_idx is decoded to determine which group's matching block will be used for fusion prediction. The value of intra_tmp_fusion_idx is related to the grouping rule. For example, if the total number of candidate matching block groups is 15, then intra_tmp_fusion_idx can take values ​​from 0 to 14, and intra_tmp_fusion_idx can also take values ​​from 0 to N, where N is less than 14. intra_tmp_fusion_idx can use a variable-length coding scheme, where a smaller index corresponds to a shorter corresponding codeword, and a smaller index value corresponds to a smaller template error value for the corresponding candidate matching block, and a higher probability of selection. A shorter codeword can be assigned to a smaller index value. For example, the following table can be used for encoding.

[0111] [Table 4]

[0112] For indices 3-6, use a codeword of the same length, and for indices 7-14, use a codeword of the same length. In the table above, x can be obtained using truncated binary. For example, intra_tmp_fusion_idx can take values ​​from 0 to 4 and is encoded using the following table.

[0113] [Table 5]

[0114] The single codeword decoding methods in intra_tmp_fusion_idx include equal-probability single codeword decoding, context-model-based single codeword decoding, or multi-context-model-based single codeword decoding.

[0115] In some embodiments, the related syntactic element further includes a third syntactic element, which is used to indicate the index value of the best matching block corresponding to the current block. Decoding the related syntactic element of the current block further includes determining that the prediction mode of the current block is the IntraTMP multiple candidate prediction mode based on a single matching block, if the value of the first syntactic element is a second numerical value, decoding the third syntactic element of the current block, and determining the index value of the best matching block corresponding to the current block based on the third syntactic element. In other words, intra_tmp_fusion_idx and intra_tmp_idx can be decoded in different ways based on intra_tmp_fusion_flag.

[0116] For example, related syntactic elements include the following:

[0117] intra_tmp_flag If(intra_tmp_flag) { intra_tmp_fusion_flag If(intra_tmp_fusion_flag){ intra_tmp_flu_idx else{ intra_tmp_idx } }

[0118] When decoding IntraTMP-related syntactic elements, if intra_tmp_flag is true, it indicates that the current block will be encoded using IntraTMP mode, and then intra_tmp_fusion_flag is decoded. If intra_tmp_fusion_flag is true, it indicates that the current block will be predicted using IntraTMP fusion prediction mode, and then intra_tmp_fusion_idx (which acts as a second syntactic element) is decoded to determine which group's matching block will be used for fusion prediction. If intra_tmp_fusion_flag is false, it indicates that the single matching block IntraTMP multiple candidate prediction mode will be used for the current block, and then intra_tmp_idx (which acts as a third syntactic element) is decoded to indicate the index of the selected matching block in the candidate matching block list. For example, if intra_tmp_idx is equal to i, then the (i+1)th matching block in the candidate matching block list is the selected matching block, where i starts from 0 and index values ​​start from 1. Alternatively, if intra_tmp_idx is equal to i, the i-th matching block in the candidate matching block list is the selected matching block, and the value of i starts from 0, and the index value also starts from 0.

[0119] When decoding intra_tmp_fusion_idx and intra_tmp_idx in different ways based on intra_tmp_fusion_flag, it is also possible to construct candidate matching blocklists of different lengths based on intra_tmp_fusion_flag. For example, if intra_tmp_fusion_flag is true, a list of length N1 is constructed, and if intra_tmp_fusion_flag is false, a list of length N2 is constructed, where N1 and N2 may be predetermined fixed values ​​or may be determined by decoding the bitstream.

[0120] In some embodiments, if the prediction mode of the current block is determined to be an IntraTMP multiple candidate prediction mode based on a single matching block, the method further includes determining the optimal matching block from a second candidate matching block list based on the index value of the optimal matching block, and determining the prediction block of the current block based on the optimal matching block.

[0121] In some embodiments, the method further comprises constructing the second candidate matching blocklist of the current block based on template matching, where the length of the second candidate matching blocklist is not equal to the length of the first candidate matching blocklist. In some embodiments, the length of the second candidate matching blocklist is equal to the length of the first candidate matching blocklist, and the first candidate matching blocklist and the second candidate matching blocklist may be understood as the same candidate matching blocklist.

[0122] In some embodiments, the second syntactic element is further used to indicate the fusion mode of the current block's IntraTMP fusion prediction mode. For example, if a first candidate matching block group has a corresponding fusion mode of one type of IntraTMP fusion prediction mode set, the first candidate matching block group can be identified based on the index value of the first candidate matching block group, while simultaneously identifying the corresponding fusion mode of one type of IntraTMP fusion prediction mode. Different fusion modes differ in the selection method of the corresponding matching block, the weighted fusion method, the fusion weight values, etc. For example, fusion modes include fusion modes for intra-template matching based on template derivation and fusion modes for intra-template matching based on template error values.

[0123] For example, if the total length of the candidate matching block list is N, then every M matching blocks in the candidate matching block list can be defined as one group, resulting in a total of N / M candidate matching block groups. Each candidate matching block group can be assigned one or more fusion modes, and the candidate matching block groups can be expanded. If the same candidate matching block group has two fusion modes, it can be considered as two separate candidate matching block groups. Examples include {BV0,BV1,BV2,BV3,BV4,bFilter=1}, {BV0,BV1,BV2,BV3,BV4,bFilter=0}, {BV0,BV1,BV2,bFilter=1}, and {BV0,BV1,bFilter=0}. bFilter=1 represents the first type of fusion mode, and bFilter=0 represents the second type of fusion mode. The index value can be used to identify the first candidate matching block group and simultaneously identify the corresponding fusion mode.

[0124] In some embodiments, the related syntactic element further includes a fourth syntactic element, and the method further includes decoding the fourth syntactic element, where the fourth syntactic element is used to indicate the fusion mode of the IntraTMP fusion prediction mode of the current block, or to indicate whether or not to perform filtering on the selected matching block.

[0125] In some embodiments, the first and fourth syntactic elements are decoded. In some embodiments, the second and fourth syntactic elements are decoded. In some embodiments, the third and fourth syntactic elements are decoded. In some embodiments, the first, second, and fourth syntactic elements are decoded.

[0126] In some embodiments, the prediction mode of the current block is determined to be the IntraTMP fusion prediction mode, the fusion mode of the IntraTMP fusion prediction mode of the current block is determined based on the fourth syntactic element, the prediction mode of the current block is determined to be the IntraTMP multiple candidate prediction mode based on a single matching block, and the system determines whether or not to perform filtering on the selected matching block based on the fourth syntactic element.

[0127] For example, related syntactic elements include the following:

[0128] intra_tmp_flag If(intra_tmp_flag){ intra_tmp_fusion_flag intra_tmp_filter_flag intra_tmp_idx }

[0129] When decoding IntraTMP-related syntactic elements, if intra_tmp_flag is true, it indicates that the current block is encoded using IntraTMP mode, and further decodes intra_tmp_fusion_flag, intra_tmp_filter_flag, and intra_tmp_idx (which acts as a second syntactic element and is also called intra_tmp_fusion_idx). If intra_tmp_fusion_flag is true, it indicates that the current block is predicted using IntraTMP fusion prediction mode, and intra_tmp_idx is used to determine which group's matching blocks will be used for fusion prediction, with intra_tmp_filter_flag representing the fusion mode. If intra_tmp_fusion_flag is false, intra_tmp_idx indicates that a single matching block prediction method will be used for the current block, and intra_tmp_filter_flag indicates whether or not filtering will be performed on the single matching block. Exemplary, we demonstrate that if intra_tmp_filter_flag is true, we use an IntraTMP fusion mode based on template derivation, and if intra_tmp_filter_flag is false, we use an IntraTMP fusion mode based on template error values.

[0130] In some embodiments, if the prediction mode of the current block is determined to be the IntraTMP fusion prediction mode, a fourth syntactic element is decoded, where the fourth syntactic element is used to indicate the fusion mode of the IntraTMP fusion prediction mode of the current block.

[0131] For example, related syntactic elements include the following:

[0132] intra_tmp_flag If(intra_tmp_flag) { intra_tmp_fusion_flag If(intra_tmp_fusion_flag){ intra_tmp_filter_flag intra_tmp_flu_idx } }

[0133] When decoding IntraTMP-related syntactic elements, if intra_tmp_flag is true, it indicates that the current block will be encoded using IntraTMP mode, and then intra_tmp_fusion_flag is decoded. If intra_tmp_fusion_flag is true, it indicates that the current block will be predicted using IntraTMP fusion prediction mode, and then intra_tmp_filter_flag (which acts as the fourth syntactic element) and intra_tmp_fusion_idx are decoded, where intra_tmp_filter_flag indicates the fusion mode, and intra_tmp_fusion_idx determines which group's matching block will be used for fusion prediction. Exemplarily, if intra_tmp_filter_flag is true, it indicates that an IntraTMP fusion mode based on template derivation will be used, intra_tmp_fusion_idx determines which group's matching block will be used for fusion prediction, and the matching block and its corresponding weight value are fused to obtain the final predicted block. If intra_tmp_filter_flag is false, it indicates that the IntraTMP fusion mode based on template error values ​​will be used. intra_tmp_fusion_idx determines which group's matching block will be used for fusion prediction, and fuses that matching block with its corresponding weight value to obtain the final prediction block.

[0134] In some embodiments, the method further includes determining the fusion mode of the current block's IntraTMP fusion prediction mode based on the fusion mode of the IntraTMP fusion prediction mode corresponding to the first candidate matching block group. Understandably, when setting the fusion mode corresponding to a candidate matching block group, the fusion mode corresponding to the first candidate matching block group can also be the fusion mode of the current block's IntraTMP fusion prediction mode, and it is not necessary to indicate the fusion mode by transmitting intra_tmp_filter_flag.

[0135] In some embodiments, if the prediction mode of the current block is determined to be the IntraTMP multiple candidate prediction mode based on a single matching block, the fourth syntactic element is decoded, and based on the fourth syntactic element, it is determined whether or not to perform filtering on the selected matching block.

[0136] For example, related syntactic elements include the following:

[0137] intra_tmp_flag If(intra_tmp_flag){ intra_tmp_fusion_flag If(!intra_tmp_fusion_flag){ intra_tmp_filter_flag } intra_tmp_idx }

[0138] When decoding IntraTMP-related syntax elements, if intra_tmp_flag is true, it indicates that the current block will be encoded using IntraTMP mode, and then intra_tmp_fusion_flag is decoded. If intra_tmp_fusion_flag is false, it indicates that the IntraTMP multiple candidate prediction mode for a single matching block will be used for the current block, and then intra_tmp_filter_flag is decoded to determine whether or not to filter the selected matching block, and then intra_tmp_idx is decoded to determine the selected optimal matching block. If intra_tmp_fusion_flag is true, it indicates that the current block will be predicted using IntraTMP fusion prediction mode, and then intra_tmp_idx is decoded to determine which group's matching block will be used for fusion prediction. In some embodiments, decoding of intra_tmp_idx may be performed before determining whether intra_tmp_fusion_flag is true or false. For example, if intra_tmp_flag is true, decrypt intra_tmp_fusion_flag and intra_tmp_idx.

[0139] In some embodiments, the related syntactic element further includes a fourth syntactic element and a fifth syntactic element, the method further comprising: determining that the prediction mode of the current block is an IntraTMP fusion prediction mode and decoding the fourth syntactic element, where the fourth syntactic element is used to indicate the fusion mode of the IntraTMP fusion prediction mode of the current block; and determining that the prediction mode of the current block is an IntraTMP multiple candidate prediction mode based on a single matching block and decoding the fifth syntactic element, where the fifth syntactic element is used to indicate whether or not to perform filtering on the selected matching block. In other words, different syntactic elements can be set and used to indicate the fusion mode of the IntraTMP fusion prediction mode of the current block and to indicate whether or not to perform filtering on the selected matching block, respectively.

[0140] In some embodiments, the index range of the index value for the first candidate matching block group is smaller than the index range corresponding to at least two candidate matching block groups. For example, the index range corresponding to two candidate matching block groups is 0 to 5, and the index range of the index value for the first candidate matching block group is 0 to 2, i.e., the second syntactic element to be transmitted is used to indicate only candidate matching block groups whose index value is 0 to 2. In other words, the value of intra_tmp_fusion_idx can be less than or equal to the number of candidate matching block groups. All possible matching block groups are resorted, and then intra_tmp_fusion_idx or intra_tmp_idx indicates the first N combinations among them. That is, the range of values ​​for intra_tmp_fusion_idx or intra_tmp_idx is 0 to N-1, and if M is the number of matching block groups being resorted, then M > N. For example, by resorting the candidate matching block groups, the index value can be limited to a relatively small index range, or only the first few groups can be identified by their index value. By limiting the index value range of candidate matching block groups, the codewords encoded from the index values ​​are saved, improving encoding efficiency.

[0141] In some embodiments, if the fusion mode includes a first fusion mode and a second fusion mode, the method further includes: determining the index value of the first candidate matching block group corresponding to the current block based on the second syntactic element when the fourth syntactic element is used to indicate that the fusion mode of the current block's IntraTMP fusion prediction mode is the first fusion mode; and determining the index value of the first candidate matching block group corresponding to the current block based on the second syntactic element and an index offset value when the fourth syntactic element is used to indicate that the fusion mode of the current block's IntraTMP fusion prediction mode is the second fusion mode.

[0142] Furthermore, if the second syntactic element is used to indicate only the index values ​​of some candidate matching block groups, more candidate matching block groups can be indicated based on the fourth syntactic element. For example, if the index range corresponding to two candidate matching block groups is 0 to 5, and the index range of the index value of the first candidate matching block group is 0 to 2, then when the fourth syntactic element is used to indicate the first fusion mode, the index range of the second syntactic element is 0 to 2, and when the fourth syntactic element is used to indicate the second fusion mode, the index range obtained by adding the index offset value to the value of the second syntactic element is 3 to 5. Moreover, it can also be understood that candidate matching block groups with an index range of 0 to 2 correspond to the first fusion mode, and candidate matching block groups with an index range of 3 to 5 correspond to the second fusion mode.

[0143] In some embodiments, candidate matching block groups with an index range of 0 to 2 and candidate matching block groups with an index range of 3 to 5 may be grouped by the same grouping rule or by different grouping rules.

[0144] In some embodiments, it is decided to predict the current block using the IntraTMP fusion prediction mode, and this method further includes storing the index value of the first candidate matching block group corresponding to the current block, or storing a predetermined matching block in the first candidate matching block group corresponding to the current block. Exemplary, a BV in the matching block group indicated by intra_tmp_fusion_idx can be stored for reference by other decryption blocks. For example, if intra_tmp_fusion_idx=i, the i*3+1th BV in the candidate block list is stored. Exemplary, other decryption blocks use the index value of the first candidate matching block group corresponding to the current block as their own index value.

[0145] In some embodiments, the method further includes decoding a sixth syntactic element, where the sixth syntactic element is used to indicate whether to decode some or all syntactic elements in the relevant syntactic elements of the current block.

[0146] In some embodiments, the sixth syntactic element includes at least one of sequence-level syntactic elements, picture-level syntactic elements, slice-level syntactic elements, stripe-level syntactic elements, and block-level syntactic elements.

[0147] Furthermore, some or all of the syntactic elements in an associated syntactic element may be limited by one or more syntactic elements from the block level, stripe level, slice level, picture level, and sequence level. In other words, a sixth syntactic element can be set corresponding to each syntactic element of an associated syntactic element, or a sixth syntactic element can be set corresponding to two or more syntactic elements of an associated syntactic element, or a sixth syntactic element can be set corresponding to all syntactic elements of an associated syntactic element. For example, if an associated syntactic element is a block-level syntactic element, the sixth syntactic element may be a picture-level and / or sequence-level syntactic element.

[0148] Furthermore, we will explain the construction of a candidate matching blocklist with an example.

[0149] In some embodiments, template matching is used to search for N candidate matching blocks within a search area, or a candidate block list of length N is constructed by sorting the N candidate matching blocks in ascending order of their template error values. The template matching process for constructing the candidate block list is as follows: A first search is performed with a fixed step size, for example, with both the horizontal and vertical step sizes set to 4. N optimal matching blocks (the first N with the smallest template error values) are obtained at fixed intervals. In the second step, a second search is performed in the adjacent regions of the N matching blocks obtained in the first step. These adjacent regions can be set as multiple non-overlapping regions based on the step size in the first step. M optimal matching blocks (which may include the matching blocks obtained in the first step) are obtained from these regions.

[0150] Furthermore, an example of the grouping method for the first candidate matching block list in the embodiment of this application will be explained.

[0151] In some embodiments, grouping the first candidate matching block list includes grouping the first candidate matching block list based on at least one grouping rule. Each grouping rule specifically defines the group quantity, the number of matching blocks in each candidate matching block group, and the distance between matching blocks in each candidate matching block group.

[0152] In some embodiments, at least one grouping rule includes a first grouping rule, which includes setting matching blocks in a first predetermined quantity from the first matching block in a first candidate matching block list as a candidate matching block group, where the first predetermined quantity is an integer greater than 0, where the first predetermined quantity is the number of matching blocks in each candidate matching block group.

[0153] The maximum length of the candidate matching block list constructed by the template matching process is N, for example, N is equal to 45. The fusion prediction can be fused using a maximum of M matching blocks, for example, if M is 3 and the first predetermined quantity is set to 3, then based on the first grouping rule, every M matching blocks in the candidate matching block list can be considered one group, resulting in a total of N / M = 15 groups. If the total length N of the candidate matching block list is not divisible by the maximum fusion quantity M, then the number of matching blocks in the last group will be less than M, and another matching block from the candidate matching block list can be added to that group. In other words, the first grouping rule further includes taking a predetermined matching block from the first candidate matching block list and adding it to the last candidate matching block group if the number of matching blocks in the last candidate matching block group is less than the first predetermined quantity, so that the number of matching blocks in the last candidate matching block group is equal to the first predetermined quantity.

[0154] At least one grouping rule includes a second grouping rule, the second grouping rule includes setting matching blocks in the first candidate matching block list, in units of a second predetermined quantity, as a candidate matching block group, where the second predetermined quantity is an integer greater than 0, and the first predetermined quantity and the second predetermined quantity are not equal.

[0155] The maximum length of the candidate matching block list constructed by the template matching process is N, for example, N is equal to 15. The fusion prediction can be fused using a maximum of M matching blocks, for example, if M is 5 and the second predetermined quantity is set to 5, then based on the first grouping rule, every M matching blocks in the candidate matching block list can be considered one group, resulting in a total of N / M = 3 groups. Correspondingly, the second grouping rule further includes, if the number of matching blocks in the last candidate matching block group is less than the second predetermined quantity, taking a predetermined matching block from the first candidate matching block list and adding it to the last candidate matching block group so that the number of matching blocks in the last candidate matching block group is equal to the second predetermined quantity.

[0156] In some embodiments, at least one grouping rule includes a first grouping rule and a second grouping rule. Exemplarily, the maximum length of the candidate matching block list constructed by the template matching process is N, for example, N is equal to 15. If the first predetermined quantity is 3 and the second predetermined quantity is 5, then based on the first grouping rule, a maximum of N / M = 5 groups can be obtained, and based on the second grouping rule, a maximum of N / M = 3 groups can be obtained. Grouping the candidate matching block list based on the first and second grouping rules yields a total of 8 groups.

[0157] In some embodiments, each grouping rule further includes a corresponding group quantity. For example, if the group quantity corresponding to the first grouping rule is 2 and the group quantity corresponding to the second grouping rule is 2, the candidate matching block list is grouped based on the first and second grouping rules to obtain a total of 4 groups. For example, the candidate blocks in the candidate matching block list are BVn, where n is an integer from 1 to N, or an integer from 0 to N-1, and in some embodiments, i may be the index value of the candidate matching block. Based on the first grouping rule, two candidate matching block groups {BV0, BV1, BV2} and {BV3, BV4, BV5} are obtained, and based on the second grouping rule, two candidate matching block groups {BV0, BV1, BV3, BV2, BV4} and {BV5, BV6, BV7, BV8, BV9} are obtained.

[0158] In some embodiments, at least one grouping rule includes a third grouping rule, the third grouping rule comprising forming a candidate matching block group with the first M1 matching blocks in the first candidate matching block list and every M2 matching blocks from the M1+1th matching block onwards. In some embodiments, the third grouping rule further includes a corresponding group quantity.

[0159] In some embodiments, the third grouping rule further includes the condition that the M2 values ​​in different matching block groups are equal, or that the M2 values ​​in different matching block groups are not equal at all.

[0160] As an example, combine BVn (i>N) with the first M1 elements in the candidate matching block list. For example, if M1=2 and M2=1, possible combinations are {BV0,BV1,BV2}, {BV0,BV1,BV3}, {BV0,BV1,BV4}, etc. If M1=2, possible combinations are {BV0,BV1,BV2,BV3}, {BV0,BV1,BV4}, {BV0,BV1,BV5}, etc. Combine BVn-BV(n+M2)(n>N) with the first N elements in the candidate matching block list. For example, if M1=1 and M2=2, possible combinations are {BV0,BV1,BV2}, {BV0,BV3,BV4}, {BV0,BV5,BV6}, etc.

[0161] In some embodiments, at least one grouping rule includes a first matching rule and a third grouping rule. At least one grouping rule includes a first matching rule, a second grouping rule, and a third grouping rule. Exemplaryly, each grouping rule further includes a corresponding grouping quantity.

[0162] In some embodiments, at least one grouping rule includes a fourth grouping rule, the fourth grouping rule includes configuring the first i matching blocks in the first candidate matching block list as the i-th candidate matching block group, where i is an integer greater than 0. Exemplarily, the first matching block may be configured as the first candidate matching block group, the first two matching blocks as the second candidate matching block group, the first three matching blocks as the third candidate matching block group, the first four matching blocks as the fourth candidate matching block group, and so on, where the maximum length of the candidate matching block list is N, and in this case the maximum value of i is N, and the number of groups can be limited by limiting the maximum value of i.

[0163] In some embodiments, the fifth grouping rule is applied to the first two in the first candidate matching blocklist. i The fifth grouping rule includes configuring the i-th candidate matching block group with the i-th matching block, where a is a positive integer.

[0164] In some embodiments, grouping can also be based on the distance between matching blocks. For example, the grouping rule may further include the condition that the distance between any two matching blocks in a candidate matching block group is greater than a first distance threshold, or the grouping rule may further include the condition that the distance between any two matching blocks in a candidate matching block group is less than a second distance threshold. By restricting the distance between matching blocks, the distribution of matching blocks in a candidate matching block group can be restricted. Note that if more than one grouping rule is set, each grouping rule may either restrict all matching blocks or restrict them partially.

[0165] In some embodiments, grouping the first candidate matching block list includes grouping the first candidate matching block list based on at least one grouping rule to obtain at least one candidate matching block group, and setting a corresponding fusion mode of at least one IntraTMP fusion prediction mode for each candidate matching block group to obtain at least two candidate matching block groups.

[0166] Furthermore, after grouping the first candidate matching block list based on the above arbitrary grouping embodiment, one or more fusion modes can be set for the candidate matching block group. Understandably, one candidate matching block group and one fusion mode are combined into one new candidate matching block group, and two fusion modes are set for one candidate matching block group and combined into two new candidate matching block groups.

[0167] Exemplary, based on the first and second grouping rules described above, we obtain two candidate matching block groups, {BV0,BV1,BV2,BV3,BV4} and {BV0,BV1}. By setting two fusion modes for each candidate group, we obtain four candidate matching block groups, {BV0,BV1,BV2,BV3,BV4,bFilter=1}, {BV0,BV1,BV2,BV3,BV4,bFilter=0}, {BV0,BV1,bFilter=1}, and {BV0,BV1,bFilter=0}. bFilter=1 represents the first type of fusion mode, and bFilter=0 represents the second type of fusion mode.

[0168] Exemplary examples include intra-template matching fusion modes based on template derivation and intra-template matching fusion modes based on template error values.

[0169] The first type of fusion mode is an intra-template matching fusion mode based on template derivation, and the second type of fusion mode is an intra-template matching fusion mode based on template error values. Exemplary, one grouping result includes {BV0,BV1,BV2,BV3,BV4,bFilter=1}, {BV0,BV1,BV2,BV3,BV4,bFilter=0}, {BV0,BV1,bFilter=1}, {BV0,BV1,bFilter=0}, and so on.

[0170] In some embodiments, the encoding and decoding sides predefine one grouping rule or a combination of one grouping rules.

[0171] In some embodiments, the method further includes decoding a bitstream and determining at least one grouping rule. Exemplaryly, a syntactic element is decoded to indicate one grouping rule or a combination of one grouping rule, the combination of grouping rules comprising a given at least two grouping rules.

[0172] In some embodiments, the encoding and decoding sides predefine one or more grouping rules, and the method includes decoding a bitstream and determining variable parameters in the grouping rules. Exemplaryly, the encoding and decoding sides predefine a first grouping rule, and the method includes decoding a bitstream and determining a first predetermined quantity. The method further includes decoding a bitstream and determining a group quantity.

[0173] In other words, one or more grouping rules can be set. For example, one grouping rule merges a maximum of M1 matching blocks, for example, M1 is equal to 3. Each M1 matching block in the candidate matching block list is considered one group, and another grouping rule merges a maximum of M2 matching blocks, for example, M2 is equal to 2. Each M2 matching block in the candidate matching block list is considered one group. These two grouping rules can be used individually or in combination to obtain matching block groups, and one way to select a matching block group is to indicate which group to use by an index value, or another way is to resort these matching block groups and determine a matching block group based on its index value.

[0174] Furthermore, we will explain the determination of the index value for each candidate matching block group with an example.

[0175] In some embodiments, determining the index value of each candidate matching block group includes determining the first index value of each candidate matching block group based on the grouping position of each candidate matching block group, and setting the first index value of each candidate matching block group as the index value of each candidate matching block group. In some embodiments, the smallest first index value is selected and set as the index value of the first candidate matching block group.

[0176] For example, a candidate block in the candidate matching block list is BVn, where n is an integer from 1 to N, or an integer from 0 to N-1. If the total length of the candidate matching block list is N, then every M matching blocks in the candidate matching block list can be defined as one group, and the list can be divided into a total of N / M candidate matching block groups. For example, if M is equal to 3, the i-th candidate matching block group is represented as {BV(3i), BV1(3i+1), BV2(3i+2)}, where i is the index value of each candidate matching block group, and in the embodiment of this application, i is an integer greater than or equal to 1, and the group number i is less than or equal to the group number.

[0177] In some embodiments, determining the index value of each candidate matching block group includes: resorting at least two candidate matching block groups; determining a second index value for each candidate matching block group based on its position after resorting; and setting the second index value of each candidate matching block group as the index value of that candidate matching block group. In some embodiments, the smallest second index value is selected and used as the index value of the first candidate matching block group.

[0178] Illustratively, the candidate matching block groups are resorted based on the corresponding template error values, with the candidate matching block group with the smallest template error value at the top. Matching block groups with smaller template error values ​​have smaller corresponding weight values, and matching block groups with smaller template error values ​​have a higher probability of being selected. This resorting reduces the number of encoded bits for the index values. Illustratively, a candidate block in the candidate matching block list is BVn, where n is an integer from 1 to N, or an integer from 0 to N-1. If the total length of the candidate matching block list is N, then every M matching blocks in the candidate matching block list are defined as one group, and the list can be divided into a total of N / M candidate matching block groups. For example, if M is equal to 3, the i-th candidate matching block group is represented as {BV(3i), BV1(3i+1), BV2(3i+2)}, where i is the index value for each candidate matching block group, and in the embodiment of this application, i is an integer greater than or equal to 1, and the group number i is less than or equal to the group quantity. For example, if, after resorting, the template error value of the second candidate matching block group is the smallest and it is sorted to the front, its index value will be 0. When the second syntactic element is used to indicate the index value of the second candidate matching block group, it only needs to be encoded as 0.

[0179] Figure 11 is an illustrative flowchart of a resorting method in an embodiment of the present application, and as shown in Figure 11, in some embodiments, resorting at least two candidate matching block groups includes the following steps:

[0180] In step 1101, N fusion matching blocks (where N is an integer greater than 0) are selected from each candidate matching block group to be fused.

[0181] In step 1102, the fusion weight values ​​of N fusion matching blocks are determined.

[0182] In step 1103, the templates of N fusion matching blocks are fused based on the fusion weight values ​​of the N fusion matching blocks, and the predicted template corresponding to each candidate matching block group is determined.

[0183] In step 1104, the template error value corresponding to each candidate matching block group is determined based on the prediction template corresponding to each candidate matching block group and the template of the current block.

[0184] In step 1105, the sorting is performed based on the template error value corresponding to each candidate matching block group.

[0185] By performing template prediction using each candidate matching block group in the template region, a predicted template corresponding to a different candidate matching block group is calculated, and a template error value is calculated based on the predicted template and the template of the current block. The specific method is as follows:

[0186] As shown in Figure 12, a prediction is made for a single matching block in the template region, and the template of that matching block is the prediction template for the template region.

[0187] As shown in Figure 13, fusion prediction of multiple matching blocks is performed in the template region. That is, a weighted fusion is performed on the templates of multiple matching blocks to obtain a predicted template. The weighted fusion process of the templates should be the same as the weighted fusion process used to predict the current block.

[0188] Based on the method for making predictions in the template region described above, a prediction template can be obtained for each candidate matching block group in the template region. Furthermore, by comparing this prediction template with the template of the current block, a template error value can be obtained for each candidate matching block group. Based on these template error values, the optimal candidate matching block group can be selected by resorting.

[0189] In some embodiments, determining the fusion weight values ​​of N fusion matching blocks involves determining the fusion weight values ​​of N fusion matching blocks based on the fusion mode of the current block's IntraTMP fusion prediction mode.

[0190] In some embodiments, when setting the fusion mode of the corresponding IntraTMP fusion prediction mode for each candidate matching block group, determining the fusion weight values ​​of N fusion matching blocks includes determining the fusion weight values ​​of N fusion matching blocks based on the fusion mode of the IntraTMP fusion prediction mode corresponding to each candidate matching block group.

[0191] Since different fusion modes correspond to different methods for deriving weight values, it is necessary to derive the fusion weight values ​​based on the fusion mode of the current block's IntraTMP fusion prediction mode, and determine the fusion weight values ​​of N fusion matching blocks based on the fusion mode of the IntraTMP fusion prediction mode corresponding to the current candidate matching block group. In the embodiments of this application, the fusion mode of the current block can be predetermined or indicated by transmitting a fourth syntactic element.

[0192] Furthermore, another example of a matching block fusion method in the embodiments of this application will be described. Figure 14 is an illustrative flowchart of one fusion method in the embodiments of this application, and as shown in Figure 14, fusion of at least one matching block in the first candidate matching block group to determine the predicted block of the current block includes the following steps.

[0193] In step 1401, N fusion matching blocks (where N is an integer greater than 0) are selected from the first candidate matching block group to be fused.

[0194] In step 1402, the fusion weight values ​​of N fusion matching blocks are determined.

[0195] In step 1403, the N fusion matching blocks are fused based on their fusion weight values, and the predicted block for the current block is determined.

[0196] Note that N is less than or equal to the number of matching blocks.

[0197] In some embodiments, determining N fusion matching blocks to be fused in at least one of steps 1101 and 1401 includes determining the template error value of each matching block in the current candidate matching block group, and determining a template error threshold based on the template error value and threshold coefficient of the i-th matching block in the current candidate matching block group, wherein the i-th matching block is the matching block with the minimum template error value in the current candidate matching block group, and determining that a matching block whose template error value is less than or equal to the template error threshold is a fusion matching block.

[0198] When predicting the matching block for the current block, the current candidate matching block group is the first candidate matching block group. When resorting at least two candidate matching block groups and performing template prediction using at least two candidate matching block groups, the current candidate matching block group is the single candidate matching block group currently selected.

[0199] In some embodiments, the method further includes determining a threshold coefficient corresponding to the current candidate matching block group, where the threshold coefficients corresponding to different candidate matching block groups are not necessarily equal. Exemplarily, the smaller the index value of the candidate matching block group, the larger the threshold coefficient.

[0200] In some embodiments, determining that a matching block whose template error value is less than or equal to the template error threshold is a fused matching block includes making the i-th matching block in the current candidate matching block group the i-th fused matching block if the template error value of the i+j-th matching block is greater than the number of matching blocks equal to the template error threshold.

[0201] For example, based on the template error value of each matching block in the current candidate matching block group, a portion can be selected and merged. For example, if the candidate matching block group contains three matching blocks, BV 3i Corresponding template error value SAD 3i Set the threshold based on this.

[0202] threshold = a × SAD 3i+j SAD 3i+j ≤threshold, j>0 Only if the following conditions are met, the corresponding BV 3i+jis used for fusion prediction to determine the fusion quantity. Here, SAD 3i corresponds to the minimum template error value of the matching block in the candidate matching block group, and a can be a predetermined arbitrary value, for example, 1.2, 1.5, or 2. SAD 3i+j If both are below the threshold value, the fusion form is as follows.

[0203] pred = w0 × BV 3i + w1 × BV 3i+1 + w2 × BV 3i+2 + w3 × Bias

[0204] If there is a matching block with a template error value greater than the threshold value, for example, SAD 3i+2 > threshold, instead of BV 3i+2 BV 3i can be used to derive the fusion coefficient and perform weighted calculation, that is, using BV 3i BV 3i+1 and BV 3i as the input templates and the current block template as the output to derive the coefficients w0~w3, and the fusion form is as follows.

[0205] pred = w0 × BV 3i + w1 × BV 3i+1 + w2 × BV 3i + w3 × Bias

[0206] If the fusion quantity N is greater than the maximum fusion quantity M, only the N matching blocks can be used to derive the coefficients and perform weighted calculation. For example, when N = 2, the fusion form is as follows.

[0207] Pred = w0 × BV0 + w1 × BV1 + w2 × Bias

[0208] Figure 15 is an illustrative flowchart of a method for determining fusion matching blocks in an embodiment of the present application, and as shown in Figure 15, determining the N fusion matching blocks to be fused in steps 1101 and 1401 includes the following steps.

[0209] In step 1501, the matching blocks in the current candidate matching block group are divided into at least two sets of candidate matching blocks, where each set of candidate matching blocks contains N fused matching blocks to be merged, and the number of fused matching blocks and the number of fused matching blocks in different sets of candidate matching blocks are not exactly the same.

[0210] In step 1502, the fusion weights of the N fusion matching blocks in each candidate matching block set are determined.

[0211] In step 1503, the templates of the N fused matching blocks are merged based on the fusion weight values ​​of the N fused matching blocks in each candidate matching block set, and the prediction template corresponding to each candidate matching block set is determined.

[0212] In step 1504, the template error value corresponding to each candidate matching block set is determined based on the prediction template corresponding to each candidate matching block set and the template of the current block.

[0213] In step 1505, based on the template error value corresponding to each candidate matching block set, the optimal candidate matching block set with the minimum template error value is determined, and the matching blocks in the optimal candidate matching block set are defined as N fused matching blocks.

[0214] When predicting the matching block for the current block, the current candidate matching block group is the first candidate matching block group. When resorting at least two candidate matching block groups and performing template prediction using at least two candidate matching block groups, the current candidate matching block group is the single candidate matching block group currently selected.

[0215] For example, if the current candidate matching block group contains three matching blocks {BV(3i), BV1(3i+1), BV2(3i+2)}, the candidate matching block sets that can be used to try template prediction are {BV(3i)}, {BV(3i), BV1(3i+1)}, and {BV(3i), BV1(3i+1), BV2(3i+2)}, and for each set, weight values ​​for a specific fusion mode are derived. The optimal candidate matching block set is determined, and fusion is performed using the matching blocks in the optimal candidate matching block set to determine the predicted block for the current block.

[0216] In some embodiments, determining the N fusion matching blocks to be fused in steps 1101 and 1401 involves selecting the first N matching blocks in the current candidate matching block group as the N fusion matching blocks, where N is less than or equal to the number of matching blocks in the current candidate matching block group. That is, if the fusion quantity N is less than the number of matching blocks M, the fusion weight values ​​can be derived and the weight calculation performed using only N matching blocks, and if the fusion quantity N is equal to the number of matching blocks M, the fusion weight values ​​can be derived and the weight calculation performed using all matching blocks. For example, if the number of fusion blocks N=3, BV0, BV1, and BV2 are always fused.

[0217] In some embodiments, the method further includes decoding the bitstream and determining the value N of the fusion matching block quantity. Exemplarily, the relevant syntactic element further includes the syntactic element intra_tmp_fusion_num, which is used to indicate the value N of the fusion matching block quantity.

[0218] In some embodiments, in at least one of steps 1102, 1402, and 1502, the fusion weight values ​​of the N fusion matching blocks are predefined fixed values.

[0219] In some embodiments, determining the fusion weight values ​​of N fusion matching blocks in at least one of steps 1102, 1402, and 1502 may include determining the fusion weight values ​​of N fusion matching blocks based on the fusion mode of the IntraTMP fusion prediction mode corresponding to the current candidate matching block group, where the fusion mode is the fusion mode of intra-template matching based on template derivation, or the fusion mode of intra-template matching based on template error values.

[0220] Note that different fusion modes correspond to different weighted fusion methods and fusion weight value derivation methods. Therefore, when determining the fusion weight values ​​for each fusion matching block, it is necessary to determine the weight value derivation method based on the fusion mode of the IntraTMP fusion prediction mode corresponding to the current candidate matching block group.

[0221] In some embodiments, the fusion mode is an intra-template matching fusion mode based on template derivation, and determining the fusion weight values ​​of N fusion matching blocks includes determining the fusion weight values ​​of the N fusion matching blocks and the fusion weight values ​​of the offset parameter based on the templates of the N fusion matching blocks, the templates of the current block, and the offset parameter.

[0222] Determining the predicted block of the current block by fusing N fusion matching blocks based on the fusing weight values ​​of the N fusion matching blocks includes fusing N fusion matching blocks and offset parameters based on the fusing weight values ​​of the N fusion matching blocks and offset parameters, and determining the predicted block of the current block.

[0223] Exemplary, the IntraTMP fusion method based on template derivation uses a method similar to training filter coefficients, obtaining weight values ​​for fusion predictions by training based on the template of each matching block and the template of the current block. For example, a candidate matching block group or set of candidate matching blocks contains three matching blocks and is represented as {BV(3i), BV1(3i+1), BV2(3i+2)}, and the fusion form is as follows:

[0224] pred=w0×BV 3×i +w1×BV 3×i +w2×BV 3×i+2 +w3×Bias

[0225] The BV(3i), BV1(3i+1), and BV2(3i+2) matching block templates are taken as input, and the current block template is output as pred. Bias is a fixed value, for example, the midpoint of the pixel range, and a set of weight values ​​w0~w3 are derived. When fusing matching blocks, the same fusing method, the reconstructed values ​​of the BV(3i), BV1(3i+1), and BV2(3i+2) matching blocks, and the weight values ​​w0~w3 are used to obtain the predicted block of the current block. Alternatively, when fusing matching block templates, the same fusing method, the reconstructed values ​​of the BV(3i), BV1(3i+1), and BV2(3i+2) matching block templates, and the weight values ​​w0~w3 are used to obtain the predicted template.

[0226] In some embodiments, when the fusion mode is the intra-template matching fusion mode based on the template error value, determining the fusion weight values of N fusion matching blocks includes determining the template error values of the N fusion matching blocks based on the templates of the N fusion matching blocks and the template of the current block, determining the cumulative sum of the template error values of the N fusion matching blocks based on the template error values of the N fusion matching blocks, and determining the fusion weight values of the N fusion matching blocks based on the template error values of the N fusion matching blocks and the cumulative sum of the template error values.

[0227] For example, if the template error value between the templates of N matching blocks and the template of the current block is the sum of absolute differences (SAD), and they are SAD1 to SADn respectively, one way of calculating the weight is as follows.

[0228] SADi=(SADi==0)?1:SADi

Equation

[0229] Here, n is the total number of matching blocks (i.e., N), and Wi is the weight value corresponding to the matching block whose template error value is SADi. The fusion format is as follows.

[0230]

Equation

[0231] Another embodiment of the present application further provides an encoding method, and referring to Figure 16, an exemplary flowchart of the encoding method according to an embodiment of the present application is shown. As shown in Figure 16, the method further includes the following steps:

[0232] In step 1601, a list of first candidate matching blocks for the current block is constructed based on template matching.

[0233] Within a predetermined search range, possible matching blocks are searched based on a predetermined search method. A template error value corresponding to each matching block is calculated based on the template of the matching block and the template of the current block. A list of candidate matching blocks is constructed based on the template error value corresponding to each matching block. Exemplaryly, the list of candidate matching blocks may be sorted in ascending order of template error value.

[0234] In step 1602, the first candidate matching block list is grouped to determine at least two candidate matching block groups, and the index value for each candidate matching block group is determined.

[0235] Exemplary, this includes grouping the first candidate matching block list based on at least one grouping rule. Each grouping rule specifically defines the group quantity, the number of matching blocks in each candidate matching block group, and the distance between matching blocks in each candidate matching block group. In embodiments of this application, one or more grouping rules can be used to group the first candidate matching block list and determine at least two candidate matching block groups, each candidate matching block group containing at least one matching block.

[0236] In step 1603, the index value of the first candidate matching block group corresponding to the current block is determined.

[0237] Exemplary, the first candidate matching block group may be a specific candidate matching block group from at least two candidate matching block groups, or any one candidate matching block group.

[0238] For example, the index value of the first candidate matching block group may be a predetermined index value, or it may be the index value of the best candidate matching block group selected by an encoding decision process such as SATD or RDO after performing fusion prediction using at least two candidate matching block groups, or it may be the index value of the best candidate matching block group on the encoding side, or the index value corresponding to the reference block. Based on the index value, the first candidate matching block group is determined, the matching block in the first candidate matching block group is used to perform IntraTMP fusion prediction, and the predicted block of the current block is determined.

[0239] In step 1604, the first candidate matching block group is determined from at least two candidate matching block groups based on the index value of the first candidate matching block group.

[0240] In step 1605, at least one matching block in the first candidate matching block group is merged to determine the predicted block of the current block.

[0241] In some embodiments, the method further includes determining the index value of the first candidate matching block group corresponding to the current block and determining the associated syntactic element of the current block. Furthermore, the method further includes encoding the associated syntactic element of the current block. Exemplarily, the associated syntactic element is used to indicate the prediction mode of the current block. In some embodiments, the associated syntactic element includes a first syntactic element and / or a second syntactic element, the first syntactic element used to indicate whether the prediction mode of the current block is a fused prediction mode based on intra-template matching prediction (IntraTMP), and the second syntactic element used to indicate the index value of the first candidate matching block group.

[0242] In some examples, the first syntactic element includes block-level syntactic elements. In some embodiments, the first syntactic element further includes at least one of stripe-level syntactic elements, slice-level syntactic elements, image-level syntactic elements, and sequence-level syntactic elements.

[0243] In some examples, the second syntactic element includes block-level syntactic elements. In some embodiments, the second syntactic element further includes at least one of stripe-level syntactic elements, slice-level syntactic elements, image-level syntactic elements, and sequence-level syntactic elements.

[0244] In some embodiments, the related syntax elements further include a syntax element for indicating whether the current block can be predicted using the IntraTMP prediction mode, a syntax element for indicating whether the current block predicts using the IntraTMP fusion prediction mode, and a syntax element for indicating whether the current block predicts using the IntraTMP multiple candidate prediction mode. In actual applications, the related syntax elements can be one or more of block-level syntax elements, stripe-level syntax elements, slice-level syntax elements, image-level syntax elements, and sequence-level syntax elements.

[0245] In some embodiments, when it is determined that the prediction mode of the current block is the IntraTMP fusion prediction mode, the encoding method of steps 1601 to 1605 in the embodiments of the present application is executed.

[0246] In some embodiments, the first syntax element is encoded. In some embodiments, the second syntax element is encoded. In some embodiments, the first syntax element and the second syntax element are encoded. Exemplarily, when it is determined that the current block predicts using the IntraTMP prediction mode, the first syntax element and the second syntax element are encoded. Exemplarily, when it is determined that the current block can be predicted using the IntraTMP fusion prediction mode, the first syntax element and the second syntax element are encoded. In addition, when it is necessary to encode the first syntax element and the second syntax element, there is no strict limitation on the encoding order of the two.

[0247] In some embodiments, when the value of the first syntax element is the first numerical value, it is determined that the prediction mode of the current block is the IntraTMP fusion prediction mode, and based on the second syntax element, the index value of the first candidate matching block group corresponding to the current block is determined.

[0248] The IntraTMP fusion prediction mode may also be a fusion mode based on at least one matching block, and may also be called the IntraTMP multiple matching block fusion prediction mode. In actual application, the number of fusion matching blocks to be fused can be selected based on the fusion mode, matching block grouping rules, etc.

[0249] In some embodiments, if the value of the first syntactic element is a second numeric value, it is determined that the prediction mode of the current block is one of the IntraTMP prediction modes other than the IntraTMP fusion prediction mode. Exemplarily, the other IntraTMP prediction mode may be an IntraTMP multiple candidate prediction mode based on a single matching block, where one matching block is selected from multiple candidate matching blocks and the selected matching block is used to obtain a prediction block.

[0250] In some embodiments, if the value of the first syntactic element is a second numerical value, it is determined that the prediction mode of the current block is the IntraTMP multiple candidate prediction mode based on a single matching block, and the index value of the optimal matching block corresponding to the current block is determined based on the second syntactic element. That is, the second syntactic element may be used to indicate the index value of the first candidate matching block group, or it may be used to indicate the index value of the optimal matching block corresponding to the current block, and the content indicated by the second syntactic element can be determined based on the prediction mode of the current block. Depending on the application, the second syntactic element may set different ranges of index values ​​or the same range of index values.

[0251] For example, the first number may be 1, and the second number may be 0.

[0252] For example, related syntactic elements include the following:

[0253] intra_tmp_flag If(intra_tmp_flag) { intra_tmp_fusion_flag intra_tmp_flu_idx }

[0254] When encoding IntraTMP-related syntactic elements, first, intra_tmp_flag is decoded. If intra_tmp_flag is true, it indicates that the current block will be encoded using IntraTMP mode. Then, intra_tmp_fusion_flag (which acts as the first syntactic element) and intra_tmp_fusion_idx (which acts as the first syntactic element) are encoded. If intra_tmp_fusion_flag is true, it indicates that the current block will be predicted using IntraTMP fusion prediction mode, and based on intra_tmp_fusion_idx, which group's matching block will be used for fusion prediction is determined. If intra_tmp_fusion_flag is false, it indicates that the current block will be used with single-matching-block IntraTMP multiple-candidate prediction mode, and based on intra_tmp_fusion_idx, the optimally selected matching block is determined.

[0255] In some embodiments, encoding the relevant syntactic elements of the current block includes encoding a first syntactic element, determining that the prediction mode of the current block is the IntraTMP fusion prediction mode if the value of the first syntactic element is a first numerical value, encoding a second syntactic element, and determining the index value of the first candidate matching block group corresponding to the current block based on the second syntactic element.

[0256] For example, related syntactic elements include the following:

[0257] intra_tmp_flag If(intra_tmp_flag) { intra_tmp_fusion_flag If(intra_tmp_fusion_flag){ intra_tmp_flu_idx } }

[0258] When encoding IntraTMP-related syntactic elements, if intra_tmp_flag is true, it indicates that the current block should be encoded using IntraTMP mode, and then intra_tmp_fusion_flag is encoded. If intra_tmp_fusion_flag is true, it indicates that the current block should be predicted using IntraTMP fusion prediction mode, and then intra_tmp_fusion_idx is encoded to determine which group's matching block will be used for fusion prediction. The value of intra_tmp_fusion_idx must be associated with a grouping rule. For example, if the total number of candidate matching block groups is 15, then intra_tmp_fusion_idx can take values ​​from 0 to 14, and intra_tmp_fusion_idx can also take values ​​from 0 to N, where N is less than 14. intra_tmp_fusion_idx can use a variable-length encoding scheme, where a smaller index corresponds to a shorter corresponding codeword, and a smaller index value corresponds to a smaller template error value for the corresponding candidate matching block, and a higher probability of selection. A shorter codeword can be assigned to a smaller index value. For example, the following table can be used for encoding.

[0259] [Table 6]

[0260] Indices 3-6 use codewords of the same length, and indices 7-14 use codewords of the same length. In the table above, x can be obtained using truncated binary. For example, intra_tmp_fusion_idx can take values ​​from 0 to 4 and is encoded using the following table.

[0261] [Table 7]

[0262] The single codeword coding schemes in intra_tmp_fusion_idx include equiprobability single codeword coding, context-model-based single codeword coding, or single codeword coding based on multiple context models.

[0263] In some embodiments, the method further includes: making an encoding decision based on the predicted block and original block of the current block corresponding to each candidate matching block group to determine the best candidate matching block group; if the index value of the first candidate matching block group is not the index value of the best candidate matching block group, setting the index value of the best candidate matching block group to the index value of the first candidate matching block group; and determining a second syntactic element based on the index value of the first candidate matching block group.

[0264] Furthermore, the encoding and decoding sides use the same matching block grouping method and perform fusion prediction for each group of matching blocks using the same process. The encoding side selects the optimal prediction mode using an encoding decision process such as SATD or RDO, determines the values ​​of the first and second syntactic elements, encodes the first and second syntactic elements, writes the encoded bits to the bitstream, and completes the encoding process for the current block.

[0265] In some embodiments, the related syntactic element further includes a third syntactic element used to indicate the index value of the best matching block corresponding to the current block, and encoding the related syntactic element of the current block further includes determining that the prediction mode of the current block is the IntraTMP multiple candidate prediction mode based on a single matching block if the value of the first syntactic element is a second numeric value, encoding the third syntactic element of the current block, and determining the index value of the best matching block corresponding to the current block based on the third syntactic element. In other words, intra_tmp_fusion_idx and intra_tmp_idx can be encoded in different ways based on intra_tmp_fusion_flag.

[0266] For example, related syntactic elements include the following:

[0267] intra_tmp_flag If(intra_tmp_flag) { intra_tmp_fusion_flag If(intra_tmp_fusion_flag){ intra_tmp_flu_idx else{ intra_tmp_idx } }

[0268] When encoding IntraTMP-related syntactic elements, if intra_tmp_flag is true, it indicates that the current block will be encoded using IntraTMP mode, and then intra_tmp_fusion_flag is encoded. If intra_tmp_fusion_flag is true, it indicates that the current block will be predicted using IntraTMP fusion prediction mode, and then intra_tmp_fusion_idx (which acts as a second syntactic element) is encoded to determine which group's matching block will be used for fusion prediction. If intra_tmp_fusion_flag is false, it indicates that the current block will be used using IntraTMP multiple candidate prediction mode for a single matching block, and then intra_tmp_idx (which acts as a third syntactic element) is encoded to indicate the index of the selected matching block in the candidate matching block list. For example, if intra_tmp_idx is equal to i, then the (i+1)th matching block in the candidate matching block list will be the selected matching block, with i starting from 0 and index values ​​starting from 1. Alternatively, if intra_tmp_idx is equal to i, the i-th matching block in the candidate matching block list is the selected matching block, and the value of i starts from 0, and the index value also starts from 0.

[0269] When encoding intra_tmp_fusion_idx and intra_tmp_idx in different ways based on intra_tmp_fusion_flag, it is also possible to construct candidate matching block lists of different lengths based on intra_tmp_fusion_flag. For example, if intra_tmp_fusion_flag is true, a list of length N1 is constructed, and if intra_tmp_fusion_flag is false, a list of length N2 is constructed, where N1 and N2 may be predetermined fixed values, or the values ​​of N1 and N2 may be written to the bitstream.

[0270] In some embodiments, if the prediction mode of the current block is determined to be an IntraTMP multiple candidate prediction mode based on a single matching block, the method further includes determining the optimal matching block from a second candidate matching block list based on the index value of the optimal matching block, and determining the prediction block of the current block based on the optimal matching block.

[0271] In some embodiments, the method further comprises constructing the second candidate matching blocklist of the current block based on template matching, where the length of the second candidate matching blocklist is not equal to the length of the first candidate matching blocklist. In some embodiments, the length of the second candidate matching blocklist is equal to the length of the first candidate matching blocklist, and the first candidate matching blocklist and the second candidate matching blocklist may be understood as the same candidate matching blocklist.

[0272] In some embodiments, the second syntactic element is further used to indicate the fusion mode of the current block's IntraTMP fusion prediction mode. For example, if a fusion mode of one type of IntraTMP fusion prediction mode is set for a first candidate matching block group, the first candidate matching block group can be identified using the index value of the first candidate matching block group, while simultaneously identifying the corresponding fusion mode of one type of IntraTMP fusion prediction mode. Different fusion modes differ in the selection method of the corresponding matching block, the weighted fusion method, the fusion weight values, etc. For example, fusion modes include fusion modes for intra-template matching based on template derivation and fusion modes for intra-template matching based on template error values.

[0273] For example, if the total length of the candidate matching block list is N, then every M matching blocks in the candidate matching block list can be defined as one group, resulting in a total of N / M candidate matching block groups. Each candidate matching block group can be assigned one or more fusion modes, and the candidate matching block groups can be expanded. If the same candidate matching block group has two fusion modes, it can be considered as two separate candidate matching block groups: {BV0,BV1,BV2,BV3,BV4,bFilter=1}, {BV0,BV1,BV2,BV3,BV4,bFilter=0}, {BV0,BV1,BV2,bFilter=1}, {BV0,BV1,bFilter=0}. bFilter=1 represents the first type of fusion mode, and bFilter=0 represents the second type of fusion mode. The index value can be used to identify the first candidate matching block group and simultaneously identify the corresponding fusion mode.

[0274] In some embodiments, the related syntactic element further includes a fourth syntactic element, and the method further includes encoding the fourth syntactic element, where the fourth syntactic element is used to indicate the fusion mode of the IntraTMP fusion prediction mode of the current block, or to indicate whether or not to perform filtering on the selected matching block.

[0275] In some embodiments, the first and fourth syntactic elements are encoded. In some embodiments, the second and fourth syntactic elements are encoded. In some embodiments, the third and fourth syntactic elements are encoded. In some embodiments, the first, second, and fourth syntactic elements are encoded.

[0276] In some embodiments, the prediction mode of the current block is determined to be the IntraTMP fusion prediction mode, the fusion mode of the IntraTMP fusion prediction mode of the current block is determined based on the fourth syntactic element, the prediction mode of the current block is determined to be the IntraTMP multiple candidate prediction mode based on a single matching block, and the system determines whether or not to perform filtering on the selected matching block based on the fourth syntactic element.

[0277] For example, related syntactic elements include the following:

[0278] intra_tmp_flag If(intra_tmp_flag){ Intra_tmp_fusion_flag intra_tmp_filter_flag intra_tmp_idx }

[0279] When encoding IntraTMP-related syntactic elements, if intra_tmp_flag is true, it indicates that the current block will be encoded using the IntraTMP mode, and further encodes intra_tmp_fusion_flag, intra_tmp_filter_flag, and intra_tmp_idx (which acts as a second syntactic element and is also called intra_tmp_fusion_idx). If intra_tmp_fusion_flag is true, it indicates that the current block will be predicted using the IntraTMP fusion prediction mode, and intra_tmp_idx determines which group's matching blocks will be used for fusion prediction, with intra_tmp_filter_flag representing the fusion mode. If intra_tmp_fusion_flag is false, intra_tmp_idx indicates that the single matching block prediction method will be used for the current block, and intra_tmp_filter_flag indicates whether or not to perform filtering on the single matching block. Exemplary, we demonstrate that if intra_tmp_filter_flag is true, we use an IntraTMP fusion mode based on template derivation, and if intra_tmp_filter_flag is false, we use an IntraTMP fusion mode based on template error values.

[0280] In some embodiments, if the prediction mode of the current block is determined to be the IntraTMP fusion prediction mode, a fourth syntactic element is encoded, where the fourth syntactic element is used to indicate the fusion mode of the IntraTMP fusion prediction mode of the current block.

[0281] For example, related syntactic elements include the following:

[0282] intra_tmp_flag If(intra_tmp_flag) { intra_tmp_fusion_flag If(intra_tmp_fusion_flag){ intra_tmp_filter_flag intra_tmp_flu_idx } }

[0283] When encoding IntraTMP-related syntactic elements, if intra_tmp_flag is true, it indicates that the current block will be encoded using the IntraTMP mode, and then intra_tmp_fusion_flag is encoded. If intra_tmp_fusion_flag is true, it indicates that the current block will be predicted using the IntraTMP fusion prediction mode, and then intra_tmp_filter_flag (which acts as the fourth syntactic element), intra_tmp_fusion_idx, and intra_tmp_filter_flag are encoded to indicate the fusion mode, where intra_tmp_fusion_idx determines which group's matching block will be used for fusion prediction. Exemplarily, if intra_tmp_filter_flag is true, it indicates that the IntraTMP fusion mode based on template derivation will be used, where intra_tmp_fusion_idx determines which group's matching block will be used for fusion prediction, and the matching block of that group and its corresponding weight value are fused to obtain the final predicted block. If intra_tmp_filter_flag is false, it indicates that the IntraTMP fusion mode based on template error values ​​will be used. intra_tmp_fusion_idx determines which group's matching block will be used for fusion prediction, and fuses that group's matching block with its corresponding weight value to obtain the final prediction block.

[0284] In some embodiments, if the prediction mode of the current block is determined to be the IntraTMP multiple candidate prediction mode based on a single matching block, a fourth syntactic element is encoded, and based on the fourth syntactic element, it is determined whether or not to perform filtering on the selected matching block.

[0285] For example, the coding process for syntactic elements includes the following:

[0286] intra_tmp_flag If(intra_tmp_flag){ intra_tmp_fusion_flag If(!intra_tmp_fusion_flag){ intra_tmp_filter_flag } intra_tmp_idx }

[0287] When encoding IntraTMP-related syntax elements, if intra_tmp_flag is true, it indicates that the current block should be encoded using IntraTMP mode, and then intra_tmp_fusion_flag is encoded. If intra_tmp_fusion_flag is false, it indicates that the current block should be encoded using the IntraTMP multiple candidate prediction mode for a single matching block, and then intra_tmp_filter_flag is encoded to determine whether or not to filter the selected matching block, and then intra_tmp_idx is encoded to determine the selected optimal matching block. If intra_tmp_fusion_flag is true, it indicates that the current block should be predicted using the IntraTMP fusion prediction mode, and then intra_tmp_idx is encoded to determine which group's matching block will be used for fusion prediction. In some embodiments, the encoding of intra_tmp_idx may be performed before determining whether intra_tmp_fusion_flag is true or false.

[0288] In some embodiments, the related syntactic element further includes a fourth syntactic element and a fifth syntactic element, the method further comprising: determining that the prediction mode of the current block is an IntraTMP fusion prediction mode and encoding a fourth syntactic element, where the fourth syntactic element is used to indicate the fusion mode of the IntraTMP fusion prediction mode of the current block; and determining that the prediction mode of the current block is an IntraTMP multiple candidate prediction mode based on a single matching block and encoding a fifth syntactic element, where the fifth syntactic element is used to indicate whether or not to perform filtering on the selected matching block. In other words, different syntactic elements can be set and used to indicate the fusion mode of the IntraTMP fusion prediction mode of the current block and to indicate whether or not to perform filtering on the selected matching block, respectively.

[0289] In some embodiments, the index range of the index value of the first candidate matching block group is smaller than the index range corresponding to at least two candidate matching block groups. Exemplarily, the index range corresponding to two candidate matching block groups is 0 to 5, and the index range of the index value of the first candidate matching block group is 0 to 2, i.e., the second syntactic element to be transmitted is used to indicate a candidate matching block group whose index value is 0 to 2. In other words, the value of intra_tmp_fusion_idx can be less than or equal to the number of candidate matching block groups. All possible matching block groups are resorted, and then intra_tmp_fusion_idx or intra_tmp_idx indicates the first N combinations among them. That is, the range of values ​​of intra_tmp_fusion_idx or intra_tmp_idx is 0 to N-1, and if M is the number of matching block groups being resorted, then M > N.

[0290] In some embodiments, if the fusion mode includes a first fusion mode and a second fusion mode, the method further includes determining a second syntactic element based on the index value of a first candidate matching block group when a fourth syntactic element is used to indicate that the fusion mode of the current block's IntraTMP fusion prediction mode is the first fusion mode, and determining a second syntactic element based on the index value and index offset value of a first candidate matching block group when a fourth syntactic element is used to indicate that the fusion mode of the current block's IntraTMP fusion prediction mode is the second fusion mode.

[0291] Furthermore, if the second syntactic element is used to indicate only the index values ​​of some candidate matching block groups, more candidate matching block groups can be indicated based on the fourth syntactic element. For example, if the index range corresponding to two candidate matching block groups is 0 to 5, and the index range of the index value of the first candidate matching block group is 0 to 2, then when the fourth syntactic element is used to indicate the first fusion mode, the index range of the second syntactic element is 0 to 2, and when the fourth syntactic element is used to indicate the second fusion mode, the index range obtained by adding the index offset value to the value of the second syntactic element is 3 to 5. Moreover, it can also be understood that candidate matching block groups with an index range of 0 to 2 correspond to the first fusion mode, and candidate matching block groups with an index range of 3 to 5 correspond to the second fusion mode.

[0292] In some embodiments, candidate matching block groups with an index range of 0 to 2 and candidate matching block groups with an index range of 3 to 5 may be grouped by the same grouping rule, or they may be grouped by different grouping rules.

[0293] In some embodiments, it is decided to predict the current block using the IntraTMP fusion prediction mode, and this method further includes saving the index value of the first candidate matching block group corresponding to the current block, or saving a predetermined matching block in the first candidate matching block group corresponding to the current block. Exemplary, a BV in the matching block group indicated by intra_tmp_fusion_idx can be saved for reference by other decryption blocks. For example, if intra_tmp_fusion_idx=i, the i*3+1th BV in the candidate block list is saved. Exemplary, other decryption blocks use the index value of the first candidate matching block group corresponding to the current block as their own index value, or use a predetermined matching block in the first candidate matching block group as a reference block for other decryption blocks.

[0294] In some embodiments, the method further includes encoding a sixth syntactic element, where the sixth syntactic element is used to indicate whether or not to encode some or all syntactic elements in the relevant syntactic elements of the current block.

[0295] In some embodiments, the sixth syntactic element includes at least one of sequence-level syntactic elements, picture-level syntactic elements, slice-level syntactic elements, stripe-level syntactic elements, and block-level syntactic elements.

[0296] Furthermore, some or all of the syntactic elements in an associated syntactic element may be limited by one or more syntactic elements from the block level, stripe level, slice level, picture level, and sequence level. In other words, a sixth syntactic element can be set corresponding to each syntactic element of an associated syntactic element, or a sixth syntactic element can be set corresponding to two or more syntactic elements of an associated syntactic element, or a sixth syntactic element can be set corresponding to all syntactic elements of an associated syntactic element. For example, if an associated syntactic element is a block-level syntactic element, the sixth syntactic element may be a picture-level and / or sequence-level syntactic element.

[0297] Furthermore, we will explain the construction of a candidate matching blocklist with an example.

[0298] In some embodiments, a candidate block list of length N is constructed by searching for N candidate matching blocks within a search area using template matching, or by sorting the N candidate matching blocks in ascending order of their template error values. The template matching process for constructing the candidate block list is as follows: A first search is performed with a fixed step size, for example, with both the horizontal and vertical step sizes set to 4. N optimal matching blocks (the first N with the smallest template error values) are obtained at fixed intervals. In the second step, a second search is performed in the adjacent regions of the N matching blocks obtained in the first step. These adjacent regions can be set as multiple non-overlapping regions based on the step size in the first step. M optimal matching blocks (which may include the matching blocks obtained in the first step) are obtained from these regions.

[0299] Furthermore, an example of the grouping method for the first candidate matching block list in the embodiment of this application will be explained.

[0300] In some embodiments, grouping the first candidate matching block list includes grouping the first candidate matching block list based on at least one grouping rule. Each grouping rule specifically defines the group quantity, the number of matching blocks in each candidate matching block group, and the distance between matching blocks in each candidate matching block group.

[0301] In some embodiments, at least one grouping rule includes a first grouping rule, which includes setting matching blocks in a first predetermined quantity from the first matching block in a first candidate matching block list as a candidate matching block group, where the first predetermined quantity is an integer greater than 0, where the first predetermined quantity is the number of matching blocks in each candidate matching block group.

[0302] The maximum length of the candidate matching block list constructed by the template matching process is N, for example, N is equal to 45. The fusion prediction can be fused using a maximum of M matching blocks, for example, if M is 3 and the first predetermined quantity is set to 3, then based on the first grouping rule, every M matching blocks in the candidate matching block list can be considered one group, resulting in a total of N / M = 15 groups. If the total length N of the candidate matching block list is not divisible by the maximum fusion quantity M, then the number of matching blocks in the last group will be less than M, and another matching block from the candidate matching block list can be added to that group. In other words, the first grouping rule further includes taking a predetermined matching block from the first candidate matching block list and adding it to the last candidate matching block group if the number of matching blocks in the last candidate matching block group is less than the first predetermined quantity, so that the number of matching blocks in the last candidate matching block group is equal to the first predetermined quantity.

[0303] At least one grouping rule includes a second grouping rule, the second grouping rule includes setting matching blocks in the first candidate matching block list, in units of a second predetermined quantity, as a candidate matching block group, where the second predetermined quantity is an integer greater than 0, and the first predetermined quantity and the second predetermined quantity are not equal.

[0304] The maximum length of the candidate matching block list constructed by the template matching process is N, for example, N is equal to 15. The fusion prediction can be fused using a maximum of M matching blocks, for example, if M is 5 and the second predetermined quantity is set to 5, then based on the first grouping rule, every M matching blocks in the candidate matching block list can be considered one group, resulting in a total of N / M = 3 groups. Correspondingly, the second grouping rule further includes, if the number of matching blocks in the last candidate matching block group is less than the second predetermined quantity, taking a predetermined matching block from the first candidate matching block list and adding it to the last candidate matching block group so that the number of matching blocks in the last candidate matching block group is equal to the second predetermined quantity.

[0305] In some embodiments, at least one grouping rule includes a first grouping rule and a second grouping rule. Exemplarily, the maximum length of the candidate matching block list constructed by the template matching process is N, for example, N is equal to 15. If the first predetermined quantity is 3 and the second predetermined quantity is 5, then based on the first grouping rule, a maximum of N / M = 5 groups can be obtained, and based on the second grouping rule, a maximum of N / M = 3 groups can be obtained. Grouping the candidate matching block list based on the first and second grouping rules yields a total of 8 groups.

[0306] In some embodiments, each grouping rule further includes a corresponding group quantity. For example, if the group quantity corresponding to the first grouping rule is 2 and the group quantity corresponding to the second grouping rule is 2, the candidate matching block list is grouped based on the first and second grouping rules to obtain a total of 4 groups. For example, the candidate blocks in the candidate matching block list are BVn, where n is an integer from 1 to N, or an integer from 0 to N-1, and in some embodiments, i may be the index value of the candidate matching block. Based on the first grouping rule, two candidate matching block groups {BV0, BV1, BV2} and {BV3, BV4, BV5} are obtained, and based on the second grouping rule, two candidate matching block groups {BV0, BV1, BV3, BV2, BV4} and {BV5, BV6, BV7, BV8, BV9} are obtained.

[0307] In some embodiments, at least one grouping rule includes a third grouping rule, the third grouping rule comprising forming a candidate matching block group with the first M1 matching blocks in the first candidate matching block list and every M2 matching blocks from the M1+1th matching block onwards. In some embodiments, the third grouping rule further includes a corresponding group quantity.

[0308] In some embodiments, the third grouping rule further includes the condition that the M2 values ​​in different matching block groups are equal, or that the M2 values ​​in different matching block groups are not equal at all.

[0309] As an example, combine BVn (i>N) with the first M1 elements in the candidate matching block list. For example, if M1=2 and M2=1, possible combinations are {BV0,BV1,BV2}, {BV0,BV1,BV3}, {BV0,BV1,BV4}, etc. If M1=2, possible combinations are {BV0,BV1,BV2,BV3}, {BV0,BV1,BV4}, {BV0,BV1,BV5}, etc. Combine BVn-BV(n+M2)(n>N) with the first N elements in the candidate matching block list. For example, if M1=1 and M2=2, possible combinations are {BV0,BV1,BV2}, {BV0,BV3,BV4}, {BV0,BV5,BV6}, etc.

[0310] In some embodiments, at least one grouping rule includes a first matching rule and a third grouping rule. At least one grouping rule includes a first matching rule, a second grouping rule, and a third grouping rule. Exemplaryly, each grouping rule further includes a corresponding grouping quantity.

[0311] In some embodiments, at least one grouping rule includes a fourth grouping rule, the fourth grouping rule includes configuring the first i matching blocks in the first candidate matching block list as the i-th candidate matching block group, where i is an integer greater than 0. Exemplarily, the first matching block may be configured as the first candidate matching block group, the first two matching blocks as the second candidate matching block group, the first three matching blocks as the third candidate matching block group, the first four matching blocks as the fourth candidate matching block group, and so on, where the maximum length of the candidate matching block list is N, and in this case the maximum value of i is N, and the number of groups can be limited by limiting the maximum value of i.

[0312] In some embodiments, the fifth grouping rule is applied to the first two in the first candidate matching blocklist. i The fifth grouping rule includes configuring the i-th candidate matching block group with the i-th matching block, where a is a positive integer.

[0313] In some embodiments, grouping can also be based on the distance between matching blocks. For example, the grouping rule may further include the condition that the distance between any two matching blocks in a candidate matching block group is greater than a first distance threshold, or the grouping rule may further include the condition that the distance between any two matching blocks in a candidate matching block group is less than a second distance threshold. By restricting the distance between matching blocks, the distribution of matching blocks in a candidate matching block group can be restricted. Note that if more than one grouping rule is set, each grouping rule may either restrict all matching blocks or restrict them partially.

[0314] In some embodiments, grouping the first candidate matching block list includes grouping the first candidate matching block list based on at least one grouping rule to obtain at least one candidate matching block group, and setting a corresponding fusion mode of at least one IntraTMP fusion prediction mode for each candidate matching block group to obtain at least two candidate matching block groups.

[0315] Furthermore, after grouping the first candidate matching block list based on the above arbitrary grouping embodiment, one or more fusion modes can be set for the candidate matching block group. Understandably, one candidate matching block group and one fusion mode are combined into one new candidate matching block group, and two fusion modes are set for one candidate matching block group and combined into two new candidate matching block groups.

[0316] Exemplary, based on the first and second grouping rules described above, we obtain two candidate matching block groups, {BV0,BV1,BV2,BV3,BV4} and {BV0,BV1}. By setting two fusion modes for each candidate group, we obtain four candidate matching block groups, {BV0,BV1,BV2,BV3,BV4,bFilter=1}, {BV0,BV1,BV2,BV3,BV4,bFilter=0}, {BV0,BV1,bFilter=1}, and {BV0,BV1,bFilter=0}. bFilter=1 represents the first type of fusion mode, and bFilter=0 represents the second type of fusion mode.

[0317] Exemplary examples include intra-template matching fusion modes based on template derivation and intra-template matching fusion modes based on template error values.

[0318] The first type of fusion mode is an intra-template matching fusion mode based on template derivation, and the second type of fusion mode is an intra-template matching fusion mode based on template error values. Exemplary, one grouping result includes {BV0,BV1,BV2,BV3,BV4,bFilter=1}, {BV0,BV1,BV2,BV3,BV4,bFilter=0}, {BV0,BV1,bFilter=1}, {BV0,BV1,bFilter=0}, and so on.

[0319] In some embodiments, the encoding and decoding sides predefine one grouping rule or a combination of one grouping rules.

[0320] In some embodiments, the method further includes determining at least one grouping rule and encoding syntactic elements to be used in at least one grouping rule. Exemplarily, the method encodes syntactic elements for representing a grouping rule or a combination of grouping rules, the combination of grouping rules comprising a given at least two grouping rules.

[0321] In some embodiments, the encoding and decoding sides predefine one or more grouping rules, and the method includes encoding variable parameters in the grouping rules. Exemplarily, the encoding and decoding sides predefine a first grouping rule, and the method includes encoding a first predetermined quantity. The method further includes encoding a group quantity.

[0322] In other words, one or more grouping rules can be set. For example, one grouping rule merges a maximum of M1 matching blocks, for example, M1 is equal to 3. Each M1 matching block in the candidate matching block list is considered one group, and another grouping rule merges a maximum of M2 matching blocks, for example, M2 is equal to 2. Each M2 matching block in the candidate matching block list is considered one group. These two grouping rules can be used individually or in combination to obtain matching block groups, and one way to select a matching block group is to indicate which group to use by an index value, or another way is to resort these matching block groups and determine a matching block group based on its index value.

[0323] Furthermore, we will explain the determination of the index value for each candidate matching block group with an example.

[0324] In some embodiments, determining the index value of each candidate matching block group includes determining the first index value of each candidate matching block group based on the grouping position of each candidate matching block group, and setting the first index value of each candidate matching block group as the index value of each candidate matching block group. In some embodiments, the smallest first index value is selected and set as the index value of the first candidate matching block group.

[0325] For example, a candidate block in the candidate matching block list is BVn, where n is an integer from 1 to N, or an integer from 0 to N-1. If the total length of the candidate matching block list is N, then every M matching blocks in the candidate matching block list can be defined as one group, and the list can be divided into a total of N / M candidate matching block groups. For example, if M is equal to 3, the i-th candidate matching block group is represented as {BV(3i), BV1(3i+1), BV2(3i+2)}, where i is the index value of each candidate matching block group, and in the embodiment of this application, i is an integer greater than or equal to 1, and the group number i is less than or equal to the group number.

[0326] In some embodiments, determining the index value of each candidate matching block group includes: resorting at least two candidate matching block groups; determining a second index value for each candidate matching block group based on its position after resorting; and setting the second index value of each candidate matching block group as the index value of that candidate matching block group. In some embodiments, the smallest second index value is selected and used as the index value of the first candidate matching block group.

[0327] Illustratively, the candidate matching block groups are resorted based on the corresponding template error values, with the candidate matching block group with the smallest template error value at the top. Matching block groups with smaller template error values ​​have smaller corresponding weight values, and matching block groups with smaller template error values ​​have a higher probability of being selected. This resorting reduces the number of encoded bits for the index values. Illustratively, a candidate block in the candidate matching block list is BVn, where n is an integer from 1 to N, or an integer from 0 to N-1. If the total length of the candidate matching block list is N, then every M matching blocks in the candidate matching block list are defined as one group, and the list can be divided into a total of N / M candidate matching block groups. For example, if M is equal to 3, the i-th candidate matching block group is represented as {BV(3i), BV1(3i+1), BV2(3i+2)}, where i is the index value for each candidate matching block group, and in the embodiment of this application, i is an integer greater than or equal to 1, and the group number i is less than or equal to the group quantity. For example, if, after resorting, the template error value of the second candidate matching block group is the smallest and it is sorted to the front, its index value will be 0. When the second syntactic element is used to indicate the index value of the second candidate matching block group, it only needs to be encoded as 0.

[0328] Figure 11 is an illustrative flowchart of a resorting method in an embodiment of the present application, and as shown in Figure 11, in some embodiments, resorting at least two candidate matching block groups includes the following steps:

[0329] In step 1101, N fusion matching blocks (where N is an integer greater than 0) are selected from each candidate matching block group to be fused.

[0330] In step 1102, the fusion weight values ​​of N fusion matching blocks are determined.

[0331] In step 1103, the templates of N fusion matching blocks are fused based on the fusion weight values ​​of the N fusion matching blocks, and the predicted template corresponding to each candidate matching block group is determined.

[0332] In step 1104, the template error value corresponding to each candidate matching block group is determined based on the prediction template corresponding to each candidate matching block group and the template of the current block.

[0333] In step 1105, the sorting is performed based on the template error value corresponding to each candidate matching block group.

[0334] By performing template prediction using each candidate matching block group in the template region, a predicted template corresponding to a different candidate matching block group is calculated, and a template error value is calculated based on the predicted template and the template of the current block. The specific method is as follows:

[0335] As shown in Figure 12, a prediction is made for a single matching block in the template region, and the template of that matching block is the prediction template for the template region.

[0336] As shown in Figure 13, fusion prediction of multiple matching blocks is performed in the template region. That is, a weighted fusion is performed on the templates of multiple matching blocks to obtain a predicted template. The weighted fusion process of the templates should be the same as the weighted fusion process used to predict the current block.

[0337] Based on the method for making predictions in the template region described above, a prediction template can be obtained for each candidate matching block group in the template region. Furthermore, by comparing this prediction template with the template of the current block, a template error value can be obtained for each candidate matching block group. Based on these template error values, the optimal candidate matching block group can be selected by resorting.

[0338] In some embodiments, determining the fusion weight values ​​of N fusion matching blocks involves determining the fusion weight values ​​of N fusion matching blocks based on the fusion mode of the current block's IntraTMP fusion prediction mode.

[0339] In some embodiments, when setting the fusion mode of the corresponding IntraTMP fusion prediction mode for each candidate matching block group, determining the fusion weight values ​​of N fusion matching blocks includes determining the fusion weight values ​​of N fusion matching blocks based on the fusion mode of the IntraTMP fusion prediction mode corresponding to each candidate matching block group.

[0340] Furthermore, since different fusion modes correspond to different methods for deriving weight values, it is necessary to derive the fusion weight values ​​based on the fusion mode of the current block's IntraTMP fusion prediction mode. The fusion mode of the IntraTMP fusion prediction mode corresponding to the current candidate matching block group determines the fusion weight values ​​of the N fusion matching blocks. In the embodiments of this application, the fusion mode of the current block can be predetermined or indicated by transmitting a fourth syntactic element.

[0341] Furthermore, another example of a matching block fusion method in the embodiments of this application will be described. Figure 14 is an illustrative flowchart of one fusion method in the embodiments of this application, and as shown in Figure 14, fusion of at least one matching block in the first candidate matching block group to determine the predicted block of the current block includes the following steps.

[0342] In step 1401, N fusion matching blocks (where N is an integer greater than 0) are selected from the first candidate matching block group to be fused.

[0343] In step 1402, the fusion weight values ​​of N fusion matching blocks are determined.

[0344] In step 1403, the N fusion matching blocks are fused based on their fusion weight values, and the predicted block for the current block is determined.

[0345] Note that N is less than or equal to the number of matching blocks.

[0346] In some embodiments, determining N fusion matching blocks to be fused in at least one of steps 1101 and 1401 includes determining the template error value of each matching block in the current candidate matching block group, and determining a template error threshold based on the template error value and threshold coefficient of the i-th matching block in the current candidate matching block group, wherein the i-th matching block is the matching block with the minimum template error value in the current candidate matching block group, and determining that a matching block whose template error value is less than or equal to the template error threshold is a fusion matching block.

[0347] When predicting the matching block for the current block, the current candidate matching block group is the first candidate matching block group. When resorting at least two candidate matching block groups and performing template prediction using at least two candidate matching block groups, the current candidate matching block group is the single candidate matching block group currently selected.

[0348] In some embodiments, the method further includes determining a threshold coefficient corresponding to the current candidate matching block group, where the threshold coefficients corresponding to different candidate matching block groups are not necessarily equal. Exemplarily, the smaller the index value of the candidate matching block group, the larger the threshold coefficient.

[0349] In some embodiments, determining that a matching block whose template error value is less than or equal to the template error threshold is a fused matching block includes making the i-th matching block in the current candidate matching block group the i-th fused matching block if the template error value of the i+j-th matching block is greater than the number of matching blocks equal to the template error threshold.

[0350] Figure 15 is an illustrative flowchart of a method for determining fusion matching blocks in an embodiment of the present application, and as shown in Figure 15, determining the N fusion matching blocks to be fused in steps 1101 and 1401 includes the following steps.

[0351] In step 1501, the matching blocks in the current candidate matching block group are divided into at least two sets of candidate matching blocks, where each set of candidate matching blocks contains N fused matching blocks to be merged, and the number of fused matching blocks and the number of fused matching blocks in different sets of candidate matching blocks are not exactly the same.

[0352] In step 1502, the fusion weights of the N fusion matching blocks in each candidate matching block set are determined.

[0353] In step 1503, the templates of the N fused matching blocks are merged based on the fusion weight values ​​of the N fused matching blocks in each candidate matching block set, and the prediction template corresponding to each candidate matching block set is determined.

[0354] In step 1504, the template error value corresponding to each candidate matching block set is determined based on the prediction template corresponding to each candidate matching block set and the template of the current block.

[0355] In step 1505, based on the template error value corresponding to each candidate matching block set, the optimal candidate matching block set with the minimum template error value is determined, and the matching blocks in the optimal candidate matching block set are defined as N fused matching blocks.

[0356] When predicting the matching block for the current block, the current candidate matching block group is the first candidate matching block group. When resorting at least two candidate matching block groups and performing template prediction using at least two candidate matching block groups, the current candidate matching block group is the single candidate matching block group currently selected.

[0357] For example, if the current candidate matching block group contains three matching blocks {BV(3i), BV1(3i+1), BV2(3i+2)}, the candidate matching block sets that can be used to try template prediction are {BV(3i)}, {BV(3i), BV1(3i+1)}, and {BV(3i), BV1(3i+1), BV2(3i+2)}, and for each set, weight values ​​for a specific fusion mode are derived. The optimal candidate matching block set is determined, and fusion is performed using the matching blocks in the optimal candidate matching block set to determine the predicted block for the current block.

[0358] In some embodiments, determining the N fusion matching blocks to be fused in steps 1101 and 1401 involves selecting the first N matching blocks in the current candidate matching block group as the N fusion matching blocks, where N is less than or equal to the number of matching blocks in the current candidate matching block group. That is, if the fusion quantity N is less than the number of matching blocks M, the fusion weight values ​​can be derived and the weight calculation performed using only N matching blocks, and if the fusion quantity N is equal to the number of matching blocks M, the fusion weight values ​​can be derived and the weight calculation performed using all matching blocks. For example, if the number of fusion blocks N=3, BV0, BV1, and BV2 are always fused.

[0359] In some embodiments, the method further includes encoding a value N for the fusion matching block quantity. Exemplaryly, the relevant syntactic element further includes the syntactic element intra_tmp_fusion_num, which is used to indicate the value N for the fusion matching block quantity.

[0360] In some embodiments, in at least one of steps 1102, 1402, and 1502, the fusion weight values ​​of the N fusion matching blocks are predefined fixed values.

[0361] In some embodiments, determining the fusion weight values ​​of N fusion matching blocks in at least one of steps 1102, 1402, and 1502 may include determining the fusion weight values ​​of N fusion matching blocks based on the fusion mode of the IntraTMP fusion prediction mode corresponding to the current candidate matching block group, where the fusion mode is the fusion mode of intra-template matching based on template derivation, or the fusion mode of intra-template matching based on template error values.

[0362] Note that different fusion modes correspond to different weighted fusion methods and fusion weight value derivation methods. Therefore, when determining the fusion weight values ​​for each fusion matching block, it is necessary to determine the weight value derivation method based on the fusion mode of the IntraTMP fusion prediction mode corresponding to the current candidate matching block group.

[0363] In some embodiments, the fusion mode is an intra-template matching fusion mode based on template derivation, and determining the fusion weight values ​​of N fusion matching blocks includes determining the fusion weight values ​​of the N fusion matching blocks and the fusion weight values ​​of the offset parameter based on the templates of the N fusion matching blocks, the templates of the current block, and the offset parameter.

[0364] Determining the predicted block of the current block by fusing N fusion matching blocks based on the fusing weight values ​​of the N fusion matching blocks includes fusing N fusion matching blocks and offset parameters based on the fusing weight values ​​of the N fusion matching blocks and offset parameters, and determining the predicted block of the current block.

[0365] Exemplary, the IntraTMP fusion method based on template derivation uses a method similar to training filter coefficients, obtaining weight values ​​for fusion predictions by training based on the template of each matching block and the template of the current block. For example, a candidate matching block group or set of candidate matching blocks contains three matching blocks and is represented as {BV(3i), BV1(3i+1), BV2(3i+2)}, and the fusion form is as follows:

[0366] pred=w0×BV 3×i +w1×BV 3×i +w2×BV 3×i+2 +w3×Bias

[0367] The BV(3i), BV1(3i+1), and BV2(3i+2) matching block templates are taken as input, and the current block template is output as pred. Bias is a fixed value, for example, the midpoint of the pixel range, and a set of weight values ​​w0~w3 are derived. When fusing matching blocks, the same fusing method, the reconstructed values ​​of the BV(3i), BV1(3i+1), and BV2(3i+2) matching blocks, and the weight values ​​w0~w3 are used to obtain the predicted block of the current block. Alternatively, when fusing matching block templates, the same fusing method, the reconstructed values ​​of the BV(3i), BV1(3i+1), and BV2(3i+2) matching block templates, and the weight values ​​w0~w3 are used to obtain the predicted template.

[0368] In some embodiments, when the fusion mode is an intra-template matching fusion mode based on template error values, determining the fusion weight values ​​of N fusion matching blocks includes: determining the template error values ​​of N fusion matching blocks based on the templates of N fusion matching blocks and the template of the current block; determining the cumulative sum of the template error values ​​of N fusion matching blocks based on the template error values ​​of N fusion matching blocks; and determining the fusion weight values ​​of N fusion matching blocks based on the template error values ​​and the cumulative sum of the template error values ​​of N fusion matching blocks.

[0369] For example, here, n is the total number of matching blocks (i.e., N), and Wi is the weight value corresponding to the matching block whose template error value is SADi. The fusion format is as follows:

[0370]

number

[0371] Here, pred is a prediction block or prediction template, and Predi is a matching block or matching block template. Based on the fusion method described above, a fused template error value is obtained for each matching block group. The matching blocks of each group are re-sorted in ascending order of the template error values; that is, the smaller the template error value of a matching block group, the smaller the corresponding index value should be. Based on the determined index values, a selected candidate matching block group is obtained, and a weighted fusion prediction of the current block is performed using the selected candidate matching block group and its corresponding weight value to obtain the final prediction block.

[0372] By employing the above technical solutions, candidate matching block lists are constructed and grouped, the first candidate matching block group is indicated by its index value, and fusion prediction is performed using the first candidate matching block group. This improves prediction accuracy, saves bitrate, and simultaneously enhances encoding and decoding efficiency, further improving encoding and decoding performance. Furthermore, combining the IntraTMP fusion prediction mode and the IntraTMP multiple candidate prediction mode improves encoding efficiency. Additionally, limiting the index value range of candidate matching block groups reduces the number of codewords used to encode the index values, thereby improving encoding efficiency. For example, by resorting the candidate matching block groups, the index values ​​can be kept within a relatively small index range.

[0373] In another embodiment of this application, based on the same inventive concept as the above embodiment, with reference to Figure 17, an exemplary structural diagram of the encoder configuration according to the embodiment of this application is shown. As shown in Figure 17, the encoder 170 comprises a first determination unit 1701, a first grouping unit 1702, and a first prediction unit 1703. The first decision unit 1701 is configured to construct a list of first candidate matching blocks for the current block based on template matching. The first grouping unit 1702 is configured to group the first candidate matching block list, determine at least two candidate matching block groups, and determine the index value for each candidate matching block group. The first decision unit 1701 is further configured to determine the index value of the first candidate matching block group corresponding to the current block. The first decision unit 1701 is further configured to determine the first candidate matching block group from among at least two candidate matching block groups based on the index value of the first candidate matching block group. The first prediction unit 1703 is configured to merge at least one matching block in the first candidate matching block group and determine the predicted block of the current block.

[0374] In some embodiments, the encoder 170 further comprises an encoding unit configured to encode relevant syntactic elements of the current block, wherein the relevant syntactic elements include a first syntactic element and / or a second syntactic element, the first syntactic element used to indicate whether the prediction mode of the current block is a fused prediction mode based on intra-template matching prediction (IntraTMP), and the second syntactic element used to indicate the index value of the first candidate matching block group.

[0375] In some embodiments, a second syntactic element is further used to indicate the fusion mode of the current block's IntraTMP fusion prediction mode. The encoding scheme of the second syntactic element includes a fixed-length encoding scheme or a variable-length encoding scheme. In some embodiments, the encoding scheme of a single codeword in the second syntactic element includes an equiprobability single codeword encoding scheme, a context-model-based single codeword encoding scheme, or a multi-context-model-based single codeword encoding scheme.

[0376] It should be understood that each functional unit in the encoder further performs the encoding method of any one of the embodiments described above.

[0377] In the embodiments of this application, "unit" may be part of a circuit, part of a processor, part of a program or software, and of course, "unit" may be a module or a non-modular structure. Furthermore, each component in these embodiments may be integrated into a single processing unit, each unit may be a separate, independent physical unit, or two or more units may be integrated into a single unit. The integrated unit may be implemented in hardware form or in the form of a software function module.

[0378] If the integrated unit is implemented in the form of a software function module rather than being sold or used as an independent product, it can be stored on a single computer-readable storage medium. Based on this understanding, an essential part of the technical solution of this embodiment, i.e., a part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a computer software product, which is stored on a single storage medium and contains several instructions for causing a single computer device (which may be a personal computer, server, or network device, etc.) or processor to perform all or part of the steps of the method in each embodiment of this application. The aforementioned storage mediums include a variety of media capable of storing program code, such as U disks, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0379] Accordingly, the embodiments of this application provide a computer-readable storage medium applicable to an encoder 170, the computer-readable storage medium storing a computer program, the computer program causing a first processor to execute the encoding method in any of the embodiments described above.

[0380] Referring to Figure 18, based on the configuration of the encoder 170 and the computer-readable storage medium, a schematic diagram of the specific hardware structure of the encoder 170 according to an embodiment of the present application is shown. As shown in Figure 18, the encoder 170 may comprise a first communication interface 1801, a first memory 1802, and a first processor 1803, each component being coupled by a first bus system 1804. To make it clear, the first bus system 1804 is configured to enable connection communication between these components. In addition to the data bus, the first bus system 1804 further includes a power bus, a control bus, and a status signal bus. However, for clarity of explanation, in Figure 18, the various buses are labeled as the first bus system 1804.

[0381] The first communication interface 1801 is configured to send and receive signals in the process of sending and receiving information with other external network elements.

[0382] The first memory 1802 is configured to store computer programs that can be executed by the first processor 1703.

[0383] The first processor 1803 is configured to perform the following processing by executing a computer program, and the processing is as follows: Based on template matching, construct a list of the first candidate matching blocks for the current block, The first candidate matching block list is grouped to determine at least two candidate matching block groups, and the index value of each candidate matching block group is determined. The index value of the first candidate matching block group corresponding to the current block is determined, Based on the index value of the first candidate matching block group, the first candidate matching block group is determined from at least two candidate matching block groups, This includes merging at least one matching block in the first candidate matching block group to determine the predicted block of the current block.

[0384] It should be understood that the first memory 1802 in the embodiments of this application may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Here, non-volatile memory may 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. Volatile memory may be random access memory (RAM) used as an external cache. To the extent that this is not an exhaustive description, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linkage dynamic random access memory (SLDRAM), and direct memory bus random access memory (DRRAM). The first memory 1802 in the systems and methods described herein includes, but is not limited to, these and any other suitable types of memory.

[0385] The first processor 1803 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be performed by a hardware-type integrated logic circuit or a software-type instruction in the first processor 1803. The first processor 1803 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 gates, or transistor logic devices, discrete hardware components, etc., which can implement or execute each method, step and logic block diagram disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor, or the processor may be any conventional processor, etc. The steps of the method disclosed in the embodiments of this application may be performed directly by a hardware decoding processor, or by a combination of hardware and software modules within the decoding processor. The software module can be placed in a conventional storage medium such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, or registers. The storage medium is placed in the first memory 1802, and the first processor 1803 reads the information in the first memory 1802 and performs the steps of the method in combination with its hardware.

[0386] To be understood, these embodiments described in this application can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. Regarding hardware implementations, the processing unit can be one or more application-specific integrated circuits (ASICs), digital signal processing (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units configured to perform the functions described in this application, or a combination thereof. Regarding software implementations, the technology described in this application can be implemented by modules (processes, functions, etc.) that perform the functions described in this application. The software code can be stored in memory and executed by a processor. The memory may be implemented within or outside the processor.

[0387] Exemplary, in another embodiment, the first processor 1803 is further configured to execute the encoding method in one of the above embodiments by executing a computer program.

[0388] According to the encoder of this embodiment, by constructing and grouping a list of candidate matching blocks, indicating a first candidate matching block group by its index value, and performing fusion prediction using the first candidate matching block group, prediction accuracy can be improved, bitrate can be saved, and encoding / decoding efficiency can be improved, and encoding / decoding performance can be further enhanced. Furthermore, by limiting the range of index values ​​of the candidate matching block groups, the codewords used to encode the index values ​​can be saved, and encoding efficiency can be improved. For example, by resorting the candidate matching block groups, the index values ​​can be kept within a relatively small index range.

[0389] In another embodiment of this application, based on the same inventive concept as the above embodiment, with reference to Figure 19, an exemplary structural diagram of the decoder 190 according to the embodiment of this application is shown. As shown in Figure 19, the decoder 190 comprises a second determination unit 1901, a second grouping unit 1902, and a second prediction unit 1903. The second decision unit 1901 is configured to construct a list of first candidate matching blocks for the current block based on template matching. The second grouping unit 1902 is configured to group the first candidate matching block list, determine at least two candidate matching block groups, and determine the index value for each candidate matching block group. The second decision unit 1901 is further configured to determine the index value of the first candidate matching block group corresponding to the current block. The second decision unit is further configured to determine the first candidate matching block group from among at least two candidate matching block groups based on the index value of the first candidate matching block group. The second prediction unit 1903 is configured to merge at least one matching block in the first candidate matching block group and determine the predicted block for the current block.

[0390] In some embodiments, the decoder 190 further comprises a decoding unit configured to decode relevant syntactic elements of the current block, wherein the relevant syntactic elements include a first syntactic element and / or a second syntactic element, the first syntactic element used to indicate whether the prediction mode of the current block is a fused prediction mode based on intra-template matching prediction (IntraTMP), and the second syntactic element used to indicate the index value of the first candidate matching block group.

[0391] In some embodiments, a second syntactic element is further used to indicate the fusion mode of the current block's IntraTMP fusion prediction mode. The encoding scheme of the second syntactic element includes a fixed-length encoding scheme or a variable-length encoding scheme. In some embodiments, the encoding scheme of a single codeword in the second syntactic element includes an equiprobability single codeword encoding scheme, a context-model-based single codeword encoding scheme, or a multi-context-model-based single codeword encoding scheme.

[0392] It should be understood that each functional unit in the decoder further performs the decoding method of any one of the embodiments described above.

[0393] In this embodiment, the "unit" may be part of a circuit, part of a processor, part of a program or software, and of course, the "unit" may be a module or a non-modular structure. Furthermore, each component in this embodiment may be integrated into a single processing unit, each unit may be a separate, independent physical unit, or two or more units may be integrated into a single unit. The above integrated unit may be implemented in hardware form or in the form of a software function module.

[0394] If the integrated units are implemented in the form of software function modules rather than being sold or used as independent products, they can be stored in a single computer-readable storage medium. Based on this understanding, this embodiment provides a computer-readable storage medium to which decoder 190 is applied, wherein a computer program is stored, and the computer program causes a second processor to execute the decoding method in any of the above embodiments.

[0395] Referring to Figure 20, based on the configuration of the decoder 190 and the computer-readable storage medium, a schematic diagram of the specific hardware structure of the decoder 190 according to the embodiment of this application is shown. As shown in Figure 20, the decoder 190 may comprise a second communication interface 2001, a second memory 2002, and a second processor 2003, each component being coupled by a second bus system 2004. To make it clear, the second bus system 2004 is configured to enable connection communication between these components. In addition to the data bus, the second bus system 2004 further includes a power bus, a control bus, and a status signal bus. However, for clarity of explanation, in Figure 20, the various buses are labeled as the second bus system 2004.

[0396] The second communication interface 2001 is configured to send and receive signals in the process of sending and receiving information with other external network elements.

[0397] The second memory 2002 is configured to store computer programs that can be executed by the first processor 2003.

[0398] The second processor 2003 is configured to execute the following processes by running a computer program, and these processes are: Based on template matching, construct a list of the first candidate matching blocks for the current block, The first candidate matching block list is grouped to determine at least two candidate matching block groups, and the index value of each candidate matching block group is determined. The index value of the first candidate matching block group corresponding to the current block is determined, Based on the index value of the first candidate matching block group, the first candidate matching block group is determined from at least two candidate matching block groups, This includes merging at least one matching block in the first candidate matching block group to determine the predicted block of the current block.

[0399] Exemplary, in another embodiment, the second processor 2003 is further configured to execute the decoding method in one of the above embodiments by executing a computer program.

[0400] It is understood that the hardware functions of the second memory 2002 and the first memory 1802 are similar, and the hardware functions of the second processor 2003 and the first processor 1803 are similar, and therefore will not be repeated in detail here.

[0401] This embodiment provides a decoder, which constructs and groups a list of candidate matching blocks, identifies a first candidate matching block group by its index value, and performs fusion prediction using the first candidate matching block group. This improves prediction accuracy, saves bitrate, improves encoding and decoding efficiency, and further enhances encoding and decoding performance. Furthermore, by limiting the range of index values ​​of the candidate matching block groups, the number of codewords used to encode the index values ​​is reduced, improving encoding efficiency. For example, by resorting the candidate matching block groups, the index values ​​are kept within a relatively small index range.

[0402] In another embodiment of this application, with reference to Figure 21, an exemplary structural diagram of the configuration of an encoding / decoding system according to an embodiment of this application is shown. As shown in Figure 21, the encoding / decoding system 210 may comprise an encoder 2101 and a decoder 2102.

[0403] In the embodiments of this application, the encoder 2101 may be an encoder described in any one of the embodiments described above, and the decoder 2102 may be a decoder described in any one of the embodiments described above.

[0404] In the embodiments of this application, the terms “equipment,” “includes,” or any other variation thereof are intended to be non-exclusive, meaning that a process, method, article, or apparatus comprising a set of elements includes not only those elements but also other elements not expressly enumerated, as well as elements inherent to that process, method, article, or apparatus. Unless otherwise specified, an element limited by the expression “includes…” does not preclude the presence of other similar elements in a process, method, part, or apparatus comprising that element.

[0405] The numbering of the embodiments in this application above does not indicate any ranking of the embodiments, but is provided for the convenience of explanation.

[0406] The methods disclosed in some embodiments of the methods provided in this application can be arbitrarily combined without conflict to obtain new embodiments of the methods.

[0407] The features disclosed in some product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0408] The features disclosed in some of the embodiments of methods or apparatus provided in this application can be arbitrarily combined without conflict to obtain new embodiments of methods or apparatus.

[0409] The above describes only specific embodiments of this application, and the scope of protection of this application is not limited thereto. All modifications or substitutions that a person skilled in the art could easily conceive of within the technical scope disclosed in this application should be included within the scope of protection of this application. Accordingly, the scope of protection of this application shall be subject to the scope of protection of the claims. [Industrial applicability]

[0410] Embodiments of this application provide an encoding method, a decoding method, a bitstream, an encoder, a decoder, and a storage medium. Based on template matching, a first candidate matching block list for the current block is constructed, the first candidate matching block list is grouped, at least two candidate matching block groups are determined, and an index value is determined for each candidate matching block group. On the encoding side, the index value of the first candidate matching block group corresponding to the current block is determined, and the index value of the first candidate matching block group is written to the bitstream. On the decoding side, the first candidate matching block group is determined based on the index value, fusion is performed based on the first candidate matching block group, and the predicted block for the current block is determined. By constructing a candidate matching block list, grouping the candidate matching block list, transmitting the index value to indicate the first candidate matching block group, and performing fusion prediction using the first candidate matching block group, prediction accuracy can be improved, bitrate can be saved, encoding and decoding efficiency can be improved, and encoding and decoding performance can be further improved.

Claims

1. A decoding method performed by the decoder, Based on template matching, construct a list of the first candidate matching blocks for the current block, The above-mentioned first candidate matching block list is grouped to determine at least two candidate matching block groups, and the index value of each candidate matching block group is determined. The index value of the first candidate matching block group corresponding to the current block is determined, Based on the index value of the first candidate matching block group, the first candidate matching block group is determined from among the at least two candidate matching block groups, A decoding method comprising: fusing at least one matching block in the first candidate matching block group to determine the predicted block of the current block.

2. The aforementioned decoding method is This now further includes decoding the relevant syntactic elements of the block, The aforementioned related syntactic element includes a first syntactic element and / or a second syntactic element, The first syntactic element is used to indicate whether the prediction mode of the current block is a fused prediction mode based on intra-template matching prediction (IntraTMP), and the second syntactic element is used to indicate the index value of the first candidate matching block group. The decoding method according to claim 1.

3. Decoding the relevant syntactic elements of the aforementioned current block is: Decoding the first syntactic element, Decoding the second syntactic element, If the value of the first syntactic element is a first numerical value, the prediction mode of the current block is determined to be the IntraTMP fusion prediction mode, and the index value of the first candidate matching block group corresponding to the current block is determined based on the second syntactic element, The decoding method according to claim 2.

4. The second syntactic element is further used to indicate the index value of the best matching block corresponding to the current block, and the decoding method is If the value of the first syntactic element is a second numerical value, the prediction mode of the current block is determined to be an IntraTMP multiple candidate prediction mode based on a single matching block, and the index value of the optimal matching block corresponding to the current block is determined based on the second syntactic element, further comprising: The decoding method according to claim 3.

5. Decoding the relevant syntactic elements of the aforementioned current block is: Decoding the first syntactic element, If the value of the first syntactic element is a first numerical value, it is determined that the prediction mode of the current block is the IntraTMP fusion prediction mode, and the second syntactic element is decoded. This includes determining the index value of the first candidate matching block group corresponding to the current block based on the second syntactic element, The decoding method according to claim 2.

6. The aforementioned related syntactic element further includes a third syntactic element, which is used to indicate the index value of the best matching block corresponding to the current block, and decoding the related syntactic element of the current block is If the value of the first syntactic element is the second numerical value, it is determined that the prediction mode of the current block is the IntraTMP multiple candidate prediction mode based on a single matching block, and the third syntactic element of the current block is decoded. The process further includes determining the index value of the best matching block corresponding to the current block based on the third syntactic element described above, The decoding method according to claim 5.

7. If the prediction mode of the current block is determined to be an IntraTMP multiple candidate prediction mode based on a single matching block, the decoding method is Based on the index value of the aforementioned optimal matching block, the optimal matching block is determined from the second candidate matching block list, The process further includes determining the predicted block for the current block based on the aforementioned optimal matching block, The decoding method according to claim 4 or 6.

8. The aforementioned decoding method is The process further includes constructing the aforementioned second candidate matching blocklist for the current block based on template matching, wherein the length of the aforementioned second candidate matching blocklist is not equal to the length of the aforementioned first candidate matching blocklist. The decoding method according to claim 7.

9. The second syntactic element is further used to indicate the fusion mode of the IntraTMP fusion prediction mode of the current block, The decoding method according to any one of claims 2 to 8.

10. The decoding scheme for the second syntactic element includes a fixed-length decoding scheme corresponding to fixed-length coding, or a variable-length decoding scheme corresponding to variable-length coding. The decoding method according to claim 2.

11. The decoding scheme for a single codeword in the second syntactic element includes an equiprobability single codeword decoding scheme, a context-based single codeword decoding scheme, or a multi-context-based single codeword decoding scheme. The decoding method according to claim 10.

12. The aforementioned related syntactic element further includes a fourth syntactic element, and the decoding method is The process further includes decoding the fourth syntactic element, which is used to indicate the fusion mode of the IntraTMP fusion prediction mode of the current block, or to indicate whether or not to perform filtering on the selected matching block. The decoding method according to any one of claims 2 to 11.

13. The aforementioned decoding method is The prediction mode of the current block is determined to be the IntraTMP fusion prediction mode, and the fusion mode of the IntraTMP fusion prediction mode of the current block is determined based on the fourth syntactic element, The current block prediction mode is determined to be an IntraTMP multiple candidate prediction mode based on a single matching block, and the process further includes determining whether or not to perform filtering on the selected matching block based on the fourth syntactic element, The decoding method according to claim 12.

14. The aforementioned decoding method is The current block's prediction mode is determined to be the IntraTMP fusion prediction mode, and the fourth syntactic element is decoded, wherein the fourth syntactic element is used to indicate the fusion mode of the current block's IntraTMP fusion prediction mode. The method further includes determining the fusion mode of the current block's IntraTMP fusion prediction mode based on the aforementioned fourth syntactic element, or The current block prediction mode is determined to be the IntraTMP multiple candidate prediction mode based on a single matching block, and the fourth syntactic element is decoded. The process further includes determining whether or not to perform filtering on the selected matching block based on the fourth syntactic element described above. The decoding method according to claim 12.

15. If the fusion mode includes a first fusion mode and a second fusion mode, the decoding method is: When the fourth syntactic element is used to indicate that the fusion mode of the IntraTMP fusion prediction mode of the current block is the first fusion mode, the index value of the first candidate matching block group corresponding to the current block is determined based on the second syntactic element, If the fourth syntactic element is used to indicate that the fusion mode of the IntraTMP fusion prediction mode of the current block is the second fusion mode, the index value of the first candidate matching block group corresponding to the current block is determined based on the second syntactic element and the index offset value. The decoding method according to any one of claims 12 to 14.

16. The index range of the index value of the first candidate matching block group is less than or equal to the index range corresponding to the at least two candidate matching block groups. The decoding method according to any one of claims 2 to 14.

17. The aforementioned decoding method is The process further includes decoding a sixth syntactic element, the sixth syntactic element being used to indicate whether to decode some or all syntactic elements in the associated syntactic element of the current block. The decoding method according to any one of claims 2 to 14.

18. The sixth syntactic element includes at least one of sequence-level syntactic elements, picture-level syntactic elements, slice-level syntactic elements, stripe-level syntactic elements, and block-level syntactic elements. The decoding method according to claim 17.

19. Grouping the aforementioned first candidate matching block list is This includes grouping the first candidate matching blocklist based on at least one grouping rule. The decoding method according to claim 1.

20. The aforementioned at least one grouping rule includes a first grouping rule, The first grouping rule includes setting matching blocks in the first candidate matching block list in units of a first predetermined quantity as one candidate matching block group, wherein the first predetermined quantity is an integer greater than 0. The decoding method according to claim 19.

21. The aforementioned at least one grouping rule includes a second grouping rule, The second grouping rule includes setting matching blocks in the first candidate matching block list, at intervals of a second predetermined quantity, as one candidate matching block group, wherein the second predetermined quantity is an integer greater than 0, and the first predetermined quantity and the second predetermined quantity are not equal. The decoding method according to claim 20.

22. The first grouping rule further includes, if the number of matching blocks in the last candidate matching block group is less than the first predetermined number, taking a predetermined number of matching blocks from the first candidate matching block list and adding it to the last candidate matching block group, and making the number of matching blocks in the last candidate matching block group equal to the first predetermined number. The second grouping rule further includes, if the number of matching blocks in the last candidate matching block group is less than the second predetermined number, taking a predetermined number of matching blocks from the first candidate matching block list and adding it to the last candidate matching block group, thereby making the number of matching blocks in the last candidate matching block group equal to the second predetermined number. The decoding method according to claim 21.

23. The aforementioned at least one grouping rule includes a third grouping rule, The third grouping rule includes configuring the first M1 matching blocks in the first candidate matching block list and every M2 matching blocks starting from the M1+1th matching block as one candidate matching block group. The decoding method according to any one of claims 19 to 22.

24. The third grouping rule further includes the condition that the values ​​of M2 are equal in different matching block groups, or that the values ​​of M2 are not exactly equal in different matching block groups. The decoding method according to claim 23.

25. The aforementioned at least one grouping rule includes a fourth grouping rule, The fourth grouping rule includes configuring the first i matching blocks in the first candidate matching block list as the i-th candidate matching block group, where i is an integer greater than 0. The decoding method according to any one of claims 19 to 24.

26. The grouping rule further includes that the distance between any two matching blocks within the candidate matching block group is greater than a first distance threshold. Alternatively, the grouping rule further includes the condition that the distance between any two matching blocks within the candidate matching block group is less than a second distance threshold. The decoding method according to any one of claims 19 to 25.

27. Each of the aforementioned grouping rules further includes the corresponding group quantity, The decoding method according to claim 19.

28. Grouping the aforementioned first candidate matching block list is The first candidate matching block list is grouped based on at least one grouping rule to obtain at least one candidate matching block group, This includes setting a fusion mode for at least one corresponding IntraTMP fusion prediction mode for each candidate matching block group, thereby obtaining at least two candidate matching block groups. The decoding method according to any one of claims 19 to 27.

29. The aforementioned fusion mode includes an intra-template matching fusion mode based on template derivation and an intra-template matching fusion mode based on template error values. The decoding method according to claim 28.

30. The aforementioned decoding method is The process further includes decoding syntactic elements for representing the at least one grouping rule and determining the at least one grouping rule. The decoding method according to any one of claims 19 to 29.

31. Determining the index value of each candidate matching block group is: Based on the grouping position of each candidate matching block group, the first index value of each candidate matching block group is determined, This includes setting the first index value of each candidate matching block group as the index value of each candidate matching block group, The decoding method according to claim 1.

32. Determining the index value of each candidate matching block group is: Re-sorting at least two candidate matching block groups, Based on the re-sorted position of each candidate matching block group, the second index value of each candidate matching block group is determined, This includes setting the second index value of each candidate matching block group as the index value of each candidate matching block group, The decoding method according to claim 1.

33. Resorting the at least two candidate matching block groups is: From each candidate matching block group, determine the N (where N is an integer greater than 0) fusion matching blocks to be merged, Determining the fusion weight values ​​of the N fusion matching blocks, Based on the fusion weight values ​​of the N fusion matching blocks, the templates of the N fusion matching blocks are fused to determine the prediction template corresponding to each candidate matching block group. Based on the prediction template corresponding to each candidate matching block group and the template of the current block, the template error value corresponding to each candidate matching block group is determined. This includes resorting based on the template error value corresponding to each candidate matching block group, The decoding method according to claim 32.

34. When setting the fusion mode of the corresponding IntraTMP fusion prediction mode for each candidate matching block group, the decoding method is as follows: The process further includes determining the fusion mode of the IntraTMP fusion prediction mode for the current block based on the fusion mode of the IntraTMP fusion prediction mode corresponding to the first candidate matching block group, The decoding method according to claim 31 or 32.

35. Merging at least one matching block in the first candidate matching block group and determining the predicted block of the current block is: From the aforementioned first candidate matching block group, determine N (where N is an integer greater than 0) fusion matching blocks to be fused, Determining the fusion weight values ​​of the N fusion matching blocks, The process includes fusing the N fusion matching blocks based on their fusion weight values ​​and determining the predicted block for the current block. The decoding method according to claim 1.

36. Determining the N fusion matching blocks that perform the aforementioned fusion is, Determine the template error value for each matching block in the current candidate matching block group, The template error threshold is determined based on the template error value and threshold coefficient of the i-th matching block in the current candidate matching block group, wherein the i-th matching block is the matching block with the minimum template error value in the current candidate matching block group. This includes determining matching blocks whose template error value is less than or equal to the template error threshold as fused matching blocks, The decoding method according to claim 33 or 35.

37. The aforementioned decoding method is This further includes determining the threshold coefficient corresponding to the current candidate matching block group, where the threshold coefficients corresponding to different candidate matching block groups are not necessarily equal. The decoding method according to claim 36.

38. Determining a matching block whose template error value is less than or equal to the template error threshold as a fused matching block means that If the template error value of the i+j-th matching block is greater than the number of matching blocks of the template error threshold, the i-th matching block in the current candidate matching block group is set to the i+j-th fused matching block. The decoding method according to claim 36.

39. Determining the N fusion matching blocks that perform the aforementioned fusion is, The current candidate matching block group is divided into at least two candidate matching block sets, each candidate matching block set containing N fused matching blocks, wherein the number of fused matching blocks and the number of fused matching blocks in different candidate matching block sets are not exactly the same. Determine the fusion weight values ​​of N fusion matching blocks in each candidate matching block set, Based on the fusion weight values ​​of the N fused matching blocks in each candidate matching block set, the templates of the N fused matching blocks are fused to determine the prediction template corresponding to each candidate matching block set. Based on the prediction template corresponding to each candidate matching block set and the template of the current block, the template error value corresponding to each candidate matching block set is determined. Based on the template error value corresponding to each candidate matching block set, the optimal candidate matching block set with the minimum template error value is determined. This includes making the matching blocks in the set of optimal candidate matching blocks the N fused matching blocks, The decoding method according to claim 33 or 35.

40. Determining the N fusion matching blocks that perform the aforementioned fusion is, This includes making the first N matching blocks in the current candidate matching block group into the N fused matching blocks, where N is less than or equal to the number of matching blocks in the current candidate matching block group. The decoding method according to claim 33 or 35.

41. The aforementioned decoding method is The process further includes decoding the bitstream and determining the value N of the fusion matching block quantity. The decoding method according to claim 40.

42. Determining the fusion weight values ​​of the N fusion matching blocks is: The process includes determining the fusion weight values ​​of the N fusion matching blocks based on the fusion mode of the IntraTMP fusion prediction mode corresponding to the current candidate matching block group. The aforementioned fusion mode is an intra-template matching fusion mode based on template derivation, or an intra-template matching fusion mode based on template error values. The decoding method according to any one of claims 33, 35, or 39.

43. The aforementioned fusion mode is an intra-template matching fusion mode based on template derivation, and determining the fusion weight values ​​of the N fusion matching blocks is: The process includes determining the fusion weight values ​​of the N fusion matching blocks and the fusion weight values ​​of the offset parameters based on the templates of the N fusion matching blocks, the template of the current block, and the offset parameters. Based on the fusion weight values ​​of the N fusion matching blocks, fusion of the N fusion matching blocks and determination of the predicted block for the current block is performed. The process includes fusing the N fusion matching blocks and the offset parameter based on the fusion weight values ​​of the N fusion matching blocks and the fusion weight values ​​of the offset parameter, and determining the predicted block of the current block. The decoding method according to claim 42.

44. The aforementioned fusion mode is an intra-template matching fusion mode based on template error values, and determining the fusion weight values ​​of the N fusion matching blocks is: Based on the templates of the N fusion matching blocks and the template of the current block, the template error value of the N fusion matching blocks is determined. Based on the template error values ​​of the N fusion matching blocks, the cumulative sum of the template error values ​​of the N fusion matching blocks is determined. This includes determining the fusion weight values ​​of the N fusion matching blocks based on the template error values ​​of the N fusion matching blocks and the cumulative sum of the template error values, The decoding method according to claim 42.

45. The aforementioned decoding method is The process further includes saving the index value of the first candidate matching block group corresponding to the current block, or saving a predetermined matching block in the first candidate matching block group corresponding to the current block. The decoding method according to claim 1.

46. The encoding method performed by the encoder, Based on template matching, construct a list of the first candidate matching blocks for the current block, The above-mentioned first candidate matching block list is grouped to determine at least two candidate matching block groups, and the index value of each candidate matching block group is determined. The index value of the first candidate matching block group corresponding to the current block is determined, Based on the index value of the first candidate matching block group, the first candidate matching block group is determined from among the at least two candidate matching block groups, An encoding method comprising: merging at least one matching block in the first candidate matching block group to determine the predicted block of the current block.

47. The aforementioned encoding method is This now further includes encoding the relevant syntactic elements of the block, The aforementioned related syntactic element includes a first syntactic element and / or a second syntactic element, The first syntactic element is used to indicate whether the prediction mode of the current block is a fused prediction mode based on intra-template matching prediction (IntraTMP), and the second syntactic element is used to indicate the index value of the first candidate matching block group. The encoding method according to claim 46.

48. Encoding the relevant syntactic elements of the current block is: Encoding the first syntactic element, Encoding the second syntactic element, If the value of the first syntactic element is a first numerical value, the prediction mode of the current block is determined to be the IntraTMP fusion prediction mode, and the index value of the first candidate matching block group corresponding to the current block is determined based on the second syntactic element, The encoding method according to claim 46.

49. The second syntactic element is further used to indicate the index value of the best matching block corresponding to the current block, and the encoding method is If the value of the first syntactic element is a second numerical value, the prediction mode of the current block is determined to be an IntraTMP multiple candidate prediction mode based on a single matching block, and further includes encoding the second syntactic element. The encoding method according to claim 48.

50. Encoding the relevant syntactic elements of the current block is: Encoding the first syntactic element, If the value of the first syntactic element is a first numerical value, the prediction mode of the current block is determined to be the IntraTMP fusion prediction mode, and the second syntactic element is encoded, The encoding method according to claim 46.

51. The aforementioned related syntactic element further includes a third syntactic element, which is used to indicate the index value of the best matching block corresponding to the current block, and encoding the related syntactic element of the current block is If the value of the first syntactic element is a second numerical value, the prediction mode of the current block is determined to be an IntraTMP multiple candidate prediction mode based on a single matching block, and the third syntactic element of the current block is encoded. The encoding method according to claim 50.

52. If the prediction mode of the current block is determined to be an IntraTMP multiple candidate prediction mode based on a single matching block, the encoding method is Based on the index value of the aforementioned optimal matching block, the optimal matching block is determined from the second candidate matching block list, The process further includes determining the predicted block for the current block based on the aforementioned optimal matching block, The encoding method according to claim 49 or 51.

53. The aforementioned encoding method is The process further includes constructing the aforementioned second candidate matching blocklist for the current block based on template matching, wherein the length of the aforementioned second candidate matching blocklist is not equal to the length of the aforementioned first candidate matching blocklist. The encoding method according to claim 52.

54. The second syntactic element is further used to indicate the fusion mode of the IntraTMP fusion prediction mode of the current block, The encoding method according to any one of claims 47 to 53.

55. The encoding scheme for the second syntactic element includes a fixed-length encoding scheme or a variable-length encoding scheme. The encoding method according to claim 47.

56. The encoding scheme for a single codeword in the second syntactic element includes an equiprobability single codeword encoding scheme, a context-model-based single codeword encoding scheme, or a multiple context-model-based single codeword encoding scheme. The encoding method according to claim 55.

57. The aforementioned encoding method is Determining the predicted block of the current block corresponding to at least two candidate matching block groups, The encoding decision is made based on the predicted block and original block corresponding to each candidate matching block group, and the optimal candidate matching block group is determined. If the index value of the first candidate matching block group is not the index value of the optimal candidate matching block group, the index value of the optimal candidate matching block group shall be set to the index value of the first candidate matching block group. The further includes determining the second syntactic element based on the index value of the first candidate matching block group, The encoding method according to any one of claims 47 to 56.

58. The aforementioned related syntactic element further includes a fourth syntactic element, and the encoding method is The further includes encoding the fourth syntactic element, which is used to indicate the fusion mode of the IntraTMP fusion prediction mode of the current block, or to indicate whether or not to perform filtering on the selected matching block. The encoding method according to any one of claims 47 to 57.

59. The aforementioned encoding method is The prediction mode of the current block is determined to be the IntraTMP fusion prediction mode, and the fusion mode of the IntraTMP fusion prediction mode of the current block is determined based on the fourth syntactic element, The current block prediction mode is determined to be an IntraTMP multiple candidate prediction mode based on a single matching block, and the process further includes determining whether or not to perform filtering on the selected matching block based on the fourth syntactic element, The encoding method according to claim 58.

60. The aforementioned encoding method is The current block's prediction mode is determined to be the IntraTMP fusion prediction mode, and the fourth syntactic element is encoded, wherein the fourth syntactic element is used to indicate the fusion mode of the current block's IntraTMP fusion prediction mode. or The prediction mode of the current block is determined to be an IntraTMP multiple candidate prediction mode based on a single matching block, and the fourth syntactic element is encoded, wherein the fourth syntactic element is used to indicate whether or not to perform filtering on the selected matching block, further comprising: The encoding method according to claim 58.

61. If the fusion mode includes a first fusion mode and a second fusion mode, the encoding method is: When the fourth syntactic element is used to indicate that the fusion mode of the current block's IntraTMP fusion prediction mode is the first fusion mode, the second syntactic element is determined based on the index value of the first candidate matching block group, If the fourth syntactic element is used to indicate that the fusion mode of the current block's IntraTMP fusion prediction mode is the second fusion mode, the second syntactic element is determined based on the index value and index offset value of the first candidate matching block group, further comprising: The encoding method according to any one of claims 58 to 60.

62. The index range of the index value of the first candidate matching block group is less than or equal to the index range corresponding to the at least two candidate matching block groups. The encoding method according to any one of claims 47 to 60.

63. The aforementioned encoding method is The method further includes encoding a sixth syntactic element, the sixth syntactic element being used to indicate whether it encodes some or all of the syntactic elements in the associated syntactic element of the current block. The encoding method according to any one of claims 47 to 60.

64. The sixth syntactic element includes at least one of sequence-level syntactic elements, picture-level syntactic elements, slice-level syntactic elements, stripe-level syntactic elements, and block-level syntactic elements. The encoding method according to claim 63.

65. Grouping the aforementioned first candidate matching block list is This includes grouping the first candidate matching blocklist based on at least one grouping rule. The encoding method according to claim 46.

66. The aforementioned at least one grouping rule includes a first grouping rule, The first grouping rule includes setting matching blocks in the first candidate matching block list in units of a first predetermined quantity as one candidate matching block group, wherein the first predetermined quantity is an integer greater than 0. The encoding method according to claim 65.

67. The aforementioned at least one grouping rule includes a second grouping rule, The second grouping rule includes setting matching blocks in the first candidate matching block list, at intervals of a second predetermined quantity, as one candidate matching block group, wherein the second predetermined quantity is an integer greater than 0, and the first predetermined quantity and the second predetermined quantity are not equal. The encoding method according to claim 66.

68. The first grouping rule further includes, if the number of matching blocks in the last candidate matching block group is less than the first predetermined number, taking a predetermined number of matching blocks from the first candidate matching block list and adding it to the last candidate matching block group, and making the number of matching blocks in the last candidate matching block group equal to the first predetermined number. The second grouping rule further includes, if the number of matching blocks in the last candidate matching block group is less than the second predetermined number, taking a predetermined number of matching blocks from the first candidate matching block list and adding it to the last candidate matching block group, thereby making the number of matching blocks in the last candidate matching block group equal to the second predetermined number. The encoding method according to claim 67.

69. The aforementioned at least one grouping rule includes a third grouping rule, The third grouping rule includes configuring the first M1 matching blocks in the first candidate matching block list and every M2 matching blocks starting from the M1+1th matching block as one candidate matching block group. The encoding method according to any one of claims 65 to 68.

70. The third grouping rule further includes the condition that the values ​​of M2 are equal in different matching block groups, or that the values ​​of M2 are not exactly equal in different matching block groups. The encoding method according to claim 69.

71. The aforementioned at least one grouping rule includes a fourth grouping rule, The fourth grouping rule includes configuring the first i matching blocks in the first candidate matching block list as the i-th candidate matching block group, where i is an integer greater than 0. The encoding method according to any one of claims 65 to 70.

72. The grouping rule further includes that the distance between any two matching blocks within the candidate matching block group is greater than a first distance threshold. Alternatively, the grouping rule further includes the condition that the distance between any two matching blocks within the candidate matching block group is less than a second distance threshold. The encoding method according to any one of claims 65 to 71.

73. Each of the aforementioned grouping rules further includes the corresponding group quantity, The encoding method according to claim 65.

74. Grouping the aforementioned first candidate matching block list is The first candidate matching block list is grouped based on at least one grouping rule to obtain at least one candidate matching block group, This includes setting a fusion mode for at least one corresponding IntraTMP fusion prediction mode for each candidate matching block group, thereby obtaining at least two candidate matching block groups. The encoding method according to any one of claims 65 to 73.

75. The aforementioned fusion mode includes an intra-template matching fusion mode based on template derivation and an intra-template matching fusion mode based on template error values. The encoding method according to claim 74.

76. The aforementioned encoding method is Further comprising encoding syntactic elements for representing the at least one grouping rule, The encoding method according to any one of claims 65 to 75.

77. Determining the index value of each candidate matching block group is: Based on the grouping position of each candidate matching block group, the first index value of each candidate matching block group is determined, This includes setting the first index value of each candidate matching block group as the index value of each candidate matching block group, The encoding method according to claim 46.

78. Determining the index value of each candidate matching block group is: Re-sorting at least two candidate matching block groups, Based on the re-sorted position of each candidate matching block group, the second index value of each candidate matching block group is determined, This includes setting the second index value of each candidate matching block group as the index value of each candidate matching block group, The encoding method according to claim 46.

79. Resorting the at least two candidate matching block groups is: From each candidate matching block group, determine the N (where N is an integer greater than 0) fusion matching blocks to be merged, Determining the fusion weight values ​​of the N fusion matching blocks, Based on the fusion weight values ​​of the N fusion matching blocks, the templates of the N fusion matching blocks are fused to determine the prediction template corresponding to each candidate matching block group. Based on the prediction template corresponding to each candidate matching block group and the template of the current block, the template error value corresponding to each candidate matching block group is determined. This includes resorting based on the template error value corresponding to each candidate matching block group, The encoding method according to claim 78.

80. When setting the fusion mode of the corresponding IntraTMP fusion prediction mode for each candidate matching block group, the encoding method is: The process further includes determining the fusion mode of the IntraTMP fusion prediction mode for the current block based on the fusion mode of the IntraTMP fusion prediction mode corresponding to the first candidate matching block group, The encoding method according to claim 77 or 78.

81. Merging at least one matching block in the first candidate matching block group and determining the predicted block of the current block is: From the aforementioned first candidate matching block group, determine N (where N is an integer greater than 0) fusion matching blocks to be fused, Determining the fusion weight values ​​of the N fusion matching blocks, The process includes fusing the N fusion matching blocks based on their fusion weight values ​​and determining the predicted block for the current block. The encoding method according to claim 46.

82. Determining the N fusion matching blocks that perform the aforementioned fusion is, Determine the template error value for each matching block in the current candidate matching block group, The template error threshold is determined based on the template error value and threshold coefficient of the i-th matching block in the current candidate matching block group, wherein the i-th matching block is the matching block with the minimum template error value in the current candidate matching block group. This includes determining matching blocks whose template error value is less than or equal to the template error threshold as fused matching blocks, The encoding method according to claim 79 or 81.

83. The aforementioned encoding method is This further includes determining the threshold coefficient corresponding to the current candidate matching block group, where the threshold coefficients corresponding to different candidate matching block groups are not necessarily equal. The encoding method according to claim 82.

84. Determining a matching block whose template error value is less than or equal to the template error threshold as a fused matching block means that If the template error value of the i+j-th matching block is greater than the number of matching blocks of the template error threshold, the i-th matching block in the current candidate matching block group is set to the i+j-th fused matching block. The encoding method according to claim 82.

85. Determining the N fusion matching blocks that perform the aforementioned fusion is, The current candidate matching block group is divided into at least two candidate matching block sets, each candidate matching block set containing N fused matching blocks, wherein the number of fused matching blocks and the number of fused matching blocks in different candidate matching block sets are not exactly the same. Determine the fusion weight values ​​of N fusion matching blocks in each candidate matching block set, Based on the fusion weight values ​​of the N fused matching blocks in each candidate matching block set, the templates of the N fused matching blocks are fused to determine the prediction template corresponding to each candidate matching block set. Based on the prediction template corresponding to each candidate matching block set and the template of the current block, the template error value corresponding to each candidate matching block set is determined. Based on the template error value corresponding to each candidate matching block set, the optimal candidate matching block set with the minimum template error value is determined. This includes making the matching blocks in the set of optimal candidate matching blocks the N fused matching blocks, The encoding method according to claim 79 or 81.

86. Determining the N fusion matching blocks that perform the aforementioned fusion is, This includes making the first N matching blocks in the current candidate matching block group into the N fused matching blocks, where N is less than or equal to the number of matching blocks in the current candidate matching block group. The encoding method according to claim 79 or 81.

87. The aforementioned encoding method is Further includes encoding the value N of the fusion matching block quantity, The encoding method according to claim 86.

88. Determining the fusion weight values ​​of the N fusion matching blocks is: This includes determining the fusion weight values ​​of the N fusion matching blocks based on the fusion mode of the IntraTMP fusion prediction mode, The aforementioned fusion mode is an intra-template matching fusion mode based on template derivation, or an intra-template matching fusion mode based on template error values. The encoding method according to any one of claims 79, 81, or 85.

89. The aforementioned fusion mode is an intra-template matching fusion mode based on template derivation, and determining the fusion weight values ​​of the N fusion matching blocks is: The process includes determining the fusion weight values ​​of the N fusion matching blocks and the fusion weight values ​​of the offset parameters based on the templates of the N fusion matching blocks, the template of the current block, and the offset parameters. Based on the fusion weight values ​​of the N fusion matching blocks, fusion of the N fusion matching blocks and determination of the predicted block for the current block is performed. The process includes fusing the N fusion matching blocks and the offset parameter based on the fusion weight values ​​of the N fusion matching blocks and the fusion weight values ​​of the offset parameter, and determining the predicted block of the current block. The encoding method according to claim 88.

90. The aforementioned fusion mode is an intra-template matching fusion mode based on template error values, and determining the fusion weight values ​​of the N fusion matching blocks is: Based on the templates of the N fusion matching blocks and the template of the current block, the template error value of the N fusion matching blocks is determined. Based on the template error values ​​of the N fusion matching blocks, the cumulative sum of the template error values ​​of the N fusion matching blocks is determined. This includes determining the fusion weight values ​​of the N fusion matching blocks based on the template error values ​​of the N fusion matching blocks and the cumulative sum of the template error values, The encoding method according to claim 88.

91. The aforementioned encoding method is The process further includes saving the index value of the first candidate matching block group corresponding to the current block, or saving a predetermined matching block in the first candidate matching block group corresponding to the current block. The encoding method according to claim 46.

92. A bitstream generated by performing bit encoding based on the information to be encoded, The encoded information is a bitstream including at least one of the following: a syntactic element for indicating the prediction mode of the current block; a syntactic element for indicating the index value of the best matching block corresponding to the current block; a syntactic element for indicating the index value of the best matching block corresponding to the current block; a syntactic element for indicating the fusion mode of the current block; a syntactic element for indicating whether or not to determine the index value of the first candidate matching block group of the current block; a syntactic element for indicating at least one grouping rule; a value N for the fusion matching block quantity; the length of the first candidate matching block list; and the length of the second candidate matching block list.

93. An encoder comprising a first determination unit, a first grouping unit, and a first prediction unit, The first decision unit is configured to construct a first candidate matching block list for the current block based on template matching. The first grouping unit is configured to group the first candidate matching block list, determine at least two candidate matching block groups, and determine the index value for each candidate matching block group. The first decision unit is further configured to determine the index value of the first candidate matching block group corresponding to the current block. The first decision unit is further configured to determine the first candidate matching block group from among the at least two candidate matching block groups based on the index value of the first candidate matching block group. The first prediction unit is an encoder configured to merge at least one matching block in the first candidate matching block group and determine the predicted block of the current block.

94. An encoder comprising a first memory and a first processor, The first memory is configured to store a computer program that can be executed by the first processor. An encoder wherein the first processor is configured to execute the encoding method described in any one of claims 46 to 91 by executing the computer program.

95. A decoder comprising a second decision unit, a second grouping unit, and a second prediction unit, The second decision unit is configured to construct a list of first candidate matching blocks for the current block based on template matching. The second grouping unit is configured to group the first candidate matching block list, determine at least two candidate matching block groups, and determine the index value for each candidate matching block group. The second decision unit is configured to determine the index value of the first candidate matching block group corresponding to the current block. The second decision unit is further configured to determine the first candidate matching block group from among the at least two candidate matching block groups based on the index value of the first candidate matching block group. The second prediction unit is a decoder configured to merge at least one matching block in the first candidate matching block group and determine the predicted block of the current block.

96. A decoder comprising a second memory and a second processor, The second memory is configured to store a computer program that can be executed by the second processor. A decoder wherein the second processor is configured to execute the decoding method described in any one of claims 1 to 45 by executing the computer program.

97. A computer-readable storage medium storing a computer program for implementing the decoding method described in any one of claims 1 to 45, or the encoding method described in any one of claims 46 to 91.