Encoding method, decoding method, code stream, encoder, decoder and storage medium

By determining and reducing the search area in the intra-template matching prediction technology, the problem of increasing encoding complexity in the prior art is solved, and the efficiency and performance of video encoding and decoding are improved.

WO2024212256A9PCT designated stage expired Publication Date: 2024-12-19GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/088540
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-04-14
Publication Date
2024-12-19

AI Technical Summary

Technical Problem

When the existing intra-template matching prediction technology improves prediction accuracy, it needs to obtain more effective reference information, resulting in an increase in encoding complexity and reducing encoding and decoding efficiency and performance.

Method used

By determining the first template of the current block, the fully reconstructed search area and the pending reconstructed search area are determined based on the template, and the area selection is performed to narrow the search range to fully obtain reference information and at the same time reduce the complexity of encoding and decoding.

Benefits of technology

Improves encoding and decoding efficiency and performance, and reduces the search range and coding complexity by leveraging available sampling points in the search area to be reconstructed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023088540_19122024_PF_FP_ABST
    Figure CN2023088540_19122024_PF_FP_ABST
Patent Text Reader

Abstract

The embodiments of the present application disclose an encoding method, a decoding method, a code stream, an encoder, a decoder and a storage medium. The encoding / decoding method comprises: an encoder / decoder determining a first template corresponding to the current block; according to the first template, determining a fully reconstructed search area and / or an undetermined reconstructed search area, wherein the fully reconstructed search area comprises reconstructed sampling points, and the undetermined reconstructed search area comprises reconstructed sampling points and / or unreconstructed sampling points; performing area selection on the basis of the fully reconstructed search area and / or the undetermined reconstructed search area, and determining a selected fully reconstructed search area and / or a selected undetermined reconstructed search area, wherein the selected fully reconstructed search area is smaller than or equal to the fully reconstructed search area, and the selected undetermined reconstructed search area is smaller than or equal to the undetermined reconstructed search area; and respectively searching in the selected fully reconstructed search area and / or the selected undetermined reconstructed search area to determine one or more block vectors of the current block.
Need to check novelty before this filing date? Find Prior Art

Description

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

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

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

[0003] However, in order to achieve higher prediction accuracy, it is often necessary to obtain more effective reference information, which will increase the complexity of encoding to a certain extent, thereby reducing encoding and decoding efficiency and performance.

[0004] Summary of the Invention

[0005] The embodiments of the present application provide a coding and decoding method, a bit stream, an encoder, a decoder, and a storage medium, which can improve coding and decoding efficiency and performance.

[0006] The technical solution of the embodiment of the present application can be implemented as follows:

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

[0008] Determine a first template corresponding to the current block;

[0009] Determining a full reconstruction search area and / or a pending reconstruction search area according to the first template; wherein the full reconstruction search area includes reconstructed sampling points, and the pending reconstruction search area includes reconstructed sampling points and / or unreconstructed sampling points;

[0010] performing region selection based on the full reconstruction search region and / or the pending reconstruction search region, and determining a selected full reconstruction search region and / or a selected pending reconstruction search region; wherein the selected full reconstruction search region is smaller than or equal to the full reconstruction search region, and the selected pending reconstruction search region is smaller than or equal to the pending reconstruction search region;

[0011] Search is performed in the selected full reconstruction search area and / or the selected pending reconstruction search area to determine one or more block vectors of the current block.

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

[0013] Determine a first template corresponding to the current block;

[0014] Determining a full reconstruction search area and / or a pending reconstruction search area according to the first template; wherein the full reconstruction search area includes reconstructed sampling points, and the pending reconstruction search area includes reconstructed sampling points and / or unreconstructed sampling points;

[0015] performing region selection based on the full reconstruction search region and / or the pending reconstruction search region, and determining a selected full reconstruction search region and / or a selected pending reconstruction search region; wherein the selected full reconstruction search region is smaller than or equal to the full reconstruction search region, and the selected pending reconstruction search region is smaller than or equal to the pending reconstruction search region;

[0016] Search is performed in the selected full reconstruction search area and / or the selected pending reconstruction search area to determine one or more block vectors of the current block.

[0017] In a third aspect, an embodiment of the present application provides a code stream, wherein the code stream is generated by bit encoding based on information to be encoded; wherein the information to be encoded includes at least one of the following:

[0018] The prediction difference of the current block, the preset number N, the narrowing parameter, the size of the template, and the template type indication information.

[0019] In a fourth aspect, an embodiment of the present application provides an encoder, comprising a first determining unit; wherein,

[0020] The first determination unit is configured to determine a first template corresponding to the current block; determine a full reconstruction search area and / or a pending reconstruction search area based on the first template; wherein the full reconstruction search area includes reconstructed sampling points, and the pending reconstruction search area includes reconstructed sampling points and / or unreconstructed sampling points; perform region selection based on the full reconstruction search area and / or the pending reconstruction search area to determine a selected full reconstruction search area and / or a selected pending reconstruction search area; wherein the selected full reconstruction search area is smaller than or equal to the full reconstruction search area, and the selected pending reconstruction search area is smaller than or equal to the pending reconstruction search area; and perform searches in the selected full reconstruction search area and / or the selected pending reconstruction search area to determine one or more block vectors of the current block.

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

[0022] The first memory is used to store a computer program that can be run on the first processor;

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

[0024] In a sixth aspect, an embodiment of the present application provides a decoder, comprising a second determining unit; wherein,

[0025] The second determination unit is configured to determine a first template corresponding to the current block; determine a full reconstruction search area and / or a pending reconstruction search area based on the first template; wherein the full reconstruction search area includes reconstructed sampling points, and the pending reconstruction search area includes reconstructed sampling points and / or unreconstructed sampling points; perform region selection based on the full reconstruction search area and / or the pending reconstruction search area to determine a selected full reconstruction search area and / or a selected pending reconstruction search area; wherein the selected full reconstruction search area is smaller than or equal to the full reconstruction search area, and the selected pending reconstruction search area is smaller than or equal to the pending reconstruction search area; and perform searches in the selected full reconstruction search area and / or the selected pending reconstruction search area to determine one or more block vectors of the current block.

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

[0027] The second memory is used to store a computer program that can be run on the second processor;

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

[0029] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed, the method as described in the first aspect or the method as described in the second aspect is implemented.

[0030] Embodiments of the present application provide a coding and decoding method, a bitstream, an encoder, a decoder, and a storage medium. The encoder and decoder determine a first template corresponding to a current block; determine a full reconstruction search area and / or a pending reconstruction search area based on the first template; wherein the full reconstruction search area includes reconstructed sampling points, and the pending reconstruction search area includes reconstructed sampling points and / or unreconstructed sampling points; perform area selection based on the full reconstruction search area and / or the pending reconstruction search area to determine a selected full reconstruction search area and / or a selected pending reconstruction search area; wherein the selected full reconstruction search area is smaller than or equal to the full reconstruction search area, and the selected pending reconstruction search area is smaller than or equal to the pending reconstruction search area; and perform searches in the selected full reconstruction search area and / or the selected pending reconstruction search area to determine one or more block vectors of the current block. Thus, in the embodiments of the present application, after determining the full reconstruction search area and / or the pending reconstruction search area including the reconstructed sampling points and / or the unreconstructed sampling points according to the first template, the full reconstruction search area and / or the pending reconstruction search area can be subjected to region selection processing to obtain a relatively small selected full reconstruction search area and / or selected pending reconstruction search area, and the search is then performed in the selected full reconstruction search area and / or selected pending reconstruction search area. In other words, the encoding and decoding method proposed in the embodiments of the present application can utilize the available sampling points in the pending reconstruction search area while limiting the search range to a certain extent. This can reduce the complexity of encoding and decoding while fully acquiring more effective reference information, thereby improving encoding and decoding efficiency and performance. BRIEF DESCRIPTION OF THE DRAWINGS

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

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

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

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

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

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

[0037] FIG7 is a schematic diagram showing the division of the search area into different sub-areas;

[0038] FIG8 is a schematic diagram of the search area determination process 1;

[0039] FIG9 is a schematic diagram of the search process;

[0040] FIG10A is a schematic block diagram of the encoder;

[0041] FIG10B is a schematic block diagram of the encoder;

[0042] FIG11 is a schematic diagram of the network architecture of the encoding and decoding system;

[0043] FIG12 is a schematic diagram of a flow chart of a decoding method proposed in an embodiment of the present application;

[0044] FIG13 is a second schematic diagram showing the division of the search area into different sub-areas;

[0045] FIG14 is a second schematic diagram of the process of determining the search area;

[0046] FIG15 is a schematic diagram of region selection 1;

[0047] Figure 16 is a second schematic diagram of region selection;

[0048] Figure 17 is a third schematic diagram of region selection;

[0049] FIG18 is a fourth schematic diagram of region selection;

[0050] Figure 19 is a fifth schematic diagram of region selection;

[0051] Figure 20 is a sixth schematic diagram of region selection;

[0052] Figure 21 is a schematic diagram of area selection seven;

[0053] FIG22 is a schematic diagram of area selection eight;

[0054] Figure 23 is a ninth schematic diagram of region selection;

[0055] FIG24 is a schematic diagram of region selection 10;

[0056] FIG25 is a schematic diagram 11 of region selection;

[0057] FIG26 is a schematic diagram 12 of region selection;

[0058] FIG27 is a schematic diagram of a flow chart of an encoding method proposed in an embodiment of the present application;

[0059] FIG28 is a schematic diagram of the composition structure of the encoder;

[0060] Figure 29 is a schematic diagram of the encoder hardware structure;

[0061] FIG30 is a schematic diagram of the composition structure of a decoder;

[0062] FIG31 is a schematic diagram of the decoder hardware structure;

[0063] FIG32 is a schematic diagram showing the composition structure of the encoding and decoding system. DETAILED DESCRIPTION

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

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

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

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

[0068] Coding Block (CB);

[0069] Block Maching (BM);

[0070] Coding Unit (CU);

[0071] Block Vector (BV);

[0072] Sum of Absolute Difference (SAD);

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

[0074] Mean Square Error (MSE);

[0075] Sum of Squared Differences (SSD);

[0076] Mean Absolute Deviation (MAD);

[0077] Mean Square Differences (MSD);

[0078] Normalized Correlation Coefficient (NCC);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[0093] See Figure 2, which shows a schematic diagram of a prediction process based on the IntraTMP technology. As shown in Figure 2, the process may include:

[0094] S201: Determine the current template type.

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

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

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

[0098] When the upper left reference pixel, the upper reference pixel, and the left reference pixel are all available, the value of refTemplateType is 1, and the template shape is as shown in (a) of Figure 3;

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

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

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

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

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

[0104] S202: Obtain current template pixels.

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

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

[0107] S203: Determine a block vector within a predefined search range.

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

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

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

[0111] In the embodiment of the present application, the fine search here may specifically be: determining the best fine matching template in the search area with a second preset step size (eg, 1), or determining the best fine matching template near the best coarse matching template after completing the coarse search.

[0112] Refer to Figure 4, which shows a schematic diagram of a search process based on the IntraTMP technology provided by an embodiment of the present application. As shown in Figure 4, the process may include:

[0113] S401: Initialize parameters.

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

[0115] For example, Figure 5 shows a schematic diagram of the parameter definition of the current block and its template. As shown in Figure 5, the specific meanings of the parameters are: 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 size of the block containing the current block and its template.

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

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

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

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

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

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

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

[0123] It should be noted that the Intra TMP technique's search area is the reconstructed portion of the current image and is limited by the search range. Figure 6 shows a schematic diagram of the template search area. As shown in Figure 6, the dark-filled background area represents the reconstructed area, the black-filled background block represents the current block, and the dashed box represents the search range window. Therefore, the IntraTMP technique's search area is no larger than the overlap between the reconstructed area represented by the dark background and the area indicated by the dashed box.

[0124] As can be seen, the search area for the current block template can be the reconstructed portion of the CTB where the current block resides, or it can be another reconstructed CTB area. The search area here is actually the set of all search points. Because the shape of this area is often not representable by a single rectangular region, in practice, multiple rectangular regions can be searched, and the search results from these different regions can be combined to obtain the final best matching block and best block vector.

[0125] For example, see Figure 7, which shows a schematic diagram of different sub-region divisions of a search area. As shown in Figure 7, eight different sub-region division methods are shown. The black-filled background block is the current block; the five division methods (a), (b), (c), (d), and (f) all divide the search area into four sub-search areas, and the three division methods (e), (g), and (h) all divide the search area into three sub-search areas. Here, different fill patterns represent a sub-search area.

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

[0127] For example, assuming that different sub-search regions are represented by regionId, and considering that the template pixels of the current block need to be retrieved in the image reconstruction region and the pixels of the reconstructed block corresponding to the template also need to be retrieved in the reconstruction region, it is necessary to further determine the positions that can be searched within the sub-search regions represented by different regionIds based on the current block position (xTbCmp, yTbCmp), the current block size (nTbW, nTbH), the current image size (picWidth, picHeight), the size of the CTB in which the current block is located (CtbSizeW, CtbSizeH), the preset search range of the template (searchRangeWidth, searchRangeHeight), and the position offset of the current block within the current CTB (offsetLCBY, offsetLCBX), thereby determining the block vector BV. Specifically, iVerMin and iVerMax represent the absolute coordinate positions that can be searched at least and at most in the vertical direction, respectively, and iHorMin and iHorMax represent the absolute coordinate positions that can be searched at least and at most in the horizontal direction, respectively. The values ​​of iVerMin, iVerMax, iHorMin, and iHorMax are different in the search areas represented by different regionIds.

[0128] Taking (f) in Figure 7 as an example, the search area is divided into four sub-search areas, which are implemented as follows:

[0129] When regionId is equal to 0, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: 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))。

[0130] When regionId is equal to 1, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: 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)。

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

[0132] When regionId is equal to 3, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: 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。

[0133] In practical applications, the iHorMin regionId 、iHorMax regionId、iVerMin regionId 、iVerMax regionId Represent the left edge, right edge, top edge and bottom edge of different sub-search areas respectively.

[0134] To intuitively illustrate the different sub-search regions corresponding to different regionIds, see Figure 8, which shows a schematic diagram of the specific search region determination process. As shown in Figure 8, R1, R2, R3, and R4 represent four different sub-search regions. Note that Figure 8 represents the pixel range aligned with the top-left corner pixel of the block.

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

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

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

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

[0139] It should also be noted that, through the search points (iPosHor, iPoxVer) in each search area, that is, each block vector BV (composed of horizontal and vertical components: (pX, pY), where pX = iPosHor-xTbCmp, pY = iPosVer-yTbCmp, then pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs; in this way, a matching reconstructed block of the current block can be found in the reconstructed area, and the adjacent reconstructed pixels of the matching reconstructed block are the matching template (that is, the second template mentioned above). Therefore, the matching cost value of the adjacent template of the current block and the adjacent template of the matching reconstructed block can be calculated, which is recorded as pDiff.

[0140] Furthermore, all search points in all search ranges (regionId=0, 1, 2, 3) are traversed, and the search point with the smallest matching cost pDiff is obtained by comparison. Its corresponding matching cost is recorded as pDiff_BEST, its corresponding block vector BV is recorded as the best block vector BV_BEST (pX_BEST, pY_BEST), and its corresponding matching template is the best matching template T_BEST.

[0141] In one possible implementation, if the search strategy is to perform only a coarse search, the specific implementation is as follows:

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

[0143] In another possible implementation, if the search strategy is to perform only detailed search, the specific implementation is as follows:

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

[0145] In another possible implementation, if the search strategy is: perform a coarse search first and then a fine search; FIG9 is a schematic diagram of the search process, as shown in FIG9. The specific process is as follows:

[0146] S901: Determine the best coarse matching template in the search area with a step size of 2.

[0147] S902: Determine the best fine matching template near the best coarse matching template with a step size of 1.

[0148] It should be noted that, for step S901, in the coarse search phase:

[0149] In each region at pX within bvXMins regionId with bvXMaxs regionId Between, pY is in bvYMins regionId with bvYMaxs regionId Within the search range between , a coarse search is performed with a step size greater than 1. For example, the best matching cost obtained by performing a coarse search with a step size of 2 is recorded as pDiff1_BEST, and its corresponding block vector BV is recorded as the best block vector BV1_BEST (pX1_BEST, pY1_BEST), and the search region where the best matching search point is located is bestRegionId.

[0150] It should also be noted that, for step S902, in the detailed search phase:

[0151] A further search is performed near the best block vector BV1_BEST obtained from the coarse search. Specifically, a refined search range TmpRefineRange is first determined. The refined search range can be a fixed size or related to the current block size, for example, min(nTbW, nTbH) / 2. The position of the best matching reconstructed block obtained from the coarse search is then calculated as the reference position of the fine search area: BestPosX = xTbCmp + pX1_BEST, BestPosY = yTbCmp + pY1_BEST.

[0152] According to the value of bestRegionId, first obtain the calculated values ​​of iVerMinbestRegionId, iVerMaxbestRegionId, iHorMinbestRegionId, and iHorMaxbestRegionId, and then obtain the new search range iVerMin according to the optimal matching block position obtained by the rough search. refine 、iVerMax refine 、iHorMin refine 、iHorMax refine, the acquisition method is as follows: iHorMin refine =max(iHorMinbestRegionId, BestPosX-TmpRefineRange); iHorMax refine =min(iHorMaxbestRegionId, BestPosX+TmpRefineRange); iVerMin refine =max(iVerMinbestRegionId, BestPosY-TmpRefineRange); iVerMax refine =min(iVerMaxbestRegionId, BestPosY+TmpRefineRange);

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

[0154] Thus, the fine search is performed at pX within bvXMins refine with bvXMaxs refine Between, pY is in bvYMins refine with bvYMaxs refine For example, the search is performed with a step size of 1, and the best matching cost obtained by template matching is recorded as pDiff_BEST, and its corresponding block vector BV is recorded as the best block vector BV_BEST (pX_BEST, pY_BEST).

[0155] After completing the above operations, the best block vector BV_BEST (pX_BEST, pY_BEST) can be obtained, where pX_BEST and pY_BEST are the horizontal offset and vertical offset of the best matching template relative to the current block template, respectively, and are also the horizontal offset and vertical offset of the best matching reconstructed block relative to the current block.

[0156] S204: Generate a predicted value.

[0157] Here, we can use simple translation copy to achieve it. The specific operation is:

[0158] For x=0...nTbW-1, y=0...nTbH-1; predSamples[x][y]=recSamples[x+pX_BEST][y+pY_BEST] (2)

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

[0160] It can be understood that in the IntraTMP mode, in addition to the above basic copying method to obtain the predicted value, it is also possible to use a method of filtering and fusing the corresponding positions of multiple BVs to obtain the predicted value, as well as a method of fusing the prediction with the ordinary Intra mode.

[0161] For example, during the region search process at the decoding end, after obtaining the BV candidate list by template matching, the first N items (eg, N=3) can be selected for weighted fusion. This method can be called IntraTMP Fusion mode.

[0162] For example, after obtaining an optimal BV, multiple points around the BV are selected and the predicted values ​​corresponding to the multiple points are weighted and fused to obtain the predicted value. This method can be called the IntraTMP FLM mode.

[0163] For example, after obtaining an optimal BV, a weighted combination of the predicted value obtained using the BV and the predicted value obtained using the normal intra mode is performed to obtain the final predicted value. The normal intra mode can be a planar mode or a directional mode, for example. The directional mode can be inferred from the TIMD or located in the intra candidate table using an index transmitted in the bitstream. This method can be referred to as the IntraTMP CIIP mode.

[0164] In simple terms, the Intra TMP technique, as used in related technologies, uses the template of the current block to search for the matching template with the lowest cost within a predefined search range in the current image according to a preset cost function. The best matching reconstructed block (Ref Block) corresponding to the matching template is used as the prediction block for the current block (Cur Block). The template of the current block can usually be selected from the reconstructed area adjacent to the current block.

[0165] In actual encoding, to address the problem of search strategies failing to fully utilize information from reconstructed neighboring sampling points, it is often necessary to obtain more effective reference information to improve prediction accuracy. For example, the search can be expanded to the pending reconstruction search area. When searching within the pending reconstruction search area, it is necessary to determine the availability of search points within it. However, performing availability determination for all search points in the entire pending reconstruction search area increases encoding complexity.

[0166] In summary, common encoding and decoding methods often need to obtain more effective reference information in order to achieve higher prediction accuracy, which will increase the complexity of encoding to a certain extent, thereby reducing encoding and decoding efficiency and performance.

[0167] To address the above-mentioned issues, embodiments of the present application provide a coding and decoding method, a bitstream, an encoder, a decoder, and a storage medium. The encoder and decoder determine a first template corresponding to a current block; determine a full reconstruction search area and / or a pending reconstruction search area based on the first template; wherein the full reconstruction search area includes reconstructed sampling points, and the pending reconstruction search area includes reconstructed sampling points and / or unreconstructed sampling points; perform area selection based on the full reconstruction search area and / or the pending reconstruction search area, and determine a selected full reconstruction search area and / or a selected pending reconstruction search area; wherein the selected full reconstruction search area is smaller than or equal to the full reconstruction search area, and the selected pending reconstruction search area is smaller than or equal to the pending reconstruction search area; and perform searches in the selected full reconstruction search area and / or the selected pending reconstruction search area to determine one or more block vectors of the current block. Thus, in the embodiments of the present application, after determining the full reconstruction search area and / or the pending reconstruction search area including the reconstructed sampling points and / or the unreconstructed sampling points according to the first template, the full reconstruction search area and / or the pending reconstruction search area can be subjected to region selection processing to obtain a relatively small selected full reconstruction search area and / or selected pending reconstruction search area, and the search is then performed in the selected full reconstruction search area and / or selected pending reconstruction search area. In other words, the encoding and decoding method proposed in the embodiments of the present application can utilize the available sampling points in the pending reconstruction search area while limiting the search range to a certain extent. This can reduce the complexity of encoding and decoding while fully acquiring more effective reference information, thereby improving encoding and decoding efficiency and performance.

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

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

[0170] Referring to FIG10B , which shows a block diagram of a decoder provided in an embodiment of the present application, as shown in FIG10B , the decoder (specifically, a "video decoder") 200 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra-frame prediction unit 203, a motion compensation unit 204, a filtering unit 205, and a decoded image buffer unit 206. The decoding unit 201 can implement header information decoding and CABAC decoding, and the filtering unit 205 can implement deblocking filtering and SAO filtering. After the input video signal is encoded as shown in FIG10A, a code stream of the video signal is output; the code stream is input to the decoder 200 and first passes through the decoding unit 201 to obtain decoded transform coefficients; the transform coefficients are processed by the inverse transform and inverse quantization unit 202 to generate a residual block in the pixel domain; the intra-frame prediction unit 203 can be used to generate prediction data for the current video decoding block based on the determined intra-frame prediction mode and data from the previously decoded block of the current frame or picture; the motion compensation unit 204 determines the prediction information for the video decoding block by analyzing the motion vector and other associated syntax elements, and uses The prediction information is used to generate a predictive block for the video decoding block being decoded; a decoded video block is formed by summing the residual block from the inverse transform and inverse quantization unit 202 with the corresponding predictive block generated by the intra-frame prediction unit 203 or the motion compensation unit 204; the decoded video signal passes through the filtering unit 205 to remove blocking artifacts, thereby improving video quality; the decoded video block is then stored in the decoded image buffer unit 206, which stores reference images used for subsequent intra-frame prediction or motion compensation, and is also used for outputting the video signal, thereby obtaining the restored original video signal.

[0171] Furthermore, the embodiment of the present application also provides a network architecture of a coding and decoding system including an encoder and a decoder, wherein Figure 11 shows a schematic diagram of the network architecture of a coding and decoding system provided by the embodiment of the present application. As shown in Figure 11, the network architecture includes one or more electronic devices 13 to 1N and a communication network 01, wherein the electronic devices 13 to 1N can perform video interaction through the communication network 01. During implementation, the electronic device can be various types of devices with video coding and decoding functions. For example, the electronic device can include a smart phone, a tablet computer, a personal computer, a personal digital assistant, a navigator, a digital phone, a video phone, a television, a sensing device, a server, etc., and the embodiment of the present application is not specifically limited. Here, the decoder or encoder described in the embodiment of the present application can be the above-mentioned electronic device.

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

[0173] It should also be noted that, when applied to the intra-frame prediction unit 103, the "current block" specifically refers to the coding block currently to be intra-frame predicted; when applied to the intra-frame prediction unit 203, the "current block" specifically refers to the decoding block currently to be intra-frame predicted.

[0174] An embodiment of the present application provides a decoding method, which is applied to a decoder. FIG12 is a flowchart of the decoding method provided in the embodiment of the present application. As shown in FIG12 , the decoding method performed by the decoder may include the following steps:

[0175] Step 101: Determine a first template corresponding to the current block.

[0176] In an embodiment of the present application, the first template corresponding to the current block may be determined first. When acquiring the first template, the template type corresponding to the current block may be determined first, and then the first template corresponding to the current block may be further determined based on the template type.

[0177] It should be noted that the decoding method in the embodiment of the present application is applied to a decoder. Furthermore, the decoding method may include an intra-frame prediction method, more specifically, a color component prediction method. A video image may be divided into multiple decoding blocks, each of which may include a first color component, a second color component, and a third color component. The current block in the embodiment of the present application refers to a decoding block in the video image that is currently to be intra-frame predicted.

[0178] Here, when the first color component needs to be predicted, the component to be predicted is the first color component; when the second color component needs to be predicted, the component to be predicted is the second color component; when the third color component needs to be predicted, the component to be predicted is the third color component. In addition, assuming that the current block predicts the first color component and the first color component is the luminance component, that is, the component to be predicted is the luminance component, then the current block can also be called a luminance block; or assuming that the current block predicts the second color component and the second color component is the chrominance component, that is, the component to be predicted is the chrominance component, then the current block can also be called a chrominance block.

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

[0180] Furthermore, in an embodiment of the present application, the template type of the current block may be determined based on indication information in the code stream; or the template type of the current block may be determined based on the size of the current block.

[0181] Furthermore, in an embodiment of the present application, the template type of the current block can be determined based on the reference pixels of the current block, wherein the reference pixels of the current block include at least one of the following: the left adjacent reference pixels of the current block, the upper adjacent reference pixels of the current block, the upper left adjacent reference pixels of the current block, the lower left adjacent reference pixels of the current block, and the upper right adjacent reference pixels of the current block.

[0182] It is understandable that in the embodiment of the present application, the reference pixels of the current block may include the adjacent reconstructed pixels of the current block, that is, the adjacent reconstructed pixels of the current block may be selected as a template to search for a matching template in a predefined search area.

[0183] It should be noted that, in an embodiment of the present application, the reference pixels of the current block, that is, the adjacent reconstructed pixels of the current block may include the upper reference pixel, the upper left reference pixel, the upper right reference pixel, the left reference pixel and the lower left reference pixel of the current block.

[0184] It can be understood that in the embodiment of the present application, when the template type of the current block is determined using the reference pixels of the current block, the template type can be classified and determined according to whether the adjacent reference pixels are available.

[0185] It is understandable that, in the embodiment of the present application, when determining the template type of the current block, the template type may be classified and determined according to an indication in the code stream.

[0186] Further, in an embodiment of the present application, when determining the template type of the current block based on the reference pixels of the current block, if the left adjacent reference pixels of the current block, the upper adjacent reference pixels of the current block and the upper-left adjacent reference pixels of the current block are all available, the template type of the current block is determined to be a first value; if the left adjacent reference pixels of the current block are available, the template type of the current block is determined to be a second value; if the upper adjacent reference pixels of the current block are available, the template type of the current block is determined to be a third value; if the left adjacent reference pixels of the current block and the upper-left adjacent reference pixels of the current block are both available, the template type of the current block is determined to be a fourth value; if the left adjacent reference pixels of the current block and the lower-left adjacent reference pixels of the current block are both available, the template type of the current block is determined to be a fifth value; if the upper adjacent reference pixels of the current block and the upper-right adjacent reference pixels of the current block are both available, the template type of the current block is determined to be a sixth value.

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

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

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

[0190] In some embodiments, the IntraTMP template type can be selected based on the aforementioned reference pixel availability information and instructions in the bitstream. For example, a sequence number for each template type can be agreed upon, and the actual template sequence number information used can be transmitted in the bitstream, so that the template type can be determined at the decoding end.

[0191] That is, in the embodiments of the present application, the template type can be determined based on the availability information of the reference pixels of the current block, or based on information indicated in the bitstream, or based on a combination of the availability information of the reference pixels and information indicated in the bitstream. This application does not make any specific limitations.

[0192] Furthermore, in an embodiment of the present application, when determining the first template corresponding to the current block based on the template type, the template reference pixels of the current block can be determined first based on the template type and the template size corresponding to the template type, and then the first template of the current block can be determined based on the template reference pixels.

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

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

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

[0196] Accordingly, in an embodiment of the present application, by combining the value of the template type refTemplateType of the current block and the template size corresponding to the refTemplateType, it is possible to determine which part of the reconstructed pixels to obtain as the template reference pixels of the current block, and then determine the corresponding first template.

[0197] Exemplarily, in an embodiment of the present application, when the value of refTemplateType is 1, you can choose to obtain the left, upper left and upper reconstructed pixels of the current block; when the value of refTemplateType is 2, only the left 4 columns of reconstructed pixels of the current block are obtained; when the value of refTemplateType is 3, only the upper 4 rows of reconstructed pixels of the current coding block are obtained.

[0198] Of course, the value of the preset template size can be any integer greater than 0, and is not limited to 4, and this application does not make any specific limitation on this.

[0199] It can be understood that in the embodiment of the present application, in combination with the template type and the corresponding template size of the current block, the template reference pixel of the current block determined from the reference pixels of the current block can be the first template corresponding to the current block.

[0200] Step 102 : Determine a full reconstruction search area and / or a pending reconstruction search area according to the first template; wherein the full reconstruction search area includes reconstructed sampling points, and the pending reconstruction search area includes reconstructed sampling points and / or unreconstructed sampling points.

[0201] In an embodiment of the present application, after determining the first template corresponding to the current block, a full reconstruction search area and / or a pending reconstruction search area may be further determined based on the first template; wherein the full reconstruction search area includes reconstructed sampling points, and the pending reconstruction search area includes reconstructed sampling points and / or unreconstructed sampling points.

[0202] It is understood that in the embodiments of the present application, during the Intra TMP prediction process, the search area selected based on the first template may include a pending reconstruction search area and / or a full reconstruction search area. The full reconstruction search area may include only reconstructed sampling points, i.e., all sampling points in the full reconstruction search area are reconstructed sampling points. However, for the pending reconstruction search area, it is uncertain whether the sampling points in the pending reconstruction search area have been reconstructed. In other words, the pending reconstruction search area may include only reconstructed sampling points, only unreconstructed sampling points, or both reconstructed and unreconstructed sampling points.

[0203] Accordingly, in the process of traversing the search area to be reconstructed, it is necessary to increase the availability of each search position so as to fully utilize the information of all adjacent reconstructed sampling points.

[0204] It should be noted that, in an embodiment of the present application, the full reconstruction search area and / or the pending reconstruction search area can be determined based on the first template, with the zero-value block vector as the center, according to the size of the search window and the position information of the current image.

[0205] That is to say, in the embodiment of the present application, the search area is near the zero value BV, or it can be said that the search area is centered on the zero value BV and is constrained by information such as the size of the search window and the edge of the image.

[0206] Furthermore, in an embodiment of the present application, the full reconstruction search area is a search area including a set of positions corresponding to the upper left corner pixel point of the reference block at each search position; the pending reconstruction search area is a search coverage area including a set of pixels corresponding to the reference block at each search position.

[0207] That is, in the embodiments of this application, the search area refers to the set of positions corresponding to the upper-left pixel of the reference block at each search position; this area may not involve unreconstructed sampling points. Regarding the pending reconstruction search area, this is because the lower-right pixel of the reference block corresponding to each search position in this area is located in the upper-right or lower-left area of ​​the current coding block and may not have been reconstructed.

[0208] Accordingly, in an embodiment of the present application, the search area may be a set of pixels to the upper left of the search point, and the search coverage area includes a set of pixels of reference blocks corresponding to all search points.

[0209] It should be noted that, in an embodiment of the present application, the block vector search process may include an initialization process, determining a search area of ​​the first template in the current frame, searching and determining one or a pair of optimal block vectors in the search area. Therefore, when performing the search process, the initialization operation needs to be completed first.

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

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

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

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

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

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

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

[0217] Furthermore, the preset search range of the template is initialized. The preset search range of the template can be set to a fixed size or dynamically adjusted according to the coding 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 can be a preset value, can be indicated by a bitstream syntax element, or can be adaptively adjusted according to information such as the coding block size, for example, set to 5.

[0218] Furthermore, in an embodiment of the present application, when determining one or more block vectors corresponding to the current block according to the first template, a full reconstruction search area can be first determined according to the first template; then a search can be performed within the full reconstruction search area to determine one or more block vectors.

[0219] It should be noted that in the embodiments of this application, the search area is the reconstructed portion of the current image and is limited by the size of the search range. As shown in Figure 6 above, the dark-filled background area is the reconstructed area, the black-filled background block is the current block, and the dashed box is the search range window. Therefore, the search area of ​​the IntraTMP technology is no larger than the overlap between the reconstructed area represented by the dark background and the area indicated by the dashed box.

[0220] As can be seen, the search area for the current block template can be the reconstructed portion of the CTB where the current block resides, or it can be another reconstructed CTB area. The search area here is actually the set of all search points. Because the shape of this area is often not representable by a single rectangular region, in practice, multiple rectangular regions can be searched, and the search results from these different regions can be combined to obtain the final best matching block and best block vector.

[0221] For example, in some embodiments, the reconstructed area within the dotted box in FIG6 is processed by region, and the upper, lower, left, and right boundaries of each area are determined. Then, a search is performed in multiple rectangular areas, and the search results of different areas are combined to obtain the final optimal matching module and the optimal block vector.

[0222] For example, see Figure 13, which illustrates four different sub-region division methods. As shown in Figure 13, the black-filled background block is the current block. Methods (a), (b), (c), and (d) all divide the search area into four sub-search areas, with different fill patterns representing each sub-search area. Methods (a), (b), (c), and (d) consider the entire available search range.

[0223] For example, assuming that different search regions are represented by regionId, considering that the current coding block template pixels need to be obtained in the image reconstruction region and the reconstructed block pixels corresponding to the template also need to be obtained in the reconstruction region, it is necessary to further determine the positions that can be searched within the search regions represented by different regionIds based on the position of the current coding block (xTbCmp, yTbCmp), the size of the current coding block (nTbW, nTbH), the size of the current image (picWidth, picHeight), the size of the CTB where the current coding block is located (CtbSizeW, CtbSizeH), the preset search range of the template (searchRangeWidth, searchRangeHeight), and the position offset of the current coding block within the current CTB (offsetLCBY, offsetLCBX), thereby determining the block vector BV. Specifically, iVerMin and iVerMax represent the absolute coordinate positions that can be searched at least and at most in the vertical direction, respectively, and iHorMin and iHorMax represent the absolute coordinate positions that can be searched at least and at most in the horizontal direction. The values ​​of iVerMin, iVerMax, iHorMin, and iHorMax are different in the search areas represented by different regionIds.

[0224] Furthermore, in an embodiment of the present application, the search area can be divided based on the shape of the reconstruction area and the certainty of the reconstructed pixels, which can balance computational complexity and coding efficiency. For example, the CTB area encoded before the CTB where the current block is located, and the areas located to the upper left, directly left, and directly above the current coding block within the CTB where the current coding block is located are all areas that are determined to be reconstructed. Therefore, such areas where it is certain that all sampling points contained therein have been reconstructed are selected as full reconstruction search areas. Correspondingly, within the CTB where the current coding block is located, the areas located to the lower left and upper right of the current coding block are areas that may or may not be reconstructed. Therefore, such areas where it is not certain that all sampling points contained therein have been reconstructed are determined as pending reconstruction search areas.

[0225] In some embodiments, based on considerations of the full reconstruction search area and the pending reconstruction search area, taking (a) in FIG. 13 as an example, the search area is divided into six sub-search areas, which are implemented as follows:

[0226] When regionId is equal to 0, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: 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))。

