Encoding / decoding methods, bitstreams, encoders, decoders, and storage media

JP2026516276A5Pending Publication Date: 2026-05-27GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
Filing Date
2023-05-18
Publication Date
2026-05-27

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium. The method includes, when the prediction mode of the current block is a prediction mode based on intra-template matching, a codec determining a first template corresponding to the current block, determining a predetermined search region based on the first template, performing a search in the predetermined search region based on a first parameter corresponding to the current block and determining the block vector of the current block, wherein the first parameter is for controlling the search process, and determining a predicted value of the current block based on the block vector of the current block.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] (Cross-reference to related applications) This application relates to the technical field of video codecs, and more particularly to encoding and decoding methods, bitstreams, encoders, decoders, and storage media. [Background technology]

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

[0003] However, general search strategies suffer from high computational complexity, which reduces the efficiency and performance of encoding and decoding. [Overview of the project]

[0004] Embodiments of the present application provide an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium that can reduce computational complexity and thereby improve the efficiency and performance of encoding and decoding.

[0005] The technical solution of the embodiment of this application is realized as follows.

[0006] In the first aspect, embodiments of the present application provide a decoding method applicable to a decoder, the method being: If the prediction mode for the current block is an intra-template matching prediction mode, then a first template corresponding to the current block is determined, and a predetermined search area is determined based on the first template. The process involves performing a search in a predetermined search area based on a first parameter corresponding to the current block, and determining the block vector of the current block, wherein the first parameter is for controlling the search process. This includes determining the predicted value of the current block based on the block vector of the current block.

[0007] In a second aspect, an embodiment of the present application provides an encoding method applicable to an encoder, the method being: If the prediction mode for the current block is an intra-template matching prediction mode, then a first template corresponding to the current block is determined, and a predetermined search area is determined based on the first template. The process involves performing a search in a predetermined search area based on a first parameter corresponding to the current block, and determining the block vector of the current block, wherein the first parameter is for controlling the search process. This includes determining the predicted value of the current block based on the block vector of the current block.

[0008] In a third aspect, an embodiment of the present application provides a bitstream, which is generated by bit encoding based on information to be encoded, and the information to be encoded is The current block includes at least one of the following: predicted difference, first parameter, second parameter, template size, and template type indication information.

[0009] In a fourth aspect, an embodiment of the present application provides an encoder comprising a first determination unit, The first decision unit is configured to perform the following actions when the prediction mode of the current block is a prediction mode based on intra-template matching: determine a first template corresponding to the current block, determine a predetermined search area based on the first template, perform a search in the predetermined search area based on a first parameter corresponding to the current block, and determine the block vector of the current block, wherein the first parameter is for controlling the search process; and determine the predicted value of the current block based on the block vector of the current block.

[0010] In a fifth aspect, an embodiment of the present application provides an encoder comprising a first memory and a first processor, The first memory is configured to store a computer program that can be executed by the first processor. The first processor is configured to perform the method described in the second embodiment when executing the computer program.

[0011] In a sixth aspect, an embodiment of the present application provides a decoder comprising a second determination unit, The second decision unit is configured to perform the following actions when the prediction mode of the current block is a prediction mode based on intra-template matching: determine a first template corresponding to the current block, determine a predetermined search area based on the first template, perform a search in the predetermined search area based on a first parameter corresponding to the current block, and determine the block vector of the current block, wherein the first parameter is for controlling the search process; and determine the predicted value of the current block based on the block vector of the current block.

[0012] In the seventh aspect, an embodiment of the present application provides a decoder comprising a second memory and a second processor, The second memory is configured to store computer programs that can be executed by the second processor, The second processor is configured to perform the method described in the first embodiment when executing the computer program.

[0013] In the eighth aspect, an embodiment of the present application provides a computer-readable storage medium in which a computer program is stored, and when the computer program is executed, it implements the method according to the first aspect or the method according to the second aspect.

[0014] Embodiments of the present application provide an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium, wherein, when the prediction mode of the current block is an intra-template matching prediction mode, the codec determines a first template corresponding to the current block, determines a predetermined search area based on the first template, performs a search in the predetermined search area based on a first parameter corresponding to the current block, and determines the block vector of the current block, wherein the first parameter is for controlling the search process, and determines the predicted value of the current block based on the block vector of the current block. Thus, in embodiments of the present application, the search process can be controlled using a predetermined first parameter such as a matching cost threshold based on the IntraTMP mode, and it is possible to select whether to terminate the search process early or continue the search process based on the first parameter. In other words, the encoding / decoding method proposed in embodiments of the present application can solve the problem of high computational complexity resulting from scanning all search points in the search area by introducing a first parameter for controlling the search process, and can improve the efficiency and performance of encoding / decoding. [Brief explanation of the drawing]

[0015] [Figure 1] This is a schematic diagram showing the prediction of Intra TMP. [Figure 2] This is a schematic diagram of the prediction process based on IntraTMP technology. [Figure 3]This is a schematic diagram illustrating the template types of Intra TMP technology. [Figure 4] This is a schematic diagram of the search process based on IntraTMP technology. [Figure 5] This is a schematic diagram showing the parameter definitions for the current block and its template. [Figure 6] This is a schematic diagram showing the template search area. [Figure 7] This is the first schematic diagram showing the division of the search domain into different sub-domains. [Figure 8] This is the first schematic diagram illustrating the process of determining the search area. [Figure 9] This is a schematic diagram of the search process. [Figure 10A] This is a block diagram showing the encoder configuration. [Figure 10B] This is a block diagram showing the encoder configuration. [Figure 11] This is a schematic diagram showing the network architecture configuration of the codec system. [Figure 12] This is a schematic flowchart of the decoding method proposed in the embodiment of the present invention. [Figure 13] This is the first schematic diagram showing at least one search region. [Figure 14] This is a second schematic diagram showing at least one search region. [Figure 15] This is a schematic flowchart of the encoding method proposed in the embodiment of the present invention. [Figure 16] This is a schematic diagram showing the configuration of an encoder. [Figure 17] This is a schematic diagram showing the hardware configuration of the encoder. [Figure 18] This is a schematic diagram showing the configuration of the decoder. [Figure 19] This is a schematic diagram showing the hardware configuration of the decoder. [Figure 20] This is a schematic diagram showing the configuration of the codec system. [Modes for carrying out the invention]

[0016] To gain a more detailed understanding of the features and technical content of the embodiments of this application, the implementation of the embodiments will be described in detail below with reference to the drawings. The drawings are for reference only and are not intended to limit the embodiments of this application.

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

[0018] In the following, the phrase "some embodiments" describes a subset of all possible embodiments, but to the extent that it is understandable, "some embodiments" may be the same subset or a different subset of all possible embodiments and can be combined with each other without contradiction. Furthermore, it should be noted that terms such as "first / second / third" in the embodiments of this application do not limit a particular order, but distinguish similar subjects. To the extent that it is understandable, "first / second / third" can be changed in a particular order or chronological order where appropriate, so the embodiments of this application described herein may be performed in an order other than that illustrated or described herein.

[0019] Before describing the embodiments of this application in further detail, the nouns and terms relating to the embodiments of this application will be explained. The explanations of the nouns and terms relating to the embodiments of this application will apply to the following interpretations.

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

[0021] To make it easier to understand, video images are typically represented by coded blocks consisting of a first color component, a second color component, and a third color component. Here, these three color components are the luminance component, the blue chromaticity component, and the red chromaticity component, respectively. Specifically, the luminance component is usually represented by the code Y, the blue chromaticity component by the code Cb or U, and the red chromaticity component by the code Cr or V. Thus, video images can be represented in YCbCr format or YUV format.

[0022] To further understand, Intra TMP is a special intra prediction mode in which both the encoder and decoder use a coding block template (T) to search for the matching template (T_BEST) with the minimum cost within a predetermined search range of the current image, according to a predetermined cost function. Here, the offset of the optimal matching template relative to the current coding block template is the optimal block vector (BV_BEST: BEST Block Vector), and then the reconstruction block (Ref Block) corresponding to the matching template is used as the prediction block for the current coding block (Cur Block). Here, the adjacent reconstruction region of the current coding block is usually selected as the coding block template.

[0023] As an example, taking the adjacent reconstruction region of the current block as an example, Figure 1 is a schematic diagram showing the prediction of Intra TMP. As shown in Figure 1, the areas filled with dark colors represent the reconstruction region, the grid-filled blocks are the current block and the adjacent region of the current block is the first template (T), the shaded blocks are the reference block and the adjacent region of the reference block is the second template (i.e., the optimal matching template, T_BEST). Here, the offset of the second template relative to the first template is the optimal block vector (BV_BEST), and in this case, the reference block can be block-copied to become the predicted block of the current block.

[0024] In the embodiments of this application, the predetermined cost function may be the sum of absolute errors (SAD), the sum of transformed absolute errors (SATD), the mean squared error (MSE), the sum of squared differences (SSD), the mean absolute difference (MAD), the mean squared difference (MSD), the normalized correlation coefficient (NCC), and the like, and is not specifically limited here.

[0025] As an example, taking the absolute sum of errors (SAD) as an example, the cost function in this case is as follows: [Formula 1]

number

[0026] The prediction process of Intra TMP technology in related technologies will be described in detail below.

[0027] The inputs to IntraTMP are the current block position (xTbCmp, yTbCmp), the current block width nTbW, and the current block height nTbH.

[0028] The output of IntraTMP is the predicted value of the current block, predSamples[x][y], where x=0…nTbW-1 and y=0…nTbH-1.

[0029] Specifically, the prediction process of the IntraTMP technology is divided into four steps: determining the current template type, obtaining a current template reconstruction sample, determining block vectors within a given search range, and generating predicted values. In this way, predicted values ​​for the current block can be obtained through the above process. It should be noted that the Intra TMP technology may be used to predict luminance components or chromaticity components, and is not specifically limited to these here.

[0030] Referring to Figure 2, which is a schematic diagram of a prediction process based on IntraTMP technology, this process may include the following steps:

[0031] In step S201, the current template type is determined.

[0032] Furthermore, the Intra TMP technology uses adjacent reconstructed samples of the current block as templates to search for matching templates in a predetermined search area. Here, adjacent reconstructed samples may be upper reference samples, upper left reference samples, upper right reference samples, left reference samples, and lower left reference samples of the current block, etc. Therefore, the template type can be classified based on whether adjacent reconstructed samples are available, and the corresponding template type can be determined.

[0033] Furthermore, it should be explained that refTemplateType can represent the template type, and Figure 3 is a schematic diagram illustrating the template types of Intra TMP technology. As shown in Figure 3, the filled-in grid blocks are current blocks, and the adjacent regions of the current blocks are templates T, where six types of templates are shown.

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

[0035] If the upper left reference sample, upper reference sample, and left reference sample are all available, the value of refTemplateType is 1, and the template shape is as shown in Figure 3(a). If only the left-hand reference sample is available, the value of refTemplateType is 2, and the template shape is as shown in Figure 3(b). If only the upper reference sample is available, the value of refTemplateType is 3, and the template shape is as shown in Figure 3(c). If only the left-side reference sample and the upper-left-side reference sample are available, the value of refTemplateType is 4, and the template shape is as shown in Figure 3(d). If only the left-side reference sample and the lower-left-side reference sample are available, the value of refTemplateType is 5, and the template shape is as shown in Figure 3(e). If only the upper reference sample and the upper right reference sample are available, the value of refTemplateType is 6, and the template shape is as shown in Figure 3(f).

[0036] In step S202, we obtain the current template sample.

[0037] The templates for Intra TMP technology can currently consist of reconstruction samples from one or more regions of the block: the upper, upper right, left, lower left, and upper left sides. The template size can also be pre-configured. For example, when obtaining the left-side template, the template width templateW_size can be set to 4, and when obtaining the upper-side template, the template height templateH_size can be set to 4.

[0038] Furthermore, it should be explained that the value of refTemplateType can be used to determine which parts of the reconstruction sample to retrieve. For example, if the value of refTemplateType is 1, the reconstruction sample of the left, upper left, and top of the current block will be retrieved; if the value of refTemplateType is 2, only the reconstruction sample of the left four columns of the current block will be retrieved; or if the value of refTemplateType is 3, only the reconstruction sample of the top four rows of the current block will be retrieved.

[0039] In step S203, a block vector is determined within a predetermined search range.

[0040] The search process in Intra TMP technology is mainly divided into the initialization process, the determination of the template search area in the current frame, the search within the search area, and the determination of the optimal block vector.

[0041] Furthermore, it should be explained that when searching for the optimal matching template in the search domain, a search strategy may be adopted that involves a rough search followed by a fine search, or only a fine search may be performed, or only a rough search may be performed; this is not specifically limited here.

[0042] In the embodiments of the present application, the coarse search hereof may specifically involve determining the optimal coarse matching template in the search domain with a first predetermined step length (e.g., 2), or determining the optimal coarse matching template in the search domain using a downsampled template (e.g., with a downsampling factor of 2).

[0043] In the embodiments of the present application, the fine search hereof may specifically involve determining the optimal fine matching template in the search region with a second predetermined step length (e.g., 1), or determining the optimal fine matching template in the vicinity of the optimal rough matching template after performing a rough search.

[0044] Referring to Figure 4, Figure 4 is a schematic diagram of a search process based on the IntraTMP technology provided in an embodiment of the present application. As shown in Figure 4, this process may include the following steps:

[0045] In step S401, the parameters are initialized.

[0046] For example, using an L-shaped template, uiPatchWidth is initialized as nTbW + templateW_size, and uiPatchHeight is initialized as nTbH + templateH_size. Here, templateW_size and templateH_size may be fixed constants, or they may be dynamically adjusted based on the current block size. Also, templateW_size and templateH_size may or may not be equal. For example, templateW_size=4 and templateH_size=4, or if the current block width is greater than 8, templateW_size=4; if the current block width is 8 or less, templateW_size=2; if the current block height is greater than 8, templateH_size=4; and if the current block height is 8 or less, templateH_size=2.

[0047] As an example, Figure 5 is a schematic diagram showing the parameter definitions for the current block and its template. As shown in Figure 5, the specific meanings of the parameters are as follows: 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.

[0048] Furthermore, the cost threshold between templates is initialized as diffThreshold. For example, if the cost function is SAD, the threshold is diffThreshold=((1<<bitDepth)> >2) × (uiPatchHeight × uiPatchWidth - nTbH × nTbW) is possible. Here, if the bit depth of the image is 10, then diffThreshold represents a distortion threshold of 256 for each sample point in the template region.

[0049] Furthermore, the positions (ctbRsX, ctbRsY) of the coding tree block CTB, where block CB is currently located, are initialized.

[0050] Furthermore, the position offsets of the current blocking CB in the current CTB (offsetLCBY=yTbCmp-ctbRsY, offsetLCBX=xTbCmp-ctbRsX) are initialized.

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

[0052] Furthermore, iBvShift is initialized, and iBvShift is the precision of the block vector BV. For example, the precision of BV can be integer sample precision, in which case iBvShift is 0. Alternatively, the precision of BV can be subsample precision; for example, iBvShift = 1 represents 1 / 2 sample precision, and iBvShift = 2 represents 1 / 4 sample precision, and this is not specifically limited here.

[0053] Furthermore, the predetermined search range of the template is initialized. The predetermined search range of the template may be set to a fixed size, or it may be dynamically adjusted based on the encoded block size. For example, searchRangeWidth = TMP_SEARCH_RANGE_MULT_FACTOR × nTbW, searchRangeHeight = TMP_SEARCH_RANGE_MULT_FACTOR × nTbH, where the value of TMP_SEARCH_RANGE_MULT_FACTOR may be a predetermined value, for example, it can be set to 5.

[0054] In step S402, the search area for templates in the current frame is determined.

[0055] The search area of ​​the Intra TMP technology is currently limited to the reconstructed portion of the image, and is restricted by the size of the search range. Figure 6 is a schematic diagram showing the template search area. As shown in Figure 6, the background area filled with a dark color is the reconstructed area, the background block filled with black is the current block, and the dashed line frame is the search range window. Therefore, the search area of ​​the Intra TMP technology does not exceed the overlapping portion between the reconstructed area shown by the dark background and the area shown by the dashed line frame.

[0056] Thus, the current search region of the block template may be the reconstructed portion of the CTB where the current block is located, or it may be another reconstructed CTB region. In practice, the search region is the set of all search points. Since the shape of the region often cannot be represented by a single rectangular region, in concrete implementations, searches can be performed in multiple rectangular regions, and the search results from different regions can be combined to obtain the final optimal matching block and optimal block vector.

[0057] For illustrative purposes, referring to Figure 7, which is a schematic diagram showing the division of a search domain into different subdomains. As shown in Figure 7, eight different subdomain division methods are shown. Here, the black-filled background block is the current block, and the five division methods (a), (b), (c), (d), and (f) all divide the search domain into four sub-search domains, while the three division methods (e), (g), and (h) all divide the search domain into three sub-search domains, where different fill patterns represent one sub-search domain.

[0058] In Figure 7, (a), (b), (c), and (d) consider all available search ranges, while (e), (f), (g), and (h) do not search the region directly above and directly to the left.

[0059] For illustrative purposes, let's assume that different sub-search regions are distinguished and represented by regionId. Considering that the template sample for the current block must be obtained from the image reconstruction region, and the reconstruction block sample corresponding to the template must also be obtained from the reconstruction region, it is necessary to further determine the searchable locations in the sub-search regions represented by different regionIds based on the current block's position (xTbCmp, yTbCmp), the current block's size (nTbW, nTbH), the current image's size (picWidth, picHeight), the size of the CTB where the current block is located (CtbSizeW, CtbSizeH), the predetermined search range of the template (search RangeWidth, searchRangeHeight), and the current block's position offset in the current CTB (offsetLCBY, offsetLCBX), thereby determining the block vector BV. Specifically, iVerMin and iVerMax represent the minimum and maximum absolute coordinate positions that can be searched in the vertical direction, respectively, while iHorMin and iHorMax represent the minimum and maximum absolute coordinate positions that can be searched in the horizontal direction. The values ​​of iVerMin, iVerMax, iHorMin, and iHorMax differ for each search region represented by a different regionId.

[0060] Taking Figure 7(f) as an example, the implementation method for dividing the search domain into four sub-search domains is as follows:

[0061] If regionId is equal to 0, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:

[0062] iHorMax0=min((xTbCmp+searchRangeWidth)< <iBvShift,((picWidth-nTbW)<<iBvShift)) iHorMin0=max((iTemplateSizeW)< <iBvShift,(xTbCmp-searchRangeWidth)<<iBvShift) iVerMax0=(yTbCmp-nTbH-offsetLCBY)< <iBvShift iVerMin0=max(((iTemplateSizeH)< <iBvShift),((yTbCmp-searchRangeHeight)<<iBvShift)) If regionId is equal to 1, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:

[0063] iHorMin1=max((iTemplateSizeW)< <iBvShift,(xTbCmp-searchRangeWidth)<<iBvShift) iHorMax1=(xTbCmp-offsetLCBX-nTbW)< <iBvShift iVerMin1=(yTbCmp+1)< <iBvShift iVerMax1=min((picHeight-nTbH)< <iBvShift,(yTbCmp-offsetLCBY+CtbSizeH-nTbH)<<iBvShift) If regionId is equal to 2, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:

[0064] iHorMax2=(xTbCmp-offsetLCBX-nTbW)< <iBvShift iHorMin2=max((iTemplateSizeW)< <iBvShift,(xTbCmp-searchRangeWidth)<<iBvShift) iVerMin2=max((iTemplateSizeH)< <iBvShift,(yTbCmp-nTbH-offsetLCBY)<<iBvShift) iVerMax2=(yTbCmp)< <iBvShift If regionId is equal to 3, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:

[0065] iHorMin3=max((iTemplateSizeW)< <iBvShift,(xTbCmp-offsetLCBX-nTbW+1)<<iBvShift) iHorMax3=(xTbCmp-nTbW)< <iBvShift iVerMin3=max(((iTemplateSizeH)< <iBvShift),(yTbCmp-offsetLCBY-nTbH+1)<<iBvShift) iVerMax3=(yTbCmp-nTbH)< <iBvShift In actual applications, iHorMin regionId iHor Max regionId iVerMin regionId iVerMax regionId These represent the left, right, top, and bottom edges of different sub-search regions, respectively.

[0066] Refer to Figure 8 for an intuitive explanation of the different sub-search regions corresponding to different regionIds. Figure 8 is a schematic diagram illustrating the process of determining a specific search region. As shown in Figure 8, R1, R2, R3, and R4 represent four different sub-search regions. Note that in Figure 8, the upper left corner sample of the block is represented by the alignable sample range.

[0067] In step S403, a search is performed in the search area to determine the optimal block vector BV.

[0068] bvXMins and bvXMaxs represent the minimum and maximum horizontal offsets of the block vector, respectively, while bvYMins and bvYMaxs represent the minimum and maximum vertical offsets of the block vector, respectively.

[0069] bvXMinsregionId, bvXMaxsregionId, bvYMinsregionId, bvYMaxsregionId are the iVerMin determined in step S402. regionId iVerMaxregionId , iHorMin regionId , iHorMax regionId can be calculated as follows using

[0070] bvXMinsregionId = iHorMin regionId - xTbCmp bvXMaxsregionId = iHorMax regionId - xTbCmp bvYMinsregionId = iVerMin regionId - yTbCmp bvYMaxsregionId = iVerMax regionId - yTbCmp Here, bvXMinsregionId, bvXMaxsregionId, bvYMinsregionId, and bvYMaxsregionId determine the ranges of the horizontal and vertical offset amounts with respect to the current block of the search point, that is, the range of the block vector BV.

