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

ZA202608188APending Publication Date: 2026-08-26GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
ZA202608188
Authority / Receiving Office
ZA · ZA
Patent Type
Applications
Current Assignee / Owner
Filing Date
2026-08-13
Publication Date
2026-08-26

AI Technical Summary

Technical Problem

The existing Intra TMP prediction technology has insufficient prediction accuracy during the video encoding and decoding process due to the unsatisfactory search strategy, which reduces the encoding and decoding efficiency.

Method used

By determining the first candidate list of the current block, the list is updated according to the candidate vector parameters and the vector parameters of the position block, the search area is expanded to improve prediction accuracy, and the spatially adjacent and non-adjacent reconstructed information is used to increase the coverage of the search list.

Benefits of technology

Improve prediction accuracy, save code rate, and improve encoding and decoding efficiency and performance.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

NOT VISIBLE DUE TO STATUS OF PATENT
Need to check novelty before this filing date? Find Prior Art

Description

Coding and decoding method, code stream, encoder, decoder and storage medium Technical Field

[0001] The present application relates to the field of video coding and decoding technology, and in particular to a coding and decoding method, a bit stream, an encoder, a decoder, and a storage medium. Background Art

[0002] Intra Template Matching Prediction (Intra TMP) technology uses the template of the coding block to search for the matching template with the minimum cost according to a preset cost function within a predefined search range in the current image, and uses the best matching reconstructed block corresponding to the matching template as the prediction block of the current coding block.

[0003] However, in the prediction process based on Intra TMP, considering that the search strategy in actual implementation is not ideal, the accuracy of the prediction cannot be guaranteed, which reduces the encoding and decoding efficiency.

[0004] Summary of the Invention

[0005] The present application provides a coding and decoding method, a code stream, an encoder, a decoder, and a storage medium, which can improve the accuracy of prediction and thus improve the coding and decoding efficiency.

[0006] The technical solution of this application can be implemented as follows:

[0007] In a first aspect, an embodiment of the present application provides a decoding method, applied to a decoder, the method comprising:

[0008] Determine a first candidate list for the current block; wherein the first candidate list includes one or more candidate vector parameters;

[0009] Determine a second position block according to candidate vector parameters in the first candidate list and / or vector parameters of the first position block of the current block;

[0010] When the decoding parameters of the second position block include vector parameters, determining whether the vector parameters of the second position block meet a second condition according to the vector parameters of the second position block;

[0011] When the vector parameter of the second position block meets the second condition, updating the first candidate list according to the vector parameter of the second position block;

[0012] determining a second search area according to the candidate vector parameters in the updated first candidate list, and determining the vector parameters of the current block according to the second search area;

[0013] A prediction value of the current block is determined according to the vector parameters of the current block.

[0014] In a second aspect, an embodiment of the present application provides an encoding method, applied to an encoder, the method comprising:

[0015] Determine a first candidate list for the current block; wherein the first candidate list includes one or more candidate vector parameters;

[0016] Determine a second position block according to candidate vector parameters in the first candidate list and / or vector parameters of the first position block of the current block;

[0017] When the coding parameters of the second position block include vector parameters, determining whether the vector parameters of the second position block meet a second condition according to the vector parameters of the second position block;

[0018] When the vector parameter of the second position block meets the second condition, updating the first candidate list according to the vector parameter of the second position block;

[0019] determining a second search area according to the candidate vector parameters in the updated first candidate list, and determining the vector parameters of the current block according to the second search area;

[0020] A prediction value of the current block is determined according to the vector parameters of the current block.

[0021] In a third aspect, an embodiment of the present application provides a code stream, which is generated by bit encoding based on information to be encoded; wherein the information to be encoded includes at least one of the following: a prediction difference value of a current block, a value of a first syntax element, a value of a second syntax element, and a value of a third syntax element;

[0022] Among them, the value of the first syntax element is used to indicate the index number of the prediction value construction method of the current block in the prediction value construction candidate list, the value of the second syntax element is used to indicate whether the current block uses the intra-frame template matching prediction mode, and the third syntax element is used to indicate whether the current block uses the first prediction mode.

[0023] In a fourth aspect, an embodiment of the present application provides an encoder, comprising a first determining unit, a first updating unit, and a first predicting unit, wherein:

[0024] A first determining unit is configured to determine a first candidate list for the current block; wherein the first candidate list includes one or more candidate vector parameters;

[0025] A first updating unit is configured to determine a second position block based on candidate vector parameters in the first candidate list and / or vector parameters of the first position block of the current block; and when the coding parameters of the second position block include vector parameters, determine whether the vector parameters of the second position block meet a second condition based on the vector parameters of the second position block; when the vector parameters of the second position block meet the second condition, update the first candidate list based on the vector parameters of the second position block; and determine a second search area based on the candidate vector parameters in the updated first candidate list, and determine the vector parameters of the current block based on the second search area;

[0026] The first prediction unit is configured to determine a prediction value of the current block according to the vector parameter of the current block.

[0027] In a fifth aspect, an embodiment of the present application provides an encoder, comprising a first memory and a first processor, wherein:

[0028] a first memory for storing a computer program capable of running on the first processor;

[0029] The first processor is configured to execute the method according to the second aspect when running a computer program.

[0030] In a sixth aspect, an embodiment of the present application provides a decoder, comprising a second determining unit, a second updating unit, and a second predicting unit, wherein:

[0031] A second determining unit is configured to determine a first candidate list for the current block; wherein the first candidate list includes one or more candidate vector parameters;

[0032] a second updating unit configured to determine a second position block based on the candidate vector parameters in the first candidate list and / or the vector parameters of the first position block of the current block; and when the decoding parameters of the second position block include vector parameters, determine whether the vector parameters of the second position block meet a second condition based on the vector parameters of the second position block; when the vector parameters of the second position block meet the second condition, update the first candidate list based on the vector parameters of the second position block; and determine a second search area based on the candidate vector parameters in the updated first candidate list, and determine the vector parameters of the current block based on the second search area;

[0033] The second prediction unit is configured to determine a prediction value of the current block according to the vector parameter of the current block.

[0034] In a seventh aspect, an embodiment of the present application provides a decoder, comprising a second memory and a second processor, wherein:

[0035] a second memory for storing a computer program capable of running on the second processor;

[0036] The second processor is configured to execute the method according to the first aspect when running a computer program.

[0037] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed, implements the method described in the first aspect or the method described in the second aspect.

[0038] An embodiment of the present application provides a coding and decoding method, a code stream, an encoder, a decoder, and a storage medium. Whether it is an encoding end or a decoding end, a first candidate list of a current block is first determined, and the first candidate list includes one or more candidate vector parameters; then, a second position block is determined based on the candidate vector parameters in the first candidate list and / or the vector parameters of the first position block of the current block; when the encoding / decoding parameters of the second position block include vector parameters, whether the vector parameters of the second position block meet a second condition is determined based on the vector parameters of the second position block; when the vector parameters of the second position block meet the second condition, the first candidate list is updated based on the vector parameters of the second position block; a second search area is determined based on the candidate vector parameters in the updated first candidate list, and the vector parameters of the current block are determined based on the second search area; finally, a prediction value of the current block is determined based on the vector parameters of the current block. That is to say, when updating the first candidate list, some vector information of the second position block can be expanded based on the candidate vector parameters and / or the vector parameters of the first position block (the spatially adjacent blocks and non-adjacent blocks of the current block) in the initial first candidate list, and then the first candidate list can be supplemented based on the expanded vector information; thereby, the spatially adjacent and non-adjacent reconstructed information can be effectively utilized, and the candidate vector information can be derived based on the vector information of these reconstructed blocks while ensuring the coding complexity, thereby increasing the coverage of the IntraTMP search list and expanding the search method of the fine search, so that the vector parameters of the current block after the fine search are more accurate, thereby improving the accuracy of the prediction, further saving the bit rate, improving the encoding and decoding efficiency, and thus improving the encoding and decoding performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 is a schematic diagram of the prediction of Intra TMP;

[0040] FIG2 is a schematic diagram of the prediction process based on the IntraTMP technology;

[0041] FIG3 is a schematic diagram of template types for the Intra TMP technology;

[0042] FIG4 is a schematic diagram of a search process based on the IntraTMP technology;

[0043] FIG5 is a schematic diagram of parameter definition of the current block and its template;

[0044] FIG6 is a schematic diagram of a template search area;

[0045] FIG7 is a schematic diagram of a flow chart of a search process;

[0046] FIG8 is a schematic diagram of the process of constructing a rough search list;

[0047] FIG9 is a schematic diagram of spatially adjacent and non-adjacent positions of a current block;

[0048] FIG10 is a schematic diagram of an integer pixel search in a fine search area;

[0049] FIG11 is a second schematic diagram of an integer pixel search in a fine search area;

[0050] FIG12 is a third schematic diagram of an integer pixel search in a fine search area;

[0051] FIG13 is a schematic diagram of a sub-pixel search in a fine search area;

[0052] FIG14 is a schematic diagram of a process for generating a prediction value;

[0053] FIG15A is a schematic diagram showing the distribution of filter coefficients;

[0054] FIG15B is a schematic diagram showing the distribution of predicted pixels;

[0055] FIG16 is a schematic diagram of the structure of an encoder provided in an embodiment of the present application;

[0056] FIG17 is a schematic diagram of the structure of a decoder provided in an embodiment of the present application;

[0057] FIG18 is a schematic diagram of a network architecture of a coding and decoding system provided in an embodiment of the present application;

[0058] FIG19 is a flowchart diagram 1 of a decoding method provided in an embodiment of the present application;

[0059] FIG20 is a second flow chart of a decoding method provided in an embodiment of the present application;

[0060] FIG21 is a fourth schematic diagram of an integer pixel search in a fine search area;

[0061] FIG22 is a fifth schematic diagram of an integer pixel search in a fine search area;

[0062] FIG23 is a sixth schematic diagram of an integer pixel search in a fine search area;

[0063] FIG24 is a seventh schematic diagram of an integer pixel search in a fine search area;

[0064] FIG25 is a second schematic diagram of a sub-pixel search in a fine search area;

[0065] FIG26 is a third schematic diagram of a sub-pixel search in a fine search area;

[0066] FIG27 is a flowchart diagram 1 of an encoding method provided in an embodiment of the present application;

[0067] FIG28 is a second flow chart of an encoding method provided in an embodiment of the present application;

[0068] FIG29 is a flowchart illustrating a search process according to an embodiment of the present application;

[0069] FIG30 is a second flow chart of a search process according to an embodiment of the present application;

[0070] FIG31 is a third flow chart of a search process according to an embodiment of the present application;

[0071] FIG32 is a fourth flow chart of a search process according to an embodiment of the present application;

[0072] FIG33 is a fifth flow chart of a search process according to an embodiment of the present application;

[0073] FIG34 is a sixth flow chart of a search process according to an embodiment of the present application;

[0074] FIG35 is a schematic diagram of the structure of an encoder provided in an embodiment of the present application;

[0075] FIG36 is a schematic diagram of a specific hardware structure of an encoder provided in an embodiment of the present application;

[0076] FIG37 is a schematic diagram of the structure of a decoder provided in an embodiment of the present application;

[0077] FIG38 is a schematic diagram of a specific hardware structure of a decoder provided in an embodiment of the present application;

[0078] Figure 39 is a schematic diagram of the composition structure of a coding and decoding system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0079] In order to enable a more detailed understanding of the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application is described in detail below with reference to the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present application.

[0080] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.

[0081] In the following description, reference is made to "some embodiments," which describe a subset of all possible embodiments. However, it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict. It should also be noted that the terms "first, second, and third" in the embodiments of the present application are only used to distinguish similar objects and do not represent a specific ordering of the objects. It is understood that "first, second, and third" may be interchanged in a specific order or sequential order where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0082] Before further explaining the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained first. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations:

[0083] Coding Block (CB);

[0084] Block Maching (BM);

[0085] Coding Unit (CU);

[0086] Prediction Unit (PU);

[0087] Block Vector (BV);

[0088] Motion Vector (MV);

[0089] Sum of Absolute Difference (SAD);

[0090] Sum of Absolute Transformed Difference (SATD);

[0091] Mean Square Error (MSE);

[0092] Sum of Squared Errors (SSE);

[0093] Sum of Squared Differences (SSD);

[0094] Mean Absolute Deviation (MAD);

[0095] Mean Absolute Error (MAE);

[0096] Mean Square Differences (MSD);

[0097] Normalized Correlation Coefficient (NCC);

[0098] H.266 / Versatile Video Coding (VVC);

[0099] VVC Test Model (VTM), a reference software testing platform for VVC;

[0100] Local Illumination Compensation (LIC);

[0101] Intra Template Matching Prediction (Intra TMP);

[0102] Beyond VVC's reference software testing platform (Enhanced Compression Model, ECM).

[0103] It can be understood that in a video image, a first color component, a second color component, and a third color component are generally used to represent a coding block. These three color components are a luminance component, a blue chrominance component, and a red chrominance component. Specifically, the luminance component is usually represented by the symbol Y, the blue chrominance component is usually represented by the symbol Cb or U, and the red chrominance component is usually represented by the symbol Cr or V. Thus, a video image can be represented in either the YCbCr format or the YUV format.

[0104] It can also be understood that Intra TMP is a special intra-frame prediction mode. Both the encoder and decoder use the template (T) of the coding block to search for the matching template (T_BEST) with the minimum cost within a predefined search range in the current image according to a preset cost function. The offset of the best matching template relative to the current coding block template is the best block vector (BEST Block Vector, BV_BEST). The reconstructed block (Ref Block) corresponding to the matching template is then used as the prediction block for the current coding block (Cur Block). The template of the coding block is usually selected from the adjacent reconstructed area of ​​the current coding block.

[0105] For example, taking the adjacent reconstructed area of ​​the current block as an example, FIG1 is a prediction diagram of an Intra TMP. As shown in FIG1 , the area filled with oblique lines represents the reconstructed area, the block filled with a grid is the current block, and the adjacent area of ​​the current block is the first template (T); the block filled with vertical lines is the reference block, and the adjacent area of ​​the reference block is the second template (i.e., the best matching template, T_BEST); wherein, the offset of the second template relative to the first template is the best block vector (BV_BEST). At this time, the reference block can be block-copied as the prediction block of the current block.

[0106] In an embodiment of the present application, the preset cost function can be the sum of absolute error SAD, the sum of absolute transformation difference SATD, the mean square error MSE, the sum of squared errors SSD, the mean absolute difference MAD, the mean sum of squared errors MSD, the normalized correlation coefficient NCC, etc., which is not specifically limited here.

[0107] For example, taking absolute error and SAD as examples, the cost function at this time is as follows:

[0108] Among them, T i is the template in the search process, and M represents the number of pixels in the template.

[0109] The following is a detailed introduction to the prediction process of the Intra TMP technology in the related art.

[0110] Input of IntraTMP: the position of the current block (xTbCmp, yTbCmp), the width of the current block nTbW, and the height of the current block nTbH.

[0111] Output of IntraTMP: predicted value predSamples[x][y] of the current block, where x = 0..nTbW-1, y = 0..nTbH–1.

[0112] Specifically, the IntraTMP prediction process can be divided into four steps: determining the current template type, obtaining the reconstructed pixels of the current template, determining the block vector (or "block vector") within a predefined search range, and generating the predicted value. This process yields the predicted value for the current block. It's important to note that the IntraTMP technique can be used to predict both luma and chroma components, and this is not specifically limited here.

[0113] In one possible implementation, FIG2 is a schematic diagram of a prediction process based on the IntraTMP technology. As shown in FIG2 , the process may include:

[0114] S201, determining the current template type.

[0115] It should be noted that the Intra TMP technology uses the adjacent reconstructed pixels of the current block as templates to search for matching templates within a predefined search area, where the adjacent reconstructed pixels can be the upper reference pixel, upper left reference pixel, upper right reference pixel, left reference pixel, lower left reference pixel, etc. of the current block. Therefore, the template type can be classified and the corresponding template type can be determined based on the availability of the adjacent reconstructed pixels.

[0116] It should also be noted that refTemplateType represents the template type. Figure 3 is a schematic diagram of template types for the Intra TMP technology. As shown in Figure 3, the block filled with a grid is the current block, and the adjacent area of ​​the current block is the template T. Six template types are shown here.

[0117] For example, the six template types are as follows:

[0118] When the upper 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 (a) of Figure 3. It should be noted that when the value of refTemplateType is 1, for an L-shaped template, in some cases there may be no upper left adjacent reference pixel.

[0119] When only the left reference pixel is available, the value of refTemplateType is 2, and the template shape is shown in (b) in Figure 3;

[0120] When only the upper reference pixel is available, the value of refTemplateType is 3, and the template shape is shown in (c) in Figure 3;

[0121] When only the left reference pixel and the upper left reference pixel are available, the value of refTemplateType is 4, and the template shape is shown in (d) in Figure 3;

[0122] When only the left reference pixel and the lower left reference pixel are available, the value of refTemplateType is 5, and the template shape is as shown in (e) in Figure 3;

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

[0124] S202, obtaining the current template pixel.

[0125] It should be noted that the Intra TMP template can be composed of reconstructed pixels from one or more of the following regions: the top, upper right, left, lower left, or upper left of the current block. Furthermore, the template size can be pre-set. For example, when obtaining the left template, the template width (templateW_size) can be set to 4, and when obtaining the top template, the template height (templateH_size) can be set to 4.

[0126] It should also be noted that the portion of the reconstructed pixels to be obtained can be determined by the value of refTemplateType. For example, when the value of refTemplateType is 1, the reconstructed pixels of the left, upper-left, and upper sides of the current block are obtained; or, when the value of refTemplateType is 2, only the reconstructed pixels of the four left columns of the current block are obtained; or, when the value of refTemplateType is 3, only the reconstructed pixels of the four upper rows of the current block are obtained.

[0127] S203: Determine a block vector.

[0128] It should be noted that the search process of the Intra TMP technology is mainly divided into an initialization process, determining a search area of ​​the template in the current frame, and searching and determining the best block vector in the search area.

[0129] It should also be noted that when searching for the best matching template in the search area, a search strategy of coarse search first and then fine search may be adopted, or only fine search or only coarse search may be performed, which is not specifically limited here.

[0130] In an embodiment of the present application, the coarse search here can specifically be: determining the best coarse matching template in the search area with a first search step (for example, 3), or determining the best coarse matching template in the search area using a downsampled template (for example, a downsampling factor of 3).

[0131] In an embodiment of the present application, the fine search here can specifically be: determining the best fine matching template in the search area with a second search step size (for example, 1, if sub-pixel accuracy is encountered, sub-pixel interpolation is required for the reconstructed pixels, which is not expanded here), or determining the best fine matching template near the best coarse matching template after completing the coarse search.

[0132] In one possible implementation, FIG4 is a schematic diagram of a search process based on the IntraTMP technology. As shown in FIG4 , the process may include:

[0133] S401, initialization parameters.

[0134] It should be noted that, taking the L-shaped template as an example, uiPatchWidth is initialized to nTbW + templateW_size, and uiPatchHeight is initialized to nTbH + templateH_size. Among them, templateW_size and templateH_size can be fixed constants, or they can be dynamically adjusted according to the size of the current block; in addition, templateW_size and templateH_size can be equal or unequal. For example, templateW_size = 4, templateH_size = 4; or, when the width of the current block is greater than 8, set templateW_size = 4; when the width of the current block is less than or equal to 8, set templateW_size = 2; when the height of the current block is greater than 8, set templateH_size = 4; when the height of the current block is less than or equal to 8, set templateH_size = 2.

[0135] For example, Figure 5 shows a parameter definition diagram for a current block and its template. As shown in Figure 5, the parameters are as follows: nTbW and nTbH represent the width and height of the current block, templateW_size and templateH_size represent the width and height of the template, and uiPatchWidth and uiPatchHeight represent the overall height and width of the current block and template.

[0136] Furthermore, the cost threshold between the initialization templates is represented by diffThreshold. For example, when the cost function is SAD, the threshold can be: diffThreshold = ((1 <<bitDepth)> >2)×(uiPatchHeight×uiPatchWidth-nTbH×nTbW). When the image bit depth bitDepth is 10, diffThreshold indicates that the distortion threshold of each pixel in the template area is 256.

[0137] Furthermore, the position of the coding tree block CTB where the current block CB is located is initialized: ctbRsX, ctbRsY.

[0138] Furthermore, the position offset of the current block CB in the current CTB is initialized: offsetLCBY=yTbCmp−ctbRsY, offsetLCBX=xTbCmp−ctbRsX.

[0139] Furthermore, initialize iTemplateSizeH=templateH_size and iTemplateSizeW=templateW_size.

[0140] Furthermore, iBvShift is initialized, where iBvShift is the precision of the block vector BV. For example, the precision of BV can be integer pixel precision, in which case iBvShift is 0; the precision of BV can also be sub-pixel precision, for example, iBvShift of 1 indicates 1 / 2 pixel precision, and iBvShift of 2 indicates 1 / 4 pixel precision. This is not specifically limited here.

[0141] Furthermore, the preset search range of the template is initialized. The preset search range of the template can be set to a fixed size or dynamically adjusted according to the encoding block size. For example: searchRangeWidth = TMP_SEARCH_RANGE_MULT_FACTOR × nTbW; searchRangeHeight = TMP_SEARCH_RANGE_MULT_FACTOR × nTbH;

[0142] The value of TMP_SEARCH_RANGE_MULT_FACTOR may be a preset value, for example, 5.

[0143] S402: Determine a search area of ​​the template in the current frame.

[0144] It should be noted that the frame here can also be called an image, so the current frame can also be called the current image. The search area of ​​the Intra TMP technology is the reconstructed part of the current image and is limited by the size of the search range. For example, Figure 6 is a schematic diagram of the template search area of ​​the current block. As shown in Figure 6, R1, R2, R3, R4, R5 and R6 represent six different search areas. Among them, picHeight represents the height of the current image, picWidth represents the width of the current image, searchRangeHeight represents the height of the search area, searchRangeWidth represents the width of the search area, CtbSizeH represents the height of the coding tree block, nTbH represents the height of the current block, and nTbW represents the width of the current block.

[0145] The search areas can be divided into two types:

[0146] One is the surrounding rectangular search area. This area is also divided into two types: one is the area where all sampling points have been reconstructed (called the fully reconstructed area), such as the four areas R1 to R4 in Figure 6; the other is the area where it is uncertain whether all sampling points have been reconstructed (called the pending reconstruction area), such as the two areas R5 to R6 in Figure 6.

[0147] One is to extend the search area, which is defined as the area pointed to by the BVs corresponding to the spatially adjacent and non-adjacent PUs. In the embodiment corresponding to FIG6 , this area can be considered as R7.

[0148] For the search points in the search area, all search points in the specified search area can be traversed, or different schemes can be used to limit the search range to a local search range, so as to balance the computational complexity and coding efficiency. For example, for the undetermined reconstruction area (corresponding to the two areas R5 to R6 in Figure 6) or the full reconstruction area (for example, corresponding to the four areas R1 to R4 in Figure 6), the width of the search range can be limited to the original 1 / wIndex, and the height can be limited to the original 1 / hIndex, where wIndex and hIndex are both any positive integers greater than or equal to 1. The limited search range takes the area closer to the unit to be encoded. For another example, when narrowing the search range of the R5 area, the width of the R5 search area can be reduced to 1 / 2 of the original width, and the width can be reduced to 1 / 2 of the original width. The final search range can take the upper right 1 / 4 area of ​​the R5 area.

[0149] S403: Search and determine the best block vector BV in the search area.

[0150] It should be noted that bvXMins and bvXMaxs represent the minimum offset and maximum offset of the block vector in the horizontal direction respectively; bvYMins and bvYMaxs represent the minimum offset and maximum offset of the block vector in the vertical direction respectively.

[0151] bvXMins regionId 、bvXMaxs regionId 、bvYMins regionId 、bvYMaxs regionId iVerMin determined in step S402 regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId Calculated: bvXMins regionId =iHorMin regionId –xTbCmp; bvXMaxs regionId =iHorMax regionId –xTbCmp; bvYMins regionId=iVerMin regionId –yTbCmp; bvYMaxs regionId =iVerMax regionId –yTbCmp;

[0152] Among them, bvXMins regionId 、bvXMaxs regionId 、bvYMins regionId and bvYMaxs regionId The horizontal and vertical offset ranges of the search point relative to the current block, ie, the range of the block vector BV, are determined.

[0153] For the entire reconstruction area (e.g., corresponding to the four regions R1 to R4 in Figure 6), a matching reconstructed block for the current block can be found in the reconstruction area through the search points (iPosHor, iPoxVer) within each search area, that is, each block vector BV (composed of horizontal and vertical components: (pX, pY), where pX = iPosHor - xTbCmp, pY = iPosVer - yTbCmp, pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs). The adjacent reconstructed pixels of the matching reconstructed block are the matching template. This allows the matching cost between the adjacent template of the current block and the adjacent template of the reconstructed block to be calculated, denoted as pDiff.

[0154] For the area to be reconstructed (e.g., corresponding to the two areas R5 to R6 in FIG6 ), the availability is judged by the search points (iPosHor, iPoxVer) in each search area, that is, each block vector BV (composed of horizontal and vertical components: (pX, pY), where pX = iPosHor-xTbCmp, pY = iPosVer-yTbCmp, then pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs):

[0155] If available, a matching reconstructed block for the current block can be found in the reconstructed area. The adjacent reconstructed pixels of the matching reconstructed block are the matching template. From this, the matching cost between the adjacent template of the current block and the adjacent template of the reconstructed block can be calculated, also recorded as pDiff.

[0156] If not available, no template matching cost calculation is performed.

[0157] Availability judgment includes but is not limited to one or more of the following conditions being met simultaneously:

[0158] ● Each sampling point in the template does not exceed the valid coordinate range limited by the image sampling point boundary;

[0159] ● Each sampling point in the template's corresponding reconstruction block does not exceed the valid coordinate range limited by the image sampling point boundary;

[0160] ● Each sampling point in the template and each sampling point in the corresponding reconstructed block does not exceed the specified range of the search window;

[0161] ●Whether each sampling point in the template is in the same tile as the current encoding area;

[0162] ●Whether the sampling points in the reconstructed block corresponding to the template are in the same tile as the current coding area;

[0163] ●All sampling points in the template have been reconstructed;

[0164] ● Each sampling point in the reconstructed block corresponding to the template is not in the current coding area;

[0165] ●All sampling points in the reconstruction block corresponding to the template have been reconstructed;

[0166] Traverse all available search points in all search ranges (regionId = 0, 1, 2, 3, 4, 5), and compare to obtain the 30 search points with the smallest matching cost pDiff. The corresponding matching cost is recorded as pDiff_BEST[n], n = 0, ..., 29, and the corresponding block vector BV is recorded as the best block vector BV_BEST[n]. Each item is a coordinate pair (pX_BEST, pY_BEST), n = 0, ..., 29, and the corresponding matching template is the best matching template T_BEST[n], n = 0, ..., 29.

[0167] If the search strategy is: only perform a rough search, the specific implementation is as follows:

[0168] In each region at pX within bvXMins regionId with bvXMaxs regionId Between, pY is in bvYMins regionId with bvYMaxs regionId In the search range between , a coarse search is performed with a step size greater than 1, for example, a coarse search is performed with a step size of 2. The best matching cost obtained by recording template matching is pDiff_BEST, and its corresponding block vector BV is recorded as the best block vector BV_BEST (pX_BEST, pY_BEST).

[0169] If the search strategy is: only perform detailed search, the specific implementation is as follows:

[0170] In each region at pX within bvXMins regionId with bvXMaxs regionId Between, pY is in bvYMins regionId with bvYMaxsregionId Within the search range between, for example, the best matching cost obtained by performing a fine search with a step size of 1 and recording the template matching is pDiff_BEST, and its corresponding block vector BV is recorded as the best block vector BV_BEST (pX_BEST, pY_BEST).

[0171] If the search strategy is: perform a coarse search first and then a fine search, as shown in Figure 7, the specific implementation is as follows:

[0172] S701: Construct a rough search list in the search area.

[0173] S702, determining a detailed search list near the rough search list BV with a step size of 1.

[0174] It should be noted that, for step S701, when constructing a rough search list within the search area, as shown in FIG8 , the implementation steps may include:

[0175] S801: Construct an initial rough search list in the search area with a step size of 3.

[0176] In each region at pX within bvXMins regionId with bvXMaxs regionId Between, pY is in bvYMins regionId with bvYMaxs regionId Within the search range between , a coarse search is performed with a step size of 3. The first P optimal matching costs obtained from the template matching are recorded as pDiff1_BEST[p], where p = 0, ..., P-1, and the corresponding block vector BV is recorded as the best block vector BV1_BEST[p], where p = 0, ..., P-1. P can be an integer value of 1 or greater as needed, and the search region where the best matching search point is located is bestRegionId[p], where p = 0, ..., P-1.

[0177] S802: Construct an IntraTMP_Merge list to update the rough search list.

[0178] After P reference points are found in the search area, a candidate BV list for reference by the current block is constructed using multiple predefined search positions, which is called the IntraTMP_Merge list.

[0179] Exemplarily, the predefined search position set may include: positions adjacent to and non-adjacent to the current block space. For example, the five positions adjacent to the current block space are: left (xTbCmp-1, yTbCmp+nTbH-1), top (xTbCmp+nTbW-1, yTbCmp-1), top right (xTbCmp+nTbW, yTbCmp-1), bottom left (xTbCmp-1, yTbCmp+nTbH), top left (xTbCmp-1, yTbCmp-1), and 18 non-adjacent positions in space (as shown in FIG9 ). Among them, the positions numbered 1-5 in FIG9 are called spatially adjacent positions, and the remaining positions are called non-adjacent positions.

[0180] An embodiment of the construction process: Check whether the PUs corresponding to these positions use the IntraTMP / IBC technology. If they do, store the BV of this PU in the IntraTMP_Merge list. After constructing the IntraTMP_Merge list, update the coarse search list. The specific operation process of the update is: access each item in this list in turn, calculate the template matching cost corresponding to each BV, compare this cost with the template matching cost of the initial coarse search list, and if it is less than the maximum template matching cost in the coarse search list, replace this BV with the worse BV in the coarse search list. For example, a specific replacement operation is: insert this BV into the coarse search list in order of cost, and delete the item with the highest cost in the coarse search list. And set the bestRegionId of the search area where it is located to 6. It should be noted that this process is actually a list merging process, but first constructs a search list of the results corresponding to R1 to R6, and then inserts the results of R7 into the appropriate position in the list. In addition, there can also be other search orders and merging strategies, which are not specifically limited here.

[0181] In the embodiment of the present application, according to the algorithm requirements, the coarse search stage will provide one or more (here denoted as M, 1<=M<=P) fine search reference points and send them to the next step. For example, M=1.

[0182] It should also be noted that, for step S702, the best block vector BV1_BEST[p], p=0, ..., M-1, obtained by the coarse search may be used as a reference point for fine search and search may be performed nearby.

[0183] In this embodiment of the present application, within a specific range of the fine search list, the searched integer pixel position costs are compared one by one to determine the minimum cost position. Specifically, for each fine search reference point, the position of the best matching reconstructed block obtained from the coarse search is first calculated as the reference position of the fine search area: BestPosX = xTbCmp + pX1_BEST, BestPosY = yTbCmp + pY1_BEST. Then, the refined search range TmpRefineRangeHor and TmpRefineRangeVer are determined. The refined search range can be fixed in size or related to the search area.

[0184] For example, for a search region with reference points 0 to 5, both TmpRefineRangeHor and TmpRefineRangeVer can be set to 1. That is, for regionId values ​​between 0 and 5, the refinement search range is a 3×3 pixel region within the range [-1, 1], with the refinement search starting point (also called the "refinement search starting point") at [0, 0] coordinates and vertical and horizontal offsets. A full point-by-point search is performed within this range, as shown in Figure 10.