[0227] When regionId is equal to 1, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: 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)。

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

[0229] When regionId is equal to 3, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: 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。

[0230] When regionId is equal to 4, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: iHorMin = (xTbCmp - offsetLCBX - nTbW) < <iBvShift; iHorMax=(xTbCmp-nTbW)<<iBvShift; iVerMin=(yTbCmp+1)<<iBvShift; iVerMax=min((picHeight–nTbH)<<iBvShift,(yTbCmp-offsetLCBY+CtbSizeH-nTbH)<<iBvShift)。

[0231] When regionId is equal to 5, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: iHorMin = (xTbCmp) < <iBvShift; iHorMax=min((xTbCmp+CtbSizeW-nTbW)<<iBvShift,min((xTbCmp+searchRangeWidth)<< iBvShift,((picWidth-nTbW)<<iBvShift))); iVerMin=max(((iTemplateSizeH)<<iBvShift),(yTbCmp-offsetLCBY-nTbH+1)<<iBvShift); iVerMax=(yTbCmp-nTbH)<<iBvShift。

[0232] In practical applications, the iHorMin regionId 、iHorMax regionId 、iVerMinregionId 、iVerMax regionId Represent the left edge, right edge, top edge and bottom edge of different sub-search areas respectively.

[0233] To visually illustrate the different sub-search regions corresponding to different regionIds, Figure 14 shows the second schematic diagram of the search region determination process. As shown in Figure 14, R1, R2, R3, R4, R5, and R6 represent six different sub-search regions. R1, R2, R3, and R4 are the full reconstruction search regions, while R5 and R6 are the pending reconstruction search regions. Note that Figure 14 represents the pixel range aligned with the top-left corner pixel of the block.

[0234] That is, in some embodiments, the search area can be divided into two types: one is a region in which all sampling points have been reconstructed (referred to as a full reconstruction search area), for example, including the four regions R1, R2, R3, and R4 in FIG14 ; the other is a region in which it is uncertain whether all sampling points have been reconstructed (referred to as a pending reconstruction search area), for example, including the two regions R5 and R6 in FIG14 .

[0235] Furthermore, in an embodiment of the present application, in order to achieve a smaller number of search areas and thus reduce the amount of code, part of the full reconstruction search area and part of the pending reconstruction search area can be selectively merged to form a new pending reconstruction search area, thereby reducing the number of search areas.

[0236] In some embodiments, the full reconstruction search area and / or the pending reconstruction search area may be merged and updated to determine an updated full reconstruction search area and an updated pending reconstruction search area; wherein a first total number of areas of the updated full reconstruction search area and the updated pending reconstruction search area is less than a second total number of areas of the full reconstruction search area and / or the pending reconstruction search area.

[0237] That is, in the embodiment of the present application, the initially specified pending reconstruction search area is relatively large, and the total number of areas is relatively small.

[0238] For example, in an embodiment of the present application, for the four full reconstruction search regions R1, R2, R3, and R4 and the two pending reconstruction search regions R5 and R6 in FIG13 , R2 and R5 can be merged to form a new pending reconstruction search region. The updated full reconstruction search region includes R1, R3, and R4, and the updated pending reconstruction search region includes R6 and the new pending reconstruction search region consisting of R2 and R5.

[0239] For example, in an embodiment of the present application, for the four full reconstruction search regions R1, R2, R3, and R4 and the two pending reconstruction search regions R5 and R6 in FIG13 , R4 and R6 can be merged to form a new pending reconstruction search region. The updated full reconstruction search region includes R1, R2, and R3, and the updated pending reconstruction search region includes R5 and the new pending reconstruction search region consisting of R4 and R6.

[0240] Step 103: Perform region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine a selected full reconstruction search region and / or a selected pending reconstruction search region; wherein the selected full reconstruction search region is smaller than or equal to the full reconstruction search region, and the selected pending reconstruction search region is smaller than or equal to the pending reconstruction search region.

[0241] In an embodiment of the present application, after determining a search area based on the first template, that is, determining a full reconstruction search area and / or a pending reconstruction search area, region selection can be further performed based on the full reconstruction search area and / or the pending reconstruction search area, thereby determining a corresponding selected full reconstruction search area and / or selected pending reconstruction search area.

[0242] It should be noted that, in the embodiments of the present application, area selection is performed based on the full reconstruction search area and / or the pending reconstruction search area, which can be understood as narrowing and restricting the full reconstruction search area and / or the pending reconstruction search area, thereby narrowing the scope of the search area for the final search and reducing the encoding and decoding complexity.

[0243] Accordingly, in an embodiment of the present application, after region selection is performed based on the full reconstruction search region and / or the pending reconstruction search region, it is determined that the selected full reconstruction search region is smaller than or equal to the full reconstruction search region, and it is determined that the selected pending reconstruction search region is smaller than or equal to the pending reconstruction search region.

[0244] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search region and / or the pending reconstruction search region, the full reconstruction search region may be determined as the selected full reconstruction search region; and simultaneously, region selection may be performed on the pending reconstruction search region to determine the selected pending reconstruction search region.

[0245] That is, in the embodiment of the present application, it is possible to choose to narrow down and limit only the pending reconstruction search area, thereby obtaining a corresponding selected pending reconstruction search area, and the selected pending reconstruction search area and the full reconstruction search area constitute the final search area.

[0246] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search region and / or the pending reconstruction search region, region selection may be performed on the full reconstruction search region to determine the selected full reconstruction search region; and simultaneously, the pending reconstruction search region may be determined as the selected pending reconstruction search region.

[0247] That is, in the embodiment of the present application, it is possible to choose to narrow down and restrict only the full reconstruction search area, thereby obtaining a corresponding selected full reconstruction search area, and the selected full reconstruction search area and the pending reconstruction search area constitute the final search area.

[0248] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search region and / or the pending reconstruction search region, region selection can be performed on the full reconstruction search region to determine the selected full reconstruction search region; and simultaneously, region selection can be performed on the pending reconstruction search region to determine the selected pending reconstruction search region.

[0249] That is, in an embodiment of the present application, the full reconstruction search area and the pending reconstruction search area can be simultaneously narrowed and restricted, thereby obtaining a corresponding selected full reconstruction search area and a selected pending reconstruction search area, and the selected full reconstruction search area and the selected pending reconstruction search area constitute the final search area.

[0250] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search region and / or the pending reconstruction search region, the full reconstruction search region may be determined as the selected full reconstruction search region; and the pending reconstruction search region may be determined as the selected pending reconstruction search region.

[0251] That is, in the embodiment of the present application, it is possible to choose not to reduce or restrict the full reconstruction search area and the pending reconstruction search area, but to directly form the final search area by the full reconstruction search area and the pending reconstruction search area.

[0252] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine the selected full reconstruction search region and / or the selected pending reconstruction search region, a narrowing parameter may be first determined; then, region selection may be performed on the full reconstruction search region and / or the pending reconstruction search region based on the narrowing parameter to finally determine the selected full reconstruction search region and / or the selected pending reconstruction search region.

[0253] It should be noted that, in the embodiment of the present application, the limiting parameters may include a height limiting parameter hIndex and a width limiting parameter wIndex, wherein both the height limiting parameter hIndex and the width limiting parameter wIndex are greater than or equal to 1.

[0254] For example, in some embodiments, for search points within a search area, all search points within the specified search area may be traversed, or a local search range may be limited in various ways to balance computational complexity and coding efficiency. For example, the width of the search range may be limited to 1 / wIndex, and the height may be limited to 1 / hIndex, where wIndex and hIndex are both arbitrary values ​​greater than or equal to 1.

[0255] It should be noted that in the embodiments of the present application, the code stream can be decoded to determine the compression parameters. The compression parameters are transmitted through any one of the following syntax information: SPS layer syntax information, PPS layer syntax information, APS layer syntax information, SH layer syntax information, and CU layer syntax information.

[0256] It should be noted that, in the embodiment of the present application, the limiting parameter may also be determined according to a preset value, for example, wIndex and hIndex are both 2.

[0257] That is to say, in the embodiment of the present application, the limitation parameter for limiting the size of the search area can be transmitted through the SPS layer syntax, or through the PPS layer syntax, the APS layer syntax, or the SH layer syntax, the CU layer syntax, etc.

[0258] It should be noted that, in the embodiments of the present application, different methods may be used to select regions for different search regions, that is, different search regions may correspond to different narrowing strategies.

[0259] Furthermore, in an embodiment of the present application, a search area in the full reconstruction search area that is located above the current block can be determined as a first initial area; a search area in the full reconstruction search area that is located to the left or upper left of the current block can be determined as a second initial area; a search area in the pending reconstruction search area that is located to the lower left of the current block can be determined as a third initial area; and a search area in the pending reconstruction search area that is located to the upper right of the current block can be determined as a fourth initial area.

[0260] For example, in some embodiments, as shown in FIG14 , R1, R2, R3, R4, R5, and R6 represent six different sub-search regions, where R1, R2, R3, and R4 are full reconstruction search regions, and R5 and R6 are pending reconstruction search regions. Based on the positional relationship between each sub-search region and the current block, search region R1 in the full reconstruction search region and located above the current block can be determined as the first initial region; search regions R2, R3, and R4 in the full reconstruction search region and located to the left or upper left of the current block can be determined as the second initial region; search region R5 in the pending reconstruction search region and located to the lower left of the current block can be determined as the third initial region; and search region R6 in the pending reconstruction search region and located to the upper right of the current block can be determined as the fourth initial region.

[0261] Furthermore, in an embodiment of the present application, when performing area selection on the full reconstruction search area and / or the pending reconstruction search area according to the limitation parameter and determining the selected full reconstruction search area and / or the selected pending reconstruction search area, a first selected area can be determined in the first initial area according to the limitation parameter and the position information of the first initial area; wherein the first selected area is any area in the first initial area; and then the selected full reconstruction search area is determined based on the first selected area.

[0262] It can be understood that in an embodiment of the present application, for the search area on the upper side of the current block, such as R1, after obtaining the four boundaries iHorMin, iHorMax, iVerMin, and iVerMax of the search area (first initial area), the search area can be cropped and limited using the limitation parameters wIndex and hIndex, so as to obtain the first selected area.

[0263] It should be noted that in the embodiments of the present application, for the search area above the current block, such as R1, the narrowed first selected area can be any area within the first initial area. That is, the first selected area can be a sub-area in different directions within the first initial area, such as above, below, left, right, or center, and this application does not impose any specific restrictions.

[0264] Exemplarily, in some embodiments, Figure 15 is a schematic diagram of region selection 1. As shown in Figure 15, for the search area on the upper side of the current block, such as R1, if the values ​​of the limiting parameters wIndex and hIndex are both 1, then the first selected area obtained after region selection of the first initial area using the limiting parameters wIndex and hIndex is the corresponding first initial area.

[0265] Exemplarily, in some embodiments, Figure 16 is a second schematic diagram of area selection. As shown in Figure 16, for the search area on the upper side of the current block, such as R1, if the value of the limitation parameter wIndex is 2 and the value of hIndex is 1, then the first selected area obtained after area selection of the first initial area using the limitation parameters wIndex and hIndex is the middle area of ​​the corresponding first initial area.

[0266] Exemplarily, in some embodiments, Figure 17 is a third schematic diagram of area selection. As shown in Figure 17, for the search area on the upper side of the current block, such as R1, if the value of the limitation parameter wIndex is 1 and the value of hIndex is 2, then the first selected area obtained after area selection of the first initial area using the limitation parameters wIndex and hIndex is the middle area of ​​the corresponding first initial area.

[0267] Exemplarily, in some embodiments, Figure 18 is a fourth schematic diagram of area selection. As shown in Figure 18, for the search area on the upper side of the current block, such as R1, if the value of the limitation parameter wIndex is 2 and the value of hIndex is 2, then the first selected area obtained after area selection of the first initial area using the limitation parameters wIndex and hIndex is the middle area of ​​the corresponding first initial area.

[0268] For example, in some embodiments, when regionId is equal to 0, such as R1 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the first selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId Calculated as follows: iHorMin regionId =iHorMin+(iHorMax-iHorMin) / (2×wIndex); iHorMax regionId =iHorMax-(iHorMax-iHorMin) / (2×wIndex); iVerMin regionId =iVerMin+(iVerMax-iVerMin) / (2×hIndex); iVerMax regionId =iVerMax-(iVerMax-iVerMin) / (2×hIndex).

[0269] It is understood that in the embodiment of the present application, when selecting a region based on the narrowing parameter, the division involved can be implemented by right shifting. For example, when wIndex is set to 2, the same result can be achieved by using the >> 1 operation.

[0270] Furthermore, in an embodiment of the present application, when performing area selection on the full reconstruction search area and / or the pending reconstruction search area according to the narrowing parameter and determining the selected full reconstruction search area and / or the selected pending reconstruction search area, a second selected area can be determined in the second initial area according to the narrowing parameter and the position information of the second initial area; wherein the second selected area is any area in the second initial area; and then the selected full reconstruction search area is determined based on the second selected area.

[0271] Furthermore, in an embodiment of the present application, when performing area selection on the full reconstruction search area and / or the pending reconstruction search area according to the narrowing parameter and determining the selected full reconstruction search area and / or the selected pending reconstruction search area, a third selected area can be determined in the third initial area according to the narrowing parameter and the position information of the third initial area; wherein the third selected area is any area in the third initial area; and then the selected full reconstruction search area is determined based on the third selected area.

[0272] It can be understood that in the embodiments of the present application, for the search area on the left side, upper left side, or lower left side of the current block, such as R2, R3, R4, and R5, after obtaining the four boundaries iHorMin, iHorMax, iVerMin, and iVerMax of the search area (the second initial area or the third initial area), the search area can be cropped and limited using the limitation parameters wIndex and hIndex, so as to obtain the second (or third) selected area.

[0273] It should be noted that in the embodiments of the present application, for the search area on the left, upper left, or lower left side of the current block, such as R2, R3, R4, and R5, the narrowed second (or third) selected area can be any area in the second (or third) initial area. That is, the second (or third) selected area can be a sub-area in different directions such as the upper, lower, left, right, or center of the second (or third) initial area, and this application does not specifically limit this.

[0274] Exemplarily, in some embodiments, Figure 19 is a schematic diagram five of area selection. As shown in Figure 19, for the search area on the left side, upper left side, or lower left side of the current block, such as R2, R3, R4, and R5, if the values ​​of the limiting parameters wIndex and hIndex are both 1, then the first selected area obtained after performing area selection on the first initial area using the limiting parameters wIndex and hIndex is the corresponding first initial area.

[0275] Exemplarily, in some embodiments, Figure 20 is a sixth schematic diagram of area selection. As shown in Figure 20, for the search area on the left side, upper left side, or lower left side of the current block, such as R2, R3, R4, and R5, if the value of the limitation parameter wIndex is 2 and the value of hIndex is 1, then the first selected area obtained after area selection of the first initial area using the limitation parameters wIndex and hIndex is the right area of ​​the corresponding first initial area.

[0276] Exemplarily, in some embodiments, Figure 21 is a schematic diagram seven of area selection. As shown in Figure 21, for the search area on the left side, upper left side, or lower left side of the current block, such as R2, R3, R4, and R5, if the value of the limitation parameter wIndex is 1 and the value of hIndex is 2, then the first selected area obtained after area selection of the first initial area using the limitation parameters wIndex and hIndex is the upper area of ​​the corresponding first initial area.

[0277] Exemplarily, in some embodiments, Figure 22 is a schematic diagram eight of area selection. As shown in Figure 22, for the search area on the left side, upper left side, or lower left side of the current block, such as R2, R3, R4, and R5, if the value of the limitation parameter wIndex is 2 and the value of hIndex is 2, then the first selected area obtained after area selection of the first initial area using the limitation parameters wIndex and hIndex is the upper right area of ​​the corresponding first initial area.

[0278] For example, in some embodiments, when regionId is equal to 1, 2, or 3, such as R2, R3, and R4 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the second selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iHorMin regionId 、iHorMax regionId Calculated as follows: iHorMin regionId=iHorMax-(iHorMax-iHorMin) / wIndex; iHorMax regionId =iHorMax.

[0279] For example, in some embodiments, when regionId is equal to 1, 2, or 3, such as R2, R3, and R4 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the second selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iHorMin regionId 、iHorMax regionId Calculated as follows: iHorMin regionId =iHorMin+(iHorMax-iHorMin) / wIndex; iHorMax regionId =iHorMax.

[0280] For example, in some embodiments, when regionId is equal to 1, 2, or 3, such as R2, R3, and R4 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the second selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iHorMin regionId 、iHorMax regionId The calculation is as follows:

[0281] When wIndex is 2, iHorMin regionId =(iHorMax+iHorMin) / wIndex; iHorMax regionId =iHorMax.

[0282] For example, in some embodiments, when regionId is equal to 1, 2, or 3, such as R2, R3, and R4 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the second selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iVerMin regionId 、iVerMax regionId The calculation is as follows: iVerMin regionId=iVerMin; iVerMax regionId =iVerMax-(iVerMax-iVerMin) / hIndex.

[0283] For example, in some embodiments, when regionId is equal to 1, 2, or 3, such as R2, R3, and R4 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the second selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iVerMin regionId 、iVerMax regionId The calculation is as follows: iVerMin regionId =iVerMin; iVerMax regionId =iVerMin+(iVerMax-iVerMin) / hIndex.

[0284] For example, in some embodiments, when regionId is equal to 1, 2, or 3, such as R2, R3, and R4 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the second selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iVerMin regionId 、iVerMax regionId The calculation is as follows: iVerMin regionId =iVerMin;

[0285] When hIndex is 2, iVerMax regionId =(iVerMax+iVerMin) / hIndex.

[0286] For example, in some embodiments, when regionId is equal to 4, such as R5 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the third selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iHorMin regionId 、iHorMax regionId Calculated as follows: iHorMin regionId=iHorMax-(iHorMax-iHorMin) / wIndex; iHorMax regionId =iHorMax.

[0287] For example, in some embodiments, when regionId is equal to 4, such as R5 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the third selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iHorMin regionId 、iHorMax regionId Calculated as follows: iHorMin regionId =iHorMin+(iHorMax-iHorMin) / wIndex; iHorMax regionId =iHorMax.

[0288] For example, in some embodiments, when regionId is equal to 4, such as R5 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the third selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iHorMin regionId 、iHorMax regionId The calculation is as follows:

[0289] When wIndex is 2, iHorMin regionId =(iHorMax+iHorMin) / wIndex; iHorMax regionId =iHorMax.

[0290] For example, in some embodiments, when regionId is equal to 4, such as R5 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the third selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iVerMin regionId 、iVerMax regionId The calculation is as follows: iVerMin regionId =iVerMin; iVerMax regionId=iVerMax-(iVerMax-iVerMin) / hIndex.

[0291] For example, in some embodiments, when regionId is equal to 4, such as R5 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the third selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iVerMin regionId 、iVerMax regionId The calculation is as follows: iVerMin regionId =iVerMin; iVerMax regionId =iVerMin+(iVerMax-iVerMin) / hIndex.