[0071] Furthermore, it should be noted that the search points (iPosHor, iPoxVer) within each search region, that is, each block vector BV (composed of a horizontal component and a vertical component (pX, pY), where pX = iPosHor - xTbCmp and pY = iPosVer - yTbCmp. In this case, pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs. Thus, a matching reconstructed block of one current block can be found in the reconstruction region, and the adjacent reconstruction samples of the matching reconstructed block are the matching template (that is, the aforementioned second template). Thereby, the matching cost value between the adjacent template of the current block and the adjacent template of the matching reconstructed block can be calculated and denoted as pDiff.

[0072] Furthermore, all search points within the entire search range (regionId=0, 1, 2, 3) are scanned, and the search point with the minimum matching cost value pDiff is obtained by comparison. The corresponding matching cost value is denoted as pDiff_BEST, the corresponding block vector BV is denoted as optimal block vector BV_BEST(pX_BEST,pY_BEST), and the corresponding matching template is denoted as optimal matching template T_BEST.

[0073] In one possible implementation, where the search strategy involves only rough searching, the specific implementation would be as follows:

[0074] In each region, a coarse search is performed with a step length greater than 1 within the search range where pX lies between bvXMinsregionId and bvXMaxsregionId, and pY lies between bvYMinsregionId and bvYMaxsregionId. For example, a coarse search is performed with a step length of 2, and the optimal matching cost value obtained by template matching is denoted as pDiff_BEST, and the corresponding block vector BV is denoted as optimal block vector BV_BEST(pX_BEST,pY_BEST).

[0075] In another possible implementation, if the search strategy involves only thorough searching, the specific implementation would be as follows:

[0076] In each region, within a search range where pX lies between bvXMinsregionId and bvXMaxsregionId, and pY lies between bvYMinsregionId and bvYMaxsregionId, a fine search is performed with a step length of, for example, 1. The optimal matching cost value obtained by template matching is denoted as pDiff_BEST, and the corresponding block vector BV is expressed as optimal block vector BV_BEST(pX_BEST,pY_BEST).

[0077] In yet another possible implementation, if the search strategy involves performing a rough search followed by a fine search, the search process is as shown in Figure 9. The specific process is as follows:

[0078] In step S901, the optimal coarse matching template is determined in the search domain with a step length of 2.

[0079] In step S902, the optimal fine matching template is determined in the vicinity of the optimal coarse matching template with a step length of 1.

[0080] In the case of step S901, during the rough search stage, In each region, a rough search is performed with a step length greater than 1 within the search range where pX lies between bvXMinsregionId and bvXMaxsregionId, and pY lies between bvYMinsregionId and bvYMaxsregionId. For example, a rough search is performed with a step length of 2, and the optimal matching cost obtained by template matching is denoted as pDiff1_BEST, the corresponding block vector BV is denoted as optimal block vector BV1_BEST(pX1_BEST,pY1_BEST), and the search region where the optimal matching search point is located is denoted as bestRegionId.

[0081] Furthermore, it should be explained that in the case of step S902, during the refinement stage, Further searching is performed in the neighborhood of the optimal block vector BV1_BEST obtained through the rough search. Specifically, first, the fine search range TmpRefineRange is determined. The fine search range may be a fixed size or may be associated with the current block size, for example, it can be set to min(nTbW,nTbH) / 2. Next, the position of the optimal matching reconstruction block obtained through the rough search is calculated as the reference position of the fine search range, i.e., BestPosX=xTbCmp+pX1_BEST and BestPosY=yTbCmp+pY1_BEST.

[0082] Based on the value of bestRegionId, first, the calculated values ​​of iVerMinbestRegionId, iVerMaxbestRegionId, iHorMinbestRegionId, and iHorMaxbestRegionId are obtained. Then, based on the optimal matching block position obtained through rough searching, new search ranges iVerMinrefine, iVerMaxrefine, iHorMinrefine, and iHorMaxrefine are obtained. The method of obtaining these values ​​is as follows.

[0083] iHorMinrefine=max(iHorMinbestRegionId,BestPosX-TmpRefineRange) iHorMaxrefine=min(iHorMaxbestRegionId,BestPosX+TmpRefineRange) iVerMinrefine=max(iVerMinbestRegionId,BestPosY-TmpRefineRange) iVerMaxrefine=min(iVerMaxbestRegionId,BestPosY+TmpRefineRange) Next, the adjusted block vectors BVbvXMins, bvXMaxs, bvYMins, and bvYMaxs are obtained by calculating them using iVerMinrefine, iVerMaxrefine, iHorMinrefine, and iHorMaxrefine.

[0084] bvXMins=iHorMinrefine-xTbCmp bvXMaxs=iHorMaxrefine-xTbCmp bvYMins=iVerMinrefine-yTbCmp bvYMaxs=iVerMaxrefine-yTbCmp Thus, the fine search is performed within the block vector range where pX lies between bvXMinsrefine and bvXMaxsrefine, and pY lies between bvYMinsrefine and bvYMaxsrefine. For example, a search is performed with a step length of 1, and the optimal matching cost obtained by template matching is denoted as pDiff_BEST, and the corresponding block vector BV is denoted as optimal block vector BV_BEST(pX_BEST,pY_BEST).

[0085] After the above operations are completed, the optimal block vector BV_BEST(pX_BEST,pY_BEST) is obtained, where pX_BEST and pY_BEST are the horizontal and vertical offset amounts of the optimal matching template relative to the current block template, and are also the horizontal and vertical offset amounts of the optimal matching reconstructed block relative to the current block.

[0086] In step S204, predicted values ​​are generated.

[0087] This can be achieved using a simple translation and copying method. The specific steps are as follows:

[0088] The target of processing is x=0...nTbW-1, y=0...nTbH-1. [Formula 2] predSamples[x][y]=recSamples[x+pX_BEST][y+pY_BEST] Here, recSamples represents the reconstructed samples of the current frame.

[0089] To make it easier to understand, in IntraTMP mode, in addition to obtaining predicted values ​​using the basic copy method described above, it is also possible to obtain predicted values ​​by performing filtering fusion at locations corresponding to multiple BVs, and to perform fused prediction with the normal Intra mode.

[0090] For example, in the decoding region search process, a list of BV candidates can be obtained using template matching, and then the first N (e.g., N=3) from this list can be selected for weighted fusion. This method may also be called IntraTMP Fusion mode.

[0091] For example, after obtaining one optimal BV, multiple points can be taken around this BV, and weighted fusion can be performed on the predicted values ​​corresponding to these points to obtain a predicted value. This method may also be called IntraTMP FLM mode.

[0092] For example, after obtaining one optimal BV, the final predicted value can be obtained by weighting and combining the predicted value obtained using this BV with the predicted value obtained in the normal Intra mode. Here, the normal Intra mode may be Planar mode or Direction mode, and this Direction mode may be derived by TIMD or obtained by positioning within the Intra candidate table using an Index transmitted in a bitstream. This method may also be called IntraTMP CIIP mode.

[0093] Simply put, in related technologies, the Intra TMP technology uses a template of the current block to search for a matching template with the minimum cost within a predetermined search range of the current image according to a predetermined cost function, and the optimal matching reconstruction block (Ref Block) corresponding to the matching template is used as the predicted block for the current block (Cur Block). Here, the template of the current block is usually selected from the adjacent reconstruction regions of the current block.

[0094] However, in actual implementation processes, the search strategy requires scanning all search points within the search area, which increases computational complexity.

[0095] As mentioned above, general search strategies suffer from high computational complexity, which reduces the efficiency and performance of encoding and decoding.

[0096] To solve the above problems, embodiments of the present application provide an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium. When the prediction mode of the current block is an intra-template matching prediction mode, the codec determines a first template corresponding to the current block, determines a predetermined search area based on the first template, performs a search in the predetermined search area based on a first parameter corresponding to the current block, determines the block vector of the current block, the first parameter is for controlling the search process, and determines the predicted value of the current block based on the block vector of the current block. Thus, in embodiments of the present application, the search process can be controlled using a predetermined first parameter such as a matching cost threshold based on the IntraTMP mode, and it is possible to select whether to terminate the search process early or continue the search process based on the first parameter. In other words, the encoding / decoding method proposed in embodiments of the present application can solve the problem of high computational complexity resulting from scanning all search points in the search area by introducing a first parameter for controlling the search process, and can improve the efficiency and performance of encoding / decoding.

[0097] The embodiments of this application will be described in detail below with reference to the drawings.

[0098] Referring to Figure 10A, Figure 10A is a block diagram showing the configuration of an encoder provided in an embodiment of the present invention. As shown in Figure 10A, the encoder (specifically, "video encoder") 100 may include a transform and quantization unit 101, an intra-estimation unit 102, an intra-prediction unit 103, a motion compensation unit 104, a motion estimation unit 105, an inverse transform and inverse quantization unit 106, a filter control analysis unit 107, a filtering unit 108, an encoding unit 109, and a decoding image buffer unit 110, where the filtering unit 108 can implement deblocking filtering and sample adaptive offset (SAO) filtering, and the encoding unit 109 can implement header information encoding and context-based adaptive binary arithmetic coding (CABAC). For the input original video signal, one video coding block is obtained by dividing the coding tree block (CTU). Next, the residual sample information obtained through intra-prediction or inter-prediction is transformed by the transformation and quantization unit 101. This transformation includes transforming the residual information from the sample region to the transformation region and quantizing the resulting transformation coefficients in order to further reduce the bitrate. The intra-estimation unit 102 and the intra-prediction unit 103 are configured to perform intra-prediction on the video coding block. Specifically, the intra-estimation unit 102 and the intra-prediction unit 103 are configured to determine the intra-prediction mode used to encode the video coding block.The motion compensation unit 104 and the motion estimation unit 105 are configured to perform interpredictive coding of received video coding blocks for one or more blocks in one or more reference frames to provide time prediction information, the motion estimation performed by the motion estimation unit 105 is a process that generates motion vectors which can estimate the motion of the video coding blocks, the motion compensation unit 104 then performs motion compensation based on the motion vectors determined by the motion estimation unit 105 and determines an intraprediction mode, the intraprediction unit 103 is further configured to provide selected intraprediction data to the coding unit 109, and the motion estimation unit 105 also transmits the computationally determined motion vector data to the coding unit 109. Furthermore, the inverse transform and inverse quantization unit 106 is for the reconstruction of the video coding block and is configured to reconstruct the residual block in the sample region. This reconstructed residual block is then subjected to blocking effect artifacts by the filter control analysis unit 107 and the filtering unit 108. This reconstructed residual block is then added to one prediction block in the frame of the decoding image buffer unit 110 to generate a reconstructed video coding block. The coding unit 109 is configured to encode various coding parameters and quantized transformation coefficients. In the CABAC-based coding algorithm, contextual content can be based on adjacent coding blocks and may be used to encode information indicating the determined intra-prediction mode and output a bitstream of this video signal. The decoding image buffer unit 110 is configured to store the reconstructed video coding blocks for prediction reference. As video image coding progresses, new reconstructed video coding blocks are continuously generated and these reconstructed video coding blocks are stored in the decoding image buffer unit 110.

[0099] Referring to Figure 10B, Figure 10B is a block diagram showing the configuration of the decoder provided in an embodiment of the present invention. As shown in Figure 10B, the decoder (specifically, the "video decoder") 200 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra prediction unit 203, a motion compensation unit 204, a filtering unit 205, and a decoded image buffer unit 206, where the decoding unit 201 can perform header information decoding and CABAC decoding, and the filtering unit 205 can perform deblocking filtering and SAO filtering. The input video signal undergoes the encoding process shown in Figure 10A and then outputs a bitstream of the video signal. This bitstream is input to the decoder 300, which first passes through the decoding unit 201 to obtain the decoded transform coefficients. These conversion coefficients are processed by the inverse transform and inverse quantization unit 202 to generate residual blocks in the sample region, the intra-prediction unit 203 may be configured to generate prediction data for the currently decoded video block based on the determined intra-prediction mode and data from previously decoded blocks from the current frame or picture, and the motion compensation unit 204 determines prediction information for the video decoded block by analyzing motion vectors and other relevant syntactic elements, and uses this prediction information to generate prediction blocks for the video decoded block being decoded. By summing the residual blocks from the inverse transform and inverse quantization unit 202 and the corresponding prediction blocks generated by the intra-prediction unit 203 or the motion compensation unit 204, a decoded video block is formed, and this decoded video signal can be improved in video quality by passing through the filtering unit 205 to remove blocking effect artifacts. Next, the decoded video blocks are stored in the decoded image buffer unit 206, which is configured to store reference images for subsequent intra-prediction or motion compensation and to output a video signal, i.e., the restored original video signal is obtained.

[0100] Furthermore, embodiments of the present application further provide a network architecture for a codec system including an encoder and a decoder, where Figure 11 is a schematic diagram showing the network architecture configuration of the codec system provided in embodiments of the present application. As shown in Figure 11, the network architecture includes one or more electronic devices 13-1N and a communication network 01, where the electronic devices 13-1N can perform video interaction via the communication network 01. The electronic devices may, in embodiment, be devices having video encoding and decoding functions. For example, the electronic devices may include smartphones, tablet computers, personal computers, personal digital assistants, navigators, digital telephones, video phones, televisions, sensor devices, servers, etc., and embodiments of the present application are not specifically limited thereto. Here, the decoder or encoder described in embodiments of the present application may be the above-mentioned electronic devices.

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

[0102] Furthermore, it should be explained that when applied to the intra-prediction unit 103, "current block" specifically refers to the coded block currently being intra-predicted, and when applied to the intra-prediction unit 203, "current block" specifically refers to the decoded block currently being intra-predicted.

[0103] One embodiment of the present invention proposes a decoding method applicable to a decoder, and Figure 12 is a schematic flowchart of the decoding method proposed in the embodiment of the present invention, and as shown in Figure 12, the decoding process by the decoder may include the following steps.

[0104] In step 101, if the prediction mode for the current block is an intra-template matching prediction mode, a first template corresponding to the current block is determined, and a predetermined search area is determined based on the first template.

[0105] In embodiments of the present invention, if the prediction mode of the current block is a prediction mode based on intra-template matching, it may first include determining a first template corresponding to the current block. Here, when obtaining the first template, it is possible to first determine the template type corresponding to the current block, and then determine the first template corresponding to the current block based on the template type.

[0106] To make it clear, in the embodiments of the present invention, the prediction mode based on intra-template matching may be a prediction mode using template matching, for example, the prediction mode based on intra-template matching may be an IntraTMP mode.

[0107] Furthermore, in the embodiments of the present application, after determining a first template corresponding to the current block, a predetermined search region corresponding to the current block can be determined based on the first template.

[0108] The decoding method according to the embodiment of this application is applied to a decoder. Furthermore, the decoding method may include an intra-prediction method, and more specifically, a color component prediction method. Here, the video image may be divided into a plurality of decoding blocks, each decoding block may include a first color component, a second color component, and a third color component, and the current block in the embodiment of this application refers to the decoding block in the video image that is currently subject to intra-prediction.

[0109] Here, if it is necessary to predict the first color component, the component to be predicted is the first color component; if it is necessary to predict the second color component, the component to be predicted is the second color component; and if it is necessary to predict the third color component, the component to be predicted is the third color component. Furthermore, if we make a prediction for the first color component of the current block and assume that the first color component is the luminance component, i.e., the component to be predicted is the luminance component, then the current block may also be called a luminance block. Or, if we make a prediction for the second color component of the current block and assume that the second color component is the chromaticity component, i.e., the component to be predicted is the chromaticity component, then the current block may also be called a chromaticity block.

[0110] Furthermore, in the embodiments of this application, the reference sample of the current block may refer to a reference sample point adjacent to the current block. Here, "adjacent" may refer to a spatially adjacent point, but is not limited to this. For example, adjacent points may refer to adjacent points in the time domain, adjacent points in the spatial domain and time domain, and furthermore, the reference sample of the current block may be a reference sample obtained by performing some processing on a spatially adjacent, temporally adjacent, or spatially and temporally adjacent reference sample point. The embodiments of this application are not particularly limited.

[0111] Furthermore, in embodiments of the present application, it may be chosen to determine the template type of the current block based on instruction information in the bitstream, or to determine the template type of the current block based on the size of the current block.

[0112] Furthermore, in embodiments of the present application, the template type of the current block may be determined based on a reference sample of the current block, where the reference sample of the current block includes at least one of the following: a left-side adjacent reference sample of the current block, an upper-side adjacent reference sample of the current block, an upper-left adjacent reference sample of the current block, an lower-left adjacent reference sample of the current block, and an upper-right adjacent reference sample of the current block.

[0113] To make it clear, in the embodiments of the present application, the reference sample of the current block may include adjacent reconstructed samples of the current block, that is, it is possible to choose to use adjacent reconstructed samples of the current block as a template to search for a matching template in a given search area.

[0114] In the embodiments of this application, the reference samples of the current block, i.e., the adjacent reconstructed samples of the current block, may include the upper reference sample, upper left reference sample, upper right reference sample, left reference sample, and lower left reference sample of the current block.

[0115] To make it clear, in the embodiments of the present application, when determining the template type of the current block using the reference samples of the current block, the template type can be classified and determined based on whether or not adjacent reference samples are available.

[0116] To make it clearer, in the embodiments of the present application, when determining the template type of a block, it is also possible to classify and determine the template type based on the instructions in the bitstream.

[0117] Furthermore, in the embodiments of the present application, when determining the template type of the current block based on the reference sample of the current block, if the left adjacent reference sample of the current block, the upper adjacent reference sample of the current block, and the upper left adjacent reference sample of the current block are all available, the template type of the current block is determined as the first value; if the left adjacent reference sample of the current block is available, the template type of the current block is determined as the second value; if the upper adjacent reference sample of the current block is available, the template type of the current block is determined as the third value; if the left adjacent reference sample of the current block and the upper left adjacent reference sample of the current block are both available, the template type of the current block is determined as the fourth value; if the left adjacent reference sample of the current block and the lower left adjacent reference sample of the current block are both available, the template type of the current block is determined as the fifth value; and if the upper adjacent reference sample of the current block and the upper right adjacent reference sample of the current block are both available, the template type of the current block is determined as the sixth value.

[0118] In the embodiments of this application, the first, second, third, fourth, fifth, and sixth values ​​may be any numerical values ​​and are not specifically limited in this application. For example, the first, second, third, fourth, fifth, and sixth values ​​may be 1, 2, 3, 4, 5, and 6, respectively.

[0119] Exemplary, in the embodiments of the present application, the template type can be represented by refTemplateType, and correspondingly, as shown in Figure 3, the grid-filled blocks are the current blocks, and the adjacent regions of the current blocks are templates T, where six types of templates are shown.

[0120] Exemplary, these six template types are as follows: When the upper left reference sample, upper reference sample, and left reference sample are all available, the value of refTemplateType is 1 and the template shape is as shown in Figure 3(a); when only the left reference sample is available, the value of refTemplateType is 2 and the template shape is as shown in Figure 3(b); when only the upper reference sample is available, the value of refTemplateType is 3 and the template shape is as shown in Figure 3(c); when only the left reference sample and upper left reference sample are available, the value of refTemplateType is 4 and the template shape is as shown in Figure 3(d); when only the left reference sample and lower left reference sample are available, the value of refTemplateType is 5 and the template shape is as shown in Figure 3(e); and when only the upper reference sample and upper right reference sample are available, the value of refTemplateType is 6 and the template shape is as shown in Figure 3(f).

[0121] In some embodiments, the IntraTMP template type can be selected based on the instructions in the bitstream, in addition to the availability information of the reference samples described above. For example, the template type can be determined on the decoding side by assigning a number to each template type and transmitting the number information of the template type actually used in the bitstream.

[0122] In other words, in the embodiments of the present application, it is possible to choose to determine the template type based on the availability information of the reference sample in the current block, or based on the information shown in the bitstream, or to determine the template type by combining the availability information of the reference sample and the information shown in the bitstream. The present application is not specifically limited.

[0123] Furthermore, in the embodiments of the present application, when determining the first template corresponding to the current block based on the template type, first, a template reference sample for the current block can be determined based on the template type and the template size corresponding to the template type, and then, the first template for the current block can be determined based on the template reference sample.

[0124] In the embodiments of this application, the first template of the current block may include a template reference sample of the current block. Here, the template reference sample of the current block can be determined by the template type of the current block and the template size corresponding to the template type.

[0125] In the embodiments of this application, the first template of the current block may consist of a reconstruction sample of one or more regions from the upper, upper right, left, lower left, and upper left sides of the current block, that is, it may consist of the reference sample of the current block described above.

[0126] In the embodiments of this invention, the template size corresponding to the template type may be predetermined, indicated by a bitstream syntax element, or 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.

[0127] Accordingly, in the embodiments of the present invention, by combining the value of the current block's template type refTemplateType and the template size corresponding to refTemplateType, it is possible to determine which part of the reconstruction sample to obtain as the template reference sample of the current block, and furthermore, to determine the corresponding first template.

[0128] Exemplary, in the embodiments of the present application, if the value of refTemplateType is 1, it is possible to choose to obtain the reconstruction samples from the left, upper left, and top of the current block; if the value of refTemplateType is 2, only the reconstruction samples from the left four columns of the current block are obtained; and if the value of refTemplateType is 3, only the reconstruction samples from the top four rows of the current encoded block are obtained.

[0129] Of course, the pre-set template size value is not limited to 4, but may be any integer greater than 0, and this application does not specifically limit it.

[0130] To make it clear, in the embodiments of the present application, the template reference sample of the current block, determined from the reference sample of the current block, is a combination of the template type of the current block and the corresponding template size, and may be a first template corresponding to the current block.

[0131] In the embodiments of this invention, the block vector search process may include parts such as an initialization process, determination of a search area (a predetermined search area) for the first template in the current frame, a search within the search area, and determination of one or more optimal block vectors. Therefore, when executing the search process, it is necessary to complete the initialization operation first.

[0132] For example, as shown in Figure 5 above, nTbW and nTbH represent the current block size, templateW_size and templateH_size represent the template size, and uiPatchWidth and uiPatchHeight represent the block size including the current block and its template.

[0133] Correspondingly, during initialization, uiPatchWidth can be initialized as nTbW + templateW_size and uiPatchHeight as nTbH + templateH_size. Here, templateW_size and templateH_size may be fixed constants, may be indicated by bitstream syntax elements, or may be dynamically adjusted based on the encoded block size or other information, and templateW_size and templateH_size may or may not be equal. For example, templateW_size=4 and templateH_size=4, or if the width of the encoded block is greater than 8, templateW_size=4 is set, and if the width of the encoded block is 8 or less, templateW_size=2 is set, and if the height of the encoded block is greater than 8, templateH_size=4 is set, and if the height of the encoded block is 8 or less, templateH_size=2 is set.

[0134] Furthermore, the cost threshold between templates is initialized as diffThreshold. For example, if the cost function is SAD, the threshold is diffThreshold=((1<<bitDepth)> >2) × (uiPatchHeight × uiPatchWidth - nTbH × nTbW) is possible. Here, if the bit depth of the image is 10, then diffThreshold represents a distortion threshold of 256 for each sample point in the template region.

[0135] Furthermore, the positions of the coding tree block CTB, where block CB is currently located, are initialized as ctbRsX and ctbRsY.

[0136] Furthermore, the positional offset of the current block CB in the current CTB is initialized as offsetLCBY=yTbCmp-ctbRsY and offsetLCBX=xTbCmp-ctbRsX.

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

[0138] Furthermore, iBvShift is initialized, and iBvShift is the precision of the block vector BV. For example, the precision of BV can be integer sample precision, in which case iBvShift is 0. Alternatively, the precision of BV can be subsample precision; for example, iBvShift = 1 represents 1 / 2 sample precision, and iBvShift = 2 represents 1 / 4 sample precision, and this is not specifically limited here.

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

[0140] In the embodiments of this invention, the predetermined search area may be a reconstructed portion within the current image and is limited by the size of the search range. As shown in Figure 6 above, the background area filled with a dark color is the reconstructed area, the background block filled with black is the current block, and the dashed line frame is the search range window. Therefore, the predetermined search area of ​​the IntraTMP technology does not exceed the overlapping portion between the reconstructed area shown by the dark background and the area shown by the dashed line frame.

[0141] Thus, the predetermined search region of the current block template may be the reconstructed portion of the CTB where the current block is located, or it may be another reconstructed CTB region. In practice, the predetermined search region is the set of all search points. Since the shape of the region cannot often be represented by a single rectangular region, in concrete implementations, searches can be performed in multiple rectangular regions, and the search results from different regions can be combined to obtain the final optimal matching block and optimal block vector.

[0142] For illustrative purposes, referring to Figure 7 above, Figure 7 shows eight different sub-region division methods. Here, the black-filled background block is the current block, and the five division methods (a), (b), (c), (d), and (f) all divide a given search region into four sub-search regions, while the three division methods (e), (g), and (h) all divide a given search region into three sub-search regions, where different fill patterns represent one sub-search region.

[0143] In Figure 7, (a), (b), (c), and (d) consider all available search ranges, while (e), (f), (g), and (h) do not search the region directly above and directly to the left.

[0144] For illustrative purposes, let's assume that different sub-search regions are distinguished and represented by regionId. Considering that the template sample for the current block must be obtained from the image reconstruction region, and the reconstruction block sample corresponding to the template must also be obtained from the reconstruction region, it is necessary to further determine the searchable locations in the sub-search regions represented by different regionIds based on the current block's position (xTbCmp, yTbCmp), the current block's size (nTbW, nTbH), the current image's size (picWidth, picHeight), the size of the CTB where the current block is located (CtbSizeW, CtbSizeH), the predetermined search range of the template (search RangeWidth, searchRangeHeight), and the current block's position offset in the current CTB (offsetLCBY, offsetLCBX), thereby determining the block vector BV. Specifically, iVerMin and iVerMax represent the minimum and maximum absolute coordinate positions that can be searched in the vertical direction, respectively, while iHorMin and iHorMax represent the minimum and maximum absolute coordinate positions that can be searched in the horizontal direction. The values ​​of iVerMin, iVerMax, iHorMin, and iHorMax differ for each search region represented by a different regionId.

[0145] In some embodiments, taking Figure 7(f) as an example, the implementation method for dividing a predetermined search area into four sub-search areas is as follows:

[0146] If regionId is equal to 0, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:

[0147] iHorMax0=min((xTbCmp+searchRangeWidth)< <iBvShift,((picWidth-nTbW)<<iBvShift)) iHorMin0=max((iTemplateSizeW)< <iBvShift,(xTbCmp-searchRangeWidth)<<iBvShift) iVerMax0=(yTbCmp-nTbH-offsetLCBY)< <iBvShift iVerMin0=max(((iTemplateSizeH)< <iBvShift),((yTbCmp-searchRangeHeight)<<iBvShift)) If regionId is equal to 1, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:

[0148] iHorMin1=max((iTemplateSizeW)< <iBvShift,(xTbCmp-searchRangeWidth)<<iBvShift) iHorMax1=(xTbCmp-offsetLCBX-nTbW)< <iBvShift iVerMin1=(yTbCmp+1)< <iBvShift iVerMax1=min((picHeight-nTbH)< <iBvShift,(yTbCmp-offsetLCBY+CtbSizeH-nTbH)<<iBvShift) If regionId is equal to 2, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:

[0149] iHorMax2=(xTbCmp-offsetLCBX-nTbW)< <iBvShift iHorMin2=max((iTemplateSizeW)< <iBvShift,(xTbCmp-searchRangeWidth)<<iBvShift) iVerMin2=max((iTemplateSizeH)< <iBvShift,(yTbCmp-nTbH-offsetLCBY)<<iBvShift) iVerMax2=(yTbCmp)< <iBvShift If regionId is equal to 3, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:

[0150] iHorMin3=max((iTemplateSizeW)< <iBvShift,(xTbCmp-offsetLCBX-nTbW+1)<<iBvShift) iHorMax3=(xTbCmp-nTbW)< <iBvShift iVerMin3=max(((iTemplateSizeH)< <iBvShift),(yTbCmp-offsetLCBY-nTbH+1)<<iBvShift) iVerMax3=(yTbCmp-nTbH)< <iBvShift To make it easier to understand, in actual applications, here is iHorMin regionId iHor Max regionId iVerMin regionId iVerMax regionId These represent the left, right, top, and bottom edges of different sub-search regions, respectively.

[0151] Refer to Figure 8 for an intuitive explanation of the different sub-search regions corresponding to different regionIds. Figure 8 is a schematic diagram illustrating the process of determining a given search region. As shown in Figure 8, R1, R2, R3, and R4 represent four different sub-search regions. Note that in Figure 8, the upper left corner sample of the block is represented by the alignable sample range.

[0152] To make it clear, in some embodiments, a given search region can be divided into two types: one is a region where it is determined that all sampling points within the region have been reconstructed (called a fully reconstructed search region), and the other is a region where it is not determined whether or not all sampling points within the region have been reconstructed (called an undetermined reconstructed search region). This application is not specifically limited.

[0153] In step 102, a search is performed in a predetermined search area based on the first parameter corresponding to the current block to determine the block vector of the current block, and the first parameter is used to control the search process.

[0154] In the embodiments of this invention, after determining a predetermined search area based on a first template, the block vector of the current block can be determined by further performing a search in the predetermined search area based on a first parameter corresponding to the current block. Here, the first parameter is for controlling the search process.

[0155] In the embodiments of this application, the first parameter may be for controlling the search process, and for example, based on the first parameter, it may be chosen to continue the search process or to terminate the search process early.

[0156] Exemplary, in the embodiments of the present invention, the first parameter may be a matching cost threshold corresponding to a matching cost value. Accordingly, when controlling the search process based on the first parameter, if the matching cost value and the first parameter (matching cost threshold) satisfy the search termination condition, the search process can be terminated early; otherwise, the search process can be continued.

[0157] To make it easier to understand, in the embodiments of the present application, if the first parameter is a matching cost threshold corresponding to a matching cost value, the first parameter can be understood as a single cost upper threshold. Therefore, the corresponding search termination condition may be the magnitude relationship between the matching cost value and the first parameter.

[0158] For example, in the embodiment of the present invention, if the matching cost value is less than or equal to the first parameter, the search termination condition can be considered to be met, and the search process can be terminated early. If the matching cost value is greater than the first parameter, the search termination condition can be considered not to be met, and the search process can be continued.

[0159] Thus, in the embodiments of the present invention, when performing a search based on the first parameter, if a search point is obtained through the search that has a matching cost value less than or equal to the first parameter, the search can be terminated, thereby enabling control of the search process.

[0160] In other words, in the embodiment of the present invention, calculating the matching cost for all search points within a predetermined search area would significantly increase complexity. Therefore, in order to ensure coding efficiency while maintaining complexity, a template matching cost threshold corresponding to the current block, i.e., the first parameter SAD, is used. thre This allows you to control the exploration process and choose to terminate the exploration early.

[0161] Furthermore, in the embodiments of the present application, the first parameter is used to limit the matching cost between different templates based on predetermined matching criteria.

[0162] In the embodiments of this application, the predetermined matching criteria include one of the following: absolute sum of errors (SAD), transformed absolute sum of errors (SATD), sum of squared errors (SSE), mean absolute difference (MAD), mean absolute error (MAE), mean squared error (MSE), and normalized correlation coefficient (NCC).

[0163] For example, in some embodiments, if a predetermined matching criterion is SSE, MSE, or SATD, the first parameter for exiting the search early is also set to SSEthre, MSEthre, or SATDthre accordingly.

[0164] In other words, in this application, the first parameter corresponds to a predetermined matching criterion.

[0165] Furthermore, in the embodiments of the present application, the predetermined matching criteria may include a first matching criterion and a second matching criterion. Here, the first matching criterion includes one of the following: absolute sum of errors (SAD), transformed absolute sum of errors (SATD), sum of squared errors (SSE), mean absolute difference (MAD), mean absolute error (MAE), mean squared error (MSE), and normalized correlation coefficient (NCC). The second matching criterion includes one of the following: the vector length of the block vector, the sum of the component lengths of the block vector, and the block vector cost parameter.

[0166] To make it understandable, in the embodiments of the present application, the first matching criterion can be understood to include a cost function related to the sample difference, while the second matching criterion can be understood to include a cost function related to the size of the block vector (BV).

[0167] In the embodiments of this application, by using a combination of the first matching criterion and the second matching criterion, it is necessary to refer to both a cost function related to the sample difference and a cost function related to the size of the block vector (BV) in the process of determining the block vector of the current block. That is, a cost function related to both the sample difference and the BV size can be adopted.

[0168] To make it easier to understand, in the embodiments of the present application, the block vector cost parameter included in the second matching criterion can be understood as a cost parameter related to the block vector.

[0169] Exemplary examples, in some embodiments, the block vector cost parameter may take the form of either the vector length of the block vector BV multiplied by a coefficient λ, or the sum of the component lengths of the block vector BV multiplied by a coefficient λ.

[0170] In the embodiments of this application, the matching cost value determined for any search point in the search process for the block vector of the current block, corresponding to a predetermined matching criterion including a first matching criterion and a second matching criterion, may also include two parts: a cost value related to the sample difference corresponding to the first matching criterion, and a cost value related to the BV size corresponding to the second matching criterion.

[0171] For example, in some embodiments, the cost value related to the sample difference corresponding to the first matching criterion is cost Dpel This represents the cost value related to the BV size corresponding to the second matching criterion, and is expressed as cost. BV Assuming that it is represented as such, the corresponding matching cost value cost determined for one search point within a given search region is cost = cost BV +cost Dpel It can be expressed as follows.

[0172] Here, cost BV This is a quantity related to the BV size, for example, the vector length of the BV, or the sum of the component lengths of the BV, or the vector length of the BV multiplied by a coefficient λ, or the sum of the component lengths of the BV multiplied by a coefficient λ, or the BV size and cost using a table. BV A definition of the relationship with, or a definition of a different domain, where the different domains have different costs BV Examples include those having a BV of a certain value (for example, a BV of zero), defining a rhombus or square multilayer region centered on a BV of a certain value, and having one fixed cost in each region. BV Take the value.

[0173] For example, in some embodiments, the cost value related to the sample difference corresponding to the first matching criterion is cost Dpel This represents the cost value related to the BV size corresponding to the second matching criterion, and is expressed as cost. BV Assuming that it is represented as such, the corresponding matching cost value cost determined for one search point within a given search region is cost = cost Dpel×costFactor BV It can be expressed as follows.

[0174] Here, costFactor BV This is a quantity related to the BV size, for example, the vector length of the BV multiplied by a coefficient λ, or the sum of the component lengths of the BV multiplied by a coefficient λ, or the BV size and costFactor using a table. BV A definition of the relationship with, or a definition of a different domain, where different domains have different costFactors BV Examples include those having a certain value of BV (for example, zero value of BV), and defining a rhombus or square multilayer region centered on a certain value of BV, with one fixed costFactor in each region. BV Take the value.

[0175] Furthermore, in the embodiment of the present application, taking the case where the predetermined matching criterion is SAD as an example, first, the first parameter SAD corresponding to the current block thre It is possible to determine this.

[0176] In the embodiment of this invention, the first parameter can be determined based on the bit depth information corresponding to the current image and the sample parameters corresponding to the first template.

[0177] To make it clear, in the embodiments of this application, one first parameter SAD thre If the search process is to be exited early by adopting this method, the first parameter SAD is based on the bit depth information of the current image. thre This can be determined, where the first parameter, which is determined based on the bit depth information of the current image, may be a predetermined fixed threshold.

[0178] For example, in several embodiments, the first parameter SAD thre =((1<<bitDepth)> >3) × Num Temp It can be defined as follows, where bitDepth is the bit depth of the image, i.e., the bit depth information corresponding to the current image, and Num TempThis is the sample number of the reference template, i.e., the sample parameter of the first template corresponding to the current block.

[0179] In the embodiments of this invention, if the prediction mode of the adjacent reconstructed block corresponding to the current block is a prediction mode based on intra-template matching, the first parameter can be determined based on the adjacent reconstructed block.

[0180] To make it clear, in the embodiments of the present invention, when the prediction mode of the adjacent reconstructed block corresponding to the current block is a prediction mode based on intra-template matching, when determining the first parameter based on the adjacent reconstructed block, first a first threshold can be determined based on the matching cost value corresponding to the block vector of the adjacent reconstructed block and the sample parameter of the reference template corresponding to the adjacent reconstructed block; simultaneously, a second threshold can be determined based on the sample parameter corresponding to the first template and the maximum mean sample value difference between the current block and the adjacent reconstructed block; and finally, the first parameter can be determined based on the first threshold and the second threshold.

[0181] In the embodiments of this invention, when determining the first parameter based on the first threshold and the second threshold, if the first threshold is less than or equal to the second threshold, the first threshold is determined as the first parameter; if the first threshold is greater than the second threshold, the second threshold is determined as the first parameter.

[0182] To make it clear, in the embodiments of this application, one first parameter SAD thre If you adopt this approach to exit the search process early, the first parameter SAD is calculated based on the optimal template matching cost of the adjacent IntraTMP encoded blocks of the current block. thre It is also possible to determine this. Here, the first parameter, which is determined based on the matching cost value of the current block corresponding to the adjacent reconstructed block whose prediction mode is an intra-template matching prediction mode, may be a single adaptive threshold.

[0183] Exemplary, in some embodiments, we assume that the upper neighboring block of the current block selects IntraTMP as its encoding mode, i.e., the prediction mode of the upper neighboring reconstructed block of the current block is a prediction mode based on intra-template matching. The block vector (optimal block vector) of that neighboring reconstructed block is BV neighbor The corresponding matching cost value (optimal matching cost) is Diff neighbor The sample parameter for the reference template corresponding to the adjacent reconfiguration block (the number of samples of the adjacent block reference template) is Num TempNei Therefore, the sample parameter of the first template corresponding to the current block (the number of samples in the reference template) is Num Temp In this case, the matching cost value Diff corresponds to the block vector of the adjacent reconstructed block. neighbor Sample parameter Num of the reference template corresponding to the adjacent reconfiguration block TempNei The first threshold, determined based on the above, is Diff neighbor / Num TempNei ×Num Temp It can be expressed as follows.

[0184] Exemplary, in some embodiments, the maximum average sample SAD difference per sample between the current block and the adjacent reconstructed block is set as offsetDiff. regionId This can be expressed as follows, and the maximum mean sample value difference per sample can be represented by a. Here, a may be a predetermined fixed factor and can be transmitted via high-level syntax. Correspondingly, the sample parameter Num corresponds to the first template. Temp , and the second threshold, determined based on the maximum mean sample value difference a between the current block and the adjacent reconstructed block, is a × Num Temp It can be expressed as follows.

[0185] For example, in some embodiments, when determining the first parameter based on a first threshold and a second threshold, the smaller of the first and second thresholds can be selected as the first parameter, i.e., the first parameter SAD thre =ken(Diff neighbor / Num TempNei ×Num Temp ,a×Num Temp ) is defined as follows.

[0186] In other words, in the embodiment of the present invention, the upper adjacent block of the current encoding target unit selects IntraTMP as its encoding mode, and the optimal block vector of the adjacent block is BV neighbor The corresponding optimal matching cost is Diff neighbor And Num TempNei Assuming that is the number of samples of adjacent block reference templates, SAD thre The value is a × Num Temp It must not be greater than . Here, a is the maximum mean sample value difference per sample. At this time, the template matching threshold for the current encoding unit is set to SAD thre =ken(Diff neighbor / Num TempNei ×Num Temp ,a×Num Temp Set it to ).

[0187] Furthermore, in embodiments of the present invention, when determining the first parameter, if the prediction mode of at least one adjacent reconstruction block corresponding to the current block is a prediction mode based on intra-template matching, a first threshold is determined based on at least one matching cost value corresponding to at least one adjacent reconstruction block, at least one sample parameter corresponding to at least one adjacent reconstruction block, and a sample parameter corresponding to the first template; a second threshold is determined based on the sample parameter corresponding to the first template and the maximum mean sample value difference between the current block and the adjacent reconstruction block; and the first parameter is determined based on the first threshold and the second threshold.

[0188] For better understanding, in the embodiments of the present application, when the prediction mode of at least one adjacent reconstruction block corresponding to the current block is a prediction mode based on intra-template matching, when determining the first threshold, it is necessary to refer to at least one matching cost value corresponding to at least one adjacent reconstruction block, and it is also necessary to refer to at least one sample parameter corresponding to at least one adjacent reconstruction block.

[0189] Exemplarily, in some embodiments, when at least two of the plurality of adjacent positions of the current block are encoded by adopting the IntraTMP mode, that is, when there are two or more adjacent reconstruction blocks using the IntraTMP mode for the current block, here, the matching cost value SAD of the adjacent position (adjacent reconstruction block) can be denoted as SADIdx (Idx = 0, 1,..., N, N is 1 or more). In this case,

Equation

[0190] Furthermore, in the embodiments of the present application, a predetermined search region includes at least one search region (i.e., at least one sub-search region), and correspondingly, different first parameters can be set for different search regions.

[0191] That is, in the present application, at least one first parameter corresponding to at least one search region can be determined. Here, the first parameters corresponding to different search regions may be the same or different.

[0192] Furthermore, in the embodiments of the present application, when determining at least one first parameter corresponding to at least one search region, if there is an adjacent reconstructed block corresponding to the current block in the current search region within at least one search region, and the prediction mode of the adjacent reconstructed block is a prediction mode based on intra-template matching, the first parameter corresponding to the current search region is determined based on the adjacent reconstructed block.

[0193] Exemplarily, in some embodiments, different thresholds SADThre RegionId (RegionId = 0, 1, 2, 3, …) are set, and SADThre regionId is derived by DiffNei regionId of the corresponding region of the block encoded using the adjacent reconstructed block in the IntraTMP mode. The number of samples of the reference template of the adjacent reconstructed block is Num TempNei and the number of samples of the reference template of the current block is denoted as Num Temp . The maximum average sample SAD difference per sample between the current block and the adjacent reconstructed block is denoted as a (offsetDiff regionId ). In this case, the first parameter SAD thre = min(DiffNei regionId / Num TempNei × Num Temp , a × Num Temp ) can be defined.

[0194] To make it clear, in embodiments of the present invention, if there are no adjacent reconstruction blocks corresponding to the current block in at least one search region, or if the prediction mode of adjacent reconstruction blocks in that search region is not a prediction mode based on intra-template matching, a first parameter corresponding to that search region can be determined according to a predetermined first parameter. For example, the first parameter corresponding to that search region is determined based on bit depth information corresponding to the current image and sample parameters corresponding to the first template.

[0195] Furthermore, in the embodiments of the present invention, when performing a search in a predetermined search area based on a first parameter corresponding to the current block and determining the block vector of the current block, the search points within the predetermined search area are sequentially scanned according to a predetermined scan order, a first matching cost value is determined between the matching template corresponding to the search point in the predetermined search area and the first template based on a predetermined matching criterion, and if the first matching cost value and the first parameter satisfy the search stop condition, the search for the predetermined search area is terminated, and the block vector corresponding to the first matching cost value is determined as the block vector of the current block.

[0196] To make it easier to understand, in the embodiments of the present application, if the first parameter is a matching cost threshold corresponding to a matching cost value, the first parameter can be understood as a single cost upper threshold. Therefore, the corresponding search termination condition may be the magnitude relationship between the matching cost value and the first parameter.

[0197] Exemplary, in the embodiments of the present application, satisfying the search termination condition may include the first matching cost value being less than or equal to the first parameter, and not satisfying the search termination condition may include the first matching cost value being greater than the first parameter.

[0198] Correspondingly, in the embodiment of the present application, when the first matching cost value is greater than the first parameter, the scanning of the next search point within the predetermined search region can be continued according to the predetermined scan order.

[0199] In addition, in the embodiment of the present application, for one block vector, it may be selected whether bvXMins and bvXMaxs represent the minimum offset and the maximum offset of the block vector in the horizontal direction, or bvYMins and bvYMaxs represent the minimum offset and the maximum offset of the block vector in the vertical direction, respectively.

[0200] bvXMinsregionId, bvXMaxsregionId, bvYMinsregionId, bvYMaxsregionId are calculated as follows using the already determined iVerMin regionId , iVerMax regionId , iHorMin regionId , iHorMax regionId :

[0201] bvXMinsregionId = iHorMin regionId -xTbCmp bvXMaxsregionId = iHorMax regionId -xTbCmp bvYMinsregionId = iVerMin regionId -yTbCmp bvYMaxsregionId = iVerMax regionId -yTbCmp bvXMinsregionId, bvXMaxsregionId, bvYMinsregionId, and bvYMaxsregionId determine the range of the horizontal and vertical offset amounts of the search point with respect to the current block, that is, the range of the block vector BV.

[0202] Furthermore, in the embodiments of this application, each search point (iPosHor, iPoxVer) within the search region, i.e., each block vector BV (composed of a horizontal component and a vertical component (pX, pY), where pX = iPosHor - xTbCmp and pY = iPosVer - yTbCmp, in which case pX lies between bvXMins and bvXMaxs, and pY lies between bvYMins and bvYMaxs, and a matching reconstruction block of one current block can be found in the reconstruction region, and the adjacent reconstruction samples of the matching reconstruction block are the matching templates.

[0203] To make it easier to understand, in the embodiments of this application, when scanning search points (iPosHor, iPoxVer) within the current search range (a predetermined search area) according to a predetermined scan order, for each search point, one matching reconstruction block of the current block can be found in the reconstruction area, and the adjacent reconstruction samples of the matching reconstruction block are the matching templates.

[0204] Furthermore, in the embodiments of this application, the matching cost between the adjacent template of the current block and the adjacent template of the reconstructed block is denoted as pDiff. The pDiff of the current search point is pDiff <= SAD. thre If the condition is met, that is, if the first matching cost value between the matching template corresponding to the search point and the first template is less than or equal to the first parameter, the matching template obtained through the search can be considered a reconstruction template that satisfies the condition, and the search can be stopped. The corresponding first matching cost pDiff is denoted as pDiff_BEST, the corresponding block vector BV is denoted as optimal block vector BV_BEST(pX_BEST,pY_BEST), and the corresponding matching template is denoted as optimal matching template T_BEST.

[0205] In the embodiments of this application, the search strategies that can be employed when performing the search process include, but are not limited to, search methods based on different search step lengths, such as a rough search based on a first search step length and / or a fine search based on a second search step length. Here, the first search step length is greater than the second search step length.

[0206] Furthermore, in the embodiments of the present application, it is possible to scan search points within a predetermined search area according to a predetermined scan order and a first search step length, and to determine the block vector and candidate template. Alternatively, it is also possible to scan search points within a predetermined search area according to a predetermined scan order and a second search step length, and to determine the block vector and candidate template.

[0207] Furthermore, in the embodiments of the present invention, first, search points within a predetermined search area are scanned according to a predetermined scan order and a first search step length to determine an initial block vector and an initial matching template corresponding to the initial block vector. Next, a first search area can be determined based on the initial matching template, where the first search area is smaller than the predetermined search area. Finally, search points within the first search area are scanned according to a predetermined scan order and a second search step length to determine a block vector and a candidate template, where the first search step length is greater than the second search step length.

[0208] In other words, in the embodiments of the present invention, when searching for the optimal matching template in the search domain, a search strategy may be adopted in which a rough search is performed followed by a fine search, or only a fine search may be performed, or only a rough search may be performed.

[0209] Exemplarily, in the embodiments of the present application, the rough search may specifically include obtaining the final candidate template by determining the optimal rough matching template in the search area at the first predetermined step length (i.e., the first search step length, for example, 2 or 3, etc.), or obtaining the final candidate template by determining the optimal rough matching template in the search area using the downsampled template (for example, the downsampling factor is 2 or 3, etc.).

[0210] Exemplarily, in the embodiments of the present application, the fine search may specifically include obtaining the final candidate template by determining the optimal fine matching template in the search area at the second predetermined step length (i.e., the second search step length, for example, 1 or 1 / 2, etc.), or obtaining the final candidate template by determining the optimal fine matching template in the vicinity of the optimal rough matching template after performing the rough search.

[0211] Furthermore, in the embodiments of the present application, the search points within the predetermined search area are sequentially scanned according to the predetermined scan order and the first search step length, and based on the predetermined matching criterion, the first matching cost value between the matching template corresponding to the search point within the predetermined search area and the first template is determined. When the first matching cost value and the first parameter satisfy the search stop condition, the search for the predetermined search area is terminated, and the block vector corresponding to the first matching cost value can be determined as the block vector of the current block.

[0212] As can be understood, in the embodiments of the present application, satisfying the search stop condition may include that the first matching cost value is less than or equal to the first parameter, and not satisfying the search stop condition may include that the first matching cost value is greater than the first parameter.

[0213] Exemplary, in embodiments of the present invention, if the search strategy is to perform only a rough search, in each region, it is possible to choose to perform a rough search with a step length greater than 1 (for example, a step length of 2 or 3) within a search range where pX is between bvXMinsregionId and bvXMaxsregionId and pY is between bvYMinsregionId and bvYMaxsregionId. The pDiff of the current search point is pDiff <= SAD thre If the condition is met, that is, if the first matching cost value between the matching template corresponding to the search point and the first template is less than or equal to the first parameter, the matching template obtained through the search can be considered a reconstruction template that satisfies the condition, and the search can be stopped. The matching cost pDiff obtained by template matching is denoted as pDiff_BEST, and the corresponding block vector BV is denoted as the optimal block vector BV_BEST, with each term being a single coordinate pair (pX_BEST, pY_BEST).

[0214] Furthermore, in the embodiments of the present invention, search points within a predetermined search area are sequentially scanned according to a predetermined scan order and second search step length, a first matching cost value is determined between the matching template corresponding to the search point within the predetermined search area and the first template based on a predetermined matching criterion, and if the first matching cost value and the first parameter satisfy the search stop condition, the search for the predetermined search area is terminated, and the block vector corresponding to the first matching cost value is determined as the block vector of the current block.

[0215] Exemplary, in the embodiments of the present application, satisfying the search termination condition may include the first matching cost value being less than or equal to the first parameter, and not satisfying the search termination condition may include the first matching cost value being greater than the first parameter.

[0216] Exemplary, in embodiments of the present invention, if the search strategy is to perform only fine search, in each region, it is possible to choose to perform fine search with a small step length (for example, a step length of 1 or 1 / 2, and if the step length is less than 1, subsample interpolation is required) within the search range where pX is between bvXMinsregionId and bvXMaxsregionId and pY is between bvYMinsregionId and bvYMaxsregionId. The current pDiff of the search point is pDiff <= SAD thre If the condition is met, that is, if the first matching cost value between the matching template corresponding to the search point and the first template is less than or equal to the first parameter, the matching template obtained through the search can be considered a reconstruction template that satisfies the condition, and the search can be stopped. The matching cost pDiff obtained by template matching is denoted as pDiff_BEST, and the corresponding block vector BV is denoted as the optimal block vector BV_BEST, with each term being a single coordinate pair (pX_BEST, pY_BEST).

[0217] Furthermore, in the embodiments of the present application, a search is performed in a predetermined search area according to a predetermined scan order and a first search step length, a second matching cost value is determined between a matching template corresponding to a search point in the predetermined search area and a first template based on a predetermined matching criterion, and if the second matching cost value and a first parameter satisfy the search termination condition, the search for the predetermined search area is terminated, the block vector corresponding to the second matching cost value is determined as the reference block vector of the current block, the first search area is determined based on the matching reconstruction block corresponding to the reference block vector, the first search area is smaller than the predetermined search area, a search is performed in the first search area according to a predetermined scan order and a second search step length, a third matching cost value is determined between a matching template corresponding to a search point in the first search area and a first template based on a predetermined matching criterion, the first search step length is greater than the second search step length, and if the third matching cost value and a first parameter satisfy the search termination condition, the search for the first search area is terminated, and the block vector corresponding to the third matching cost value is determined as the block vector of the current block.

[0218] To make it easier to understand, in the embodiments of the present application, if the first parameter is a matching cost threshold corresponding to a matching cost value, then the first parameter can be understood as a single cost upper threshold. Therefore, the corresponding search termination condition may be the magnitude relationship between the matching cost value and the first parameter.

[0219] Exemplary examples, in the embodiments of the present application, satisfying the search termination condition may include the second matching cost value being less than or equal to the first parameter, and not satisfying the search termination condition may include the second matching cost value being greater than the first parameter.

[0220] Exemplary, in the embodiments of the present application, satisfying the search termination condition may include the third matching cost value being less than or equal to the first parameter, and not satisfying the search termination condition may include the third matching cost value being greater than the first parameter.

[0221] In other words, in the embodiments of the present application, satisfying the search termination condition includes the first matching cost value being less than or equal to the first parameter, and / or the second matching cost value being less than or equal to the first parameter, and / or the third matching cost value being less than or equal to the first parameter.

[0222] For example, in the embodiment of the present invention, if the search strategy is to perform a rough search followed by a fine search, first a rough search is performed with a step length of 2 (i.e., the first search step length is 2), and the optimal rough matching template (initial matching template) is obtained by template matching. Then, the optimal fine matching template is determined in the neighborhood of the optimal rough matching template with a step length of 1 (i.e., the second search step length is 1), thereby obtaining the final candidate template.

[0223] Here, in the coarse search phase, in each region, it is possible to choose to perform a coarse search with a step length greater than 1 within the search range where pX is between bvXMinsregionId and bvXMaxsregionId, and pY is between bvYMinsregionId and bvYMaxsregionId. For example, a coarse search is performed with a step length of 2, and during the scanning process of the coarse search, the current search point pDiff is pDiff <= SAD. thre If the condition is met, that is, if the second matching cost value between the matching template corresponding to the search point and the first template is less than or equal to the first parameter, then it can be determined that the matching template obtained through the search is a reconstruction template that satisfies the condition. In this case, the search is stopped, and the optimal matching cost obtained by template matching is pDiff1_BEST=pDiff refineThis is expressed as follows, and the corresponding block vector BV is expressed as the optimal block vector BV1_BEST(pX1_BEST,pY1_BEST), i.e., the reference block vector. The corresponding matching template is the initial matching template, and in this case, the search region where the optimal matching search point is located is bestRegionId.

[0224] Subsequently, in the refinement phase, it is possible to choose to perform a search in the neighborhood of the optimal block vector BV1_BEST (reference block vector) obtained in the rough search, that is, to perform a search in the first search region. Therefore, it is first necessary to determine the refinement range TmpRefineRange, that is, to determine the first search region TmpRefineRange. Here, the refinement range (first search region TmpRefineRange) may be a fixed size or may be associated with the current block size, for example, it can be set to min(nTbW,nTbH) / 2. Next, the position of the optimal matching reconstruction block obtained in the rough search is calculated as the reference position of the refinement region, that is, BestPosX=xTbCmp+pX1_BEST and BestPosY=yTbCmp+pY1_BEST.

[0225] In one embodiment, based on the value of bestRegionId, the calculated values ​​of iVerMinbestRegionId, iVerMaxbestRegionId, iHorMinbestRegionId, and iHorMaxbestRegionId are first obtained. Then, based on the optimal matching block position obtained through rough searching, new search ranges iVerMinrefine, iVerMaxrefine, iHorMinrefine, and iHorMaxrefine can be obtained. The method of obtaining these values ​​is as follows.

[0226] iHorMinrefine=max(iHorMinbestRegionId,BestPosX-TmpRefineRange) iHorMaxrefine=min(iHorMaxbestRegionId,BestPosX+TmpRefineRange) iVerMinrefine=max(iVerMinbestRegionId,BestPosY-TmpRefineRange) iVerMaxrefine=min(iVerMaxbestRegionId,BestPosY+TmpRefineRange) Next, the adjusted block vectors BVbvXMins, bvXMaxs, bvYMins, and bvYMaxs are obtained by calculating them using iVerMinrefine, iVerMaxrefine, iHorMinrefine, and iHorMaxrefine.

[0227] bvXMins=iHorMinrefine-xTbCmp bvXMaxs=iHorMaxrefine-xTbCmp bvYMins=iVerMinrefine-yTbCmp bvYMaxs=iVerMaxrefine-yTbCmp The fine search is performed within a block vector range where pX lies between bvXMinsrefine and bvXMaxsrefine, and pY lies between bvYMinsrefine and bvYMaxsrefine. For example, a search is performed with a step length of 1, and the current search point pDiff is reached during the fine search scan. refine pDiff <= SAD thre If the following condition is met, i.e., if the third matching cost value between the matching template corresponding to the search point and the first template is less than or equal to the first parameter, then it can be determined that the matching template obtained through the search is a reconstruction template that satisfies the condition. In this case, the optimal matching cost obtained by template matching is pDiff_BEST=pDiff refineThis is expressed as follows, and the corresponding block vector BV is expressed as the optimal block vector BV_BEST(pX_BEST,pY_BEST), i.e., the block vector of the current block that is ultimately determined, and the corresponding matching template is the candidate template of the current block.

[0228] After the above operations are completed, the optimal block vector BV_BEST(pX_BEST,pY_BEST) is obtained, where pX_BEST and pY_BEST are the horizontal and vertical offset amounts of the optimal matching template relative to the currently encoded block template, and are also the horizontal and vertical offset amounts of the optimal matching reconstruction block relative to the currently encoded block.

[0229] In the embodiments of this application, by combining the results of a rough search and a fine search process (where the fine search process includes one or more reference point searches), one or more optimal block vectors BV_BEST corresponding to different algorithmic requirements can be obtained, and BV_BEST is a single coordinate pair (pX_BEST, pY_BEST).

[0230] Thus, in the embodiments of the present invention, the process of performing a search in the search domain and determining one or more block vectors may include three types of search strategies: performing only a rough search, performing only a fine search, or performing a rough search followed by a fine search.

[0231] Furthermore, in the embodiments of the present invention, when performing a search in a predetermined search area based on a first parameter corresponding to the current block for at least one search area included in a predetermined search area, and determining the block vector of the current block, first, a first search order corresponding to at least one search area is determined based on the positional relationship between the current block and at least one search area. Next, at least one search area is sequentially scanned based on the first search order, a search is performed in at least one search area based on the first parameter, and the block vector of the current block can be determined.

[0232] In the embodiments of this application, the first search order may be from the closest to the current block to the furthest. This is because, when searching multiple sub-search regions, following a search order from closest to furthest allows for a quicker determination of the block vector of the current block.

[0233] Exemplaryly, in some embodiments, different search regions can be defined in different ways. Figure 13 is a first schematic diagram showing at least one search region, where, as shown in Figure 13, regions close to the current block are defined as R1, R2, and R3, and regions furthest away are defined as R4, R5, R6, and so on, and the search can be performed in the order of first R1, R2, R3, then R4, R5, R6.

[0234] In other words, in the embodiment of the present invention, the search order corresponding to different search regions can be determined based on the positional relationship between the search region and the current block.

[0235] In the embodiments of this application, the order of R1 and R2 is interchangeable, and the order of R4 and R5 is interchangeable.

[0236] Furthermore, in the embodiments of the present invention, a search is performed in the predetermined search area based on a first parameter corresponding to the current block for at least one search area included in a predetermined search area, and when determining the block vector of the current block, at least one search area is merged based on the positional relationship between the current block and at least one search area to obtain at least one merged search area. Next, a second search order corresponding to at least one merged search area is determined based on the positional relationship between the current block and at least one merged search area. Based on the second search order, at least one merged search area is sequentially scanned, a search is performed within at least one merged search area based on the first parameter, and the block vector of the current block can be determined.

[0237] In the embodiments of this application, the second search order may be from the closest to the current block to the furthest. This is because, when searching multiple sub-search regions, following a search order from closest to furthest allows for a quicker determination of the block vector of the current block.

[0238] Exemplary examples, in some embodiments, as shown in Figure 13, R1 and R3 may be merged into one region, or R2 and R3 may be merged into one region, or R5 and R6 may be merged into one region, or R4 and R6 may be merged into one region.

[0239] Exemplary, in some embodiments, different search domains can be defined in different ways. Figure 14 is a second schematic diagram showing at least one search domain, and as shown in Figure 14, in a search situation in which an undetermined reconstructed search domain is included in a given search domain, the search can be performed in the order of R1, R2, R3, R7, R8, and then R4, R5, R6. Here, the order of R1 and R2 is interchangeable, the order of R7 and R8 is interchangeable, and the order of R4 and R5 is interchangeable.

[0240] Furthermore, in the embodiments of the present application, a predetermined scan sequence includes one of the following: a raster scan sequence, a vertical inverse raster scan sequence, a horizontal inverse raster scan sequence, a full inverse raster scan sequence, a diagonal scan sequence, a horizontal scan sequence, a vertical scan sequence, or a zigzag scan sequence.

[0241] In other words, in the embodiments of the present invention, when scanning for search points within a predetermined search area, a raster scan order from top to bottom and left to right may be adopted, a vertical inverse raster scan order from bottom to top and left to right may be adopted, a horizontal inverse raster scan order from top to bottom and right to left may be adopted, a complete inverse raster scan order from bottom to top and right to left may be adopted, or an order such as diagonal scan, horizontal scan, vertical scan, or zigzag scan may be adopted.

[0242] Furthermore, in the embodiments of the present invention, when sequentially searching at least one search region based on a first search order for at least one search region included in a predetermined search region, the search points within the current search region are sequentially scanned according to a predetermined scan order corresponding to the current search region, and the block vector of the current block is determined.

[0243] In other words, for each search area, it is possible to use the same scan method and scan order, different scan methods or the same scan method, or different scan orders.

[0244] In the embodiments of this invention, a vertical inverse raster scan sequence is determined as a predetermined scan sequence corresponding to the first region located above the current block within at least one search area; a horizontal inverse raster scan sequence is determined as a predetermined scan sequence corresponding to the second region located to the left of the current block within at least one search area; and a complete inverse raster scan sequence is determined as a predetermined scan sequence corresponding to the third region located to the upper left of the current block within at least one search area.

[0245] Exemplary examples, in some embodiments, as shown in Figure 14, R1 and R5 can perform searches according to the vertical inverse raster scan order, R2 and R4 can perform searches according to the horizontal inverse raster scan order, and R3 and R6 can perform searches according to the complete inverse raster scan order.

[0246] In the embodiments of this application, a vertical inverse raster scan order is determined as a predetermined scan order corresponding to the fourth region located above and / or to the upper right of the current block within at least one search area; a horizontal inverse raster scan order is determined as a predetermined scan order corresponding to the fifth region located to the left and / or lower left of the current block within at least one search area; and a complete inverse raster scan order is determined as a predetermined scan order corresponding to the third region located to the upper left of the current block within at least one search area.

[0247] Exemplary examples, in some embodiments, as shown in Figure 14, R1, R5, and R7 can perform searches according to the vertical inverse raster scan order, R2, R4, and R8 can perform searches according to the horizontal inverse raster scan order, and R3 and R6 can perform searches according to the complete inverse raster scan order.

[0248] Furthermore, in embodiments of the present invention, the first parameter corresponding to the current block can also be determined by decoding the bitstream. Here, the first parameter can be transmitted by any of the SPS layer syntax information, PPS layer syntax information, APS layer syntax information, SH layer syntax information, or CU layer syntax information.

[0249] In other words, in the embodiments of the present invention, the threshold condition for early termination (first parameter) can be identified by the SPS, PPS, APS, or SH layer to control the complexity on the decoding side.

[0250] Furthermore, in the embodiments of the present application, when performing a search in a predetermined search area based on a first parameter corresponding to the current block and determining the block vector of the current block, it is also possible to further scan the search points within the predetermined search area according to a predetermined search method, determine a first matching cost value between the matching template corresponding to the search point in the predetermined search area and the first template based on a predetermined matching criterion, and if the first matching cost value and the first parameter satisfy the search termination condition, terminate the search in the predetermined search area and determine the block vector corresponding to the first matching cost value as the block vector of the current block.

[0251] In the embodiments of this application, the predetermined search method includes one of the following: a cross-shaped search method, a square-shaped search method, a diamond-shaped search method, or a hash search method.

[0252] In other words, in the embodiments of this application, it is possible to choose to perform a search in a predetermined scan order within each region. For example, a raster order such as top to bottom, left to right, or bottom to top, right to left can be used. Alternatively, a high-speed iterative search can be performed within a predetermined search region according to a predetermined search method, where the predetermined search method includes, but is not limited to, a cross search, a square search, or a diamond search. Alternatively, a hash search method similar to IBC can be employed. This application is not specifically limited.

[0253] Furthermore, in the embodiments of the present application, when performing a search process according to a predetermined search method, the employable search strategies include, but are not limited to, search methods based on different search step lengths, such as a rough search based on a third search step length and / or a fine search based on a fourth search step length. Here, the third search step length is greater than the fourth search step length.

[0254] Exemplary, in some embodiments, it is possible to scan for search points within a predetermined search area according to a predetermined search method and a third search step length, and to determine a first matching cost value between a matching template corresponding to a search point within the predetermined search area and a first template based on a predetermined matching criterion; or, it is possible to scan for search points within a predetermined search area according to a predetermined search method and a fourth search step length, and to determine a first matching cost value between a matching template corresponding to a search point within the predetermined search area and a first template based on a predetermined matching criterion, where the third search step length is greater than the fourth search step length.

[0255] Exemplary, in some embodiments, it is possible to first perform a search in a predetermined search area according to a predetermined search method and a third search step length, and then, based on a predetermined matching criterion, determine a second matching cost value between the matching template corresponding to the search point in the predetermined search area and the first template. If the second matching cost value and the first parameter satisfy the search termination condition, the search in the predetermined search area is terminated, the block vector corresponding to the second matching cost value is determined as the reference block vector of the current block, and the first search area is determined based on the matching reconstruction block corresponding to the reference block vector. The first search area is smaller than the predetermined search area, and a search is performed in the first search area according to a predetermined search method and a fourth search step length. Finally, based on a predetermined matching criterion, a third matching cost value is determined between the matching template corresponding to the search point in the first search area and the first template. If the third search step length is greater than the fourth search step length, and the third matching cost value and the first parameter satisfy the search termination condition, the search in the first search area is terminated, and the block vector corresponding to the third matching cost value is determined as the block vector of the current block.

[0256] In other words, in the embodiments of the present invention, when searching for the optimal matching template in the search domain according to a predetermined search method, a search strategy may be adopted in which a rough search is performed followed by a fine search, or only a fine search may be performed, or only a rough search may be performed.

[0257] Furthermore, in the embodiments of the present invention, when performing a high-speed iterative search according to a predetermined search method, in addition to controlling the search process using a first parameter, the search process can also be controlled using a second parameter.

[0258] In the embodiments of this application, the second parameter is used to limit the difference in matching costs between different templates based on predetermined matching criteria.

[0259] In other words, in the embodiment of the present invention, after determining a predetermined search area based on a first template, it is possible to select to perform a search within the predetermined search area based on a first parameter and / or a second parameter corresponding to the current block, thereby determining the block vector of the current block.

[0260] Furthermore, in the embodiment of the present invention, when performing a search within a predetermined search area based on a second parameter corresponding to the current block, first, an iterative search is performed on the search points within the predetermined search area according to a predetermined search method, and the iterative cost difference between the matching template corresponding to the search points within the predetermined search area and the first template is determined based on a predetermined matching criterion. If the iterative cost difference and the second parameter satisfy the search termination condition, the iterative search for the predetermined search area is terminated, and the block vector corresponding to the iterative cost difference is determined as the block vector of the current block. Here, the second parameter is for limiting the matching cost difference between different templates based on a predetermined matching criterion.

[0261] In the embodiments of this application, the second parameter may be used to control the search process. For example, based on the second parameter, it may be chosen to continue the high-speed iterative search process or to terminate the iterative search process early.

[0262] For example, in the embodiments of the present invention, the second parameter may be an iteration cost difference threshold corresponding to the iteration cost difference. Accordingly, when controlling the search process based on the second parameter, if the iteration cost difference and the second parameter (iteration cost difference) satisfy the search termination condition, it is possible to choose to terminate the high-speed iterative search process early; otherwise, the iterative search process can be continued.

[0263] To make it easier to understand, in the embodiments of the present invention, if the second parameter is an iterative cost difference corresponding to an iterative cost difference, the second parameter can be understood as a single upper limit threshold for the difference. Therefore, the corresponding search termination condition may be the magnitude relationship between the iterative cost difference and the second parameter.

[0264] For example, in the embodiment of the present invention, if the iterative cost difference is less than or equal to the second parameter, the search termination condition can be considered to be met, and the high-speed iterative search process can be terminated early. If the matching cost value is greater than the second parameter, the search termination condition can be considered not to be met, and the high-speed iterative search process can be continued.

[0265] Thus, in the embodiments of the present invention, when performing a search based on the second parameter, if the search obtains a search point where the difference in iteration cost before and after the iteration is less than or equal to the second parameter, the high-speed iterative search can be terminated, thereby enabling control of the search process.

[0266] In other words, in the embodiment of the present invention, in addition to a threshold for the magnitude of the cost itself (i.e., the first parameter), the cost difference before and after iteration can be set as a termination threshold (i.e., the second parameter), and if the cost difference before and after iteration (iteration cost difference) is smaller than a certain threshold (the second parameter), the iteration is stopped.

[0267] In the embodiments of this invention, the search process may be controlled by using both the first and second parameters simultaneously, or by selecting either the first or second parameter to control the search process. That is, the iterative cost difference threshold (second parameter) and the threshold for the magnitude of the cost itself (first parameter) may be used independently or in combination.

[0268] Furthermore, in the embodiment of the present application, first, an iterative search is performed in a first sub-region within a predetermined search area according to a predetermined search method, and the iterative cost difference between the matching template corresponding to the search point in the first sub-region and the first template is determined based on a predetermined matching criterion. If the iterative cost difference and the second parameter satisfy the search termination condition, the iterative search for the first sub-region is terminated. Then, based on a predetermined matching criterion, the current matching cost value between the matching template corresponding to the search point in the first sub-region and the first template is determined. If the current matching cost value and the first parameter satisfy the search termination condition, the search for the predetermined search area is terminated, and the block vector corresponding to the first matching cost value is determined as the block vector of the current block.

[0269] Furthermore, in the embodiments of the present invention, first, an iterative search is performed in a first sub-region within a predetermined search area according to a predetermined search method, and the iterative cost difference between the matching template corresponding to the search point in the first sub-region and the first template is determined based on a predetermined matching criterion. If the iterative cost difference and the second parameter satisfy the search termination condition, the iterative search for the first sub-region is terminated. Then, based on a predetermined matching criterion, the current matching cost value between the matching template corresponding to the search point in the first sub-region and the first template is determined. If the current matching cost value and the first parameter do not satisfy the search termination condition, the iterative search can be continued in other sub-regions within the predetermined search area, other than the first sub-region, according to the predetermined search method.

[0270] For example, in some embodiments, it is possible to choose to perform a high-speed iterative search within each sub-region of a given search area. If the iterative cost difference is less than a certain threshold (second parameter), the iterative search process in that sub-region is stopped. If the current cost (current matching cost value) is less than a termination threshold (second parameter), the entire search process in the given search area is stopped, i.e., the search process in the given search area is terminated early. Otherwise, it is possible to choose to continue the iterative search process in other sub-regions.

[0271] Furthermore, in embodiments of the present invention, the second parameter corresponding to the current block can also be determined by decoding the bitstream. Here, the second parameter can be transmitted by any of the SPS layer syntax information, PPS layer syntax information, APS layer syntax information, SH layer syntax information, or CU layer syntax information.

[0272] In other words, in the embodiments of the present invention, the threshold condition for early termination (second parameter) can be identified by the SPS, PPS, APS, or SH layer to control the complexity on the decoding side.

[0273] In step 103, the predicted value of the current block is determined based on the block vector of the current block.

[0274] In the embodiment of the present invention, a search is performed in a predetermined search area based on a first parameter corresponding to the current block, the block vector of the current block is determined, and then, based on the block vector of the current block, a predicted value of the current block can be determined.

[0275] Furthermore, in the embodiments of the present application, when determining the predicted value of the current block based on the block vector of the current block, first, the reference block of the current block can be determined based on the block vector of the current block, and then the predicted value of the current block can be determined based on the reference block of the current block.

[0276] Exemplary, in the embodiments of this application, the determination of the reference block of the current block can be achieved using a simple translation copy. The specific operation is as follows: x=0…nTbW-1, y=0…nTbH-1 are to be processed, and the reconstruction sample recSamples of the current frame (i.e., the reference block of the current block) is determined by RefBlockn [x][y]=recSamples[x+pXn][y+pYn].

[0277] In the embodiment of this application, when determining the reference block of the current block based on the block vector of the current block, first, the initial reconfigured block of the current block is determined based on the block vector of the current block, and then a modification process is performed on the initial reconfigured block to determine the reference block of the current block.

[0278] In other words, in the embodiments of this application, other methods can be used when obtaining candidate reconstruction blocks (reference blocks). For example, first, modifications are made to the initial reconstruction block corresponding to the obtained candidate template, and then the corresponding reference block is determined.

[0279] In the embodiments of this invention, the predicted value determined by the block vector of the current block may be the final predicted value, or it may be further processed to obtain the final predicted value of the current block.

[0280] Furthermore, in the embodiments of the present application, when determining the predicted value of the current block based on the block vector of the current block, first, at least one reference block corresponding to the current block can be determined based on the block vector of the current block, and then the predicted value of the current block can be determined based on at least one more reference block.

[0281] In the embodiments of this application, when determining the predicted value of the current block based on at least one reference block, first, at least one predicted block is determined based on at least one reference block, weighted fusion is performed on at least one predicted block, and then the predicted value of the current block is determined.

[0282] For example, in some embodiments, after determining the block vector of the current block, multiple points are obtained from around the block vector, i.e., multiple reference blocks are obtained, and then a weighted fusion is performed on the predicted values ​​corresponding to the multiple points to obtain a predicted value for the current block.

[0283] Furthermore, in the embodiments of the present application, when determining the predicted value of the current block based on the block vector of the current block, first a first predicted value of the current block can be determined based on the block vector of the current block, and then a second predicted value of the current block can be determined based on a predetermined prediction mode, the predetermined prediction mode including a Planar mode and / or a directional mode, and finally the predicted value of the current block can be determined based on the first predicted value and the second predicted value.

[0284] For example, in some embodiments, after determining the block vector of the current block, the final predicted value can be obtained by weighting and combining the predicted value obtained using the block vector with the predicted value obtained in other intra modes. Here, other intra modes may be other prediction modes other than IntraTMP, such as Planar mode or direction mode, where the direction mode may be obtained by deriving from TIMD or by positioning in an intra candidate table using an Index transmitted in a bitstream. This method may be called IntraTMP CIIP mode.

[0285] To make it easier to understand, in IntraTMP mode, in addition to obtaining predicted values ​​using the basic copy method, it is also possible to obtain predicted values ​​by performing filtering fusion at locations corresponding to multiple BVs, and to perform fused prediction with the normal Intra mode.

[0286] Furthermore, in the embodiments of the present application, after determining the predicted value of the current block based on the block vector of the current block, the reconstructed value of the current block can be determined based on the predicted value of the current block.

[0287] In the embodiment of this invention, first, the bitstream can be decoded to determine the predicted difference (residual) corresponding to the current block, and then, based on the predicted difference and the predicted value, the reconstructed value of the current block can be determined.

[0288] As described above, the decoding method proposed in steps 101 to 103 above can effectively utilize current image information (e.g., depth information) or Diff information of adjacent positions of the current target block to be encoded (e.g., matching cost value corresponding to adjacent reconstructed blocks) to derive a first parameter for template matching. If, during the search process, it is determined that the matching cost value corresponding to the search point satisfies the first parameter, the search process for the current encoded block can be terminated early, thereby reducing the search complexity of IntraTMP to some extent.

[0289] In the embodiments of this invention, the first parameter determined by the current image information (e.g., depth information) may be a predefined fixed threshold, while the first parameter determined based on adjacent reference blocks using IntraTMP mode may be an adaptive threshold. Here, different first parameters can be set for different sub-search regions within a predetermined search region to control the search process.

[0290] For example, in some embodiments, a search strategy for early exit based on the reference template SAD matching cost can be proposed for IntraTMP technology. According to this search strategy, the search process can be controlled using a matching cost threshold (first parameter) for one reference template, and the search can be terminated early when the first parameter is met, thereby ensuring the effectiveness of the algorithm while maintaining complexity.

[0291] For example, in some embodiments, a template matching cost threshold (first parameter) can be derived using current image information or Diff information of adjacent positions of the current target block to be encoded. If the cost value of the current search point does not exceed the threshold, the BV of the search point is expressed as the optimal block vector BV_BEST, and the search process is terminated early.

[0292] Here, the input for obtaining Intra TMP-BV is the position (xTbCmp, yTbCmp) of the current encoded block (current block), the width nTbW of the current encoded block, and the height nTbH of the current encoded block. The output for obtaining Intra TMP-BV is the BV of the current block and the corresponding predicted value of the predicted block, predSamples[x][y], where x=0...nTbW-1 and y=0...nTbH-1. The predicted value of the predicted block may also be used as the final predicted value, and further processing can be performed to obtain the final predicted value of the current block.

[0293] To make it easier to understand, the specific process for obtaining Intra TMP-BV proposed in the embodiment of this application is divided into three steps: determining the current template type, obtaining a current template reconstruction sample, and determining the block vector within a given search range. Here, a set of predicted values ​​for the current block can be obtained for each BV obtained.

[0294] The embodiments of the present application provide a decoding method. When the prediction mode of the current block is an intra-template matching prediction mode, the decoder determines a first template corresponding to the current block, determines a predetermined search area based on the first template, performs a search in the predetermined search area based on a first parameter corresponding to the current block, determines the block vector of the current block, the first parameter is for controlling the search process, and determines the predicted value of the current block based on the block vector of the current block. Thus, in the embodiments of the present application, the search process can be controlled using a predetermined first parameter such as a matching cost threshold based on the IntraTMP mode, and it is possible to select whether to terminate the search process early or continue the search process based on the first parameter. In other words, the coding and decoding method proposed in the embodiments of the present application can solve the problem of high computational complexity that arises from scanning all search points in the search area by introducing a first parameter for controlling the search process, and can improve the efficiency and performance of coding and decoding.

[0295] One embodiment of the present invention proposes an encoding method applicable to an encoder, and Figure 15 is a schematic flowchart of the encoding method proposed in the embodiment of the present invention, and as shown in Figure 15, the encoding process by the encoder may include the following steps.

[0296] In step 201, if the prediction mode for the current block is an intra-template matching prediction mode, a first template corresponding to the current block is determined, and a predetermined search area is determined based on the first template.

[0297] In embodiments of the present invention, if the prediction mode of the current block is a prediction mode based on intra-template matching, the first step is to determine a first template corresponding to the current block. Here, when obtaining the first template, the template type corresponding to the current block can be determined first, and then the first template corresponding to the current block can be determined based on the template type.

[0298] To make it clear, in the embodiments of the present invention, the prediction mode based on intra-template matching may be a prediction mode using template matching, for example, the prediction mode based on intra-template matching may be an IntraTMP mode.

[0299] Furthermore, in the embodiments of the present application, after determining a first template corresponding to the current block, a predetermined search region corresponding to the current block can be determined based on the first template.

[0300] The encoding method of the embodiment of this application is applied to an encoder. The encoding method may also include an intra prediction method, and more specifically, it may be a color component prediction method. Here, the video image is divided into a plurality of encoding blocks, each encoding block may include a first color component, a second color component, and a third color component, and the current block in the embodiment of this application refers to the encoding block in the video image that is currently subject to intra prediction.

[0301] Here, if it is necessary to predict the first color component, the component to be predicted is the first color component; if it is necessary to predict the second color component, the component to be predicted is the second color component; and if it is necessary to predict the third color component, the component to be predicted is the third color component. Furthermore, if we make a prediction for the first color component of the current block and assume that the first color component is the luminance component, i.e., the component to be predicted is the luminance component, then the current block may also be called a luminance block. Or, if we make a prediction for the second color component of the current block and assume that the second color component is the chromaticity component, i.e., the component to be predicted is the chromaticity component, then the current block may also be called a chromaticity block.

[0302] Furthermore, in the embodiments of this application, the reference sample of the current block may refer to a reference sample point adjacent to the current block. Here, "adjacent" may refer to a spatially adjacent point, but is not limited to this. For example, adjacent points may refer to adjacent points in the time domain, adjacent points in the spatial domain and time domain, and furthermore, the reference sample of the current block may be a reference sample obtained by performing some processing on a spatially adjacent, temporally adjacent, or spatially and temporally adjacent reference sample point. The embodiments of this application are not particularly limited.

[0303] Furthermore, in embodiments of the present application, it may be chosen to determine the template type of the current block based on instruction information in the bitstream, or to determine the template type of the current block based on the size of the current block.

[0304] Furthermore, in embodiments of the present application, the template type of the current block may be determined based on a reference sample of the current block, where the reference sample of the current block includes at least one of the following: a left-side adjacent reference sample of the current block, an upper-side adjacent reference sample of the current block, an upper-left adjacent reference sample of the current block, an lower-left adjacent reference sample of the current block, and an upper-right adjacent reference sample of the current block.

[0305] To make it clear, in the embodiments of the present application, the reference sample of the current block may include adjacent reconstructed samples of the current block, that is, it is possible to choose to use adjacent reconstructed samples of the current block as a template to search for a matching template in a given search area.

[0306] In the embodiments of this application, the reference samples of the current block, i.e., the adjacent reconstructed samples of the current block, may include the upper reference sample, upper left reference sample, upper right reference sample, left reference sample, and lower left reference sample of the current block.

[0307] To make it clear, in the embodiments of the present application, when determining the template type of the current block using the reference samples of the current block, the template type can be classified and determined based on whether or not adjacent reference samples are available.

[0308] To make it clearer, in the embodiments of the present application, when determining the template type of a block, it is also possible to classify and determine the template type based on the instructions in the bitstream.

[0309] Furthermore, in the embodiments of the present application, when determining the template type of the current block based on the reference sample of the current block, if the left adjacent reference sample of the current block, the upper adjacent reference sample of the current block, and the upper left adjacent reference sample of the current block are all available, the template type of the current block is determined as the first value; if the left adjacent reference sample of the current block is available, the template type of the current block is determined as the second value; if the upper adjacent reference sample of the current block is available, the template type of the current block is determined as the third value; if the left adjacent reference sample of the current block and the upper left adjacent reference sample of the current block are both available, the template type of the current block is determined as the fourth value; if the left adjacent reference sample of the current block and the lower left adjacent reference sample of the current block are both available, the template type of the current block is determined as the fifth value; and if the upper adjacent reference sample of the current block and the upper right adjacent reference sample of the current block are both available, the template type of the current block is determined as the sixth value.

[0310] In the embodiments of this application, the first, second, third, fourth, fifth, and sixth values ​​may be any numerical values ​​and are not specifically limited in this application. For example, the first, second, third, fourth, fifth, and sixth values ​​may be 1, 2, 3, 4, 5, and 6, respectively.

[0311] Exemplary, in the embodiments of the present application, the template type can be represented by refTemplateType, and correspondingly, as shown in Figure 3, the grid-filled blocks are the current blocks, and the adjacent regions of the current blocks are templates T, where six types of templates are shown.

[0312] Exemplary, these six template types are as follows: When the upper left reference sample, upper reference sample, and left reference sample are all available, the value of refTemplateType is 1 and the template shape is as shown in Figure 3(a); when only the left reference sample is available, the value of refTemplateType is 2 and the template shape is as shown in Figure 3(b); when only the upper reference sample is available, the value of refTemplateType is 3 and the template shape is as shown in Figure 3(c); when only the left reference sample and upper left reference sample are available, the value of refTemplateType is 4 and the template shape is as shown in Figure 3(d); when only the left reference sample and lower left reference sample are available, the value of refTemplateType is 5 and the template shape is as shown in Figure 3(e); and when only the upper reference sample and upper right reference sample are available, the value of refTemplateType is 6 and the template shape is as shown in Figure 3(f).

[0313] In some embodiments, the IntraTMP template type can be selected based on the instructions in the bitstream, in addition to the availability information of the reference samples described above. For example, the template type can be determined on the decoding side by assigning a number to each template type and transmitting the number information of the template type actually used in the bitstream.

[0314] In other words, in the embodiments of the present application, it is possible to choose to determine the template type based on the availability information of the reference sample in the current block, or based on the information shown in the bitstream, or to determine the template type by combining the availability information of the reference sample and the information shown in the bitstream. The present application is not specifically limited.

[0315] Furthermore, in the embodiments of the present application, when determining the first template corresponding to the current block based on the template type, first, a template reference sample for the current block can be determined based on the template type and the template size corresponding to the template type, and then, the first template for the current block can be determined based on the template reference sample.

[0316] In the embodiments of this application, the first template of the current block may include a template reference sample of the current block. Here, the template reference sample of the current block can be determined by the template type of the current block and the template size corresponding to the template type.

[0317] In the embodiments of this application, the first template of the current block may consist of a reconstruction sample of one or more regions from the upper, upper right, left, lower left, and upper left sides of the current block, that is, it may consist of the reference sample of the current block described above.

[0318] In the embodiments of this invention, the template size corresponding to the template type may be predetermined, indicated by a bitstream syntax element, or 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.

[0319] Accordingly, in the embodiments of the present invention, by combining the value of the current block's template type refTemplateType and the template size corresponding to refTemplateType, it is possible to determine which part of the reconstruction sample to obtain as the template reference sample of the current block, and furthermore, to determine the corresponding first template.

[0320] Exemplary, in the embodiments of the present application, if the value of refTemplateType is 1, it is possible to choose to obtain the reconstruction samples from the left, upper left, and top of the current block; if the value of refTemplateType is 2, only the reconstruction samples from the left four columns of the current block are obtained; and if the value of refTemplateType is 3, only the reconstruction samples from the top four rows of the current encoded block are obtained.

[0321] Of course, the pre-set template size value is not limited to 4, but may be any integer greater than 0, and this application does not specifically limit it.

[0322] To make it clear, in the embodiments of the present application, the template reference sample of the current block, determined from the reference sample of the current block, is a combination of the template type of the current block and the corresponding template size, and may be a first template corresponding to the current block.

[0323] In the embodiments of this invention, the block vector search process may include parts such as an initialization process, determination of a search area (a predetermined search area) for the first template in the current frame, a search within the search area, and determination of one or more optimal block vectors. Therefore, when executing the search process, it is necessary to complete the initialization operation first.

[0324] For example, as shown in Figure 5 above, nTbW and nTbH represent the current block size, templateW_size and templateH_size represent the template size, and uiPatchWidth and uiPatchHeight represent the block size including the current block and its template.

[0325] Correspondingly, during initialization, uiPatchWidth can be initialized as nTbW + templateW_size and uiPatchHeight as nTbH + templateH_size. Here, templateW_size and templateH_size may be fixed constants, may be indicated by bitstream syntax elements, or may be dynamically adjusted based on the encoded block size or other information, and templateW_size and templateH_size may or may not be equal. For example, templateW_size=4 and templateH_size=4, or if the width of the encoded block is greater than 8, templateW_size=4 is set, and if the width of the encoded block is 8 or less, templateW_size=2 is set, and if the height of the encoded block is greater than 8, templateH_size=4 is set, and if the height of the encoded block is 8 or less, templateH_size=2 is set.

[0326] Furthermore, the cost threshold between templates is initialized as diffThreshold. For example, if the cost function is SAD, the threshold is diffThreshold=((1<<bitDepth)> >2) × (uiPatchHeight × uiPatchWidth - nTbH × nTbW) is possible. Here, if the bit depth of the image is 10, then diffThreshold represents a distortion threshold of 256 for each sample point in the template region.

[0327] Furthermore, the positions of the coding tree block CTB, where block CB is currently located, are initialized as ctbRsX and ctbRsY.

[0328] Furthermore, the positional offset of the current block CB in the current CTB is initialized as offsetLCBY=yTbCmp-ctbRsY and offsetLCBX=xTbCmp-ctbRsX.

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

[0330] Furthermore, iBvShift is initialized, where iBvShift is the precision of the block vector BV. For example, the precision of BV can be sample-level precision, in which case iBvShift is 0. Alternatively, the precision of BV can be subsample precision; for example, iBvShift = 1 represents 1 / 2 sample precision, and iBvShift = 2 represents 1 / 4 sample precision, and this is not specifically limited here.

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

[0332] In the embodiments of this invention, the predetermined search area may be a reconstructed portion within the current image and is limited by the size of the search range. As shown in Figure 6 above, the background area filled with a dark color is the reconstructed area, the background block filled with black is the current block, and the dashed line frame is the search range window. Therefore, the predetermined search area of ​​the IntraTMP technology does not exceed the overlapping portion between the reconstructed area shown by the dark background and the area shown by the dashed line frame.

[0333] Thus, the predetermined search region of the current block template may be the reconstructed portion of the CTB where the current block is located, or it may be another reconstructed CTB region. In practice, the predetermined search region is the set of all search points. Since the shape of the region cannot often be represented by a single rectangular region, in concrete implementations, searches can be performed in multiple rectangular regions, and the search results from different regions can be combined to obtain the final optimal matching block and optimal block vector.

[0334] For illustrative purposes, referring to Figure 7 above, Figure 7 shows eight different sub-region division methods. Here, the black-filled background block is the current block, and the five division methods (a), (b), (c), (d), and (f) all divide a given search region into four sub-search regions, while the three division methods (e), (g), and (h) all divide a given search region into three sub-search regions, where different fill patterns represent one sub-search region.

[0335] In Figure 7, (a), (b), (c), and (d) consider all available search ranges, while (e), (f), (g), and (h) do not search the region directly above and directly to the left.

[0336] For illustrative purposes, let's assume that different sub-search regions are distinguished and represented by regionId. Considering that the template sample for the current block must be obtained from the image reconstruction region, and the reconstruction block sample corresponding to the template must also be obtained from the reconstruction region, it is necessary to further determine the searchable locations in the sub-search regions represented by different regionIds based on the current block's position (xTbCmp, yTbCmp), the current block's size (nTbW, nTbH), the current image's size (picWidth, picHeight), the size of the CTB where the current block is located (CtbSizeW, CtbSizeH), the predetermined search range of the template (search RangeWidth, searchRangeHeight), and the current block's position offset in the current CTB (offsetLCBY, offsetLCBX), thereby determining the block vector BV. Specifically, iVerMin and iVerMax represent the minimum and maximum absolute coordinate positions that can be searched in the vertical direction, respectively, while iHorMin and iHorMax represent the minimum and maximum absolute coordinate positions that can be searched in the horizontal direction. The values ​​of iVerMin, iVerMax, iHorMin, and iHorMax differ for each search region represented by a different regionId.

[0337] In some embodiments, taking Figure 7(f) as an example, the implementation method for dividing a predetermined search area into four sub-search areas is as follows:

[0338] If regionId is equal to 0, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:

[0339] iHorMax0=min((xTbCmp+searchRangeWidth)< <iBvShift,((picWidth-nTbW)<<iBvShift)) iHorMin0=max((iTemplateSizeW)< <iBvShift,(xTbCmp-searchRangeWidth)<<iBvShift) iVerMax0=(yTbCmp-nTbH-offsetLCBY)< <iBvShift iVerMin0=max(((iTemplateSizeH)< <iBvShift),((yTbCmp-searchRangeHeight)<<iBvShift)) If regionId is equal to 1, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:

[0340] iHorMin1=max((iTemplateSizeW)< <iBvShift,(xTbCmp-searchRangeWidth)<<iBvShift) iHorMax1=(xTbCmp-offsetLCBX-nTbW)< <iBvShift iVerMin1=(yTbCmp+1)< <iBvShift iVerMax1=min((picHeight-nTbH)< <iBvShift,(yTbCmp-offsetLCBY+CtbSizeH-nTbH)<<iBvShift) If regionId is equal to 2, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:

[0341] iHorMax2=(xTbCmp-offsetLCBX-nTbW)< <iBvShift iHorMin2=max((iTemplateSizeW)< <iBvShift,(xTbCmp-searchRangeWidth)<<iBvShift) iVerMin2=max((iTemplateSizeH)< <iBvShift,(yTbCmp-nTbH-offsetLCBY)<<iBvShift) iVerMax2=(yTbCmp)< <iBvShift If regionId is equal to 3, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:

[0342] iHorMin3=max((iTemplateSizeW)< <iBvShift,(xTbCmp-offsetLCBX-nTbW+1)<<iBvShift) iHorMax3=(xTbCmp-nTbW)< <iBvShift iVerMin3=max(((iTemplateSizeH)< <iBvShift),(yTbCmp-offsetLCBY-nTbH+1)<<iBvShift) iVerMax3=(yTbCmp-nTbH)< <iBvShift To make it easier to understand, in actual applications, here is iHorMin regionId iHor Max regionId iVerMin regionId iVerMax regionId These represent the left, right, top, and bottom edges of different sub-search regions, respectively.

[0343] Refer to Figure 8 for an intuitive explanation of the different sub-search regions corresponding to different regionIds. Figure 8 is a schematic diagram illustrating the process of determining a given search region. As shown in Figure 8, R1, R2, R3, and R4 represent four different sub-search regions. Note that in Figure 8, the upper left corner sample of the block is represented by the alignable sample range.

[0344] To make it clear, in some embodiments, a given search region can be divided into two types: one is a region where it is determined that all sampling points within the region have been reconstructed (called a fully reconstructed search region), and the other is a region where it is not determined whether or not all sampling points within the region have been reconstructed (called an undetermined reconstructed search region). This application is not specifically limited.

[0345] In step 202, a search is performed in a predetermined search area based on the first parameter corresponding to the current block to determine the block vector of the current block, and the first parameter is used to control the search process.

[0346] In the embodiments of this invention, after determining a predetermined search area based on a first template, the block vector of the current block can be determined by further performing a search in the predetermined search area based on a first parameter corresponding to the current block. Here, the first parameter is for controlling the search process.

[0347] In the embodiments of this application, the first parameter may be for controlling the search process, and for example, based on the first parameter, it may be chosen to continue the search process or to terminate the search process early.

[0348] Exemplary, in the embodiments of the present invention, the first parameter may be a matching cost threshold corresponding to a matching cost value. Accordingly, when controlling the search process based on the first parameter, if the matching cost value and the first parameter (matching cost threshold) satisfy the search termination condition, the search process can be terminated early; otherwise, the search process can be continued.

[0349] To make it easier to understand, in the embodiments of the present application, if the first parameter is a matching cost threshold corresponding to a matching cost value, the first parameter can be understood as a single cost upper threshold. Therefore, the corresponding search termination condition may be the magnitude relationship between the matching cost value and the first parameter.

[0350] For example, in the embodiment of the present invention, if the matching cost value is less than or equal to the first parameter, the search termination condition can be considered to be met, and the search process can be terminated early. If the matching cost value is greater than the first parameter, the search termination condition can be considered not to be met, and the search process can be continued.

[0351] Thus, in the embodiments of the present invention, when performing a search based on the first parameter, if a search point is obtained through the search that has a matching cost value less than or equal to the first parameter, the search can be terminated, thereby enabling control of the search process.

[0352] In other words, in the embodiment of the present invention, calculating the matching cost for all search points within a predetermined search area would significantly increase complexity. Therefore, in order to ensure coding efficiency while maintaining complexity, a template matching cost threshold corresponding to the current block, i.e., the first parameter SAD, is used. thre This allows you to control the exploration process and choose to terminate the exploration early.

[0353] Furthermore, in the embodiments of the present application, the first parameter is used to limit the matching cost between different templates based on predetermined matching criteria.

[0354] In the embodiments of this application, the predetermined matching criteria include one of the following: absolute sum of errors (SAD), transformed absolute sum of errors (SATD), sum of squared errors (SSE), mean absolute difference (MAD), mean absolute error (MAE), mean squared error (MSE), and normalized correlation coefficient (NCC).

[0355] For example, in some embodiments, if a predetermined matching criterion is SSE, MSE, or SATD, the first parameter for exiting the search early is also set to SSEthre, MSEthre, or SATDthre accordingly.

[0356] In other words, in this application, the first parameter corresponds to a predetermined matching criterion.

[0357] Furthermore, in the embodiments of the present application, the predetermined matching criteria may include a first matching criterion and a second matching criterion. Here, the first matching criterion includes one of the following: absolute sum of errors (SAD), transformed absolute sum of errors (SATD), sum of squared errors (SSE), mean absolute difference (MAD), mean absolute error (MAE), mean squared error (MSE), and normalized correlation coefficient (NCC). The second matching criterion includes one of the following: the vector length of the block vector, the sum of the component lengths of the block vector, and the block vector cost parameter.

[0358] To make it understandable, in the embodiments of the present application, the first matching criterion can be understood to include a cost function related to the sample difference, while the second matching criterion can be understood to include a cost function related to the size of the block vector (BV).

[0359] In the embodiments of this application, by using a combination of the first matching criterion and the second matching criterion, it is necessary to refer to both a cost function related to the sample difference and a cost function related to the size of the block vector (BV) in the process of determining the block vector of the current block. That is, a cost function related to both the sample difference and the BV size can be adopted.

[0360] To make it easier to understand, in the embodiments of the present application, the block vector cost parameter included in the second matching criterion can be understood as a cost parameter related to the block vector.

[0361] Exemplary examples, in some embodiments, the block vector cost parameter may take the form of either the vector length of the block vector BV multiplied by a coefficient λ, or the sum of the component lengths of the block vector BV multiplied by a coefficient λ.

[0362] In the embodiments of this application, the matching cost value determined for any search point in the search process for the block vector of the current block, corresponding to a predetermined matching criterion including a first matching criterion and a second matching criterion, may also include two parts: a cost value related to the sample difference corresponding to the first matching criterion, and a cost value related to the BV size corresponding to the second matching criterion.

[0363] For example, in some embodiments, the cost value related to the sample difference corresponding to the first matching criterion is cost Dpel This represents the cost value related to the BV size corresponding to the second matching criterion, and is expressed as cost. BV Assuming that it is represented as such, the corresponding matching cost value cost determined for one search point within a given search region is cost = cost BV +cost Dpel It can be expressed as follows.

[0364] Here, cost BV This is a quantity related to the BV size, for example, the vector length of the BV, or the sum of the component lengths of the BV, or the vector length of the BV multiplied by a coefficient λ, or the sum of the component lengths of the BV multiplied by a coefficient λ, or the BV size and cost using a table. BV A definition of the relationship with, or a definition of a different domain, where different costs BV Examples include those having a BV of a certain value (for example, a BV of zero), defining a rhombus or square multilayer region centered on a BV of a certain value, and having one fixed cost in each region. BV Take the value.

[0365] For example, in some embodiments, the cost value related to the sample difference corresponding to the first matching criterion is cost Dpel This represents the cost value related to the BV size corresponding to the second matching criterion, and is expressed as cost. BV Assuming that it is represented as such, the corresponding matching cost value cost determined for one search point within a given search region is cost = cost Dpel×costFactor BV It can be expressed as follows.

[0366] Here, costFactor BV This is a quantity related to the BV size, for example, the vector length of the BV multiplied by a coefficient λ, or the sum of the component lengths of the BV multiplied by a coefficient λ, or the BV size and costFactor using a table. BV A definition of the relationship with, or a definition of a different domain, where different domains have different costFactors BV Examples include those having a certain value of BV (for example, zero value of BV), and defining a rhombus or square multilayer region centered on a certain value of BV, with one fixed costFactor in each region. BV Take the value.

[0367] Furthermore, in the embodiment of the present application, taking the case where the predetermined matching criterion is SAD as an example, first, the first parameter SAD corresponding to the current block thre It is possible to determine this.

[0368] In the embodiment of this invention, the first parameter can be determined based on the bit depth information corresponding to the current image and the sample parameters corresponding to the first template.

[0369] To make it clear, in the embodiments of this application, one first parameter SAD thre If the search process is to be exited early by adopting this method, the first parameter SAD is based on the bit depth information of the current image. thre This can be determined, where the first parameter, which is determined based on the bit depth information of the current image, may be a predetermined fixed threshold.

[0370] For example, in several embodiments, the first parameter SAD thre =((1<<bitDepth)> >3) × Num Temp It can be defined as follows, where bitDepth is the bit depth of the image, i.e., the bit depth information corresponding to the current image, and Num TempThis is the sample number of the reference template, i.e., the sample parameter of the first template corresponding to the current block.

[0371] In the embodiments of this invention, if the prediction mode of the adjacent reconstructed block corresponding to the current block is a prediction mode based on intra-template matching, the first parameter can be determined based on the adjacent reconstructed block.

[0372] To make it clear, in the embodiments of the present invention, when the prediction mode of the adjacent reconstructed block corresponding to the current block is a prediction mode based on intra-template matching, when determining the first parameter based on the adjacent reconstructed block, first a first threshold can be determined based on the matching cost value corresponding to the block vector of the adjacent reconstructed block and the sample parameter of the reference template corresponding to the adjacent reconstructed block; simultaneously, a second threshold can be determined based on the sample parameter corresponding to the first template and the maximum mean sample value difference between the current block and the adjacent reconstructed block; and finally, the first parameter can be determined based on the first threshold and the second threshold.

[0373] In the embodiments of this invention, when determining the first parameter based on the first threshold and the second threshold, if the first threshold is less than or equal to the second threshold, the first threshold is determined as the first parameter; if the first threshold is greater than the second threshold, the second threshold is determined as the first parameter.

[0374] To make it clear, in the embodiments of this application, one first parameter SAD thre If you adopt this approach to exit the search process early, the first parameter SAD is calculated based on the optimal template matching cost of the adjacent IntraTMP encoded blocks of the current block. thre It is also possible to determine this. Here, the first parameter, which is determined based on the matching cost value of the current block corresponding to the adjacent reconstructed block whose prediction mode is an intra-template matching prediction mode, may be a single adaptive threshold.

[0375] Exemplary, in some embodiments, we assume that the upper neighboring block of the current block selects IntraTMP as its encoding mode, i.e., the prediction mode of the upper neighboring reconstructed block of the current block is a prediction mode based on intra-template matching. The block vector (optimal block vector) of that neighboring reconstructed block is BV neighbor The corresponding matching cost value (optimal matching cost) is Diff neighbor The sample parameter for the reference template corresponding to the adjacent reconfiguration block (the number of samples of the adjacent block reference template) is Num TempNei Therefore, the sample parameter of the first template corresponding to the current block (the number of samples in the reference template) is Num Temp In this case, the matching cost value Diff corresponds to the block vector of the adjacent reconstructed block. neighbor Sample parameter Num of the reference template corresponding to the adjacent reconfiguration block TempNei The first threshold, determined based on the above, is Diff neighbor / Num TempNei ×Num Temp It can be expressed as follows.

[0376] Exemplary, in some embodiments, the maximum average sample SAD difference per sample between the current block and the adjacent reconstructed block is set as offsetDiff. regionId This can be expressed as follows, and the maximum mean sample value difference per sample can be represented by a. Here, a may be a predetermined fixed factor and can be transmitted via high-level syntax. Correspondingly, the sample parameter Num corresponds to the first template. Temp , and the second threshold, determined based on the maximum mean sample value difference a between the current block and the adjacent reconstructed block, is a × Num Temp It can be expressed as follows.

[0377] For example, in some embodiments, when determining the first parameter based on a first threshold and a second threshold, the smaller of the first and second thresholds can be selected as the first parameter, i.e., the first parameter SAD thre =ken(Diff neighbor / Num TempNei ×Num Temp ,a×Num Temp ) is defined as follows.

[0378] In other words, in the embodiment of the present invention, the upper adjacent block of the current encoding target unit selects IntraTMP as its encoding mode, and the optimal block vector of the adjacent block is BV neighbor The corresponding optimal matching cost is Diff neighbor And Num TempNei Assuming that is the number of samples of adjacent block reference templates, SAD thre The value is a × Num Temp It must not be greater than . Here, a is the maximum mean sample value difference per sample. At this time, the template matching threshold for the current encoding unit is set to SAD thre =ken(Diff neighbor / Num TempNei ×Num Temp ,a×Num Temp Set it to ).

[0379] Furthermore, in embodiments of the present invention, when determining the first parameter, if the prediction mode of at least one adjacent reconstruction block corresponding to the current block is a prediction mode based on intra-template matching, a first threshold is determined based on at least one matching cost value corresponding to at least one adjacent reconstruction block, at least one sample parameter corresponding to at least one adjacent reconstruction block, and a sample parameter corresponding to the first template; a second threshold is determined based on the sample parameter corresponding to the first template and the maximum mean sample value difference between the current block and the adjacent reconstruction block; and the first parameter is determined based on the first threshold and the second threshold.

[0380] To make it clear, in the embodiments of the present invention, if the prediction mode of at least one adjacent reconstruction block corresponding to the current block is a prediction mode based on intra-template matching, then when determining the first threshold, it is necessary to refer to at least one matching cost value corresponding to at least one adjacent reconstruction block, and also to refer to at least one sample parameter corresponding to at least one adjacent reconstruction block.

[0381] For example, in some embodiments, if at least two of the multiple adjacent positions in the current block are encoded using IntraTMP mode, that is, if there are two or more adjacent reconstruction blocks in the current block that use IntraTMP mode, then the matching cost value SAD of the adjacent position (adjacent reconstruction block) can be denoted as SADIdx (Idx = 0, 1, ..., N, where N is 1 or greater). In this case,

number

[0382] Furthermore, in the embodiments of the present invention, a predetermined search region includes at least one search region (i.e., at least one sub-search region), and correspondingly, different first parameters can be set for different search regions.

[0383] In other words, in this application, it is possible to determine at least one first parameter corresponding to at least one search domain. Here, the first parameters corresponding to different search domains may be the same or different.

[0384] Furthermore, in embodiments of the present invention, when determining at least one first parameter corresponding to at least one search region, if there is an adjacent reconstruction block corresponding to the current block in the current search region within at least one search region, and the prediction mode of the adjacent reconstruction block is a prediction mode based on intra-template matching, the first parameter corresponding to the current search region is determined based on the adjacent reconstruction block.

[0385] Exemplary, in some embodiments, different thresholds SADThre are used for different search regions. RegionId Set (RegionId=0,1,2,3,…) and SADThre regionId This is the DiffNei of the corresponding region of the block encoded using adjacent reconstruction blocks in IntraTMP mode. regionId This is derived by the number of samples of the reference template for adjacent reconfiguration blocks. TempNei The current number of reference templates in the block is Num Temp It is expressed as a(offsetDiff), and the maximum average sample SAD difference per sample between the current block and the adjacent reconstructed block is a(offsetDiff). regionId ) is written as . In this case, the first parameter is SAD thre =min(DiffNei regionId / Num TempNei ×Num Temp ,a×Num Temp ) can be defined as follows.

[0386] To make it clear, in embodiments of the present invention, if there are no adjacent reconstruction blocks corresponding to the current block in at least one search region, or if the prediction mode of adjacent reconstruction blocks in that search region is not a prediction mode based on intra-template matching, a first parameter corresponding to that search region can be determined according to a predetermined first parameter. For example, the first parameter corresponding to that search region is determined based on bit depth information corresponding to the current image and sample parameters corresponding to the first template.

[0387] Furthermore, in the embodiments of the present invention, when performing a search in a predetermined search area based on a first parameter corresponding to the current block and determining the block vector of the current block, the search points within the predetermined search area are sequentially scanned according to a predetermined scan order, a first matching cost value is determined between the matching template corresponding to the search point in the predetermined search area and the first template based on a predetermined matching criterion, and if the first matching cost value and the first parameter satisfy the search stop condition, the search for the predetermined search area is terminated, and the block vector corresponding to the first matching cost value is determined as the block vector of the current block.

[0388] To make it easier to understand, in the embodiments of the present application, if the first parameter is a matching cost threshold corresponding to a matching cost value, the first parameter can be understood as a single cost upper threshold. Therefore, the corresponding search termination condition may be the magnitude relationship between the matching cost value and the first parameter.

[0389] Exemplary, in the embodiments of the present application, satisfying the search termination condition may include the first matching cost value being less than or equal to the first parameter, and not satisfying the search termination condition may include the first matching cost value being greater than the first parameter.

[0390] In response to this, in the embodiments of the present invention, if the first matching cost value is greater than the first parameter, the scanning of the next search point within a predetermined search area can be continued according to a predetermined scan order.

[0391] In the embodiments of this application, for a single block vector, it is possible to choose to represent the minimum and maximum horizontal offsets of the block vector using bvXMins and bvXMaxs, respectively, or to represent the minimum and maximum vertical offsets of the block vector using bvYMins and bvYMaxs, respectively.

[0392] bvXMinsregionId, bvXMaxsregionId, bvYMinsregionId, and bvYMaxsregionId are obtained by using the already determined iVerMinregionId, iVerMaxregionId, iHorMinregionId, and iHorMaxregionId as follows.

[0393] bvXMinsregionId=iHorMinregionId-xTbCmp bvXMaxsregionId=iHorMaxregionId-xTbCmp bvYMinsregionId=iVerMinregionId-yTbCmp bvYMaxsregionId=iVerMaxregionId-yTbCmp bvXMinsregionId, bvXMaxsregionId, bvYMinsregionId, and bvYMaxsregionId determine the range of horizontal and vertical offsets of the search point relative to the current block, i.e., the range of the block vector BV.

[0394] Furthermore, in the embodiments of this application, each search point (iPosHor, iPoxVer) within the search region, i.e., each block vector BV (composed of a horizontal component and a vertical component (pX, pY), where pX = iPosHor - xTbCmp and pY = iPosVer - yTbCmp, in which case pX lies between bvXMins and bvXMaxs, and pY lies between bvYMins and bvYMaxs, and a matching reconstruction block of one current block can be found in the reconstruction region, and the adjacent reconstruction samples of the matching reconstruction block are the matching templates.

[0395] To make it easier to understand, in the embodiments of this application, when scanning search points (iPosHor, iPoxVer) within the current search range (a predetermined search area) according to a predetermined scan order, for each search point, one matching reconstruction block of the current block can be found in the reconstruction area, and the adjacent reconstruction samples of the matching reconstruction block are the matching templates.

[0396] Furthermore, in the embodiments of this application, the matching cost between the adjacent template of the current block and the adjacent template of the reconstructed block is denoted as pDiff. The pDiff of the current search point is pDiff <= SAD. thre If the condition is met, that is, if the first matching cost value between the matching template corresponding to the search point and the first template is less than or equal to the first parameter, the matching template obtained through the search can be considered a reconstruction template that satisfies the condition, and the search can be stopped. The corresponding first matching cost pDiff is denoted as pDiff_BEST, the corresponding block vector BV is denoted as optimal block vector BV_BEST(pX_BEST,pY_BEST), and the corresponding matching template is denoted as optimal matching template T_BEST.

[0397] In the embodiments of this application, the search strategies that can be employed when performing the search process include, but are not limited to, search methods based on different search step lengths, such as a rough search based on a first search step length and / or a fine search based on a second search step length. Here, the first search step length is greater than the second search step length.

[0398] Furthermore, in the embodiments of the present application, it is possible to scan search points within a predetermined search area according to a predetermined scan order and a first search step length, and to determine the block vector and candidate template. Alternatively, it is also possible to scan search points within a predetermined search area according to a predetermined scan order and a second search step length, and to determine the block vector and candidate template.

[0399] Furthermore, in the embodiments of the present invention, first, search points within a predetermined search area are scanned according to a predetermined scan order and a first search step length to determine an initial block vector and an initial matching template corresponding to the initial block vector. Next, a first search area can be determined based on the initial matching template, where the first search area is smaller than the predetermined search area. Finally, search points within the first search area are scanned according to a predetermined scan order and a second search step length to determine a block vector and a candidate template, where the first search step length is greater than the second search step length.

[0400] In other words, in the embodiments of the present invention, when searching for the optimal matching template in the search domain, a search strategy may be adopted in which a rough search is performed followed by a fine search, or only a fine search may be performed, or only a rough search may be performed.

[0401] Exemplary, in embodiments of the present application, the rough search may specifically include obtaining a final candidate template by determining the optimal rough matching template in the search domain with a first predetermined step length (i.e., a first search step length, e.g., 2 or 3), or obtaining a final candidate template by determining the optimal rough matching template in the search domain using a downsampled template (e.g., with a downsampling coefficient of 2 or 3).

[0402] Exemplary, in embodiments of the present application, the fine search may specifically include obtaining a final candidate template by determining the optimal fine matching template in the search region with a second predetermined step length (i.e., a second search step length, e.g., 1 or 1 / 2), or obtaining a final candidate template by determining the optimal fine matching template in the vicinity of the optimal rough matching template after performing a rough search.

[0403] Furthermore, in the embodiments of the present invention, search points within a predetermined search area are sequentially scanned according to a predetermined scan order and a first search step length, a first matching cost value is determined between the matching template corresponding to the search point within the predetermined search area and the first template based on a predetermined matching criterion, and if the first matching cost value and the first parameter satisfy the search stop condition, the search for the predetermined search area is terminated, and the block vector corresponding to the first matching cost value is determined as the block vector of the current block.

[0404] To make it clear, in the embodiments of the present application, satisfying the search termination condition may include the first matching cost value being less than or equal to the first parameter, and not satisfying the search termination condition may include the first matching cost value being greater than the first parameter.

[0405] Exemplary, in embodiments of the present invention, if the search strategy is to perform only a rough search, in each region, it is possible to choose to perform a rough search with a step length greater than 1 (for example, a step length of 2 or 3) within a search range where pX is between bvXMinsregionId and bvXMaxsregionId and pY is between bvYMinsregionId and bvYMaxsregionId. The pDiff of the current search point is pDiff <= SAD thre If the condition is met, that is, if the first matching cost value between the matching template corresponding to the search point and the first template is less than or equal to the first parameter, the matching template obtained through the search can be considered a reconstruction template that satisfies the condition, and the search can be stopped. The matching cost pDiff obtained by template matching is denoted as pDiff_BEST, and the corresponding block vector BV is denoted as the optimal block vector BV_BEST, with each term being a single coordinate pair (pX_BEST, pY_BEST).

[0406] Furthermore, in the embodiments of the present invention, search points within a predetermined search area are sequentially scanned according to a predetermined scan order and second search step length, a first matching cost value is determined between the matching template corresponding to the search point within the predetermined search area and the first template based on a predetermined matching criterion, and if the first matching cost value and the first parameter satisfy the search stop condition, the search for the predetermined search area is terminated, and the block vector corresponding to the first matching cost value is determined as the block vector of the current block.

[0407] Exemplary, in the embodiments of the present application, satisfying the search termination condition may include the first matching cost value being less than or equal to the first parameter, and not satisfying the search termination condition may include the first matching cost value being greater than the first parameter.

[0408] Exemplary, in embodiments of the present invention, if the search strategy is to perform only fine search, in each region, it is possible to choose to perform fine search with a small step length (for example, a step length of 1 or 1 / 2, and if the step length is less than 1, subsample interpolation is required) within the search range where pX is between bvXMinsregionId and bvXMaxsregionId and pY is between bvYMinsregionId and bvYMaxsregionId. The current pDiff of the search point is pDiff <= SAD thre If the condition is met, that is, if the first matching cost value between the matching template corresponding to the search point and the first template is less than or equal to the first parameter, the matching template obtained through the search can be considered a reconstruction template that satisfies the condition, and the search can be stopped. The matching cost pDiff obtained by template matching is denoted as pDiff_BEST, and the corresponding block vector BV is denoted as the optimal block vector BV_BEST, with each term being a single coordinate pair (pX_BEST, pY_BEST).

[0409] Furthermore, in the embodiments of the present application, a search is performed in a predetermined search area according to a predetermined scan order and a first search step length, a second matching cost value is determined between a matching template corresponding to a search point in the predetermined search area and a first template based on a predetermined matching criterion, and if the second matching cost value and a first parameter satisfy the search termination condition, the search for the predetermined search area is terminated, the block vector corresponding to the second matching cost value is determined as the reference block vector of the current block, the first search area is determined based on the matching reconstruction block corresponding to the reference block vector, the first search area is smaller than the predetermined search area, a search is performed in the first search area according to a predetermined scan order and a second search step length, a third matching cost value is determined between a matching template corresponding to a search point in the first search area and a first template based on a predetermined matching criterion, the first search step length is greater than the second search step length, and if the third matching cost value and a first parameter satisfy the search termination condition, the search for the first search area is terminated, and the block vector corresponding to the third matching cost value is determined as the block vector of the current block.

[0410] To make it easier to understand, in the embodiments of the present application, if the first parameter is a matching cost threshold corresponding to a matching cost value, then the first parameter can be understood as a single cost upper threshold. Therefore, the corresponding search termination condition may be the magnitude relationship between the matching cost value and the first parameter.

[0411] Exemplary examples, in the embodiments of the present application, satisfying the search termination condition may include the second matching cost value being less than or equal to the first parameter, and not satisfying the search termination condition may include the second matching cost value being greater than the first parameter.

[0412] Exemplary, in the embodiments of the present application, satisfying the search termination condition may include the third matching cost value being less than or equal to the first parameter, and not satisfying the search termination condition may include the third matching cost value being greater than the first parameter.

[0413] In other words, in the embodiments of the present application, satisfying the search termination condition includes the first matching cost value being less than or equal to the first parameter, and / or the second matching cost value being less than or equal to the first parameter, and / or the third matching cost value being less than or equal to the first parameter.

[0414] For example, in the embodiment of the present invention, if the search strategy is to perform a rough search followed by a fine search, first a rough search is performed with a step length of 2 (i.e., the first search step length is 2), and the optimal rough matching template (initial matching template) is obtained by template matching. Then, the optimal fine matching template is determined in the neighborhood of the optimal rough matching template with a step length of 1 (i.e., the second search step length is 1), thereby obtaining the final candidate template.

[0415] Here, in the coarse search phase, in each region, it is possible to choose to perform a coarse search with a step length greater than 1 within the search range where pX is between bvXMinsregionId and bvXMaxsregionId, and pY is between bvYMinsregionId and bvYMaxsregionId. For example, a coarse search is performed with a step length of 2, and during the scanning process of the coarse search, the current search point pDiff is pDiff <= SAD. thre If the condition is met, that is, if the second matching cost value between the matching template corresponding to the search point and the first template is less than or equal to the first parameter, then it can be determined that the matching template obtained through the search is a reconstruction template that satisfies the condition. In this case, the search is stopped, and the optimal matching cost obtained by template matching is pDiff1_BEST=pDiff refineThis is expressed as follows, and the corresponding block vector BV is expressed as the optimal block vector BV1_BEST(pX1_BEST,pY1_BEST), i.e., the reference block vector. The corresponding matching template is the initial matching template, and in this case, the search region where the optimal matching search point is located is bestRegionId.

[0416] Subsequently, in the refinement phase, it is possible to choose to perform a search in the neighborhood of the optimal block vector BV1_BEST (reference block vector) obtained in the rough search, that is, to perform a search in the first search region. Therefore, it is first necessary to determine the refinement range TmpRefineRange, that is, to determine the first search region TmpRefineRange. Here, the refinement range (first search region TmpRefineRange) may be a fixed size or may be associated with the current block size, for example, it can be set to min(nTbW,nTbH) / 2. Next, the position of the optimal matching reconstruction block obtained in the rough search is calculated as the reference position of the refinement region, that is, BestPosX=xTbCmp+pX1_BEST and BestPosY=yTbCmp+pY1_BEST.

[0417] In one embodiment, based on the value of bestRegionId, the calculated values ​​of iVerMinbestRegionId, iVerMaxbestRegionId, iHorMinbestRegionId, and iHorMaxbestRegionId are first obtained. Then, based on the optimal matching block position obtained through rough searching, new search ranges iVerMinrefine, iVerMaxrefine, iHorMinrefine, and iHorMaxrefine can be obtained. The method of obtaining these values ​​is as follows.

[0418] iHorMinrefine=max(iHorMinbestRegionId,BestPosX-TmpRefineRange) iHorMaxrefine=min(iHorMaxbestRegionId,BestPosX+TmpRefineRange) iVerMinrefine=max(iVerMinbestRegionId,BestPosY-TmpRefineRange) iVerMaxrefine=min(iVerMaxbestRegionId,BestPosY+TmpRefineRange) Next, the adjusted block vectors BVbvXMins, bvXMaxs, bvYMins, and bvYMaxs are obtained by calculating them using iVerMinrefine, iVerMaxrefine, iHorMinrefine, and iHorMaxrefine.

[0419] bvXMins=iHorMinrefine-xTbCmp bvXMaxs=iHorMaxrefine-xTbCmp bvYMins=iVerMinrefine-yTbCmp bvYMaxs=iVerMaxrefine-yTbCmp The fine search is performed within a block vector range where pX lies between bvXMinsrefine and bvXMaxsrefine, and pY lies between bvYMinsrefine and bvYMaxsrefine. For example, a search is performed with a step length of 1, and the current search point pDiff is reached during the fine search scan. refine pDiff <= SAD thre If the following condition is met, i.e., if the third matching cost value between the matching template corresponding to the search point and the first template is less than or equal to the first parameter, then it can be determined that the matching template obtained through the search is a reconstruction template that satisfies the condition. In this case, the optimal matching cost obtained by template matching is pDiff_BEST=pDiff refineThis is expressed as follows, and the corresponding block vector BV is expressed as the optimal block vector BV_BEST(pX_BEST,pY_BEST), i.e., the block vector of the current block that is ultimately determined, and the corresponding matching template is the candidate template of the current block.

[0420] After the above operations are completed, the optimal block vector BV_BEST(pX_BEST,pY_BEST) is obtained, where pX_BEST and pY_BEST are the horizontal and vertical offset amounts of the optimal matching template relative to the currently encoded block template, and are also the horizontal and vertical offset amounts of the optimal matching reconstruction block relative to the currently encoded block.

[0421] In the embodiments of this application, by combining the results of a rough search and a fine search process (where the fine search process includes one or more reference point searches), one or more optimal block vectors BV_BEST corresponding to different algorithmic requirements can be obtained, and BV_BEST is a single coordinate pair (pX_BEST, pY_BEST).

[0422] Thus, in the embodiments of the present invention, the process of performing a search in the search domain and determining one or more block vectors may include three types of search strategies: performing only a rough search, performing only a fine search, or performing a rough search followed by a fine search.

[0423] Furthermore, in the embodiments of the present invention, when performing a search in a predetermined search area based on a first parameter corresponding to the current block for at least one search area included in a predetermined search area, and determining the block vector of the current block, first, a first search order corresponding to at least one search area is determined based on the positional relationship between the current block and at least one search area. Next, at least one search area is sequentially scanned based on the first search order, a search is performed in at least one search area based on the first parameter, and the block vector of the current block can be determined.

[0424] In the embodiments of this application, the first search order may be from the closest to the current block to the furthest. This is because, when searching multiple sub-search regions, following a search order from closest to furthest allows for a quicker determination of the block vector of the current block.

[0425] Exemplaryly, in some embodiments, different search regions can be defined in different ways. Figure 13 is a first schematic diagram showing at least one search region, where, as shown in Figure 13, regions close to the current block are defined as R1, R2, and R3, and regions furthest away are defined as R4, R5, R6, and so on, and the search can be performed in the order of first R1, R2, R3, then R4, R5, R6.

[0426] In other words, in the embodiment of the present invention, the search order corresponding to different search regions can be determined based on the positional relationship between the search region and the current block.

[0427] In the embodiments of this application, the order of R1 and R2 is interchangeable, and the order of R4 and R5 is interchangeable.

[0428] Furthermore, in the embodiments of the present invention, a search is performed in the predetermined search area based on a first parameter corresponding to the current block for at least one search area included in a predetermined search area, and when determining the block vector of the current block, at least one search area is merged based on the positional relationship between the current block and at least one search area to obtain at least one merged search area. Next, a second search order corresponding to at least one merged search area is determined based on the positional relationship between the current block and at least one merged search area. Based on the second search order, at least one merged search area is sequentially scanned, a search is performed within at least one merged search area based on the first parameter, and the block vector of the current block can be determined.

[0429] In the embodiments of this application, the second search order may be from the closest to the current block to the furthest. This is because, when searching multiple sub-search regions, following a search order from closest to furthest allows for a quicker determination of the block vector of the current block.

[0430] Exemplary examples, in some embodiments, as shown in Figure 13, R1 and R3 may be merged into one region, or R2 and R3 may be merged into one region, or R5 and R6 may be merged into one region, or R4 and R6 may be merged into one region.

[0431] Exemplary, in some embodiments, different search domains can be defined in different ways. Figure 14 is a second schematic diagram showing at least one search domain, and as shown in Figure 14, in a search situation in which an undetermined reconstructed search domain is included in a given search domain, the search can be performed in the order of R1, R2, R3, R7, R8, and then R4, R5, R6. Here, the order of R1 and R2 is interchangeable, the order of R7 and R8 is interchangeable, and the order of R4 and R5 is interchangeable.

[0432] Furthermore, in the embodiments of the present application, a predetermined scan sequence includes one of the following: a raster scan sequence, a vertical inverse raster scan sequence, a horizontal inverse raster scan sequence, a full inverse raster scan sequence, a diagonal scan sequence, a horizontal scan sequence, a vertical scan sequence, or a zigzag scan sequence.

[0433] In other words, in the embodiments of the present invention, when scanning for search points within a predetermined search area, a raster scan order from top to bottom and left to right may be adopted, a vertical inverse raster scan order from bottom to top and left to right may be adopted, a horizontal inverse raster scan order from top to bottom and right to left may be adopted, a complete inverse raster scan order from bottom to top and right to left may be adopted, or an order such as diagonal scan, horizontal scan, vertical scan, or zigzag scan may be adopted.

[0434] Furthermore, in the embodiments of the present invention, when sequentially searching at least one search region based on a first search order for at least one search region included in a predetermined search region, the search points within the current search region are sequentially scanned according to a predetermined scan order corresponding to the current search region, and the block vector of the current block is determined.

[0435] In other words, for each search area, it is possible to use the same scan method and scan order, different scan methods or the same scan method, or different scan orders.

[0436] In the embodiments of this invention, a vertical inverse raster scan sequence is determined as a predetermined scan sequence corresponding to the first region located above the current block within at least one search area; a horizontal inverse raster scan sequence is determined as a predetermined scan sequence corresponding to the second region located to the left of the current block within at least one search area; and a complete inverse raster scan sequence is determined as a predetermined scan sequence corresponding to the third region located to the upper left of the current block within at least one search area.

[0437] Exemplary examples, in some embodiments, as shown in Figure 14, R1 and R5 can perform searches according to the vertical inverse raster scan order, R2 and R4 can perform searches according to the horizontal inverse raster scan order, and R3 and R6 can perform searches according to the complete inverse raster scan order.

[0438] In the embodiments of this application, a vertical inverse raster scan order is determined as a predetermined scan order corresponding to the fourth region located above and / or to the upper right of the current block within at least one search area; a horizontal inverse raster scan order is determined as a predetermined scan order corresponding to the fifth region located to the left and / or lower left of the current block within at least one search area; and a complete inverse raster scan order is determined as a predetermined scan order corresponding to the third region located to the upper left of the current block within at least one search area.

[0439] Exemplary examples, in some embodiments, as shown in Figure 14, R1, R5, and R7 can perform searches according to the vertical inverse raster scan order, R2, R4, and R8 can perform searches according to the horizontal inverse raster scan order, and R3 and R6 can perform searches according to the complete inverse raster scan order.

[0440] Furthermore, in the embodiments of the present invention, after determining the first parameter corresponding to the current block, the first parameter can be written to the bitstream and transmitted to the decoding side. Here, the first parameter can be transmitted by any of the following: SPS layer syntax information, PPS layer syntax information, APS layer syntax information, SH layer syntax information, or CU layer syntax information.

[0441] In other words, in the embodiments of the present invention, the threshold condition for early termination (first parameter) can be identified by the SPS, PPS, APS, or SH layer to control the complexity on the decoding side.

[0442] Furthermore, in the embodiments of the present application, when performing a search within a predetermined search area based on a first parameter corresponding to the current block and determining the block vector of the current block, it is also possible to further scan search points within the predetermined search area according to a predetermined search method, determine a first matching cost value between a matching template corresponding to a search point within the predetermined search area and the first template based on a predetermined matching criterion, and if the first matching cost value and the first parameter satisfy the search termination condition, terminate the search for the predetermined search area and determine the block vector corresponding to the first matching cost value as the block vector of the current block.

[0443] In the embodiments of this application, the predetermined search method includes one of the following: a cross-shaped search method, a square-shaped search method, a diamond-shaped search method, or a hash search method.

[0444] In other words, in the embodiments of this application, it is possible to choose to perform a search in a predetermined scan order within each region. For example, a raster order such as top to bottom, left to right, or bottom to top, right to left can be used. Alternatively, a high-speed iterative search can be performed within a predetermined search region according to a predetermined search method, where the predetermined search method includes, but is not limited to, a cross search, a square search, or a diamond search. Alternatively, a hash search method similar to IBC can be employed. This application is not specifically limited.

[0445] Furthermore, in the embodiments of the present application, when performing a search process according to a predetermined search method, the employable search strategies include, but are not limited to, search methods based on different search step lengths, such as a rough search based on a third search step length and / or a fine search based on a fourth search step length. Here, the third search step length is greater than the fourth search step length.

[0446] Exemplary, in some embodiments, it is possible to scan for search points within a predetermined search area according to a predetermined search method and a third search step length, and to determine a first matching cost value between a matching template corresponding to a search point within the predetermined search area and a first template based on a predetermined matching criterion; or, it is possible to scan for search points within a predetermined search area according to a predetermined search method and a fourth search step length, and to determine a first matching cost value between a matching template corresponding to a search point within the predetermined search area and a first template based on a predetermined matching criterion, where the third search step length is greater than the fourth search step length.

[0447] Exemplary, in some embodiments, it is possible to first perform a search in a predetermined search area according to a predetermined search method and a third search step length, and then, based on a predetermined matching criterion, determine a second matching cost value between the matching template corresponding to the search point in the predetermined search area and the first template. If the second matching cost value and the first parameter satisfy the search termination condition, the search in the predetermined search area is terminated, the block vector corresponding to the second matching cost value is determined as the reference block vector of the current block, and the first search area is determined based on the matching reconstruction block corresponding to the reference block vector. The first search area is smaller than the predetermined search area, and a search is performed in the first search area according to a predetermined search method and a fourth search step length. Finally, based on a predetermined matching criterion, a third matching cost value is determined between the matching template corresponding to the search point in the first search area and the first template. If the third search step length is greater than the fourth search step length, and the third matching cost value and the first parameter satisfy the search termination condition, the search in the first search area is terminated, and the block vector corresponding to the third matching cost value is determined as the block vector of the current block.

[0448] In other words, in the embodiments of the present invention, when searching for the optimal matching template in the search domain according to a predetermined search method, a search strategy may be adopted in which a rough search is performed followed by a fine search, or only a fine search may be performed, or only a rough search may be performed.

[0449] Furthermore, in the embodiments of the present invention, when performing a high-speed iterative search according to a predetermined search method, in addition to controlling the search process using a first parameter, the search process can also be controlled using a second parameter.

[0450] In the embodiments of this application, the second parameter is used to limit the difference in matching costs between different templates based on predetermined matching criteria.

[0451] In other words, in the embodiment of the present invention, after determining a predetermined search area based on a first template, it is possible to select to perform a search within the predetermined search area based on a first parameter and / or a second parameter corresponding to the current block, thereby determining the block vector of the current block.

[0452] Furthermore, in the embodiment of the present invention, when performing a search within a predetermined search area based on a second parameter corresponding to the current block, first, an iterative search is performed on the search points within the predetermined search area according to a predetermined search method, and the iterative cost difference between the matching template corresponding to the search points within the predetermined search area and the first template is determined based on a predetermined matching criterion. If the iterative cost difference and the second parameter satisfy the search termination condition, the iterative search for the predetermined search area is terminated, and the block vector corresponding to the iterative cost difference is determined as the block vector of the current block. Here, the second parameter is for limiting the matching cost difference between different templates based on a predetermined matching criterion.

[0453] In the embodiments of this application, the second parameter may be used to control the search process. For example, based on the second parameter, it may be chosen to continue the high-speed iterative search process or to terminate the iterative search process early.

[0454] For example, in the embodiments of the present invention, the second parameter may be an iteration cost difference threshold corresponding to the iteration cost difference. Accordingly, when controlling the search process based on the second parameter, if the iteration cost difference and the second parameter (iteration cost difference) satisfy the search termination condition, it is possible to choose to terminate the high-speed iterative search process early; otherwise, the iterative search process can be continued.

[0455] To make it easier to understand, in the embodiments of the present invention, if the second parameter is an iterative cost difference corresponding to an iterative cost difference, the second parameter can be understood as a single upper limit threshold for the difference. Therefore, the corresponding search termination condition may be the magnitude relationship between the iterative cost difference and the second parameter.

[0456] For example, in the embodiment of the present invention, if the iterative cost difference is less than or equal to the second parameter, the search termination condition can be considered to be met, and the high-speed iterative search process can be terminated early. If the matching cost value is greater than the second parameter, the search termination condition can be considered not to be met, and the high-speed iterative search process can be continued.

[0457] Thus, in the embodiments of the present invention, when performing a search based on the second parameter, if the search obtains a search point where the difference in iteration cost before and after the iteration is less than or equal to the second parameter, the high-speed iterative search can be terminated, thereby enabling control of the search process.

[0458] In other words, in the embodiment of the present invention, in addition to a threshold for the magnitude of the cost itself (i.e., the first parameter), the cost difference before and after iteration can be set as a termination threshold (i.e., the second parameter), and if the cost difference before and after iteration (iteration cost difference) is smaller than a certain threshold (the second parameter), the iteration is stopped.

[0459] In the embodiments of this invention, the search process may be controlled by using both the first and second parameters simultaneously, or by selecting either the first or second parameter to control the search process. That is, the iterative cost difference threshold (second parameter) and the threshold for the magnitude of the cost itself (first parameter) may be used independently or in combination.

[0460] Furthermore, in the embodiment of the present application, first, an iterative search is performed in a first sub-region within a predetermined search area according to a predetermined search method, and the iterative cost difference between the matching template corresponding to the search point in the first sub-region and the first template is determined based on a predetermined matching criterion. If the iterative cost difference and the second parameter satisfy the search termination condition, the iterative search for the first sub-region is terminated. Then, based on a predetermined matching criterion, the current matching cost value between the matching template corresponding to the search point in the first sub-region and the first template is determined. If the current matching cost value and the first parameter satisfy the search termination condition, the search for the predetermined search area is terminated, and the block vector corresponding to the first matching cost value is determined as the block vector of the current block.

[0461] Furthermore, in the embodiments of the present invention, first, an iterative search is performed in a first sub-region within a predetermined search area according to a predetermined search method, and the iterative cost difference between the matching template corresponding to the search point in the first sub-region and the first template is determined based on a predetermined matching criterion. If the iterative cost difference and the second parameter satisfy the search termination condition, the iterative search for the first sub-region is terminated. Then, based on a predetermined matching criterion, the current matching cost value between the matching template corresponding to the search point in the first sub-region and the first template is determined. If the current matching cost value and the first parameter do not satisfy the search termination condition, the iterative search can be continued in other sub-regions within the predetermined search area, other than the first sub-region, according to the predetermined search method.

[0462] For example, in some embodiments, it is possible to choose to perform a high-speed iterative search within each sub-region of a given search domain. If the iterative cost difference (iterative cost difference) is smaller than a certain threshold (second parameter), the iterative search process in that sub-region is stopped. If the current cost (current matching cost value) is smaller than a termination threshold (second parameter), the entire search process in the given search domain is stopped, i.e., the search process in the given search domain is terminated early. Otherwise, it is possible to choose to continue the iterative search process in other sub-regions.

[0463] Furthermore, in the embodiments of the present invention, after determining the first parameter corresponding to the current block, the first parameter can be written to the bitstream and transmitted to the decoding side. Here, the second parameter can be transmitted by any of the SPS layer syntax information, PPS layer syntax information, APS layer syntax information, SH layer syntax information, or CU layer syntax information.

[0464] In other words, in the embodiments of the present invention, the threshold condition for early termination (second parameter) can be identified by the SPS, PPS, APS, or SH layer to control the complexity on the decoding side.

[0465] In step 203, the predicted value of the current block is determined based on the block vector of the current block.

[0466] In the embodiment of the present invention, a search is performed in a predetermined search area based on a first parameter corresponding to the current block, the block vector of the current block is determined, and then, based on the block vector of the current block, a predicted value of the current block can be determined.

[0467] Furthermore, in the embodiments of the present application, when determining the predicted value of the current block based on the block vector of the current block, first, the reference block of the current block can be determined based on the block vector of the current block, and then the predicted value of the current block can be determined based on the reference block of the current block.

[0468] Exemplary, in the embodiments of this application, the determination of the reference block of the current block can be achieved using a simple translation copy. The specific operation is as follows: x=0…nTbW-1, y=0…nTbH-1 are to be processed, and the reconstruction sample recSamples of the current frame (i.e., the reference block of the current block) is determined by RefBlockn [x][y]=recSamples[x+pXn][y+pYn].

[0469] In the embodiment of this application, when determining the reference block of the current block based on the block vector of the current block, first, the initial reconfigured block of the current block is determined based on the block vector of the current block, and then a modification process is performed on the initial reconfigured block to determine the reference block of the current block.

[0470] In other words, in the embodiments of this application, other methods can be used when obtaining candidate reconstruction blocks (reference blocks). For example, first, modifications are made to the initial reconstruction block corresponding to the obtained candidate template, and then the corresponding reference block is determined.

[0471] In the embodiments of this invention, the predicted value determined by the block vector of the current block may be the final predicted value, or it may be further processed to obtain the final predicted value of the current block.

[0472] Furthermore, in the embodiments of the present application, when determining the predicted value of the current block based on the block vector of the current block, first, at least one reference block corresponding to the current block can be determined based on the block vector of the current block, and then the predicted value of the current block can be determined based on at least one more reference block.

[0473] In the embodiments of this application, when determining the predicted value of the current block based on at least one reference block, first, at least one predicted block is determined based on at least one reference block, weighted fusion is performed on at least one predicted block, and then the predicted value of the current block is determined.

[0474] For example, in some embodiments, after determining the block vector of the current block, multiple points are obtained from around the block vector, i.e., multiple reference blocks are obtained, and then a weighted fusion is performed on the predicted values ​​corresponding to the multiple points to obtain a predicted value for the current block.

[0475] Furthermore, in the embodiments of the present application, when determining the predicted value of the current block based on the block vector of the current block, first a first predicted value of the current block can be determined based on the block vector of the current block, and then a second predicted value of the current block can be determined based on a predetermined prediction mode, the predetermined prediction mode including a Planar mode and / or a directional mode, and finally the predicted value of the current block can be determined based on the first predicted value and the second predicted value.

[0476] For example, in some embodiments, after determining the block vector of the current block, the final predicted value can be obtained by weighting and combining the predicted value obtained using the block vector with the predicted value obtained in other intra modes. Here, other intra modes may be other prediction modes other than IntraTMP, such as Planar mode or direction mode, where the direction mode may be obtained by deriving from TIMD or by positioning in an intra candidate table using an Index transmitted in a bitstream. This method may be called IntraTMP CIIP mode.

[0477] To make it easier to understand, in IntraTMP mode, in addition to obtaining predicted values ​​using the basic copy method, it is also possible to obtain predicted values ​​by performing filtering fusion at locations corresponding to multiple BVs, and to perform fused prediction with the normal Intra mode.

[0478] Furthermore, in the embodiments of the present application, after determining the predicted value of the current block based on the block vector of the current block, the reconstructed value of the current block can be determined based on the predicted value of the current block.

[0479] In the embodiment of this application, first, the predicted difference (residual) corresponding to the current block can be determined, and then, based on the predicted difference and the predicted value, the reconstruction value of the current block can be determined.

[0480] As described above, the encoding method proposed in steps 201 to 203 above can effectively utilize current image information (e.g., depth information) or Diff information of adjacent positions of the current target block to be encoded (e.g., matching cost value corresponding to adjacent reconstructed blocks) to derive a first parameter for template matching. If, during the search process, it is determined that the matching cost value corresponding to the search point satisfies the first parameter, the search process for the current encoded block can be terminated early, thereby reducing the search complexity of IntraTMP to some extent.

[0481] In the embodiments of this invention, the first parameter determined by the current image information (e.g., depth information) may be a predefined fixed threshold, while the first parameter determined based on adjacent reference blocks using IntraTMP mode may be an adaptive threshold. Here, different first parameters can be set for different sub-search regions within a predetermined search region to control the search process.

[0482] For example, in some embodiments, a search strategy for early termination based on the reference template SAD matching cost can be proposed for IntraTMP technology. According to this search strategy, the search process can be controlled using a matching cost threshold (first parameter) for one reference template, and the search can be terminated early if the first parameter is met, thereby ensuring the effectiveness of the algorithm while maintaining complexity.

[0483] For example, in some embodiments, a template matching cost threshold (first parameter) can be derived using current image information or Diff information of adjacent positions of the current target block to be encoded. If the cost value of the current search point does not exceed the threshold, the BV of the search point is expressed as the optimal block vector BV_BEST, and the search process is terminated early.

[0484] Here, the input for obtaining Intra TMP-BV is the position (xTbCmp, yTbCmp) of the current encoded block (current block), the width nTbW of the current encoded block, and the height nTbH of the current encoded block. The output for obtaining Intra TMP-BV is the BV of the current block and the corresponding predicted value of the predicted block, predSamples[x][y], where x=0...nTbW-1 and y=0...nTbH-1. The predicted value of the predicted block may also be used as the final predicted value, and further processing can be performed to obtain the final predicted value of the current block.

[0485] To make it easier to understand, the specific process for obtaining Intra TMP-BV proposed in the embodiment of this application is divided into three steps: determining the current template type, obtaining a current template reconstruction sample, and determining the block vector within a given search range. Here, a set of predicted values ​​for the current block can be obtained for each BV obtained.

[0486] The embodiments of the present application provide an encoding method. When the prediction mode of the current block is an intra-template matching prediction mode, the encoder determines a first template corresponding to the current block, determines a predetermined search area based on the first template, performs a search in the predetermined search area based on a first parameter corresponding to the current block, determines the block vector of the current block, the first parameter is for controlling the search process, and determines the predicted value of the current block based on the block vector of the current block. Thus, in the embodiments of the present application, the search process can be controlled using a predetermined first parameter such as a matching cost threshold based on the IntraTMP mode, and it is possible to select whether to terminate the search process early or continue the search process based on the first parameter. In other words, the encoding and decoding method proposed in the embodiments of the present application can solve the problem of high computational complexity that arises from scanning all search points in the search area by introducing a first parameter for controlling the search process, and can improve the efficiency and performance of encoding and decoding.

[0487] In yet another embodiment of the present application, referring to Figure 16, Figure 16 is a schematic diagram showing the configuration of the encoder provided in an embodiment of the present application. As shown in Figure 16, the encoder 20 may include a first determination unit 211, where, The first decision unit 211 is configured to perform the following actions when the prediction mode of the current block is a prediction mode based on intra-template matching: determine a first template corresponding to the current block, determine a predetermined search area based on the first template, perform a search in the predetermined search area based on a first parameter corresponding to the current block, and determine the block vector of the current block, wherein the first parameter is for controlling the search process; and determine the predicted value of the current block based on the block vector of the current block.

[0488] To ensure understanding, in the embodiments of this application, a "unit" may be a part of a circuit, a part of a processor, a part of a program, or software, and may, of course, be a module or non-modular. Furthermore, each component in these embodiments may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The integrated unit may be implemented in hardware form or in the form of a software function module.

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

[0490] Accordingly, embodiments of the present application provide a computer-readable storage medium applicable to an encoder 20, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a first processor, the method described in any of the above embodiments is realized.

[0491] Referring to Figure 17, based on the configuration of the encoder 20 and the computer-readable storage medium, Figure 17 is a schematic diagram showing the specific hardware configuration of the encoder 20 provided in the embodiment of the present application. As shown in Figure 17, the encoder 20 may comprise a first memory 221, a first processor 222, a first communication interface 223, and a first bus system 224. The first memory 221, the first processor 222, and the first communication interface 223 are coupled via the first bus system 224. To understand this, the first bus system 224 is used to provide connection communication between these components. In addition to the data bus, the first bus system 224 includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity in this explanation, all the various buses are referred to as the first bus system 224. Here, The first communication interface 223 is configured to send and receive signals in the process of sending and receiving information with other external network elements. The first memory 221 is configured to store a computer program that can be executed on the first processor. The first processor 222 is configured to, when executing the computer program, determine a first template corresponding to the current block and determine a predetermined search area based on the first template if the prediction mode of the current block is a prediction mode based on intra-template matching, perform a search in the predetermined search area based on a first parameter corresponding to the current block and determine the block vector of the current block, wherein the first parameter is for controlling the search process, and determine the predicted value of the current block based on the block vector of the current block.

[0492] To ensure clarity, the first memory 221 in the embodiments of this application may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Here, the non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory may be random access memory (RAM) used as an external cache. To the extent of illustrative but non-limiting examples, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous-connected dynamic random access memory (SLDRAM), and direct memory bus random access memory (DRRAM). The first memory 221 in the systems and methods described herein includes, but is not limited to, these and any other suitable types of memory.

[0493] The first processor 222 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method may be completed by instructions in the form of hardware integrated logic circuits or software in the first processor 222. The first processor 1903 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, etc. Each method, step and logic block diagram disclosed in the embodiments of this application can be implemented or executed. The general-purpose processor may be a microprocessor, or the processor may be any conventional processor, etc. The steps of the method disclosed in the embodiments of this application may be performed directly by a hardware decoding processor, or by a combination of hardware and software modules within the decoding processor. The software modules may be located in conventional storage media such as random-access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers, etc. The storage medium is placed in the first memory 221, and the first processor 222 reads the information in the first memory 221 and combines it with its hardware to complete the steps of the above method.

[0494] To ensure understanding, these embodiments described herein may be implemented by hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementations, the processing unit may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described herein, or a combination thereof. For software implementations, the technical solutions described herein can be implemented by executing the functional modules (processes, functions, etc.) described herein. The software code may be stored in memory and executed by the processor. The memory may be implemented in the processor or outside the processor. Optionally, in another embodiment, the first processor 222 is further configured to perform the method described in any of the above embodiments when executing the computer program.

[0495] In yet another embodiment of the present application, referring to Figure 18, Figure 18 is a schematic diagram showing the configuration of the decoder provided in an embodiment of the present application. As shown in Figure 18, the decoder 30 may include a second determination unit 311, where, The second decision unit 311 is configured to perform the following actions when the prediction mode of the current block is a prediction mode based on intra-template matching: determine a first template corresponding to the current block, determine a predetermined search area based on the first template, perform a search in the predetermined search area based on a first parameter corresponding to the current block, and determine the block vector of the current block, wherein the first parameter is for controlling the search process; and determine the predicted value of the current block based on the block vector of the current block.

[0496] To make it clear, in this embodiment, a "unit" may be part of a circuit, part of a processor, part of a program, or software, and may be a module or non-modular. Furthermore, each component in this embodiment may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The integrated unit may be implemented in hardware form or in the form of a software function module.

[0497] If the integrated unit is implemented in the form of a software function module and is not sold or used as an independent product, it can be stored in a single computer-readable storage medium. Based on this understanding, this embodiment provides a computer-readable storage medium to which a computer program is stored, and when the computer program is executed by a second processor, the method described in any of the above embodiments is realized.

[0498] Referring to Figure 19, based on the configuration of the decoder 30 and the computer-readable storage medium, Figure 19 is a schematic diagram showing the specific hardware configuration of the decoder 30 provided in the embodiment of the present application. As shown in Figure 19, the decoder 30 may comprise a second memory 321, a second processor 322, a second communication interface 323, and a second bus system 324. The second memory 321, the second processor 322, and the second communication interface 323 are coupled via the second bus system 324. To make it clear, the second bus system 324 is used to provide connection communication between these components. In addition to the data bus, the second bus system 324 includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity in this explanation, all the various buses are referred to as the second bus system 324. Here, The second communication interface 323 is configured to send and receive signals in the process of sending and receiving information with other external network elements. The second memory 321 is configured to store a computer program that can be executed by the second processor, The second processor 322 is configured to, when executing the computer program, determine a first template corresponding to the current block and determine a predetermined search area based on the first template if the prediction mode of the current block is a prediction mode based on intra-template matching, perform a search in the predetermined search area based on a first parameter corresponding to the current block and determine the block vector of the current block, wherein the first parameter is for controlling the search process, and determine the predicted value of the current block based on the block vector of the current block.

[0499] Optionally, in another embodiment, the second processor 322 is further configured to perform the method described in any of the above embodiments when executing the computer program.

[0500] To make it easier to understand, the second memory 321 has the same hardware functionality as the first memory 221, and the second processor 322 has the same hardware functionality as the first processor 222, which will not be explained again here.

[0501] This embodiment provides a codec in which, when the prediction mode of the current block is an intra-template matching prediction mode, the codec determines a first template corresponding to the current block, determines a predetermined search area based on the first template, performs a search in the predetermined search area based on a first parameter corresponding to the current block, determines the block vector of the current block, the first parameter is for controlling the search process, and determines the predicted value of the current block based on the block vector of the current block. In this way, in the embodiment of the present application, the search process can be controlled using a predetermined first parameter such as a matching cost threshold based on the IntraTMP mode, and it is possible to select whether to terminate the search process early or continue the search process based on the first parameter. In other words, the encoding / decoding method proposed in the embodiment of the present application can solve the problem of high computational complexity that arises from scanning all search points in the search area by introducing a first parameter for controlling the search process, and can improve the efficiency and performance of encoding / decoding.

[0502] In yet another embodiment of the present application, referring to Figure 20, which is a schematic diagram showing the configuration of a codec system provided in an embodiment of the present application. As shown in Figure 20, the codec system 230 may include an encoder 2301 and a decoder 2302.

[0503] In the embodiments of the present application, the encoder 2301 may be the encoder described in any of the above embodiments, and the decoder 2302 may be the decoder described in any of the above embodiments.

[0504] Furthermore, embodiments of the present application further provide a bitstream, which is generated by bit encoding based on information to be encoded, the information to be encoded includes at least one of the following: the predicted difference of the current block, a first parameter, a second parameter, the size of the template, and template type indication information.

[0505] It should be explained that in this application, the terms “compose,” “include,” or any other variation thereof are intended to encompass non-exclusive inclusion, thereby including not only those elements but also other elements not expressly enumerated, or elements specific to such process, method, article, or device. Unless otherwise specified, an element defined by the expression “includes…” does not preclude the presence of another identical element in a process, method, article, or device that includes that element.

[0506] The above-mentioned examples of the present invention are for illustrative purposes only and do not indicate any ranking of the examples.

[0507] The methods disclosed in some embodiments of the methods provided herein can be arbitrarily combined without contradiction to obtain new embodiments of the methods.

[0508] The features disclosed in the embodiments of some of the products provided in this application can be arbitrarily combined without contradiction to obtain embodiments of new products.

[0509] The features disclosed in some embodiments of the methods or apparatus provided herein can be arbitrarily combined without contradiction to obtain new embodiments of the methods or apparatus.

[0510] The above description is merely an embodiment of the present application, and the scope of protection of this application is not limited thereto. All modifications or substitutions that a person skilled in the art could easily conceive of within the technical scope disclosed herein should be included within the scope of protection of this application. Accordingly, the scope of protection of this application shall be subject to the scope of protection of the claims. [Industrial applicability]

[0511] Embodiments of the present application provide an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium. When the prediction mode of the current block is an intra-template matching prediction mode, the codec determines a first template corresponding to the current block, determines a predetermined search area based on the first template, performs a search in the predetermined search area based on a first parameter corresponding to the current block, determines the block vector of the current block, the first parameter is for controlling the search process, and determines the predicted value of the current block based on the block vector of the current block. Thus, in embodiments of the present application, the search process can be controlled using a predetermined first parameter such as a matching cost threshold based on the IntraTMP mode, and it is possible to select whether to terminate the search process early or continue the search process based on the first parameter. In other words, the encoding / decoding method proposed in embodiments of the present application can solve the problem of high computational complexity resulting from scanning all search points in the search area by introducing a first parameter for controlling the search process, and can improve the efficiency and performance of encoding / decoding.

Claims

1. A decoding method applicable to a decoder, Currently, a first template corresponding to the block is determined, and a predetermined search area is determined based on the said first template, The process involves performing a search in a predetermined search area based on a first parameter corresponding to the current block, and determining the block vector of the current block, wherein the first parameter is for controlling the search process. A decoding method comprising determining a predicted value of the current block based on the block vector of the current block.

2. The aforementioned decryption method is The process further includes determining the first parameter based on the bit depth information corresponding to the current image and the sample parameter corresponding to the first template. The decoding method according to claim 1.

3. The aforementioned decryption method is Further comprising determining the first parameter based on adjacent reconfiguration blocks, The decoding method according to claim 1.

4. Determining the first parameter based on the adjacent reconfiguration block means that A first threshold is determined based on the matching cost value corresponding to the block vector of the adjacent reconstruction block and the sample parameters of the reference template corresponding to the adjacent reconstruction block. A second threshold is determined based on the sample parameters corresponding to the first template and the maximum mean sample value difference between the current block and the adjacent reconstructed block. This includes determining the first parameter based on the first threshold and the second threshold, The decoding method according to claim 3.

5. Determining the first parameter based on the first threshold and the second threshold means If the first threshold is less than or equal to the second threshold, the first threshold is determined to be the first parameter. If the first threshold is greater than the second threshold, the second threshold is determined to be the first parameter, including The decoding method according to claim 4.

6. The aforementioned decryption method is The first threshold is determined based on at least one matching cost value corresponding to at least one adjacent reconstruction block, at least one sample parameter corresponding to the at least one adjacent reconstruction block, and a sample parameter corresponding to the first template. A second threshold is determined based on the sample parameters corresponding to the first template and the maximum mean sample value difference between the current block and the adjacent reconstructed block. The further includes determining the first parameter based on the first threshold and the second threshold, The decoding method according to claim 5.

7. The predetermined search area includes at least one search area, and the decoding method is Further comprising determining at least one first parameter corresponding to the at least one search region, The decoding method according to claim 3.

8. Performing a search in the predetermined search area based on the first parameter corresponding to the current block and determining the block vector of the current block is: The process involves sequentially scanning the search points within the predetermined search area according to a predetermined scan order, and determining a first matching cost value between the matching template corresponding to the search point within the predetermined search area and the first template based on the predetermined matching criteria. The process includes: if the first matching cost value and the first parameter satisfy the search termination condition, terminating the search for the predetermined search area and determining the block vector corresponding to the first matching cost value as the block vector of the current block; The decoding method according to claim 1.

9. The aforementioned decryption method is The search points within the predetermined search area are sequentially scanned according to the predetermined scan order and first search step length, and the first matching cost value between the matching template corresponding to the search points within the predetermined search area and the first template is determined based on the predetermined matching criteria, or The process involves sequentially scanning the search points within a predetermined search area according to the predetermined scan order and second search step length, and determining the first matching cost value between the matching template corresponding to the search point within the predetermined search area and the first template based on the predetermined matching criteria, wherein the first search step length is greater than the second search step length. The decoding method according to claim 8.

10. The aforementioned decryption method is A search is performed in the predetermined search area according to the predetermined scan order and first search step length, and a second matching cost value is determined between the matching template corresponding to the search point in the predetermined search area and the first template based on the predetermined matching criteria. If the second matching cost value and the first parameter satisfy the search termination condition, the search for the predetermined search area is terminated, and the block vector corresponding to the second matching cost value is determined as the reference block vector of the current block. The first search region is determined based on the matching reconstruction block corresponding to the aforementioned reference block vector, wherein the first search region is smaller than the predetermined search region. A search is performed in the first search area according to the predetermined scan order and second search step length, and a third matching cost value is determined between the matching template corresponding to the search point in the first search area and the first template based on the predetermined matching criteria, wherein the first search step length is greater than the second search step length. If the third matching cost value and the first parameter satisfy the search termination condition, the search for the first search region is terminated, and the block vector corresponding to the third matching cost value is determined as the block vector of the current block, further comprising: The decoding method according to claim 8.

11. The predetermined search area includes at least one search area, and the search is performed in the predetermined search area based on a first parameter corresponding to the current block, and the block vector of the current block is determined. Based on the positional relationship between the current block and the at least one search region, a first search order corresponding to the at least one search region is determined. This includes sequentially scanning the at least one search region based on the first search order, performing a search in the at least one search region based on the first parameter, and determining the block vector of the current block. The decoding method according to claim 1.

12. The aforementioned decryption method is The process further includes decoding the bitstream to determine the first parameter, The first parameter is transmitted by one of the following: SPS layer syntax information, PPS layer syntax information, APS layer syntax information, SH layer syntax information, or CU layer syntax information. The decoding method according to claim 1.

13. Determining the predicted value of the current block based on the block vector of the current block is, The reference block of the current block is determined based on the block vector of the current block, This includes determining the predicted value of the current block based on the reference block of the current block, The decoding method according to claim 1.

14. Determining the reference block of the current block based on the block vector of the current block means that The initial reconstructed block of the current block is determined based on the block vector of the current block, This includes performing a modification process on the initial reconfiguration block and determining the reference block of the current block, The decoding method according to claim 13.

15. Determining the predicted value of the current block based on the block vector of the current block is, Determine at least one reference block corresponding to the current block based on the block vector of the current block, The process includes determining the predicted value of the current block based on the at least one reference block, Determining the predicted value of the current block based on the at least one reference block is: Determining at least one prediction block based on the aforementioned at least one reference block, This includes performing weighted fusion on at least one of the prediction blocks and determining the predicted value of the current block, The decoding method according to claim 1.

16. Determining the first template corresponding to the aforementioned current block is: This includes determining the template type corresponding to the current block and determining a first template corresponding to the current block based on the template type, Determining the template type corresponding to the aforementioned current block is: Based on the reference sample of the current block, determine the template type of the current block, or Based on the instruction information in the bitstream, determine the template type of the current block, or This includes determining the template type of the current block based on the size of the current block, The reference sample of the current block includes at least one of the following: the left adjacent reference sample of the current block, the upper adjacent reference sample of the current block, the upper left adjacent reference sample of the current block, the lower left adjacent reference sample of the current block, and the upper right adjacent reference sample of the current block. The decoding method according to claim 1.

17. An encoding method applied to an encoder, Currently, a first template corresponding to the block is determined, and a predetermined search area is determined based on the said first template, The process involves performing a search in a predetermined search area based on a first parameter corresponding to the current block, and determining the block vector of the current block, wherein the first parameter is for controlling the search process. An encoding method comprising determining a predicted value of the current block based on the block vector of the current block.

18. The aforementioned encoding method is The process further includes determining the first parameter based on the bit depth information corresponding to the current image and the sample parameter corresponding to the first template. The encoding method according to claim 17.

19. The aforementioned encoding method is Further comprising determining the first parameter based on adjacent reconfiguration blocks, The encoding method according to claim 17.

20. A computer-readable storage medium storing a computer program and a bitstream, wherein the computer program generates the bitstream by causing a processor to execute the encoding method described in any one of claims 17 to 19.