[0185] For reference points with a search region of 6, both TmpRefineRangeHor and TmpRefineRangeVer can be set to 5. That is, when regionId is 6, the refinement search range is an 11×11 pixel area within the range [-5, 5], with the refinement search starting position at [0, 0] as the vertical and horizontal coordinates offset. A full point search is performed within this range, as shown in Figure 11.

[0186] In addition, for the case where regionId is 6: Alternatively, if used in conjunction with the IntraTMP-LIC mode, when the IntraTMP-LIC mode is selected for the current block, the fine search range is a 5×5 pixel region with the fine search starting point at [0,0] and vertical and horizontal coordinates offset within the range [-2,2], respectively. Otherwise, when the IntraTMP-LIC mode is not selected for the current block, the fine search range is an 11×11 pixel region with the fine search starting point at [0,0] and vertical and horizontal coordinates offset within the range [-5,5], respectively. A full point-by-point search is performed within this range, as shown in Figure 12. In Figure 12, (a) shows the case where the IntraTMP-LIC mode is selected for the current block, i.e., the syntax element (flag) corresponding to the IntraTMP-LIC mode for the current block is set to 1; (b) shows the case where the IntraTMP-LIC mode is not selected for the current block, i.e., the syntax element (flag) corresponding to the IntraTMP-LIC mode for the current block is set to 0.

[0187] It should also be noted that, for the IntraTMP-LIC mode, in the IntraTMP mode, after searching for a matching position for the current block through the template, a LIC model (e.g., a linear model) is established between the template of the current block and the template at the matching position, as follows: I0(x,y)=aI1(x,y)+b (2)

[0188] Where I0(x, y) is the pixel value in the current template / predicted block, I1(x, y) is the pixel value in the reference template / reference block, and a and b are linear model parameters. Here, a and b can be calculated from the current block template and the reference block template (for example, using the least squares method), and then the pixel values ​​in the reference block are substituted into the values ​​to calculate the pixel values ​​in the current predicted block.

[0189] In a possible implementation, the search window is directly used, and the fine search area is regarded as an entire pending reconstruction area and directly traversed.

[0190] First, the new search range is obtained based on the optimal matching block position obtained by the rough search, which is: iHorMax refine =min(picWidth-nTbW,BestPosX+TmpRefineRangeHor); iHorMin refine =max(iTemplateSizeW,BestPosX-TmpRefineRangeHor); iVerMax refine =min(picHeight-nTbH,BestPosY+TmpRefineRangeVer); iVerMin refine =max(iTemplateSizeH,BestPosY-TmpRefineRangeVer);

[0191] Then, the adjusted block vectors BVbvXMins, bvXMaxs, bvYMins, bvYMaxs can be obtained by iVerMin refine 、iVerMax refine 、iHorMin refine 、iHorMax refine Calculation: bvXMins = iHorMin refine –xTbCmp; bvXMaxs=iHorMax refine –xTbCmp; bvYMins=iVerMin refine –yTbCmp; bvYMaxs=iVerMax refine –yTbCmp;

[0192] Fine search in pX is bvXMins refine with bvXMaxs refine Between, pY is in bvYMins refine with bvYMaxs refine This is done within the block vector range between , that is, all search positions within the fine search window are directly traversed, and availability judgments are made one by one. For example, a search is performed with a step size of 1. The top T best matching costs obtained from the available point template matching are recorded as pDiff_BEST[t], t = 0, ..., T-1, and the corresponding block vector BV is recorded as the best block vector BV_BEST[t], t = 0, ..., T-1. Where T is an integer of 1 or greater. For example, T = 1.

[0193] It should also be noted that in the embodiments of the present application, further sub-pixel position search can be performed based on the above. For example, the initial direction of the sub-pixel position is first determined, and then the sub-pixel position index (which can be represented by tmpIsSubPel) and the final direction index (which can be represented by tmpSubIdx) are determined.

[0194] Specifically, with the sub-pixel search starting point as the [0,0] coordinate, the vertical and horizontal coordinates are offset by -1 / 2 and 1 / 2 in 8 directions respectively, and the costs of the 8 candidate positions are compared one by one, and the first 4 directions with the smallest cost are determined as the initial directions of the sub-pixel search. Then, with the sub-pixel search starting point as the [0,0] coordinate, the vertical and horizontal coordinates of the first 4 directions determined above are offset by the range of [-3 / 4, 3 / 4] respectively, and a search is performed between multiple 1 / 4 pixel precision positions. The costs of 10 to 12 candidate positions are compared one by one to determine the position with the smallest cost, which is the sub-pixel position index tmpIsSubPel and the final direction index tmpSubIdx. As shown in Figure 13, the white-filled dots are sub-pixel positions, the grid-filled dots are half-pixel positions, and the black-filled dots are whole-pixel positions.

[0195] Exemplarily, tmpIsSubPel can have four values, corresponding to the integer pixel position (0), 1 / 2 pixel position (1), 1 / 4 pixel position (2 or 3) and 3 / 4 pixel position (2 or 3); among which, the serial numbers corresponding to the 1 / 4 and 3 / 4 positions are related to the interpolation positions.

[0196] For example, tmpSubIdx can have eight values, corresponding to eight directions: left (0), right (1), up (2), down (3), upper left (4), upper right (5), lower left (6), and lower right (7).

[0197] In this way, the sub-pixel position (Dx, Dy) value can be used to obtain the specific sub-pixel coordinate position according to tmpIsSubPel and tmpSubIdx, and then the optimal matching coordinate is updated.

[0198] After completing the above operations, the results of the coarse selection and fine selection processes (where the fine selection process includes one or more reference point searches) are combined to obtain one or more optimal block vectors BV_BEST[n] for different algorithm requirements, where n = 0, ..., N-1, and each item is a coordinate pair (pX_BEST, pY_BEST). pX_BEST and pY_BEST are the horizontal and vertical offsets of the best matching template relative to the current coding block template, respectively, and are also the horizontal and vertical offsets of the best matching reconstructed block relative to the current coding block.

[0199] S204: Generate a predicted value.

[0200] In IntraTMP mode, in addition to the basic copying method to obtain prediction values, there is also a method of obtaining prediction values ​​by fusing the corresponding positions of multiple BVs, a method of filtering the reference block corresponding to the BV and then copying it, and a method of pixel-by-pixel interpolation of the corresponding reference block of the BV and then copying it.

[0201] In one possible implementation, after obtaining a BV candidate list using template matching during the decoding end region search process, the first N items (eg, N=3) are selected for weighted fusion. This method may be referred to as the IntraTMP Fusion mode.

[0202] Alternatively, in another possible implementation, after obtaining an optimal BV, multiple points are taken around the BV, and the corresponding predicted values ​​of the multiple points are weighted and fused to obtain the predicted value. This method can be called the IntraTMP FLM mode.

[0203] Alternatively, in another possible implementation, after obtaining an optimal BV, the templates are sorted using sub-pixel precision, the optimal direction and precision are selected, and the prediction value is calculated using an interpolation filter. This method may be referred to as the IntraTMP SubPel mode.

[0204] The implementation process of some of the above methods is described in detail below.

[0205] In the IntraTMP technology, different prediction methods are used depending on the prediction mode. For example, in the IntraTMP Fusion technology, after obtaining the block vectors BV corresponding to N candidate templates, N candidate reconstructed blocks are obtained through BV, and then the N candidate reconstructed blocks are weighted and fused to obtain the predicted block of the current coding block. Specifically, the final prediction value is generated through the following steps: obtaining N candidate reconstructed blocks, determining the weighted fusion weights, and then generating the prediction value through weighted fusion. As shown in Figure 14, this process may include:

[0206] S1401: Obtain N candidate reconstruction blocks.

[0207] After obtaining the block vector BV corresponding to N candidate templates, directly according to BV n Get the candidate reconstruction block RefBlock in the current image n , of which BV n The horizontal offset is pX n , the vertical offset is pY n , where n=0,1…,N-1.

[0208] It is realized by simple translation copy. For x=0…nTbW-1,y=0…nTbH-1, the specific operation is: RefBlock n [x][y]=recSamples[x+pX n ][y+pY n ] (3)

[0209] Among them, recSamples represents the reconstructed pixels of the current frame.

[0210] S1402: Determine weighted fusion weights.

[0211] After obtaining N candidate reconstructed blocks RefBlock, it is necessary to calculate the weight W of the weighted fusion of the N candidate reconstructed blocks. The weight can be a predefined value or a value adaptively calculated using a cost value, pixel value, etc.

[0212] In the embodiment of the present application, the candidate template refT is used in the embodiment of the IntraTMP Fusion technology. n The reconstruction value and the template to be predicted refpredT n The weighted fusion weights are derived by minimizing the MSE of the pixel values.

[0213] Specifically, the MSE minimization process takes as input the autocorrelation matrix of the first N matching reference samples refT, the cross-correlation vector of the first N matching reference samples refT and the adjacent template samples curT of the current coding block, and outputs the weight of each matching reference item corresponding to the reconstructed block.

[0214] S1403: Generate a prediction value through weighted fusion.

[0215] The prediction block is calculated based on each candidate reconstructed block and its corresponding weighted fusion weight. Specifically, the value of each candidate reconstructed block and its corresponding weight are multiplied and accumulated to obtain the current prediction block (i.e., weighted prediction). The calculation formula is as follows:

[0216] For x = 0 ... nTbW-1, y = 0 ... nTbH-1, the predicted value is calculated as follows:

[0217] Finally, each predicted value predSamples x,y The spatial storage is the output prediction block of IntraTMP Fusion.

[0218] In IntraTMP FLM mode, the linear filter model is established using the best matching template found in the previous step and the current coding block template. This mainly involves the following two steps: determining the reconstruction area for calculating the filter coefficients and calculating the filter coefficients. The specific prediction value calculation process is as follows:

[0219] Assuming that the number of filter taps nTap is 5, the shape of the filter is shown in FIG15A , where c0 to c4 are the tap coefficients of the filter, and the dot filled with the grid corresponding to the tap coefficient C0 is the current pixel to be predicted Y pred [i][j] is the reconstructed pixel ref[i][j] at the corresponding position in the best matching block; the other white-filled dots are the reconstructed pixels adjacent to the current spatial position in the best matching reconstructed block. In this way, according to the filter in Figure 15A, the final predicted pixel Y pred [i][j] are shown as black filled dots in Figure 15B.

[0220] The specific prediction value calculation process is as follows:

[0221] For each current pixel to be predicted (i, j), the pixel position in the filter template is defined as (k, l), then the corresponding reconstructed pixel in the best matching block during filtering is defined as ref[i+k][j+l], and each filter coefficient at the position (k, l) in the filter template is defined as c k,l : c k,l =c n (5)

[0222] Where n=0,…,nTap-1, k and l are between -1 and 1.

[0223] For i = 0, ..., nTbW-1, j = 0, ..., nTbH-1: Y pred [i][j]=∑ k ∑ l ref[i+k][j+l]×C ,k,l (6)

[0224] The final predicted pixel is: predSamples[i][j]=Clip3(0,(1<<BitDepth)-1,Y pred [i][j]) (7)

[0225] in,

[0226] In IntraTMP SubPel mode, for the optimal BV, traverse the eight directions of 1 / 4, 1 / 2, 3 / 4, up, down, left, right, upper left, upper right, lower left, and lower right, sort them according to the template cost, and use the interpolation filter to calculate the prediction value for the reference block corresponding to the BV with the smallest template cost.

[0227] Simply put, IntraTMP technology uses a coding block template to search for a matching template with the lowest cost within a predefined search range in the current image according to a preset cost function. The best matching reconstructed block (Ref Block) corresponding to the matching template is used as the prediction block for the current coding block (Cur Block). The coding block template is typically selected from the reconstructed area adjacent to the current coding block. However, in actual implementations, the search strategies often fail to fully utilize the reconstructed information of adjacent sampling points, thus failing to guarantee prediction accuracy and thus affecting coding efficiency.

[0228] Based on this, an embodiment of the present application provides a coding and decoding method, which first determines a first candidate list of the current block, and the first candidate list includes one or more candidate vector parameters; then determines the second position block based on the candidate vector parameters in the first candidate list and / or the vector parameters of the first position block of the current block; when the encoding / decoding parameters of the second position block include vector parameters, determines whether the vector parameters of the second position block meet the second condition based on the vector parameters of the second position block; when the vector parameters of the second position block meet the second condition, updates the first candidate list based on the vector parameters of the second position block; determines a second search area based on the candidate vector parameters in the updated first candidate list, and determines the vector parameters of the current block based on the second search area; finally, determines the prediction value of the current block based on the vector parameters of the current block.

[0229] It can be seen that when updating the first candidate list, the embodiment of the present application can expand some vector information of the second position block based on the candidate vector parameters in the initial first candidate list and / or the vector parameters of the first position block (the spatially adjacent blocks and non-adjacent blocks of the current block), and then supplement the first candidate list based on the expanded vector information; thereby, the spatially adjacent and non-adjacent reconstructed information can be effectively utilized, and the candidate vector information can be derived based on the vector information of these reconstructed blocks while ensuring the coding complexity, thereby increasing the coverage of the IntraTMP search list, thereby improving the accuracy of the prediction, further saving the bit rate, and thereby improving the encoding and decoding efficiency and encoding and decoding performance.

[0230] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0231] Figure 16 is a schematic diagram of the composition structure of an encoder provided in an embodiment of the present application. As shown in Figure 16, the encoder 100 may include a transform and quantization unit 101, an intra-frame estimation unit 102, an intra-frame prediction unit 103, a motion compensation unit 104, a motion estimation unit 105, an inverse transform and inverse quantization unit 106, a filter control analysis unit 107, a filtering unit 108, an encoding unit 109, and a decoded image cache unit 110, among others. Among them, the filtering unit 108 can implement deblocking filtering and sample adaptive offset (SAO) filtering, and the encoding unit 109 can implement header information encoding and context-based adaptive binary arithmetic coding (CABAC).For the input original video signal, a video coding block can be obtained by dividing the coding tree unit (CTU). Then, the residual pixel information obtained after intra-frame or inter-frame prediction is transformed by the transformation and quantization unit 101, including transforming the residual information from the pixel domain to the transform domain and quantizing the obtained transform coefficients to further reduce the bit rate; the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to perform intra-frame prediction on the video coding block. Specifically, the intra-frame estimation unit 102 and the intra-frame prediction unit 103 are used to determine the intra-frame prediction mode to be used to encode the video coding block; the motion compensation unit 104 and the motion estimation unit 105 are used to perform inter-frame prediction coding on the received video coding block relative to one or more blocks in one or more reference frames to provide temporal prediction information; the motion estimation performed by the motion estimation unit 105 is the process of generating a motion vector, which can estimate the motion of the video coding block. The motion compensation unit 104 then calculates the motion vector based on the motion vector determined by the motion estimation unit 105. After determining the intra-frame prediction mode, the intra-frame prediction unit 103 is further configured to provide the selected intra-frame prediction data to the encoding unit 109, and the motion estimation unit 105 also sends the calculated motion vector data to the encoding unit 109. In addition, the inverse transform and inverse quantization unit 106 is configured to reconstruct the video coding block and reconstruct a residual block in the pixel domain. The reconstructed residual block is subjected to the filter control analysis unit 107 and the filtering unit 108 to remove the block effect artifacts. The reconstructed residual block is then added to a predictive block in the frame of the decoded image buffer unit 110 to generate a reconstructed video coding block. The encoding unit 109 is configured to encode various coding parameters and quantized transform coefficients. In the CABAC-based coding algorithm, the context content can be based on adjacent coding blocks and can be used to encode information indicating the determined intra-frame prediction mode, and output the code stream of the video signal. The decoded image buffer unit 110 is configured to store the reconstructed video coding block for prediction reference. As the video image encoding proceeds, new reconstructed video encoding blocks are continuously generated, and these reconstructed video encoding blocks are stored in the decoded image buffer unit 110 .

[0232] FIG17 is a schematic diagram of the composition structure of a decoder provided by an embodiment of the present application. As shown in FIG17 , the decoder 200 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra-frame prediction unit 203, a motion compensation unit 204, a filtering unit 205, and a decoded image cache unit 206, among others. The decoding unit 201 can implement header information decoding and CABAC decoding, and the filtering unit 205 can implement deblocking filtering and SAO filtering. After the input video signal undergoes the encoding process of FIG16 , a code stream of the video signal is output; the code stream is input to the decoder 200, and first passes through the decoding unit 201 to obtain the decoded transform coefficients; the transform coefficients are processed by the inverse transform and inverse quantization unit 202 to generate residual blocks in the pixel domain; the intra-frame prediction unit 203 can be used to generate prediction data for the current video decoding block based on the determined intra-frame prediction mode and the data of the previously decoded block from the current frame or picture; the motion compensation unit 204 is to determine the prediction information for the video decoding block by analyzing the motion vector and other associated syntax elements, and use The prediction information is used to generate a predictive block for the video decoding block being decoded; a decoded video block is formed by summing the residual block from the inverse transform and inverse quantization unit 202 with the corresponding predictive block generated by the intra-frame prediction unit 203 or the motion compensation unit 204; the decoded video signal passes through the filtering unit 205 to remove blocking artifacts, thereby improving video quality; the decoded video block is then stored in the decoded image buffer unit 206, which stores reference images used for subsequent intra-frame prediction or motion compensation, and is also used for outputting the video signal, thereby obtaining the restored original video signal.

[0233] Furthermore, an embodiment of the present application also provides a network architecture of a codec system including an encoder and a decoder, wherein FIG18 is a schematic diagram of a network architecture of a codec system provided by an embodiment of the present application. As shown in FIG18 , the network architecture includes one or more electronic devices 13 to 1N and a communication network 01, wherein the electronic devices 13 to 1N can perform video interaction through the communication network 01. During implementation, the electronic device can be various types of devices with video codec functions. For example, the electronic device can include a smart phone, a tablet computer, a personal computer, a personal digital assistant, a navigator, a digital phone, a video phone, a television, a sensor device, a server, etc., which are not specifically limited here.

[0234] It should be noted that the decoder or encoder in the embodiment of the present application can be the above-mentioned electronic device. Among them, the encoder can also be called a "video encoder" or "image encoder", and the decoder can also be called a "video decoder" or "image decoder".

[0235] It should be noted that the method of the embodiment of the present application is mainly applied to the intra-frame prediction unit 103 shown in Figure 16 and the intra-frame prediction unit 203 shown in Figure 17. In other words, the embodiment of the present application can be applied to both the encoder and the decoder, and can even be applied to both the encoder and the decoder at the same time, but the embodiment of the present application is not specifically limited thereto.

[0236] In one embodiment of the present application, FIG19 is a flowchart diagram of a decoding method provided by the embodiment of the present application. As shown in FIG19 , the method may include:

[0237] S1901, determine the first candidate list of the current block.

[0238] It should be noted that the decoding method of the embodiments of the present application is applied to a decoder. Furthermore, the decoding method may specifically refer to an intra-frame prediction method, more specifically, an intra-frame prediction method based on an intra TMP extended block vector list. Here, by fully utilizing reconstructed information from spatially adjacent and non-adjacent locations, the coverage of the first candidate list is increased, thereby improving prediction accuracy.

[0239] It should also be noted that, in the embodiment of the present application, a video image can be divided into multiple decoding blocks, each of which can include a first color component, a second color component, and a third color component. The current block in the embodiment of the present application refers to the decoding block in the video image that is currently to be intra-frame predicted. If the current block predicts the first color component, and the first color component is a luminance component, then the current block can also be called a luminance block; or if the current block predicts the second color component, and the second color component is a chrominance component, then the current block can also be called a chrominance block.

[0240] It should also be noted that, in this embodiment of the present application, the first candidate list may include one or more candidate vector parameters. The vector parameters may include block vector parameters and / or motion vector parameters. In other words, the first candidate list may include a list of multiple candidate BVs or a list of multiple candidate MVs.

[0241] Exemplarily, the block vector parameter may also be referred to as a block vector parameter, which may be specifically used to indicate the position of the reference block relative to the current block, that is, the offset between the current block and the reference block is the block vector parameter.

[0242] In some embodiments, for determining a first candidate list for the current block, the method may include: determining a first search area for the current block; and determining the first candidate list for the current block according to the first search area.

[0243] It should be noted that, in the embodiment of the present application, determining the first search area of ​​the current block may include: determining a first template of the current block; and determining the first search area of ​​the current block based on the first template.

[0244] In an embodiment of the present application, the template type of the current block may be determined first, and then the first template of the current block may be determined based on the template type. Determining the template type of the current block may include: determining the template type of the current block based on reference pixels of the current block; or determining the template type of the current block based on indication information in a bitstream; or determining the template type of the current block based on a size parameter of the current block.

[0245] In an embodiment of the present application, the reference pixels of the current block include at least one of the following: a left adjacent reference pixel of the current block, an upper adjacent reference pixel of the current block, and an upper-left adjacent reference pixel of the current block.

[0246] It is understood that in the embodiments of the present application, the reference pixel (Reference Sample) of the current block may refer to a reference pixel point adjacent to the current block; wherein, adjacent here may be spatially adjacent, but is not limited to this. For example, adjacent may also mean temporal adjacent, spatially and temporally adjacent, or even the reference pixel of the current block may be a reference pixel obtained by performing some processing on spatially adjacent, temporally adjacent, or spatially and temporally adjacent reference pixels, etc., and the embodiments of the present application do not specifically limit this.

[0247] It is also understood that, in the embodiment of the present application, the reference pixels of the current block may include the adjacent reconstructed pixels of the current block, that is, the adjacent reconstructed pixels of the current block may be selected as a template to search for a matching template within the first search area. It should be noted that, in the embodiment of the present application, the reference pixels of the current block, that is, the adjacent reconstructed pixels of the current block may include the upper reference pixel, the upper left reference pixel, the upper right reference pixel, the left reference pixel, and the lower left reference pixel of the current block.

[0248] It can also be understood that in the embodiment of the present application, when using the reference pixels of the current block to determine the template type of the current block, the template type can be classified and determined according to the availability of adjacent reference pixels.

[0249] In some embodiments, when determining the template type of the current block based on the reference pixels of the current block, if the left adjacent reference pixels of the current block, the upper adjacent reference pixels of the current block and the upper-left adjacent reference pixels of the current block are all available, the template type of the current block is determined to be a first value; if the left adjacent reference pixels of the current block are available, the template type of the current block is determined to be a second value; if the upper adjacent reference pixels of the current block are available, the template type of the current block is determined to be a third value; if the left adjacent reference pixels of the current block and the upper-left adjacent reference pixels of the current block are both available, the template type of the current block is determined to be a fourth value; if the left adjacent reference pixels of the current block and the lower-left adjacent reference pixels of the current block are both available, the template type of the current block is determined to be a fifth value; if the upper adjacent reference pixels of the current block and the upper-right adjacent reference pixels of the current block are both available, the template type of the current block is determined to be a sixth value.

[0250] It should be noted that in the embodiments of the present application, in some cases, if both the left adjacent reference pixels of the current block and the upper adjacent reference pixels of the current block are available, the template type of the current block is determined to be the first value. In other words, for an L-type template, in some cases there may be no upper left adjacent reference pixels.

[0251] It should be noted that in the embodiments of the present application, the first value, the second value, the third value, the fourth value, the fifth value, and the sixth value can be any values ​​and are not specifically limited in this application. For example, the first value, the second value, the third value, the fourth value, the fifth value, and the sixth value can be 1, 2, 3, 4, 5, and 6, respectively.

[0252] For example, in an embodiment of the present application, refTemplateType can be used to represent the template type. Accordingly, as shown in FIG3 above, the block filled with the grid is the current block, and the adjacent area of ​​the current block is the template T. Six template types are shown here.

[0253] Exemplarily, these six template types are as follows: when the upper 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 shown in (a) in Figure 3; when only the left reference pixel is available, the value of refTemplateType is 2, and the template shape is shown in (b) in Figure 3; when only the upper reference pixel is available, the value of refTemplateType is 3, and the template shape is shown in (c) in Figure 3; when only the left reference pixel and the upper left reference pixel are available, the value of refTemplateType is 4, and the template shape is shown in (d) in Figure 3; when only the left reference pixel and the lower left reference pixel are available, the value of refTemplateType is 5, and the template shape is shown in (e) in Figure 3; when only the upper reference pixel and the upper right reference pixel are available, the value of refTemplateType is 6, and the template shape is shown in (f) in Figure 3.

[0254] In some embodiments, the template type of IntraTMP can also be selected in combination with the availability information of the reference pixels described above and according to the indication in the code stream. For example, the serial number of each template type is agreed upon, and the serial number information of the template actually used is transmitted in the code stream, so that the template type can be determined at the decoding end. That is to say, in the embodiments of the present application, it is possible to determine the template type based on the availability information of the reference pixels of the current block, or to determine the template type based on the information indicated in the code stream, or to determine the template type based on the availability information of the reference pixels and the information indicated in the code stream. This application does not make any specific limitations.

[0255] Furthermore, in an embodiment of the present application, when determining the first template corresponding to the current block based on the template type, it can also include: determining the template reference pixels of the current block based on the template type and the template size corresponding to the template type; and then determining the first template of the current block based on the template reference pixels.

[0256] It should be noted that, in the embodiment of the present application, the first template of the current block may include template reference pixels of the current block, wherein the template reference pixels of the current block may be determined by the template type of the current block and the template size corresponding to the template type.

[0257] It should also be noted that, in an embodiment of the present application, the first template of the current block can be composed of reconstructed pixels of one or more areas above, upper right, left, lower left, and upper left of the current block, that is, it can be composed of reference pixels of the current block.

[0258] It should also be noted that in the embodiments of the present application, the template size corresponding to the template type can be pre-set, can be indicated by a bitstream syntax element, or can be adaptively selected based on the block size or other information. For example, when obtaining the left template, the template width templateW_size can be set to 4, and when obtaining the upper template, the template height templateH_size can be set to 4.

[0259] Accordingly, in the embodiment of the present application, the value of the template type refTemplateType of the current block and the template size corresponding to the refTemplateType are combined to determine which portion of the reconstructed pixels to obtain as the template reference pixels of the current block, and thus the corresponding first template can be determined. For example, when the value of refTemplateType is 1, the left, upper left, and upper reconstructed pixels of the current block can be obtained; when the value of refTemplateType is 2, only the left four columns of reconstructed pixels of the current block are obtained; when the value of refTemplateType is 3, only the upper four rows of reconstructed pixels of the current coding block are obtained.

[0260] Of course, the value of the preset template size can be any integer greater than 0 and is not limited to 4, and is not specifically limited here.

[0261] That is to say, in the embodiment of the present application, in combination with the template type and the corresponding template size of the current block, the template reference pixels of the current block determined from the reference pixels of the current block may be the first template corresponding to the current block.

[0262] It can be understood that in an embodiment of the present application, the search process of the vector parameters may include an initialization process, determining the search area of ​​the first template in the current frame (first search area), searching and determining one or a pair of optimal vector parameters in the first search area. Therefore, when performing the search process, the initialization operation needs to be completed first.

[0263] Exemplarily, as shown in FIG5 , nTbW and nTbH represent the size of the current block, templateW_size and templateH_size represent the template size, and uiPatchWidth and uiPatchHeight represent the block size including the current block and its template.

[0264] Accordingly, during initialization, uiPatchWidth can be initialized to nTbW + templateW_size, and uiPatchHeight can be initialized to nTbH + templateH_size, where templateW_size and templateH_size can be fixed constants, or indicated by codestream syntax elements, or dynamically adjusted according to the current block size or other information. TemplateW_size and templateH_size can be equal or unequal. For example, templateW_size = 4, templateH_size = 4; or, when the width of the current block is greater than 8, templateW_size = 4; when the width of the current block is less than or equal to 8, templateW_size = 2; when the height of the current block is greater than 8, templateH_size = 4; when the height of the current block is less than or equal to 8, templateH_size = 2.

[0265] Furthermore, the cost threshold between the initialization templates is represented by diffThreshold. For example, when the cost function is SAD, the threshold can be: diffThreshold = ((1 <<bitDepth)> >2)×(uiPatchHeight×uiPatchWidth-nTbH×nTbW). When the image bit depth bitDepth is 10, diffThreshold indicates that the distortion threshold of each pixel in the template area is 256.

[0266] Furthermore, the position of the coding tree block CTB where the current block CB is located is initialized: ctbRsX, ctbRsY.

[0267] Furthermore, the position offset of the current block CB in the current CTB is initialized: offsetLCBY=yTbCmp−ctbRsY, offsetLCBX=xTbCmp−ctbRsX.

[0268] Furthermore, initialize iTemplateSizeH=templateH_size and iTemplateSizeW=templateW_size.

[0269] Furthermore, iBvShift is initialized, where iBvShift is the precision of the vector parameter BV. For example, the precision of BV can be integer pixel precision, in which case iBvShift is 0; BV precision can also be sub-pixel precision, for example, iBvShift of 1 indicates 1 / 2 pixel precision, and iBvShift of 2 indicates 1 / 4 pixel precision. This is not specifically limited here.

[0270] Furthermore, the preset search range of the template is initialized. The preset search range of the template can be set to a fixed size or dynamically adjusted based on the size of the current block. For example, searchRangeWidth = TMP_SEARCH_RANGE_MULT_FACTOR × nTbW, searchRangeHeight = TMP_SEARCH_RANGE_MULT_FACTOR × nTbH. The value of TMP_SEARCH_RANGE_MULT_FACTOR can be a preset value, can be indicated by a bitstream syntax element, or can be adaptively adjusted based on information such as the size of the current block, for example, set to 5.

[0271] It is also understandable that in the embodiment of the present application, the first search area may include a first-type search area and / or a second-type search area. The first-type search area is a rectangular search area surrounding the current block; the second-type search area is an area pointed to by the vector parameter corresponding to the preset search position of the current block and an area pointed to by automatic relocation.

[0272] Here, the first type of search area includes a full reconstruction area and / or a pending reconstruction area, wherein all sampling points in the full reconstruction area are reconstructed sampling points, and sampling points in the pending reconstruction area include reconstructed sampling points and / or unreconstructed sampling points.

[0273] That is to say, in the embodiment of the present application, the first search area can be divided into two types:

[0274] One is the surrounding rectangular search area, which can also be divided into two types: one is the area where all sampling points have been reconstructed (called the full reconstruction area), for example, including the four areas R1 to 4 in Figure 6; the other is the area where it is uncertain whether all sampling points have been reconstructed (called the pending reconstruction area), for example, including the two areas R5 to R6 in Figure 6.

[0275] One is an extended search area: defined as the area pointed to by the BV corresponding to spatially adjacent and non-adjacent PUs. In the embodiment corresponding to Figure 6, this area can be considered R7; and the area pointed to by the automatic relocation, which can be considered R8. Since the search points in R7 and / or R8 are not necessarily adjacent to each other, the search of the R7 and / or R8 areas is performed point by point according to the list.

[0276] In some embodiments, determining a first candidate list for the current block based on the first search area may include: searching within the first search area based on a first search step to determine one or more first candidate vector parameters; and adding the one or more first candidate vector parameters to the first candidate list for the current block.

[0277] In a specific embodiment, searching within a first search area according to a first search step size to determine one or more first candidate vector parameters may include: traversing search points in the first search area according to the first search step size, and determining a first matching cost value between a matching template corresponding to the search point in the first search area and the first template according to a preset matching criterion; determining one or more matching search points according to the first matching cost value, and determining one or more first candidate vector parameters based on the one or more matching search points.

[0278] It should be noted that, in the embodiment of the present application, the first search step can be set to 3, and the first candidate list obtained at this time can be called an initial rough search list.