[0292] For example, in some embodiments, when regionId is equal to 4, such as R5 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the third selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iVerMin regionId 、iVerMax regionId The calculation is as follows: iVerMin regionId =iVerMin;

[0293] When hIndex is 2, iVerMax regionId =(iVerMax+iVerMin) / hIndex.

[0294] It is understandable that, in the embodiment of the present application, for the search area on the left side, upper left side, or lower left side of the current block, such as R2, R3, R4, and R5, when performing area selection on the second (or third) initial area, it is possible to select only the right half of the second (or third) initial area, then determine wIndex to be 2, iHorMin regionId =(iHorMax+iHorMin) / wIndexiHorMin, and set iHorMax at the same time regionId =iHorMax, iVerMin regionId =iVerMin, iVerMax regionId =iVerMax.

[0295] It is understandable that in the embodiment of the present application, for the search area on the left side, upper left side, or lower left side of the current block, such as R2, R3, R4, and R5, when performing area selection on the second (or third) initial area, it is possible to select only the upper half of the second (or third) initial area, then determine hIndex to be 2, and iVerMax regionId =(iVerMax+iVerMin) / hIndex, and set iHorMin at the same time regionId =iHorMin, iHorMax regionId =iHorMax, iVerMin regionId =iVerMin.

[0296] It is understood that in the embodiment of the present application, when selecting a region based on the narrowing parameter, the division involved can be implemented by right shifting. For example, when wIndex is set to 2, the same result can be achieved by using the >> 1 operation.

[0297] Furthermore, in an embodiment of the present application, when performing area selection on the full reconstruction search area and / or the pending reconstruction search area according to the limitation parameters and determining the selected full reconstruction search area and / or the selected pending reconstruction search area, a fourth selected area can be determined in the fourth initial area according to the limitation parameters and the position information of the fourth initial area; wherein the fourth selected area is any area in the fourth initial area; and then the selected pending reconstruction search area is determined based on the fourth selected area.

[0298] It can be understood that in an embodiment of the present application, for the search area on the upper right side of the current block, such as R6, after obtaining the four boundaries iHorMin, iHorMax, iVerMin, and iVerMax of the search area (the fourth initial area), the search area can be cropped and limited using the limitation parameters wIndex and hIndex, so as to obtain the fourth selected area.

[0299] It should be noted that in the embodiment of the present application, for the search area on the upper right side of the current block, such as R6, the narrowed fourth selected area can be any area within the fourth initial area. That is, the fourth selected area can be a sub-area in different directions such as the upper, lower, left, right, or center of the fourth initial area, and this application does not impose any specific restrictions.

[0300] Exemplarily, in some embodiments, Figure 23 is a ninth schematic diagram of region selection. As shown in Figure 23, for the search area on the upper right side of the current block, such as R6, if the values ​​of the limiting parameters wIndex and hIndex are both 1, then the fourth selected area obtained after region selection of the fourth initial area using the limiting parameters wIndex and hIndex is the corresponding fourth initial area.

[0301] Exemplarily, in some embodiments, Figure 24 is a schematic diagram of area selection ten. As shown in Figure 24, for the search area on the upper right side of the current block, such as R6, if the value of the limitation parameter wIndex is 2 and the value of hIndex is 1, then the fourth selected area obtained after area selection of the fourth initial area using the limitation parameters wIndex and hIndex is the left area of ​​the corresponding fourth initial area.

[0302] Exemplarily, in some embodiments, Figure 25 is a schematic diagram eleven of area selection. As shown in Figure 25, for the search area on the upper right side of the current block, such as R6, if the value of the limitation parameter wIndex is 1 and the value of hIndex is 2, then the fourth selected area obtained after area selection of the fourth initial area using the limitation parameters wIndex and hIndex is the lower area of ​​the corresponding fourth initial area.

[0303] Exemplarily, in some embodiments, Figure 26 is a schematic diagram 12 of area selection. As shown in Figure 26, for the search area on the upper right side of the current block, such as R6, if the value of the limitation parameter wIndex is 2 and the value of hIndex is 2, then the fourth selected area obtained after area selection of the fourth initial area using the limitation parameters wIndex and hIndex is the lower left area of ​​the corresponding fourth initial area.

[0304] For example, in some embodiments, when regionId is equal to 5, such as R6 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the first selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iHorMin regionId 、iHorMax regionId The calculation is as follows: iHorMax regionId =iHorMin+(iHorMax-iHorMin) / wIndex; iHorMin regionId =iHorMin.

[0305] For example, in some embodiments, when regionId is equal to 5, such as R6 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the first selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iHorMin regionId 、iHorMax regionId The calculation is as follows: iHorMax regionId =iHorMax-(iHorMax-iHorMin) / wIndex; iHorMin regionId =iHorMin.

[0306] For example, in some embodiments, when regionId is equal to 5, such as R6 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the first selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iHorMin regionId 、iHorMax regionId The calculation is as follows:

[0307] When wIndex is 2, iHorMax regionId =(iHorMax+iHorMin) / wIndex; iHorMin regionId =iHorMin.

[0308] For example, in some embodiments, when regionId is equal to 5, such as R6 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the first selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iVerMin regionId 、iVerMax regionId The calculation is as follows: iVerMin regionId =iVerMin+(iVerMax-iVerMin) / hIndex; iVerMax regionId =iVerMax.

[0309] For example, in some embodiments, when regionId is equal to 5, such as R6 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the first selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iVerMin regionId 、iVerMax regionId The calculation is as follows: iVerMin regionId =iVerMax-(iVerMax-iVerMin) / hIndex; iVerMax regionId =iVerMax.

[0310] For example, in some embodiments, when regionId is equal to 5, such as R6 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the first selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iVerMin regionId 、iVerMax regionId The calculation is as follows:

[0311] When hIndex is 2, iVerMin regionId =(iVerMax+iVerMin) / hIndex; iVerMax regionId =iVerMax.

[0312] It is understandable that in the embodiment of the present application, for the search area on the upper right side of the current block, such as R6, when performing area selection on the fourth initial area, it is possible to select only the left half of the fourth initial area, then determine wIndex to be 2, iHorMax regionId =(iHorMax+iHorMin) / wIndex, and set iHorMin at the same time regionId =iHorMin, iVerMin regionId =iVerMin, iVerMax regionId =iVerMax.

[0313] It is understandable that in the embodiment of the present application, for the search area on the upper right side of the current block, such as R6, when performing area selection on the fourth initial area, it is possible to select only the lower half of the fourth initial area, then determine hIndex to be 2, iVerMin regionId=(iVerMax+iVerMin) / hIndex, and set iHorMin at the same time regionId =iHorMin, iHorMax regionId =iHorMax, iVerMax regionId =iVerMax.

[0314] It is understood that in the embodiment of the present application, when selecting a region based on the narrowing parameter, the division involved can be implemented by right shifting. For example, when wIndex is set to 2, the same result can be achieved by using the >> 1 operation.

[0315] It can be seen that in the embodiments of the present application, for any sub-search area in the full reconstruction search area and / or the pending reconstruction search area, after obtaining the four boundaries iHorMin, iHorMax, iVerMin, iVerMax of the search area. When wIndex≠1 and / or hIndex≠1 are satisfied, the search area can be cropped according to the narrowing parameter. For example, in Figure 14, for the area Ri (i=2, 3, 4, 5), the search range is the area to the right or upper right of the Ri area, and the four schemes for limiting the search range are shown in Figures 19-22. For the area R6, the search range is the area to the left or lower left of the R6 area, and the four schemes for limiting the search range are shown in Figures 23-26. For the area R1, the middle position of the original search area can be taken, and the four schemes for limiting the search range are shown in Figures 15-18.

[0316] That is, in the embodiments of the present application, for search points within a search area, all search points within the specified search area can be traversed, or different schemes can be used to limit the search range to a local search range, so as to balance computational complexity and coding efficiency. For example, for the pending reconstruction search area (corresponding to the two areas R5 and R6 in Figure 14) or the full reconstruction area (corresponding to the four areas R1 to R4 in Figure 14), the width of the search range can be limited to the original 1 / wIndex, and the height can be limited to the original 1 / hIndex, where wIndex and hIndex are both arbitrary positive integers greater than or equal to 1.

[0317] It is understood that in the embodiments of the present application, the limited search range, i.e., the selected full reconstruction search area and / or the selected pending reconstruction search area, can be an area closer to the unit to be encoded (current block). For example, when narrowing the search range of the R5 area, the width of the R5 search area can be reduced to 1 / 2 of the original width, and the final search range can be the upper right 1 / 4 area of ​​the R5 area, as shown in Figure 22.

[0318] In summary, in the embodiments of the present application, different methods can be used to select different search areas. Specifically, the search areas can be divided into three categories based on their relative position to the reference block (e.g., left side of the current block to be encoded, top side of the current block to be encoded, top right side of the current block to be encoded), and Intra TMP search area restrictions can be applied to each of the three search areas.

[0319] It will be appreciated that in embodiments of the present application, after determining the full reconstruction search area and / or the pending reconstruction search area based on the first template, region selection can be performed based on the full reconstruction search area and / or the pending reconstruction search area to obtain a selected full reconstruction search area and / or a selected pending reconstruction search area. Alternatively, during the process of determining the full reconstruction search area and / or the pending reconstruction search area, the range of the full reconstruction search area and / or the pending reconstruction search area can be directly set. Specifically, the search area size of the full reconstruction search area and / or the pending reconstruction search area can be directly limited to the search area size of the selected full reconstruction search area and / or the selected pending reconstruction search area in the above-described solution.

[0320] For example, in some embodiments, when calculating the search area, a weight term or a clip operation may be added to the current formula. For example, only the right half of the R5 area is taken:

[0321] When regionId is equal to 4, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: iHorMin = max(iTemplateSizeW<<iBvShift,(xTbCmp–offsetLCBX> >1–nTbW+1)<< iBvShift); iHorMax=min((xTbCmp-nTbW)< <iBvShift,(picWidth-nTbW)<<iBvShift); iVerMin=(yTbCmp+1)<<iBvShift; iVerMax=min((picHeight–nTbH)<<iBvShift,(yTbCmp-offsetLCBY+CtbSizeH-nTbH)<< iBvShift)。

[0322] For example, in some embodiments, when calculating the search area, a weight term or a clip operation may be added to the current formula. For example, only the upper 1 / 2 of the R5 area is taken:

[0323] When regionId is equal to 4, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: iHorMin = max(iTemplateSizeW< <iBvShift,(xTbCmp–offsetLCBX–nTbW+1)<<iBvShift); iHorMax=min((xTbCmp-nTbW)<<iBvShift,(picWidth-nTbW)<<iBvShift); iVerMin=(yTbCmp+1)<<iBvShift; iVerMax=min((picHeight–nTbH)<<iBvShift,(yTbCmp–offsetLCBY+CtbSizeH> >1-nTbH) < <iBvShift)。

[0324] For example, in some embodiments, when calculating the search area, a weight term or a clip operation may be added to the current formula. For example, only the left half of the R6 area is taken:

[0325] When regionId is equal to 5, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: iHorMin = (xTbCmp + 1) < <iBvShift; iHorMax=min((xTbCmp-offsetLCBX+CtbSizeW-nTbW)<<iBvShift,min((xTbCmp+ searchRangeWidth> >1)< <iBvShift,((picWidth-nTbW)<<iBvShift))); iVerMin=max(((iTemplateSizeH)<<iBvShift),(yTbCmp-offsetLCBY-nTbH+1)<< iBvShift); iVerMax=(yTbCmp-nTbH)<<iBvShift。

[0326] For example, in some embodiments, when calculating the search area, a weight term or a clip operation may be added to the current formula. For example, only the lower 1 / 2 area of ​​the R6 area is taken:

[0327] When regionId is equal to 5, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: iHorMin = (xTbCmp + 1) < <iBvShift; iHorMax=min((xTbCmp-offsetLCBX+CtbSizeW-nTbW)<<iBvShift,min((xTbCmp+ searchRangeWidth)<<iBvShift,((picWidth-nTbW)<<iBvShift))); iVerMin=max(((iTemplateSizeH)<<iBvShift),(yTbCmp-offsetLCBY> >1-nTbH+1)<< iBvShift); iVerMax=(yTbCmp-nTbH)< <iBvShift。

[0328] For example, in some embodiments, when calculating the search area, a weight term or a clip operation may be added to the current formula. For example, only the upper right 1 / 4 area of ​​the R5 area is taken:

[0329] When regionId is equal to 4, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: iHorMin = max(iTemplateSizeW<<iBvShift,(xTbCmp–offsetLCBX> >1–nTbW+1)< <iBvShift); iHorMax=min((xTbCmp-nTbW)<<iBvShift,(picWidth-nTbW)<<iBvShift); iVerMin=(yTbCmp+1)<<iBvShift; iVerMax=min((picHeight–nTbH)<<iBvShift,(yTbCmp+(CtbSizeH-offsetLCBY)> >1- nTbH)< <iBvShift)。

[0330] For example, in some embodiments, when calculating the search area, a weight term or a clip operation may be added to the current formula. For example, only the lower left 1 / 4 area of ​​the R6 area is taken:

[0331] When regionId is equal to 5, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: iHorMin = (xTbCmp + 1) < <iBvShift; iHorMax=min((xTbCmp–offsetLCBX+CtbSizeW-nTbW)<<iBvShift,min((xTbCmp+ searchRangeWidth> >1)< <iBvShift,((picWidth-nTbW)<<iBvShift))); iVerMin=max(((iTemplateSizeH)<<iBvShift),(yTbCmp–offsetLCBY> >1-nTbH+1)<< iBvShift); iVerMax=(yTbCmp-nTbH)< <iBvShift。

[0332] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search area and / or the pending reconstruction search area to determine the selected full reconstruction search area and / or the selected pending reconstruction search area, a region width threshold and a region height threshold may be first determined based on a size parameter of the current block; and then, region selection is performed on the full reconstruction search area and / or the pending reconstruction search area based on the region width threshold and / or the region height threshold to determine the selected full reconstruction search area and / or the selected pending reconstruction search area.

[0333] It should be noted that, in the embodiments of the present application, the region width threshold and the region height threshold can respectively limit the width and height of the search region after region selection. The region width threshold can be derived using the current block width nTbW, for example, by setting the region width threshold to wIndex times the current block width nTbW; the region height threshold can be derived using the current block height nTbH, for example, by setting the region height threshold to hIndex times the current block height nTbH.

[0334] That is, in the embodiment of the present application, during the region selection process, the search region limit size can also be derived from the current coding block size (the size parameter of the current block). For example, when the width dw of the search region is greater than 2×nTbW, the width of the search region is reduced to ensure that the width dw' of the reduced search region does not exceed wIndex times the width nTbW of the current block; when the width dh of the search region is greater than 2×nTbH, the height of the search region is reduced to ensure that the height dh' of the reduced search region does not exceed hIndex times the height nTbH of the current block.

[0335] For example, in the embodiment of the present application, when regionId is equal to 0, iVerMinregionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId Calculated as follows: iHorMin regionId =(iHorMax+iHorMin) / 2-wIndex×nTbW / 2; iHorMax regionId =(iHorMax+iHorMin) / 2+wIndex×nTbW / 2; iVerMin regionId =(iVerMax+iVerMin) / 2-hIndex×nTbH / 2; iVerMax regionId =(iVerMax+iVerMin) / 2+hIndex×nTbH / 2.

[0336] For example, in the embodiment of the present application, when regionId is equal to 1, 2, 3, or 4, iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId Calculated as follows: iHorMin regionId =iHorMax–wIndex×nTbW; iHorMax regionId =iHorMax; iVerMax regionId =iVerMax-hIndex×nTbH; iVerMin regionId =iVerMin.

[0337] For example, in the embodiment of the present application, when regionId is equal to 5, iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId The calculation is as follows: iHorMax regionId =iHorMin+wIndex×nTbW; iHorMin regionId =iHorMin; iVerMin regionId =iVerMin+hIndex×nTbH; iVerMax regionId =iVerMax.

[0338] Furthermore, in an embodiment of the present application, a search area in the full reconstruction search area, where any pixel point in the reference block corresponding to the search area overlaps with the current coding tree block corresponding to the current block, can be determined as a first overlapping area; at the same time, a search area in the pending reconstruction search area, where any pixel point overlaps with the current coding tree block corresponding to the current block, can be determined as a second overlapping area.

[0339] Correspondingly, in an embodiment of the present application, other areas in the full reconstruction search area outside the first overlapping area can also be determined as the first non-overlapping area; other areas in the pending reconstruction search area outside the second overlapping area can also be determined as the second non-overlapping area.

[0340] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search area and / or the pending reconstruction search area to determine the selected full reconstruction search area and / or the selected pending reconstruction search area, region selection can be performed on the first overlapping area to determine the fourth selected area; then, based on the fourth selected area and the first non-overlapping area, the selected full reconstruction search area is determined; wherein the first non-overlapping area is other areas in the full reconstruction search area outside the first overlapping area.

[0341] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search area and / or the pending reconstruction search area to determine the selected full reconstruction search area and / or the selected pending reconstruction search area, region selection can be performed on the first non-overlapping area to determine the fifth selected area; and then, based on the fifth selected area and the first overlapping area, the selected full reconstruction search area is determined.

[0342] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search area and / or the pending reconstruction search area to determine the selected full reconstruction search area and / or the selected pending reconstruction search area, region selection can be performed on the second overlapping area to determine the sixth selected area; then, the selected pending reconstruction search area is determined based on the sixth selected area and the second non-overlapping area; wherein the second non-overlapping area is other areas in the pending reconstruction search area outside the second overlapping area.

[0343] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search area and / or the pending reconstruction search area to determine the selected full reconstruction search area and / or the selected pending reconstruction search area, region selection can be performed on the second non-overlapping area to determine the seventh selected area; and then, based on the seventh selected area and the second overlapping area, the selected pending reconstruction search area is determined.

[0344] For example, in an embodiment of the present application, it is possible to choose to limit only the areas that overlap with the current CTU (such as the first overlapping area and / or the second overlapping area), while other areas (such as the first non-overlapping area and / or the second non-overlapping area) are not subject to area reduction restrictions.

[0345] For example, in an embodiment of the present application, it is possible to choose to limit only the areas that do not overlap with the current CTU (such as the first non-overlapping area and / or the second non-overlapping area), while other areas (such as the first overlapping area and / or the second overlapping area) are not subject to area reduction restrictions.

[0346] Exemplarily, in an embodiment of the present application, it is also possible to choose to limit areas that do not overlap with the current CTU (such as the first non-overlapping area and / or the second non-overlapping area) and the pending reconstruction search area, while other areas (such as the first overlapping area) are not subject to area reduction restrictions.

[0347] For example, in some embodiments, if the coded unit adjacent to the current unit to be coded (current block) is in Intra TMP mode, its block vector is recorded as BV neighbor , find the upper left corner of the reference block of the adjacent block through the BV, use this point as the search starting point, expand nTbW in the positive and negative directions of the X axis, and expand nTbH in the positive and negative directions of the Y axis. Then, record the area that does not overlap with the full reconstruction search area and the pending reconstruction search area as R7, and then traverse the search points in R7. The specific implementation process is as follows:

[0348] Input: Luma position (xCb, yCb), which specifies the top left corner sample of the current coding block relative to the top left corner luma sample of the current image, a variable cbWidth, which specifies the width of the current coding block in luma samples, a variable cbHeight, which specifies the height of the current coding block in luma samples, a block vector bv, and a variable cIdx, which specifies the color component index of the current block.

[0349] Output: array predSamples of predicted samples.

[0350] When cIdx is equal to 0, that is, the luminance component, for x = xCb..xCb+cbWidth-1 and y = yCb..yCb+cbHeight-1: xVb = (x + (bvL[0]>>4)) & (IbcBufWidthY-1) yVb = (y + (bvL[1]>>4)) & (CtbSizeY-1)

[0351] When cIdx is not equal to 0, that is, when it is a chroma component, for x = xCb / SubWidthC..xCb / SubWidthC+cbWidth / SubWidthC-1 and y = yCb / SubHeightC..yCb / SubHeightC+cbHeight / SubHeightC-1: xVb = (x + (bvC[0]>>4)) & (IbcBufWidthC-1) yVb = (y + (bvC[1]>>4)) & ((CtbSizeY / subHeightC)-1)

[0352] The four boundaries of the R7 region are calculated as follows: iHorMax = min(min((xTbCmp + searchRangeWidth) < <iBvShift,((picWidth-nTbW)<<iBvShift)), xVb+nTbW); iHorMin=max(max((iTemplateSizeW)<<iBvShift,(xTbCmp-searchRangeWidth)<<iBvShift), xVb–iHorMin); iVerMin=max(max(((iTemplateSizeH)<<iBvShift),((yTbCmp-searchRangeHeight)<<iBvShift)), iVerMin+nTbH); iVerMax=min(min(picHeight-nTbH,(yTbCmp-offsetLCBY+CtbSizeH-nTbH)<<iBvShift),iVerMax –nTbH)。

[0353] After obtaining the range of region R7, determine whether R7 overlaps with the existing search area. When at least one of the four boundaries of region R7 falls within any search area Ri (i=0, 1, 2, 3, 4, 5) (i.e., at least one of the following conditions is met), region R7 is determined to overlap with the existing search area. In this case, it is necessary to traverse the non-overlapping parts of region R7 with the existing search area. Otherwise, traverse all search points within the search area R7. iHorMin[regionId]<=iHorMax<=iHorMax[regionId]; iHorMin[regionId]<=iHorMin<=iHorMax[regionId]; iVerMin[regionId]<=iVerMax<=iVerMax[regionId]; iVerMin[regionId]<=iVerMin<=iVerMax[regionId]

[0354] Further, in the embodiments of the present application, when defining the search range of a partial area, different values are taken for the searchRangeWidth and / or searchRangeHeight of this partial area compared with other areas.

[0355] Exemplarily, in some embodiments, when defining the corresponding area of a specific reconstruction search area, the following calculations can be performed:

[0356] When regionId is equal to 4, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: iHorMin = max(max(iTemplateSizeW << iBvShift, (xTbCmp - offsetLCBX - nTbW + 1) << iBvShift), (xTbCmp - searchRangeWidth × scaleFactorW)) << iBvShift); iHorMax = min((xTbCmp - nTbW) << iBvShift,, (picWidth - nTbW) << iBvShift); iVerMin = (yTbCmp + 1) << iBvShift; iVerMax = min(min((picHeight – nTbH) << iBvShift, (yTbCmp - offsetLCBY + CtbSizeH - nTbH) << iBvShift, (yTbCmp + searchRangeHeight × scaleFactorH) << iBvShift)).

[0357] It should be noted that in the embodiments of the present application, scaleFactorW and scaleFactorH can be 1 / 2 or other values.

[0358] It should be noted that in the embodiments of the present application, the multiplication in the above calculation process can be replaced by division or shift operations.

[0359] It should be noted that in the embodiments of the present application, the <<iBvShift operation in the above calculation process can also be a comparison-then-shift operation.

[0360] It should be noted that in the embodiments of the present application, during the determination process of iHorMin, the term (xTbCmp - searchRangeWidth × scaleFactorW)) << iBvShift is added and the maximum value is taken with the existing terms before. Such an operation can be understood as the outer boundary moving closer to the current block.

[0361] It should be noted that in the embodiments of the present application, during the determination process of iVerMax, the term (yTbCmp + searchRangeHeight × scaleFactorH) << iBvShift is added and the minimum value is taken with the existing terms before. Such an operation can be understood as the outer boundary moving closer to the current block.

[0362] Exemplarily, in some embodiments, when limiting the corresponding area of the to-be-determined reconstruction search area, the following calculations can be performed:

[0363] When regionId is equal to 5, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: iHorMin = (xTbCmp + 1) << iBvShift; iHorMax = min(min((xTbCmp - offsetLCBX + CtbSizeW - nTbW) << iBvShift, min((xTbCmp + searchRangeWidth) << iBvShift, ((picWidth - nTbW) << iBvShift))), (xTbCmp + searchRangeWidth × scaleFactorW) << iBvShift)); iVerMin = max(max(((iTemplateSizeH) << iBvShift), (yTbCmp - offsetLCBY - nTbH + 1) << iBvShift, ((yTbCmp - searchRangeHeight × scaleFactorH)) << iBvShift)); iVerMax = (yTbCmp - nTbH) << iBvShift.

[0364] It should be noted that in the embodiments of the present application, scaleFactorW and scaleFactorH can be 1 / 2 or other values.

[0365] It should be noted that in the embodiments of the present application, the multiplication in the above calculation process can be replaced by division or shift operations. <e

[0366] It should be noted that in the embodiments of the present application, the << iBvShift operation in the above calculation process can also be a compare-then-shift operation.

[0367] It should be noted that in the embodiments of the present application, during the determination process of iHorMax, the term (xTbCmp + searchRangeWidth × scaleFactorW) << iBvShift is added and the minimum value is taken with the existing terms before. Such an operation can be understood as the outer boundary approaching the current block.

[0368] It should be noted that in the embodiments of the present application, during the determination process of iVerMin, the term (yTbCmp - searchRangeHeight × scaleFactorH)) << iBvShift is added and the maximum value is taken with the existing terms before. Such an operation can be understood as the outer boundary approaching the current block.

[0369] Further, in the embodiments of the present application, when performing region selection based on the full reconstruction search region and / or the pending reconstruction search region, an operation of appropriately increasing the offset, such as a +1 operation, can be selected on the basis of the already determined iHorMin, iHorMax, iVerMin, and iVerMax.

[0370] Further, in the embodiments of the present application, when performing region selection based on the full reconstruction search region and / or the pending reconstruction search region, an operation of further limiting the selected full reconstruction search region and / or the selected pending reconstruction search region can also be added. For example, the min function is used to control its minimum possible value range, or the max function is used to control its maximum possible value range.

[0371] Step 104: Perform searches in the selected full reconstruction search region and / or the selected pending reconstruction search region respectively to determine one or more block vectors of the current block.

[0372] In the embodiments of the present application, after performing region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine the selected full reconstruction search region and / or the selected pending reconstruction search region, searches can be further performed in the selected full reconstruction search region and / or the selected pending reconstruction search region respectively, so as to determine one or more block vectors of the current block.

[0373] Furthermore, in an embodiment of the present application, when searching in the selected full reconstruction search area and / or the selected pending reconstruction search area to determine one or more block vectors, on the one hand, search points in the selected full reconstruction search area can be traversed, and first matching cost values ​​between matching templates corresponding to the search points in the selected full reconstruction search area and the first template can be determined according to a preset matching criterion; on the other hand, search points in the selected pending reconstruction search area can be traversed, and second matching cost values ​​between matching templates corresponding to search points in the selected pending reconstruction search area that meet preset availability conditions and the first template can be determined according to the preset matching criterion; finally, one or more block vectors and one or more candidate templates corresponding to the one or more block vectors can be determined based on the first matching cost values ​​and the second matching cost values.

[0374] It should be noted that, in the embodiment of the present application, since it is impossible to determine whether the sampling points in the selected pending reconstruction search area are reconstructed sampling points, it is necessary to first determine whether the sampling points in the selected pending reconstruction search area are available.

[0375] It can be understood that in an embodiment of the present application, it is possible to first determine whether the current search point in the selected pending reconstruction search area meets the preset availability conditions; if the current search point meets the preset availability conditions, the second matching cost between the matching template corresponding to the current search point and the first template is determined according to the preset matching criteria.

[0376] Accordingly, in an embodiment of the present application, after determining whether the current search point in the selected pending reconstruction search area meets the preset availability condition, if the current search point does not meet the preset availability condition, the second matching cost value determination process is not executed.

[0377] In some embodiments, the preset available conditions include at least one or more of the following conditions: all sampling points in the matching template of the current search point do not exceed the coordinate range of the sampling point boundary corresponding to the current image; all sampling points in the reconstructed block corresponding to the matching template of the current search point do not exceed the coordinate range of the sampling point boundary corresponding to the current image; all sampling points in the matching template of the current search point do not exceed the preset search window range; all sampling points in the reconstructed block corresponding to the matching template of the current search point do not exceed the preset search window range; all sampling points in the matching template of the current search point and the current coding block are in the same tile; all sampling points in the reconstructed block corresponding to the matching template of the current search point and the current coding block are in the same tile; all sampling points in the matching template of the current search point have been reconstructed; all sampling points in the reconstructed block corresponding to the matching template of the current search point do not belong to the current coding block; all sampling points in the reconstructed block corresponding to the matching template of the current search point have been reconstructed.

[0378] It should be noted that in the embodiments of the present application, the preset matching criteria include any one of the cost functions used to measure the pattern, such as the sum of absolute error SAD, the sum of transformed absolute error SATD, the sum of squared differences SSE, the mean absolute difference MAD, the mean absolute error MAE, the mean squared error MSE, and the normalized correlation coefficient NCC.

[0379] Exemplarily, in an embodiment of the present application, when a block vector is determined by searching, bvYMins and bvYMaxs are used to represent the minimum offset and maximum offset of the block vector in the vertical direction, respectively.

[0380] bvXMinsregionId, bvXMaxsregionId, bvYMinsregionId, and bvYMaxsregionId can be calculated using the already determined iVerMinregionId, iVerMaxregionId, iHorMinregionId, and iHorMaxregionId: bvXMinsregionId = iHorMinregionId - xTbCmp; bvXMaxsregionId = iHorMaxregionId - xTbCmp; bvYMinsregionId = iVerMinregionId - yTbCmp; bvYMaxsregionId = iVerMaxregionId - yTbCmp;

[0381] bvXMinsregionId, bvXMaxsregionId, bvYMinsregionId, and bvYMaxsregionId determine the horizontal and vertical offset ranges of the search point relative to the current block, that is, the range of the block vector BV.

[0382] Exemplarily, in an embodiment of the present application, when searching in the selected full reconstruction search area, through the search points (iPosHor, iPoxVer) within each search area, that is, each block vector BV (composed of horizontal and vertical components: (pX, pY), where pX = iPosHor-xTbCmp, pY = iPosVer-yTbCmp, then pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs), one or more matching reconstructed blocks of the current block can be found in the reconstruction area, and the adjacent reconstructed pixels of the one or more matching reconstructed blocks are the matching templates. Thus, the first matching cost of the adjacent template of the current block and the adjacent template of the one or more reconstructed blocks can be calculated respectively, which is recorded as pDiff.

[0383] Exemplarily, in an embodiment of the present application, when searching in the selected pending reconstruction search area, the availability of each block vector BV (composed of a horizontal component and a vertical component: (pX, pY), where pX = iPosHor-xTbCmp, pY = iPosVer-yTbCmp, then pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs) is judged through the search points (iPosHor, iPoxVer) in each search area; if available, one or more matching reconstructed blocks of the current block can be found in the reconstruction area, and the adjacent reconstructed pixels of the matching reconstructed blocks are the matching templates, thereby calculating the second matching cost of the adjacent template of the current block and the adjacent template of the reconstructed block, which is also recorded as pDiff; if unavailable, the template matching cost calculation is not performed.

[0384] Illustratively, in an embodiment of the present application, the availability judgment includes but is not limited to one or more of the following conditions being met simultaneously: each sampling point in the template does not exceed the valid coordinate range limited by the image sampling point boundary; each sampling point in the reconstructed block corresponding to the template does not exceed the valid coordinate range limited by the image sampling point boundary; each sampling point in the template and each sampling point in the corresponding reconstructed block do not exceed the specified range of the search window; whether each sampling point in the template is in the same tile as the current coding region; whether each sampling point in the reconstructed block corresponding to the template is in the same tile as the current coding region; each sampling point in the template has been reconstructed; each sampling point in the reconstructed block corresponding to the template is not in the current coding region; and each sampling point in the reconstructed block corresponding to the template has been reconstructed.

[0385] In some embodiments, the preset availability conditions may further include at least one or more of the following conditions: the first identified sampling points in the matching template of the current search point do not exceed the coordinate range of the sampling point boundary corresponding to the current image; the second identified sampling points in the reconstructed block corresponding to the matching template of the current search point do not exceed the coordinate range of the sampling point boundary corresponding to the current image; the first identified sampling points in the matching template of the current search point do not exceed the preset search window range; the second identified sampling points in the reconstructed block corresponding to the matching template of the current search point do not exceed the preset search window range; the first identified sampling points in the matching template of the current search point and the current coding block are in the same tile; the second identified sampling points in the reconstructed block corresponding to the matching template of the current search point and the current coding block are in the same tile; the first identified sampling points in the matching template of the current search point have all been reconstructed; the second identified sampling points in the reconstructed block corresponding to the matching template of the current search point do not belong to the current coding block; and the second identified sampling points in the reconstructed block corresponding to the matching template of the current search point have all been reconstructed.

[0386] It should be noted that, in the embodiment of the present application, the first identified sampling point is one or more sampling points in the matching template of the current search point; the second identified sampling point is one or more sampling points in the reconstructed block corresponding to the matching template of the current search point.

[0387] That is, when determining the availability of a search point in the selected pending reconstruction search area, all sampling points in the matching template corresponding to the search point are no longer traversed and determined, but the availability of the search point is determined by the identified sampling point in the matching template. Correspondingly, all sampling points in the reconstructed block corresponding to the matching template of the search point are no longer traversed and determined, but the availability of the search point is determined by the identified sampling point in the reconstructed block.

[0388] It is understood that in the embodiments of the present application, the first identification sampling point can be any one or more sampling points in the matching template. For example, the first identification sampling point can be one or more sampling points located at corner positions in the matching template, such as the upper left and lower right sampling points of the upper template region when only the upper template is present, or only the lower right sampling point.

[0389] It will be appreciated that, in the embodiments of the present application, the second identified sampling point is any one or more sampling points in the reconstructed block corresponding to the matching template of the current search point. For example, the second identified sampling point may be one or more sampling points located at corner positions in the reconstructed block, such as the sampling points at the upper left and lower right corners of the reconstructed block region, or only the sampling point at the lower right corner of the reconstructed block region.

[0390] Furthermore, in an embodiment of the present application, when determining the availability of search points in the selected pending reconstruction search area, based on the above-mentioned preset availability conditions, the first identified sampling points are traversed in descending order of priority. If the current first identified sampling point does not meet the preset availability conditions, the traversal is stopped and it is determined that the current search point does not meet the preset availability conditions. If the current first identified sampling point meets the preset availability conditions, the traversal continues to the next first identified sampling point. If all first identified sampling points meet the preset availability conditions, it is determined that the current search point meets the preset availability conditions.

[0391] Furthermore, in an embodiment of the present application, when determining the availability of search points in the selected pending reconstruction search area, based on the above-mentioned preset availability conditions, the second identified sampling points are traversed in descending order of priority. If the current second identified sampling point does not meet the preset availability conditions, the traversal is stopped and it is determined that the current search point does not meet the preset availability conditions. If the current second identified sampling point meets the preset availability conditions, the traversal continues to the next second identified sampling point. If all second identified sampling points meet the preset availability conditions, it is determined that the current search point meets the preset availability conditions.

[0392] That is, in the embodiments of the present application, multiple identification sampling points can be used sequentially. For example, the upper left corner sampling point is first determined to be available. If not, the result is "unavailable." If available, the lower right corner sampling point is then determined to be available. If not, the result is "unavailable." If available, the result is "available." The upper left corner sampling point has a higher priority than the lower right corner sampling point.

[0393] It should be noted that, in the embodiment of the present application, the number of block vectors determined by the search process may be one or more. For example, N block vectors of the current block may be determined, where N is an integer greater than 0.

[0394] Accordingly, in an embodiment of the present application, when searching the selected full reconstruction search area and / or the selected pending reconstruction search area to determine one or more block vectors, a preset number N corresponding to candidate templates may be first determined; then, the search points in the selected full reconstruction search area are traversed, and first matching cost values ​​between matching templates corresponding to the search points in the selected full reconstruction search area and the first template are determined according to a preset matching criterion; simultaneously, the search points in the selected pending reconstruction search area are traversed, and second matching cost values ​​between matching templates corresponding to search points in the selected pending reconstruction search area that meet a preset availability condition and the first template are determined according to the preset matching criterion; finally, N block vectors and N candidate templates corresponding to the N block vectors may be determined based on the first matching cost values ​​and the second matching cost values.

[0395] That is, in an embodiment of the present application, when searching and determining N block vectors corresponding to N matching templates in the selected full reconstruction search area and / or the selected pending reconstruction search area, respectively, the process of searching and determining the block vectors BV corresponding to N matching templates in the search area (the selected full reconstruction search area and / or the selected pending reconstruction search area) may include determining the value of the number N of candidate templates, determining a matching template comparison criterion, and recording the N block vectors BV corresponding to the N matching templates (the selected N candidate templates).

[0396] It is understandable that in the embodiment of the present application, when determining the preset number N corresponding to the candidate template, N can be determined by decoding the code stream; N can also be determined according to a first preset value; or N can be determined according to a preset value range.

[0397] That is, in the embodiments of the present application, the value of N must first be determined. Here, N can be a preset constant, such as 4. N can also be within a certain numerical range, such as any integer in [2, 8]. The range of N is preset, and the optimal N value can be determined at the encoding end by using cost 1 coarse selection, cost 2 coarse selection, or cost 3 coarse selection, cost 4 fine selection, etc., and the optimal N value is transmitted to the decoding end in the form of a bitstream. Among them, costs 1, 2, 3, and 4 can be one of the cost functions used to measure the mode, such as SAD, SATD, MSE, MAD, and RDO. This application does not specifically limit the method for determining N.

[0398] Furthermore, in an embodiment of the present application, when determining N block vectors and N candidate templates corresponding to the N block vectors based on the first matching cost value and the second matching cost value, that is, when determining one or more block vectors and one or more candidate templates corresponding to the one or more block vectors, N minimum matching cost values ​​among the first matching cost value and the second matching cost value can be determined first; and then, based on the N search points corresponding to the N minimum matching cost values, N block vectors and N candidate templates corresponding to the N block vectors are determined.

[0399] Among the matching cost values ​​between the matching template corresponding to the search point in the selected full reconstruction search area and the first template, N minimum matching cost values ​​are determined; and then N block vectors and N candidate templates corresponding to the N minimum matching cost values ​​are determined.

[0400] In some embodiments, all available search points in all search ranges (e.g., regionId = 0, 1, 2, 3, 4, 5) are traversed and compared to obtain the N search points with the smallest matching costs pDiff (including the first matching cost value and the second matching cost value). The corresponding matching costs are recorded as pDiff_BEST[n], n = 0, ..., N-1, and the corresponding block vectors BV are recorded as the best block vectors BV_BEST[n]. Each entry is a coordinate pair (pX_BEST, pY_BEST), n = 0, ..., N-1, and the corresponding matching template is the best matching template T_BEST[n], n = 0, ..., N-1. Wherein, N can be an integer value of 1 or greater as needed.

[0401] It should be noted that in an embodiment of the present application, when performing search processing, the search strategies that can be adopted may include but are not limited to search methods based on different search step sizes, for example, a coarse search based on a first search step size and / or a fine search based on a second search step size, wherein the first search step size is larger than the second search step size.

[0402] In some embodiments, the first search step size and the second search step size can be any value greater than 0, and can be an integer value or a non-integer value, as long as the first search step size is greater than the second search step size. For example, the first search step size can be 3, and the second search step size can be 1 / 2.

[0403] Furthermore, in an embodiment of the present application, it is possible to select a first search step size and perform searches in the selected full reconstruction search area and / or the selected pending reconstruction search area, respectively, to determine a first matching cost value corresponding to a search point in the selected full reconstruction search area and a second matching cost value corresponding to a search point in the selected pending reconstruction search area that meets a preset availability condition, and determine N block vectors and N candidate templates corresponding to the N block vectors based on the first cost value and the second cost value.

[0404] Exemplarily, in an embodiment of the present application, the coarse search may specifically include: determining the best coarse matching template in the search area with a first preset step size (i.e., the first search step size, for example, 2), that is, obtaining the final candidate template, or, using a downsampled template (for example, a downsampling factor of 2) to determine the best coarse matching template in the search area, that is, obtaining the final candidate template.

[0405] For example, in an embodiment of the present application, if the search strategy is to perform only a coarse search, then within each region, a coarse search may be performed with a larger step size (first search step size) (e.g., a step size of 2 or 3) within the search range where pX is between bvXMinsregionId and bvXMaxsregionId and pY is between bvYMinsregionId and bvYMaxsregionId. The top N best matching costs obtained by template matching are recorded as pDiff_BEST[n], where n=0, ..., N-1, and the corresponding block vector BV is recorded as the best block vector BV_BEST[n], where each item is a coordinate pair (pX_BEST, pY_BEST), where n=0, ..., N-1. N can be an integer value of 1 or greater as needed.

[0406] Furthermore, in an embodiment of the present application, it is possible to select a second search step size and perform searches in the selected full reconstruction search area and / or the selected pending reconstruction search area, respectively, to determine a first matching cost value corresponding to a search point in the selected full reconstruction search area and a second matching cost value corresponding to a search point in the selected pending reconstruction search area that meets a preset availability condition, and determine N block vectors and N candidate templates corresponding to the N block vectors based on the first cost value and the second cost value; wherein the first search step size is greater than the second search step size.

[0407] Exemplarily, in an embodiment of the present application, the fine search may specifically include: determining the best fine matching template in the search area with a second preset step size (i.e., the second search step size, for example, 1), that is, obtaining the final candidate template, or, determining the best fine matching template near the best coarse matching template after completing the coarse search, that is, obtaining the final candidate template.

[0408] For example, in an embodiment of the present application, if the search strategy is to perform only a fine search, then within each region, within the search range where pX is between bvXMinsregionId and bvXMaxsregionId and pY is between bvYMinsregionId and bvYMaxsregionId, a fine search may be performed with a smaller step size (second search step size) (e.g., a step size of 1 or 1 / 2; when the step size is less than 1, sub-pixel interpolation is required). The top N best matching costs obtained by template matching are recorded as pDiff_BEST[n], where n=0, ..., N-1, and the corresponding block vector BV is recorded as the best block vector BV_BEST[n], where each item is a coordinate pair (pX_BEST, pY_BEST), where n=0, ..., N-1. N may be an integer value of 1 or greater as needed.

[0409] Furthermore, in an embodiment of the present application, a search may be performed in the selected full reconstruction search area and / or the selected pending reconstruction search area, respectively, according to a first search step size, to determine first matching cost values ​​corresponding to search points in the selected full reconstruction search area and second matching cost values ​​corresponding to search points in the selected pending reconstruction search area that meet preset availability conditions. M reference block vectors and M matching reconstructed blocks corresponding to the M reference block vectors are determined based on the first and second matching cost values, where M is an integer greater than 0. A first search area is then determined based on the M matching reconstructed blocks, where the first search area is smaller than the total area formed by the selected full reconstruction search area and / or the selected pending reconstruction search area. A search may then be performed in the first search area according to a second search step size to determine third matching cost values ​​between matching templates corresponding to search points in the first search area that meet preset availability conditions and the first template, where the first search step size is greater than the second search step size. Finally, N block vectors and N candidate templates corresponding to the N block vectors are determined based on the first matching cost values, the second matching cost values, and / or the third matching cost values.

[0410] It can be understood that in the embodiments of the present application, when determining N block vectors and N candidate templates corresponding to the N block vectors based on the first matching cost value, the second matching cost value, and / or the third matching cost value, the N minimum matching cost values ​​among the third matching cost values ​​can be determined first; and then, based on the N search points corresponding to the N minimum matching cost values, the N block vectors and the N candidate templates corresponding to the N block vectors can be determined.

[0411] It can be understood that in the embodiments of the present application, when determining N block vectors and N candidate templates corresponding to the N block vectors based on the first matching cost value, the second matching cost value, and / or the third matching cost value, it is also possible to first determine T block vectors and T candidate templates corresponding to the T block vectors based on the third matching cost value; where T is an integer greater than 0 and less than N; and based on the first cost value and the second cost value, determine NT block vectors other than the M reference block vectors and NT candidate templates corresponding to the NT block vectors.

[0412] It should be noted that, in the embodiment of the present application, after performing a coarse search, P initial block vectors can be determined based on the first-generation value and the second-generation value; where P is an integer greater than or equal to M; and then M reference block vectors are determined based on the P initial block vectors.

[0413] For example, in an embodiment of the present application, if the search strategy is to perform a coarse search first and then a fine search, a coarse search record template matching can be performed with a step size of 2 (i.e., a first search step size of 2) to obtain the best coarse matching template (initial matching template), and then a step size of 1 (i.e., a second search step size of 1) can be used to determine the best fine matching template near the best coarse matching template, thereby obtaining the final candidate template.

[0414] In the coarse search phase, a coarse search can be performed with a larger step size (e.g., 2 or 3) within each region, where pX is between bvXMinsregionId and bvXMaxsregionId, and pY is between bvYMinsregionId and bvYMaxsregionId. For example, a coarse search with a step size of 2 is performed, recording the top P best matching costs obtained from template matching as pDiff1_BEST[p], where p = 0, ..., P-1, and the corresponding block vector BV is recorded as the best block vector BV1_BEST[p], where p = 0, ..., P-1. P can be an integer value of 1 or greater as needed, and the search region where the best matching search point is located is bestRegionId[p], where p = 0, ..., P-1. As required by the algorithm, the coarse search phase will provide one or more (here, M, where 1 <= M <= P) fine search reference points and send them to the next step. For example, M = 1.

[0415] Next, in the fine search phase, the best block vector BV1_BEST[p], p=0, ..., M-1, obtained in the coarse search can be selected as the search point near the fine search reference point. Specifically, for each fine search reference point, the refinement search range TmpRefineRangeHor and TmpRefineRangeVer are first determined. The refinement search range can be a fixed size or can be related to the coding block size. For example, the above TmpRefineRangeHor and TmpRefineRangeVer can be set to min(nTbW, nTbH) / 2. Then, the position of the best matching reconstructed block obtained in the coarse search is calculated as the reference position of the fine search area: BestPosX=xTbCmp+pX1_BEST, BestPosY=yTbCmp+pY1_BEST.

[0416] In one embodiment, the search window can be directly used to treat the fine search area as a whole selected pending reconstruction search area, and directly traverse:

[0417] The new search range is obtained according to the optimal matching block position obtained by the rough search, which are: iHorMaxrefine = min(picWidth-nTbW, BestPosX+TmpRefineRangeHor) iHorMinrefine = max(iTemplateSizeW, BestPosX-TmpRefineRangeHor) iVerMaxrefine = min(picHeight-nTbH, BestPosY+TmpRefineRangeVer) iVerMinrefine = max(iTemplateSizeH, BestPosY-TmpRefineRangeVer).

[0418] Then, the adjusted block vectors BVbvXMins, bvXMaxs, bvYMins, bvYMaxs can be calculated by iVerMinrefine, iVerMaxrefine, iHorMinrefine, iHorMaxrefine: bvXMins=iHorMinrefine-xTbCmp; bvXMaxs=iHorMaxrefine-xTbCmp; bvYMins=iVerMinrefine-yTbCmp; bvYMaxs=iVerMaxrefine-yTbCmp;

[0419] The refined search is performed within the block vector range where pX is between bvXMinsrefine and bvXMaxsrefine, and pY is between bvYMinsrefine and bvYMaxsrefine. This means that all search positions within the refined search window are directly traversed, and availability is determined sequentially. For example, a search is performed with a step size of 1. The top T optimal matching costs obtained from the available point template matching are recorded as pDiff_BEST[t], t = 0, ..., T-1, and the corresponding block vector BV is recorded as the best block vector BV_BEST[t], t = 0, ..., T-1. T is an integer of 1 or greater. For example, T = 1.

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

[0421] It should be noted that in the embodiments of the present application, the results of the coarse and fine selection processes can be combined to produce different block vector selection schemes. For example, the first N block vectors can be selected after fully sorting by template cost. Another example is selecting the T fine search results (obtained from the first M coarse search results) exiting from the M coarse search, followed by the (NT)th block vector from the M+1th coarse search. In practice, for example, M = 1, T = 1, N = 5; or M = 1, T = 1, N = 3.

[0422] It can be seen that in the embodiment of the present application, the process of searching and determining one or more block vectors in the search area may include three search strategies: only coarse search, only fine search, and coarse search first and then fine search.

[0423] Furthermore, in an embodiment of the present application, after determining one or more block vectors corresponding to the current block, one or more reference blocks of the current block can be further determined based on the one or more block vectors, and then the prediction value of the current block can be determined based on the one or more reference blocks.

[0424] Furthermore, in an embodiment of the present application, when determining one or more reference blocks corresponding to a current block based on one or more block vectors, one or more initial reconstructed blocks corresponding to the current block can be first determined based on the one or more block vectors; then, the one or more initial reconstructed blocks can be corrected to determine one or more reference blocks.

[0425] That is to say, in the embodiment of the present application, other methods may be used to obtain N candidate reconstructed blocks (reference blocks), for example, first correcting the initial reconstructed block corresponding to the obtained candidate template, and then determining the corresponding reference block.

[0426] Correspondingly, after obtaining N candidate reconstructed blocks (reference blocks) by copying N BV corresponding matching reconstructed blocks (initial reconstructed blocks), these N candidate reconstructed blocks can be directly weighted to obtain the predicted value of the current block; or the candidate reconstructed blocks (reference blocks) obtained after correcting the N BV corresponding matching reconstructed blocks (initial reconstructed blocks) can be weighted again to obtain the predicted value of the current block.

[0427] Furthermore, in an embodiment of the present application, when performing correction processing on one or more initial reconstructed blocks to determine one or more reference blocks, filtering processing may be performed on the one or more initial reconstructed blocks to determine one or more reference blocks.

[0428] Furthermore, in an embodiment of the present application, when performing correction processing on one or more initial reconstructed blocks to determine one or more reference blocks, one or more correction parameter vectors can be first determined based on one or more candidate templates corresponding to one or more block vectors; then, the one or more initial reconstructed blocks can be corrected based on the one or more correction parameter vectors to determine one or more reference blocks.

[0429] Furthermore, in an embodiment of the present application, when determining one or more correction parameter vectors based on one or more candidate templates corresponding to one or more block vectors, the autocorrelation matrix corresponding to the candidate template can be first determined based on the pixel values ​​in the candidate template; then, the cross-correlation vector can be determined based on the pixel values ​​in the first template and the pixel values ​​in the candidate template; and then, the correction parameter vector can be determined based on the autocorrelation matrix and the cross-correlation vector.

[0430] It can be understood that in an embodiment of the present application, the scheme for correcting the initial reconstructed block may include directly filtering the initial reconstructed block, wherein the filtering scheme adopted when performing the processing may be a traditional filtering method, such as bilateral filtering, mean filtering, etc., or it may be a filtering enhancement based on a neural network.

[0431] It is understandable that, in the embodiment of the present application, the solution of correcting the initial reconstructed block may further include correcting the matching reconstructed block (initial reconstructed block) using matching template information (candidate template).

[0432] Furthermore, in an embodiment of the present application, a prediction value of a current block may be determined based on one or more block vectors. Specifically, an optimal block vector of the current block may be first determined based on one or more block vectors of the current block; then, at least one reference block corresponding to the current block may be determined based on the optimal block vector; and finally, a prediction value of the current block may be determined based on the at least one reference block.

[0433] It should be noted that, in an embodiment of the present application, when determining the prediction value of the current block based on at least one reference block, it is possible to first determine the prediction value of the current block based on at least one prediction block corresponding to the at least one reference block; then, weighted fusion is performed on the at least one prediction block to determine the prediction value of the current block.

[0434] Exemplarily, in some embodiments, after determining the best block vector of the current block, multiple points can be taken around the best block vector, that is, multiple reference blocks are obtained, and then the corresponding prediction values ​​of the multiple points are weightedly fused to obtain the prediction value of the current block.

[0435] Furthermore, in an embodiment of the present application, a prediction value of the current block can be determined based on one or more block vectors. Specifically, a first prediction value of the current block can be determined based on one or more block vectors of the current block; then a second prediction value of the current block can be determined based on a preset prediction mode; wherein the preset prediction mode includes a planar mode and / or a directional mode; finally, the prediction value of the current block can be determined based on the first prediction value and the second prediction value.

[0436] For example, in some embodiments, after determining one or more block vectors for the current block, a weighted combination of prediction values ​​obtained using the one or more block vectors and prediction values ​​obtained using other intra modes can be performed to obtain a final prediction value. Other intra modes can be prediction modes other than IntraTMP, such as Planar mode or Directional mode. The Directional mode can be derived from TIMD or located in the Intra candidate table using an index transmitted in the bitstream. This method can be referred to as the IntraTMP CIIP mode.

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

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

[0439] It should be noted that, in the embodiment of the present application, the code stream may be decoded first to determine the prediction residual corresponding to the current block; and then the reconstructed value of the current block may be further determined based on the prediction residual and the prediction value of the current block.

[0440] In summary, the decoding method proposed in steps 101 to 104 can effectively utilize the reconstruction sampling points spatially adjacent to the current coding region while reducing the size of the search area, thereby improving prediction accuracy while ensuring coding complexity.

[0441] That is to say, the embodiment of the present application proposes a method for limiting the IntraTMP search area by region. By specifically limiting the search area at different positions, the reconstructed sampling points that are relatively close to the current unit to be encoded are retained, which improves the prediction accuracy to a certain extent and ensures the coding complexity.

[0442] It should be noted that the decoding method proposed in the embodiment of the present application is a method for narrowing the Intra TMP search area by region. Specifically, by narrowing the search area in different locations, the algorithm is ensured to be effective while taking into account the complexity, thereby effectively improving the coding efficiency.

[0443] The Intra TMP-BV function takes as input the position (xTbCmp, yTbCmp) of the current coding block (current block), the width (nTbW) of the current coding block, and the height (nTbH) of the current coding block. The Intra TMP-BV function outputs one or more BVs for the current block and the corresponding prediction block prediction values ​​(predSamples[x][y]), where x = 0..nTbW-1 and y = 0..nTbH-1. These prediction block prediction values ​​can be used as the final prediction values ​​or further processed to obtain the final prediction value for the current block.

[0444] It is understood that the specific process for acquiring the intra TMP-BV proposed in this embodiment is divided into three steps: determining the current template type, acquiring the reconstructed pixels of the current template, and determining the block vector within a predefined search range. For each acquired BV, a set of predicted values ​​for the current block can be obtained.

[0445] In an embodiment of the present application, the search range may include a selected full reconstruction search area and / or a selected to-be-reconstructed search area obtained after performing area selection based on the full reconstruction search area and / or the to-be-reconstructed search area, wherein the full reconstruction search area includes reconstructed sampling points, and the to-be-reconstructed search area includes reconstructed sampling points and / or unreconstructed sampling points.