[0279] It should also be noted that in the embodiment of the present application, the preset matching criteria may include any one of the absolute error sum SAD, the transformed absolute error sum SATD, the difference square sum SSE, the mean absolute difference MAD, the mean absolute error MAE, the mean square error MSE, and the normalized correlation coefficient NCC.

[0280] In a possible implementation, when traversing the search points in the first search area, the following steps may be specifically included:

[0281] For the entire reconstruction area (e.g., corresponding to the four regions R1 to R4 in Figure 6), a matching reconstructed block for the current block can be found in the reconstruction area through the search points (iPosHor, iPoxVer) within each search area, that is, each block vector BV (composed of horizontal and vertical components: (pX, pY), where pX = iPosHor - xTbCmp, pY = iPosVer - yTbCmp, pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs). The adjacent reconstructed pixels of the matching reconstructed block are the matching template. This allows the matching cost between the adjacent template of the current block and the adjacent template of the reconstructed block to be calculated, denoted as pDiff.

[0282] For the area to be reconstructed (e.g., corresponding to the two areas R5 to R6 in FIG6 ), the availability is judged by the search points (iPosHor, iPoxVer) in each search area, that is, each block vector BV (composed of horizontal and vertical components: (pX, pY), where pX = iPosHor-xTbCmp, pY = iPosVer-yTbCmp, then pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs):

[0283] If available, a matching reconstructed block for the current block can be found in the reconstructed area. The adjacent reconstructed pixels of the matching reconstructed block are the matching template. From this, the matching cost between the adjacent template of the current block and the adjacent template of the reconstructed block can be calculated, also recorded as pDiff.

[0284] If not available, no template matching cost calculation is performed.

[0285] Availability judgment includes but is not limited to one or more of the following conditions being met simultaneously:

[0286] ● Each sampling point in the template does not exceed the valid coordinate range limited by the image sampling point boundary;

[0287] ● Each sampling point in the template's corresponding reconstruction block does not exceed the valid coordinate range limited by the image sampling point boundary;

[0288] ● Each sampling point in the template and each sampling point in the corresponding reconstructed block does not exceed the specified range of the search window;

[0289] ●Whether each sampling point in the template is in the same tile as the current encoding area;

[0290] ●Whether the sampling points in the reconstructed block corresponding to the template are in the same tile as the current coding area;

[0291] ●All sampling points in the template have been reconstructed;

[0292] ● Each sampling point in the reconstructed block corresponding to the template is not in the current coding area;

[0293] ●All sampling points in the reconstruction block corresponding to the template have been reconstructed;

[0294] Traverse all available search points in all search ranges (regionId = 0, 1, 2, 3, 4, 5), and compare to obtain the 30 search points with the smallest matching cost pDiff. The corresponding matching cost is recorded as pDiff_BEST[n], n = 0, ..., 29, and the corresponding block vector BV is recorded as the best block vector BV_BEST[n]. Each item is a coordinate pair (pX_BEST, pY_BEST), n = 0, ..., 29, and the corresponding matching template is the best matching template T_BEST[n], n = 0, ..., 29.

[0295] Thus, in the embodiment of the present application, assuming that the first search step is 3, a search is performed within the first search area with a step size of 3. For example, within each region, when pX is between bvXMinsregionId and bvXMaxsregionId, and pY is within the search range between bvYMinsregionId and bvYMaxsregionId, a coarse search is performed with a step size of 3, and then the first P best matching costs obtained by template matching are recorded as pDiff1_BEST[p], p=0,…,P-1, and the corresponding block vector BV is recorded as the best block vector BV1_BEST[p], p=0,…,P-1. Where P can be an integer value of 1 or greater than 1 as needed, and the search area where the best matching search point is located is bestRegionId[p], p=0,…,P-1. In this way, a first candidate list can be constructed based on the P best block vectors BV1_BEST[p].

[0296] S1902: Determine a second position block according to candidate vector parameters in the first candidate list and / or vector parameters of the first position block of the current block.

[0297] S1903 : When the decoding parameters of the second position block include vector parameters, determine whether the vector parameters of the second position block meet a second condition according to the vector parameters of the second position block.

[0298] It should be noted that, in the embodiment of the present application, the first position block of the current block may include blocks in spatially adjacent positions and / or non-adjacent positions. In addition, the number of the first position blocks may be one or more.

[0299] Exemplarily, for the predefined one or more first position blocks, the predefined search positions may be, for example, five positions spatially adjacent to the current block: left (xTbCmp-1, yTbCmp+nTbH-1), upper left (xTbCmp-1, yTbCmp-1), upper (xTbCmp+nTbW-1, yTbCmp-1), upper right (xTbCmp+nTbW, yTbCmp-1), lower left (xTbCmp-1, yTbCmp+nTbH) and 18 spatially non-adjacent positions (as specifically shown in FIG9 ).

[0300] It should also be noted that, in an embodiment of the present application, determining the second position block may include: determining the second position block based on the candidate vector parameters in the first candidate list; and / or determining the second position block based on the vector parameters of the first position block of the current block.

[0301] That is to say, in an embodiment of the present application, the second position block can be determined based on the candidate vector parameters in the first candidate list, or the second position block can be determined based on the vector parameters of the first position block, or the second position block can be determined based on the candidate vector parameters in the first candidate list and the vector parameters of the first position block, without specific limitation here.

[0302] In some embodiments, when determining the second position block based on the vector parameters of the first position block of the current block, the method may further include: when the decoding parameters of the first position block of the current block include vector parameters, determining whether the vector parameters of the first position block meet the first condition based on the vector parameters of the first position block; when the vector parameters of the first position block meet the first condition, determining the second position block based on the vector parameters of the first position block.

[0303] It should be noted that in an embodiment of the present application, when the vector parameter is BV, if the first position block of the current block uses a BV-based prediction technology (ie, IBC / IntraTMP), then it can be determined that the decoding parameters of the first position block of the current block include vector parameters.

[0304] It should also be noted that, in the embodiment of the present application, the first condition may include: the cost value corresponding to the vector parameter of the first position block is better than the cost value corresponding to at least one candidate vector parameter in the first candidate list. In other words, if the cost value corresponding to the vector parameter of the first position block is better than the cost value corresponding to at least one candidate vector parameter in the first candidate list, then the vector parameter of the first position block is determined to meet the first condition.

[0305] In some embodiments, for determining that the vector parameters of the first position block meet the first condition, the method also includes: determining the cost value corresponding to the vector parameters of the first position block based on the matching cost value between the matching template corresponding to the vector parameters of the first position block and the first template; determining the cost value corresponding to at least one candidate vector parameter in the first candidate list based on the matching cost value between the matching template corresponding to at least one candidate vector parameter in the first candidate list and the first template; when the cost value corresponding to the vector parameters of the first position block is less than the cost value corresponding to at least one candidate vector parameter in the first candidate list, it is determined that the vector parameters of the first position block meet the first condition.

[0306] It should also be noted that, in the embodiment of the present application, the method further includes: when the vector parameter of the first position block meets the first condition, updating the first candidate list according to the vector parameter of the first position block.

[0307] In a specific embodiment, updating the first candidate list according to the vector parameter of the first position block may include: adding the vector parameter of the first position block to the first candidate list.

[0308] That is, when the vector parameters of the first position block meet the first condition, the first candidate list can be updated using the vector parameters of the first position block. For example, the vector parameters of the first position block can be added to the first candidate list according to the size of the cost value, and the item with the largest cost value in the first candidate list can be deleted to obtain an updated first candidate list.

[0309] It should also be noted that, in the embodiment of the present application, the method further includes: determining the search region where the vector parameter of the first position block is located as R6, that is, the value of bestRegionId is set to 6.

[0310] It should also be noted that in an embodiment of the present application, during the update process, it is first checked whether the PUs corresponding to these predefined search positions use the IntraTMP / IBC technology, that is, whether the decoding parameters of the PUs corresponding to these predefined search positions contain vector parameters. If they contain vector parameters, the BV of this PU is determined, and then the first candidate list is updated using this BV. The specific operation of the update is: access each item in the first candidate list in turn, calculate the template matching cost corresponding to each BV, compare this cost with the template matching cost of the first candidate list, and if it is less than the largest cost value in the first candidate list, replace this BV with the worse BV in the first candidate list. For example, the specific operation can be: insert this BV into the first candidate list in order of cost size, and delete the item with the largest cost in the first candidate list. And set the value of the bestRegionId of the search area where it is located to 6.

[0311] It can be understood that, in the embodiment of the present application, the number of the second location blocks can be one or more.

[0312] It should also be noted that, in the embodiment of the present application, the second position block represents the reference block pointed to by the vector parameter of the first position block, or the second position block represents the block pointed to by the vector parameter of the reference block pointed to by the vector parameter of the first position block.

[0313] It should also be noted that in the embodiment of the present application, still taking the vector parameter as BV as an example, if the second position block uses the BV-based prediction technology (ie IBC / IntraTMP), then it can be determined that the decoding parameters of the second position block include vector parameters.

[0314] Exemplarily, for the second position block, the vector parameters of the first position block are used as the current BV. First, several candidate positions of the current block are determined, for example, five candidate positions: center (xTbCmp+nTbW / 2, yTbCmp+nTbH / 2), upper left (xTbCmp, yTbCmp), upper right (xTbCmp+nTbW-1, yTbCmp), lower left (xTbCmp, yTbCmp+nTbH-1), and lower right (xTbCmp+nTbW-1, yTbCmp+nTbH-1). Then, it is checked whether the corresponding PU after adding the coordinates of these five candidate positions to the current BV uses a BV-based prediction mode (i.e., IBC / IntraTMP). If used, the newly obtained BV is regarded as the current BV, and the above operation is repeated to determine the vector parameters of the second position block (also referred to as "extended BV"). In other words, in the embodiment of the present application, the extended BV can be the BV stored in the block pointed to by the current BV, or the BV stored in the block pointed to by the BV of the block pointed to by the current BV, and so on.

[0315] In some embodiments, the second condition may include: a cost value corresponding to the vector parameter of the second position block is better than a cost value corresponding to at least one candidate vector parameter in the first candidate list. In other words, if the cost value corresponding to the vector parameter of the second position block is better than a cost value corresponding to at least one candidate vector parameter in the first candidate list, then the vector parameter of the second position block is determined to meet the second condition.

[0316] It should also be noted that, in an embodiment of the present application, the method further includes: determining a cost value corresponding to the vector parameters of the second position block based on a matching cost value between the matching template corresponding to the vector parameters of the second position block and the first template; determining a cost value corresponding to at least one candidate vector parameter in the first candidate list based on a matching cost value between the matching template corresponding to at least one candidate vector parameter in the first candidate list and the first template; when the cost value corresponding to the vector parameters of the second position block is less than a cost value corresponding to at least one candidate vector parameter in the first candidate list, determining that the vector parameters of the second position block meet the second condition.

[0317] S1904: When the vector parameter of the second position block meets the second condition, update the first candidate list according to the vector parameter of the second position block.

[0318] It should be noted that, in the embodiment of the present application, the vector parameters of the second position block may be one or more vector parameters of the second position block. Determination of the vector parameters of the second position block may cease when all vector parameters of the first position block are traversed or the number of vector parameters of the second position block obtained is greater than a first threshold.

[0319] It should also be noted that, in the embodiment of the present application, the first threshold value can be represented by V. For example, the value of V can be 15, but it can also be other values, such as 1, 2, 5, 10, etc., which are not specifically limited here.

[0320] In some embodiments, updating the first candidate list according to the vector parameters of the second position block may include: adding the vector parameters of the second position block to the first candidate list.

[0321] That is, when the vector parameters of the second position block meet the second condition, the first candidate list can be updated using the vector parameters of the second position block. For example, the vector parameters of the second position block can be added to the first candidate list according to the cost value, and the item with the largest cost value in the first candidate list can be deleted to obtain an updated first candidate list.

[0322] In some embodiments, the method further includes: determining the search region where the vector parameter of the second position block is located as R7, that is, setting the value of bestRegionId to 7.

[0323] It should be noted that in the embodiment of the present application, for the vector parameters of the obtained first position block, first, for each current BV, the five positions of the current block are determined: center (xTbCmp+nTbW / 2, yTbCmp+nTbH / 2), upper left (xTbCmp, yTbCmp), upper right (xTbCmp+nTbW-1, yTbCmp), lower left (xTbCmp, yTbCmp+nTbH-1), and lower right (xTbCmp+nTbW-1, yTbCmp+nTbH-1), and it is checked whether the corresponding PU after adding the current BV to these five position coordinates uses the BV-based prediction technology (ie, IBC / IntraTMP). If it is used, the sum of the BV stored in the corresponding PU and the current BV (vector sum, i.e., the horizontal and vertical components are added separately) is recorded as BV', and BV' is then regarded as the current BV. The above operation is repeated for this BV' to continue to determine the available options for the extended BV. If it is not used, the next position is checked. Repeat the above operation until all five positions are checked or the number of extended BVs determined is greater than V, then stop determining the vector parameters of the second position block.

[0324] It should also be noted that after obtaining multiple extended BVs, the first candidate list is further updated. The specific operation of the update is: for multiple extended BVs, calculate the corresponding template matching cost, compare this cost with the template matching cost of the BV in the first candidate list, and if it is less than the maximum template matching cost in the first candidate list, replace this BV with the worse BV in the first candidate list. Specific replacement operations include: inserting this BV into the first candidate list in order of cost size, and deleting the item with the highest cost in the first candidate list. Set the value of bestRegionId of the search area where the BV newly inserted into the first candidate list is located to 7.

[0325] That is, in an embodiment of the present application, when the BV of the first position block (the spatially adjacent position and / or non-adjacent position of the current block) is better than at least one BV in the first candidate list (the first condition), then the block pointed to by the BV of the first position block is checked. If the block pointed to by the BV of the first position block also has a BV, it is determined (the second condition) whether to add the BV to the first candidate list. At the same time, another feature of the embodiment of the present application is that the first position block can contribute two candidate BVs to the first candidate list (adding one BV when the first condition is met and adding another BV when the second condition is met) to obtain an updated first candidate list (i.e., the final rough search list).

[0326] In another embodiment of the present application, FIG20 is a second flow chart of a decoding method provided by the embodiment of the present application. As shown in FIG20 , the method may include:

[0327] S2001, determining the first candidate list of the current block.

[0328] It should be noted that in the embodiment of the present application, a first template of the current block is first determined; then, based on the first template, a first search area of ​​the current block is determined; and then, a search is performed within the first search area with a step size of 3 to construct an initial coarse search list (i.e., a first candidate list). The first candidate list may include one or more candidate vector parameters.

[0329] S2002: When the decoding parameters of the first position block of the current block include vector parameters, determine whether the vector parameters of the first position block meet a first condition according to the vector parameters of the first position block.

[0330] S2003 : When the vector parameter of the first position block meets the first condition, determine a first candidate set of the current block according to the vector parameter of the first position block, and update the first candidate list according to the first candidate set.

[0331] It should also be noted that, in the embodiment of the present application, the first position block of the current block may include blocks in spatially adjacent positions and / or non-adjacent positions. In addition, the number of the first position blocks may be one or more.

[0332] Exemplarily, for the predefined one or more first position blocks, the predefined search positions may be, for example, five positions spatially adjacent to the current block: left (xTbCmp-1, yTbCmp+nTbH-1), upper left (xTbCmp-1, yTbCmp-1), upper (xTbCmp+nTbW-1, yTbCmp-1), upper right (xTbCmp+nTbW, yTbCmp-1), lower left (xTbCmp-1, yTbCmp+nTbH) and 18 spatially non-adjacent positions (as specifically shown in FIG9 ).

[0333] It should also be noted that in embodiments of the present application, the first candidate set can be represented by IntraTMP_Merge. In some embodiments, updating the first candidate list based on the first candidate set may include: determining a cost value corresponding to a second candidate vector parameter in the first candidate set, and determining a maximum cost value corresponding to one or more candidate vector parameters in the first candidate list; when the cost value corresponding to the second candidate vector parameter is less than the maximum cost value in the first candidate list, replacing the candidate vector parameter corresponding to the maximum cost value in the first candidate list with the second candidate vector parameter to update the first candidate list. The second candidate vector parameter is any vector parameter in the first candidate set.

[0334] In a specific embodiment, replacing the candidate vector parameter corresponding to the maximum cost value in the first candidate list with the second candidate vector parameter may include: adding the second candidate vector parameter to the first candidate list, and deleting the candidate vector parameter corresponding to the maximum cost value from the first candidate list.

[0335] Exemplarily, in an embodiment of the present application, the construction process of the IntraTMP_Merge set (or IntraTMP_Merge list) can be specifically: check whether the PUs corresponding to these positions use the IntraTMP / IBC technology. If they do, the BV of this PU is stored in the IntraTMP_Merge set. After constructing the IntraTMP_Merge set, the first candidate list is updated according to the IntraTMP_Merge set. The specific operation of the update is: access each item of the IntraTMP_Merge set in turn, calculate the template matching cost corresponding to each BV, compare this cost with the template matching cost of the first candidate list, and if it is less than the maximum template matching cost in the first candidate list, replace this BV with the worse BV in the first candidate list. Specific operations, for example: insert this BV into the first candidate list in order of cost size, and delete the item with the highest cost in the first candidate list. And set the search area bestRegionId where it is located to 6.

[0336] S2004: When the vector parameter of the second position block meets the second condition, determine a second candidate set of the current block according to the vector parameter of the second position block, and update the first candidate list according to the second candidate set.

[0337] It should be noted that, in this embodiment of the present application, after the first candidate list is updated based on the first candidate set, the second position block can be determined based on at least some of the candidate vector parameters in the updated first candidate list. Furthermore, when the vector parameters of the second position block meet a second condition, a second candidate set for the current block is constructed based on the vector parameters of the second position block.

[0338] In one possible implementation, at least some of the candidate vector parameters in the updated first candidate list may be one or more second candidate vector parameters updated from the first candidate set to the first candidate list. Therefore, in some embodiments, determining the second candidate set for the current block may include: determining one or more second candidate vector parameters updated from the first candidate set to the first candidate list; determining a second position block based on the one or more second candidate vector parameters; and determining the second candidate set for the current block based on the vector parameters of the second position block.

[0339] In another possible implementation, at least some of the candidate vector parameters in the updated first candidate list may be all of the candidate vector parameters in the updated first candidate list. Therefore, in some embodiments, determining the second candidate set for the current block may include: after updating the first candidate list based on the first candidate set, determining a second position block based on all of the candidate vector parameters in the first candidate list, and determining the second candidate set for the current block based on the vector parameters of the second position block.

[0340] In another possible implementation, at least some of the candidate vector parameters in the updated first candidate list may be a preset number of candidate vector parameters in the updated first candidate list. Therefore, in some embodiments, determining the second candidate set for the current block may include: after updating the first candidate list based on the first candidate set, determining the first N candidate vector parameters in the first candidate list; determining a second position block based on the N candidate vector parameters, and determining a second candidate set for the current block based on the vector parameters of the second position block; wherein N is a positive integer.

[0341] It should be noted that in this embodiment of the present application, the method further includes: determining the value of N based on the size parameter of the current block. In other words, the number of checks can be limited based on the size of the current block. For example, for a current block with a size less than or equal to 16x16, the first 5 blocks are checked, and for other sizes, the first 10 blocks are checked.

[0342] In another possible implementation, determining the second candidate set of the current block may include: after updating the first candidate list based on the first candidate set, clustering the first candidate list to determine M candidate vector parameters at the cluster center; determining the second position block based on the M candidate vector parameters, and determining the second candidate set of the current block based on the vector parameters of the second position block; wherein M is a positive integer.

[0343] It should also be noted that in this embodiment of the present application, the second candidate set can be represented by IntraTMP_EBVP. When constructing the IntraTMP_EBVP set (or IntraTMP_EBVP list), only all BVs replaced by the IntraTMP_Merge set in the first candidate list can be checked. Alternatively, all options in the updated first candidate list can be updated based on the EBVP.

[0344] In addition, in an embodiment of the present application, the BV objects and their number checked by the IntraTMP_EBVP set can also be adjusted. For example, the first 5 of the corresponding BV set can be used for inspection, or the first 10 of the corresponding BV set can be used for inspection. Or the number of inspections can be limited according to the size of the current block, for example, the first 5 CUs with a size less than or equal to 16x16 are inspected, and the first 10 CUs with other sizes are inspected. Or the updated first candidate list can be clustered, and the clustering rule is the geometric distance to the cluster center. The number of cluster centers is 2 to 5, for example, only the cluster center is subjected to EBVP operation.

[0345] In another possible implementation, the second candidate set may not be constructed. The method further includes: when the first candidate set of the current block is not full, filling the first candidate set with vector parameters of the second position block until the first candidate set is full; and updating the first candidate list based on the full first candidate set.

[0346] That is to say, in the embodiment of the present application, the BV of EBVP can be added after the IntraTMP_Merge set until the IntraTMP_Merge set is filled, and then the first candidate list is updated with this IntraTMP_Merge set, that is, the number is limited to the number of unfilled items in the IntraTMP_Merge set.

[0347] For example, in an embodiment of the present application, after the first candidate list is updated according to the IntraTMP_Merge set, for each BV replaced by the IntraTMP_Merge set into the first candidate list, an IntraTMP_EBVP set is constructed and the first candidate list is updated again according to the set:

[0348] First, for each current BV, build its corresponding IntraTMP_EBVP set from scratch. Determine the five positions of the current CU: center (xTbCmp+nTbW / 2,yTbCmp+nTbH / 2), top left (xTbCmp,yTbCmp), top right (xTbCmp+nTbW-1,yTbCmp), bottom left (xTbCmp,yTbCmp+nTbH-1), bottom right (xTbCmp+nTbW-1,yTbCmp+nTbH-1), and check whether the corresponding PU after adding the current BV to these five position coordinates uses BV-based prediction technology (i.e., IBC / IntraTMP). If used, the sum of the BV stored in the corresponding PU and the current BV (vector sum, i.e., the horizontal and vertical components are added separately) is recorded as BV' and added to the TMP_EBVP set. Then BV' is regarded as the current BV and the above operation is repeated for this BV' to continue to construct the available options in the TMP_EBVP set; if not used, check the next position.

[0349] In some embodiments, the method further includes: when all vector parameters of the second position block are traversed or the number of candidate vector parameters in the second candidate set is greater than a first threshold, determining that the construction of the third candidate set is completed.

[0350] It should be noted that in the embodiment of the present application, the first threshold can be represented by V, or the length of the second candidate set is V. For example, the value of V can be 15. Alternatively, the length V of the IntraTMP_EBVP set can be changed to another value, for example, the value of V can be limited to 1, 2, 5, or 10.

[0351] In this way, the above operation is repeated until all five positions are checked or the number of IntraTMP_EBVP sets being constructed is greater than V, thereby completing the construction of the current IntraTMP_EBVP set.

[0352] In some embodiments, after constructing the second candidate set, the method further includes: determining a second matching cost between a matching template corresponding to a third candidate vector parameter in the second candidate set and the first template according to a preset matching criterion; and when the second matching cost is greater than a second threshold, deleting the third candidate vector parameter from the second candidate set to update the second candidate set. The third candidate vector parameter is any vector parameter in the second candidate set.

[0353] That is to say, in an embodiment of the present application, restrictions can be imposed based on the template cost corresponding to the BV (such as SAD, SATD, etc.), and the template cost of each BV in the second candidate set is first calculated, and a cost threshold is defined. BVs that do not exceed the threshold are then added to the IntraTMP_EBVP set to obtain the final second candidate set.

[0354] In some embodiments, updating the first candidate list based on the second candidate set may include: determining a cost value corresponding to a third candidate vector parameter in the second candidate set, and determining a maximum cost value corresponding to one or more candidate vector parameters in the first candidate list; and when the cost value corresponding to the third candidate vector parameter is less than the maximum cost value in the first candidate list, replacing the candidate vector parameter corresponding to the maximum cost value in the first candidate list with the third candidate vector parameter to update the first candidate list. The third candidate vector parameter is any vector parameter in the first candidate set.

[0355] In a specific embodiment, replacing the candidate vector parameter corresponding to the maximum cost value in the first candidate list with the second candidate vector parameter may include: adding the third candidate vector parameter to the first candidate list, and deleting the candidate vector parameter corresponding to the maximum cost value from the first candidate list.

[0356] For example, in an embodiment of the present application, after the current IntraTMP_EBVP set is constructed, the first candidate list is updated. The specific operation of the update is: loop through each BV in this IntraTMP_EBVP set, calculate its corresponding template matching cost, compare this cost with the template matching cost of the BV in the first candidate list, and if it is less than the maximum template matching cost in the first candidate list, replace this BV with the worse BV in the first candidate list. A specific replacement operation is, for example: insert this BV into the first candidate list in order of cost, and delete the item with the highest cost in the first candidate list. And set the search area bestRegionId where the BV newly inserted into the first candidate list is located to 7.

[0357] It should also be noted that, in the embodiment of the present application, it is also not necessary to share with the IntraTMP_Merge set, that is, the expansion is only performed based on the BV directly searched by IntraTMP in the search window.

[0358] It should also be noted that in the embodiment of the present application, there is no need to divide the steps into rough search and fine search. Only a one-time search can be performed, and then the BV options can be expanded based on the one-time search results to obtain the final BV results.

[0359] In some embodiments, for updating the first candidate list, the method further includes: determining first K candidate vector parameters in the first candidate set; updating the first candidate list according to the first K candidate vector parameters; wherein K is a positive integer.

[0360] That is, in the embodiment of the present application, the IntraTMP_Merge set only takes the first K (for example, K can be 5) to update the rough search list, and only expands based on the BVs of the IntraTMP_Merge set.

[0361] In some embodiments, for updating the first candidate list, the method also includes: determining the first P candidate vector parameters in the first candidate set; determining the second position block based on the P candidate vector parameters, and determining the vector parameters of the second position block; when the vector parameters of the second position block meet the second condition, constructing the fourth candidate set of the current block based on the vector parameters of the second position block, and determining that the construction of the fourth candidate set is completed when all P candidate vector parameters are traversed or the fourth candidate set is filled; determining the cost values ​​corresponding to one or more candidate vector parameters in the fourth candidate set, and determining Q candidate vector parameters from the fourth candidate set based on the cost values ​​corresponding to one or more candidate vector parameters; updating the first candidate list based on the Q candidate vector parameters; wherein P and Q are positive integers.

[0362] That is to say, in the embodiment of the present application, IntraTMP_Merge and IntraTMP_EBVP can also be used to jointly maintain a Merge set or list. For example, the first P items (for example, P can be 5) BVs of the IntraTMP_Merge set are first taken, and the IntraTMP_EBVP is expanded based on these P BVs to construct a new Merge set with a length of L (for example, L can be 28). When the expanded BV fills the new Merge set or the expansion of P BVs is completed, the cost of each BV in the new Merge set is calculated and sorted, and then the first Q items (for example, Q can be 5) of the sorted list are taken to update the first candidate list.

[0363] S1905 , determining a second search area according to the candidate vector parameters in the updated first candidate list, and determining the vector parameters of the current block according to the second search area.

[0364] It should be noted that, in the embodiment of the present application, after obtaining the final rough search list, a fine search can be performed on the rough search list. In other words, the search process of the embodiment of the present application can be: first perform a rough search, then perform a fine search.

[0365] It should also be noted that in the embodiments of the present application, the second search area is referred to as the detailed search area. In some embodiments, determining the second search area based on the candidate vector parameters in the updated first candidate list may include: determining a starting position of the second search area based on the candidate vector parameters in the first candidate list; and offsetting the starting position by a first preset range in both the vertical and horizontal directions to determine the resulting pixel area as the second search area.

[0366] In an embodiment of the present application, the starting position of the second search area (i.e., the starting point of the fine search) is first determined. Here, the starting point of the fine search can be set to the [0,0] coordinate, and then the first preset range is offset in the vertical and horizontal directions respectively to obtain the second search area.

[0367] In an embodiment of the present application, the first preset range may be [-2, 2], and the second search area is performed within the obtained 5×5 pixel area. In addition, the first preset range may also be other preset ranges, such as [-1, 1], [-3, 3], [-4, 4], [-5, 5], etc., and the second search area is performed within the corresponding obtained pixel area. In addition, it should be noted that the offset ranges in the vertical and horizontal directions may be the same or different. For example, the horizontal offset range may be [-2, 2], and the vertical offset range may be [-3, 3].

[0368] That is, for the second search area, the search area can be a square, that is, the vertical and horizontal offset ranges are the same; or, the search area can be a non-square, that is, the vertical and horizontal offset ranges are different, and there is no limitation on this.

[0369] In an embodiment of the present application, the second search area obtained is different depending on the first preset range. In some embodiments, the method may include: when the first preset range is [-1, 1], the second search area may be performed within the obtained 3×3 pixel area, as shown in Figure 10; or, when the first preset range is [-2, 2], the second search area may be performed within the obtained 5×5 pixel area, as shown in Figure 21; or, when the first preset range is [-3, 3], the second search area may be performed within the obtained 7×7 pixel area, as shown in Figure 22; or, when the first preset range is [-4, 4], the second search area may be performed within the obtained 9×9 pixel area, as shown in Figure 23; or, when the first preset range is [-5, 5], the second search area may be performed within the obtained 11×11 pixel area, as shown in Figure 11.

[0370] That is, for the case where the search area is 7: TmpRefineRangeHor and TmpRefineRangeVer can both be set to 2. That is, the starting position of the fine search is the [0,0] coordinate, the vertical and horizontal coordinates are offset to a 5×5 pixel area in the range of [-2,2], and a full search is performed point by point within this range.

[0371] For example, for a 5×5 pixel area, the code description is as follows:

[0372] Among them, intOffX represents the horizontal integer pixel offset, and intOffY represents the vertical integer pixel offset.

[0373] In some embodiments, the method may also be used in conjunction with the first prediction mode. The method may further include: decoding the bitstream, determining a value of a third syntax element; and when the third syntax element indicates that the current block uses the first prediction mode, determining that the second search area is within a 5×5 pixel area obtained when the first preset range is [-2, 2].

[0374] Furthermore, in some embodiments, the method further includes: when the third syntax element indicates that the current block does not use the first prediction mode, determining that the second search area is performed within a pixel area obtained when the first preset range is other preset ranges outside of [-2, 2].

[0375] In a specific embodiment, when the third syntax element indicates that the current block does not use the first prediction mode, determining the second search area is performed within a 7×7 pixel area obtained when the first preset range is [−3, 3].

[0376] It should be noted that, in the embodiment of the present application, the third syntax element can be used to indicate whether the current block uses the first prediction mode. If the value of the third syntax element is a first preset value, it is determined that the current block uses the first prediction mode; if the value of the third syntax element is a second preset value, it is determined that the current block does not use the first prediction mode.

[0377] It should also be noted that in the embodiments of the present application, the first preset value is different from the second preset value. The first preset value can be set to 1 and the second preset value can be set to 0; or the first preset value can be set to 0 and the second preset value can be set to 1; or the first preset value can be set to true and the second preset value can be set to false; or the first preset value can be set to false and the second preset value can be set to true.

[0378] It should also be noted that in the embodiment of the present application, the first prediction mode can be the IntraTMP-LIC mode, but is not limited to this. For example, the first preset value can be set to 1, and the second preset value can be set to 0. When the IntraTMP-LIC mode is selected for use with the current block, as shown in FIG24 , when the IntraTMP-LIC mode is selected for the current block, the fine search range is a 5×5 pixel area with the fine search starting position as the [0,0] coordinates, and the vertical and horizontal coordinates are offset within the range of [-2,2], as shown in FIG24 (a). Otherwise, when the IntraTMP-LIC mode is not selected for the current block, the fine search range is a 7×7 pixel area with the fine search starting position as the [0,0] coordinates, and the vertical and horizontal coordinates are offset within the range of [-3,3], as shown in FIG24 (b). Here, when the IntraTMP-LIC mode is not selected for the current block, the fine search range can also correspond to other preset areas, such as those shown in FIG10 , FIG11 , FIG21 , or FIG23 . A full point-by-point search can then be performed within this range. Note that this method is similar to the process when regionId is 6 and IntraTMP-LIC mode is enabled.