[0446] An embodiment of the present application provides a decoding method, wherein a decoder determines a first template corresponding to a current block; determines a full reconstruction search area and / or a to-be-determined reconstruction search area based on the first template; wherein the full reconstruction search area includes reconstructed sampling points, and the to-be-determined reconstruction search area includes reconstructed sampling points and / or unreconstructed sampling points; performs area selection based on the full reconstruction search area and / or the to-be-determined reconstruction search area, and determines a selected full reconstruction search area and / or a selected to-be-determined reconstruction search area; wherein the selected full reconstruction search area is smaller than or equal to the full reconstruction search area, and the selected to-be-determined reconstruction search area is smaller than or equal to the to-be-determined reconstruction search area; and performs searches in the selected full reconstruction search area and / or the selected to-be-determined reconstruction search area to determine one or more block vectors of the current block. Thus, in the embodiments of the present application, after determining the full reconstruction search area and / or the pending reconstruction search area including the reconstructed sampling points and / or the unreconstructed sampling points according to the first template, the full reconstruction search area and / or the pending reconstruction search area can be subjected to region selection processing to obtain a relatively small selected full reconstruction search area and / or selected pending reconstruction search area, and the search is then performed in the selected full reconstruction search area and / or selected pending reconstruction search area. In other words, the encoding and decoding method proposed in the embodiments of the present application can utilize the available sampling points in the pending reconstruction search area while limiting the search range to a certain extent. This can reduce the complexity of encoding and decoding while fully acquiring more effective reference information, thereby improving encoding and decoding efficiency and performance.

[0447] An embodiment of the present application provides an encoding method, which is applied to an encoder. FIG27 is a flow chart of the encoding method provided in the embodiment of the present application. As shown in FIG27 , the encoding method performed by the encoder may include the following steps:

[0448] Step 201: Determine the first template corresponding to the current block.

[0449] In an embodiment of the present application, the first template corresponding to the current block may be determined first. When acquiring the first template, the template type corresponding to the current block may be determined first, and then the first template corresponding to the current block may be further determined based on the template type.

[0450] It should be noted that the encoding method of the embodiment of the present application is applied to an encoder. In addition, the encoding method may include an intra-frame prediction method, more specifically, a color component prediction method. The video image can be divided into multiple coding blocks, each coding block may include a first color component, a second color component, and a third color component, and the current block in the embodiment of the present application refers to the coding block in the video image that is currently to be intra-frame predicted.

[0451] Here, when the first color component needs to be predicted, the component to be predicted is the first color component; when the second color component needs to be predicted, the component to be predicted is the second color component; when the third color component needs to be predicted, the component to be predicted is the third color component. In addition, assuming that the current block predicts the first color component and the first color component is the luminance component, that is, the component to be predicted is the luminance component, then the current block can also be called a luminance block; or assuming that the current block predicts the second color component and the second color component is the chrominance component, that is, the component to be predicted is the chrominance component, then the current block can also be called a chrominance block.

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

[0453] Furthermore, in an embodiment of the present application, the template type of the current block may be determined based on indication information in the code stream; or the template type of the current block may be determined based on the size of the current block.

[0454] Furthermore, in an embodiment of the present application, the template type of the current block can be determined based on the reference pixels of the current block, wherein the reference pixels of the current block include at least one of the following: the left adjacent reference pixels of the current block, the upper adjacent reference pixels of the current block, the upper left adjacent reference pixels of the current block, the lower left adjacent reference pixels of the current block, and the upper right adjacent reference pixels of the current block.

[0455] It is understandable that in the embodiment of the present application, the reference pixels of the current block may include the adjacent reconstructed pixels of the current block, that is, the adjacent reconstructed pixels of the current block may be selected as a template to search for a matching template in a predefined search area.

[0456] It should be noted that, in an embodiment of the present application, the reference pixels of the current block, that is, the adjacent reconstructed pixels of the current block may include the upper reference pixel, the upper left reference pixel, the upper right reference pixel, the left reference pixel and the lower left reference pixel of the current block.

[0457] It can be understood that in the embodiment of the present application, when the template type of the current block is determined using the reference pixels of the current block, the template type can be classified and determined according to whether the adjacent reference pixels are available.

[0458] It is understandable that, in the embodiment of the present application, when determining the template type of the current block, the template type may be classified and determined according to an indication in the code stream.

[0459] Further, in an embodiment of the present application, when determining the template type of the current block based on the reference pixels of the current block, if the left adjacent reference pixels of the current block, the upper adjacent reference pixels of the current block and the upper-left adjacent reference pixels of the current block are all available, the template type of the current block is determined to be a first value; if the left adjacent reference pixels of the current block are available, the template type of the current block is determined to be a second value; if the upper adjacent reference pixels of the current block are available, the template type of the current block is determined to be a third value; if the left adjacent reference pixels of the current block and the upper-left adjacent reference pixels of the current block are both available, the template type of the current block is determined to be a fourth value; if the left adjacent reference pixels of the current block and the lower-left adjacent reference pixels of the current block are both available, the template type of the current block is determined to be a fifth value; if the upper adjacent reference pixels of the current block and the upper-right adjacent reference pixels of the current block are both available, the template type of the current block is determined to be a sixth value.

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

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

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

[0463] In some embodiments, the IntraTMP template type can be selected based on the aforementioned reference pixel availability information and instructions in the bitstream. For example, a sequence number for each template type can be agreed upon, and the actual template sequence number information used can be transmitted in the bitstream, so that the template type can be determined at the decoding end.

[0464] That is, in the embodiments of the present application, the template type can be determined based on the availability information of the reference pixels of the current block, or based on information indicated in the bitstream, or based on a combination of the availability information of the reference pixels and information indicated in the bitstream. This application does not make any specific limitations.

[0465] Furthermore, in an embodiment of the present application, when determining the first template corresponding to the current block based on the template type, the template reference pixels of the current block can be determined first based on the template type and the template size corresponding to the template type, and then the first template of the current block can be determined based on the template reference pixels.

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

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

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

[0469] Accordingly, in an embodiment of the present application, by combining the value of the template type refTemplateType of the current block and the template size corresponding to the refTemplateType, it is possible to determine which part of the reconstructed pixels to obtain as the template reference pixels of the current block, and then determine the corresponding first template.

[0470] Exemplarily, in an embodiment of the present application, when the value of refTemplateType is 1, you can choose to obtain the left, upper left and upper reconstructed pixels of the current block; when the value of refTemplateType is 2, only the left 4 columns of reconstructed pixels of the current block are obtained; when the value of refTemplateType is 3, only the upper 4 rows of reconstructed pixels of the current coding block are obtained.

[0471] Of course, the value of the preset template size can be any integer greater than 0, and is not limited to 4, and this application does not make any specific limitation on this.

[0472] It can be understood that in the embodiment of the present application, in combination with the template type and the corresponding template size of the current block, the template reference pixel of the current block determined from the reference pixels of the current block can be the first template corresponding to the current block.

[0473] Step 202 : Determine a full reconstruction search area and / or a pending reconstruction search area according to the first template; wherein the full reconstruction search area includes reconstructed sampling points, and the pending reconstruction search area includes reconstructed sampling points and / or unreconstructed sampling points.

[0474] In an embodiment of the present application, after determining the first template corresponding to the current block, a full reconstruction search area and / or a pending reconstruction search area may be further determined based on the first template; wherein the full reconstruction search area includes reconstructed sampling points, and the pending reconstruction search area includes reconstructed sampling points and / or unreconstructed sampling points.

[0475] It is understood that in the embodiments of the present application, during the Intra TMP prediction process, the search area selected based on the first template may include a pending reconstruction search area and / or a full reconstruction search area. The full reconstruction search area may include only reconstructed sampling points, i.e., all sampling points in the full reconstruction search area are reconstructed sampling points. However, for the pending reconstruction search area, it is uncertain whether the sampling points in the pending reconstruction search area have been reconstructed. In other words, the pending reconstruction search area may include only reconstructed sampling points, only unreconstructed sampling points, or both reconstructed and unreconstructed sampling points.

[0476] Accordingly, in the process of traversing the search area to be reconstructed, it is necessary to increase the availability of each search position so as to fully utilize the information of all adjacent reconstructed sampling points.

[0477] It should be noted that, in an embodiment of the present application, the full reconstruction search area and / or the pending reconstruction search area can be determined based on the first template, with the zero-value block vector as the center, according to the size of the search window and the position information of the current image.

[0478] That is to say, in the embodiment of the present application, the search area is near the zero value BV, or it can be said that the search area is centered on the zero value BV and is constrained by information such as the size of the search window and the edge of the image.

[0479] Furthermore, in an embodiment of the present application, the full reconstruction search area is a search area including a set of positions corresponding to the upper left corner pixel point of the reference block at each search position; the pending reconstruction search area is a search coverage area including a set of pixels corresponding to the reference block at each search position.

[0480] That is, in the embodiments of this application, the search area refers to the set of positions corresponding to the upper-left pixel of the reference block at each search position; this area may not involve unreconstructed sampling points. Regarding the pending reconstruction search area, this is because the lower-right pixel of the reference block corresponding to each search position in this area is located in the upper-right or lower-left area of ​​the current coding block and may not have been reconstructed.

[0481] Accordingly, in an embodiment of the present application, the search area may be a set of pixels to the upper left of the search point, and the search coverage area includes a set of pixels of reference blocks corresponding to all search points.

[0482] It should be noted that, in an embodiment of the present application, the block vector search process may include an initialization process, determining a search area of ​​the first template in the current frame, searching and determining one or a pair of optimal block vectors in the search area. Therefore, when performing the search process, the initialization operation needs to be completed first.

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

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

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

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

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

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

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

[0490] Furthermore, the preset search range of the template is initialized. The preset search range of the template can be set to a fixed size or dynamically adjusted according to the coding 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 can be a preset value, can be indicated by a bitstream syntax element, or can be adaptively adjusted according to information such as the coding block size, for example, set to 5.

[0491] Furthermore, in an embodiment of the present application, when determining one or more block vectors corresponding to the current block according to the first template, a full reconstruction search area can be first determined according to the first template; then a search can be performed within the full reconstruction search area to determine one or more block vectors.

[0492] It should be noted that in the embodiments of this application, the search area is the reconstructed portion of the current image and is limited by the size of the search range. As shown in Figure 6 above, the dark-filled background area is the reconstructed area, the black-filled background block is the current block, and the dashed box is the search range window. Therefore, the search area of ​​the IntraTMP technology is no larger than the overlap between the reconstructed area represented by the dark background and the area indicated by the dashed box.

[0493] As can be seen, the search area for the current block template can be the reconstructed portion of the CTB where the current block resides, or it can be another reconstructed CTB area. The search area here is actually the set of all search points. Because the shape of this area is often not representable by a single rectangular region, in practice, multiple rectangular regions can be searched, and the search results from these different regions can be combined to obtain the final best matching block and best block vector.

[0494] For example, in some embodiments, the reconstructed area within the dotted box in FIG6 is processed by region, and the upper, lower, left, and right boundaries of each area are determined. Then, a search is performed in multiple rectangular areas, and the search results of different areas are combined to obtain the final optimal matching module and the optimal block vector.

[0495] For example, see Figure 13, which illustrates four different sub-region division methods. As shown in Figure 13, the black-filled background block is the current block. Methods (a), (b), (c), and (d) all divide the search area into four sub-search areas, with different fill patterns representing each sub-search area. Methods (a), (b), (c), and (d) consider the entire available search range.

[0496] For example, assuming that different search regions are represented by regionId, considering that the current coding block template pixels need to be obtained in the image reconstruction region and the reconstructed block pixels corresponding to the template also need to be obtained in the reconstruction region, it is necessary to further determine the positions that can be searched within the search regions represented by different regionIds based on the position of the current coding block (xTbCmp, yTbCmp), the size of the current coding block (nTbW, nTbH), the size of the current image (picWidth, picHeight), the size of the CTB where the current coding block is located (CtbSizeW, CtbSizeH), the preset search range of the template (searchRangeWidth, searchRangeHeight), and the position offset of the current coding block within the current CTB (offsetLCBY, offsetLCBX), thereby determining the block vector BV. Specifically, iVerMin and iVerMax represent the absolute coordinate positions that can be searched at least and at most in the vertical direction, respectively, and iHorMin and iHorMax represent the absolute coordinate positions that can be searched at least and at most in the horizontal direction. The values ​​of iVerMin, iVerMax, iHorMin, and iHorMax are different in the search areas represented by different regionIds.

[0497] Furthermore, in an embodiment of the present application, the search area can be divided based on the shape of the reconstruction area and the certainty of the reconstructed pixels, which can balance computational complexity and coding efficiency. For example, the CTB area encoded before the CTB where the current block is located, and the areas located to the upper left, directly left, and directly above the current coding block within the CTB where the current coding block is located are all areas that are determined to be reconstructed. Therefore, such areas where it is certain that all sampling points contained therein have been reconstructed are selected as full reconstruction search areas. Correspondingly, within the CTB where the current coding block is located, the areas located to the lower left and upper right of the current coding block are areas that may or may not be reconstructed. Therefore, such areas where it is not certain that all sampling points contained therein have been reconstructed are determined as pending reconstruction search areas.

[0498] In some embodiments, based on considerations of the full reconstruction search area and the pending reconstruction search area, taking (a) in FIG. 13 as an example, the search area is divided into six sub-search areas, which are implemented as follows:

[0499] When regionId is equal to 0, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: 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))。

[0500] When regionId is equal to 1, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: 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)。

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

[0502] When regionId is equal to 3, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: 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。

[0503] When regionId is equal to 4, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: iHorMin = (xTbCmp - offsetLCBX - nTbW) < <iBvShift; iHorMax=(xTbCmp-nTbW)<<iBvShift; iVerMin=(yTbCmp+1)<<iBvShift; iVerMax=min((picHeight–nTbH)<<iBvShift,(yTbCmp-offsetLCBY+CtbSizeH-nTbH)<<iBvShift)。

[0504] When regionId is equal to 5, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: iHorMin = (xTbCmp) < <iBvShift; iHorMax=min((xTbCmp+CtbSizeW-nTbW)<<iBvShift,min((xTbCmp+searchRangeWidth)<< iBvShift,((picWidth-nTbW)<<iBvShift))); iVerMin=max(((iTemplateSizeH)<<iBvShift),(yTbCmp-offsetLCBY-nTbH+1)<<iBvShift); iVerMax=(yTbCmp-nTbH)<<iBvShift。

[0505] In practical applications, the iHorMin regionId 、iHorMax regionId 、iVerMin regionId 、iVerMax regionId Represent the left edge, right edge, top edge and bottom edge of different sub-search areas respectively.

[0506] To visually illustrate the different sub-search regions corresponding to different regionIds, Figure 14 shows the second schematic diagram of the search region determination process. As shown in Figure 14, R1, R2, R3, R4, R5, and R6 represent six different sub-search regions. R1, R2, R3, and R4 are the full reconstruction search regions, while R5 and R6 are the pending reconstruction search regions. Note that Figure 14 represents the pixel range aligned with the top-left corner pixel of the block.

[0507] That is, in some embodiments, the search area can be divided into two types: one is a region in which all sampling points have been reconstructed (referred to as a full reconstruction search area), for example, including the four regions R1, R2, R3, and R4 in FIG14 ; the other is a region in which it is uncertain whether all sampling points have been reconstructed (referred to as a pending reconstruction search area), for example, including the two regions R5 and R6 in FIG14 .

[0508] Furthermore, in an embodiment of the present application, in order to achieve a smaller number of search areas and thus reduce the amount of code, part of the full reconstruction search area and part of the pending reconstruction search area can be selectively merged to form a new pending reconstruction search area, thereby reducing the number of search areas.

[0509] In some embodiments, the full reconstruction search area and / or the pending reconstruction search area may be merged and updated to determine an updated full reconstruction search area and an updated pending reconstruction search area; wherein a first total number of areas of the updated full reconstruction search area and the updated pending reconstruction search area is less than a second total number of areas of the full reconstruction search area and / or the pending reconstruction search area.

[0510] That is, in the embodiment of the present application, the initially specified pending reconstruction search area is relatively large, and the total number of areas is relatively small.

[0511] For example, in an embodiment of the present application, for the four full reconstruction search regions R1, R2, R3, and R4 and the two pending reconstruction search regions R5 and R6 in FIG13 , R2 and R5 can be merged to form a new pending reconstruction search region. The updated full reconstruction search region includes R1, R3, and R4, and the updated pending reconstruction search region includes R6 and the new pending reconstruction search region consisting of R2 and R5.

[0512] For example, in an embodiment of the present application, for the four full reconstruction search regions R1, R2, R3, and R4 and the two pending reconstruction search regions R5 and R6 in FIG13 , R4 and R6 can be merged to form a new pending reconstruction search region. The updated full reconstruction search region includes R1, R2, and R3, and the updated pending reconstruction search region includes R5 and the new pending reconstruction search region consisting of R4 and R6.

[0513] Step 203: Perform region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine a selected full reconstruction search region and / or a selected pending reconstruction search region; wherein the selected full reconstruction search region is smaller than or equal to the full reconstruction search region, and the selected pending reconstruction search region is smaller than or equal to the pending reconstruction search region.

[0514] In an embodiment of the present application, after determining a search area based on the first template, that is, determining a full reconstruction search area and / or a pending reconstruction search area, region selection can be further performed based on the full reconstruction search area and / or the pending reconstruction search area, thereby determining a corresponding selected full reconstruction search area and / or selected pending reconstruction search area.

[0515] It should be noted that, in the embodiments of the present application, area selection is performed based on the full reconstruction search area and / or the pending reconstruction search area, which can be understood as narrowing and restricting the full reconstruction search area and / or the pending reconstruction search area, thereby narrowing the scope of the search area for the final search and reducing the encoding and decoding complexity.

[0516] Accordingly, in an embodiment of the present application, after region selection is performed based on the full reconstruction search region and / or the pending reconstruction search region, it is determined that the selected full reconstruction search region is smaller than or equal to the full reconstruction search region, and it is determined that the selected pending reconstruction search region is smaller than or equal to the pending reconstruction search region.

[0517] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search region and / or the pending reconstruction search region, the full reconstruction search region may be determined as the selected full reconstruction search region; and simultaneously, region selection may be performed on the pending reconstruction search region to determine the selected pending reconstruction search region.

[0518] That is, in the embodiment of the present application, it is possible to choose to narrow down and limit only the pending reconstruction search area, thereby obtaining a corresponding selected pending reconstruction search area, and the selected pending reconstruction search area and the full reconstruction search area constitute the final search area.

[0519] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search region and / or the pending reconstruction search region, region selection may be performed on the full reconstruction search region to determine the selected full reconstruction search region; and simultaneously, the pending reconstruction search region may be determined as the selected pending reconstruction search region.

[0520] That is, in the embodiment of the present application, it is possible to choose to narrow down and restrict only the full reconstruction search area, thereby obtaining a corresponding selected full reconstruction search area, and the selected full reconstruction search area and the pending reconstruction search area constitute the final search area.

[0521] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search region and / or the pending reconstruction search region, region selection can be performed on the full reconstruction search region to determine the selected full reconstruction search region; and simultaneously, region selection can be performed on the pending reconstruction search region to determine the selected pending reconstruction search region.

[0522] That is, in an embodiment of the present application, the full reconstruction search area and the pending reconstruction search area can be simultaneously narrowed and restricted, thereby obtaining a corresponding selected full reconstruction search area and a selected pending reconstruction search area, and the selected full reconstruction search area and the selected pending reconstruction search area constitute the final search area.

[0523] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search region and / or the pending reconstruction search region, the full reconstruction search region may be determined as the selected full reconstruction search region; and the pending reconstruction search region may be determined as the selected pending reconstruction search region.

[0524] That is, in the embodiment of the present application, it is possible to choose not to reduce or restrict the full reconstruction search area and the pending reconstruction search area, but to directly form the final search area by the full reconstruction search area and the pending reconstruction search area.

[0525] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine the selected full reconstruction search region and / or the selected pending reconstruction search region, a narrowing parameter may be first determined; then, region selection may be performed on the full reconstruction search region and / or the pending reconstruction search region based on the narrowing parameter to finally determine the selected full reconstruction search region and / or the selected pending reconstruction search region.

[0526] It should be noted that, in the embodiment of the present application, the limiting parameters may include a height limiting parameter hIndex and a width limiting parameter wIndex, wherein both the height limiting parameter hIndex and the width limiting parameter wIndex are greater than or equal to 1.

[0527] For example, in some embodiments, for search points within a search area, all search points within the specified search area may be traversed, or a local search range may be limited in various ways to balance computational complexity and coding efficiency. For example, the width of the search range may be limited to 1 / wIndex, and the height may be limited to 1 / hIndex, where wIndex and hIndex are both arbitrary values ​​greater than or equal to 1.

[0528] It should be noted that, in an embodiment of the present application, a compression parameter can be determined and written into the bitstream. The compression parameter is transmitted via any one of the following syntax information: SPS layer syntax information, PPS layer syntax information, APS layer syntax information, SH layer syntax information, and CU layer syntax information.

[0529] It should be noted that, in the embodiment of the present application, the limiting parameter may also be determined according to a preset value, for example, wIndex and hIndex are both 2.

[0530] That is to say, in the embodiment of the present application, the limitation parameter for limiting the size of the search area can be transmitted through the SPS layer syntax, or through the PPS layer syntax, the APS layer syntax, or the SH layer syntax, the CU layer syntax, etc.

[0531] It should be noted that, in the embodiments of the present application, different methods may be used to select regions for different search regions, that is, different search regions may correspond to different narrowing strategies.

[0532] Furthermore, in an embodiment of the present application, a search area in the full reconstruction search area that is located above the current block can be determined as a first initial area; a search area in the full reconstruction search area that is located to the left or upper left of the current block can be determined as a second initial area; a search area in the pending reconstruction search area that is located to the lower left of the current block can be determined as a third initial area; and a search area in the pending reconstruction search area that is located to the upper right of the current block can be determined as a fourth initial area.

[0533] For example, in some embodiments, as shown in FIG14 , R1, R2, R3, R4, R5, and R6 represent six different sub-search regions, where R1, R2, R3, and R4 are full reconstruction search regions, and R5 and R6 are pending reconstruction search regions. Based on the positional relationship between each sub-search region and the current block, search region R1 in the full reconstruction search region and located above the current block can be determined as the first initial region; search regions R2, R3, and R4 in the full reconstruction search region and located to the left or upper left of the current block can be determined as the second initial region; search region R5 in the pending reconstruction search region and located to the lower left of the current block can be determined as the third initial region; and search region R6 in the pending reconstruction search region and located to the upper right of the current block can be determined as the fourth initial region.

[0534] Furthermore, in an embodiment of the present application, when performing area selection on the full reconstruction search area and / or the pending reconstruction search area according to the limitation parameter and determining the selected full reconstruction search area and / or the selected pending reconstruction search area, a first selected area can be determined in the first initial area according to the limitation parameter and the position information of the first initial area; wherein the first selected area is any area in the first initial area; and then the selected full reconstruction search area is determined based on the first selected area.

[0535] It can be understood that in an embodiment of the present application, for the search area on the upper side of the current block, such as R1, after obtaining the four boundaries iHorMin, iHorMax, iVerMin, and iVerMax of the search area (first initial area), the search area can be cropped and limited using the limitation parameters wIndex and hIndex, so as to obtain the first selected area.

[0536] It should be noted that in the embodiments of the present application, for the search area above the current block, such as R1, the narrowed first selected area can be any area within the first initial area. That is, the first selected area can be a sub-area in different directions within the first initial area, such as above, below, left, right, or center, and this application does not impose any specific restrictions.

[0537] Exemplarily, in some embodiments, Figure 15 is a schematic diagram of region selection 1. As shown in Figure 15, for the search area on the upper side of the current block, such as R1, if the values ​​of the limiting parameters wIndex and hIndex are both 1, then the first selected area obtained after region selection of the first initial area using the limiting parameters wIndex and hIndex is the corresponding first initial area.

[0538] Exemplarily, in some embodiments, Figure 16 is a second schematic diagram of area selection. As shown in Figure 16, for the search area on the upper side of the current block, such as R1, if the value of the limitation parameter wIndex is 2 and the value of hIndex is 1, then the first selected area obtained after area selection of the first initial area using the limitation parameters wIndex and hIndex is the middle area of ​​the corresponding first initial area.

[0539] Exemplarily, in some embodiments, Figure 17 is a third schematic diagram of area selection. As shown in Figure 17, for the search area on the upper side of the current block, such as R1, if the value of the limitation parameter wIndex is 1 and the value of hIndex is 2, then the first selected area obtained after area selection of the first initial area using the limitation parameters wIndex and hIndex is the middle area of ​​the corresponding first initial area.

[0540] Exemplarily, in some embodiments, Figure 18 is a fourth schematic diagram of area selection. As shown in Figure 18, for the search area on the upper side of the current block, such as R1, if the value of the limitation parameter wIndex is 2 and the value of hIndex is 2, then the first selected area obtained after area selection of the first initial area using the limitation parameters wIndex and hIndex is the middle area of ​​the corresponding first initial area.

[0541] For example, in some embodiments, when regionId is equal to 0, such as R1 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the first selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId Calculated as follows: iHorMin regionId =iHorMin+(iHorMax-iHorMin) / (2×wIndex); iHorMax regionId =iHorMax-(iHorMax-iHorMin) / (2×wIndex); iVerMin regionId =iVerMin+(iVerMax-iVerMin) / (2×hIndex); iVerMax regionId =iVerMax-(iVerMax-iVerMin) / (2×hIndex).

[0542] It is understood that in the embodiment of the present application, when selecting a region based on the narrowing parameter, the division involved can be implemented by right shifting. For example, when wIndex is set to 2, the same result can be achieved by using the >> 1 operation.

[0543] Furthermore, in an embodiment of the present application, when performing area selection on the full reconstruction search area and / or the pending reconstruction search area according to the narrowing parameter and determining the selected full reconstruction search area and / or the selected pending reconstruction search area, a second selected area can be determined in the second initial area according to the narrowing parameter and the position information of the second initial area; wherein the second selected area is any area in the second initial area; and then the selected full reconstruction search area is determined based on the second selected area.

[0544] Furthermore, in an embodiment of the present application, when performing area selection on the full reconstruction search area and / or the pending reconstruction search area according to the narrowing parameter and determining the selected full reconstruction search area and / or the selected pending reconstruction search area, a third selected area can be determined in the third initial area according to the narrowing parameter and the position information of the third initial area; wherein the third selected area is any area in the third initial area; and then the selected full reconstruction search area is determined based on the third selected area.

[0545] It can be understood that in the embodiments of the present application, for the search area on the left side, upper left side, or lower left side of the current block, such as R2, R3, R4, and R5, after obtaining the four boundaries iHorMin, iHorMax, iVerMin, and iVerMax of the search area (the second initial area or the third initial area), the search area can be cropped and limited using the limitation parameters wIndex and hIndex, so as to obtain the second (or third) selected area.

[0546] It should be noted that in the embodiments of the present application, for the search area on the left, upper left, or lower left side of the current block, such as R2, R3, R4, and R5, the narrowed second (or third) selected area can be any area in the second (or third) initial area. That is, the second (or third) selected area can be a sub-area in different directions such as the upper, lower, left, right, or center of the second (or third) initial area, and this application does not specifically limit this.

[0547] Exemplarily, in some embodiments, Figure 19 is a schematic diagram five of area selection. As shown in Figure 19, for the search area on the left side, upper left side, or lower left side of the current block, such as R2, R3, R4, and R5, if the values ​​of the limiting parameters wIndex and hIndex are both 1, then the first selected area obtained after performing area selection on the first initial area using the limiting parameters wIndex and hIndex is the corresponding first initial area.

[0548] Exemplarily, in some embodiments, Figure 20 is a sixth schematic diagram of area selection. As shown in Figure 20, for the search area on the left side, upper left side, or lower left side of the current block, such as R2, R3, R4, and R5, if the value of the limitation parameter wIndex is 2 and the value of hIndex is 1, then the first selected area obtained after area selection of the first initial area using the limitation parameters wIndex and hIndex is the right area of ​​the corresponding first initial area.