[0379] In some embodiments, determining the vector parameters of the current block based on the second search area may include: searching within the second search area based on a second search step size to determine the vector parameters of the current block, wherein the second search step size is smaller than the first search step size.

[0380] It should be noted that, in the embodiment of the present application, the second search step size can be 1, but can also be other values. Here, the second search step size needs to be smaller than the value of the first search step size in the coarse search phase.

[0381] It should also be noted that, in the embodiment of the present application, when the second search step size is 1, a full point-by-point search may be performed within the second search area to determine the vector parameters of the current block.

[0382] In a specific embodiment, the best block vector BV1_BEST[p] obtained in the first candidate list, p=0, ..., M-1, is used as a search reference point for performing a search near the fine search reference point.

[0383] For each fine search reference point, the position of the best matching reconstructed block obtained by the coarse search is first calculated as the reference position of the fine search area: BestPosX = xTbCmp + pX1_BEST, BestPosY = yTbCmp + pY1_BEST, and then the refined search range TmpRefineRangeHor and TmpRefineRangeVer are determined. The refined search range can be a fixed size or related to the search area.

[0384] For example, for reference points in the search region 0 to 5, both TmpRefineRangeHor and TmpRefineRangeVer can be set to 1. That is, for region IDs 0 to 5, the refinement search range is a 3×3 pixel area within the range [-1, 1], with the refinement search starting position at [0, 0] and vertical and horizontal coordinates offset. A full point search is performed within this range, as shown in Figure 10.

[0385] For reference points with a search region of 6, both TmpRefineRangeHor and TmpRefineRangeVer can be set to 5. That is, when regionId is 6, the refinement search range is an 11×11 pixel area within the range [-5, 5], with the refinement search starting position at [0, 0] as the vertical and horizontal coordinates. A full point search is performed within this range, as shown in Figure 11.

[0386] For the search region 7, both TmpRefineRangeHor and TmpRefineRangeVer can be set to 2. This means the refined search starts at the [0,0] coordinate, with the vertical and horizontal coordinates offset to a 5×5 pixel region within the [-2,2] range, as shown in Figure 21. A full, point-by-point search is performed within this range. Note that this approach is consistent with the process when regionId is 6 and the IntraTMP-LIC mode flag is enabled.

[0387] Directly use the search window, treat the fine search area as a whole undetermined reconstruction area, and traverse directly:

[0388] According to the optimal matching block position obtained by the rough search, a new search range is obtained: iHorMax refine =min(picWidth-nTbW,BestPosX+TmpRefineRangeHor); iHorMin refine=max(iTemplateSizeW,BestPosX-TmpRefineRangeHor); iVerMax refine =min(picHeight-nTbH,BestPosY+TmpRefineRangeVer); iVerMin refine =max(iTemplateSizeH,BestPosY-TmpRefineRangeVer);

[0389] Then, the adjusted block vectors BVbvXMins, bvXMaxs, bvYMins, bvYMaxs can be obtained by iVerMin refine 、iVerMax refine 、iHorMin refine 、iHorMax refine Calculation: bvXMins = iHorMin refine –xTbCmp; bvXMaxs=iHorMax refine –xTbCmp; bvYMins=iVerMin refine –yTbCmp; bvYMaxs=iVerMax refine –yTbCmp;

[0390] Fine search in pX is bvXMins refine with bvXMaxs refine Between, pY is in bvYMins refine with bvYMaxs refine This is done within the block vector range between , that is, all search positions within the fine search window are directly traversed, and availability judgments are made in sequence. For example, a search is performed with a second search step size of 1. The top T best matching costs obtained from the available point template matching are recorded as pDiff_BEST[t], t = 0, ..., T-1, and the corresponding block vector BV is recorded as the best block vector BV_BEST[t], t = 0, ..., T-1. Where T is an integer of 1 or greater. For example, T = 1.

[0391] It should also be noted that in the embodiments of the present application, a sub-pixel position search can be further implemented based on the above. In some embodiments, the method can further include: determining new candidate vector parameters for the current block after performing a full point-by-point search within the second search area; and performing a sub-pixel search based on the new candidate vector parameters to determine the vector parameters for the current block.

[0392] In one possible implementation, after performing a full point-by-point search in the second search area, determining new candidate vector parameters for the current block may include: determining, according to a preset matching criterion, a third matching cost value between a matching template corresponding to a plurality of search points in the second search area and a first template of the current block; determining a minimum matching cost value from the third matching cost values ​​of the plurality of search points, and determining new candidate vector parameters based on the search point corresponding to the minimum matching cost value.

[0393] That is to say, in the embodiment of the present application, the costs of the searched integer pixel positions can be compared one by one within a certain detailed search list (eg, the second search area) to determine the minimum cost position, thereby determining new candidate vector parameters.

[0394] It should also be noted that in the embodiment of the present application, the preset matching criteria may include any one of the absolute error sum SAD, the transformed absolute error sum SATD, the difference square sum SSE, the mean absolute difference MAD, the mean absolute error MAE, the mean square error MSE, and the normalized correlation coefficient NCC.

[0395] In some embodiments, performing a sub-pixel search based on new candidate vector parameters to determine the vector parameters of the current block may include: determining a third search area indicated by the new candidate vector parameters; searching according to multiple candidate positions in the third search area to determine an initial direction of the sub-pixel search; determining a fourth search area based on the initial direction of the sub-pixel search, and searching according to multiple candidate positions in the fourth search area to determine the sub-pixel position index and direction index of the current block; and determining the vector parameters of the current block based on the sub-pixel position index and direction index.

[0396] It should be noted that, in an embodiment of the present application, determining the third search area indicated by the new candidate vector parameters may include: determining the starting position of the third search area based on the new candidate vector parameters; performing a half-pixel position search based on the starting position, and determining the obtained multiple candidate positions as the third search area.

[0397] It should also be noted that, in an embodiment of the present application, searching based on multiple candidate positions in the third search area to determine the initial direction of the sub-pixel search may include: determining, based on a preset matching criterion, a fourth matching cost value between the matching templates corresponding to the multiple candidate positions in the third search area and the first template of the current block; sorting the fourth matching cost values ​​of the multiple candidate positions from small to large to determine the top H matching cost values; and determining the initial direction of the sub-pixel search based on the candidate positions corresponding to the H matching cost values; wherein H is a positive integer.

[0398] It should be noted that in this embodiment of the present application, when searching for half-pixel positions based on the starting position, eight directions offset by -1 / 2 in the vertical direction and 1 / 2 in the horizontal direction can be used to obtain eight candidate positions. The third search area can then be determined based on these eight candidate positions. Furthermore, in this embodiment of the present application, the value of H can be set to 4, meaning that the first four candidate directions with relatively low cost values ​​can be selected as the initial directions for the sub-pixel search.

[0399] It should also be noted that in the embodiments of the present application, the sub-pixel search range is always within (-1, 1), where 1 / 2 is the farthest value achieved with half-pixel precision within this range, and 3 / 4 is the farthest value achieved with quarter-pixel precision within this range.

[0400] For example, the sub-pixel search starting position is taken as the coordinate [0,0], and the vertical and horizontal coordinates are offset in 8 directions of -1 / 2 and 1 / 2 respectively. The costs of the 8 candidate positions are compared one by one, and the first 4 directions with the smallest costs are determined as the initial directions of the sub-pixel search.

[0401] In some embodiments, determining the fourth search area based on the initial direction of the sub-pixel search may include: performing a sub-pixel position search based on the starting position and the initial direction of the sub-pixel search, and determining the obtained multiple candidate positions as the fourth search area.

[0402] It should be noted that in an embodiment of the present application, when performing a sub-pixel position search based on the starting position and the initial direction of the sub-pixel search, the search can be performed between multiple 1 / 4 pixel precision positions by offsetting the range of [-3 / 4, 3 / 4] in the vertical and horizontal directions respectively. For example, when the initial direction is the first 4 directions, 10 to 12 candidate positions may correspond to this time. In some embodiments, determining the sub-pixel position index and direction index of the current block may include: determining the fifth matching cost value between the matching templates corresponding to the multiple candidate positions in the fourth search area and the first template of the current block according to a preset matching criterion; determining the minimum matching cost value from the fifth matching cost values ​​of the multiple candidate positions; and determining the sub-pixel position index and direction index of the current block according to the candidate position corresponding to the minimum matching cost value.

[0403] It should also be noted that, in the embodiment of the present application, the sub-pixel position index can be represented by tmpIsSubPel, and the direction index can be represented by tmpSubIdx. For example, tmpIsSubPel can have four values, corresponding to the integer pixel position (0), 1 / 2 pixel position (1), 1 / 4 pixel position (2 or 3) and 3 / 4 pixel position (2 or 3); wherein, the corresponding serial numbers of the 1 / 4 and 3 / 4 positions are related to the interpolation position. tmpSubIdx can have eight values, corresponding to eight directions: left (0), right (1), up (2), down (3), upper left (4), upper right (5), lower left (6), and lower right (7).

[0404] Additionally, it should be noted that when determining the fourth search area, the vertical and horizontal offset ranges can be the same or different. For example, the horizontal offset range can be [-3 / 4, 3 / 4], and the vertical offset range can be [-1 / 2, 1 / 2]. In other words, for the fourth search area, the search area can be square, i.e., the vertical and horizontal offset ranges are the same; or, the search area can be non-square, i.e., the vertical and horizontal offset ranges are different, without any limitation.

[0405] Exemplarily, the sub-pixel search starting position is taken as the [0,0] coordinate, and the vertical and horizontal coordinates of the first four directions determined above are offset by the [-3 / 4, 3 / 4] range respectively, and the search is performed between multiple 1 / 4 pixel precision positions. Specifically, the costs of 10 to 12 candidate positions can be compared one by one to determine the position with the lowest cost, which is the sub-pixel position index tmpIsSubPel and the final direction index tmpSubIdx.

[0406] In this way, the sub-pixel position (Dx, Dy) value can be used to obtain the specific sub-pixel coordinate position according to tmpIsSubPel and tmpSubIdx, and then the optimal matching coordinate is updated.

[0407] After completing the above operations, the results of the coarse selection and fine selection processes (where the fine selection process includes one or more reference point searches) are combined to obtain one or more optimal block vectors BV_BEST[n] for different algorithm requirements, where n = 0, ..., N-1, and each item is a coordinate pair (pX_BEST, pY_BEST). pX_BEST and pY_BEST are the horizontal and vertical offsets of the best matching template relative to the current coding block template, respectively, and are also the horizontal and vertical offsets of the best matching reconstructed block relative to the current coding block.

[0408] In some embodiments, a sub-pixel search is performed based on new candidate vector parameters to determine the vector parameters of the current block. The method may also include: determining a starting position of the sub-pixel search and multiple candidate positions around the starting position; calculating cost values ​​corresponding to each of the multiple candidate positions, and constructing a preset cost model based on the multiple candidate positions and their corresponding cost values; wherein the preset cost model is used to indicate a mapping relationship between the candidate positions and the cost values; determining the candidate position corresponding to the minimum cost value according to the preset cost model, and determining the candidate position corresponding to the minimum cost value as the vector parameter of the current block.

[0409] In other words, for sub-pixel search, another approach is to find the location with the minimum cost by building a model. For example, starting from the sub-pixel search starting point, select several coordinate points around it and build a model based on the cost values ​​of these locations. The location corresponding to the minimum value of the model is found and selected as the search result.

[0410] For example, taking the quadratic model as an example, it is assumed that the relationship model between Vcost and position near MVint is as follows: Vcost(x,y)=A(x-xmin) 2 +B(y-ymin) 2 +C (9)

[0411] Where (xmin, ymin) is the sub-pixel position at which Vcost is minimum, and A, B, and C are model parameters. Model parameters A, B, C, xmin, and ymin can be solved using the Vcosts of the corresponding position of MVint and its four adjacent positions above, below, to the left, and to the right. Assume that the Vcost of the corresponding position of MVint is Vcost(0,0), and the Vcosts of the positions above, below, to the left, and to the right are Vcost(0,-1), Vcost(0,1), Vcost(-1,0), and Vcost(1,0), respectively.

[0412] Where xmin and ymin are calculated as follows: xmin=(Vcost(-1,0)-Vcost(1,0)) / (Vcost(-1,0)+Vcost(1,0)-2Vcost(0,0)) (10) ymin=(Vcost(0,-1)-Vcost(0,1)) / (Vcost(0,-1)+Vcost(0,1)-2Vcost(0,0)) (11)

[0413] Here, the search results can be saved as units such as half pixel, 1 / 4 brightness pixel, 1 / 8 brightness pixel or 1 / 16 brightness pixel as needed.

[0414] In addition, Vcost can be calculated according to a preset cost function, such as the sum of absolute error SAD, the sum of absolute transformation difference SATD, the mean square error MSE, the sum of squared errors SSD, the mean absolute difference MAD, the mean sum of squared errors MSD, the normalized correlation coefficient NCC, etc.

[0415] It should also be noted that, in the embodiment of the present application, for sub-pixel search, it is also possible to search between multiple half-pixel positions, that is, with the sub-pixel search starting position as the [0,0] coordinate, the vertical and horizontal coordinates are offset by a square area in the range of [-1 / 2, 1 / 2], and the cost comparison is performed on the 9 candidate positions one by one, as shown in Figure 25. Alternatively, it is also possible to search between multiple 1 / 4 pixel precision positions, that is, with the sub-pixel search starting position as the [0,0] coordinate, the vertical and horizontal coordinates are offset by a square area in the range of [-3 / 4, 3 / 4], and the cost comparison is performed on the 49 candidate positions one by one, as shown in Figure 26; there is no limitation here.

[0416] It should also be noted that in the embodiment of the present application, between different search steps, the cost function can choose the same type, for example, all are SAD; or different values ​​can be selected, such as SAD for coarse search, SAD or SATD for fine search, SAD or SATD, SSE for sub-pixel search, etc., which are not specifically limited here.

[0417] After completing the above operations, by combining the results of the coarse search and fine search process (where the fine search process includes one or more reference point searches), one or more optimal block vectors BV_BEST[n] for different algorithm requirements can be obtained, where n=0,…,N-1, and each item is a coordinate pair (pX_BEST, pY_BEST). Among them, pX_BEST and pY_BEST are the horizontal and vertical offsets of the best matching template relative to the current block template, and also the horizontal and vertical offsets of the best matching reconstructed block relative to the current block. Thus, the vector parameters of the current block can be obtained.

[0418] In some embodiments, searching within the second search area according to the second search step size to determine the vector parameters of the current block may include performing a sub-pixel search within the second search area according to the second search step size to determine the vector parameters of the current block. In other words, a sub-pixel search may be performed during the detailed search phase.

[0419] S1906: Determine a prediction value of the current block according to the vector parameters of the current block.

[0420] It should be noted that, in the embodiment of the present application, the vector parameter of the current block may be one or more. Here, if there are multiple vector parameters of the current block, weighted fusion can be performed using the corresponding positions of multiple BVs to obtain the predicted value of the current block.

[0421] In some embodiments, when the vector parameter of the current block is one, determining the prediction value of the current block based on the vector parameter of the current block may include: determining a reference block of the current block based on the vector parameter of the current block; and determining the prediction value of the current block based on the reference block.

[0422] For example, in the embodiment of the present application, when determining the reference block of the current block, a simple translation copy can be used to achieve it. The specific operation is: for x=0...nTbW-1, y=0...nTbH-1, through RefBlock n [x][y]=recSamples[x+pX n ][y+pY n ]Determine the reconstructed pixels recSamples of the current frame (i.e., the reference block of the current block).

[0423] It should be noted that in the embodiments of the present application, when determining the reference block of the current block based on the vector parameters of the current block, the initial reconstructed block of the current block can be first determined based on the vector parameters of the current block; then, the initial reconstructed block is corrected to determine the reference block of the current block. Alternatively, the reference block can be filtered to determine a filtered reference block; and the prediction value of the current block can be determined based on the filtered reference block.

[0424] It should also be noted that, in the embodiment of the present application, the prediction value determined by the vector parameters of the current block can be used as the final prediction value, or can be further corrected (eg, a clip operation) to determine the final prediction value of the current block.

[0425] In some embodiments, when determining the prediction value of the current block based on the reference block, the method may include: determining a first prediction block of the current block based on the reference block; predicting the current block based on a second prediction mode to determine a second prediction block of the current block; wherein the second prediction mode is a non-intra-frame template matching prediction mode; and determining the prediction value of the current block based on the first prediction block and the second prediction block.

[0426] It should be noted that, in the embodiment of the present application, the second prediction mode may be a prediction mode different from the intra-frame template matching prediction mode used by the current block, such as a PLANAR mode, a CCLM mode, an angular prediction mode, etc. Here, the first prediction block and the second prediction block may be weightedly fused to determine the prediction value of the current block.

[0427] That is to say, in the embodiment of the present application, when determining the prediction value of the current block, the prediction value can be corrected by local filtering, or the prediction value can be corrected by weighting multiple prediction values, etc.

[0428] In some embodiments, when there are multiple vector parameters of the current block, determining the prediction value of the current block based on the vector parameters of the current block may include: determining multiple reference blocks of the current block based on the multiple vector parameters of the current block; and determining the prediction value of the current block based on the multiple reference blocks.

[0429] It should also be noted that, in an embodiment of the present application, determining the prediction value of the current block based on multiple reference blocks may include: determining multiple prediction blocks of the current block based on multiple reference blocks; and performing weighted fusion on the multiple prediction blocks to determine the prediction value of the current block.

[0430] It can be understood that in the IntraTMP mode, in addition to the basic copying method to obtain the prediction value, there is also a method of obtaining the prediction value by filtering and fusing the corresponding positions of multiple BVs, as well as a method of fusion prediction with the ordinary Intra mode.

[0431] In some embodiments, the prediction value of the current block is determined based on the vector parameters of the current block. The method may also include: decoding the code stream to determine the value of the first syntax element; determining the method for constructing the prediction value of the current block based on the value of the first syntax element and the candidate list of constructed prediction values ​​of the current block; determining the prediction value of the current block based on the vector parameters of the current block and the method for constructing the prediction value.

[0432] That is to say, when determining the prediction value of the current block, a candidate list of prediction values ​​can be constructed by using multiple single prediction values, filtered prediction values, weighted prediction values, and / or a method of constructing prediction values ​​of these prediction values, and the decoding end can determine which item in the candidate list of prediction values ​​to use to obtain the actual prediction value through the syntax elements transmitted in the code stream.

[0433] In some embodiments, the method further includes: decoding the code stream, determining the value of the second syntax element; and when the second syntax element indicates that the current block uses the intra template matching prediction mode, executing the step of determining the first candidate list of the current block.

[0434] It should be noted that, in the embodiment of the present application, the value of the first syntax element is used to indicate the index number of the prediction value construction method of the current block in the prediction value construction candidate list, and the value of the second syntax element is used to indicate whether the current block uses the intra-frame template matching prediction mode.

[0435] It should be noted that, in an embodiment of the present application, if the value of the second syntax element is a first preset value, it is determined that the current block uses the intra template matching prediction mode; if the value of the second syntax element is a second preset value, it is determined that the current block does not use the intra template matching prediction mode.

[0436] In an embodiment of the present application, the first preset value is different from the second preset value. The first preset value may be set to 1 and the second preset value may be set to 0; or the first preset value may be set to 0 and the second preset value may be set to 1; or the first preset value may be set to true and the second preset value may be set to false; or the first preset value may be set to false and the second preset value may be set to true.

[0437] In a specific embodiment, the first preset value is set to 1, and the second preset value is set to 0. For example, if the value of the second syntax element is 1, it indicates that the second syntax element indicates that the current block uses the intra template matching prediction mode, and the decoding method shown in Figure 15 is executed. That is, the method of the embodiment of the present application is applied to the intra template matching prediction mode.

[0438] Furthermore, in the embodiment of the present application, after the prediction value of the current block is determined according to the vector parameters of the current block, the reconstructed value of the current block can be further determined according to the prediction value of the current block.

[0439] In some embodiments, the method further includes: decoding the code stream to determine a prediction residual of the current block; and determining a reconstructed value of the current block according to the prediction residual and the prediction value of the current block.

[0440] It should also be noted that, in the embodiment of the present application, by adding the prediction difference and the prediction value of the current block, the reconstruction value of the current block can be determined, thereby realizing the reconstruction of the current block.

[0441] It should also be noted that in the embodiment of the present application, there is no need to divide the steps into coarse search and fine search. Only a one-time search can be performed, and then the BV option can be expanded based on the one-time search results to obtain the final vector parameters; then, based on the final vector parameters, the predicted value of the current block can be determined.

[0442] It should also be noted that in the IntraTMP mode, in addition to the basic copying method to obtain the prediction value, there is also a method of fusing the corresponding positions of multiple BVs to obtain the prediction value, a method of filtering the reference block corresponding to the BV and then copying it, and a method of pixel-by-pixel interpolation of the BV and then copying its corresponding reference block. For example, after obtaining the BV candidate list by template matching during the decoding end area search process, the first N items (for example, N=3) are selected for weighted fusion. This method can be called the IntraTMP Fusion mode. Alternatively, after obtaining an optimal BV, multiple points are taken around the BV, and the corresponding prediction values ​​of the multiple points are weightedly fused to obtain the prediction value. This method can be called the IntraTMP FLM mode. Alternatively, after obtaining an optimal BV, the templates are sorted by pixel-by-pixel accuracy, the optimal direction and accuracy are selected, and the prediction value is calculated using an interpolation filter. This method can be called the IntraTMP SubPel mode. No specific limitation is made here.

[0443] An embodiment of the present application provides a decoding method, specifically a method for extending the coverage of an Intra TMP search list. First, a first candidate list of a current block is determined, the first candidate list including one or more candidate vector parameters; then, a second position block is determined based on the candidate vector parameters in the first candidate list and / or the vector parameters of the first position block of the current block; when the decoding parameters of the second position block include vector parameters, whether the vector parameters of the second position block meet a second condition is determined based on the vector parameters of the second position block; when the vector parameters of the second position block meet the second condition, the first candidate list is updated based on the vector parameters of the second position block; a second search area is determined based on the candidate vector parameters in the updated first candidate list, and the vector parameters of the current block are determined based on the second search area; finally, a prediction value of the current block is determined based on the vector parameters of the current block. In this way, when updating the first candidate list, some vector information of the second position block can be expanded based on the candidate vector parameters in the initial first candidate list and / or the vector parameters of the first position block (the spatially adjacent blocks and non-adjacent blocks of the current block), and then the first candidate list can be supplemented based on the expanded vector information; thereby, the spatially adjacent and non-adjacent reconstructed information can be effectively utilized, and the candidate vector information can be derived based on the vector information of these reconstructed blocks while ensuring the coding complexity, thereby increasing the coverage of the IntraTMP search list and expanding the search method of the fine search, so that the vector parameters of the current block after the fine search are more accurate, thereby improving the accuracy of the prediction, further saving the bit rate, improving the encoding and decoding efficiency, and thus improving the encoding and decoding performance.

[0444] In another embodiment of the present application, FIG27 is a flow chart of a coding method provided in an embodiment of the present application. As shown in FIG27 , the method may include:

[0445] S2701, determine the first candidate list of the current block.

[0446] It should be noted that the encoding method of the embodiments of the present application is applied to an encoder. Furthermore, the encoding method may specifically refer to an intra-frame prediction method, more specifically, an intra-frame prediction method based on an intra TMP extended block vector list. Here, by fully utilizing reconstructed information from spatially adjacent and non-adjacent locations, the coverage of the first candidate list is increased, thereby improving prediction accuracy.

[0447] It should also be noted that, in the embodiment of the present application, a video image can be divided into multiple coding blocks, each of which can include a first color component, a second color component, and a third color component, and the current block in the embodiment of the present application refers to the coding block in the video image that is currently to be intra-frame predicted. If the current block predicts the first color component, and the first color component is a luminance component, then the current block can also be called a luminance block; or if the current block predicts the second color component, and the second color component is a chrominance component, then the current block can also be called a chrominance block.

[0448] It should also be noted that, in this embodiment of the present application, the first candidate list may include one or more candidate vector parameters. The vector parameters may include block vector parameters and / or motion vector parameters. In other words, the first candidate list may include a list of multiple candidate BVs or a list of multiple candidate MVs.

[0449] Exemplarily, the block vector parameter may also be referred to as a block vector parameter, which may be specifically used to indicate the position of the reference block relative to the current block, that is, the offset between the current block and the reference block is the block vector parameter.

[0450] In some embodiments, for determining a first candidate list for the current block, the method may include: determining a first search area for the current block; and determining the first candidate list for the current block according to the first search area.

[0451] It should be noted that, in the embodiment of the present application, determining the first search area of ​​the current block may include: determining a first template of the current block; and determining the first search area of ​​the current block based on the first template.

[0452] In an embodiment of the present application, the template type of the current block may be determined first, and then the first template of the current block may be determined based on the template type. Determining the template type of the current block may include: determining the template type of the current block based on reference pixels of the current block; or determining the template type of the current block based on indication information in a bitstream; or determining the template type of the current block based on a size parameter of the current block.

[0453] In an embodiment of the present application, the reference pixels of the current block include at least one of the following: a left adjacent reference pixel of the current block, an upper adjacent reference pixel of the current block, and an upper-left adjacent reference pixel of the current block.

[0454] It is understood that in the embodiments of the present application, the reference pixel (Reference Sample) of the current block may refer to a reference pixel point adjacent to the current block; wherein, adjacent here may be spatially adjacent, but is not limited to this. For example, adjacent may also mean temporal adjacent, spatially and temporally adjacent, or even the reference pixel of the current block may be a reference pixel obtained by performing some processing on spatially adjacent, temporally adjacent, or spatially and temporally adjacent reference pixels, etc., and the embodiments of the present application do not specifically limit this.

[0455] It is also understood that, in the embodiment of the present application, the reference pixels of the current block may include the adjacent reconstructed pixels of the current block, that is, the adjacent reconstructed pixels of the current block may be selected as a template to search for a matching template within the first search area. It should be noted that, in the embodiment of the present application, the reference pixels of the current block, that is, the adjacent reconstructed pixels of the current block may include the upper reference pixel, the upper left reference pixel, the upper right reference pixel, the left reference pixel, and the lower left reference pixel of the current block.

[0456] It can also be understood that in the embodiment of the present application, when using the reference pixels of the current block to determine the template type of the current block, the template type can be classified and determined according to the availability of adjacent reference pixels.

[0457] In some embodiments, when determining the template type of the current block based on the reference pixels of the current block, if the left adjacent reference pixels of the current block, the upper adjacent reference pixels of the current block and the upper-left adjacent reference pixels of the current block are all available, the template type of the current block is determined to be a first value; if the left adjacent reference pixels of the current block are available, the template type of the current block is determined to be a second value; if the upper adjacent reference pixels of the current block are available, the template type of the current block is determined to be a third value; if the left adjacent reference pixels of the current block and the upper-left adjacent reference pixels of the current block are both available, the template type of the current block is determined to be a fourth value; if the left adjacent reference pixels of the current block and the lower-left adjacent reference pixels of the current block are both available, the template type of the current block is determined to be a fifth value; if the upper adjacent reference pixels of the current block and the upper-right adjacent reference pixels of the current block are both available, the template type of the current block is determined to be a sixth value.

[0458] It should be noted that in the embodiments of the present application, in some cases, if both the left adjacent reference pixels of the current block and the upper adjacent reference pixels of the current block are available, the template type of the current block is determined to be the first value. In other words, for an L-type template, in some cases there may be no upper left adjacent reference pixels.

[0459] It should be noted that in the embodiments of the present application, the first value, the second value, the third value, the fourth value, the fifth value, and the sixth value can be any values ​​and are not specifically limited in this application. For example, the first value, the second value, the third value, the fourth value, the fifth value, and the sixth value can be 1, 2, 3, 4, 5, and 6, respectively.

[0460] For example, in an embodiment of the present application, refTemplateType can be used to represent the template type. Accordingly, as shown in FIG3 above, the block filled with the grid is the current block, and the adjacent area of ​​the current block is the template T. Six template types are shown here.

[0461] Exemplarily, these six template types are as follows: when the upper 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 shown in (a) in Figure 3; when only the left reference pixel is available, the value of refTemplateType is 2, and the template shape is shown in (b) in Figure 3; when only the upper reference pixel is available, the value of refTemplateType is 3, and the template shape is shown in (c) in Figure 3; when only the left reference pixel and the upper left reference pixel are available, the value of refTemplateType is 4, and the template shape is shown in (d) in Figure 3; when only the left reference pixel and the lower left reference pixel are available, the value of refTemplateType is 5, and the template shape is shown in (e) in Figure 3; when only the upper reference pixel and the upper right reference pixel are available, the value of refTemplateType is 6, and the template shape is shown in (f) in Figure 3.

[0462] In some embodiments, the template type of IntraTMP can also be selected in combination with the availability information of the reference pixels described above and according to the indication in the code stream. For example, the serial number of each template type is agreed upon, and the serial number information of the template actually used is transmitted in the code stream, so that the template type can be determined at the decoding end. That is to say, in the embodiments of the present application, it is possible to determine the template type based on the availability information of the reference pixels of the current block, or to determine the template type based on the information indicated in the code stream, or to determine the template type based on the availability information of the reference pixels and the information indicated in the code stream. This application does not make any specific limitations.

[0463] Furthermore, in an embodiment of the present application, when determining the first template corresponding to the current block based on the template type, it can also include: determining the template reference pixels of the current block based on the template type and the template size corresponding to the template type; and then determining the first template of the current block based on the template reference pixels.

[0464] It should be noted that, in the embodiment of the present application, the first template of the current block may include template reference pixels of the current block, wherein the template reference pixels of the current block may be determined by the template type of the current block and the template size corresponding to the template type.

[0465] It should also be noted that, in an embodiment of the present application, the first template of the current block can be composed of reconstructed pixels of one or more areas above, upper right, left, lower left, and upper left of the current block, that is, it can be composed of reference pixels of the current block.

[0466] It should also be noted that in the embodiments of the present application, the template size corresponding to the template type can be pre-set, can be indicated by a bitstream syntax element, or can be adaptively selected based on the block size or other information. For example, when obtaining the left template, the template width templateW_size can be set to 4, and when obtaining the upper template, the template height templateH_size can be set to 4.

[0467] Accordingly, in the embodiment of the present application, the value of the template type refTemplateType of the current block and the template size corresponding to the refTemplateType are combined to determine which portion of the reconstructed pixels to obtain as the template reference pixels of the current block, and thus the corresponding first template can be determined. For example, when the value of refTemplateType is 1, the left, upper left, and upper reconstructed pixels of the current block can be obtained; when the value of refTemplateType is 2, only the left four columns of reconstructed pixels of the current block are obtained; when the value of refTemplateType is 3, only the upper four rows of reconstructed pixels of the current coding block are obtained.

[0468] Of course, the value of the preset template size can be any integer greater than 0 and is not limited to 4, and is not specifically limited here.

[0469] That is to say, in the embodiment of the present application, in combination with the template type and the corresponding template size of the current block, the template reference pixels of the current block determined from the reference pixels of the current block may be the first template corresponding to the current block.