[0549] Exemplarily, in some embodiments, Figure 21 is a schematic diagram seven of area selection. As shown in Figure 21, for the search area on the left side, upper left side, or lower left side of the current block, such as R2, R3, R4, and R5, if the value of the limitation parameter wIndex is 1 and the value of hIndex is 2, then the first selected area obtained after area selection of the first initial area using the limitation parameters wIndex and hIndex is the upper area of ​​the corresponding first initial area.

[0550] Exemplarily, in some embodiments, Figure 22 is a schematic diagram eight of area selection. As shown in Figure 22, for the search area on the left side, upper left side, or lower left side of the current block, such as R2, R3, R4, and R5, if the value of the limitation parameter wIndex is 2 and the value of hIndex is 2, then the first selected area obtained after area selection of the first initial area using the limitation parameters wIndex and hIndex is the upper right area of ​​the corresponding first initial area.

[0551] For example, in some embodiments, when regionId is equal to 1, 2, or 3, such as R2, R3, and R4 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the second selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iHorMin regionId 、iHorMax regionId Calculated as follows: iHorMin regionId =iHorMax-(iHorMax-iHorMin) / wIndex; iHorMax regionId =iHorMax.

[0552] For example, in some embodiments, when regionId is equal to 1, 2, or 3, such as R2, R3, and R4 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the second selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iHorMin regionId 、iHorMax regionId Calculated as follows: iHorMin regionId =iHorMin+(iHorMax-iHorMin) / wIndex; iHorMax regionId =iHorMax.

[0553] For example, in some embodiments, when regionId is equal to 1, 2, or 3, such as R2, R3, and R4 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the second selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iHorMin regionId 、iHorMax regionId The calculation is as follows:

[0554] When wIndex is 2, iHorMin regionId =(iHorMax+iHorMin) / wIndex; iHorMax regionId =iHorMax.

[0555] For example, in some embodiments, when regionId is equal to 1, 2, or 3, such as R2, R3, and R4 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the second selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iVerMin regionId 、iVerMax regionId The calculation is as follows: iVerMin regionId =iVerMin; iVerMax regionId =iVerMax-(iVerMax-iVerMin) / hIndex.

[0556] For example, in some embodiments, when regionId is equal to 1, 2, or 3, such as R2, R3, and R4 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the second selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iVerMin regionId 、iVerMax regionId The calculation is as follows: iVerMin regionId =iVerMin; iVerMax regionId =iVerMin+(iVerMax-iVerMin) / hIndex.

[0557] For example, in some embodiments, when regionId is equal to 1, 2, or 3, such as R2, R3, and R4 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the second selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iVerMin regionId 、iVerMax regionId The calculation is as follows: iVerMin regionId =iVerMin;

[0558] When hIndex is 2, iVerMax regionId =(iVerMax+iVerMin) / hIndex.

[0559] For example, in some embodiments, when regionId is equal to 4, such as R5 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the third selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iHorMin regionId 、iHorMax regionId Calculated as follows: iHorMin regionId =iHorMax-(iHorMax-iHorMin) / wIndex; iHorMax regionId =iHorMax.

[0560] For example, in some embodiments, when regionId is equal to 4, such as R5 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the third selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iHorMin regionId 、iHorMax regionId Calculated as follows: iHorMin regionId =iHorMin+(iHorMax-iHorMin) / wIndex; iHorMax regionId =iHorMax.

[0561] For example, in some embodiments, when regionId is equal to 4, such as R5 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the third selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iHorMin regionId 、iHorMax regionId The calculation is as follows:

[0562] When wIndex is 2, iHorMin regionId =(iHorMax+iHorMin) / wIndex;

[0563] iHorMax regionId =iHorMax.

[0564] For example, in some embodiments, when regionId is equal to 4, such as R5 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the third selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iVerMin regionId 、iVerMax regionId The calculation is as follows: iVerMin regionId =iVerMin; iVerMax regionId =iVerMax-(iVerMax-iVerMin) / hIndex.

[0565] For example, in some embodiments, when regionId is equal to 4, such as R5 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the third selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iVerMin regionId 、iVerMax regionId The calculation is as follows: iVerMin regionId =iVerMin; iVerMax regionId =iVerMin+(iVerMax-iVerMin) / hIndex.

[0566] For example, in some embodiments, when regionId is equal to 4, such as R5 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the third selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iVerMin regionId 、iVerMax regionId The calculation is as follows: iVerMin regionId =iVerMin;

[0567] When hIndex is 2, iVerMax regionId =(iVerMax+iVerMin) / hIndex.

[0568] It is understandable that, in the embodiment of the present application, for the search area on the left side, upper left side, or lower left side of the current block, such as R2, R3, R4, and R5, when performing area selection on the second (or third) initial area, it is possible to select only the right half of the second (or third) initial area, then determine wIndex to be 2, iHorMin regionId =(iHorMax+iHorMin) / wIndexiHorMin, and set iHorMax at the same time regionId =iHorMax, iVerMin regionId =iVerMin, iVerMax regionId =iVerMax.

[0569] It is understandable that in the embodiment of the present application, for the search area on the left side, upper left side, or lower left side of the current block, such as R2, R3, R4, and R5, when performing area selection on the second (or third) initial area, it is possible to select only the upper half of the second (or third) initial area, then determine hIndex to be 2, and iVerMax regionId =(iVerMax+iVerMin) / hIndex, and set iHorMin at the same time regionId =iHorMin, iHorMax regionId =iHorMax, iVerMin regionId =iVerMin.

[0570] It is understood that in the embodiment of the present application, when selecting a region based on the narrowing parameter, the division involved can be implemented by right shifting. For example, when wIndex is set to 2, the same result can be achieved by using the >> 1 operation.

[0571] Furthermore, in an embodiment of the present application, when performing area selection on the full reconstruction search area and / or the pending reconstruction search area according to the limitation parameters and determining the selected full reconstruction search area and / or the selected pending reconstruction search area, a fourth selected area can be determined in the fourth initial area according to the limitation parameters and the position information of the fourth initial area; wherein the fourth selected area is any area in the fourth initial area; and then the selected pending reconstruction search area is determined based on the fourth selected area.

[0572] It can be understood that in an embodiment of the present application, for the search area on the upper right side of the current block, such as R6, after obtaining the four boundaries iHorMin, iHorMax, iVerMin, and iVerMax of the search area (the fourth initial area), the search area can be cropped and limited using the limitation parameters wIndex and hIndex, so as to obtain the fourth selected area.

[0573] It should be noted that in the embodiment of the present application, for the search area on the upper right side of the current block, such as R6, the narrowed fourth selected area can be any area within the fourth initial area. That is, the fourth selected area can be a sub-area in different directions such as the upper, lower, left, right, or center of the fourth initial area, and this application does not impose any specific restrictions.

[0574] Exemplarily, in some embodiments, Figure 23 is a ninth schematic diagram of region selection. As shown in Figure 23, for the search area on the upper right side of the current block, such as R6, if the values ​​of the limiting parameters wIndex and hIndex are both 1, then the fourth selected area obtained after region selection of the fourth initial area using the limiting parameters wIndex and hIndex is the corresponding fourth initial area.

[0575] Exemplarily, in some embodiments, Figure 24 is a schematic diagram of area selection ten. As shown in Figure 24, for the search area on the upper right side of the current block, such as R6, if the value of the limitation parameter wIndex is 2 and the value of hIndex is 1, then the fourth selected area obtained after area selection of the fourth initial area using the limitation parameters wIndex and hIndex is the left area of ​​the corresponding fourth initial area.

[0576] Exemplarily, in some embodiments, Figure 25 is a schematic diagram eleven of area selection. As shown in Figure 25, for the search area on the upper right side of the current block, such as R6, if the value of the limitation parameter wIndex is 1 and the value of hIndex is 2, then the fourth selected area obtained after area selection of the fourth initial area using the limitation parameters wIndex and hIndex is the lower area of ​​the corresponding fourth initial area.

[0577] Exemplarily, in some embodiments, Figure 26 is a schematic diagram 12 of area selection. As shown in Figure 26, for the search area on the upper right side of the current block, such as R6, if the value of the limitation parameter wIndex is 2 and the value of hIndex is 2, then the fourth selected area obtained after area selection of the fourth initial area using the limitation parameters wIndex and hIndex is the lower left area of ​​the corresponding fourth initial area.

[0578] For example, in some embodiments, when regionId is equal to 5, such as R6 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the first selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iHorMin regionId 、iHorMax regionId The calculation is as follows: iHorMax regionId =iHorMin+(iHorMax-iHorMin) / wIndex; iHorMin regionId =iHorMin.

[0579] For example, in some embodiments, when regionId is equal to 5, such as R6 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the first selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iHorMin regionId 、iHorMax regionId The calculation is as follows: iHorMax regionId =iHorMax-(iHorMax-iHorMin) / wIndex; iHorMin regionId =iHorMin.

[0580] For example, in some embodiments, when regionId is equal to 5, such as R6 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the first selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iHorMin regionId 、iHorMax regionId The calculation is as follows:

[0581] When wIndex is 2, iHorMax regionId =(iHorMax+iHorMin) / wIndex; iHorMin regionId =iHorMin.

[0582] For example, in some embodiments, when regionId is equal to 5, such as R6 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the first selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iVerMin regionId 、iVerMax regionId The calculation is as follows: iVerMin regionId =iVerMin+(iVerMax-iVerMin) / hIndex; iVerMax regionId =iVerMax.

[0583] For example, in some embodiments, when regionId is equal to 5, such as R6 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the first selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iVerMin regionId 、iVerMax regionId The calculation is as follows: iVerMin regionId =iVerMax-(iVerMax-iVerMin) / hIndex; iVerMax regionId =iVerMax.

[0584] For example, in some embodiments, when regionId is equal to 5, such as R6 in FIG14 , the four boundaries after defining the search area, that is, the four boundaries of the first selected area, can be set to iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId , then, iVerMin regionId 、iVerMax regionId The calculation is as follows:

[0585] When hIndex is 2, iVerMin regionId =(iVerMax+iVerMin) / hIndex; iVerMax regionId =iVerMax.

[0586] It is understandable that in the embodiment of the present application, for the search area on the upper right side of the current block, such as R6, when performing area selection on the fourth initial area, it is possible to select only the left half of the fourth initial area, then determine wIndex to be 2, iHorMax regionId =(iHorMax+iHorMin) / wIndex, and set iHorMin at the same time regionId =iHorMin, iVerMin regionId =iVerMin, iVerMax regionId =iVerMax.

[0587] It is understandable that in the embodiment of the present application, for the search area on the upper right side of the current block, such as R6, when performing area selection on the fourth initial area, it is possible to select only the lower half of the fourth initial area, then determine hIndex to be 2, iVerMin regionId =(iVerMax+iVerMin) / hIndex, and set iHorMin at the same time regionId =iHorMin, iHorMax regionId =iHorMax, iVerMax regionId =iVerMax.

[0588] It is understood that in the embodiment of the present application, when selecting a region based on the narrowing parameter, the division involved can be implemented by right shifting. For example, when wIndex is set to 2, the same result can be achieved by using the >> 1 operation.

[0589] It can be seen that in the embodiments of the present application, for any sub-search area in the full reconstruction search area and / or the pending reconstruction search area, after obtaining the four boundaries iHorMin, iHorMax, iVerMin, iVerMax of the search area. When wIndex≠1 and / or hIndex≠1 are satisfied, the search area can be cropped according to the narrowing parameter. For example, in Figure 14, for the area Ri (i=2, 3, 4, 5), the search range is the area to the right or upper right of the Ri area, and the four schemes for limiting the search range are shown in Figures 19-22. For the area R6, the search range is the area to the left or lower left of the R6 area, and the four schemes for limiting the search range are shown in Figures 23-26. For the area R1, the middle position of the original search area can be taken, and the four schemes for limiting the search range are shown in Figures 15-18.

[0590] That is, in the embodiments of the present application, for search points within a search area, all search points within the specified search area can be traversed, or different schemes can be used to limit the search range to a local search range, so as to balance computational complexity and coding efficiency. For example, for the pending reconstruction search area (corresponding to the two areas R5 and R6 in Figure 14) or the full reconstruction area (corresponding to the four areas R1 to R4 in Figure 14), the width of the search range can be limited to the original 1 / wIndex, and the height can be limited to the original 1 / hIndex, where wIndex and hIndex are both arbitrary positive integers greater than or equal to 1.

[0591] It is understood that in the embodiments of the present application, the limited search range, i.e., the selected full reconstruction search area and / or the selected pending reconstruction search area, can be an area closer to the unit to be encoded (current block). For example, when narrowing the search range of the R5 area, the width of the R5 search area can be reduced to 1 / 2 of the original width, and the final search range can be the upper right 1 / 4 area of ​​the R5 area, as shown in Figure 22.

[0592] In summary, in the embodiments of the present application, different methods can be used to select different search areas. Specifically, the search areas can be divided into three categories based on their relative position to the reference block (e.g., left side of the current block to be encoded, top side of the current block to be encoded, top right side of the current block to be encoded), and Intra TMP search area restrictions can be applied to each of the three search areas.

[0593] It will be appreciated that in embodiments of the present application, after determining the full reconstruction search area and / or the pending reconstruction search area based on the first template, region selection can be performed based on the full reconstruction search area and / or the pending reconstruction search area to obtain a selected full reconstruction search area and / or a selected pending reconstruction search area. Alternatively, during the process of determining the full reconstruction search area and / or the pending reconstruction search area, the range of the full reconstruction search area and / or the pending reconstruction search area can be directly set. Specifically, the search area size of the full reconstruction search area and / or the pending reconstruction search area can be directly limited to the search area size of the selected full reconstruction search area and / or the selected pending reconstruction search area in the above-described solution.

[0594] For example, in some embodiments, when calculating the search area, a weight term or a clip operation may be added to the current formula. For example, only the right half of the R5 area is taken:

[0595] When regionId is equal to 4, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: iHorMin = max(iTemplateSizeW<<iBvShift,(xTbCmp–offsetLCBX> >1–nTbW+1)<< iBvShift); iHorMax=min((xTbCmp-nTbW)< <iBvShift,(picWidth-nTbW)<<iBvShift); iVerMin=(yTbCmp+1)<<iBvShift; iVerMax=min((picHeight–nTbH)<<iBvShift,(yTbCmp-offsetLCBY+CtbSizeH-nTbH)<< iBvShift)。

[0596] For example, in some embodiments, when calculating the search area, a weight term or a clip operation may be added to the current formula. For example, only the upper 1 / 2 of the R5 area is taken:

[0597] When regionId is equal to 4, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: iHorMin = max(iTemplateSizeW< <iBvShift,(xTbCmp–offsetLCBX–nTbW+1)<<iBvShift); iHorMax=min((xTbCmp-nTbW)<<iBvShift,(picWidth-nTbW)<<iBvShift); iVerMin=(yTbCmp+1)<<iBvShift; iVerMax=min((picHeight–nTbH)<<iBvShift,(yTbCmp–offsetLCBY+CtbSizeH> >1-nTbH) < <iBvShift)。

[0598] For example, in some embodiments, when calculating the search area, a weight term or a clip operation may be added to the current formula. For example, only the left half of the R6 area is taken:

[0599] When regionId is equal to 5, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: iHorMin = (xTbCmp + 1) < <iBvShift; iHorMax=min((xTbCmp-offsetLCBX+CtbSizeW-nTbW)<<iBvShift,min((xTbCmp+ searchRangeWidth> >1)< <iBvShift,((picWidth-nTbW)<<iBvShift))); iVerMin=max(((iTemplateSizeH)<<iBvShift),(yTbCmp-offsetLCBY-nTbH+1)<< iBvShift); iVerMax=(yTbCmp-nTbH)<<iBvShift。

[0600] For example, in some embodiments, when calculating the search area, a weight term or a clip operation may be added to the current formula. For example, only the lower 1 / 2 area of ​​the R6 area is taken:

[0601] When regionId is equal to 5, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: iHorMin = (xTbCmp + 1) < <iBvShift; iHorMax=min((xTbCmp-offsetLCBX+CtbSizeW-nTbW)<<iBvShift,min((xTbCmp+ searchRangeWidth)<<iBvShift,((picWidth-nTbW)<<iBvShift))); iVerMin=max(((iTemplateSizeH)<<iBvShift),(yTbCmp-offsetLCBY> >1-nTbH+1)<< iBvShift); iVerMax=(yTbCmp-nTbH)< <iBvShift。

[0602] For example, in some embodiments, when calculating the search area, a weight term or a clip operation may be added to the current formula. For example, only the upper right 1 / 4 area of ​​the R5 area is taken:

[0603] When regionId is equal to 4, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: iHorMin = max(iTemplateSizeW<<iBvShift,(xTbCmp–offsetLCBX> >1–nTbW+1)< <iBvShift); iHorMax=min((xTbCmp-nTbW)<<iBvShift,(picWidth-nTbW)<<iBvShift); iVerMin=(yTbCmp+1)<<iBvShift; iVerMax=min((picHeight–nTbH)<<iBvShift,(yTbCmp+(CtbSizeH-offsetLCBY)> >1- nTbH)< <iBvShift)。

[0604] For example, in some embodiments, when calculating the search area, a weight term or a clip operation may be added to the current formula. For example, only the lower left 1 / 4 area of ​​the R6 area is taken:

[0605] When regionId is equal to 5, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: iHorMin = (xTbCmp + 1) < <iBvShift; iHorMax=min((xTbCmp–offsetLCBX+CtbSizeW-nTbW)<<iBvShift,min((xTbCmp+ searchRangeWidth> >1)< <iBvShift,((picWidth-nTbW)<<iBvShift))); iVerMin=max(((iTemplateSizeH)<<iBvShift),(yTbCmp–offsetLCBY> >1-nTbH+1)<< iBvShift); iVerMax=(yTbCmp-nTbH)< <iBvShift。

[0606] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search area and / or the pending reconstruction search area to determine the selected full reconstruction search area and / or the selected pending reconstruction search area, a region width threshold and a region height threshold may be first determined based on a size parameter of the current block; and then, region selection is performed on the full reconstruction search area and / or the pending reconstruction search area based on the region width threshold and / or the region height threshold to determine the selected full reconstruction search area and / or the selected pending reconstruction search area.

[0607] It should be noted that, in the embodiments of the present application, the region width threshold and the region height threshold can respectively limit the width and height of the search region after region selection. The region width threshold can be derived using the current block width nTbW, for example, by setting the region width threshold to wIndex times the current block width nTbW; the region height threshold can be derived using the current block height nTbH, for example, by setting the region height threshold to hIndex times the current block height nTbH.

[0608] That is, in the embodiment of the present application, during the region selection process, the search region limit size can also be derived from the current coding block size (the size parameter of the current block). For example, when the width dw of the search region is greater than 2×nTbW, the width of the search region is reduced to ensure that the width dw' of the reduced search region does not exceed wIndex times the width nTbW of the current block; when the width dh of the search region is greater than 2×nTbH, the height of the search region is reduced to ensure that the height dh' of the reduced search region does not exceed hIndex times the height nTbH of the current block.

[0609] For example, in the embodiment of the present application, when regionId is equal to 0, iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId Calculated as follows: iHorMin regionId =(iHorMax+iHorMin) / 2-wIndex×nTbW / 2; iHorMax regionId =(iHorMax+iHorMin) / 2+wIndex×nTbW / 2; iVerMin regionId =(iVerMax+iVerMin) / 2-hIndex×nTbH / 2; iVerMax regionId =(iVerMax+iVerMin) / 2+hIndex×nTbH / 2.

[0610] For example, in the embodiment of the present application, when regionId is equal to 1, 2, 3, or 4, iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId Calculated as follows: iHorMin regionId =iHorMax–wIndex×nTbW; iHorMax regionId =iHorMax; iVerMax regionId=iVerMax-hIndex×nTbH; iVerMin regionId =iVerMin.

[0611] For example, in the embodiment of the present application, when regionId is equal to 5, iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId The calculation is as follows: iHorMax regionId =iHorMin+wIndex×nTbW; iHorMin regionId =iHorMin; iVerMin regionId =iVerMin+hIndex×nTbH; iVerMax regionId =iVerMax.

[0612] Furthermore, in an embodiment of the present application, a search area in the full reconstruction search area, where any pixel point in the reference block corresponding to the search area overlaps with the current coding tree block corresponding to the current block, can be determined as a first overlapping area; at the same time, a search area in the pending reconstruction search area, where any pixel point overlaps with the current coding tree block corresponding to the current block, can be determined as a second overlapping area.

[0613] Correspondingly, in an embodiment of the present application, other areas in the full reconstruction search area outside the first overlapping area can also be determined as the first non-overlapping area; other areas in the pending reconstruction search area outside the second overlapping area can also be determined as the second non-overlapping area.

[0614] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search area and / or the pending reconstruction search area to determine the selected full reconstruction search area and / or the selected pending reconstruction search area, region selection can be performed on the first overlapping area to determine the fourth selected area; then, based on the fourth selected area and the first non-overlapping area, the selected full reconstruction search area is determined; wherein the first non-overlapping area is other areas in the full reconstruction search area outside the first overlapping area.

[0615] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search area and / or the pending reconstruction search area to determine the selected full reconstruction search area and / or the selected pending reconstruction search area, region selection can be performed on the first non-overlapping area to determine the fifth selected area; and then, based on the fifth selected area and the first overlapping area, the selected full reconstruction search area is determined.

[0616] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search area and / or the pending reconstruction search area to determine the selected full reconstruction search area and / or the selected pending reconstruction search area, region selection can be performed on the second overlapping area to determine the sixth selected area; then, the selected pending reconstruction search area is determined based on the sixth selected area and the second non-overlapping area; wherein the second non-overlapping area is other areas in the pending reconstruction search area outside the second overlapping area.

[0617] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search area and / or the pending reconstruction search area to determine the selected full reconstruction search area and / or the selected pending reconstruction search area, region selection can be performed on the second non-overlapping area to determine the seventh selected area; and then, based on the seventh selected area and the second overlapping area, the selected pending reconstruction search area is determined.

[0618] For example, in an embodiment of the present application, it is possible to choose to limit only the areas that overlap with the current CTU (such as the first overlapping area and / or the second overlapping area), while other areas (such as the first non-overlapping area and / or the second non-overlapping area) are not subject to area reduction restrictions.

[0619] For example, in an embodiment of the present application, it is possible to choose to limit only the areas that do not overlap with the current CTU (such as the first non-overlapping area and / or the second non-overlapping area), while other areas (such as the first overlapping area and / or the second overlapping area) are not subject to area reduction restrictions.

[0620] Exemplarily, in an embodiment of the present application, it is also possible to choose to limit areas that do not overlap with the current CTU (such as the first non-overlapping area and / or the second non-overlapping area) and the pending reconstruction search area, while other areas (such as the first overlapping area) are not subject to area reduction restrictions.

[0621] For example, in some embodiments, if the coded unit adjacent to the current unit to be coded (current block) is in Intra TMP mode, its block vector is recorded as BV neighbor , find the upper left corner of the reference block of the adjacent block through the BV, use this point as the search starting point, expand nTbW in the positive and negative directions of the X axis, and expand nTbH in the positive and negative directions of the Y axis. Then, record the area that does not overlap with the full reconstruction search area and the pending reconstruction search area as R7, and then traverse the search points in R7. The specific implementation process is as follows:

[0622] Input: Luma position (xCb, yCb), which specifies the top left corner sample of the current coding block relative to the top left corner luma sample of the current image, a variable cbWidth, which specifies the width of the current coding block in luma samples, a variable cbHeight, which specifies the height of the current coding block in luma samples, a block vector bv, and a variable cIdx, which specifies the color component index of the current block.

[0623] Output: array predSamples of predicted samples.

[0624] When cIdx is equal to 0, that is, the luminance component, for x = xCb..xCb+cbWidth-1 and y = yCb..yCb+cbHeight-1: xVb = (x + (bvL[0]>>4)) & (IbcBufWidthY-1) yVb = (y + (bvL[1]>>4)) & (CtbSizeY-1)

[0625] When cIdx is not equal to 0, that is, when it is a chroma component, for x = xCb / SubWidthC..xCb / SubWidthC+cbWidth / SubWidthC-1 and y = yCb / SubHeightC..yCb / SubHeightC+cbHeight / SubHeightC-1: xVb = (x + (bvC[0]>>4)) & (IbcBufWidthC-1) yVb = (y + (bvC[1]>>4)) & ((CtbSizeY / subHeightC)-1)

[0626] The four boundaries of the R7 region are calculated as follows: iHorMax = min(min((xTbCmp + searchRangeWidth) < <iBvShift,((picWidth-nTbW)<<iBvShift)), xVb+nTbW); iHorMin=max(max((iTemplateSizeW)<<iBvShift,(xTbCmp-searchRangeWidth)<<iBvShift), xVb–iHorMin); iVerMin=max(max(((iTemplateSizeH)<<iBvShift),((yTbCmp-searchRangeHeight)<<iBvShift)), iVerMin+nTbH); iVerMax=min(min(picHeight-nTbH,(yTbCmp-offsetLCBY+CtbSizeH-nTbH)<<iBvShift),iVerMax –nTbH)。

[0627] After obtaining the range of region R7, determine whether R7 overlaps with the existing search area. When at least one of the four boundaries of region R7 falls within any search area Ri (i=0, 1, 2, 3, 4, 5) (i.e., at least one of the following conditions is met), region R7 is determined to overlap with the existing search area. In this case, it is necessary to traverse the non-overlapping parts of region R7 with the existing search area. Otherwise, traverse all search points within the search area R7. iHorMin[regionId]<=iHorMax<=iHorMax[regionId]; iHorMin[regionId]<=iHorMin<=iHorMax[regionId]; iVerMin[regionId]<=iVerMax<=iVerMax[regionId]; iVerMin[regionId]<=iVerMin<=iVerMax[regionId]

[0628] Furthermore, in an embodiment of the present application, when limiting the search range of a partial area, the searchRangeWidth and / or searchRangeHeight of the partial area are set to different values ​​from those of other areas.

[0629] For example, in some embodiments, when limiting the area corresponding to the pending reconstruction search area, the following calculation may be performed:

[0630] When regionId is equal to 4, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: iHorMin = max(max(iTemplateSizeW< <iBvShift,(xTbCmp-offsetLCBX–nTbW+1)<<iBvShift), (xTbCmp-searchRangeWidth×scaleFactorW))<<iBvShift); iHorMax=min((xTbCmp-nTbW)<<iBvShift,,(picWidth-nTbW)<<iBvShift); iVerMin=(yTbCmp+1)<<iBvShift; iVerMax=min(min((picHeight–nTbH)<<iBvShift,(yTbCmp-offsetLCBY+CtbSizeH-nTbH)<< iBvShift,(yTbCmp+searchRangeHeight×scaleFactorH)<<iBvShift))。

[0631] It should be noted that in the embodiments of the present application, scaleFactorW and scaleFactorH can be 1 / 2 or other values.

[0632] It should be noted that in the embodiments of the present application, the multiplication in the above calculation process can be replaced by division or shift operations.

[0633] It should be noted that in the embodiments of the present application, the <<iBvShift operation in the above calculation process can also be a compare-then-shift operation.

[0634] It should be noted that in the embodiments of the present application, during the determination of iHorMin, an item of (xTbCmp - searchRangeWidth × scaleFactorW)) << iBvShift is added and the maximum value is taken with the previously existing items. Such an operation can be understood as the outer boundary approaching the current block.