[0470] It can be understood that in an embodiment of the present application, the search process of the vector parameters may include an initialization process, determining the search area of ​​the first template in the current frame (first search area), searching and determining one or a pair of optimal vector parameters in the first search area. Therefore, when performing the search process, the initialization operation needs to be completed first.

[0471] Exemplarily, as shown in FIG5 , nTbW and nTbH represent the size of the current block, templateW_size and templateH_size represent the template size, and uiPatchWidth and uiPatchHeight represent the block size including the current block and its template.

[0472] Accordingly, during initialization, uiPatchWidth can be initialized to nTbW + templateW_size, and uiPatchHeight can be initialized to nTbH + templateH_size, where templateW_size and templateH_size can be fixed constants, or indicated by codestream syntax elements, or dynamically adjusted according to the current block size or other information. TemplateW_size and templateH_size can be equal or unequal. For example, templateW_size = 4, templateH_size = 4; or, when the width of the current block is greater than 8, templateW_size = 4; when the width of the current block is less than or equal to 8, templateW_size = 2; when the height of the current block is greater than 8, templateH_size = 4; when the height of the current block is less than or equal to 8, templateH_size = 2.

[0473] Furthermore, the cost threshold between the initialization templates is represented by diffThreshold. For example, when the cost function is SAD, the threshold can be: diffThreshold = ((1 <<bitDepth)> >2)×(uiPatchHeight×uiPatchWidth-nTbH×nTbW). When the image bit depth bitDepth is 10, diffThreshold indicates that the distortion threshold of each pixel in the template area is 256.

[0474] Furthermore, the position of the coding tree block CTB where the current block CB is located is initialized: ctbRsX, ctbRsY.

[0475] Furthermore, the position offset of the current block CB in the current CTB is initialized: offsetLCBY=yTbCmp−ctbRsY, offsetLCBX=xTbCmp−ctbRsX.

[0476] Furthermore, initialize iTemplateSizeH=templateH_size and iTemplateSizeW=templateW_size.

[0477] Furthermore, iBvShift is initialized, where iBvShift is the precision of the vector parameter BV. For example, the precision of BV can be integer pixel precision, in which case iBvShift is 0; BV precision can also be sub-pixel precision, for example, iBvShift of 1 indicates 1 / 2 pixel precision, and iBvShift of 2 indicates 1 / 4 pixel precision. This is not specifically limited here.

[0478] Furthermore, the preset search range of the template is initialized. The preset search range of the template can be set to a fixed size or dynamically adjusted based on the size of the current block. For example, searchRangeWidth = TMP_SEARCH_RANGE_MULT_FACTOR × nTbW, searchRangeHeight = TMP_SEARCH_RANGE_MULT_FACTOR × nTbH. The value of TMP_SEARCH_RANGE_MULT_FACTOR can be a preset value, can be indicated by a bitstream syntax element, or can be adaptively adjusted based on information such as the size of the current block, for example, set to 5.

[0479] It is also understandable that in the embodiment of the present application, the first search area may include a first-type search area and / or a second-type search area. The first-type search area is a rectangular search area surrounding the current block; the second-type search area is an area pointed to by the vector parameter corresponding to the preset search position of the current block and an area pointed to by automatic relocation.

[0480] Here, the first type of search area includes a full reconstruction area and / or a pending reconstruction area, wherein all sampling points in the full reconstruction area are reconstructed sampling points, and sampling points in the pending reconstruction area include reconstructed sampling points and / or unreconstructed sampling points.

[0481] That is to say, in the embodiment of the present application, the first search area can be divided into two types:

[0482] One is the surrounding rectangular search area, which can also be divided into two types: one is the area where all sampling points have been reconstructed (called the full reconstruction area), for example, including the four areas R1 to 4 in Figure 6; the other is the area where it is uncertain whether all sampling points have been reconstructed (called the pending reconstruction area), for example, including the two areas R5 to R6 in Figure 6.

[0483] One is an extended search area: defined as the area pointed to by the BV corresponding to spatially adjacent and non-adjacent PUs. In the embodiment corresponding to Figure 6, this area can be considered R7; and the area pointed to by the automatic relocation, which can be considered R8. Since the search points in R7 and / or R8 are not necessarily adjacent to each other, the search of the R7 and / or R8 areas is performed point by point according to the list.

[0484] In some embodiments, determining a first candidate list for the current block based on the first search area may include: searching within the first search area based on a first search step to determine one or more first candidate vector parameters; and adding the one or more first candidate vector parameters to the first candidate list for the current block.

[0485] In a specific embodiment, searching within a first search area according to a first search step size to determine one or more first candidate vector parameters may include: traversing search points in the first search area according to the first search step size, and determining a first matching cost value between a matching template corresponding to the search point in the first search area and the first template according to a preset matching criterion; determining one or more matching search points according to the first matching cost value, and determining one or more first candidate vector parameters based on the one or more matching search points.

[0486] It should be noted that, in the embodiment of the present application, the first search step can be set to 3, and the first candidate list obtained at this time can be called an initial rough search list.

[0487] It should also be noted that in the embodiment of the present application, the preset matching criteria may include any one of the absolute error sum SAD, the transformed absolute error sum SATD, the difference square sum SSE, the mean absolute difference MAD, the mean absolute error MAE, the mean square error MSE, and the normalized correlation coefficient NCC.

[0488] In a possible implementation, when traversing the search points in the first search area, the following steps may be specifically included:

[0489] For the entire reconstruction area (e.g., corresponding to the four regions R1 to R4 in Figure 6), a matching reconstructed block for the current block can be found in the reconstruction area through the search points (iPosHor, iPoxVer) within each search area, that is, each block vector BV (composed of horizontal and vertical components: (pX, pY), where pX = iPosHor - xTbCmp, pY = iPosVer - yTbCmp, pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs). The adjacent reconstructed pixels of the matching reconstructed block are the matching template. This allows the matching cost between the adjacent template of the current block and the adjacent template of the reconstructed block to be calculated, denoted as pDiff.

[0490] For the area to be reconstructed (e.g., corresponding to the two areas R5 to R6 in FIG6 ), the availability is judged by the search points (iPosHor, iPoxVer) in each search area, that is, each block vector BV (composed of horizontal and vertical components: (pX, pY), where pX = iPosHor-xTbCmp, pY = iPosVer-yTbCmp, then pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs):

[0491] If available, a matching reconstructed block for the current block can be found in the reconstructed area. The adjacent reconstructed pixels of the matching reconstructed block are the matching template. From this, the matching cost between the adjacent template of the current block and the adjacent template of the reconstructed block can be calculated, also recorded as pDiff.

[0492] If not available, no template matching cost calculation is performed.

[0493] Availability judgment includes but is not limited to one or more of the following conditions being met simultaneously:

[0494] ● Each sampling point in the template does not exceed the valid coordinate range limited by the image sampling point boundary;

[0495] ● Each sampling point in the template's corresponding reconstruction block does not exceed the valid coordinate range limited by the image sampling point boundary;

[0496] ● Each sampling point in the template and each sampling point in the corresponding reconstructed block does not exceed the specified range of the search window;

[0497] ●Whether each sampling point in the template is in the same tile as the current encoding area;

[0498] ●Whether the sampling points in the reconstructed block corresponding to the template are in the same tile as the current coding area;

[0499] ●All sampling points in the template have been reconstructed;

[0500] ● Each sampling point in the reconstructed block corresponding to the template is not in the current coding area;

[0501] ●All sampling points in the reconstruction block corresponding to the template have been reconstructed;

[0502] Traverse all available search points in all search ranges (regionId = 0, 1, 2, 3, 4, 5), and compare to obtain the 30 search points with the smallest matching cost pDiff. The corresponding matching cost is recorded as pDiff_BEST[n], n = 0, ..., 29, and the corresponding block vector BV is recorded as the best block vector BV_BEST[n]. Each item is a coordinate pair (pX_BEST, pY_BEST), n = 0, ..., 29, and the corresponding matching template is the best matching template T_BEST[n], n = 0, ..., 29.

[0503] Thus, in the embodiment of the present application, assuming that the first search step is 3, a search is performed within the first search area with a step size of 3. For example, within each region, when pX is between bvXMinsregionId and bvXMaxsregionId, and pY is within the search range between bvYMinsregionId and bvYMaxsregionId, a coarse search is performed with a step size of 3, and then the first P best matching costs obtained by template matching are recorded as pDiff1_BEST[p], p=0,…,P-1, and the corresponding block vector BV is recorded as the best block vector BV1_BEST[p], p=0,…,P-1. Where P can be an integer value of 1 or greater than 1 as needed, and the search area where the best matching search point is located is bestRegionId[p], p=0,…,P-1. In this way, a first candidate list can be constructed based on the P best block vectors BV1_BEST[p].

[0504] S2702: Determine a second position block according to the candidate vector parameters in the first candidate list and / or the vector parameters of the first position block of the current block.

[0505] S2703 : When the coding parameters of the second position block include vector parameters, determine whether the vector parameters of the second position block meet a second condition according to the vector parameters of the second position block.

[0506] It should be noted that, in the embodiment of the present application, the first position block of the current block may include blocks in spatially adjacent positions and / or non-adjacent positions. In addition, the number of the first position blocks may be one or more.

[0507] Exemplarily, for the predefined one or more first position blocks, the predefined search positions may be, for example, five positions spatially adjacent to the current block: left (xTbCmp-1, yTbCmp+nTbH-1), upper left (xTbCmp-1, yTbCmp-1), upper (xTbCmp+nTbW-1, yTbCmp-1), upper right (xTbCmp+nTbW, yTbCmp-1), lower left (xTbCmp-1, yTbCmp+nTbH) and 18 spatially non-adjacent positions (as specifically shown in FIG9 ).

[0508] It should also be noted that, in an embodiment of the present application, determining the second position block may include: determining the second position block based on the candidate vector parameters in the first candidate list; and / or determining the second position block based on the vector parameters of the first position block of the current block.

[0509] That is to say, in an embodiment of the present application, the second position block can be determined based on the candidate vector parameters in the first candidate list, or the second position block can be determined based on the vector parameters of the first position block, or the second position block can be determined based on the candidate vector parameters in the first candidate list and the vector parameters of the first position block, without specific limitation here.

[0510] In some embodiments, when determining the second position block based on the vector parameters of the first position block of the current block, the method may further include: when the encoding parameters of the first position block of the current block include vector parameters, determining whether the vector parameters of the first position block meet the first condition based on the vector parameters of the first position block; when the vector parameters of the first position block meet the first condition, determining the second position block based on the vector parameters of the first position block.

[0511] It should be noted that in an embodiment of the present application, when the vector parameter is BV, if the first position block of the current block uses a BV-based prediction technology (ie, IBC / IntraTMP), then it can be determined that the encoding parameters of the first position block of the current block include vector parameters.

[0512] It should also be noted that, in the embodiment of the present application, the first condition may include: the cost value corresponding to the vector parameter of the first position block is better than the cost value corresponding to at least one candidate vector parameter in the first candidate list. In other words, if the cost value corresponding to the vector parameter of the first position block is better than the cost value corresponding to at least one candidate vector parameter in the first candidate list, then the vector parameter of the first position block is determined to meet the first condition.

[0513] In some embodiments, for determining that the vector parameters of the first position block meet the first condition, the method also includes: determining the cost value corresponding to the vector parameters of the first position block based on the matching cost value between the matching template corresponding to the vector parameters of the first position block and the first template; determining the cost value corresponding to at least one candidate vector parameter in the first candidate list based on the matching cost value between the matching template corresponding to at least one candidate vector parameter in the first candidate list and the first template; when the cost value corresponding to the vector parameters of the first position block is less than the cost value corresponding to at least one candidate vector parameter in the first candidate list, it is determined that the vector parameters of the first position block meet the first condition.

[0514] It should also be noted that, in the embodiment of the present application, the method further includes: when the vector parameter of the first position block meets the first condition, updating the first candidate list according to the vector parameter of the first position block.

[0515] In a specific embodiment, updating the first candidate list according to the vector parameter of the first position block may include: adding the vector parameter of the first position block to the first candidate list.

[0516] That is, when the vector parameters of the first position block meet the first condition, the first candidate list can be updated using the vector parameters of the first position block. For example, the vector parameters of the first position block can be added to the first candidate list according to the size of the cost value, and the item with the largest cost value in the first candidate list can be deleted to obtain an updated first candidate list.

[0517] It should also be noted that, in the embodiment of the present application, the method further includes: determining the search region where the vector parameter of the first position block is located as R6, that is, the value of bestRegionId is set to 6.

[0518] It should also be noted that in an embodiment of the present application, during the update process, it is first checked whether the PUs corresponding to these predefined search positions use the IntraTMP / IBC technology, that is, whether the encoding parameters of the PUs corresponding to these predefined search positions contain vector parameters. If they contain vector parameters, the BV of this PU is determined, and then the first candidate list is updated using this BV. The specific operation of the update is: access each item in the first candidate list in turn, calculate the template matching cost corresponding to each BV, compare this cost with the template matching cost of the first candidate list, and if it is less than the largest cost value in the first candidate list, replace this BV with the worse BV in the first candidate list. For example, the specific operation can be: insert this BV into the first candidate list in order of cost size, and delete the item with the largest cost in the first candidate list. And set the value of the bestRegionId of the search area where it is located to 6.

[0519] It can be understood that, in the embodiment of the present application, the number of the second location blocks can be one or more.

[0520] It should also be noted that, in the embodiment of the present application, the second position block represents the reference block pointed to by the vector parameter of the first position block, or the second position block represents the block pointed to by the vector parameter of the reference block pointed to by the vector parameter of the first position block.

[0521] It should also be noted that in the embodiment of the present application, still taking the vector parameter as BV as an example, if the second position block uses the BV-based prediction technology (ie IBC / IntraTMP), then it can be determined that the encoding parameters of the second position block include vector parameters.

[0522] Exemplarily, for the second position block, the vector parameters of the first position block are used as the current BV. First, several candidate positions of the current block are determined, for example, five candidate positions: center (xTbCmp+nTbW / 2, yTbCmp+nTbH / 2), upper left (xTbCmp, yTbCmp), upper right (xTbCmp+nTbW-1, yTbCmp), lower left (xTbCmp, yTbCmp+nTbH-1), and lower right (xTbCmp+nTbW-1, yTbCmp+nTbH-1). Then, it is checked whether the corresponding PU after adding the coordinates of these five candidate positions to the current BV uses a BV-based prediction mode (i.e., IBC / IntraTMP). If used, the newly obtained BV is regarded as the current BV, and the above operation is repeated to determine the vector parameters of the second position block (also referred to as "extended BV"). In other words, in the embodiment of the present application, the extended BV can be the BV stored in the block pointed to by the current BV, or the BV stored in the block pointed to by the BV of the block pointed to by the current BV, and so on.

[0523] In some embodiments, the second condition may include: a cost value corresponding to the vector parameter of the second position block is better than a cost value corresponding to at least one candidate vector parameter in the first candidate list. In other words, if the cost value corresponding to the vector parameter of the second position block is better than a cost value corresponding to at least one candidate vector parameter in the first candidate list, then the vector parameter of the second position block is determined to meet the second condition.

[0524] It should also be noted that, in an embodiment of the present application, the method further includes: determining a cost value corresponding to the vector parameters of the second position block based on a matching cost value between the matching template corresponding to the vector parameters of the second position block and the first template; determining a cost value corresponding to at least one candidate vector parameter in the first candidate list based on a matching cost value between the matching template corresponding to at least one candidate vector parameter in the first candidate list and the first template; when the cost value corresponding to the vector parameters of the second position block is less than a cost value corresponding to at least one candidate vector parameter in the first candidate list, determining that the vector parameters of the second position block meet the second condition.

[0525] S2704: When the vector parameter of the second position block meets the second condition, update the first candidate list according to the vector parameter of the second position block.

[0526] It should be noted that, in the embodiment of the present application, the vector parameters of the second position block may be one or more vector parameters of the second position block. Determination of the vector parameters of the second position block may cease when all vector parameters of the first position block are traversed or the number of vector parameters of the second position block obtained is greater than a first threshold.

[0527] It should also be noted that, in the embodiment of the present application, the first threshold value can be represented by V. For example, the value of V can be 15, but it can also be other values, such as 1, 2, 5, 10, etc., which are not specifically limited here.

[0528] In some embodiments, updating the first candidate list according to the vector parameters of the second position block may include: adding the vector parameters of the second position block to the first candidate list.

[0529] That is, when the vector parameters of the second position block meet the second condition, the first candidate list can be updated using the vector parameters of the second position block. For example, the vector parameters of the second position block can be added to the first candidate list according to the cost value, and the item with the largest cost value in the first candidate list can be deleted to obtain an updated first candidate list.

[0530] In some embodiments, the method further includes: determining the search region where the vector parameter of the second position block is located as R7, that is, setting the value of bestRegionId to 7.

[0531] It should be noted that in the embodiment of the present application, for the vector parameters of the obtained first position block, first, for each current BV, the five positions of the current block are determined: center (xTbCmp+nTbW / 2, yTbCmp+nTbH / 2), upper left (xTbCmp, yTbCmp), upper right (xTbCmp+nTbW-1, yTbCmp), lower left (xTbCmp, yTbCmp+nTbH-1), and lower right (xTbCmp+nTbW-1, yTbCmp+nTbH-1), and it is checked whether the corresponding PU after adding the current BV to these five position coordinates uses the BV-based prediction technology (ie, IBC / IntraTMP). If it is used, the sum of the BV stored in the corresponding PU and the current BV (vector sum, i.e., the horizontal and vertical components are added separately) is recorded as BV', and BV' is then regarded as the current BV. The above operation is repeated for this BV' to continue to determine the available options for the extended BV. If it is not used, the next position is checked. Repeat the above operation until all five positions are checked or the number of extended BVs determined is greater than V, then stop determining the vector parameters of the second position block.

[0532] It should also be noted that after obtaining multiple extended BVs, the first candidate list is further updated. The specific operation of the update is: for multiple extended BVs, calculate the corresponding template matching cost, compare this cost with the template matching cost of the BV in the first candidate list, and if it is less than the maximum template matching cost in the first candidate list, replace this BV with the worse BV in the first candidate list. Specific replacement operations include: inserting this BV into the first candidate list in order of cost size, and deleting the item with the highest cost in the first candidate list. Set the value of bestRegionId of the search area where the BV newly inserted into the first candidate list is located to 7.

[0533] That is, in an embodiment of the present application, when the BV of the first position block (the spatially adjacent position and / or non-adjacent position of the current block) is better than at least one BV in the first candidate list (the first condition), then the block pointed to by the BV of the first position block is checked. If the block pointed to by the BV of the first position block also has a BV, it is determined (the second condition) whether to add the BV to the first candidate list. At the same time, another feature of the embodiment of the present application is that the first position block can contribute two candidate BVs to the first candidate list (adding one BV when the first condition is met and adding another BV when the second condition is met) to obtain an updated first candidate list (i.e., the final rough search list).

[0534] In some embodiments, for updating the first candidate list, the method may also include: when the vector parameters of the first position block meet the first condition, determining the first candidate set of the current block according to the vector parameters of the first position block, and updating the first candidate list according to the first candidate set; when the vector parameters of the second position block meet the second condition, determining the second candidate set of the current block according to the vector parameters of the second position block, and updating the first candidate list according to the second candidate set.

[0535] It should be noted that, in the embodiment of the present application, the first candidate set can be represented by IntraTMP_Merge, and the second candidate set can be represented by IntraTMP_EBVP.

[0536] It should also be noted that, in some embodiments, updating the first candidate list based on the first candidate set may include: determining a cost value corresponding to a second candidate vector parameter in the first candidate set, and determining a maximum cost value corresponding to one or more candidate vector parameters in the first candidate list; and when the cost value corresponding to the second candidate vector parameter is less than the maximum cost value in the first candidate list, replacing the candidate vector parameter corresponding to the maximum cost value in the first candidate list with the second candidate vector parameter to update the first candidate list. The second candidate vector parameter is any vector parameter in the first candidate set.

[0537] In a specific embodiment, replacing the candidate vector parameter corresponding to the maximum cost value in the first candidate list with the second candidate vector parameter may include: adding the second candidate vector parameter to the first candidate list, and deleting the candidate vector parameter corresponding to the maximum cost value from the first candidate list.

[0538] Exemplarily, in an embodiment of the present application, the construction process of the IntraTMP_Merge set (or IntraTMP_Merge list) can be specifically: check whether the PUs corresponding to these positions use the IntraTMP / IBC technology. If they do, the BV of this PU is stored in the IntraTMP_Merge set. After constructing the IntraTMP_Merge set, the first candidate list is updated according to the IntraTMP_Merge set. The specific operation of the update is: access each item of the IntraTMP_Merge set in turn, calculate the template matching cost corresponding to each BV, compare this cost with the template matching cost of the first candidate list, and if it is less than the maximum template matching cost in the first candidate list, replace this BV with the worse BV in the first candidate list. Specific operations, for example: insert this BV into the first candidate list in order of cost size, and delete the item with the highest cost in the first candidate list. And set the search area bestRegionId where it is located to 6.

[0539] It should also be noted that, in this embodiment of the present application, after the first candidate list is updated based on the first candidate set, the second position block can be determined based on at least some of the candidate vector parameters in the updated first candidate list. Furthermore, when the vector parameters of the second position block meet a second condition, the second candidate set for the current block is constructed based on the vector parameters of the second position block.

[0540] In one possible implementation, at least some of the candidate vector parameters in the updated first candidate list may be one or more second candidate vector parameters updated from the first candidate set to the first candidate list. Therefore, in some embodiments, determining the second candidate set for the current block may include: determining one or more second candidate vector parameters updated from the first candidate set to the first candidate list; determining a second position block based on the one or more second candidate vector parameters; and determining the second candidate set for the current block based on the vector parameters of the second position block.

[0541] In another possible implementation, at least some of the candidate vector parameters in the updated first candidate list may be all of the candidate vector parameters in the updated first candidate list. Therefore, in some embodiments, determining the second candidate set for the current block may include: after updating the first candidate list based on the first candidate set, determining a second position block based on all of the candidate vector parameters in the first candidate list, and determining the second candidate set for the current block based on the vector parameters of the second position block.

[0542] In another possible implementation, at least some of the candidate vector parameters in the updated first candidate list may be a preset number of candidate vector parameters in the updated first candidate list. Therefore, in some embodiments, determining the second candidate set for the current block may include: after updating the first candidate list based on the first candidate set, determining the first N candidate vector parameters in the first candidate list; determining a second position block based on the N candidate vector parameters, and determining a second candidate set for the current block based on the vector parameters of the second position block; wherein N is a positive integer.

[0543] It should be noted that in this embodiment of the present application, the method further includes: determining the value of N based on the size parameter of the current block. In other words, the number of checks can be limited based on the size of the current block. For example, for a current block with a size less than or equal to 16x16, the first 5 blocks are checked, and for other sizes, the first 10 blocks are checked.

[0544] In another possible implementation, determining the second candidate set of the current block may include: after updating the first candidate list based on the first candidate set, clustering the first candidate list to determine M candidate vector parameters at the cluster center; determining the second position block based on the M candidate vector parameters, and determining the second candidate set of the current block based on the vector parameters of the second position block; wherein M is a positive integer.

[0545] It should also be noted that, in the embodiment of the present application, when constructing the IntraTMP_EBVP set (or IntraTMP_EBVP list), only all BVs replaced by the IntraTMP_Merge set in the first candidate list may be checked, or all options in the updated first candidate list may be updated based on EBVP.

[0546] In addition, in an embodiment of the present application, the BV objects and their number checked in the IntraTMP_EBVP list can also be adjusted. For example, the first 5 of the corresponding BV set can be used for inspection, or the first 10 of the corresponding BV set can be used for inspection. Or the number of inspections can be limited according to the size of the current block, for example, the first 5 CUs with a size less than or equal to 16x16 are inspected, and the first 10 CUs with other sizes are inspected. Or the updated first candidate list can be clustered, and the clustering rule is the geometric distance to the cluster center. The number of cluster centers is 2 to 5, for example, EBVP operations are performed only on the cluster centers.

[0547] In another possible implementation, the second candidate set may not be constructed. The method further includes: when the first candidate set of the current block is not full, filling the first candidate set with vector parameters of the second position block until the first candidate set is full; and updating the first candidate list based on the full first candidate set.

[0548] That is to say, in the embodiment of the present application, the BV of EBVP can be added after the IntraTMP_Merge set until the IntraTMP_Merge set is filled, and then the first candidate list is updated with this IntraTMP_Merge set, that is, the number is limited to the number of unfilled items in the IntraTMP_Merge set.

[0549] For example, in an embodiment of the present application, after the first candidate list is updated according to the IntraTMP_Merge set, for each BV replaced by the IntraTMP_Merge set into the first candidate list, an IntraTMP_EBVP set is constructed and the first candidate list is updated again according to the set:

[0550] First, for each current BV, build its corresponding IntraTMP_EBVP set from scratch. Determine the five positions of the current CU: center (xTbCmp+nTbW / 2,yTbCmp+nTbH / 2), top left (xTbCmp,yTbCmp), top right (xTbCmp+nTbW-1,yTbCmp), bottom left (xTbCmp,yTbCmp+nTbH-1), bottom right (xTbCmp+nTbW-1,yTbCmp+nTbH-1), and check whether the corresponding PU after adding the current BV to these five position coordinates uses BV-based prediction technology (i.e., IBC / IntraTMP). If used, the sum of the BV stored in the corresponding PU and the current BV (vector sum, that is, the horizontal and vertical components are added separately) is recorded as BV' and added to the TMP_EBVP list. Then BV' is regarded as the current BV and the above operation is repeated for this BV' to continue to build the available options in the TMP_EBVP list; if not used, check the next position.

[0551] In some embodiments, the method further includes: when all vector parameters of the second position block are traversed or the number of candidate vector parameters in the second candidate set is greater than a first threshold, determining that the construction of the third candidate set is completed.

[0552] It should be noted that in the embodiment of the present application, the first threshold can be represented by V, or the length of the second candidate set is V. For example, the value of V can be 15. Alternatively, the length V of the IntraTMP_EBVP set can be changed to another value, for example, the value of V can be limited to 1, 2, 5, or 10.

[0553] In this way, the above operation is repeated until all five positions are checked or the number of IntraTMP_EBVP sets being constructed is greater than V, thereby completing the construction of the current IntraTMP_EBVP set.

[0554] In some embodiments, after constructing the second candidate set, the method further includes: determining a second matching cost between a matching template corresponding to a third candidate vector parameter in the second candidate set and the first template according to a preset matching criterion; and when the second matching cost is greater than a second threshold, deleting the third candidate vector parameter from the second candidate set to update the second candidate set. The third candidate vector parameter is any vector parameter in the second candidate set.

[0555] In the embodiment of the present application, the preset matching criteria may include any one of the following: Sum of Absolute Error (SAD), Sum of Transformed Absolute Error (SATD), Sum of Squared Difference (SSE), Mean Absolute Difference (MAD), Mean Absolute Error (MAE), Mean Squared Error (MSE), and Normalized Correlation Coefficient (NCC). In other words, restrictions may be imposed based on the template cost (e.g., SAD, SATD, etc.) corresponding to the BV. The template cost is first calculated for each BV in the second candidate set, and a cost threshold is defined. BVs that do not exceed the threshold are then added to the IntraTMP_EBVP set to obtain the final second candidate set.

[0556] In some embodiments, updating the first candidate list based on the second candidate set may include: determining a cost value corresponding to a third candidate vector parameter in the second candidate set, and determining a maximum cost value corresponding to one or more candidate vector parameters in the first candidate list; and when the cost value corresponding to the third candidate vector parameter is less than the maximum cost value in the first candidate list, replacing the candidate vector parameter corresponding to the maximum cost value in the first candidate list with the third candidate vector parameter to update the first candidate list. The third candidate vector parameter is any vector parameter in the first candidate set.

[0557] In a specific embodiment, replacing the candidate vector parameter corresponding to the maximum cost value in the first candidate list with the second candidate vector parameter may include: adding the third candidate vector parameter to the first candidate list, and deleting the candidate vector parameter corresponding to the maximum cost value from the first candidate list.

[0558] For example, in an embodiment of the present application, after the current IntraTMP_EBVP set is constructed, the first candidate list is updated. The specific operation of the update is: loop through each BV in this IntraTMP_EBVP set, calculate its corresponding template matching cost, compare this cost with the template matching cost of the BV in the first candidate list, and if it is less than the maximum template matching cost in the first candidate list, replace this BV with the worse BV in the first candidate list. A specific replacement operation is, for example: insert this BV into the first candidate list in order of cost, and delete the item with the highest cost in the first candidate list. And set the search area bestRegionId where the BV newly inserted into the first candidate list is located to 7.

[0559] It should also be noted that, in the embodiment of the present application, it is also not necessary to share with the IntraTMP_Merge set, that is, the expansion is only performed based on the BV directly searched by IntraTMP in the search window.

[0560] It should also be noted that in the embodiment of the present application, there is no need to divide the steps into rough search and fine search. Only a one-time search can be performed, and then the BV options can be expanded based on the one-time search results to obtain the final BV results.

[0561] In some embodiments, for updating the first candidate list, the method further includes: determining first K candidate vector parameters in the first candidate set; updating the first candidate list according to the first K candidate vector parameters; wherein K is a positive integer.

[0562] That is, in the embodiment of the present application, the IntraTMP_Merge set only takes the first K (for example, K can be 5) to update the rough search list, and only expands based on the BVs of the IntraTMP_Merge set.

[0563] In some embodiments, for updating the first candidate list, the method also includes: determining the first P candidate vector parameters in the first candidate set; determining the second position block based on the P candidate vector parameters, and determining the vector parameters of the second position block; when the vector parameters of the second position block meet the second condition, constructing the fourth candidate set of the current block based on the vector parameters of the second position block, and determining that the construction of the fourth candidate set is completed when all P candidate vector parameters are traversed or the fourth candidate set is filled; determining the cost values ​​corresponding to one or more candidate vector parameters in the fourth candidate set, and determining Q candidate vector parameters from the fourth candidate set based on the cost values ​​corresponding to one or more candidate vector parameters; updating the first candidate list based on the Q candidate vector parameters; wherein P and Q are positive integers.

[0564] That is to say, in the embodiment of the present application, IntraTMP_Merge and IntraTMP_EBVP can also be used to jointly maintain a Merge set or list. For example, the first P items (for example, P can be 5) BVs of the IntraTMP_Merge set are first taken, and the IntraTMP_EBVP is expanded based on these P BVs to construct a new Merge set with a length of L (for example, L can be 28). When the expanded BV fills the new Merge set or the expansion of P BVs is completed, the cost of each BV in the new Merge set is calculated and sorted, and then the first Q items (for example, Q can be 5) of the sorted list are taken to update the first candidate list.

[0565] S2705 , determining a second search area according to the candidate vector parameters in the updated first candidate list, and determining vector parameters of the current block according to the second search area.

[0566] It should be noted that, in the embodiment of the present application, after obtaining the final rough search list, a fine search can be performed on the rough search list. In other words, the search process of the embodiment of the present application can be: first perform a rough search, then perform a fine search.

[0567] It should also be noted that in the embodiments of the present application, the second search area is referred to as the detailed search area. In some embodiments, determining the second search area based on the candidate vector parameters in the updated first candidate list may include: determining a starting position of the second search area based on the candidate vector parameters in the first candidate list; and offsetting the starting position by a first preset range in both the vertical and horizontal directions to determine the resulting pixel area as the second search area.

[0568] In an embodiment of the present application, the starting position of the second search area (i.e., the starting point of the fine search) is first determined. Here, the starting point of the fine search can be set to the [0,0] coordinate, and then the first preset range is offset in the vertical and horizontal directions respectively to obtain the second search area.