[0635] It should be noted that in the embodiments of the present application, during the determination of iVerMax, an item of (yTbCmp + searchRangeHeight × scaleFactorH) << iBvShift is added and the minimum value is taken with the previously existing items. Such an operation can be understood as the outer boundary approaching the current block.

[0636] Exemplarily, in some embodiments, when limiting the corresponding area of the to-be-reconstructed search area, the following calculation can be performed:

[0637] When regionId is equal to 5, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows: iHorMin = (xTbCmp + 1) << iBvShift; iHorMax = min(min((xTbCmp - offsetLCBX + CtbSizeW - nTbW) << iBvShift, min((xTbCmp + searchRangeWidth) << iBvShift, ((picWidth - nTbW) << iBvShift))), (xTbCmp + searchRangeWidth × scaleFactorW) << iBvShift)); iVerMin = max(max(((iTemplateSizeH) << iBvShift), (yTbCmp - offsetLCBY - nTbH + 1) << iBvShift, ((yTbCmp - searchRangeHeight × scaleFactorH)) << iBvShift)); iVerMax = (yTbCmp - nTbH) << iBvShift.

[0638] It should be noted that in the embodiments of the present application, scaleFactorW and scaleFactorH can be 1 / 2 or other values.

[0639] It should be noted that in the embodiments of the present application, the multiplication in the above calculation process can be replaced by division or shift operations.

[0640] It should be noted that in the embodiments of the present application, the <<iBvShift operation in the above calculation process can also be a comparison-then-shift operation.

[0641] It should be noted that in the embodiments of the present application, during the determination process of iHorMax, the term (xTbCmp + searchRangeWidth × scaleFactorW) << iBvShift is added and the minimum value is taken with the existing terms. Such an operation can be understood as the outer boundary approaching the current block.

[0642] It should be noted that in the embodiments of the present application, during the determination process of iVerMin, the term ((yTbCmp - searchRangeHeight × scaleFactorH)) << iBvShift is added and the maximum value is taken with the existing terms. Such an operation can be understood as the outer boundary approaching the current block.

[0643] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search area and / or the pending reconstruction search area, it is possible to appropriately increase the offset operation, such as a +1 operation, based on the already determined iHorMin, iHorMax, iVerMin, and iVerMax.

[0644] Furthermore, in an embodiment of the present application, when performing region selection based on the full reconstruction search region and / or the pending reconstruction search region, an operation may be added to further limit the selected full reconstruction search region and / or the selected pending reconstruction search region, for example, by using a min function to control the minimum possible value range, or by using a max function to control the maximum possible value range.

[0645] Step 204 : Search the selected full reconstruction search area and / or the selected pending reconstruction search area to determine one or more block vectors of the current block.

[0646] In an embodiment of the present application, after performing region selection based on the full reconstruction search area and / or the pending reconstruction search area and determining the selected full reconstruction search area and / or the selected pending reconstruction search area, further searches may be performed in the selected full reconstruction search area and / or the selected pending reconstruction search area, respectively, to determine one or more block vectors of the current block.

[0647] Furthermore, in an embodiment of the present application, when searching in the selected full reconstruction search area and / or the selected pending reconstruction search area to determine one or more block vectors, on the one hand, search points in the selected full reconstruction search area may be traversed, and first matching cost values ​​between matching templates corresponding to the search points in the selected full reconstruction search area and the first template may be determined according to a preset matching criterion. On the other hand, search points in the selected pending reconstruction search area may be traversed, and second matching cost values ​​between matching templates corresponding to search points in the selected pending reconstruction search area that meet preset availability conditions and the first template may be determined according to the preset matching criterion. Finally, one or more block vectors and one or more candidate templates corresponding to the one or more block vectors may be determined based on the first matching cost value and the second matching cost value.

[0648] It should be noted that, in the embodiment of the present application, since it is impossible to determine whether the sampling points in the selected pending reconstruction search area are reconstructed sampling points, it is necessary to first determine whether the sampling points in the selected pending reconstruction search area are available.

[0649] It can be understood that in an embodiment of the present application, it is possible to first determine whether the current search point in the selected pending reconstruction search area meets the preset availability conditions; if the current search point meets the preset availability conditions, the second matching cost between the matching template corresponding to the current search point and the first template is determined according to the preset matching criteria.

[0650] Accordingly, in an embodiment of the present application, after determining whether the current search point in the selected pending reconstruction search area meets the preset availability condition, if the current search point does not meet the preset availability condition, the second matching cost value determination process is not executed.

[0651] In some embodiments, the preset available conditions include at least one or more of the following conditions: all sampling points in the matching template of the current search point do not exceed the coordinate range of the sampling point boundary corresponding to the current image; all sampling points in the reconstructed block corresponding to the matching template of the current search point do not exceed the coordinate range of the sampling point boundary corresponding to the current image; all sampling points in the matching template of the current search point do not exceed the preset search window range; all sampling points in the reconstructed block corresponding to the matching template of the current search point do not exceed the preset search window range; all sampling points in the matching template of the current search point and the current coding block are in the same tile; all sampling points in the reconstructed block corresponding to the matching template of the current search point and the current coding block are in the same tile; all sampling points in the matching template of the current search point have been reconstructed; all sampling points in the reconstructed block corresponding to the matching template of the current search point do not belong to the current coding block; all sampling points in the reconstructed block corresponding to the matching template of the current search point have been reconstructed.

[0652] It should be noted that in the embodiments of the present application, the preset matching criteria include any one of the cost functions used to measure the pattern, such as the sum of absolute error SAD, the sum of transformed absolute error SATD, the sum of squared differences SSE, the mean absolute difference MAD, the mean absolute error MAE, the mean squared error MSE, and the normalized correlation coefficient NCC.

[0653] Exemplarily, in an embodiment of the present application, when a block vector is determined by searching, bvYMins and bvYMaxs are used to represent the minimum offset and maximum offset of the block vector in the vertical direction, respectively.

[0654] bvXMinsregionId, bvXMaxsregionId, bvYMinsregionId, and bvYMaxsregionId can be calculated using the already determined iVerMinregionId, iVerMaxregionId, iHorMinregionId, and iHorMaxregionId: bvXMinsregionId = iHorMinregionId - xTbCmp; bvXMaxsregionId = iHorMaxregionId - xTbCmp; bvYMinsregionId = iVerMinregionId - yTbCmp; bvYMaxsregionId = iVerMaxregionId - yTbCmp;

[0655] bvXMinsregionId, bvXMaxsregionId, bvYMinsregionId, and bvYMaxsregionId determine the horizontal and vertical offset ranges of the search point relative to the current block, that is, the range of the block vector BV.

[0656] Exemplarily, in an embodiment of the present application, when searching in the selected full reconstruction search area, through the search points (iPosHor, iPoxVer) within each search area, that is, each block vector BV (composed of horizontal and vertical components: (pX, pY), where pX = iPosHor-xTbCmp, pY = iPosVer-yTbCmp, then pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs), one or more matching reconstructed blocks of the current block can be found in the reconstruction area, and the adjacent reconstructed pixels of the one or more matching reconstructed blocks are the matching templates. Thus, the first matching cost of the adjacent template of the current block and the adjacent template of the one or more reconstructed blocks can be calculated respectively, which is recorded as pDiff.

[0657] Exemplarily, in an embodiment of the present application, when searching in the selected pending reconstruction search area, the availability of each block vector BV (composed of a horizontal component and a vertical component: (pX, pY), where pX = iPosHor-xTbCmp, pY = iPosVer-yTbCmp, then pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs) is judged through the search points (iPosHor, iPoxVer) in each search area; if available, one or more matching reconstructed blocks of the current block can be found in the reconstruction area, and the adjacent reconstructed pixels of the matching reconstructed blocks are the matching templates, thereby calculating the second matching cost of the adjacent template of the current block and the adjacent template of the reconstructed block, which is also recorded as pDiff; if unavailable, the template matching cost calculation is not performed.

[0658] Illustratively, in an embodiment of the present application, the availability judgment includes but is not limited to one or more of the following conditions being met simultaneously: each sampling point in the template does not exceed the valid coordinate range limited by the image sampling point boundary; each sampling point in the reconstructed block corresponding to the template does not exceed the valid coordinate range limited by the image sampling point boundary; each sampling point in the template and each sampling point in the corresponding reconstructed block do not exceed the specified range of the search window; whether each sampling point in the template is in the same tile as the current coding region; whether each sampling point in the reconstructed block corresponding to the template is in the same tile as the current coding region; each sampling point in the template has been reconstructed; each sampling point in the reconstructed block corresponding to the template is not in the current coding region; and each sampling point in the reconstructed block corresponding to the template has been reconstructed.

[0659] In some embodiments, the preset availability conditions may further include at least one or more of the following conditions: the first identified sampling points in the matching template of the current search point do not exceed the coordinate range of the sampling point boundary corresponding to the current image; the second identified sampling points in the reconstructed block corresponding to the matching template of the current search point do not exceed the coordinate range of the sampling point boundary corresponding to the current image; the first identified sampling points in the matching template of the current search point do not exceed the preset search window range; the second identified sampling points in the reconstructed block corresponding to the matching template of the current search point do not exceed the preset search window range; the first identified sampling points in the matching template of the current search point and the current coding block are in the same tile; the second identified sampling points in the reconstructed block corresponding to the matching template of the current search point and the current coding block are in the same tile; the first identified sampling points in the matching template of the current search point have all been reconstructed; the second identified sampling points in the reconstructed block corresponding to the matching template of the current search point do not belong to the current coding block; and the second identified sampling points in the reconstructed block corresponding to the matching template of the current search point have all been reconstructed.

[0660] It should be noted that, in the embodiment of the present application, the first identified sampling point is one or more sampling points in the matching template of the current search point; the second identified sampling point is one or more sampling points in the reconstructed block corresponding to the matching template of the current search point.

[0661] That is, when determining the availability of a search point in the selected pending reconstruction search area, all sampling points in the matching template corresponding to the search point are no longer traversed and determined, but the availability of the search point is determined by the identified sampling point in the matching template. Correspondingly, all sampling points in the reconstructed block corresponding to the matching template of the search point are no longer traversed and determined, but the availability of the search point is determined by the identified sampling point in the reconstructed block.

[0662] It is understood that in the embodiments of the present application, the first identification sampling point can be any one or more sampling points in the matching template. For example, the first identification sampling point can be one or more sampling points located at corner positions in the matching template, such as the upper left and lower right sampling points of the upper template region when only the upper template is present, or only the lower right sampling point.

[0663] It will be appreciated that, in the embodiments of the present application, the second identified sampling point is any one or more sampling points in the reconstructed block corresponding to the matching template of the current search point. For example, the second identified sampling point may be one or more sampling points located at corner positions in the reconstructed block, such as the sampling points at the upper left and lower right corners of the reconstructed block region, or only the sampling point at the lower right corner of the reconstructed block region.

[0664] Furthermore, in an embodiment of the present application, when determining the availability of search points in the selected pending reconstruction search area, based on the above-mentioned preset availability conditions, the first identified sampling points are traversed in descending order of priority. If the current first identified sampling point does not meet the preset availability conditions, the traversal is stopped and it is determined that the current search point does not meet the preset availability conditions. If the current first identified sampling point meets the preset availability conditions, the traversal continues to the next first identified sampling point. If all first identified sampling points meet the preset availability conditions, it is determined that the current search point meets the preset availability conditions.

[0665] Furthermore, in an embodiment of the present application, when determining the availability of search points in the selected pending reconstruction search area, based on the above-mentioned preset availability conditions, the second identified sampling points are traversed in descending order of priority. If the current second identified sampling point does not meet the preset availability conditions, the traversal is stopped and it is determined that the current search point does not meet the preset availability conditions. If the current second identified sampling point meets the preset availability conditions, the traversal continues to the next second identified sampling point. If all second identified sampling points meet the preset availability conditions, it is determined that the current search point meets the preset availability conditions.

[0666] That is, in the embodiments of the present application, multiple identification sampling points can be used sequentially. For example, the upper left corner sampling point is first determined to be available. If not, the result is "unavailable." If available, the lower right corner sampling point is then determined to be available. If not, the result is "unavailable." If available, the result is "available." The upper left corner sampling point has a higher priority than the lower right corner sampling point.

[0667] It should be noted that, in the embodiment of the present application, the number of block vectors determined by the search process may be one or more. For example, N block vectors of the current block may be determined, where N is an integer greater than 0.

[0668] Accordingly, in an embodiment of the present application, when searching the selected full reconstruction search area and / or the selected pending reconstruction search area to determine one or more block vectors, a preset number N corresponding to candidate templates may be first determined; then, the search points in the selected full reconstruction search area are traversed, and first matching cost values ​​between matching templates corresponding to the search points in the selected full reconstruction search area and the first template are determined according to a preset matching criterion; simultaneously, the search points in the selected pending reconstruction search area are traversed, and second matching cost values ​​between matching templates corresponding to search points in the selected pending reconstruction search area that meet a preset availability condition and the first template are determined according to the preset matching criterion; finally, N block vectors and N candidate templates corresponding to the N block vectors may be determined based on the first matching cost values ​​and the second matching cost values.

[0669] That is, in an embodiment of the present application, when searching and determining N block vectors corresponding to N matching templates in the selected full reconstruction search area and / or the selected pending reconstruction search area, respectively, the process of searching and determining the block vectors BV corresponding to N matching templates in the search area (the selected full reconstruction search area and / or the selected pending reconstruction search area) may include determining the value of the number N of candidate templates, determining a matching template comparison criterion, and recording the N block vectors BV corresponding to the N matching templates (the selected N candidate templates).

[0670] It is understandable that in the embodiment of the present application, when determining the preset number N corresponding to the candidate templates, you can choose to determine N; you can also determine N according to a first preset value; you can also determine N according to a preset value range.

[0671] That is, in the embodiments of the present application, the value of N must first be determined. Here, N can be a preset constant, such as 4. N can also be within a certain numerical range, such as any integer in [2, 8]. The range of N is preset, and the optimal N value can be determined at the encoding end by using cost 1 coarse selection, cost 2 coarse selection, or cost 3 coarse selection, cost 4 fine selection, etc., and the optimal N value is transmitted to the decoding end in the form of a bitstream. Among them, costs 1, 2, 3, and 4 can be one of the cost functions used to measure the mode, such as SAD, SATD, MSE, MAD, and RDO. This application does not specifically limit the method for determining N.

[0672] Furthermore, in an embodiment of the present application, when determining N block vectors and N candidate templates corresponding to the N block vectors based on the first matching cost value and the second matching cost value, that is, when determining one or more block vectors and one or more candidate templates corresponding to the one or more block vectors, N minimum matching cost values ​​among the first matching cost value and the second matching cost value can be determined first; and then, based on the N search points corresponding to the N minimum matching cost values, N block vectors and N candidate templates corresponding to the N block vectors are determined.

[0673] Among the matching cost values ​​between the matching template corresponding to the search point in the selected full reconstruction search area and the first template, N minimum matching cost values ​​are determined; and then N block vectors and N candidate templates corresponding to the N minimum matching cost values ​​are determined.

[0674] In some embodiments, all available search points in all search ranges (e.g., regionId = 0, 1, 2, 3, 4, 5) are traversed and compared to obtain the N search points with the smallest matching costs pDiff (including the first matching cost value and the second matching cost value). The corresponding matching costs are recorded as pDiff_BEST[n], n = 0, ..., N-1, and the corresponding block vectors BV are recorded as the best block vectors BV_BEST[n]. Each entry is a coordinate pair (pX_BEST, pY_BEST), n = 0, ..., N-1, and the corresponding matching template is the best matching template T_BEST[n], n = 0, ..., N-1. Wherein, N can be an integer value of 1 or greater as needed.

[0675] It should be noted that in an embodiment of the present application, when performing search processing, the search strategies that can be adopted may include but are not limited to search methods based on different search step sizes, for example, a coarse search based on a first search step size and / or a fine search based on a second search step size, wherein the first search step size is larger than the second search step size.

[0676] In some embodiments, the first search step size and the second search step size can be any value greater than 0, and can be an integer value or a non-integer value, as long as the first search step size is greater than the second search step size. For example, the first search step size can be 3, and the second search step size can be 1 / 2.

[0677] Furthermore, in an embodiment of the present application, it is possible to select a first search step size and perform searches in the selected full reconstruction search area and / or the selected pending reconstruction search area, respectively, to determine a first matching cost value corresponding to a search point in the selected full reconstruction search area and a second matching cost value corresponding to a search point in the selected pending reconstruction search area that meets a preset availability condition, and determine N block vectors and N candidate templates corresponding to the N block vectors based on the first cost value and the second cost value.

[0678] Exemplarily, in an embodiment of the present application, the coarse search may specifically include: determining the best coarse matching template in the search area with a first preset step size (i.e., the first search step size, for example, 2), that is, obtaining the final candidate template, or, using a downsampled template (for example, a downsampling factor of 2) to determine the best coarse matching template in the search area, that is, obtaining the final candidate template.

[0679] For example, in an embodiment of the present application, if the search strategy is to perform only a coarse search, then within each region, a coarse search may be performed with a larger step size (first search step size) (e.g., a step size of 2 or 3) within the search range where pX is between bvXMinsregionId and bvXMaxsregionId and pY is between bvYMinsregionId and bvYMaxsregionId. The top N best matching costs obtained by template matching are recorded as pDiff_BEST[n], where n=0, ..., N-1, and the corresponding block vector BV is recorded as the best block vector BV_BEST[n], where each item is a coordinate pair (pX_BEST, pY_BEST), where n=0, ..., N-1. N can be an integer value of 1 or greater as needed.

[0680] Furthermore, in an embodiment of the present application, it is possible to select a second search step size and perform searches in the selected full reconstruction search area and / or the selected pending reconstruction search area, respectively, to determine a first matching cost value corresponding to a search point in the selected full reconstruction search area and a second matching cost value corresponding to a search point in the selected pending reconstruction search area that meets a preset availability condition, and determine N block vectors and N candidate templates corresponding to the N block vectors based on the first cost value and the second cost value; wherein the first search step size is greater than the second search step size.

[0681] Exemplarily, in an embodiment of the present application, the fine search may specifically include: determining the best fine matching template in the search area with a second preset step size (i.e., the second search step size, for example, 1), that is, obtaining the final candidate template, or, determining the best fine matching template near the best coarse matching template after completing the coarse search, that is, obtaining the final candidate template.

[0682] For example, in an embodiment of the present application, if the search strategy is to perform only a fine search, then within each region, within the search range where pX is between bvXMinsregionId and bvXMaxsregionId and pY is between bvYMinsregionId and bvYMaxsregionId, a fine search may be performed with a smaller step size (second search step size) (e.g., a step size of 1 or 1 / 2; when the step size is less than 1, sub-pixel interpolation is required). The top N best matching costs obtained by template matching are recorded as pDiff_BEST[n], where n=0, ..., N-1, and the corresponding block vector BV is recorded as the best block vector BV_BEST[n], where each item is a coordinate pair (pX_BEST, pY_BEST), where n=0, ..., N-1. N may be an integer value of 1 or greater as needed.

[0683] Furthermore, in an embodiment of the present application, a search may be performed in the selected full reconstruction search area and / or the selected pending reconstruction search area, respectively, according to a first search step size, to determine first matching cost values ​​corresponding to search points in the selected full reconstruction search area and second matching cost values ​​corresponding to search points in the selected pending reconstruction search area that meet preset availability conditions. M reference block vectors and M matching reconstructed blocks corresponding to the M reference block vectors are determined based on the first and second matching cost values, where M is an integer greater than 0. A first search area is then determined based on the M matching reconstructed blocks, where the first search area is smaller than the total area formed by the selected full reconstruction search area and / or the selected pending reconstruction search area. A search may then be performed in the first search area according to a second search step size to determine third matching cost values ​​between matching templates corresponding to search points in the first search area that meet preset availability conditions and the first template, where the first search step size is greater than the second search step size. Finally, N block vectors and N candidate templates corresponding to the N block vectors are determined based on the first matching cost values, the second matching cost values, and / or the third matching cost values.

[0684] It can be understood that in the embodiments of the present application, when determining N block vectors and N candidate templates corresponding to the N block vectors based on the first matching cost value, the second matching cost value, and / or the third matching cost value, the N minimum matching cost values ​​among the third matching cost values ​​can be determined first; and then, based on the N search points corresponding to the N minimum matching cost values, the N block vectors and the N candidate templates corresponding to the N block vectors can be determined.

[0685] It can be understood that in the embodiments of the present application, when determining N block vectors and N candidate templates corresponding to the N block vectors based on the first matching cost value, the second matching cost value, and / or the third matching cost value, it is also possible to first determine T block vectors and T candidate templates corresponding to the T block vectors based on the third matching cost value; where T is an integer greater than 0 and less than N; and based on the first cost value and the second cost value, determine NT block vectors other than the M reference block vectors and NT candidate templates corresponding to the NT block vectors.

[0686] It should be noted that, in the embodiment of the present application, after performing a coarse search, P initial block vectors can be determined based on the first-generation value and the second-generation value; where P is an integer greater than or equal to M; and then M reference block vectors are determined based on the P initial block vectors.

[0687] For example, in an embodiment of the present application, if the search strategy is to perform a coarse search first and then a fine search, a coarse search record template matching can be performed with a step size of 2 (i.e., a first search step size of 2) to obtain the best coarse matching template (initial matching template), and then a step size of 1 (i.e., a second search step size of 1) can be used to determine the best fine matching template near the best coarse matching template, thereby obtaining the final candidate template.

[0688] In the coarse search phase, a coarse search can be performed with a larger step size (e.g., 2 or 3) within each region, where pX is between bvXMinsregionId and bvXMaxsregionId, and pY is between bvYMinsregionId and bvYMaxsregionId. For example, a coarse search with a step size of 2 is performed, recording the top P best matching costs obtained from template matching as pDiff1_BEST[p], where p = 0, ..., P-1, and the corresponding block vector BV is recorded as the best block vector BV1_BEST[p], where p = 0, ..., P-1. P can be an integer value of 1 or greater as needed, and the search region where the best matching search point is located is bestRegionId[p], where p = 0, ..., P-1. As required by the algorithm, the coarse search phase will provide one or more (here, M, where 1 <= M <= P) fine search reference points and send them to the next step. For example, M = 1.

[0689] Next, in the fine search phase, the best block vector BV1_BEST[p], p=0, ..., M-1, obtained in the coarse search can be selected as the search point near the fine search reference point. Specifically, for each fine search reference point, the refinement search range TmpRefineRangeHor and TmpRefineRangeVer are first determined. The refinement search range can be a fixed size or can be related to the coding block size. For example, the above TmpRefineRangeHor and TmpRefineRangeVer can be set to min(nTbW, nTbH) / 2. Then, the position of the best matching reconstructed block obtained in the coarse search is calculated as the reference position of the fine search area: BestPosX=xTbCmp+pX1_BEST, BestPosY=yTbCmp+pY1_BEST.

[0690] In one embodiment, the search window can be directly used to treat the fine search area as a whole selected pending reconstruction search area, and directly traverse:

[0691] The new search range is obtained according to the optimal matching block position obtained by the rough search, which are: iHorMaxrefine = min(picWidth-nTbW, BestPosX+TmpRefineRangeHor) iHorMinrefine = max(iTemplateSizeW, BestPosX-TmpRefineRangeHor) iVerMaxrefine = min(picHeight-nTbH, BestPosY+TmpRefineRangeVer) iVerMinrefine = max(iTemplateSizeH, BestPosY-TmpRefineRangeVer).

[0692] Then, the adjusted block vectors BVbvXMins, bvXMaxs, bvYMins, bvYMaxs can be calculated by iVerMinrefine, iVerMaxrefine, iHorMinrefine, iHorMaxrefine: bvXMins=iHorMinrefine-xTbCmp; bvXMaxs=iHorMaxrefine-xTbCmp; bvYMins=iVerMinrefine-yTbCmp; bvYMaxs=iVerMaxrefine-yTbCmp;

[0693] The refined search is performed within the block vector range where pX is between bvXMinsrefine and bvXMaxsrefine, and pY is between bvYMinsrefine and bvYMaxsrefine. This means that all search positions within the refined search window are directly traversed, and availability is determined sequentially. For example, a search is performed with a step size of 1. The top T optimal matching costs obtained from the available point template matching are recorded as pDiff_BEST[t], t = 0, ..., T-1, and the corresponding block vector BV is recorded as the best block vector BV_BEST[t], t = 0, ..., T-1. T is an integer of 1 or greate...

Claims

1. A decoding method, applied to a decoder, the method comprising: Determine a first template corresponding to the current block; Determine a full reconstruction search area and / or a pending reconstruction search area according to the first template; wherein the full reconstruction search area includes reconstructed sampling points, and the pending reconstruction search area includes reconstructed sampling points and / or unreconstructed sampling points; Performing region selection based on the full reconstruction search region and / or the pending reconstruction search region, and determining a selected full reconstruction search region and / or a selected pending reconstruction search region; wherein the selected full reconstruction search region is smaller than or equal to the full reconstruction search region, and the selected pending reconstruction search region is smaller than or equal to the pending reconstruction search region; Search is performed in the selected full reconstruction search area and / or the selected pending reconstruction search area to determine one or more block vectors of the current block.

2. The method according to claim 1, wherein: The step of determining a full reconstruction search area and / or a pending reconstruction search area according to the first template includes: Based on the first template, with the zero-value block vector as the center, the full reconstruction search area and / or the pending reconstruction search area are determined according to the size of the search window and the position information of the current image.

3. The method according to claim 2, wherein: The full reconstruction search area is a search area including a set of positions corresponding to the upper left corner pixel point of the reference block at each search position; The pending reconstruction search area is a search coverage area including a pixel set corresponding to a reference block at each search position.

4. The method according to claim 1, wherein: The performing region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: determining the full reconstruction search area as the selected full reconstruction search area; Performing region selection on the pending reconstruction search region to determine the selected pending reconstruction search region.

5. The method according to claim 1, wherein: The performing region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: Performing region selection on the full reconstruction search region to determine the selected full reconstruction search region; The pending reconstruction search area is determined as the selected pending reconstruction search area.

6. The method according to claim 1, wherein: The performing region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: Performing region selection on the full reconstruction search region to determine the selected full reconstruction search region; Performing region selection on the pending reconstruction search region to determine the selected pending reconstruction search region.

7. The method according to claim 1, wherein: The performing region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: Determine a limiting parameter; wherein the limiting parameter includes a height limiting parameter and a width limiting parameter, and the height limiting parameter and the width limiting parameter are both greater than or equal to 1; The full reconstruction search region and / or the pending reconstruction search region are selected according to the narrowing parameter to determine the selected full reconstruction search region and / or the selected pending reconstruction search region.

8. The method according to claim 7, wherein: The determining of the limiting parameters comprises: Decoding the code stream to determine the limiting parameter; or, The reduction parameter is determined according to a preset value.

9. The method according to claim 8, wherein: The limiting parameter is transmitted through any one of the following syntax information: sps layer syntax information, pps layer syntax information, aps layer syntax information, sh layer syntax information, and cu layer syntax information.

10. The method according to claim 7, wherein: The method further comprises: Determine a search area in the full reconstruction search area that is located on the upper side of the current block as a first initial area; Determine a search area in the full reconstruction search area that is located on the left side or the upper left side of the current block as a second initial area; Determine a search area in the pending reconstruction search area that is located at the lower left side of the current block as a third initial area; A search area in the pending reconstruction search area that is located on the upper right side of the current block is determined as a fourth initial area.