[0569] In an embodiment of the present application, the first preset range may be [-2, 2], and the second search area is performed within the obtained 5×5 pixel area. In addition, the first preset range may also be other preset ranges, such as [-1, 1], [-3, 3], [-4, 4], [-5, 5], etc., and the second search area is performed within the corresponding obtained pixel area. In addition, it should be noted that the offset ranges in the vertical and horizontal directions may be the same or different. For example, the horizontal offset range may be [-2, 2], and the vertical offset range may be [-3, 3].

[0570] That is, for the second search area, the search area can be a square, that is, the vertical and horizontal offset ranges are the same; or, the search area can be a non-square, that is, the vertical and horizontal offset ranges are different, and there is no limitation on this.

[0571] In an embodiment of the present application, the second search area obtained is different depending on the first preset range. In some embodiments, the method may include: when the first preset range is [-1, 1], the second search area may be performed within the obtained 3×3 pixel area, as shown in Figure 10; or, when the first preset range is [-2, 2], the second search area may be performed within the obtained 5×5 pixel area, as shown in Figure 21; or, when the first preset range is [-3, 3], the second search area may be performed within the obtained 7×7 pixel area, as shown in Figure 22; or, when the first preset range is [-4, 4], the second search area may be performed within the obtained 9×9 pixel area, as shown in Figure 23; or, when the first preset range is [-5, 5], the second search area may be performed within the obtained 11×11 pixel area, as shown in Figure 11.

[0572] That is, for the case where the search area is 7: TmpRefineRangeHor and TmpRefineRangeVer can both be set to 2. That is, the starting position of the fine search is the [0,0] coordinate, the vertical and horizontal coordinates are offset to a 5×5 pixel area in the range of [-2,2], and a full search is performed point by point within this range.

[0573] For example, for a 5×5 pixel area, the code description is as follows:

[0574] Among them, intOffX represents the horizontal integer pixel offset, and intOffY represents the vertical integer pixel offset.

[0575] In an embodiment of the present application, it is also possible to choose to use it in conjunction with the first prediction mode. In some embodiments, the method may include: when the current block uses the first prediction mode, determining that the second search area is performed within a 5×5 pixel area obtained when the first preset range is [-2, 2]. Furthermore, in some embodiments, the method may also include: when the current block does not use the first prediction mode, determining that the second search area is performed within a pixel area obtained when the first preset range is other than [-2, 2].

[0576] In a specific embodiment, when the current block does not use the first prediction mode, it can be determined that the second search area is within a 7×7 pixel area obtained when the first preset range is [−3, 3].

[0577] In an embodiment of the present application, a third syntax element may be provided. The third syntax element may be used to indicate whether the current block uses the first prediction mode. In some embodiments, the method may further include: determining a value for the third syntax element; encoding the value for the third syntax element, and writing the resulting encoded bits into the bitstream.

[0578] It should be noted that, in the embodiment of the present application, if the current block uses the first prediction mode, the value of the third syntax element is determined to be the first preset value; if the current block does not use the first prediction mode, the value of the third syntax element is determined to be the second preset value.

[0579] It should also be noted that in the embodiments of the present application, the first preset value is different from the second preset value. The first preset value can be set to 1 and the second preset value can be set to 0; or the first preset value can be set to 0 and the second preset value can be set to 1; or the first preset value can be set to true and the second preset value can be set to false; or the first preset value can be set to false and the second preset value can be set to true.

[0580] It should also be noted that in the embodiment of the present application, the first prediction mode can be the IntraTMP-LIC mode, but is not limited to this. For example, the first preset value can be set to 1, and the second preset value can be set to 0. When the IntraTMP-LIC mode is selected for use with the current block, as shown in FIG24 , when the IntraTMP-LIC mode is selected for the current block, the fine search range is a 5×5 pixel area with the fine search starting position as the [0,0] coordinates, and the vertical and horizontal coordinates are offset within the range of [-2,2], as shown in FIG24 (a). Otherwise, when the IntraTMP-LIC mode is not selected for the current block, the fine search range is a 7×7 pixel area with the fine search starting position as the [0,0] coordinates, and the vertical and horizontal coordinates are offset within the range of [-3,3], as shown in FIG24 (b). Here, when the IntraTMP-LIC mode is not selected for the current block, the fine search range can also correspond to other preset areas, such as those shown in FIG10 , FIG11 , FIG21 , or FIG23 . A full point-by-point search can then be performed within this range. Note that this method is similar to the process when regionId is 6 and IntraTMP-LIC mode is enabled.

[0581] In some embodiments, determining the vector parameters of the current block based on the second search area may include: searching within the second search area based on a second search step size to determine the vector parameters of the current block, wherein the second search step size is smaller than the first search step size.

[0582] It should be noted that, in the embodiment of the present application, the second search step size can be 1, but can also be other values. Here, the second search step size needs to be smaller than the value of the first search step size in the coarse search phase.

[0583] It should also be noted that, in the embodiment of the present application, when the second search step size is 1, a full point-by-point search may be performed within the second search area to determine the vector parameters of the current block.

[0584] In a specific embodiment, the best block vector BV1_BEST[p] obtained in the first candidate list, p=0, ..., M-1, is used as a search reference point for performing a search near the fine search reference point.

[0585] For each fine search reference point, the position of the best matching reconstructed block obtained by the coarse search is first calculated as the reference position of the fine search area: BestPosX = xTbCmp + pX1_BEST, BestPosY = yTbCmp + pY1_BEST, and then the refined search range TmpRefineRangeHor and TmpRefineRangeVer are determined. The refined search range can be a fixed size or related to the search area.

[0586] For example, for reference points in the search region 0 to 5, both TmpRefineRangeHor and TmpRefineRangeVer can be set to 1. That is, for region IDs 0 to 5, the refinement search range is a 3×3 pixel area within the range [-1, 1], with the refinement search starting position at [0, 0] and vertical and horizontal coordinates offset. A full point search is performed within this range, as shown in Figure 10.

[0587] For reference points with a search region of 6, both TmpRefineRangeHor and TmpRefineRangeVer can be set to 5. That is, when regionId is 6, the refinement search range is an 11×11 pixel area within the range [-5, 5], with the refinement search starting position at [0, 0] as the vertical and horizontal coordinates. A full point search is performed within this range, as shown in Figure 11.

[0588] For the search region 7, both TmpRefineRangeHor and TmpRefineRangeVer can be set to 2. This means the refined search starts at the [0,0] coordinate, with the vertical and horizontal coordinates offset to a 5×5 pixel region within the [-2,2] range, as shown in Figure 21. A full, point-by-point search is performed within this range. Note that this approach is consistent with the process when regionId is 6 and the IntraTMP-LIC mode flag is enabled.

[0589] Directly use the search window, treat the fine search area as a whole undetermined reconstruction area, and traverse directly:

[0590] According to the optimal matching block position obtained by the rough search, a new search range is obtained: iHorMax refine =min(picWidth-nTbW,BestPosX+TmpRefineRangeHor); iHorMin refine =max(iTemplateSizeW,BestPosX-TmpRefineRangeHor); iVerMax refine =min(picHeight-nTbH,BestPosY+TmpRefineRangeVer); iVerMin refine =max(iTemplateSizeH,BestPosY-TmpRefineRangeVer);

[0591] Then, the adjusted block vectors BVbvXMins, bvXMaxs, bvYMins, bvYMaxs can be obtained by iVerMin refine 、iVerMax refine 、iHorMin refine 、iHorMax refine Calculation: bvXMins = iHorMin refine –xTbCmp; bvXMaxs=iHorMax refine –xTbCmp; bvYMins=iVerMin refine –yTbCmp; bvYMaxs=iVerMax refine –yTbCmp;

[0592] Fine search in pX is bvXMins refine with bvXMaxs refine Between, pY is in bvYMins refinewith bvYMaxs refine This is done within the block vector range between , that is, all search positions within the fine search window are directly traversed, and availability judgments are made in sequence. For example, a search is performed with a second search step size of 1. The top T best matching costs obtained from the available point template matching are recorded as pDiff_BEST[t], t = 0, ..., T-1, and the corresponding block vector BV is recorded as the best block vector BV_BEST[t], t = 0, ..., T-1. Where T is an integer of 1 or greater. For example, T = 1.

[0593] It should also be noted that in the embodiments of the present application, a sub-pixel position search can be further implemented based on the above. In some embodiments, the method can further include: determining new candidate vector parameters for the current block after performing a full point-by-point search within the second search area; and performing a sub-pixel search based on the new candidate vector parameters to determine the vector parameters for the current block.

[0594] In one possible implementation, after performing a full point-by-point search in the second search area, determining new candidate vector parameters for the current block may include: determining, according to a preset matching criterion, a third matching cost value between a matching template corresponding to a plurality of search points in the second search area and a first template of the current block; determining a minimum matching cost value from the third matching cost values ​​of the plurality of search points, and determining new candidate vector parameters based on the search point corresponding to the minimum matching cost value.

[0595] That is to say, in the embodiment of the present application, the costs of the searched integer pixel positions can be compared one by one within a certain detailed search list (eg, the second search area) to determine the minimum cost position, thereby determining new candidate vector parameters.

[0596] It should also be noted that in the embodiment of the present application, the preset matching criteria may include any one of the absolute error sum SAD, the transformed absolute error sum SATD, the difference square sum SSE, the mean absolute difference MAD, the mean absolute error MAE, the mean square error MSE, and the normalized correlation coefficient NCC.

[0597] In some embodiments, performing a sub-pixel search based on new candidate vector parameters to determine the vector parameters of the current block may include: determining a third search area indicated by the new candidate vector parameters; searching according to multiple candidate positions in the third search area to determine an initial direction of the sub-pixel search; determining a fourth search area based on the initial direction of the sub-pixel search, and searching according to multiple candidate positions in the fourth search area to determine the sub-pixel position index and direction index of the current block; and determining the vector parameters of the current block based on the sub-pixel position index and direction index.

[0598] It should be noted that, in an embodiment of the present application, determining the third search area indicated by the new candidate vector parameters may include: determining the starting position of the third search area based on the new candidate vector parameters; performing a half-pixel position search based on the starting position, and determining the obtained multiple candidate positions as the third search area.

[0599] It should also be noted that, in an embodiment of the present application, searching based on multiple candidate positions in the third search area to determine the initial direction of the sub-pixel search may include: determining, based on a preset matching criterion, a fourth matching cost value between the matching templates corresponding to the multiple candidate positions in the third search area and the first template of the current block; sorting the fourth matching cost values ​​of the multiple candidate positions from small to large to determine the top H matching cost values; and determining the initial direction of the sub-pixel search based on the candidate positions corresponding to the H matching cost values; wherein H is a positive integer.

[0600] It should be noted that in this embodiment of the present application, when searching for half-pixel positions based on the starting position, eight directions offset by -1 / 2 in the vertical direction and 1 / 2 in the horizontal direction can be used to obtain eight candidate positions. The third search area can then be determined based on these eight candidate positions. Furthermore, in this embodiment of the present application, the value of H can be set to 4, meaning that the first four candidate directions with relatively low cost values ​​can be selected as the initial directions for the sub-pixel search.

[0601] It should also be noted that in the embodiments of the present application, the sub-pixel search range is always within (-1, 1), where 1 / 2 is the farthest value achieved with half-pixel precision within this range, and 3 / 4 is the farthest value achieved with quarter-pixel precision within this range.

[0602] For example, the sub-pixel search starting position is taken as the coordinate [0,0], and the vertical and horizontal coordinates are offset in 8 directions of -1 / 2 and 1 / 2 respectively. The costs of the 8 candidate positions are compared one by one, and the first 4 directions with the smallest costs are determined as the initial directions of the sub-pixel search.

[0603] In some embodiments, determining the fourth search area based on the initial direction of the sub-pixel search may include: performing a sub-pixel position search based on the starting position and the initial direction of the sub-pixel search, and determining the obtained multiple candidate positions as the fourth search area.

[0604] It should be noted that in an embodiment of the present application, when performing a sub-pixel position search based on the starting position and the initial direction of the sub-pixel search, the search can be performed between multiple 1 / 4 pixel precision positions by offsetting the range of [-3 / 4, 3 / 4] in the vertical and horizontal directions respectively. For example, when the initial direction is the first 4 directions, 10 to 12 candidate positions may correspond to this time. In some embodiments, determining the sub-pixel position index and direction index of the current block may include: determining the fifth matching cost value between the matching templates corresponding to the multiple candidate positions in the fourth search area and the first template of the current block according to a preset matching criterion; determining the minimum matching cost value from the fifth matching cost values ​​of the multiple candidate positions; and determining the sub-pixel position index and direction index of the current block according to the candidate position corresponding to the minimum matching cost value.

[0605] It should also be noted that, in the embodiment of the present application, the sub-pixel position index can be represented by tmpIsSubPel, and the direction index can be represented by tmpSubIdx. For example, tmpIsSubPel can have four values, corresponding to the integer pixel position (0), 1 / 2 pixel position (1), 1 / 4 pixel position (2 or 3) and 3 / 4 pixel position (2 or 3); wherein, the corresponding serial numbers of the 1 / 4 and 3 / 4 positions are related to the interpolation position. tmpSubIdx can have eight values, corresponding to eight directions: left (0), right (1), up (2), down (3), upper left (4), upper right (5), lower left (6), and lower right (7).

[0606] Additionally, it should be noted that when determining the fourth search area, the vertical and horizontal offset ranges can be the same or different. For example, the horizontal offset range can be [-3 / 4, 3 / 4], and the vertical offset range can be [-1 / 2, 1 / 2]. In other words, for the fourth search area, the search area can be square, i.e., the vertical and horizontal offset ranges are the same; or, the search area can be non-square, i.e., the vertical and horizontal offset ranges are different, without any limitation.

[0607] Exemplarily, the sub-pixel search starting position is taken as the [0,0] coordinate, and the vertical and horizontal coordinates of the first four directions determined above are offset by the [-3 / 4, 3 / 4] range respectively, and the search is performed between multiple 1 / 4 pixel precision positions. Specifically, the costs of 10 to 12 candidate positions can be compared one by one to determine the position with the lowest cost, which is the sub-pixel position index tmpIsSubPel and the final direction index tmpSubIdx.

[0608] In this way, the sub-pixel position (Dx, Dy) value can be used to obtain the specific sub-pixel coordinate position according to tmpIsSubPel and tmpSubIdx, and then the optimal matching coordinate is updated.

[0609] After completing the above operations, the results of the coarse selection and fine selection processes (where the fine selection process includes one or more reference point searches) are combined to obtain one or more optimal block vectors BV_BEST[n] for different algorithm requirements, where n = 0, ..., N-1, and each item is a coordinate pair (pX_BEST, pY_BEST). pX_BEST and pY_BEST are the horizontal and vertical offsets of the best matching template relative to the current coding block template, respectively, and are also the horizontal and vertical offsets of the best matching reconstructed block relative to the current coding block.

[0610] In some embodiments, a sub-pixel search is performed based on new candidate vector parameters to determine the vector parameters of the current block. The method may also include: determining a starting position of the sub-pixel search and multiple candidate positions around the starting position; calculating cost values ​​corresponding to each of the multiple candidate positions, and constructing a preset cost model based on the multiple candidate positions and their corresponding cost values; wherein the preset cost model is used to indicate a mapping relationship between the candidate positions and the cost values; determining the candidate position corresponding to the minimum cost value according to the preset cost model, and determining the candidate position corresponding to the minimum cost value as the vector parameter of the current block.

[0611] In other words, for sub-pixel search, another approach is to find the location with the minimum cost by building a model. For example, starting from the sub-pixel search starting point, select several coordinate points around it and build a model based on the cost values ​​of these locations. The location corresponding to the minimum value of the model is found and selected as the search result.

[0612] Taking the quadratic model as an example, assume that the relationship between Vcost and position near MVint is as shown in the above equation (9). Where (xmin, ymin) is the sub-pixel position where Vcost is minimum, and A, B, and C are model parameters. The model parameters A, B, C, xmin, and ymin can be solved using the Vcost of the corresponding position of MVint and its four adjacent positions above, below, left, and right. Assume that the Vcost of the corresponding position of MVint is Vcost(0,0), and the Vcost of its upper, lower, left, and right positions are Vcost(0,-1), Vcost(0,1), Vcost(-1,0), and Vcost(1,0), respectively.

[0613] The calculation method of xmin and ymin is as shown in the above formula (10) and formula (11). Here, the search results can be saved as units such as half pixels, 1 / 4 brightness pixels, 1 / 8 brightness pixels, or 1 / 16 brightness pixels as needed.

[0614] In addition, Vcost can be calculated according to a preset cost function, such as the sum of absolute error SAD, the sum of absolute transformation difference SATD, the mean square error MSE, the sum of squared errors SSD, the mean absolute difference MAD, the mean sum of squared errors MSD, the normalized correlation coefficient NCC, etc.

[0615] It should also be noted that, in the embodiment of the present application, for sub-pixel search, it is also possible to search between multiple half-pixel positions, that is, with the sub-pixel search starting position as the [0,0] coordinate, the vertical and horizontal coordinates are offset by a square area in the range of [-1 / 2, 1 / 2], and the cost comparison is performed on the 9 candidate positions one by one, as shown in Figure 25. Alternatively, it is also possible to search between multiple 1 / 4 pixel precision positions, that is, with the sub-pixel search starting position as the [0,0] coordinate, the vertical and horizontal coordinates are offset by a square area in the range of [-3 / 4, 3 / 4], and the cost comparison is performed on the 49 candidate positions one by one, as shown in Figure 26; there is no limitation here.

[0616] It should also be noted that in the embodiment of the present application, between different search steps, the cost function can choose the same type, for example, all are SAD; or different values ​​can be selected, such as SAD for coarse search, SAD or SATD for fine search, SAD or SATD, SSE for sub-pixel search, etc., which are not specifically limited here.

[0617] S2706: Determine a prediction value of the current block based on the vector parameters of the current block.

[0618] It should be noted that, in the embodiment of the present application, the vector parameter of the current block may be one or more. Here, if there are multiple vector parameters of the current block, weighted fusion can be performed using the corresponding positions of multiple BVs to obtain the predicted value of the current block.

[0619] In some embodiments, when the vector parameter of the current block is one, determining the prediction value of the current block based on the vector parameter of the current block may include: determining a reference block of the current block based on the vector parameter of the current block; and determining the prediction value of the current block based on the reference block.

[0620] For example, in the embodiment of the present application, when determining the reference block of the current block, a simple translation copy can be used to achieve it. The specific operation is: for x=0...nTbW-1, y=0...nTbH-1, through RefBlock n[x][y]=recSamples[x+pX n ][y+pY n ]Determine the reconstructed pixels recSamples of the current frame (i.e., the reference block of the current block).

[0621] It should be noted that in the embodiments of the present application, when determining the reference block of the current block based on the vector parameters of the current block, the initial reconstructed block of the current block can be first determined based on the vector parameters of the current block; then, the initial reconstructed block is corrected to determine the reference block of the current block. Alternatively, the reference block can be filtered to determine a filtered reference block; and the prediction value of the current block can be determined based on the filtered reference block.

[0622] It should also be noted that, in the embodiment of the present application, the prediction value determined by the vector parameters of the current block can be used as the final prediction value, or can be further corrected (eg, a clip operation) to determine the final prediction value of the current block.

[0623] In some embodiments, when determining the prediction value of the current block based on the reference block, the method may include: determining a first prediction block of the current block based on the reference block; predicting the current block based on a second prediction mode to determine a second prediction block of the current block; wherein the second prediction mode is a non-intra-frame template matching prediction mode; and determining the prediction value of the current block based on the first prediction block and the second prediction block.

[0624] It should be noted that, in the embodiment of the present application, the second prediction mode may be a prediction mode different from the intra-frame template matching prediction mode used by the current block, such as a PLANAR mode, a CCLM mode, an angular prediction mode, etc. Here, the first prediction block and the second prediction block may be weightedly fused to determine the prediction value of the current block.

[0625] That is to say, in the embodiment of the present application, when determining the prediction value of the current block, the prediction value can be corrected by local filtering, or the prediction value can be corrected by weighting multiple prediction values, etc.

[0626] In some embodiments, when there are multiple vector parameters of the current block, determining the prediction value of the current block based on the vector parameters of the current block may include: determining multiple reference blocks of the current block based on the multiple vector parameters of the current block; and determining the prediction value of the current block based on the multiple reference blocks.

[0627] It should also be noted that, in an embodiment of the present application, determining the prediction value of the current block based on multiple reference blocks may include: determining multiple prediction blocks of the current block based on multiple reference blocks; and performing weighted fusion on the multiple prediction blocks to determine the prediction value of the current block.

[0628] It can be understood that in the IntraTMP mode, in addition to the basic copying method to obtain the prediction value, there is also a method of obtaining the prediction value by filtering and fusing the corresponding positions of multiple BVs, as well as a method of fusion prediction with the ordinary Intra mode.

[0629] In some embodiments, the prediction value of the current block is determined based on the vector parameters of the current block. The method may also include: determining a method for constructing a prediction value of the current block; and determining the prediction value of the current block based on the vector parameters of the current block and the method for constructing a prediction value.

[0630] In a specific embodiment, determining a construction prediction value method for the current block may include: determining a candidate construction prediction value list for the current block; wherein the candidate construction prediction value list includes at least one candidate construction prediction value method; performing cost calculation on at least one candidate construction prediction value method respectively to determine at least one cost result; determining a minimum cost result from at least one cost result, and determining the candidate construction prediction value method corresponding to the minimum cost result as the construction prediction value method for the current block.

[0631] It should be noted that in the embodiment of the present application, the distortion value method can be used to determine the cost result, specifically the rate-distortion cost method can be used to determine the cost result; however, it can also be the size of SAD, the size of MSE, the size of SSE or other criteria for judging the cost, which is not specifically limited here.

[0632] In some embodiments, the method further includes: determining a value of a first syntax element; wherein the value of the first syntax element is used to indicate an index number of a method for constructing a prediction value of the current block in a candidate list of constructed prediction values; encoding the value of the first syntax element, and writing the obtained coded bits into a bitstream.

[0633] That is to say, when determining the prediction value of the current block, a candidate list of prediction values ​​can be constructed by using multiple single prediction values, filtered prediction values, weighted prediction values, and / or a method of constructing prediction values ​​of these prediction values, and the syntax elements transmitted through the code stream are transmitted to the decoding end, so that the decoding end can determine which item in the candidate list of prediction values ​​to use to obtain the actual prediction value by decoding the code stream.

[0634] In some embodiments, the method further includes: determining a value of a second syntax element; encoding the value of the second syntax element, and writing the obtained coded bits into a bitstream.

[0635] It should be noted that, in the embodiment of the present application, the value of the second syntax element is used to indicate whether the current block uses the intra template matching prediction mode. If the current block uses the intra template matching prediction mode, the value of the second syntax element is determined to be the first preset value; if the current block does not use the intra template matching prediction mode, the value of the second syntax element is determined to be the second preset value.

[0636] In an embodiment of the present application, the first preset value is different from the second preset value. The first preset value may be set to 1, and the second preset value may be set to 0; or, the first preset value may be set to 0, and the second preset value may be set to 1; or, the first preset value may be set to true, and the second preset value may be set to false; or, the first preset value may be set to false, and the second preset value may be set to true. For example, here, the first preset value is set to 1, and the second preset value is set to 0.

[0637] It should also be noted that in the embodiment of the present application, when the current block uses the intra-frame template matching prediction mode, the step of determining the first candidate list for the current block is performed, that is, the encoding method shown in Figure 17 is performed. In other words, the method of the embodiment of the present application is applied to the intra-frame template matching prediction mode.

[0638] That is to say, in the IntraTMP mode, in addition to the basic copying method to obtain the prediction value, there is also a method of obtaining the prediction value by fusing the corresponding positions of multiple BVs, a method of filtering the reference block corresponding to the BV and then copying it, and a method of pixel-by-pixel interpolation of the BV and then copying its corresponding reference block. For example, after obtaining the BV candidate list by template matching during the decoding end area search process, the first N items (for example, N=3) are selected for weighted fusion. This method can be called the IntraTMP Fusion mode. Alternatively, after obtaining an optimal BV, multiple points are taken around the BV, and the corresponding prediction values ​​of the multiple points are weightedly fused to obtain the prediction value. This method can be called the IntraTMP FLM mode. Alternatively, after obtaining an optimal BV, the templates are sorted by pixel-by-pixel accuracy, the optimal direction and accuracy are selected, and the prediction value is calculated using an interpolation filter. This method can be called the IntraTMP SubPel mode. No specific limitation is given here.

[0639] In some embodiments, after step S2706, referring to FIG. 28 , the method further includes:

[0640] S2801: Determine a prediction difference value of the current block according to the prediction value of the current block.

[0641] S2802: Encode the prediction difference of the current block and write the obtained coded bits into the bitstream.

[0642] It should be noted that in the embodiments of the present application, after determining the predicted value of the current block based on the vector parameters of the current block, a predicted residual value of the current block can be further determined based on the predicted value of the current block. Specifically, the initial value of the current block can be determined, and a subtraction operation can be performed on the initial value of the current block and the predicted value to obtain a predicted residual value of the current block. In this way, the predicted residual value of the current block is written into the bitstream and transmitted to the decoder. The decoder obtains the predicted residual value of the current block by decoding the bitstream, and further determines the reconstructed value of the current block, thereby achieving reconstruction of the current block.

[0643] In some embodiments, an embodiment of the present application provides a code stream, which is generated by bit encoding based on information to be encoded; wherein the information to be encoded includes at least one of the following: a prediction difference value of the current block, a value of a first syntax element, a value of a second syntax element, and a value of a third syntax element.

[0644] In this embodiment of the present application, the value of the first syntax element is used to indicate the index number of the prediction value construction method of the current block in the prediction value construction candidate list, the value of the second syntax element is used to indicate whether the current block uses the intra template matching prediction mode, and the third syntax element is used to indicate whether the current block uses the first prediction mode. Exemplarily, the first prediction mode can be the IntraTMP-LIC mode.

[0645] The embodiment of the present application provides a coding method, specifically a method for extending the coverage of the Intra TMP search list. First, a first candidate list of the current block is determined, and the first candidate list includes one or more candidate vector parameters; then, a second position block is determined based on the candidate vector parameters in the first candidate list and / or the vector parameters of the first position block of the current block; when the coding parameters of the second position block include vector parameters, whether the vector parameters of the second position block meet the second condition is determined based on the vector parameters of the second position block; when the vector parameters of the second position block meet the second condition, the first candidate list is updated based on the vector parameters of the second position block; a second search area is determined based on the candidate vector parameters in the updated first candidate list, and the vector parameters of the current block are determined based on the second search area; finally, a prediction value of the current block is determined based on the vector parameters of the current block. In this way, when updating the first candidate list, some vector information of the second position block can be expanded based on the candidate vector parameters in the initial first candidate list and / or the vector parameters of the first position block (the spatially adjacent blocks and non-adjacent blocks of the current block), and then the first candidate list can be supplemented based on the expanded vector information; thereby, the spatially adjacent and non-adjacent reconstructed information can be effectively utilized, and the candidate vector information can be derived based on the vector information of these reconstructed blocks while ensuring the coding complexity, thereby increasing the coverage of the IntraTMP search list and expanding the search method of the fine search, so that the vector parameters of the current block after the fine search are more accurate, thereby improving the accuracy of the prediction, further saving the bit rate, improving the encoding and decoding efficiency, and thus improving the encoding and decoding performance.

[0646] In another embodiment of the present application, based on the encoding and decoding method of the aforementioned embodiment, in the prediction process of IntraTMP, it is proposed to establish an adaptive repositioning BV list to fully utilize the information of all adjacent reconstructed sampling points, and adopt different schemes to narrow the search range for search areas with different relative positions to the current block to take into account the complexity.

[0647] The following is a detailed introduction to the prediction process of the embodiment of the present application.

[0648] Input of IntraTMP: the position of the current block (xTbCmp, yTbCmp), the width of the current block nTbW, and the height of the current block nTbH.

[0649] Output of IntraTMP: predicted value predSamples[x][y] of the current block, where x = 0..nTbW–1, y = 0..nTbH–1.

[0650] Specifically, the IntraTMP prediction process can be divided into four steps: determining the current template type, obtaining the reconstructed pixels of the current template, determining the block vector (or "block vector") within a predefined search range, and generating the predicted value. This process yields the predicted value for the current block. It's important to note that the IntraTMP technique can be used to predict both luma and chroma components, and this is not specifically limited here.

[0651] The IntraTMP search process for determining block vectors consists of initialization, determining the search area for the template within the current frame, and searching and determining the optimal block vector within the search area, as shown in Figure 4. A coarse search followed by a fine search strategy can be employed to search for the optimal matching template within the search area.

[0652] The coarse search here may specifically be: determining the best coarse matching template in the search area with a first search step size (eg, 3), or determining the best coarse matching template in the search area using a downsampled template (eg, a downsampling factor of 3).

[0653] The fine search here can specifically be: determining the best fine matching template in the search area with a second search step size (for example, 1. If sub-pixel accuracy is encountered, sub-pixel interpolation of the reconstructed pixels is required, which is not expanded here), or determining the best fine matching template near the best coarse matching template after completing the coarse search.

[0654] Step 1, initialization.

[0655] Among them, initialize uiPatchWidth to nTbW+templateW_size, and uiPatchHeight to nTbH+templateH_size, where templateW_size and templateH_size can be fixed constants or dynamically adjusted according to the size of the coding block. TemplateW_size and templateH_size can be equal or unequal. For example, templateW_size=4, templateH_size=4; or when the width of the coding block is greater than 8, set templateW_size=4, when the width of the coding block is less than or equal to 8, set templateW_size=2, when the height of the coding block is greater than 8, set templateH_size=4, when the height of the coding block is less than or equal to 8, set templateH_size=2. The specific meaning of the parameters is shown in Figure 5 above.

[0656] Initialize the cost threshold diffThreshold between templates. For example, when the cost function is SAD, the threshold can be: diffThreshold = ((1 <<bitDepth)> >2)*(uiPatchHeight*uiPatchWidth-nTbH*nTbW), when the image bit depth bitDepth is 10, diffThreshold indicates that the distortion threshold of each pixel in the template area is 256.

[0657] Initialize the position of the coding tree block CTB where the current coding block CB is located: ctbRsX, ctbRsY.

[0658] Initialize the position offset of the current CB in the current CTB: offsetLCBY=yTbCmp–ctbRsY, offsetLCBX=xTbCmp–ctbRsX.

[0659] Initialize iTemplateSizeH=templateH_size, iTemplateSizeW=templateW_size.

[0660] Initialize iBvShift, which is the precision of the block vector BV. The BV precision can be integer pixel precision, in which case iBvShift is 0; the BV precision can also be sub-pixel precision, for example, when iBvShift is 1, it indicates 1 / 2 pixel precision, and when iBvShift is 2, it indicates 1 / 4 pixel precision.

[0661] Initialize the preset search range of the template. The preset search range of the template can be set to a fixed size or dynamically adjusted according to the encoding block size, such as: searchRangeWidth = TMP_SEARCH_RANGE_MULT_FACTOR * nTbW; searchRangeHeight = TMP_SEARCH_RANGE_MULT_FACTOR * nTbH;

[0662] The value of TMP_SEARCH_RANGE_MULT_FACTOR is a preset value, for example, a fixed value of 5.

[0663] Step 2: Determine the search area of ​​the template in the current frame.

[0664] The search areas described here are divided into two types:

[0665] One is the surrounding rectangular search area. This area is divided into two types: one is where all sampling points in the area are confirmed to have been reconstructed (called the fully reconstructed area), for example, the four areas R1 to R4 in Figure 6; the other is where it is uncertain whether all sampling points in the area have been reconstructed (called the pending reconstruction area), for example, the two areas R5 to R6 in Figure 6.

[0666] One is an extended search area. This is defined as the area pointed to by the BV corresponding to spatially adjacent and non-adjacent PUs. In the embodiment corresponding to Figure 6, this area can be considered R7; and the area pointed to by the automatic relocation, which can be considered R8. Since search points in R7 and / or R8 are not necessarily adjacent to each other, the search of the R7 and / or R8 areas is performed point by point according to the list.

[0667] For the search points in the search area, all search points in the specified search area can be traversed, or different schemes can be used to limit the search range to a local search range, so as to balance the computational complexity and coding efficiency. For example, for the undetermined reconstruction area (corresponding to the two areas R5 to R6 in Figure 6) or the full reconstruction area (e.g., corresponding to the four areas R1 to R4 in Figure 6), the width of the search range can be limited to the original 1 / wIndex, and the height can be limited to the original 1 / hIndex, where wIndex and hIndex are both any positive integers greater than or equal to 1. The limited search range takes the area closer to the unit to be encoded. For another example, when narrowing the search range of the R5 area, the width of the R5 search area can be reduced to 1 / 2 of the original width, and the width can be reduced to 1 / 2 of the original width. The final search range can take the upper right 1 / 4 area of ​​the R5 area.

[0668] Step 3: Search and determine the best block vector BV in the search area.

[0669] bvXMins and bvXMaxs represent the minimum offset and maximum offset of the block vector in the horizontal direction respectively; bvYMins and bvYMaxs represent the minimum offset and maximum offset of the block vector in the vertical direction respectively.

[0670] bvXMins regionId 、bvXMaxs regionId 、bvYMins regionId 、bvYMaxs regionId iVerMin can be determined by step 2 regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId Calculated: bvXMins regionId =iHorMin regionId –xTbCmp; bvXMaxs regionId=iHorMax regionId –xTbCmp; bvYMins regionId =iVerMin regionId –yTbCmp; bvYMaxs regionId =iVerMax regionId –yTbCmp;

[0671] Among them, bvXMins regionId 、bvXMaxs regionId 、bvYMins regionId and bvYMaxs regionId The horizontal and vertical offset ranges of the search point relative to the current block, ie, the range of the block vector BV, are determined.

[0672] For the entire reconstruction area (e.g., corresponding to the four regions R1 to R4 in Figure 6), a matching reconstructed block for the current block can be found in the reconstruction area through the search points (iPosHor, iPoxVer) within each search area, that is, each block vector BV (composed of horizontal and vertical components: (pX, pY), where pX = iPosHor - xTbCmp, pY = iPosVer - yTbCmp, pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs). The adjacent reconstructed pixels of the matching reconstructed block are the matching template. This allows the matching cost between the adjacent template of the current block and the adjacent template of the reconstructed block to be calculated, denoted as pDiff.

[0673] For the area to be reconstructed (e.g., corresponding to the two areas R5 to R6 in FIG6 ), the availability is judged by the search points (iPosHor, iPoxVer) in each search area, that is, each block vector BV (composed of horizontal and vertical components: (pX, pY), where pX = iPosHor-xTbCmp, pY = iPosVer-yTbCmp, then pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs):

[0674] If available, a matching reconstructed block for the current block can be found in the reconstructed area. The adjacent reconstructed pixels of the matching reconstructed block are the matching template. From this, the matching cost between the adjacent template of the current block and the adjacent template of the reconstructed block can be calculated, also recorded as pDiff.

[0675] If not available, no template matching cost calculation is performed.

[0676] Availability judgment includes but is not limited to one or more of the following conditions being met simultaneously:

[0677] ● Each sampling point in the template does not exceed the valid coordinate range limited by the image sampling point boundary;

[0678] ● Each sampling point in the template's corresponding reconstruction block does not exceed the valid coordinate range limited by the image sampling point boundary;

[0679] ● Each sampling point in the template and each sampling point in the corresponding reconstructed block does not exceed the specified range of the search window;

[0680] ●Whether each sampling point in the template is in the same tile as the current encoding area;

[0681] ●Whether the sampling points in the reconstructed block corresponding to the template are in the same tile as the current coding area;

[0682] ●All sampling points in the template have been reconstructed;

[0683] ● Each sampling point in the reconstructed block corresponding to the template is not in the current coding area;

[0684] ●All sampling points in the reconstruction block corresponding to the template have been reconstructed;

[0685] Traverse all available search points in all search ranges (regionId = 0, 1, 2, 3, 4, 5), and compare to obtain the 30 search points with the smallest matching cost pDiff. The corresponding matching cost is recorded as pDiff_BEST[n], n = 0, ..., 29, and the corresponding block vector BV is recorded as the best block vector BV_BEST[n]. Each item is a coordinate pair (pX_BEST, pY_BEST), n = 0, ..., 29, and the corresponding matching template is the best matching template T_BEST[n], n = 0, ..., 29.

[0686] In a possible implementation, if the search strategy is: perform a coarse search first and then a fine search, it can be as shown in Figure 7. The specific implementation is as follows: construct a coarse search list in the search area, and determine a fine search list near the coarse search list BV with a step size of 1.

[0687] In a possible implementation, for the coarse search phase, referring to FIG. 29 , the specific implementation is as follows:

[0688] S2901: Construct an initial rough search list in the search area with a step size of 3.

[0689] It should be noted that in each region, pX is in bvXMins regionId with bvXMaxs regionId Between, pY is in bvYMins regionId with bvYMaxs regionIdWithin the search range between , a coarse search is performed with a step size of 3. The first P optimal matching costs obtained from the template matching are recorded as pDiff1_BEST[p], where p = 0, ..., P-1, and the corresponding block vector BV is recorded as the best block vector BV1_BEST[p], where p = 0, ..., P-1. P can be an integer value of 1 or greater as needed, and the search region where the best matching search point is located is bestRegionId[p], where p = 0, ..., P-1.

[0690] S2902: Build an Intra TMP_Merge list to update the rough search list.

[0691] After P reference points are found in the search area, multiple predefined search positions are used to construct a candidate BV list for reference by the current block, which is called the IntraTMP_Merge list.

[0692] The predefined search position set, for example, uses five spatially adjacent positions of the current block: left (xTbCmp-1, yTbCmp+nTbH-1), upper left (xTbCmp-1, yTbCmp-1), upper (xTbCmp+nTbW-1, yTbCmp-1), upper right (xTbCmp+nTbW, yTbCmp-1), lower left (xTbCmp-1, yTbCmp+nTbH) and 18 spatially non-adjacent positions (as shown in Figure 9).

[0693] In an embodiment of the present application, an embodiment of the construction process is as follows: check whether the PUs corresponding to these positions use the IntraTMP / IBC technology. If they do, store the BV of this PU in the IntraTMP_Merge list. After constructing the IntraTMP_Merge list, update the coarse search list. The specific operation of the update is: access each item in this list in turn, calculate the template matching cost corresponding to each BV, compare this cost with the template matching cost of the initial coarse search list, and if it is less than the maximum template matching cost in the coarse search list, replace this BV with the worse BV in the coarse search list. Specific operations are, for example: insert this BV into the coarse search list in order of cost, and delete the item with the highest cost in the coarse search list. And set the search area bestRegionId where it is located to 6. It should also be noted that the construction process is actually a list merging process, but first constructs a list of corresponding results of R1 to R6, and then inserts the result of R7 into the appropriate position in the list. In practice, there can also be other search orders and merging strategies.

[0694] In the embodiment of the present application, according to the algorithm requirements, the coarse search stage will provide one or more (here denoted as M, 1<=M<=P) fine search reference points and send them to the next step. For example, M=1.

[0695] S2903: Construct an Intra TMP_EBVP list to update the rough search list.

[0696] After updating the rough search list according to the IntraTMP_Merge list, for each BV replaced by the Merge list into the rough search list, build an IntraTMP_EBVP list and update the rough search list according to the list:

[0697] First, for each current BV, build its corresponding IntraTMP_EBVP list from scratch. Determine the five positions of the current block: center (xTbCmp+nTbW / 2,yTbCmp+nTbH / 2), top left (xTbCmp,yTbCmp), top right (xTbCmp+nTbW-1,yTbCmp), bottom left (xTbCmp,yTbCmp+nTbH-1), bottom right (xTbCmp+nTbW-1,yTbCmp+nTbH-1), and check whether the corresponding PU after adding the current BV to these five positions uses BV-based prediction technology (i.e., IBC / IntraTMP).

[0698] If used, the sum of the BV stored in the corresponding PU and the current BV (vector sum, that is, the horizontal and vertical components are added separately) is recorded as BV' and added to the TMP_EBVP list. Then BV' is regarded as the current BV and the above operation is repeated for this BV' to continue to build the available options in the TMP_EBVP list; if not used, check the next position.

[0699] The above steps are repeated until all five locations have been checked or the number of IntraTMP_EBVPs in the IntraTMP_EBVP list being constructed is greater than T (for example, T can be 15), completing the construction of the current IntraTMP_EBVP list. Alternatively, the number can be limited to smaller values ​​such as 1, 2, 5, or 10; or, the SAD can be limited to stop the operation if it exceeds a certain threshold; or, the total number of extensions can be limited (similar to the IBC-ARBVP method, where regions are optionally added to the end of the merge list of a limited length until the list is full, at which point R7 and the new R7 can be considered the same candidate region); or, both the number and the SAD can be limited, etc.

[0700] In an embodiment of the present application, after the current IntraTMP_EBVP list is constructed, the coarse search list is updated. The specific operation of the update is: cyclically access each BV in this IntraTMP_EBVP list, calculate its corresponding template matching cost, compare this cost with the template matching cost of the BV in the coarse search list to be updated, and if it is less than the maximum template matching cost in the coarse search list, replace this BV with the worse BV in the coarse search list. A specific replacement operation is, for example: insert this BV into the coarse search list in order of cost size, and delete the item with the highest cost in the coarse search list. Set the search area bestRegionId where the BV newly inserted into the coarse search list is located to 7. It should be noted that the role of the search area bestRegionId here is originally to provide a basis for accessing surrounding pixels during fine search and filtering.

[0701] It should also be noted that the so-called "update" in steps S2902 and S2903 refers solely to the process of merging the result lists, and there is no mandatory order for the updates. Furthermore, it should be noted that three tables exist in memory: the rough search list, the intra TMP-Merge list, and the intra TMP-EBVP list. The rough search list is mandatory, while the other two lists do not need to be constructed. Instead, they serve as a check sequence, and if a suitable option is found, the rough search list is updated.

[0702] Furthermore, after the coarse search is completed, a fine search list can be determined near the coarse search list BV with a step size of 1. Specifically, the search is performed near the best block vector BV1_BEST[p] obtained from the coarse search, where p=0, ..., M-1, serves as a fine search reference point.

[0703] In a specific embodiment, for each fine search reference point, the position of the best matching reconstructed block obtained by the coarse search is first calculated as the reference position of the fine search area: BestPosX = xTbCmp + pX1_BEST, BestPosY = yTbCmp + pY1_BEST, and then the refined search range TmpRefineRangeHor and TmpRefineRangeVer are determined. The refined search range can be a fixed size or related to the search area.

[0704] For example, for reference points in the search region 0 to 5, both TmpRefineRangeHor and TmpRefineRangeVer can be set to 1. That is, for region IDs 0 to 5, the refinement search range is a 3×3 pixel area within the range [-1, 1], with the refinement search starting position at [0, 0] and vertical and horizontal coordinates offset. A full point search is performed within this range, as shown in Figure 10.

[0705] For reference points with a search region of 6, both TmpRefineRangeHor and TmpRefineRangeVer can be set to 5. That is, when regionId is 6, the refinement search range is an 11×11 pixel area within the range [-5, 5], with the refinement search starting position at [0, 0] as the vertical and horizontal coordinates. A full point search is performed within this range, as shown in Figure 11.

[0706] In addition, for the case where regionId is 6: Alternatively, if used in conjunction with the IntraTMP-LIC mode, when the IntraTMP-LIC mode is selected for the current block, the fine search range is a 5×5 pixel region with the fine search starting position at [0,0] and vertical and horizontal coordinates offset within the range [-2,2], respectively. Otherwise, when the IntraTMP-LIC mode is not selected for the current block, the fine search range is an 11×11 pixel region with the fine search starting position at [0,0] and vertical and horizontal coordinates offset within the range [-5,5], respectively. A point-by-point full search is performed within this range, as shown in Figure 12. In Figure 12, (a) shows the case where the IntraTMP-LIC mode is selected for the current block, i.e., the syntax element (flag) corresponding to the IntraTMP-LIC mode for the current block is set to 1; (b) shows the case where the IntraTMP-LIC mode is not selected for the current block, i.e., the syntax element (flag) corresponding to the IntraTMP-LIC mode for the current block is set to 0.

[0707] It should also be noted that, in the IntraTMP-LIC mode, after searching for a matching position for the current block using the template, a LIC model (e.g., a linear model) is established between the template of the current block and the template at the matching position in the IntraTMP mode, as shown in the aforementioned equation (2). Here, I0(x, y) is the pixel value in the current template / current prediction block, I1(x, y) is the pixel value in the reference template / reference block, and a and b are linear model parameters. Here, a and b can be obtained from the current block template and the reference block template (e.g., using the least squares method), and then the pixel values ​​in the reference block are substituted in to obtain the pixel values ​​in the current prediction block.

[0708] For the search region 7, both TmpRefineRangeHor and TmpRefineRangeVer can be set to 2. This means the refined search starts at the [0,0] coordinate, with the vertical and horizontal coordinates offset to a 5×5 pixel region within the [-2,2] range, as shown in Figure 21. A full, point-by-point search is performed within this range. Note that this approach is consistent with the process when regionId is 6 and the IntraTMP-LIC mode flag is enabled.

[0709] Directly use the search window, treat the fine search area as a whole undetermined reconstruction area, and traverse directly:

[0710] According to the optimal matching block position obtained by the rough search, a new search range is obtained: iHorMax refine =min(picWidth-nTbW,BestPosX+TmpRefineRangeHor); iHorMin refine =max(iTemplateSizeW,BestPosX-TmpRefineRangeHor); iVerMax refine =min(picHeight-nTbH,BestPosY+TmpRefineRangeVer); iVerMin refine =max(iTemplateSizeH,BestPosY-TmpRefineRangeVer);

[0711] Then, the adjusted block vectors BVbvXMins, bvXMaxs, bvYMins, bvYMaxs can be obtained by iVerMin refine 、iVerMax refine 、iHorMin refine 、iHorMax refine Calculation: bvXMins = iHorMin refine –xTbCmp; bvXMaxs=iHorMax refine –xTbCmp; bvYMins=iVerMin refine –yTbCmp; bvYMaxs=iVerMax refine –yTbCmp;

[0712] Fine search in pX is bvXMins refine with bvXMaxs refine Between, pY is in bvYMins refinewith bvYMaxs refine This is done within the block vector range between , that is, all search positions within the fine search window are directly traversed, and availability judgments are made one by one. For example, a search is performed with a step size of 1. The top T best matching costs obtained from the available point template matching are recorded as pDiff_BEST[t], t = 0, ..., T-1, and the corresponding block vector BV is recorded as the best block vector BV_BEST[t], t = 0, ..., T-1. Where T is an integer of 1 or greater. For example, T = 1.

[0713] It should also be noted that in the embodiment of the present application, sub-pixel position search can be further implemented on the basis of the above. Referring to FIG30 , the method may include:

[0714] S3001, comparing the searched integer pixel position costs one by one in the second search area to determine the minimum cost position.

[0715] S3002, perform sub-pixel position search.

[0716] In the embodiment of the present application, for sub-pixel position search, the initial direction of the sub-pixel position is first determined, and then the sub-pixel position index and the final direction index are determined. In one possible implementation, referring to FIG. 31 , the specific implementation is as follows:

[0717] S3101, determine the initial direction of the sub-pixel position.

[0718] S3102, determine the sub-pixel position index and the final direction index.

[0719] For S3101, the sub-pixel search starting position is set as the coordinate [0,0], and the vertical and horizontal coordinates are offset in 8 directions of [-1 / 2, 1 / 2] respectively. The costs of the 8 candidate positions are compared one by one, and the first 4 directions with the smallest costs are determined as the initial directions of the sub-pixel search.

[0720] For S3102, the sub-pixel search starts at the [0,0] coordinate. The vertical and horizontal coordinates of the first four directions determined above are offset by the [-3 / 4, 3 / 4] range, respectively. The search is performed between multiple 1 / 4 pixel precision positions. Specifically, the cost of each of the 10 to 12 candidate positions is compared one by one, and the position with the lowest cost is determined. This is the sub-pixel position index tmpIsSubPel and the final direction index tmpSubIdx. As shown in Figure 13, the white-filled dots are sub-pixel positions, the grid-filled dots are half-pixel positions, and the black-filled dots are whole-pixel positions.

[0721] Exemplarily, tmpIsSubPel can have four values, corresponding to the integer pixel position (0), 1 / 2 pixel position (1), 1 / 4 pixel position (2 or 3) and 3 / 4 pixel position (2 or 3); among which, the serial numbers corresponding to the 1 / 4 and 3 / 4 positions are related to the interpolation positions.

[0722] For example, tmpSubIdx can have eight values, corresponding to eight directions: left (0), right (1), up (2), down (3), upper left (4), upper right (5), lower left (6), and lower right (7).

[0723] In this way, the sub-pixel position (Dx, Dy) value can be used to obtain the specific sub-pixel coordinate position according to tmpIsSubPel and tmpSubIdx, and then the optimal matching coordinate is updated.

[0724] After completing the above operations, the results of the coarse selection and fine selection processes (where the fine selection process includes one or more reference point searches) are combined to obtain one or more optimal block vectors BV_BEST[n] for different algorithm requirements, where n = 0, ..., N-1, and each item is a coordinate pair (pX_BEST, pY_BEST). pX_BEST and pY_BEST are the horizontal and vertical offsets of the best matching template relative to the current coding block template, respectively, and are also the horizontal and vertical offsets of the best matching reconstructed block relative to the current coding block.

[0725] It should also be noted that, in the embodiments of the present application, the aforementioned search scheme may be adjusted.

[0726] In one possible implementation, the BV list after the Intra TMP_Merge list is updated by the Intra TMP_EBVP and the list of the original rectangular search area can be merged into a new coarse search list, and then a fine search is performed. Referring to FIG32 , the specific implementation is as follows:

[0727] S3201: Build an Intra TMP_Merge list to update the rough search list.

[0728] S3202: Build an Intra TMP_EBVP list to update the rough search list.

[0729] S3203: Construct an initial rough search list in the search area with a step size of 3.

[0730] S3204, determine a new rough search list.

[0731] S3205, determine a detailed search list near the rough search list BV with a step size of 1.

[0732] In another possible implementation, the original rectangular search area list can be updated with EBVP, and then merged with the Intra TMP_Merge list to form a new coarse search list, and then a fine search can be performed. Referring to FIG33 , the specific implementation is as follows:

[0733] S3301: Construct an initial rough search list in the search area with a step size of 3.

[0734] S3302: Build an Intra TMP_EBVP list to update the rough search list.

[0735] S3303: Build an Intra TMP_Merge list to update the rough search list.

[0736] S3304, determine a new rough search list.

[0737] S3305, determine a detailed search list near the rough search list BV with a step size of 1.

[0738] In another possible implementation, the original rectangular search area list can be updated using the Intra TMP_Merge list, and then the EBVP update can be performed on this modified list. During the second update, all options in the updated coarse search list can be constructed based on the Intra TMP_EBVP list, and the final list is used as the new coarse search list for the fine search. Referring to Figure 34, the specific implementation is as follows:

[0739] S3401: Construct an initial rough search list in the search area with a step size of 3.

[0740] S3402: Build an Intra TMP_Merge list to update the rough search list.

[0741] S3403: Build an Intra TMP_EBVP list to update the rough search list.

[0742] S3404, determine a detailed search list near the rough search list BV with a step size of 1.

[0743] It should also be noted that in the embodiment of the present application, not only can all BVs replaced by the IntraTMP_Merge list in the rough selection list be checked, but the BV objects and their number checked in the IntraTMP_EBVP list can also be adjusted:

[0744] Exemplarily, the first 5 of the corresponding BV set can be used for checking, or the first 10 of the corresponding BV set can be used for checking. Alternatively, the number of checks can be limited according to the size of the current block, for example, the first 5 blocks with a size less than or equal to 16x16 are checked, and the first 10 blocks with other sizes are checked. Alternatively, the rough selection list can be clustered, and the clustering rule is the geometric distance to the cluster center. The number of cluster centers is 2 to 5, and the EBVP operation is only performed on the cluster centers. Alternatively, the BV of EBVP can be added after the IntraTMP_Merge list until the IntraTMP_Merge list is filled, and then the initial rough search list is updated with this IntraTMP_Merge list, that is, the number is limited to the number of unfilled items in the IntraTMP_Merge list.

[0745] It should also be noted that, in the embodiment of the present application, the length of the IntraTMP_EBVP list can be modified to other values. For example, the list length can be limited to 1, 2, 5, or 10 items.

[0746] It should also be noted that in the embodiment of the present application, restrictions can be made based on the template cost corresponding to the BV (such as SAD, SATD, etc.). The template cost is first calculated for each BV of the EBVP, and a cost threshold is defined. BVs that do not exceed the threshold are then added to the EBVP list.

[0747] It should also be noted that, in the embodiment of the present application, sub-pixel search can be implemented in the fine search stage.

[0748] It should also be noted that, in the embodiment of the present application, when constructing the prediction value of the current block, the prediction value can be corrected by a local filtering method. Alternatively, when constructing the prediction value of the current block, the prediction value can be corrected by weighting multiple prediction values. Alternatively, when constructing the prediction value, a candidate list of prediction values ​​can be constructed by using multiple single prediction values, filtered prediction values, weighted prediction values, and / or construction schemes of these prediction values, and the syntax elements transmitted in the bitstream are used to determine at the decoding end which item in the candidate list to use to obtain the actual prediction value.

[0749] It should also be noted that, in the embodiment of the present application, it may not be shared with the IntraTMP_Merge list, that is, it is only expanded based on the BV directly searched by IntraTMP in the search window.

[0750] It should also be noted that in the embodiment of the present application, it is not necessary to divide the steps into rough search and detailed search. Only a one-time search can be performed, and then the BV options can be expanded based on the one-time search results to obtain the final BV results.

[0751] It should also be noted that, in the embodiment of the present application, the IntraTMP_Merge list only takes the first K (for example, K can be 5) to update the rough search list, and is only expanded based on the BVs of each item in the IntraTMP_Merge list.

[0752] It should also be noted that in the embodiment of the present application, IntraTMP_Merge and IntraTMP_EBVP are used to jointly maintain a Merge list. The first P BVs (for example, P can be 5) in the IntraTMP_Merge list are first taken. Based on these P BVs, IntraTMP_EBVP is expanded to construct a new Merge list of length L (for example, L can be 28). When the expanded BVs fill the new Merge list or the expansion of all P BVs is completed, the cost of each BV in the new Merge list is calculated and sorted. Then, the first Q BVs (for example, Q can be 5) in the sorted list are taken to update the rough selection list.

[0753] It should also be noted that in the embodiment of the present application, when the regionId is 7, the fine search range can also be selected as a 3×3 pixel area in the range of [-1,1] with the fine search starting position as the [0,0] coordinate, and the vertical and horizontal coordinates offset respectively, as shown in Figure 10; or a 7×7 pixel area in the range of [-3,3], as shown in Figure 22; or a 9×9 pixel area in the range of [-4,4], as shown in Figure 23; or an 11×11 pixel area in the range of [-5,5], as shown in Figure 11. A point-by-point full search is performed within this range. It should be noted that when the 3×3 pixel area is selected, the method is consistent with the case where the region Id is 0 to 5 in the related art. In addition, it should be noted that when the 11×11 pixel area is selected, the method is the same as the method when the regionId is 6, or the method is consistent with the case where the region Id is 6 in the related art and the IntraTMP-LIC flag is false when the IntraTMP-LIC mode is turned on.

[0754] It should also be noted that in the embodiment of the present application, when regionId is 7, it can also be used in conjunction with the IntraTMP-LIC mode. As shown in Figure 24, when the current block chooses to use the IntraTMP-LIC mode, the fine search range is a 5×5 pixel area with the fine search starting position as the [0,0] coordinate, and the vertical and horizontal coordinates are offset respectively within the range of [-2,2]. Otherwise, when the current block chooses not to use the IntraTMP-LIC mode, the fine search range is a 7×7 pixel area with the fine search starting position as the [0,0] coordinate, and the vertical and horizontal coordinates are offset respectively within the range of [-3,3] (or various other situations in the aforementioned embodiments). A point-by-point full search is performed within this range. It should be noted that this search method is similar to the processing when regionId is 6 and the IntraTMP-LIC mode is turned on.

[0755] It should also be noted that, in an embodiment of the present application, the method for sub-pixel search can also be: a search between multiple half-pixel positions, that is, the sub-pixel search starting position is the [0,0] coordinate, the vertical and horizontal coordinates are offset by a square area in the range of [-1 / 2, 1 / 2] respectively, and the costs of the 9 candidate positions are compared one by one, as shown in FIG25; or, it can also be a search between multiple 1 / 4 pixel precision positions, that is, the sub-pixel search starting position is the [0,0] coordinate, the vertical and horizontal coordinates are offset by a square area in the range of [-3 / 4, 3 / 4] respectively, and the costs of the 49 candidate positions are compared one by one, as shown in FIG26.

[0756] It should also be noted that in the embodiments of the present application, the sub-pixel search method can also be used to solve the location of the minimum cost by building a model. For example, with the sub-pixel search starting position as the center, several coordinate points are selected around it, and a model is built based on the cost values ​​of these locations. The location corresponding to the minimum value of the model is solved, and this location is selected as the search result.

[0757] Taking the quadratic model as an example, assume that the relationship between Vcost and position near MVint is as shown in the above equation (9). Where (xmin, ymin) is the sub-pixel position where Vcost is minimum, and A, B, and C are model parameters. The model parameters A, B, C, xmin, and ymin can be solved using the Vcost of the corresponding position of MVint and its four adjacent positions above, below, left, and right. Assume that the Vcost of the corresponding position of MVint is Vcost(0,0), and the Vcost of its upper, lower, left, and right positions are Vcost(0,-1), Vcost(0,1), Vcost(-1,0), and Vcost(1,0), respectively.

[0758] The calculation method of xmin and ymin is shown in the above formula (10) and formula (11). Here, the search results can be saved as units such as half pixels, 1 / 4 brightness pixels, 1 / 8 brightness pixels, or 1 / 16 brightness pixels as needed.

[0759] In addition, Vcost can be calculated according to a preset cost function, such as the sum of absolute error SAD, the sum of absolute transformation difference SATD, the mean square error MSE, the sum of squared errors SSD, the mean absolute difference MAD, the mean sum of squared errors MSD, the normalized correlation coefficient NCC, etc.

[0760] It should also be noted that in the embodiment of the present application, between different search steps, the cost function can choose the same type, for example, all are SAD; or different values ​​can be selected, such as SAD for coarse search, SAD or SATD for fine search, SAD or SATD, SSE for sub-pixel search, etc., which are not specifically limited here.

[0761] In the embodiments of the present application, the specific implementation of the aforementioned embodiments is described in detail through the aforementioned embodiments. It can be seen that, according to the technical solutions of the aforementioned embodiments, a method for expanding the coverage of the IntraTMP search list is proposed, which increases the BV candidate positions derived from the BV information of the reconstructed blocks, effectively improving the encoding accuracy. In other words, this technical solution can effectively utilize the information of spatially adjacent and non-adjacent reconstructed blocks, and increases the search area range of IntraTMP without significantly increasing the encoding complexity. It also expands the search method of the fine search, making the vector parameters of the current block after the fine search more accurate, thereby improving the prediction accuracy, and further improving the encoding and decoding efficiency and encoding and decoding performance.

[0762] In yet another embodiment of the present application, based on the same inventive concept as the aforementioned embodiment, FIG35 is a schematic diagram of the composition structure of an encoder provided in an embodiment of the present application. As shown in FIG35 , the encoder 350 may include a first determination unit 3501, a first update unit 3502, and a first prediction unit 3503, wherein:

[0763] A first determining unit 3501 is configured to determine a first candidate list for the current block; wherein the first candidate list includes one or more candidate vector parameters;

[0764] The first updating unit 3502 is configured to determine a second position block based on the candidate vector parameters in the first candidate list and / or the vector parameters of the first position block of the current block; and when the coding parameters of the second position block include vector parameters, determine whether the vector parameters of the second position block meet a second condition based on the vector parameters of the second position block; when the vector parameters of the second position block meet the second condition, update the first candidate list based on the vector parameters of the second position block; and determine a second search area based on the candidate vector parameters in the updated first candidate list, and determine the vector parameters of the current block based on the second search area;

[0765] The first prediction unit 3503 is configured to determine a prediction value of the current block according to the vector parameters of the current block.

[0766] In some embodiments, the first determination unit 3501 is further configured to determine whether the vector parameters of the first position block meet the first condition based on the vector parameters of the first position block when the encoding parameters of the first position block of the current block include vector parameters; and determine the second position block based on the vector parameters of the first position block when the vector parameters of the first position block meet the first condition.

[0767] In some embodiments, the vector parameters include block vector parameters and / or motion vector parameters.

[0768] In some embodiments, the first determining unit 3501 is further configured to determine a first search area of ​​the current block; and determine a first candidate list of the current block according to the first search area.

[0769] In some embodiments, the first determining unit 3501 is further configured to determine a first template of the current block; and determine a first search area of ​​the current block according to the first template.

[0770] In some embodiments, the first determination unit 3501 is further configured to search in the first search area according to the first search step to determine one or more first candidate vector parameters; and add the one or more first candidate vector parameters to the first candidate list of the current block.

[0771] In some embodiments, the first determination unit 3501 is further configured to traverse the search points in the first search area according to the first search step size, and determine the first matching cost value between the matching template corresponding to the search point in the first search area and the first template according to a preset matching criterion; and determine one or more matching search points based on the first matching cost value, and determine one or more first candidate vector parameters based ...

Claims

1. A decoding method, applied to a decoder, the method comprising: Determine a first candidate list for a current block; wherein, the first candidate list includes one or more candidate vector parameters; Determine a second position block according to the candidate vector parameters in the first candidate list and / or the vector parameters of the first position block of the current block; When the decoding parameters of the second position block include vector parameters, determine whether the vector parameters of the second position block satisfy a second condition according to the vector parameters of the second position block; When the vector parameters of the second position block satisfy the second condition, update the first candidate list according to the vector parameters of the second position block; Determine a second search region according to the candidate vector parameters in the updated first candidate list, and determine the vector parameters of the current block according to the second search region; Determine a predicted value of the current block according to the vector parameters of the current block.

2. The method according to claim 1, wherein When determining the second position block according to the vector parameters of the first position block of the current block, the method further comprises: When the decoding parameters of the first position block of the current block include vector parameters, determine whether the vector parameters of the first position block satisfy a first condition according to the vector parameters of the first position block; When the vector parameters of the first position block satisfy the first condition, determine the second position block according to the vector parameters of the first position block.

3. The method according to claim 1, wherein The vector parameters include block vector parameters and / or motion vector parameters.

4. The method according to claim 1, wherein, The determining the first candidate list for the current block includes: Determine a first search region for the current block; Determine the first candidate list for the current block according to the first search region.

5. The method according to claim 4, wherein, The determining the first search region for the current block includes: Determine a first template for the current block; Determine the first search region for the current block according to the first template.

6. The method according to claim 4, wherein, The determining the first candidate list for the current block according to the first search region includes: Search within the first search region according to a first search step size to determine one or more first candidate vector parameters; Add the one or more first candidate vector parameters to the first candidate list for the current block.