11. The method according to claim 10, wherein: The step of performing region selection on the full reconstruction search region and / or the pending reconstruction search region according to the narrowing parameter, and determining the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: Determine a first selected area in the first initial area according to the narrowing parameter and the position information of the first initial area; wherein the first selected area is any area in the first initial area; Determine the selected full reconstruction search area according to the first selected area; and / or, Determine a second selected area in the second initial area according to the narrowing parameter and the position information of the second initial area; wherein the second selected area is any area in the second initial area; The selected full reconstruction search area is determined according to the second selected area.

12. The method according to claim 10, wherein: The step of performing region selection on the full reconstruction search region and / or the pending reconstruction search region according to the narrowing parameter, and determining the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: Determine a third selected area in the third initial area according to the narrowing parameter and the position information of the third initial area; wherein the third selected area is any area in the third initial area; The selected pending reconstruction search area is determined according to the third selected area.

13. The method according to claim 10, wherein: The step of performing region selection on the full reconstruction search region and / or the pending reconstruction search region according to the narrowing parameter, and determining the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: Determine a fourth selected area in the fourth initial area according to the narrowing parameter and the position information of the fourth initial area; wherein the fourth selected area is any area in the fourth initial area; The selected pending reconstruction search area is determined according to the fourth selected area.

14. The method according to claim 1, wherein: The performing region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: Determine a region width threshold and a region height threshold according to a size parameter of the current block; The full reconstruction search region and / or the pending reconstruction search region are selected according to the region width threshold and / or the region height threshold to determine the selected full reconstruction search region and / or the selected pending reconstruction search region.

15. The method according to claim 1, wherein: The performing region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: determining the full reconstruction search area as the selected full reconstruction search area; The pending reconstruction search area is determined as the selected pending reconstruction search area.

16. The method according to claim 1, wherein: The method further comprises: A search area in the full reconstruction search area where any pixel point in a reference block corresponding to the search area overlaps with a current coding tree block corresponding to the current block is determined as a first overlapping area.

17. The method according to claim 16, wherein: The performing region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: Performing region selection on the first overlapping region to determine a fourth selected region; The selected full reconstruction search region is determined according to the fourth selected region and the first non-overlapping region; wherein the first non-overlapping region is other regions in the full reconstruction search region except the first overlapping region.

18. The method according to claim 17, wherein: The performing region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: Performing region selection on the first non-overlapping regions to determine a fifth selected region; The selected full reconstruction search area is determined according to the fifth selected area and the first overlapping area.

19. The method according to claim 1, wherein: The searching in the selected full reconstruction search area and / or the selected pending reconstruction search area respectively to determine one or more block vectors of the current block comprises: Traversing the search points in the selected full reconstruction search area, and determining a first matching cost value between a matching template corresponding to the search point in the selected full reconstruction search area and the first template according to a preset matching criterion; Traversing the search points in the selected pending reconstruction search area, and determining, according to a preset matching criterion, a second matching cost value between a matching template corresponding to a search point in the selected pending reconstruction search area that meets a preset availability condition and the first template; The one or more block vectors and one or more candidate templates corresponding to the one or more block vectors are determined according to the first matching cost value and the second matching cost value.

20. The method according to claim 19, wherein: The method further comprises: Determining whether the current search point in the selected pending reconstruction search area meets the preset availability condition; If the current search point satisfies the preset availability condition, the second matching cost between the matching template corresponding to the current search point and the first template is determined according to a preset matching criterion.

21. The method according to claim 20, wherein: The method further comprises: If the current search point does not satisfy the preset availability condition, the second matching cost value determination process is not performed.

22. The method according to claim 20 or 21, wherein: The preset available conditions include at least one or more of the following conditions: All sampling points in the matching template of the current search point do not exceed the coordinate range of the sampling point boundary corresponding to the current image; All sampling points in the reconstructed block corresponding to the matching template of the current search point do not exceed the coordinate range of the sampling point boundary corresponding to the current image; All sampling points in the matching template of the current search point do not exceed the preset search window range; All sampling points in the reconstructed block corresponding to the matching template of the current search point do not exceed the preset search window range; All sampling points in the matching template of the current search point are in the same Tile as the current coding block; All sampling points in the reconstructed block corresponding to the matching template of the current search point are in the same Tile as the current coding block; All sampling points in the matching template of the current search point have been reconstructed; All sampling points in the reconstructed block corresponding to the matching template of the current search point do not belong to the current coding block; All sampling points in the reconstructed block corresponding to the matching template of the current search point have been reconstructed.

23. The method according to claim 22, wherein: The method further comprises: Determine a preset number N corresponding to the candidate template; wherein N is an integer greater than 0; According to the first matching cost value and the second matching cost value, N block vectors and N candidate templates corresponding to the N block vectors are determined.

24. The method according to claim 23, wherein: The method further comprises: Determine N minimum matching cost values ​​among the first matching cost value and the second matching cost value; The N block vectors and the N candidate templates corresponding to the N block vectors are determined based on the N search points corresponding to the N minimum matching cost values.

25. The method according to claim 23, wherein: The method further comprises: performing searches in the selected full reconstruction search area and / or the selected pending reconstruction search area respectively according to a first search step length, determining the first matching cost value corresponding to the search point in the selected full reconstruction search area and the second matching cost value corresponding to the search point in the selected pending reconstruction search area that meets the preset availability condition, and determining the N block vectors and the N candidate templates corresponding to the N block vectors based on the first cost value and the second cost value; or Searching is performed in the selected full reconstruction search area and / or the selected pending reconstruction search area respectively according to a second search step length to determine the first matching cost value corresponding to the search point in the selected full reconstruction search area and the second matching cost value corresponding to the search point in the selected pending reconstruction search area that meets the preset availability condition, and the N block vectors and the N candidate templates corresponding to the N block vectors are determined based on the first cost value and the second cost value; wherein the first search step length is greater than the second search step length.

26. The method of claim 23, wherein: The method further comprises: Searching the selected full reconstruction search area and / or the selected pending reconstruction search area respectively according to a first search step length, determining the first matching cost value corresponding to the search point in the selected full reconstruction search area and the second matching cost value corresponding to the search point in the selected pending reconstruction search area that meets the preset availability condition, and determining the M reference block vectors and the M matching reconstruction blocks corresponding to the M reference block vectors based on the first cost value and the second cost value; wherein M is an integer greater than 0; Determine a first search area according to the M matching reconstruction blocks; wherein the first search area is smaller than a total area formed by the selected full reconstruction search area and / or the selected pending reconstruction search area; Searching in the first search area according to a second search step length, determining a third matching cost value between a matching template corresponding to a search point in the first search area that meets the preset availability condition and the first template; wherein the first search step length is greater than the second search step length; The N block vectors and the N candidate templates corresponding to the N block vectors are determined according to the first matching cost value, the second matching cost value, and / or the third matching cost value.

27. The method according to claim 26, wherein: The determining the N block vectors and the N candidate templates corresponding to the N block vectors according to the first matching cost value, the second matching cost value, and / or the third matching cost value includes: Determining N minimum matching cost values ​​among the third matching cost values; The N block vectors and the N candidate templates corresponding to the N block vectors are determined based on the N search points corresponding to the N minimum matching cost values.

28. The method according to claim 26, wherein: The determining the N block vectors and the N candidate templates corresponding to the N block vectors according to the first matching cost value, the second matching cost value, and / or the third matching cost value includes: Determine T block vectors and T candidate templates corresponding to the T block vectors according to the third matching cost value; wherein T is an integer greater than 0 and less than N; Based on the first generation value and the second generation value, NT block vectors other than the M reference block vectors and NT candidate templates corresponding to the NT block vectors are determined.

29. The method according to claim 26, wherein: The method further comprises: Determine the P initial block vectors based on the first generation value and the second generation value; wherein P is an integer greater than or equal to M; The M reference block vectors are determined according to the P initial block vectors.

30. The method of claim 1, wherein: The method further comprises: determining one or more reference blocks for the current block according to the one or more block vectors; A prediction value of the current block is determined according to the one or more reference blocks.

31. The method according to claim 30, wherein: The determining one or more reference blocks of the current block according to the one or more block vectors comprises: Determine one or more initial reconstructed blocks corresponding to the current block according to the one or more block vectors; The one or more initial reconstructed blocks are corrected to determine the one or more reference blocks.

32. The method of claim 1, wherein: The method further comprises: Determine an optimal block vector for the current block according to one or more block vectors of the current block; Determine at least one reference block corresponding to the current block according to the best block vector; A prediction value of the current block is determined according to the at least one reference block.

33. The method of claim 32, wherein: in, The determining, according to the at least one reference block, a prediction value of the current block comprises: at least one prediction block corresponding to the at least one reference block; The at least one prediction block is weightedly integrated to determine a prediction value of the current block.

34. The method of claim 1, wherein: The method further comprises: Determine a first prediction value of the current block according to one or more block vectors of the current block; Determining a second prediction value of the current block according to a preset prediction mode; wherein the preset prediction mode includes a planar mode and / or a directional mode; A prediction value of the current block is determined according to the first prediction value and the second prediction value.

35. The method of claim 19, wherein: The preset matching criteria include any one of the sum of absolute error SAD, the sum of transformed absolute error SATD, the sum of squared differences SSE, the mean absolute difference MAD, the mean absolute error MAE, the mean squared error MSE, and the normalized correlation coefficient NCC.

36. The method of claim 1, wherein: The determining the first template corresponding to the current block includes: A template type corresponding to the current block is determined, and a first template corresponding to the current block is determined according to the template type.

37. The method of claim 36, wherein: The determining of the template type corresponding to the current block includes: Determine the template type of the current block according to the reference pixels of the current block; or, Determine the template type of the current block according to indication information in the bitstream; or, Determining a template type of the current block according to the size of the current block; Among them, the reference pixels of the current block include at least one of the following: the left adjacent reference pixels of the current block, the upper adjacent reference pixels of the current block, the upper left adjacent reference pixels of the current block, the lower left adjacent reference pixels of the current block, and the upper right adjacent reference pixels of the current block.

38. The method of claim 36, wherein: The determining, according to the reference pixel of the current block, the template type of the current block comprises: If the left adjacent reference pixel of the current block, the upper adjacent reference pixel of the current block, and the upper left adjacent reference pixel of the current block are all available, determining that the template type of the current block is a first value; If the left adjacent reference pixel of the current block is available, determining the template type of the current block to be a second value; If the upper adjacent reference pixel of the current block is available, determining the template type of the current block to be a third value; If both the left adjacent reference pixel of the current block and the upper left adjacent reference pixel of the current block are available, determining that the template type of the current block is a fourth value; If both the left adjacent reference pixel of the current block and the lower left adjacent reference pixel of the current block are available, determining that the template type of the current block is a fifth value; If both the upper neighboring reference pixels of the current block and the upper right neighboring reference pixels of the current block are available, the template type of the current block is determined to be a sixth value.

39. The method of claim 1, wherein: The determining, according to the template type, a first template corresponding to the current block includes: Determining a template reference pixel of the current block according to the template type and a template size corresponding to the template type; A first template of the current block is determined according to the template reference pixels.

40. The method according to any one of claims 30 to 34, wherein: The method further comprises: Decoding the bitstream to determine a prediction difference corresponding to the current block; A reconstructed value of the current block is determined according to the prediction difference value and the prediction value of the current block.

41. A coding method, applied to an encoder, the method comprising: Determine a first template corresponding to the current block; Determine a full reconstruction search area and / or a pending reconstruction search area according to the first template; wherein the full reconstruction search area includes reconstructed sampling points, and the pending reconstruction search area includes reconstructed sampling points and / or unreconstructed sampling points; Performing region selection based on the full reconstruction search region and / or the pending reconstruction search region, and determining a selected full reconstruction search region and / or a selected pending reconstruction search region; wherein the selected full reconstruction search region is smaller than or equal to the full reconstruction search region, and the selected pending reconstruction search region is smaller than or equal to the pending reconstruction search region; Search is performed in the selected full reconstruction search area and / or the selected pending reconstruction search area to determine one or more block vectors of the current block.

42. The method according to claim 41, wherein: The step of determining a full reconstruction search area and / or a pending reconstruction search area according to the first template includes: Based on the first template, with the zero-value block vector as the center, the full reconstruction search area and / or the pending reconstruction search area are determined according to the size of the search window and the position information of the current image.

43. The method of claim 42, wherein: The full reconstruction search area is a search area including a set of positions corresponding to the upper left corner pixel point of the reference block at each search position; The pending reconstruction search area is a search coverage area including a pixel set corresponding to a reference block at each search position.

44. The method of claim 41, wherein: The performing region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: determining the full reconstruction search area as the selected full reconstruction search area; Performing region selection on the pending reconstruction search region to determine the selected pending reconstruction search region.

45. The method of claim 41, wherein: The performing region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: Performing region selection on the full reconstruction search region to determine the selected full reconstruction search region; The pending reconstruction search area is determined as the selected pending reconstruction search area.

46. ​​The method of claim 41, wherein: The performing region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: Performing region selection on the full reconstruction search region to determine the selected full reconstruction search region; Performing region selection on the pending reconstruction search region to determine the selected pending reconstruction search region.

47. The method of claim 41, wherein: The performing region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: Determine a limiting parameter; wherein the limiting parameter includes a height limiting parameter and a width limiting parameter, and the height limiting parameter and the width limiting parameter are both greater than or equal to 1; The full reconstruction search region and / or the pending reconstruction search region are selected according to the narrowing parameter to determine the selected full reconstruction search region and / or the selected pending reconstruction search region.

48. The method of claim 47, wherein: The determining of the limiting parameters comprises: The limiting parameter is determined according to a preset value, and the limiting parameter is written into the bit stream.

49. The method of claim 48, wherein: The limiting parameter is transmitted through any one of the following syntax information: sps layer syntax information, pps layer syntax information, aps layer syntax information, sh layer syntax information, and cu layer syntax information.

50. The method of claim 47, wherein: The method further comprises: Determine a search area in the full reconstruction search area that is located on the upper side of the current block as a first initial area; Determine a search area in the full reconstruction search area that is located on the left side or the upper left side of the current block as a second initial area; Determine a search area in the pending reconstruction search area that is located at the lower left side of the current block as a third initial area; A search area in the pending reconstruction search area that is located on the upper right side of the current block is determined as a fourth initial area.

51. The method of claim 50, wherein: The step of performing region selection on the full reconstruction search region and / or the pending reconstruction search region according to the narrowing parameter, and determining the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: Determine a first selected area in the first initial area according to the narrowing parameter and the position information of the first initial area; wherein the first selected area is any area in the first initial area; Determine the selected full reconstruction search area according to the first selected area; and / or, Determine a second selected area in the second initial area according to the narrowing parameter and the position information of the second initial area; wherein the second selected area is any area in the second initial area; The selected full reconstruction search area is determined according to the second selected area.

52. The method of claim 50, wherein: The step of performing region selection on the full reconstruction search region and / or the pending reconstruction search region according to the narrowing parameter, and determining the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: Determine a third selected area in the third initial area according to the narrowing parameter and the position information of the third initial area; wherein the third selected area is any area in the third initial area; The selected pending reconstruction search area is determined according to the third selected area.

53. The method of claim 50, wherein: The step of performing region selection on the full reconstruction search region and / or the pending reconstruction search region according to the narrowing parameter, and determining the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: Determine a fourth selected area in the fourth initial area according to the narrowing parameter and the position information of the fourth initial area; wherein the fourth selected area is any area in the fourth initial area; The selected pending reconstruction search area is determined according to the fourth selected area.

54. The method of claim 41, wherein: The performing region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: Determine a region width threshold and a region height threshold according to a size parameter of the current block; The full reconstruction search region and / or the pending reconstruction search region are selected according to the region width threshold and / or the region height threshold to determine the selected full reconstruction search region and / or the selected pending reconstruction search region.

55. The method of claim 41, wherein: The performing region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: determining the full reconstruction search area as the selected full reconstruction search area; The pending reconstruction search area is determined as the selected pending reconstruction search area.

56. The method of claim 41, wherein: The method further comprises: A search area in the full reconstruction search area where any pixel point in a reference block corresponding to the search area overlaps with a current coding tree block corresponding to the current block is determined as a first overlapping area.

57. The method of claim 56, wherein: The performing region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: Performing region selection on the first overlapping region to determine a fourth selected region; The selected full reconstruction search region is determined according to the fourth selected region and the first non-overlapping region; wherein the first non-overlapping region is other regions in the full reconstruction search region except the first overlapping region.

58. The method of claim 57, wherein: The performing region selection based on the full reconstruction search region and / or the pending reconstruction search region to determine the selected full reconstruction search region and / or the selected pending reconstruction search region comprises: Performing region selection on the second non-overlapping region to determine a seventh selected region; The selected pending reconstruction search area is determined according to the seventh selected area and the second overlapping area.

59. The method of claim 41, wherein: The searching in the selected full reconstruction search area and / or the selected pending reconstruction search area respectively to determine one or more block vectors of the current block comprises: Traversing the search points in the selected full reconstruction search area, and determining a first matching cost value between a matching template corresponding to the search point in the selected full reconstruction search area and the first template according to a preset matching criterion; Traversing the search points in the selected pending reconstruction search area, and determining, according to a preset matching criterion, a second matching cost value between a matching template corresponding to a search point in the selected pending reconstruction search area that meets a preset availability condition and the first template; The one or more block vectors and one or more candidate templates corresponding to the one or more block vectors are determined according to the first matching cost value and the second matching cost value.

60. The method of claim 59, wherein: The method further comprises: Determining whether the current search point in the selected pending reconstruction search area meets the preset availability condition; If the current search point satisfies the preset availability condition, the second matching cost between the matching template corresponding to the current search point and the first template is determined according to a preset matching criterion.

61. The method of claim 60, wherein: The method further comprises: If the current search point does not satisfy the preset availability condition, the second matching cost value determination process is not performed.

62. The method of claim 60 or 61, wherein: The preset available conditions include at least one or more of the following conditions: All sampling points in the matching template of the current search point do not exceed the coordinate range of the sampling point boundary corresponding to the current image; All sampling points in the reconstructed block corresponding to the matching template of the current search point do not exceed the coordinate range of the sampling point boundary corresponding to the current image; All sampling points in the matching template of the current search point do not exceed the preset search window range; All sampling points in the reconstructed block corresponding to the matching template of the current search point do not exceed the preset search window range; All sampling points in the matching template of the current search point are in the same Tile as the current coding block; All sampling points in the reconstructed block corresponding to the matching template of the current search point are in the same Tile as the current coding block; All sampling points in the matching template of the current search point have been reconstructed; All sampling points in the reconstructed block corresponding to the matching template of the current search point do not belong to the current coding block; All sampling points in the reconstructed block corresponding to the matching template of the current search point have been reconstructed.

63. The method of claim 62, wherein: The method further comprises: Determine a preset number N corresponding to the candidate template; wherein N is an integer greater than 0; According to the first matching cost value and the second matching cost value, N block vectors and N candidate templates corresponding to the N block vectors are determined.

64. The method of claim 63, wherein: The method further comprises: Determine N minimum matching cost values ​​among the first matching cost value and the second matching cost value; The N block vectors and the N candidate templates corresponding to the N block vectors are determined based on the N search points corresponding to the N minimum matching cost values.

65. The method of claim 63, wherein: The method further comprises: performing searches in the selected full reconstruction search area and / or the selected pending reconstruction search area respectively according to a first search step length, determining the first matching cost value corresponding to the search point in the selected full reconstruction search area and the second matching cost value corresponding to the search point in the selected pending reconstruction search area that meets the preset availability condition, and determining the N block vectors and the N candidate templates corresponding to the N block vectors based on the first cost value and the second cost value; or Searching is performed in the selected full reconstruction search area and / or the selected pending reconstruction search area respectively according to a second search step length to determine the first matching cost value corresponding to the search point in the selected full reconstruction search area and the second matching cost value corresponding to the search point in the selected pending reconstruction search area that meets the preset availability condition, and the N block vectors and the N candidate templates corresponding to the N block vectors are determined based on the first cost value and the second cost value; wherein the first search step length is greater than the second search step length.

66. The method of claim 63, wherein: The method further comprises: Searching the selected full reconstruction search area and / or the selected pending reconstruction search area respectively according to a first search step length, determining the first matching cost value corresponding to the search point in the selected full reconstruction search area and the second matching cost value corresponding to the search point in the selected pending reconstruction search area that meets the preset availability condition, and determining the M reference block vectors and the M matching reconstruction blocks corresponding to the M reference block vectors based on the first cost value and the second cost value; wherein M is an integer greater than 0; Determine a first search area according to the M matching reconstruction blocks; wherein the first search area is smaller than a total area formed by the selected full reconstruction search area and / or the selected pending reconstruction search area; Searching in the first search area according to a second search step length, determining a third matching cost value between a matching template corresponding to a search point in the first search area that meets the preset availability condition and the first template; wherein the first search step length is greater than the second search step length; The N block vectors and the N candidate templates corresponding to the N block vectors are determined according to the first matching cost value, the second matching cost value, and / or the third matching cost value.

67. The method of claim 66, wherein: The determining the N block vectors and the N candidate templates corresponding to the N block vectors according to the first matching cost value, the second matching cost value, and / or the third matching cost value includes: Determining N minimum matching cost values ​​among the third matching cost values; The N block vectors and the N candidate templates corresponding to the N block vectors are determined based on the N search points corresponding to the N minimum matching cost values.

68. The method of claim 66, wherein: The determining the N block vectors and the N candidate templates corresponding to the N block vectors according to the first matching cost value, the second matching cost value, and / or the third matching cost value includes: Determine T block vectors and T candidate templates corresponding to the T block vectors according to the third matching cost value; wherein T is an integer greater than 0 and less than N; Based on the first generation value and the second generation value, NT block vectors other than the M reference block vectors and NT candidate templates corresponding to the NT block vectors are determined.

69. The method of claim 66, wherein: The method further comprises: Determine the P initial block vectors based on the first generation value and the second generation value; wherein P is an integer greater than or equal to M; The M reference block vectors are determined according to the P initial block vectors.

70. The method of claim 41, wherein: The method further comprises: determining one or more reference blocks for the current block according to the one or more block vectors; A prediction value of the current block is determined according to the one or more reference blocks.

71. The method of claim 70, wherein: The determining one or more reference blocks of the current block according to the one or more block vectors comprises: Determine one or more initial reconstructed blocks corresponding to the current block according to the one or more block vectors; The one or more initial reconstructed blocks are corrected to determine the one or more reference blocks.

72. The method of claim 41, wherein: The method further comprises: Determine an optimal block vector for the current block according to one or more block vectors of the current block; Determine at least one reference block corresponding to the current block according to the best block vector; A prediction value of the current block is determined according to the at least one reference block.

73. The method of claim 72, wherein: in, The determining, according to the at least one reference block, a prediction value of the current block comprises: at least one prediction block corresponding to the at least one reference block; The at least one prediction block is weightedly integrated to determine a prediction value of the current block.

74. The method of claim 41, wherein: The method further comprises: Determine a first prediction value of the current block according to one or more block vectors of the current block; Determining a second prediction value of the current block according to a preset prediction mode; wherein the preset prediction mode includes a planar mode and / or a directional mode; A prediction value of the current block is determined according to the first prediction value and the second prediction value.

75. The method of claim 59, wherein: The preset matching criteria include any one of the sum of absolute error SAD, the sum of transformed absolute error SATD, the sum of squared differences SSE, the mean absolute difference MAD, the mean absolute error MAE, the mean squared error MSE, and the normalized correlation coefficient NCC.

76. The method of claim 41, wherein: The determining the first template corresponding to the current block includes: A template type corresponding to the current block is determined, and a first template corresponding to the current block is determined according to the template type.

77. The method of claim 76, wherein: The determining of the template type corresponding to the current block includes: Determine the template type of the current block according to the reference pixels of the current block; or, Determine the template type of the current block according to indication information in the bitstream; or, Determining a template type of the current block according to the size of the current block; Among them, the reference pixels of the current block include at least one of the following: the left adjacent reference pixels of the current block, the upper adjacent reference pixels of the current block, the upper left adjacent reference pixels of the current block, the lower left adjacent reference pixels of the current block, and the upper right adjacent reference pixels of the current block.

78. The method of claim 76, wherein: The determining, according to the reference pixel of the current block, the template type of the current block comprises: If the left adjacent reference pixel of the current block, the upper adjacent reference pixel of the current block, and the upper left adjacent reference pixel of the current block are all available, determining that the template type of the current block is a first value; If the left adjacent reference pixel of the current block is available, determining the template type of the current block to be a second value; If the upper adjacent reference pixel of the current block is available, determining the template type of the current block to be a third value; If both the left adjacent reference pixel of the current block and the upper left adjacent reference pixel of the current block are available, determining that the template type of the current block is a fourth value; If both the left adjacent reference pixel of the current block and the lower left adjacent reference pixel of the current block are available, determining that the template type of the current block is a fifth value; If both the upper neighboring reference pixels of the current block and the upper right neighboring reference pixels of the current block are available, the template type of the current block is determined to be a sixth value.

79. The method of claim 41, wherein: The determining, according to the template type, a first template corresponding to the current block includes: Determining a template reference pixel of the current block according to the template type and a template size corresponding to the template type; A first template of the current block is determined according to the template reference pixels.

80. The method according to any one of claims 70 to 74, wherein: The method further comprises: Determine a prediction difference value corresponding to the current block, and write the prediction difference value into a bitstream; A reconstructed value of the current block is determined according to the prediction difference value and the prediction value of the current block.

81. A code stream, wherein The code stream is generated by bit encoding according to the information to be encoded; wherein the information to be encoded includes at least one of the following: The prediction difference of the current block, the preset number N, the narrowing parameter, the size of the template, and the template type indication information.

82. An encoder, comprising a first determining unit; wherein, The first determination unit is configured to determine a first template corresponding to the current block; determine a full reconstruction search area and / or a pending reconstruction search area according to the first template; wherein the full reconstruction search area includes reconstructed sampling points, and the pending reconstruction search area includes reconstructed sampling points and / or unreconstructed sampling points; perform area selection based on the full reconstruction search area and / or the pending reconstruction search area, and determine a selected full reconstruction search area and / or a selected pending reconstruction search area; wherein the selected full reconstruction search area is smaller than or equal to the full reconstruction search area, and the selected pending reconstruction search area is smaller than or equal to the pending reconstruction search area; and perform searches in the selected full reconstruction search area and / or the selected pending reconstruction search area respectively to determine one or more block vectors of the current block.

83. An encoder comprising a first memory and a first processor; wherein, The first memory is used to store a computer program that can be run on the first processor; The first processor is configured to execute the method according to any one of claims 41 to 80 when running the computer program.

84. A decoder comprising a second determination unit; wherein: The second determination unit is configured to determine a first template corresponding to the current block; determine a full reconstruction search area and / or a pending reconstruction search area according to the first template; wherein the full reconstruction search area includes reconstructed sampling points, and the pending reconstruction search area includes reconstructed sampling points and / or unreconstructed sampling points; perform area selection based on the full reconstruction search area and / or the pending reconstruction search area, and determine a selected full reconstruction search area and / or a selected pending reconstruction search area; wherein the selected full reconstruction search area is smaller than or equal to the full reconstruction search area, and the selected pending reconstruction search area is smaller than or equal to the pending reconstruction search area; and perform searches in the selected full reconstruction search area and / or the selected pending reconstruction search area respectively to determine one or more block vectors of the current block.

85. A decoder, comprising a second memory and a second processor; wherein: The second memory is used to store a computer program that can be run on the second processor; The second processor is configured to execute the method according to any one of claims 1 to 40 when running the computer program.

86. A computer-readable storage medium, wherein: The computer-readable storage medium stores a computer program, and when the computer program is executed, the method according to any one of claims 1 to 40 is implemented, or the method according to any one of claims 41 to 80 is implemented.