7. The method according to claim 6, wherein The searching within the first search region according to the first search step size to determine one or more first candidate vector parameters includes: Traverse the search points in the first search region according to the first search step size, and determine a first matching cost value between the matching template corresponding to the search point in the first search region and the first template according to a preset matching criterion; Determine one or more matching search points according to the first matching cost value, and determine the one or more first candidate vector parameters according to the one or more matching search points.

8. The method according to claim 2, wherein The first condition includes: the cost value corresponding to the vector parameters of the first position block is better than the cost value corresponding to at least one candidate vector parameter in the first candidate list.

9. The method according to claim 8, wherein The method further comprises: Determine the cost value corresponding to the vector parameters of the first position block according to the matching cost value between the matching template corresponding to the vector parameters of the first position block and the first template; Determine the cost value corresponding to at least one candidate vector parameter in the first candidate list according to the matching cost value between the matching template corresponding to the at least one candidate vector parameter in the first candidate list and the first template; When the cost value corresponding to the vector parameter of the first position block is less than the cost value corresponding to at least one candidate vector parameter in the first candidate list, it is determined that the vector parameter of the first position block satisfies the first condition.

10. The method according to claim 2, wherein The method further includes: When the vector parameter of the first position block satisfies the first condition, update the first candidate list according to the vector parameter of the first position block.

11. The method according to claim 10, wherein, The updating the first candidate list according to the vector parameter of the first position block includes: Add the vector parameter of the first position block to the first candidate list.

12. The method according to claim 1, wherein The second position block represents the reference block pointed to by the vector parameter of the first position block.

13. The method according to claim 1, wherein, The second position block represents the block pointed to by the vector parameter of the reference block pointed to by the vector parameter of the first position block.

14. The method according to claim 1, wherein, The second condition includes: the cost value corresponding to the vector parameter of the second position block is better than the cost value corresponding to at least one candidate vector parameter in the first candidate list.

15. The method according to claim 14, wherein, The method further includes: Determine the cost value corresponding to the vector parameter of the second position block according to the matching cost value between the matching template corresponding to the vector parameter of the second position block and the first template; Determine the cost value corresponding to at least one candidate vector parameter in the first candidate list according to the matching cost value between the matching template corresponding to at least one candidate vector parameter in the first candidate list and the first template; When the cost value corresponding to the vector parameter of the second position block is less than the cost value corresponding to at least one candidate vector parameter in the first candidate list, it is determined that the vector parameter of the second position block satisfies the second condition.

16. The method according to claim 1, wherein The updating the first candidate list according to the vector parameter of the second position block includes: Add the vector parameter of the second position block to the first candidate list.

17. The method according to claim 1, wherein, The method further includes: When the vector parameter of the first position block satisfies the first condition, determine the first candidate set of the current block according to the vector parameter of the first position block, and update the first candidate list according to the first candidate set; When the vector parameter of the second position block satisfies the second condition, determine the second candidate set of the current block according to the vector parameter of the second position block, and update the first candidate list according to the second candidate set; Determine the predicted value of the current block according to the first candidate list.

18. The method according to claim 17, wherein The updating the first candidate list according to the first candidate set includes: Determine the cost value corresponding to the second candidate vector parameter in the first candidate set, and determine the maximum cost value corresponding to one or more candidate vector parameters in the first candidate list; When the cost value corresponding to the second candidate vector parameter is less than the maximum cost value in the first candidate list, use the second candidate vector parameter to replace the candidate vector parameter corresponding to the maximum cost value in the first candidate list to update the first candidate list; Among them, the second candidate vector parameter is any one of the vector parameters in the first candidate set.

19. The method according to claim 18, wherein The replacing the candidate vector parameter corresponding to the maximum cost value in the first candidate list with the second candidate vector parameter includes: Adding the second candidate vector parameter to the first candidate list and deleting the candidate vector parameter corresponding to the maximum cost value from the first candidate list.

20. The method according to claim 18, wherein The determining the second candidate set of the current block includes: Determining one or more second candidate vector parameters updated from the first candidate set to the first candidate list; Determining the second position block according to the one or more second candidate vector parameters, and determining the second candidate set of the current block according to the vector parameters of the second position block.

21. The method according to claim 18, wherein, The determining the second candidate set of the current block includes: After updating the first candidate list according to the first candidate set, determining the second position block according to all the candidate vector parameters in the first candidate list, and determining the second candidate set of the current block according to the vector parameters of the second position block.

22. The method according to claim 17, wherein, The determining the second candidate set of the current block includes: After updating the first candidate list according to the first candidate set, determining the first N candidate vector parameters in the first candidate list; Determining the second position block according to the N candidate vector parameters, and determining the second candidate set of the current block according to the vector parameters of the second position block; where N is a positive integer.

23. The method according to claim 22, wherein, The method further includes: Determining the value of N according to the size parameter of the current block.

24. The method according to claim 17, wherein, The determining the second candidate set of the current block includes: After updating the first candidate list according to the first candidate set, clustering the first candidate list to determine M candidate vector parameters at the cluster center; Determining the second position block according to the M candidate vector parameters, and determining the second candidate set of the current block according to the vector parameters of the second position block; where M is a positive integer.

25. The method according to claim 17, wherein The method further includes: When all the vector parameters of the second position block are traversed or the number of candidate vector parameters in the second candidate set is greater than the first threshold, determining that the construction of the third candidate set is completed.

26. The method according to claim 25, wherein, The method further includes: Determining the second matching cost value between the matching template corresponding to the third candidate vector parameter in the second candidate set and the first template according to a preset matching criterion; When the second matching cost value is greater than the second threshold, deleting the third candidate vector parameter from the second candidate set to update the second candidate set; Among them, the third candidate vector parameter is any one of the vector parameters in the second candidate set.

27. The method according to claim 17, wherein The method further includes: When the first candidate set of the current block is not full, filling the vector parameters of the second position block into the first candidate set until the first candidate set is full; Updating the first candidate list according to the filled first candidate set.

28. The method according to claim 17, wherein The updating the first candidate list according to the first candidate set includes: Determine the top K candidate vector parameters in the first candidate set; Update the first candidate list according to the top K candidate vector parameters; where K is a positive integer.

29. The method according to claim 17, wherein, The method further includes: Determine the top P candidate vector parameters in the first candidate set; Determine the second position block according to the P candidate vector parameters, and determine the vector parameters of the second position block; When the vector parameters of the second position block satisfy the second condition, construct a fourth candidate set for the current block according to the vector parameters of the second position block, and determine that the construction of the fourth candidate set is completed when all the P candidate vector parameters are traversed or the fourth candidate set is filled; Determine the cost values corresponding to one or more candidate vector parameters in the fourth candidate set, and determine Q candidate vector parameters from the fourth candidate set according to the cost values corresponding to the one or more candidate vector parameters; Update the first candidate list according to the Q candidate vector parameters; where P and Q are positive integers.

30. The method according to any one of claims 1 to 29, wherein, The determining the second search area according to the candidate vector parameters in the updated first candidate list includes: Based on the candidate vector parameters in the first candidate list, determine the starting position of the second search area; Based on the starting position, offset a first preset range in the vertical and horizontal directions respectively, and determine the obtained pixel area as the second search area.

31. The method according to claim 30, wherein, The method further includes: When the first preset range is [-1, 1], the second search area is within the obtained 3×3 pixel area; or, When the first preset range is [-2, 2], the second search area is within the obtained 5×5 pixel area; or, When the first preset range is [-3, 3], the second search area is within the obtained 7×7 pixel area; or, When the first preset range is [-4, 4], the second search area is within the obtained 9×9 pixel area; or, When the first preset range is [-5, 5], the second search area is within the obtained 11×11 pixel area.

32. The method according to claim 31, wherein, The method further includes: Decode the bitstream and determine the value of the third syntax element; When the third syntax element indicates that the current block uses the first prediction mode, determine that the second search area is within the obtained 5×5 pixel area when the first preset range is [-2, 2].

33. The method according to claim 32, wherein, The method further includes: When the third syntax element indicates that the current block does not use the first prediction mode, determine that the second search area is within the pixel area obtained when the first preset range is outside [-2, 2].

34. The method according to claim 6, wherein The determining the vector parameters of the current block according to the second search area includes: Search within the second search area according to a second search step to determine the vector parameters of the current block; Wherein, the value of the second search step is less than the value of the first search step.

35. The method according to any one of claims 1 to 29, wherein, The determining the vector parameters of the current block according to the second search area includes: Perform a point-by-point full search within the second search area to determine the vector parameters of the current block.

36. The method according to claim 35, wherein The method further includes: After performing a point-by-point full search within the second search area, determine new candidate vector parameters for the current block; Based on the new candidate vector parameters, perform a sub-pixel search to determine the vector parameters of the current block.

37. The method according to claim 36, wherein, After performing a point-by-point full search within the second search area, determining new candidate vector parameters for the current block includes: According to a preset matching criterion, determine the third matching cost value between the matching templates corresponding to multiple search points in the second search area and the first template of the current block; Determine the minimum matching cost value from the third matching cost values of the multiple search points, and determine the new candidate vector parameters according to the search point corresponding to the minimum matching cost value.

38. The method according to claim 36, wherein, Based on the new candidate vector parameters, performing a sub-pixel search to determine the vector parameters of the current block includes: Determine the third search area indicated by the new candidate vector parameters; According to multiple candidate positions in the third search area, perform a search to determine the initial direction of the sub-pixel search; Based on the initial direction of the sub-pixel search, determine the fourth search area, and perform a search according to multiple candidate positions in the fourth search area to determine the sub-pixel position index and direction index of the current block; According to the sub-pixel position index and the direction index, determine the vector parameters of the current block.

39. The method according to claim 38, wherein Determining the third search area indicated by the new candidate vector parameters includes: Based on the new candidate vector parameters, determine the starting position of the third search area; Perform a half-pixel position search based on the starting position, and determine the multiple obtained candidate positions as the third search area.

40. The method according to claim 38, wherein, According to multiple candidate positions in the third search area, performing a search to determine the initial direction of the sub-pixel search includes: According to a preset matching criterion, determine the fourth matching cost value between the matching templates corresponding to multiple candidate positions in the third search area and the first template of the current block; Sort the fourth matching cost values of the multiple candidate positions from small to large, and determine the top H matching cost values; Determine the initial direction of the sub-pixel search according to the candidate positions corresponding to the H matching cost values; where H is a positive integer.

41. The method according to claim 39, wherein, Based on the initial direction of the sub-pixel search, determining the fourth search area includes: Based on the starting position and the initial direction of the sub-pixel search, perform a sub-pixel position search, and determine the multiple obtained candidate positions as the fourth search area.

42. The method according to claim 36, wherein Based on the new candidate vector parameters, performing a sub-pixel search to determine the vector parameters of the current block includes: Determine the starting position of the sub-pixel search and multiple candidate positions around the starting position; Calculate the cost value corresponding to each of the multiple candidate positions, and construct a preset cost model according to the multiple candidate positions and their corresponding cost values; where the preset cost model is used to indicate the mapping relationship between candidate positions and cost values. Determine the candidate position corresponding to the minimum cost value according to the preset cost model, and determine the candidate position corresponding to the minimum cost value as the vector parameter of the current block.

43. The method according to any one of claims 1 to 42, wherein, When there is one vector parameter of the current block, the determining the predicted value of the current block according to the vector parameter of the current block includes: Determine the reference block of the current block according to the vector parameter of the current block; Determine the predicted value of the current block according to the reference block.

44. The method according to claim 43, wherein, The determining the predicted value of the current block according to the reference block includes: Filter the reference block to determine the filtered reference block; Determine the predicted value of the current block according to the filtered reference block.

45. The method according to claim 43, wherein, The determining the predicted value of the current block according to the reference block includes: Determine the first predicted block of the current block according to the reference block; Perform prediction on the current block according to the second prediction mode to determine the second predicted block of the current block; wherein, the second prediction mode is a non-intra-frame template matching prediction mode; Determine the predicted value of the current block according to the first predicted block and the second predicted block.

46. The method according to any one of claims 1 to 42, wherein When there are multiple vector parameters of the current block, the determining the predicted value of the current block according to the vector parameter of the current block includes: Determine multiple reference blocks of the current block according to the multiple vector parameters of the current block; Determine the predicted value of the current block according to the multiple reference blocks.

47. The method according to claim 46, wherein, The determining the predicted value of the current block according to the multiple reference blocks includes: Determine multiple predicted blocks of the current block according to the multiple reference blocks; Perform weighted fusion on the multiple predicted blocks to determine the predicted value of the current block.

48. The method according to any one of claims 1 to 42, wherein, The determining the predicted value of the current block according to the vector parameter of the current block includes: Decode the bitstream to determine the value of the first syntax element; Determine the way to construct the predicted value of the current block according to the value of the first syntax element and the candidate list for constructing the predicted value of the current block; Determine the predicted value of the current block according to the vector parameter of the current block and the way to construct the predicted value.

49. The method according to any one of claims 1 to 48, wherein, The method further includes: Decode the bitstream to determine the value of the second syntax element; When the second syntax element indicates that the current block uses the intra-frame template matching prediction mode, perform the step of determining the first candidate list of the current block.

50. The method according to any one of claims 1 to 48, wherein, The method further includes: Decode the bitstream to determine the prediction difference of the current block; Determine the reconstructed value of the current block according to the prediction difference and the predicted value of the current block.

51. An encoding method, applied to an encoder, the method includes: Determine the first candidate list of the current block; wherein, the first candidate list includes one or more candidate vector parameters; Determine the second position block according to the candidate vector parameters in the first candidate list and / or the vector parameter of the first position block of the current block; When the encoding parameter of the second position block includes a vector parameter, determine whether the vector parameter of the second position block satisfies the second condition according to the vector parameter of the second position block; When the vector parameter of the second position block satisfies the second condition, update the first candidate list according to the vector parameter of the second position block; Determine a second search region according to the candidate vector parameters in the updated first candidate list, and determine the vector parameters of the current block according to the second search region; Determine the predicted value of the current block according to the vector parameters of the current block.

52. The method according to claim 51, wherein, When determining the second position block according to the vector parameters of the first position block of the current block, the method further includes: When the decoding parameters of the first position block of the current block include vector parameters, determine whether the vector parameters of the first position block satisfy a first condition according to the vector parameters of the first position block; When the vector parameters of the first position block satisfy the first condition, determine the second position block according to the vector parameters of the first position block.

53. The method according to claim 51, wherein, The vector parameters include block vector parameters and / or motion vector parameters.

54. The method according to claim 51, wherein, The determining the first candidate list of the current block includes: Determine the first search region of the current block; Determine the first candidate list of the current block according to the first search region.

55. The method according to claim 54, wherein, The determining the first search region of the current block includes: Determine the first template of the current block; Determine the first search region of the current block according to the first template.

56. The method according to claim 54, wherein, The determining the first candidate list of the current block according to the first search region includes: Search within the first search region according to a first search step size to determine one or more first candidate vector parameters; Add the one or more first candidate vector parameters to the first candidate list of the current block.

57. The method according to claim 56, wherein, The searching within the first search region according to a first search step size to determine one or more first candidate vector parameters includes: Traverse the search points in the first search region according to the first search step size, and determine the first matching cost value between the matching template corresponding to the search point in the first search region and the first template according to a preset matching criterion; Determine one or more matching search points according to the first matching cost value, and determine the one or more first candidate vector parameters according to the one or more matching search points.

58. The method according to claim 52, wherein, The first condition includes: the cost value corresponding to the vector parameters of the first position block is better than the cost value corresponding to at least one candidate vector parameter in the first candidate list.

59. The method according to claim 58, wherein, The method further includes: Determine the cost value corresponding to the vector parameters of the first position block according to the matching cost value between the matching template corresponding to the vector parameters of the first position block and the first template; Determine the cost value corresponding to at least one candidate vector parameter in the first candidate list according to the matching cost value between the matching template corresponding to at least one candidate vector parameter in the first candidate list and the first template; When the cost value corresponding to the vector parameters of the first position block is less than the cost value corresponding to at least one candidate vector parameter in the first candidate list, it is determined that the vector parameters of the first position block satisfy the first condition.

60. The method according to claim 52, wherein, The method further includes: When the vector parameters of the first position block satisfy the first condition, update the first candidate list according to the vector parameters of the first position block.

61. The method according to claim 60, wherein, The updating the first candidate list according to the vector parameters of the first position block includes: Add the vector parameter of the first position block to the first candidate list.

62. The method according to claim 51, wherein, The second position block represents the reference block pointed to by the vector parameter of the first position block.

63. The method according to claim 51, wherein The second position block represents the block pointed to by the vector parameter of the reference block pointed to by the vector parameter of the first position block.

64. The method according to claim 51, wherein, The second condition includes: the cost value corresponding to the vector parameter of the second position block is better than the cost value corresponding to at least one candidate vector parameter in the first candidate list.

65. The method according to claim 64, wherein, The method further includes: Determine the cost value corresponding to the vector parameter of the second position block according to the matching cost value between the matching template corresponding to the vector parameter of the second position block and the first template; Determine the cost value corresponding to at least one candidate vector parameter in the first candidate list according to the matching cost value between the matching template corresponding to at least one candidate vector parameter in the first candidate list and the first template; When the cost value corresponding to the vector parameter of the second position block is less than the cost value corresponding to at least one candidate vector parameter in the first candidate list, it is determined that the vector parameter of the second position block satisfies the second condition.

66. The method according to claim 51, wherein, The updating the first candidate list according to the vector parameter of the second position block includes: Add the vector parameter of the second position block to the first candidate list.

67. The method according to claim 51, wherein The method further includes: When the vector parameter of the first position block satisfies the first condition, determine the first candidate set of the current block according to the vector parameter of the first position block, and update the first candidate list according to the first candidate set; When the vector parameter of the second position block satisfies the second condition, determine the second candidate set of the current block according to the vector parameter of the second position block, and update the first candidate list according to the second candidate set; Determine the predicted value of the current block according to the first candidate list.

68. The method according to claim 67, wherein, The updating the first candidate list according to the first candidate set includes: Determine the cost value corresponding to the second candidate vector parameter in the first candidate set, and determine the maximum cost value corresponding to one or more candidate vector parameters in the first candidate list; When the cost value corresponding to the second candidate vector parameter is less than the maximum cost value in the first candidate list, use the second candidate vector parameter to replace the candidate vector parameter corresponding to the maximum cost value in the first candidate list to update the first candidate list; Wherein, the second candidate vector parameter is any vector parameter in the first candidate set.

69. The method according to claim 68, wherein, The using the second candidate vector parameter to replace the candidate vector parameter corresponding to the maximum cost value in the first candidate list includes: Add the second candidate vector parameter to the first candidate list, and delete the candidate vector parameter corresponding to the maximum cost value from the first candidate list.

70. The method according to claim 68, wherein, The determining the second candidate set of the current block includes: Determine one or more second candidate vector parameters updated from the first candidate set to the first candidate list; Determine the second position block according to the one or more second candidate vector parameters, and determine the second candidate set of the current block according to the vector parameters of the second position block.

71. The method according to claim 68, wherein, The determining the second candidate set of the current block includes: After updating the first candidate list according to the first candidate set, determine the second position block according to all the candidate vector parameters in the first candidate list, and determine the second candidate set of the current block according to the vector parameters of the second position block.

72. The method according to claim 67, wherein, The determining the second candidate set of the current block includes: After updating the first candidate list according to the first candidate set, determine the first N candidate vector parameters in the first candidate list; Determine the second position block according to the N candidate vector parameters, and determine the second candidate set of the current block according to the vector parameters of the second position block; where N is a positive integer.

73. The method according to claim 72, wherein, The method further includes: Determine the value of N according to the size parameter of the current block.

74. The method according to claim 67, wherein, The determining the second candidate set of the current block includes: After updating the first candidate list according to the first candidate set, cluster the first candidate list to determine M candidate vector parameters at the cluster center; Determine the second position block according to the M candidate vector parameters, and determine the second candidate set of the current block according to the vector parameters of the second position block; where M is a positive integer.

75. The method according to claim 67, wherein, The method further includes: When all the vector parameters of the second position block are traversed or the number of candidate vector parameters in the second candidate set is greater than the first threshold, determine that the construction of the third candidate set is completed.

76. The method according to claim 75, wherein, The method further includes: Determine the second matching cost value between the matching template corresponding to the third candidate vector parameter in the second candidate set and the first template according to a preset matching criterion; When the second matching cost value is greater than the second threshold, delete the third candidate vector parameter from the second candidate set to update the second candidate set; Wherein, the third candidate vector parameter is any one vector parameter in the second candidate set.

77. The method according to claim 67, wherein The method further includes: When the first candidate set of the current block is not full, fill the vector parameters of the second position block into the first candidate set until the first candidate set is full; Update the first candidate list according to the filled first candidate set.

78. The method according to claim 67, wherein, The updating the first candidate list according to the first candidate set includes: Determine the first K candidate vector parameters in the first candidate set; Update the first candidate list according to the first K candidate vector parameters; where K is a positive integer.

79. The method according to claim 67, wherein, The method further includes: Determine the first P candidate vector parameters in the first candidate set; Determine the second position block according to the P candidate vector parameters, and determine the vector parameters of the second position block; When the vector parameters of the second position block satisfy the second condition, construct a fourth candidate set for the current block according to the vector parameters of the second position block, and determine that the construction of the fourth candidate set is completed when all of the P candidate vector parameters have been traversed or the fourth candidate set is full; Determine the cost values corresponding to one or more candidate vector parameters in the fourth candidate set, and determine Q candidate vector parameters from the fourth candidate set according to the cost values corresponding to the one or more candidate vector parameters; Update the first candidate list according to the Q candidate vector parameters; where P and Q are positive integers.

80. The method according to any one of claims 51 to 79, wherein The determining the second search area according to the candidate vector parameters in the updated first candidate list includes: Determine the starting position of the second search area based on the candidate vector parameters in the first candidate list; Based on the starting position, offset a first preset range in the vertical and horizontal directions respectively, and determine the obtained pixel area as the second search area.

81. The method according to claim 80, wherein, The method further includes: When the first preset range is [-1, 1], the second search area is within the obtained 3×3 pixel area; or, When the first preset range is [-2, 2], the second search area is within the obtained 5×5 pixel area; or, When the first preset range is [-3, 3], the second search area is within the obtained 7×7 pixel area; or, When the first preset range is [-4, 4], the second search area is within the obtained 9×9 pixel area; or, When the first preset range is [-5, 5], the second search area is within the obtained 11×11 pixel area.

82. The method according to claim 81, wherein The method further includes: When the current block uses the first prediction mode, determine that the second search area is within the obtained 5×5 pixel area when the first preset range is [-2, 2]; When the current block does not use the first prediction mode, determine that the second search area is within the pixel area obtained when the first preset range is outside [-2, 2].

83. The method according to claim 82, wherein The method further includes: Determine the value of a third syntax element; where the third syntax element is used to indicate whether the current block uses the first prediction mode; Perform encoding processing on the value of the third syntax element, and write the obtained encoded bits into the code stream.

84. The method according to claim 56, wherein, The determining the vector parameters of the current block according to the second search area includes: Search within the second search area according to a second search step to determine the vector parameters of the current block; Wherein, the value of the second search step is less than the value of the first search step.

85. The method according to any one of claims 51 to 79, wherein, The determining the vector parameters of the current block according to the second search area includes: Perform a point-by-point full search within the second search area to determine the vector parameters of the current block.

86. The method according to claim 85, wherein The method further includes: After performing a point-by-point full search within the second search area, determine new candidate vector parameters for the current block; Perform sub-pixel search based on the new candidate vector parameters to determine the vector parameters of the current block.

87. The method according to claim 86, wherein, After performing point-by-point full search within the second search region, determining the new candidate vector parameters of the current block includes: Determine the third matching cost value between the matching templates corresponding to multiple search points in the second search region and the first template of the current block according to a preset matching criterion; Determine the minimum matching cost value from the third matching cost values of the multiple search points, and determine the new candidate vector parameters according to the search point corresponding to the minimum matching cost value.

88. The method according to claim 86, wherein, The performing sub-pixel search based on the new candidate vector parameters to determine the vector parameters of the current block includes: Determine the third search region indicated by the new candidate vector parameters; Perform search according to multiple candidate positions in the third search region to determine the initial direction of the sub-pixel search; Determine the fourth search region based on the initial direction of the sub-pixel search, and perform search according to multiple candidate positions in the fourth search region to determine the sub-pixel position index and direction index of the current block; Determine the vector parameters of the current block according to the sub-pixel position index and the direction index.

89. The method according to claim 88, wherein The determining the third search region indicated by the new candidate vector parameters includes: Based on the new candidate vector parameters, determine the starting position of the third search region; Perform half-pixel position search based on the starting position, and determine the obtained multiple candidate positions as the third search region.

90. The method according to claim 88, wherein, The performing search according to multiple candidate positions in the third search region to determine the initial direction of the sub-pixel search includes: Determine the fourth matching cost value between the matching templates corresponding to multiple candidate positions in the third search region and the first template of the current block according to a preset matching criterion; Sort the fourth matching cost values of the multiple candidate positions from small to large, and determine the top H matching cost values; Determine the initial direction of the sub-pixel search according to the candidate positions corresponding to the H matching cost values; where H is a positive integer.

91. The method according to claim 89, wherein, The determining the fourth search region based on the initial direction of the sub-pixel search includes: Perform sub-pixel position search based on the starting position and the initial direction of the sub-pixel search, and determine the obtained multiple candidate positions as the fourth search region.

92. The method according to claim 86, wherein, The performing sub-pixel search based on the new candidate vector parameters to determine the vector parameters of the current block includes: Determine the starting position of the sub-pixel search and multiple candidate positions around the starting position; Calculate the cost value corresponding to each of the multiple candidate positions, and construct a preset cost model according to the multiple candidate positions and their corresponding cost values; where the preset cost model is used to indicate the mapping relationship between candidate positions and cost values; Determine the candidate position corresponding to the minimum cost value according to the preset cost model, and determine the candidate position corresponding to the minimum cost value as the vector parameters of the current block.

93. The method according to any one of claims 51 to 92, wherein, When there is one vector parameter of the current block, the determining the predicted value of the current block according to the vector parameter of the current block includes: Determine a reference block of the current block according to vector parameters of the current block; Determine a predicted value of the current block according to the reference block.

94. The method according to claim 93, wherein The determining the predicted value of the current block according to the reference block includes: Filter the reference block to determine a filtered reference block; Determine the predicted value of the current block according to the filtered reference block.

95. The method according to claim 93, wherein, The determining the predicted value of the current block according to the reference block includes: Determine a first predicted block of the current block according to the reference block; Predict the current block according to a second prediction mode to determine a second predicted block of the current block; wherein, the second prediction mode is a non-intra-frame template matching prediction mode; Determine the predicted value of the current block according to the first predicted block and the second predicted block.

96. The method according to any one of claims 51 to 92, wherein, When there are multiple vector parameters of the current block, the determining the predicted value of the current block according to the vector parameters of the current block includes: Determine multiple reference blocks of the current block according to the multiple vector parameters of the current block; Determine the predicted value of the current block according to the multiple reference blocks.

97. The method according to claim 96, wherein, The determining the predicted value of the current block according to the multiple reference blocks includes: Determine multiple predicted blocks of the current block according to the multiple reference blocks; Perform weighted fusion on the multiple predicted blocks to determine the predicted value of the current block.

98. The method according to any one of claims 51 to 92, wherein, The determining the predicted value of the current block according to the vector parameters of the current block includes: Determine a way to construct the predicted value of the current block; Determine the predicted value of the current block according to the vector parameters of the current block and the way to construct the predicted value.

99. The method according to claim 98, wherein The determining the way to construct the predicted value of the current block includes: Determine a candidate list for constructing the predicted value of the current block; wherein, the candidate list for constructing the predicted value includes at least one candidate way to construct the predicted value; Calculate costs for each of the at least one candidate way to construct the predicted value respectively to determine at least one cost result; Determine a minimum cost result from the at least one cost result, and determine the candidate way to construct the predicted value corresponding to the minimum cost result as the way to construct the predicted value of the current block.

100. The method according to claim 99, wherein, The method further includes: Determine a value of a first syntax element; wherein, the value of the first syntax element is used to indicate an index number of the way to construct the predicted value of the current block in the candidate list for constructing the predicted value; Perform encoding processing on the value of the first syntax element, and write the obtained encoded bits into a bitstream.

101. The method according to any one of claims 51 to 100, wherein The method further includes: Determine a value of a second syntax element; wherein, the value of the second syntax element is used to indicate whether the current block uses the intra-frame template matching prediction mode; Perform encoding processing on the value of the second syntax element, and write the obtained encoded bits into a bitstream.

102. The method according to claim 101, wherein The method further includes: When the current block uses the intra-frame template matching prediction mode, perform the step of determining a first candidate list of the current block.

103. The method according to any one of claims 51 to 100, wherein The method further includes: Determine a prediction difference of the current block according to the predicted value of the current block; Perform encoding processing on the prediction difference of the current block, and write the obtained encoded bits into a bitstream.

104. A bitstream, wherein, The bitstream is generated by performing bit encoding on the information to be encoded; wherein, the information to be encoded includes at least one of the following: the prediction difference of the current block, the value of the first syntax element, the value of the second syntax element, and the value of the third syntax element; wherein, the value of the first syntax element is used to indicate the index number of the current block's construction prediction value method in the construction prediction value candidate list, the value of the second syntax element is used to indicate whether the current block uses the intra-frame template matching prediction mode, and the third syntax element is used to indicate whether the current block uses the first prediction mode.

105. An encoder, comprising a first determination unit, a first update unit, and a first prediction unit, wherein: The first determination unit is configured to determine a first candidate list of the current block; wherein, the first candidate list includes one or more candidate vector parameters; The first update unit is configured to determine a second position block according to the candidate vector parameters in the first candidate list and / or the vector parameters of the first position block of the current block; and when the encoding parameters of the second position block include vector parameters, determine whether the vector parameters of the second position block meet a second condition according to the vector parameters of the second position block; when the vector parameters of the second position block meet the second condition, update the first candidate list according to the vector parameters of the second position block; and determine a second search area according to the candidate vector parameters in the updated first candidate list, and determine the vector parameters of the current block according to the second search area; The first prediction unit is configured to determine the prediction value of the current block according to the vector parameters of the current block.

106. An encoder, comprising a first memory and a first processor, wherein: The first memory is used to store a computer program that can run on the first processor; The first processor is used to execute the method according to any one of claims 51 to 103 when running the computer program.

107. A decoder, comprising a second determination unit, a second update unit, and a second prediction unit, wherein: The second determination unit is configured to determine a first candidate list of the current block; wherein, the first candidate list includes one or more candidate vector parameters; The second update unit is configured to determine a second position block according to the candidate vector parameters in the first candidate list and / or the vector parameters of the first position block of the current block; and when the decoding parameters of the second position block include vector parameters, determine whether the vector parameters of the second position block meet a second condition according to the vector parameters of the second position block; when the vector parameters of the second position block meet the second condition, update the first candidate list according to the vector parameters of the second position block; and determine a second search area according to the candidate vector parameters in the updated first candidate list, and determine the vector parameters of the current block according to the second search area; The second prediction unit is configured to determine the prediction value of the current block according to the vector parameters of the current block.

108. A decoder, the decoder comprising a second memory and a second processor, wherein: The second memory is configured to store a computer program that can run on the second processor; The second processor is configured to execute the method according to any one of claims 1 to 50 when running the computer program.

109. A computer-readable storage medium, wherein, The computer-readable storage medium stores a computer program, and when the computer program is executed, it implements the method according to any one of claims 1 to 50, or implements the method according to any one of claims 51 to 103.