Encoding / decoding methods, bitstreams, encoders, decoders, and storage media
By selecting smaller search regions based on the first template, the method addresses the inefficiencies in Intra TMP, improving encoding and decoding efficiency and accuracy by limiting the search area and utilizing available sampling points.
Patent Information
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
- Filing Date
- 2023-04-14
- Publication Date
- 2026-06-19
AI Technical Summary
Existing video encoding methods using Intra Template Matching Prediction (Intra TMP) face challenges in achieving higher prediction accuracy while maintaining efficiency and performance due to increased complexity from obtaining more valid reference information.
The proposed method involves determining a first template corresponding to a block, selecting a smaller fully reconstructed and/or undetermined reconstructed search region based on this template, and performing a search within these regions to determine block vectors, thereby reducing the search area and complexity while obtaining effective reference information.
This approach improves the efficiency and performance of encoding and decoding by utilizing available sampling points within limited search regions, effectively reducing complexity while enhancing prediction accuracy.
Smart Images

Figure 2026519938000001_ABST
Abstract
Description
[Technical Field]
[0001] This application relates to the technical field of video codecs, and more particularly to encoding and decoding methods, bitstreams, encoders, decoders, and storage media. [Background technology]
[0002] The Intra Template Matching Prediction (Intra TMP) technique uses a template of encoded blocks to search for a matching template with the minimum cost within a predetermined search range of the current image, according to a predetermined cost function. The optimal matching reconstruction block corresponding to the matching template is then used as the predicted block for the current encoded block.
[0003] However, achieving higher prediction accuracy often requires obtaining more valid reference information, which increases the complexity of the encoding to some extent, thus reducing the efficiency and performance of encoding and decoding. [Overview of the project]
[0004] Embodiments of the present invention provide an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium that can improve the efficiency and performance of encoding and decoding.
[0005] The technical solution of the embodiment of this application is realized as follows.
[0006] In the first aspect, embodiments of the present application provide a decoding method applicable to a decoder, the method being: Currently, the first template corresponding to the block is determined, Determining a fully reconstructed search area and / or an undetermined reconstructed search area based on the aforementioned first template, wherein the fully reconstructed search area includes reconstructed sampling points, and the undetermined reconstructed search area includes reconstructed sampling points and / or unreconstructed sampling points, The process involves selecting a region based on the aforementioned complete reconstruction search region and / or the aforementioned undetermined reconstruction search region, and determining the selected complete reconstruction search region and / or the selected undetermined reconstruction search region, wherein the selected complete reconstruction search region is smaller than or equal to the aforementioned complete reconstruction search region, and the selected undetermined reconstruction search region is smaller than or equal to the aforementioned undetermined reconstruction search region. This includes performing a search in the selected complete reconstruction search area and / or the selected undetermined reconstruction search area, respectively, to determine one or more block vectors of the current block.
[0007] In a second aspect, embodiments of the present application provide an encoding method applicable to an encoder, the method being: Currently, the first template corresponding to the block is determined, Determining a fully reconstructed search area and / or an undetermined reconstructed search area based on the aforementioned first template, wherein the fully reconstructed search area includes reconstructed sampling points, and the undetermined reconstructed search area includes reconstructed sampling points and / or unreconstructed sampling points, The process involves selecting a region based on the aforementioned complete reconstruction search region and / or the aforementioned undetermined reconstruction search region, and determining the selected complete reconstruction search region and / or the selected undetermined reconstruction search region, wherein the selected complete reconstruction search region is smaller than or equal to the aforementioned complete reconstruction search region, and the selected undetermined reconstruction search region is smaller than or equal to the aforementioned undetermined reconstruction search region. This includes performing a search in the selected complete reconstruction search area and / or the selected undetermined reconstruction search area, respectively, to determine one or more block vectors of the current block.
[0008] In a third aspect, an embodiment of the present application provides a bitstream, which is generated by bit encoding based on information to be encoded, and the information to be encoded is The current block includes at least one of the following: predicted difference, predetermined quantity N, scaling parameter, template size, and template type indication information.
[0009] In a fourth aspect, an embodiment of the present application provides an encoder comprising a first determination unit, The first decision unit is configured to perform the following: determine a first template corresponding to the current block; determine a full reconstruction search region and / or an undetermined reconstruction search region based on the first template, wherein the full reconstruction search region includes reconstructed sampling points and the undetermined reconstruction search region includes reconstructed sampling points and / or unreconstructed sampling points; perform region selection based on the full reconstruction search region and / or the undetermined reconstruction search region to determine a selected full reconstruction search region and / or a selected undetermined reconstruction search region, wherein the selected full reconstruction search region is smaller than or equal to the full reconstruction search region and the selected undetermined reconstruction search region is smaller than or equal to the undetermined reconstruction search region; and perform a search in the selected full reconstruction search region and / or the selected undetermined reconstruction search region, respectively, to determine one or more block vectors of the current block.
[0010] In a fifth aspect, an embodiment of the present application provides an encoder comprising a first memory and a first processor, The first memory is configured to store a computer program that can be executed by the first processor. The first processor is configured to perform the method described in the second embodiment when executing the computer program.
[0011] In a sixth aspect, an embodiment of the present application provides a decoder comprising a second determination unit, The second decision unit is configured to perform the following: determine a first template corresponding to the current block; determine a full reconstruction search region and / or an undetermined reconstruction search region based on the first template, wherein the full reconstruction search region includes reconstructed sampling points, and the undetermined reconstruction search region includes reconstructed sampling points and / or unreconstructed sampling points; perform region selection based on the full reconstruction search region and / or the undetermined reconstruction search region to determine a selected full reconstruction search region and / or a selected undetermined reconstruction search region, wherein the selected full reconstruction search region is smaller than or equal to the full reconstruction search region, and the selected undetermined reconstruction search region is smaller than or equal to the undetermined reconstruction search region; and perform a search in the selected full reconstruction search region and / or the selected undetermined reconstruction search region, respectively, to determine one or more block vectors of the current block.
[0012] In the seventh aspect, an embodiment of the present application provides a decoder comprising a second memory and a second processor, The second memory is configured to store computer programs that can be executed by the second processor, The second processor is configured to perform the method described in the first embodiment when executing the computer program.
[0013] In the eighth aspect, an embodiment of the present application provides a computer-readable storage medium in which a computer program is stored, and when the computer program is executed, it implements the method according to the first aspect or the method according to the second aspect.
[0014] Embodiments of the present application provide an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium, wherein the codec determines a first template corresponding to the current block; determines a full reconstruction search region and / or an undetermined reconstruction search region based on the first template, wherein the full reconstruction search region includes reconstructed sampling points, and the undetermined reconstruction search region includes reconstructed sampling points and / or unreconstructed sampling points; performs region selection based on the full reconstruction search region and / or the undetermined reconstruction search region to determine a selected full reconstruction search region and / or a selected undetermined reconstruction search region, wherein the selected full reconstruction search region is smaller than or equal to the full reconstruction search region, and the selected undetermined reconstruction search region is smaller than or equal to the undetermined reconstruction search region; and performs a search in the selected full reconstruction search region and / or the selected undetermined reconstruction search region, respectively, to determine one or more block vectors of the current block. Thus, in the embodiments of the present application, after determining a fully reconstructed search area and / or an undetermined reconstructed search area including reconstructed sampling points and / or unreconstructed sampling points based on the first template, a region selection process is performed on the fully reconstructed search area and / or the undetermined reconstructed search area to obtain a selected fully reconstructed search area and / or a selected undetermined reconstructed search area with a relatively small range, and a search can be performed in the selected fully reconstructed search area and / or selected undetermined reconstructed search area. In other words, the encoding and decoding method proposed in the embodiments of the present application can utilize available sampling points within the undetermined reconstructed search area, while simultaneously limiting the search range to some extent, and furthermore, it can sufficiently obtain more effective reference information while reducing the complexity of encoding and decoding, thereby improving the efficiency and performance of encoding and decoding. [Brief explanation of the drawing]
[0015] [Figure 1] This is a schematic diagram showing the prediction of Intra TMP. [Figure 2] This is a schematic diagram of the prediction process based on IntraTMP technology. [Figure 3]This is a schematic diagram illustrating the template types of Intra TMP technology. [Figure 4] This is a schematic diagram of the search process based on IntraTMP technology. [Figure 5] This is a schematic diagram showing the parameter definitions for the current block and its template. [Figure 6] This is a schematic diagram showing the template search area. [Figure 7] This is the first schematic diagram showing the division of the search domain into different sub-domains. [Figure 8] This is the first schematic diagram illustrating the process of determining the search area. [Figure 9] This is a schematic diagram of the search process. [Figure 10A] This is a block diagram showing the encoder configuration. [Figure 10B] This is a block diagram showing the encoder configuration. [Figure 11] This is a schematic diagram showing the network architecture configuration of the codec system. [Figure 12] This is a schematic flowchart of the decoding method proposed in the embodiment of the present invention. [Figure 13] This is a second schematic diagram showing the division of the search domain into different sub-domains. [Figure 14] This is a second schematic diagram illustrating the process of determining the search area. [Figure 15] This is the first schematic diagram illustrating region selection. [Figure 16] This is a second schematic diagram illustrating region selection. [Figure 17] This is a third schematic diagram illustrating region selection. [Figure 18] This is the fourth schematic diagram illustrating region selection. [Figure 19] This is the fifth schematic diagram illustrating region selection. [Figure 20] This is the sixth schematic diagram illustrating region selection. [Figure 21] This is the seventh schematic diagram illustrating region selection. [Figure 22] This is the eighth schematic diagram illustrating region selection. [Figure 23] This is the ninth schematic diagram illustrating region selection. [Figure 24] This is the tenth schematic diagram illustrating region selection. [Figure 25] This is the 11th schematic diagram illustrating region selection. [Figure 26] This is the 12th schematic diagram illustrating region selection. [Figure 27] This is a schematic flowchart of the encoding method proposed in the embodiment of the present invention. [Figure 28] This is a schematic diagram showing the configuration of an encoder. [Figure 29] This is a schematic diagram showing the hardware configuration of the encoder. [Figure 30] This is a schematic diagram showing the configuration of the decoder. [Figure 31] This is a schematic diagram showing the hardware configuration of the decoder. [Figure 32] This is a schematic diagram showing the configuration of the codec system. [Modes for carrying out the invention]
[0016] In order to understand the features and technical details of the embodiments of this application in more detail, the implementation of the embodiments of this application will be described in detail below with reference to the drawings. The attached drawings are for reference only and are not intended to limit the embodiments of this application.
[0017] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art. The terms used herein are adopted solely for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0018] In the following, the phrase "several embodiments" describes a subset of all possible embodiments, but it is understandable that "several embodiments" may be the same subset or a different subset of all possible embodiments and can be combined with each other without contradiction. Furthermore, it should be noted that terms such as "first / second / third" in the embodiments of this application do not limit a specific order, but rather distinguish similar objects. It is understandable that "first / second / third" can be changed in a specific order or chronological order where appropriate, so that the embodiments of this application described herein may be performed in an order other than that illustrated or described herein.
[0019] Before describing the embodiments of this application in detail, the nouns and terms used in the embodiments of this application will be explained. The explanations of the nouns and terms used in the embodiments of this application will apply to the following interpretations.
[0020] Coding Block (CB) Block matching (BM) Coding Unit (CU) Block Vector (BV); Sum of Absolute Difference (SAD), Sum of Absolute Transformed Difference (SATD) Mean Squared Error (MSE), Sum of Squared Differences (SSD) Mean Absolute Deviation (MAD) Mean Squared Differences (MSD) Normalized Correlation Coefficient (NCC) H.266 / Versatile Video Coding (VVC), VVC Reference Software Test Platform (VTM: VVC Test Model) Intra Template Matching Prediction (Intra TMP) Beyond VVC Reference Software Testing Platform (ECM: Enhanced Compression Model).
[0021] Understandably, video images are typically represented by coded blocks consisting of a first color component, a second color component, and a third color component. Here, these three color components are the luminance component, the blue chromaticity component, and the red chromaticity component, respectively. Specifically, the luminance component is usually represented by the code Y, the blue chromaticity component by the code Cb or U, and the red chromaticity component by the code Cr or V. Thus, video images can be represented in YCbCr format or YUV format.
[0022] Furthermore, Intra TMP is a special intra prediction mode in which both the encoder and decoder use a coding block template (T) to search for the matching template (T_BEST) with the minimum cost within a predetermined search range of the current image, according to a predetermined cost function. Here, the offset of the optimal matching template relative to the current coding block template is the optimal block vector (BV_BEST: BEST Block Vector), and then the reconstructed block (Ref Block) corresponding to the matching template is used as the prediction block for the current coding block (Cur Block). Here, the adjacent reconstruction region of the current coding block is usually selected as the coding block template.
[0023] As an example, taking the adjacent reconstruction region of the current block as an example, Figure 1 is a schematic diagram showing the prediction of Intra TMP. As shown in Figure 1, the areas filled with dark colors represent the reconstruction region, the grid-filled blocks are the current block and the adjacent region of the current block is the first template (T), the shaded blocks are reference blocks and the adjacent region of the reference block is the second template (i.e., the optimal matching template, T_BEST). Here, the offset of the second template relative to the first template is the optimal block vector (BV_BEST), and in this case, the reference block can be block-copied to become the predicted block of the current block.
[0024] In the embodiments of this application, the predetermined cost function may be the absolute difference sum (SAD), the absolute transformation difference sum (SATD), the mean squared error (MSE), the difference squared sum (SSD), the mean absolute difference (MAD), the mean difference squared sum (MSD), the normalized correlation coefficient (NCC), and the like, and is not specifically limited here.
[0025] As an example, taking the absolute difference sum (SAD) as an example, the cost function in this case is as follows:
[0026]
number
[0027] The prediction process of Intra TMP technology in related technologies will be described in detail below.
[0028] The inputs to IntraTMP are the current block position (xTbCmp, yTbCmp), the current block width nTbW, and the current block height nTbH.
[0029] The output of IntraTMP is the predicted value of the current block, predSamples[x][y], where x=0…nTbW-1 and y=0…nTbH-1.
[0030] Specifically, the prediction process of the IntraTMP technology is divided into four steps: determining the current template type, obtaining the current template reconstruction pixels, determining the block vector within a given search range, and generating the predicted value. In this way, the predicted value of the current block can be obtained through the above process. It should be noted that the Intra TMP technology may be used to predict the luminance component or the chromaticity component, and is not specifically limited to either here.
[0031] Referring to Figure 2, which is a schematic diagram of a prediction process based on IntraTMP technology, this process may include the following steps:
[0032] In step S201, the current template type is determined.
[0033] It should be explained that the Intra TMP technology uses the adjacent reconstructed pixels of the current block as a template and searches for a matching template in a predetermined search area. Here, the adjacent reconstructed pixels may be the upper reference pixels, upper left reference pixels, upper right reference pixels, left reference pixels, and lower left reference pixels of the current block, etc. Therefore, the template type can be classified based on whether adjacent reconstructed pixels are available, and the corresponding template type can be determined.
[0034] Furthermore, it should be explained that refTemplateType can represent the template type, and Figure 3 is a schematic diagram illustrating the template types of Intra TMP technology. As shown in Figure 3, the filled-in grid blocks are current blocks, and the adjacent regions of the current blocks are templates T, where six types of templates are shown.
[0035] For example, these six template types are as follows:
[0036] If the upper left reference pixel, upper reference pixel, and left reference pixel are all available, the value of refTemplateType is 1, and the template shape is as shown in Figure 3(a). If only the left reference pixel is available, the value of refTemplateType is 2, and the template shape is as shown in Figure 3(b). If only the upper reference pixel is available, the value of refTemplateType is 3, and the template shape is as shown in Figure 3(c). If only the left reference pixel and the upper left reference pixel are available, the value of refTemplateType is 4, and the template shape is as shown in Figure 3(d). If only the left reference pixel and the lower left reference pixel are available, the value of refTemplateType is 5, and the template shape is as shown in Figure 3(e). When only the upper and upper right reference pixels are available, the value of refTemplateType is 6, and the template shape is as shown in Figure 3(f).
[0037] In step S202, the current template pixel is obtained.
[0038] It should be explained that the template for Intra TMP technology can consist of reconstructed pixels from one or more regions of the current block: the top, top right, left, bottom left, and top left sides. Furthermore, the template size can be pre-configured. For example, when obtaining the left-side template, the template width templateW_size can be set to 4, and when obtaining the top-side template, the template height templateH_size can be set to 4.
[0039] Furthermore, it should be explained that the value of refTemplateType determines which parts of the reconstructed pixels to retrieve. For example, if the value of refTemplateType is 1, the reconstructed pixels on the left, upper left, and top of the current block are retrieved; if the value of refTemplateType is 2, only the reconstructed pixels of the left four columns of the current block are retrieved; or if the value of refTemplateType is 3, only the reconstructed pixels of the top four rows of the current block are retrieved.
[0040] In step S203, a block vector is determined within a predetermined search range.
[0041] To explain further, the search process of Intra TMP technology can be mainly divided into the initialization process, the determination of the template search area in the current frame, and the search within the search area and the determination of the optimal block vector.
[0042] Furthermore, it should be explained that when searching for the optimal matching template in the search domain, a search method may be adopted that involves a rough search followed by a fine search, or only a fine search may be performed, or only a rough search may be performed; this is not specifically limited here.
[0043] In the embodiments of the present application, the coarse search hereof may specifically involve determining the optimal coarse matching template in the search domain with a first predetermined step length (e.g., 2), or determining the optimal coarse matching template in the search domain using a downsampled template (e.g., with a downsampling factor of 2).
[0044] In the embodiments of the present application, the fine search hereof may specifically involve determining the optimal fine matching template in the search region with a second predetermined step length (e.g., 1), or determining the optimal fine matching template in the vicinity of the optimal rough matching template after performing a rough search.
[0045] Referring to Figure 4, Figure 4 is a schematic diagram of a search process based on the IntraTMP technology provided in an embodiment of the present application. As shown in Figure 4, this process may include the following steps:
[0046] In step S401, the parameters are initialized.
[0047] To explain, taking an L-shaped template as an example, uiPatchWidth is initialized as nTbW + templateW_size, and uiPatchHeight is initialized as nTbH + templateH_size. Here, templateW_size and templateH_size may be fixed constants, or they may be dynamically adjusted based on the current block size. Also, templateW_size and templateH_size may or may not be equal. For example, templateW_size=4 and templateH_size=4, or if the current block width is greater than 8, templateW_size=4; if the current block width is 8 or less, templateW_size=2; if the current block height is greater than 8, templateH_size=4; and if the current block height is 8 or less, templateH_size=2.
[0048] As an example, Figure 5 is a schematic diagram showing the parameter definitions for the current block and its template. As shown in Figure 5, the specific meanings of the parameters are as follows: nTbW and nTbH represent the size of the current block, templateW_size and templateH_size represent the template size, and uiPatchWidth and uiPatchHeight represent the block size including the current block and its template.
[0049] Furthermore, the cost threshold between templates is initialized as diffThreshold. For example, if the cost function is SAD, the threshold is diffThreshold=((1<<bitDepth)> >2) × (uiPatchHeight × uiPatchWidth - nTbH × nTbW). Here, if the bit depth of the image is 10, then diffThreshold represents a distortion threshold of 256 for each pixel point in the template region.
[0050] Furthermore, the positions of the coding tree block CTB, where block CB is currently located, are initialized as ctbRsX and ctbRsY.
[0051] Furthermore, the positional offset of the current block CB in the current CTB is initialized as offsetLCBY=yTbCmp-ctbRsY and offsetLCBX=xTbCmp-ctbRsX.
[0052] Furthermore, initialize iTemplateSizeH=templateH_size and iTemplateSizeW=templateW_size.
[0053] Furthermore, iBvShift is initialized, and iBvShift is the precision of the block vector BV. For example, the precision of BV can be pixel-level precision, in which case iBvShift is 0. Alternatively, the precision of BV can be sub-pixel precision; for example, iBvShift = 1 represents 1 / 2 pixel precision, and iBvShift = 2 represents 1 / 4 pixel precision, and this is not specifically limited here.
[0054] Furthermore, the predetermined search range of the template is initialized. The predetermined search range of the template may be set to a fixed size, or it may be dynamically adjusted based on the encoded block size. For example, searchRangeWidth = TMP_SEARCH_RANGE_MULT_FACTOR × nTbW, searchRangeHeight = TMP_SEARCH_RANGE_MULT_FACTOR × nTbH, where the value of TMP_SEARCH_RANGE_MULT_FACTOR may be a predetermined value, for example, it can be set to 5.
[0055] In step S402, the search area for templates in the current frame is determined.
[0056] It should be explained that the search area of IntraTMP technology is the reconstructed portion of the current image and is limited by the size of the search range. Figure 6 is a schematic diagram showing the template search area. As shown in Figure 6, the dark-colored background area is the reconstructed area, the black-colored background block is the current block, and the dashed line frame is the search range window. Therefore, the search area of IntraTMP technology does not exceed the overlapping portion between the reconstructed area shown by the dark-colored background and the area shown by the dashed line frame.
[0057] Thus, the current search region of the block template may be the reconstructed portion of the CTB where the current block is located, or it may be another reconstructed CTB region. In practice, the search region is the set of all search points. Since the shape of the region cannot often be represented by a single rectangular region, in concrete implementations, searches can be performed in multiple rectangular regions, and the search results from different regions can be combined to obtain the final optimal matching block and optimal block vector.
[0058] For illustrative purposes, referring to Figure 7, which is a schematic diagram showing the division of a search domain into different subdomains. As shown in Figure 7, eight different subdomain division methods are shown. Here, the black-filled background block is the current block, and the five division methods (a), (b), (c), (d), and (f) all divide the search domain into four sub-search domains, while the three division methods (e), (g), and (h) all divide the search domain into three sub-search domains, where different fill patterns represent one sub-search domain.
[0059] In Figure 7, (a), (b), (c), and (d) consider all available search ranges, while (e), (f), (g), and (h) do not search the region directly above and directly to the left.
[0060] For illustrative purposes, let's assume that different sub-search regions are distinguished and represented by regionId. Considering that the template pixels of the current block must be obtained from the image reconstruction region, and the reconstructed block pixels corresponding to the template must also be obtained from the reconstruction region, it is necessary to further determine the searchable locations in the sub-search regions represented by different regionIds based on the current block's position (xTbCmp, yTbCmp), the current block's size (nTbW, nTbH), the current image's size (picWidth, picHeight), the size of the CTB where the current block is located (CtbSizeW, CtbSizeH), the predetermined search range of the template (search RangeWidth, searchRangeHeight), and the current block's position offset in the current CTB (offsetLCBY, offsetLCBX), thereby determining the block vector BV. Specifically, iVerMin and iVerMax represent the minimum and maximum absolute coordinate positions that can be searched in the vertical direction, respectively, while iHorMin and iHorMax represent the minimum and maximum absolute coordinate positions that can be searched in the horizontal direction. The values of iVerMin, iVerMax, iHorMin, and iHorMax differ for each search region represented by a different regionId.
[0061] Taking Figure 7(f) as an example, the implementation method for dividing the search domain into four sub-search domains is as follows:
[0062] If regionId is equal to 0, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0063] iHorMax0=min((xTbCmp+searchRangeWidth)< <iBvShift,((picWidth-nTbW)<<iBvShift)) iHorMin0=max((iTemplateSizeW)< <iBvShift,(xTbCmp-searchRangeWidth)<<iBvShift) iVerMax0=(yTbCmp-nTbH-offsetLCBY)< <iBvShift iVerMin0=max(((iTemplateSizeH)< <iBvShift),((yTbCmp-searchRangeHeight)<<iBvShift)) If regionId is equal to 1, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0064] iHorMin1=max((iTemplateSizeW)< <iBvShift,(xTbCmp-searchRangeWidth)<<iBvShift) iHorMax1=(xTbCmp-offsetLCBX-nTbW)< <iBvShift iVerMin1=(yTbCmp+1)< <iBvShift iVerMax1=min((picHeight-nTbH)< <iBvShift,(yTbCmp-offsetLCBY+CtbSizeH-nTbH)<<iBvShift) If regionId is equal to 2, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0065] iHorMax2=(xTbCmp-offsetLCBX-nTbW)< <iBvShift iHorMin2=max((iTemplateSizeW)< <iBvShift,(xTbCmp-searchRangeWidth)<<iBvShift) iVerMin2=max((iTemplateSizeH)< <iBvShift,(yTbCmp-nTbH-offsetLCBY)<<iBvShift) iVerMax2=(yTbCmp)< <iBvShift If regionId is equal to 3, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0066] iHorMin3=max((iTemplateSizeW)< <iBvShift,(xTbCmp-offsetLCBX-nTbW+1)<<iBvShift) iHorMax3=(xTbCmp-nTbW)< <iBvShift iVerMin3=max(((iTemplateSizeH)< <iBvShift),(yTbCmp-offsetLCBY-nTbH+1)<<iBvShift) iVerMax3=(yTbCmp-nTbH)< <iBvShift In actual applications, iHorMin regionId iHor Max regionId iVerMin regionId iVerMax regionId These represent the left, right, top, and bottom edges of different sub-search regions, respectively.
[0067] Refer to Figure 8 for an intuitive explanation of the different sub-search regions corresponding to different regionIds. Figure 8 is a schematic diagram showing the process of determining a specific search region. As shown in Figure 8, R1, R2, R3, and R4 represent four different sub-search regions. Note that in Figure 8, the upper-left corner pixel of the block is represented by the pixel range that can be aligned.
[0068] In step S403, search is performed in the search area to determine the optimal block vector BV.
[0069] It should be noted that bvXMins and bvXMaxs represent the minimum offset and the maximum offset in the horizontal direction of the block vector, respectively, and bvYMins and bvYMaxs represent the minimum offset and the maximum offset in the vertical direction of the block vector, respectively.
[0070] bvXMins regionId 、bvXMaxs regionId 、bvYMins regionId 、bvYMaxs regionId are calculated as follows using iVerMin regionId 、iVerMax regionId 、iHorMin regionId 、iHorMax regionId determined in step S402.
[0071] bvXMins regionId =iHorMin regionId -xTbCmp bvXMaxs regionId =iHorMax regionId -xTbCmp bvYMins regionId =iVerMin regionId -yTbCmp bvYMaxs regionId =iVerMax regionId -yTbCmp Here, bvXMins regionId 、bvXMaxs regionId 、bvYMins regionId 、and bvYMaxs regionId determine the range of the horizontal and vertical offset amounts with respect to the current block of the search point, that is, the range of the block vector BV.
[0072] Furthermore, it should be further explained that (pX, pY) is constituted by the search points (iPosHor, iPoxVer) within each search region and each block vector BV (composed of a horizontal component and a vertical component), where pX = iPosHor - xTbCmp and pY = iPosVer - yTbCmp. In this case, pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs. Thus, a matching reconstruction block of one current block can be found in the reconstruction region, and the adjacent reconstruction pixels of the matching reconstruction block are the matching template (i.e., the aforementioned second template). Thereby, the matching cost value between the adjacent template of the current block and the adjacent template of the matching reconstruction block can be calculated and denoted as pDiff.
[0073] Furthermore, all search points within all search ranges (regionId = 0, 1, 2, 3) are scanned, and the search point with the minimum matching cost value pDiff is obtained by comparison. The corresponding matching cost value is denoted as pDiff_BEST, the corresponding block vector BV is denoted as the optimal block vector BV_BEST (pX_BEST, pY_BEST), and the corresponding matching template is denoted as the optimal matching template T_BEST.
[0074] In a possible implementation form, when the search method only performs a rough search, the specific implementation is as follows.
[0075] In each region, when pX is between bvXMins regionId and bvXMaxs regionId and pY is between bvYMins regionId and bvYMaxs regionId a rough search is performed with a step length greater than 1 within the search range. For example, a rough search is performed with a step length of 2, and the optimal matching cost value obtained by template matching is used as pDiff_BEST, and the corresponding block vector BV is denoted as the optimal block vector BV_BEST (pX_BEST, pY_BEST).
[0076] In another possible implementation, where the search method performs only fine search, the specific implementation is as follows:
[0077] In each domain, pX is bvXMins regionId and bvXMaxs regionId It is between and and pY is bvYMins regionId and bvYMaxs regionId Within the search range between the specified values, for example, a fine search is performed with a step length of 1, and the optimal matching cost value obtained by template matching is recorded as pDiff_BEST, and the corresponding block vector BV is recorded as optimal block vector BV_BEST(pX_BEST,pY_BEST).
[0078] In yet another possible implementation, the search method performs a rough search followed by a fine search, and Figure 9 is a schematic diagram of the search process. As shown in Figure 9, the specific process is as follows:
[0079] In step S901, the optimal coarse matching template is determined in the search domain with a step length of 2.
[0080] In step S902, the optimal fine matching template is determined in the vicinity of the optimal coarse matching template with a step length of 1.
[0081] One thing to explain is that in the case of step S901, during the rough search stage, In each domain, pX is bvXMins regionId and bvXMaxs regionId It is between and and pY is bvYMins regionId and bvYMaxs regionIdWithin the search range between [the specified values], a rough search is performed with a step length greater than 1. For example, a rough search is performed with a step length of 2, and the optimal matching cost obtained by template matching is denoted as pDiff1_BEST, the corresponding block vector BV is denoted as the optimal block vector BV1_BEST(pX1_BEST,pY1_BEST), and the search region where the optimal matching search point is located is denoted as bestRegionId.
[0082] Furthermore, it should be explained that in the case of step S902, during the refinement stage, Further searching is performed in the neighborhood of the optimal block vector BV1_BEST obtained through the rough search. Specifically, first, the fine search range TmpRefineRange is determined. The fine search range may be a fixed size or may be associated with the current block size, for example, it can be set to min(nTbW,nTbH) / 2. Next, the position of the optimal matching reconstruction block obtained through the rough search is calculated as the reference position of the fine search range, i.e., BestPosX=xTbCmp+pX1_BEST and BestPosY=yTbCmp+pY1_BEST.
[0083] Based on the value of bestRegionId, first calculate iVerMin bestRegionId iVerMax bestRegionId iHorMin bestRegionId iHor Max bestRegionId The value is obtained, and then a new search range iVerMin is created based on the optimal matching block position obtained through coarse search. refine iVerMax refine iHorMin refine iHor Max refine Obtain it. The method of obtaining it is as follows:
[0084] iHorMin refine =max(iHorMin bestRegionId (BestPosX-TmpRefineRange) iHor Max refine =min(iHorMax bestRegionId(BestPosX + TmpRefineRange) iVerMin refine =max(iVerMin bestRegionId (BestPosY-TmpRefineRange) i VerMax refine =min(iVerMax bestRegionId (BestPosY+TmpRefineRange) Next, the adjusted block vectors BVbvXMins, bvXMaxs, bvYMins, bvYMaxs are obtained from iVerMin refine iVerMax refine iHorMin refine iHor Max refine It is obtained by calculation using [this method].
[0085] bvXMins=iHorMin refine -xTbCmp bvXMaxs=iHorMax refine -xTbCmp bvYMins=iVerMin refine -yTbCmp bvYMaxs=iVerMax refine -yTbCmp Thus, the fine search is performed within the block vector range where pX lies between bvXMinsrefine and bvXMaxsrefine, and pY lies between bvYMinsrefine and bvYMaxsrefine. For example, a search is performed with a step length of 1, and the optimal matching cost obtained by template matching is denoted as pDiff_BEST, and the corresponding block vector BV is denoted as optimal block vector BV_BEST(pX_BEST,pY_BEST).
[0086] After the above operations are completed, the optimal block vector BV_BEST(pX_BEST, pY_BEST) is obtained, where pX_BEST and pY_BEST are the horizontal offset amount and the vertical offset amount of the optimal matching template with respect to the current block template, respectively, and also the horizontal offset amount and the vertical offset amount of the optimal matching reconstruction block with respect to the current block.
[0087] In step S204, a predicted value is generated.
[0088] Here, it can be realized by using a simple parallel translation copy. The specific operation is as follows.
[0089] Taking x = 0…nTbW - 1 and y = 0…nTbH - 1 as the processing targets, predSamples[x][y] = recSamples[x + pX_BEST][y + pY_BEST] (2) Here, recSamples represents the reconstructed pixels of the current frame.
[0090] Understandably, in the IntraTMP mode, in addition to the method of obtaining the predicted value by the above basic copy method, a method of obtaining the predicted value by performing filtering fusion at positions corresponding to multiple BVs, and a method of performing fusion prediction with the normal Intra mode can also be used.
[0091] Exemplarily, in the region search process on the decoding side, after obtaining the BV candidate list by using the matching of the template, the first N (for example, N = 3) in it can be selected for weighted fusion. This method may be called the IntraTMP Fusion mode.
[0092] Exemplarily, after obtaining one optimal BV, multiple points are taken around this BV, and weighted fusion is performed on the predicted values corresponding to the multiple points to obtain the predicted value. This method may be called the IntraTMP FLM mode.
[0093] For example, after obtaining one optimal BV, the final predicted value can be obtained by weighting and combining the predicted value obtained using this BV with the predicted value obtained in normal Intra mode. Here, the normal Intra mode may be Planar mode or Direction mode, and this Direction mode may be derived by TIMD and obtained by positioning within the Intra candidate table using an Index transmitted in a bitstream. This method may also be called IntraTMP CIIP mode.
[0094] Simply put, in related technologies, Intra TMP technology uses a template of the current block to search for a matching template with the minimum cost within a predetermined search range of the current image according to a predetermined cost function, and the optimal matching reconstruction block (Ref Block) corresponding to the matching template is used as the predicted block for the current block (Cur Block). Here, the template of the current block is usually selected from the adjacent reconstruction regions of the current block.
[0095] In actual coding processes, to address the problem that search methods cannot fully utilize the information of reconstructed neighboring sampling points, it is often necessary to acquire more effective reference information to improve prediction accuracy. For example, the search can be extended to an undetermined reconstruction search region, and when searching within this region, availability judgments must be made for the search points within it. However, performing availability judgments for all search points in the entire undetermined reconstruction search region increases the complexity of the coding.
[0096] As described above, in general encoding and decoding methods, achieving higher prediction accuracy often requires obtaining more valid reference information, which increases the complexity of the encoding to some extent, thus reducing the efficiency and performance of encoding and decoding.
[0097] To solve the above problems, embodiments of the present application provide an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium. The codec determines a first template corresponding to the current block, determines a fully reconstructed search region and / or an undetermined reconstructed search region based on the first template, the fully reconstructed search region includes reconstructed sampling points, and the undetermined reconstructed search region includes reconstructed sampling points and / or unreconstructed sampling points. Region selection is performed based on the fully reconstructed search region and / or the undetermined reconstructed search region, determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, the selected fully reconstructed search region being smaller than or equal to the fully reconstructed search region, and the selected undetermined reconstructed search region being smaller than or equal to the undetermined reconstructed search region. A search is performed in the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, respectively, to determine one or more block vectors of the current block. Thus, in the embodiments of the present application, after determining a fully reconstructed search area and / or an undetermined reconstructed search area including reconstructed sampling points and / or unreconstructed sampling points based on the first template, a region selection process is performed on the fully reconstructed search area and / or the undetermined reconstructed search area to obtain a selected fully reconstructed search area and / or a selected undetermined reconstructed search area with a relatively small range, and a search can be performed in the selected fully reconstructed search area and / or selected undetermined reconstructed search area. In other words, the encoding and decoding method proposed in the embodiments of the present application can utilize available sampling points within the undetermined reconstructed search area, while simultaneously limiting the search range to some extent, and furthermore, it can sufficiently obtain more effective reference information while reducing the complexity of encoding and decoding, thereby improving the efficiency and performance of encoding and decoding.
[0098] The embodiments of this application will be described in detail below with reference to the drawings.
[0099] Referring to Figure 10A, Figure 10A is a block diagram showing the configuration of an encoder provided in an embodiment of the present invention. As shown in Figure 10A, the encoder (specifically, "video encoder") 100 may include a transform and quantization unit 101, an intra-estimation unit 102, an intra-prediction unit 103, a motion compensation unit 104, a motion estimation unit 105, an inverse transform and inverse quantization unit 106, a filter control analysis unit 107, a filtering unit 108, an encoding unit 109, and a decoding image buffer unit 110, where the filtering unit 108 can implement deblocking filtering and sample adaptive offset (SAO) filtering, and the encoding unit 109 can implement header information encoding and context-based adaptive binary arithmetic coding (CABAC). For the input original video signal, a video coding block is obtained by dividing the coding tree block (CTU). Next, the video coding block is transformed by the transformation and quantization unit 101 using residual pixel information obtained through intra-prediction or inter-prediction. This transformation includes transforming the residual information from the pixel region to the transformation region and quantizing the resulting transformation coefficients in order to further reduce the bitrate. The intra-estimation unit 102 and the intra-prediction unit 103 are configured to perform intra-prediction on the video coding block, and explicitly, the intra-estimation unit 102 and the intra-prediction unit 103 are configured to determine the intra-prediction mode used to encode the video coding block.The motion compensation unit 104 and the motion estimation unit 105 are configured to perform interpredictive coding of received video coding blocks for one or more blocks in one or more reference frames to provide time prediction information, the motion estimation performed by the motion estimation unit 105 is a process that generates motion vectors which can estimate the motion of the video coding blocks, the motion compensation unit 104 then performs motion compensation based on the motion vectors determined by the motion estimation unit 105 and determines an intraprediction mode, the intraprediction unit 103 is further configured to provide selected intraprediction data to the coding unit 109, and the motion estimation unit 105 also transmits the computationally determined motion vector data to the coding unit 109. Furthermore, the inverse transform and inverse quantization unit 106 is for the reconstruction of the video coding block and is configured to reconstruct the residual block in the pixel region. This reconstructed residual block is then subjected to blocking effect artifacts by the filter control analysis unit 107 and the filtering unit 108, and this reconstructed residual block is then added to one prediction block in the frame of the decoding image buffer unit 110 to generate a reconstructed video coding block. The coding unit 109 is configured to encode various coding parameters and quantized transformation coefficients. In the CABAC-based coding algorithm, contextual content can be based on adjacent coding blocks and may be used to encode information indicating the determined intra-prediction mode and output a bitstream of this video signal. The decoding image buffer unit 110 is configured to store the reconstructed video coding block for prediction reference. As video image coding progresses, new reconstructed video coding blocks are continuously generated, and these reconstructed video coding blocks are stored in the decoding image buffer unit 110.
[0100] Referring to Figure 10B, Figure 10B is a block diagram showing the configuration of the decoder provided in an embodiment of the present invention. As shown in Figure 10B, the decoder (specifically, the "video decoder") 200 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra prediction unit 203, a motion compensation unit 204, a filtering unit 205, and a decoded image buffer unit 206, where the decoding unit 201 can perform header information decoding and CABAC decoding, and the filtering unit 205 can perform deblocking filtering and SAO filtering. The input video signal undergoes the encoding process shown in Figure 15 and outputs a bitstream of the video signal. This bitstream is input to the decoder 200 and first passes through the decoding unit 201 to obtain the decoded transform coefficients. These conversion coefficients are processed by the inverse transform and inverse quantization unit 202 to generate residual blocks in the pixel region, the intra-prediction unit 203 may be configured to generate prediction data for the currently decoded video block based on the determined intra-prediction mode and data from previously decoded blocks from the current frame or picture, and the motion compensation unit 204 determines prediction information for the video decoded block by analyzing motion vectors and other relevant syntactic elements, and uses this prediction information to generate prediction blocks for the video decoded block being decoded. By summing the residual blocks from the inverse transform and inverse quantization unit 202 and the corresponding prediction blocks generated by the intra-prediction unit 203 or the motion compensation unit 204, a decoded video block is formed, and this decoded video signal can be improved in video quality by passing through the filtering unit 205 to remove blocking effect artifacts. Next, the decoded video blocks are stored in the decoded image buffer unit 206, which is configured to store reference images for subsequent intra-prediction or motion compensation and to output a video signal, i.e., the restored original video signal is obtained.
[0101] Furthermore, embodiments of the present application further provide a network architecture for a codec system including an encoder and a decoder, where Figure 11 is a schematic diagram showing the network architecture configuration of the codec system provided in embodiments of the present application. As shown in Figure 11, the network architecture includes one or more electronic devices 13 to 1N and a communication network 01, where the electronic devices 13 to 1N can perform video interaction via the communication network 01. The electronic devices may, in the implementation process, be devices having video encoding and decoding functions. For example, the electronic devices may include smartphones, tablet computers, personal computers, personal digital assistants, navigators, digital telephones, video phones, televisions, sensor devices, servers, etc., and embodiments of the present application are not specifically limited thereto. Here, the decoder or encoder described in embodiments of the present application may be the above-mentioned electronic devices.
[0102] It should be noted that the method of the embodiment of this application is mainly applied to the intra-prediction unit 103 shown in Figure 10A and the intra-prediction unit 203 shown in Figure 10B. In other words, the embodiment of this application may be applied to an encoder, or to a decoder, or even to both an encoder and a decoder simultaneously, but the embodiment of this application is not specifically limited.
[0103] Furthermore, it should be explained that when applied to the intra-prediction unit 103, "current block" specifically refers to the coded block currently being intra-predicted, and when applied to the intra-prediction unit 203, "current block" specifically refers to the decoded block currently being intra-predicted.
[0104] One embodiment of the present invention proposes a decoding method applicable to a decoder, and Figure 12 is a schematic flowchart of the decoding method proposed in the embodiment of the present invention, and as shown in Figure 12, the decoding process by the decoder may include the following steps.
[0105] In step 101, determine the first template corresponding to the current block.
[0106] In the embodiment of the present invention, first, a first template corresponding to the current block can be determined. Here, when obtaining the first template, first, the template type corresponding to the current block can be determined, and then, based on the template type, the first template corresponding to the current block can be determined.
[0107] It should be explained that the decoding method according to the embodiment of the present application is applied to a decoder. Furthermore, the decoding method may include an intra-prediction method, and more specifically, it may be a color component prediction method. Here, the video image may be divided into a plurality of decoding blocks, each decoding block may include a first color component, a second color component, and a third color component, and the current block in the embodiment of the present application refers to the decoding block in the video image that is currently subject to intra-prediction.
[0108] Here, if it is necessary to predict the first color component, the component to be predicted is the first color component; if it is necessary to predict the second color component, the component to be predicted is the second color component; and if it is necessary to predict the third color component, the component to be predicted is the third color component. Furthermore, if we make a prediction for the first color component of the current block and assume that the first color component is the luminance component, i.e., the component to be predicted is the luminance component, then the current block may also be called a luminance block. Or, if we make a prediction for the second color component of the current block and assume that the second color component is the chromaticity component, i.e., the component to be predicted is the chromaticity component, then the current block may also be called a chromaticity block.
[0109] Furthermore, in the embodiments of this application, the reference pixel of the current block may refer to a reference pixel point adjacent to the current block. Here, "adjacent" may refer to spatially adjacent, but is not limited to this. For example, adjacent may refer to adjacent in the time domain, adjacent in the spatial domain and time domain, and furthermore, the reference pixel of the current block may be a reference pixel obtained by performing some processing on a reference pixel point adjacent in the spatial domain, adjacent in the time domain, adjacent in spacetime and time domain, and the embodiments of this application are not particularly limited.
[0110] Furthermore, in embodiments of the present application, it may be chosen to determine the template type of the current block based on instruction information in the bitstream, or to determine the template type of the current block based on the size of the current block.
[0111] Furthermore, in embodiments of the present application, it may be chosen to determine the template type of the current block based on the reference pixels of the current block, where the reference pixels of the current block include at least one of 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.
[0112] Understandably, in the embodiments of the present application, the reference pixels of the current block may include adjacent reconstructed pixels of the current block, that is, it is possible to choose to use adjacent reconstructed pixels of the current block as a template to search for a matching template in a predetermined search area.
[0113] It should be explained that in the embodiments of the present application, the reference pixels of the current block, i.e., the adjacent reconstructed pixels of the current block, may include the upper reference pixels, upper left reference pixels, upper right reference pixels, left reference pixels, and lower left reference pixels of the current block.
[0114] Understandably, in the embodiments of the present application, when determining the template type of the current block using the reference pixels of the current block, the template type can be classified and determined based on whether or not adjacent reference pixels are available.
[0115] Understandably, in the embodiments of the present application, when determining the template type of a block, it is also possible to classify and determine the template type based on the instructions in the bitstream.
[0116] Furthermore, in the embodiments of the present application, when determining the template type of the current block based on the reference pixels of the current block, the template type of the current block is determined as the first value 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; the template type of the current block is determined as the second value if the left adjacent reference pixel of the current block is available; the template type of the current block is determined as the third value if the upper adjacent reference pixel of the current block is available; the template type of the current block is determined as the fourth value if the left adjacent reference pixel of the current block and the upper left adjacent reference pixel of the current block are both available; the template type of the current block is determined as the fifth value if the left adjacent reference pixel of the current block and the lower left adjacent reference pixel of the current block are both available; and the template type of the current block is determined as the sixth value if the upper adjacent reference pixel of the current block and the upper right adjacent reference pixel of the current block are both available.
[0117] It should be explained that in the embodiments of this application, the first, second, third, fourth, fifth, and sixth values may be any numerical values and are not specifically limited in this application. For example, the values of the first, second, third, fourth, fifth, and sixth values may be 1, 2, 3, 4, 5, and 6, respectively.
[0118] Exemplary, in the embodiments of the present application, the template type can be represented by refTemplateType, and correspondingly, as shown in Figure 3, the grid-filled blocks are the current blocks, and the adjacent regions of the current blocks are templates T, where six types of templates are shown.
[0119] Exemplary examples of these six template types are shown below. Specifically, when the upper left reference pixel, upper reference pixel, and left reference pixel are all available, the value of refTemplateType is 1 and the template shape is as shown in Figure 3(a); when only the left reference pixel is available, the value of refTemplateType is 2 and the template shape is as shown in Figure 3(b); when only the upper reference pixel is available, the value of refTemplateType is 3 and the template shape is as shown in Figure 3(c); when only the left reference pixel and upper left reference pixel are available, the value of refTemplateType is 4 and the template shape is as shown in Figure 3(d); when only the left reference pixel and lower left reference pixel are available, the value of refTemplateType is 5 and the template shape is as shown in Figure 3(e); and when only the upper reference pixel and upper right reference pixel are available, the value of refTemplateType is 6 and the template shape is as shown in Figure 3(f).
[0120] In some embodiments, the IntraTMP template type can be selected based on instructions within the bitstream, in addition to the availability information of the reference pixels described above. For example, the template type can be determined on the decoding side by assigning a number to each template type and transmitting the number information of the template type actually used within the bitstream.
[0121] In other words, in the embodiments of the present application, it is possible to choose to determine the template type based on the availability information of the reference pixels in the current block, or to choose to determine the template type based on the information shown in the bitstream, or to determine the template type by combining the availability information of the reference pixels and the information shown in the bitstream. The present application is not specifically limited.
[0122] Furthermore, in the embodiments of the present invention, when determining a first template corresponding to the current block based on the template type, the template reference pixels of the current block can first be determined 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.
[0123] It should be explained that in the embodiments of the present application, the first template of the current block may include template reference pixels of the current block. Here, the template reference pixels of the current block can be determined by the template type of the current block and the template size corresponding to the template type.
[0124] It should be explained that in the embodiments of the present application, the first template of the current block may consist of reconstructed pixels in one or more regions of the upper, upper right, left, lower left, and upper left sides of the current block, i.e., it may consist of the reference pixels of the current block described above.
[0125] It should be noted that, in the embodiments of this application, the template size corresponding to the template type may be predefined, indicated by a bitstream syntax element, or adaptively selected based on block size or other information. For example, when retrieving the left template, the template width templateW_size can be set to 4, and when retrieving the upper template, the template height templateH_size can be set to 4.
[0126] In response to this, in the embodiment of the present invention, by combining the value of the current block's template type refTemplateType and the template size corresponding to the refTemplateType, it is possible to determine which part of the reconstructed pixels will be obtained as the template reference pixels of the current block, and furthermore, the corresponding first template can be determined.
[0127] Exemplary, in the embodiments of the present application, if the value of refTemplateType is 1, it is possible to choose to obtain the reconstructed pixels on the left, upper left, and top of the current block; if the value of refTemplateType is 2, only the reconstructed pixels of the left four columns of the current block are obtained; and if the value of refTemplateType is 3, only the reconstructed pixels of the top four rows of the currently encoded block are obtained.
[0128] Of course, the pre-set template size value is not limited to 4, but may be any integer greater than 0, and this application does not specifically limit it.
[0129] Understandably, in the embodiments of the present application, the template reference pixels of the current block, determined from the reference pixels of the current block, can be a first template corresponding to the current block, by combining the template type of the current block and the corresponding template size.
[0130] In step 102, a fully reconstructed search area and / or an undetermined reconstructed search area are determined based on the first template, the fully reconstructed search area includes reconstructed sampling points, and the undetermined reconstructed search area includes reconstructed sampling points and / or unreconstructed sampling points.
[0131] In the embodiments of the present invention, after determining a first template corresponding to the current block, a fully reconstructed search region and / or an undetermined reconstructed search region can be determined based on the first template, the fully reconstructed search region including reconstructed sampling points, and the undetermined reconstructed search region including reconstructed sampling points and / or unreconstructed sampling points.
[0132] Understandably, in the embodiments of the present application, the search region selected based on the first template in the prediction process of the Intra TMP may include an undetermined reconstruction search region and / or a fully reconstruction search region. Here, the fully reconstruction search region may include only reconstructed sampling points, i.e., all sampling points within the fully reconstruction search region are reconstructed sampling points. On the other hand, with respect to the undetermined reconstruction search region, it is not possible to determine whether the sampling points within the undetermined reconstruction search region are reconstructed or not, i.e., the undetermined reconstruction search region may include only reconstructed sampling points, only unreconstructed sampling points, or both reconstructed and unreconstructed sampling points.
[0133] To address this, the process of scanning the undetermined reconstruction search area requires the addition of a process to determine the availability of each search location, thereby allowing full use of information on all neighboring reconstructed sampling points.
[0134] It should be explained that, in the embodiments of the present invention, based on the first template, the fully reconstructed search area and / or the undetermined reconstructed search area can be determined, centered on a zero-value block vector, according to the size of the search window and the position information of the current image.
[0135] In other words, in the embodiment of the present invention, the search region is located near a zero-value BV, or it can be said that it is constrained by information such as the size of the search window and image edges, centered around a zero-value BV.
[0136] Furthermore, in the embodiments of the present application, the fully reconstructed search area is a search area that includes a set of positions corresponding to the upper-left corner pixel point of the corresponding reference block at each search position, and the undetermined reconstructed search area is a search cover area that includes a set of pixels of the corresponding reference block at each search position.
[0137] In other words, in the embodiments of the present invention, the search region refers to the set of positions corresponding to the upper-left corner pixel point of the corresponding reference block at each search position, and this region may not include unreconstructed sampling points. On the other hand, the undetermined reconstruction search region is because the lower-right corner pixel of the reference block corresponding to each search position in this region may be located in the upper-right or lower-left region of the currently encoded block and may not have been reconstructed.
[0138] Accordingly, in the embodiment of the present invention, the search region can be the set of upper-left pixels of the search points, and the search cover region includes the set of pixels of the reference block corresponding to all the search points.
[0139] It should be explained that in the embodiments of the present invention, the block vector search process may include parts such as an initialization process, determination of the search region of the first template in the current frame, searching within the search region, and determination of one or more optimal block vectors. Therefore, when performing the search process, the initialization operation must be completed first.
[0140] For example, as shown in Figure 5 above, nTbW and nTbH represent the current block size, templateW_size and templateH_size represent the template size, and uiPatchWidth and uiPatchHeight represent the block size including the current block and its template.
[0141] Correspondingly, during initialization, uiPatchWidth can be initialized as nTbW + templateW_size and uiPatchHeight as nTbH + templateH_size. Here, templateW_size and templateH_size may be fixed constants, may be indicated by bitstream syntax elements, or may be dynamically adjusted based on the encoded block size or other information, and templateW_size and templateH_size may or may not be equal. For example, templateW_size=4 and templateH_size=4, or if the width of the encoded block is greater than 8, templateW_size=4 is set, and if the width of the encoded block is 8 or less, templateW_size=2 is set, and if the height of the encoded block is greater than 8, templateH_size=4 is set, and if the height of the encoded block is 8 or less, templateH_size=2 is set.
[0142] Furthermore, the cost threshold between templates is initialized as diffThreshold. For example, if the cost function is SAD, the threshold is diffThreshold=((1<<bitDepth)> >2) × (uiPatchHeight × uiPatchWidth - nTbH × nTbW). Here, if the bit depth of the image is 10, then diffThreshold represents a distortion threshold of 256 for each pixel point in the template region.
[0143] Furthermore, the positions of the coding tree block CTB, where block CB is currently located, are initialized as ctbRsX and ctbRsY.
[0144] Furthermore, the positional offset of the current block CB in the current CTB is initialized as offsetLCBY=yTbCmp-ctbRsY and offsetLCBX=xTbCmp-ctbRsX.
[0145] Furthermore, initialize iTemplateSizeH=templateH_size and iTemplateSizeW=templateW_size.
[0146] Furthermore, iBvShift is initialized, and iBvShift is the precision of the block vector BV. For example, the precision of BV can be pixel-level precision, in which case iBvShift is 0. Alternatively, the precision of BV can be sub-pixel precision; for example, iBvShift = 1 represents 1 / 2 pixel precision, and iBvShift = 2 represents 1 / 4 pixel precision, and this is not specifically limited here.
[0147] Furthermore, the predetermined search range of the template is initialized. The predetermined search range of the template may be set to a fixed size, or it may be dynamically adjusted based on the encoded block size. For example, searchRangeWidth = TMP_SEARCH_RANGE_MULT_FACTOR × nTbW, searchRangeHeight = TMP_SEARCH_RANGE_MULT_FACTOR × nTbH, where the value of TMP_SEARCH_RANGE_MULT_FACTOR may be a predetermined value, for example, set to 5, may be indicated by a bitstream syntax element, or may be adaptively adjusted based on information such as the encoded block size.
[0148] Furthermore, in the embodiments of the present invention, when determining one or more block vectors corresponding to the current block based on the first template, first, a complete reconstruction search area can be determined based on the first template, and then, a search can be performed in the complete reconstruction search area to determine one or more block vectors.
[0149] It should be explained 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-colored background area is the reconstructed area, the black-colored background block is the current block, and the dashed line frame is the search range window. Therefore, the search area of the IntraTMP technique does not exceed the overlapping portion between the reconstructed area shown by the dark-colored background and the area shown by the dashed line frame.
[0150] Thus, the current search region of the block template may be the reconstructed portion of the CTB where the current block is located, or it may be another reconstructed CTB region. In practice, the search region is the set of all search points. Since the shape of the region cannot often be represented by a single rectangular region, in concrete implementations, searches can be performed in multiple rectangular regions, and the search results from different regions can be combined to obtain the final optimal matching block and optimal block vector.
[0151] As an example, in some embodiments, a region segmentation process is performed on the reconstruction area within the dashed frame in Figure 6 to determine the top, bottom, left, and right boundaries of each region. Then, a search is performed in multiple rectangular regions, and the search results from different regions are combined to obtain the final optimal matching module and optimal block vector.
[0152] For illustrative purposes, referring to Figure 13, which shows four different sub-region division methods. As shown in Figure 13, the black-filled background block is the current block, and the four division methods (a), (b), (c), and (d) all divide the search region into four sub-search regions, where different fill patterns represent one sub-search region. Here, (a), (b), (c), and (d) consider all available search ranges.
[0153] For illustrative purposes, let's assume that different search regions are distinguished and represented by regionId. Considering that the currently encoded block template pixels must be obtained from the image reconstruction region, and the reconstructed block pixels corresponding to the template must also be obtained from the reconstruction region, it is necessary to further determine the searchable locations in the search regions represented by different regionIds based on the current encoded block's position (xTbCmp, yTbCmp), the current encoded block's size (nTbW, nTbH), the current image's size (picWidth, picHeight), the size of the CTB where the current encoded block is located (CtbSizeW, CtbSizeH), a predetermined search range of the template (searchRangeWidth, searchRangeHeight), and the position offset of the current encoded block in the current CTB (offsetLCBY, offsetLCBX), thereby determining the block vector BV. Specifically, iVerMin and iVerMax represent the minimum and maximum absolute coordinate positions that can be searched in the vertical direction, respectively, while iHorMin and iHorMax represent the minimum and maximum absolute coordinate positions that can be searched in the horizontal direction. The values of iVerMin, iVerMax, iHorMin, and iHorMax differ for each search region represented by a different regionId.
[0154] Furthermore, in the embodiments of this application, the search area can be divided based on the shape of the reconstruction area and the certainty of the possibility of obtaining the reconstruction pixels, thereby achieving a balance between computational complexity and coding efficiency. For example, the CTB area encoded before the CTB in which the current block is located, and the areas located to the upper left, directly to the left, and directly above the current block within the CTB in which the current encoded block is located, belong to areas that are definitely reconstructed. In this way, it is possible to select to determine the area in which it can be determined that all included sampling points have been reconstructed as the complete reconstruction search area. Correspondingly, the areas located to the lower left and upper right of the current encoded block within the CTB in which the current encoded block is located belong to areas that may or may not be reconstructed. In this way, the area in which it cannot be determined that all included sampling points have been reconstructed is selected as the undetermined reconstruction search area.
[0155] In some embodiments, based on considerations for the fully reconstructed search area and the undetermined reconstructed search area, taking Figure 13(a) as an example, the search area is divided into six sub-search areas. The implementation method is as follows.
[0156] If regionId is equal to 0, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0157] iHorMax0=min((xTbCmp+searchRangeWidth)< <iBvShift,((picWidth-nTbW)<<iBvShift)) iHorMin0=max((iTemplateSizeW)< <iBvShift,(xTbCmp-searchRangeWidth)<<iBvShift) iVerMax0=(yTbCmp-nTbH-offsetLCBY)< <iBvShift iVerMin0=max(((iTemplateSizeH)< <iBvShift),((yTbCmp-searchRangeHeight)<<iBvShift)) If regionId is equal to 1, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0158] iHorMin1=max((iTemplateSizeW)< <iBvShift,(xTbCmp-searchRangeWidth)<<iBvShift)、 iHorMax1=(xTbCmp-offsetLCBX-nTbW)< <iBvShift、 iVerMin1=(yTbCmp+1)< <iBvShift、 iVerMax1=min((picHeight-nTbH)< <iBvShift,(yTbCmp-offsetLCBY+CtbSizeH-nTbH)<<iBvShift) If regionId is equal to 2, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0159] iHorMax2=(xTbCmp-offsetLCBX-nTbW)< <iBvShift iHorMin2=max((iTemplateSizeW)< <iBvShift,(xTbCmp-searchRangeWidth)<<iBvShift) iVerMin2=max((iTemplateSizeH)< <iBvShift,(yTbCmp-nTbH-offsetLCBY)<<iBvShift) iVerMax2=(yTbCmp)< <iBvShift If regionId is equal to 3, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0160] 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 If regionId is equal to 4, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0161] iHorMin=(xTbCmp-offsetLCBX-nTbW)< <iBvShift iHorMax=(xTbCmp-nTbW)< <iBvShift iVerMin=(yTbCmp+1)< <iBvShift iVerMax=min((picHeight-nTbH)< <iBvShift,(yTbCmp-offsetLCBY+CtbSizeH-nTbH)<<iBvShift) If regionId is equal to 5, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0162] 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 In actual applications, iHorMin here regionId iHor Max regionId iVerMin regionId iVerMax regionIdThese represent the left, right, top, and bottom edges of different sub-search regions, respectively.
[0163] To intuitively illustrate the different sub-search regions corresponding to different regionIds, Figure 14 is a second schematic diagram showing the search region determination process. As shown in Figure 14, R1, R2, R3, R4, R5, and R6 represent six different sub-search regions, where R1, R2, R3, and R4 are fully reconstructed search regions, and R5 and R6 are undetermined reconstructed search regions. It should be noted that in Figure 14, the upper-left corner pixels of a block are represented by a pixel range that can be aligned.
[0164] In other words, in some embodiments, the search region can be divided into two types: one is a region where it is determined that all sampling points within the region have been reconstructed (called the fully reconstructed search region), which includes, for example, the four regions R1, R2, R3, and R4 in Figure 14; and the other is a region where it is not determined whether all sampling points within the region have been reconstructed (called the undetermined reconstructed search region), which includes, for example, the two regions R5 and R6 in Figure 14.
[0165] Furthermore, in the embodiments of this application, in order to realize a smaller number of search areas and reduce the amount of code, the number of search areas can be reduced by selectively integrating some fully reconstructed search areas and some undetermined reconstructed search areas to construct a new undetermined reconstructed search area.
[0166] In some embodiments, an integrated update process can be performed on the fully reconstructed search area and / or the undetermined reconstructed search area to determine the updated fully reconstructed search area and the updated undetermined reconstructed search area. Here, the first total number of areas in the updated fully reconstructed search area and the updated undetermined reconstructed search area is smaller than the second total number of areas in the fully reconstructed search area and / or the undetermined reconstructed search area.
[0167] In other words, in the embodiments of the present invention, the initially defined undetermined reconstruction search region is relatively large, and the total number of regions is relatively small.
[0168] Exemplary, in the embodiment of the present application, it is possible to perform an integration process on R2 and R5 to form a new undefined reconstruction search area, compared to the four fully reconstructed search areas R1, R2, R3, and R4 in Figure 13 and the two undefined reconstruction search areas R5 and R6. Here, the updated fully reconstructed search area includes R1, R3, and R4, and the updated undefined reconstruction search area includes R6 and a new undefined reconstruction search area composed of R2 and R5.
[0169] Exemplary, in the embodiment of the present application, it is possible to perform an integration process on R4 and R6 to form a new undefined reconstruction search area, compared to the four fully reconstructed search areas R1, R2, R3, and R4 in Figure 13 and the two undefined reconstruction search areas R5 and R6. Here, the updated fully reconstructed search area includes R1, R2, and R3, and the updated undefined reconstruction search area includes R5 and a new undefined reconstruction search area composed of R4 and R6.
[0170] In step 103, a region selection is performed based on the fully reconstructed search region and / or the undetermined reconstructed search region, and the selected fully reconstructed search region and / or the selected undetermined reconstructed search region are determined, the selected fully reconstructed search region being smaller than or equal to the fully reconstructed search region, and the selected undetermined reconstructed search region being smaller than or equal to the undetermined reconstructed search region.
[0171] In the embodiments of the present invention, after determining the search area, i.e., the fully reconstructed search area and / or the undetermined reconstructed search area, based on the first template, it is possible to further perform area selection based on the fully reconstructed search area and / or the undetermined reconstructed search area, thereby determining the corresponding selected fully reconstructed search area and / or the selected undetermined reconstructed search area.
[0172] It should be explained that, in the embodiments of this application, performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region can be understood as performing reduction and restriction processing on the fully reconstructed search region and / or the undetermined reconstructed search region, thereby reducing the range of the search region to be ultimately searched and lowering the complexity of encoding and decoding.
[0173] In response to this, in the embodiments of the present application, after performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region, the determined selected fully reconstructed search region is smaller than or equal to the fully reconstructed search region, and the determined selected undetermined reconstructed search region is smaller than or equal to the undetermined reconstructed search region.
[0174] Furthermore, in the embodiments of the present invention, when performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region, the fully reconstructed search region can be determined as the selected fully reconstructed search region, and at the same time, region selection can be performed on the undetermined reconstructed search region to determine the selected undetermined reconstructed search region.
[0175] In other words, in the embodiments of the present invention, it is possible to select to reduce and restrict only the undetermined reconstruction search area, and furthermore, to obtain the corresponding selected undetermined reconstruction search area, and to construct the search area in which the search is ultimately performed using the selected undetermined reconstruction search area and the fully reconstructed search area.
[0176] Furthermore, in the embodiments of this application, when performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region, region selection can be performed on the fully reconstructed search region to determine the selected fully reconstructed search region, and at the same time, the undetermined reconstructed search region can be determined as the selected undetermined reconstructed search region.
[0177] In other words, in the embodiments of the present invention, it is possible to select to reduce and restrict only the fully reconstructed search area, and furthermore, to obtain the corresponding selected fully reconstructed search area, and to construct the search area in which the search is ultimately performed using the selected fully reconstructed search area and the undetermined reconstructed search area.
[0178] Furthermore, in the embodiments of this application, when performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region, region selection can be performed on the fully reconstructed search region to determine the selected fully reconstructed search region, and at the same time, region selection can be performed on the undetermined reconstructed search region to determine the selected undetermined reconstructed search region.
[0179] In other words, in the embodiments of the present invention, it is possible to simultaneously reduce and restrict the fully reconstructed search area and the undetermined reconstructed search area, and furthermore, the corresponding selected fully reconstructed search area and selected undetermined reconstructed search area can be obtained, and the search area to be ultimately explored can be constructed using the selected fully reconstructed search area and selected undetermined reconstructed search area.
[0180] Furthermore, in the embodiments of the present invention, when performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region, the fully reconstructed search region can be determined as the fully reconstructed search region after selection, and at the same time, the undetermined reconstructed search region can be determined as the undetermined reconstructed search region after selection.
[0181] In other words, in the embodiment of the present invention, the fully reconstructed search area and the undetermined reconstructed search area are not reduced or restricted, and instead the search area in which the final search is performed can be directly constructed using the fully reconstructed search area and the undetermined reconstructed search area.
[0182] Furthermore, in the embodiments of the present invention, when performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, first, a scaling parameter is determined, then region selection is performed on the fully reconstructed search region and / or the undetermined reconstructed search region based on the scaling parameter, and finally the selected fully reconstructed search region and / or the selected undetermined reconstructed search region can be determined.
[0183] It should be explained that in the embodiments of this application, the scaling parameters may include a height scaling parameter hIndex and a width scaling parameter wIndex, where both the height scaling parameter hIndex and the width scaling parameter wIndex are 1 or greater.
[0184] For example, in some embodiments, a search point within a search domain may be scanned by scanning all search points within a specified search domain, and different methods may be employed to restrict the local search range in order to balance computational complexity and coding efficiency. For example, the width of the search range may be restricted to 1 / wIndex of the original range, and the height to 1 / hIndex of the original range, where wIndex and hIndex are both arbitrary numbers greater than or equal to 1.
[0185] It should be explained that in the embodiments of this application, the bitstream can be decoded to determine the scaling parameters. Here, the scaling parameters are transmitted by one of the following: SPS layer syntax information, PPS layer syntax information, APS layer syntax information, SH layer syntax information, or CU layer syntax information.
[0186] It should be explained that in the embodiments of this application, the scaling parameters may be determined based on predetermined numerical values, for example, both wIndex and hIndex are 2.
[0187] In other words, in the embodiments of the present invention, the scaling parameter that limits the size of the search area may be transmitted by the sps layer syntax, or by the pps layer syntax, aps layer syntax, or sh layer syntax, cu layer syntax, etc.
[0188] It should be explained that in the embodiments of this application, different search regions can be selected using different methods, that is, different search regions can correspond to different reduction methods.
[0189] Furthermore, in the embodiment of the present invention, the search area located above the current block within the fully reconstructed search area can be determined as the first initial area, the search area located to the left or upper left of the current block within the fully reconstructed search area can be determined as the second initial area, the search area located to the lower left of the current block within the undetermined reconstructed search area can be determined as the third initial area, and the search area located to the upper right of the current block within the undetermined reconstructed search area can be determined as the fourth initial area.
[0190] Exemplary, in some embodiments, as shown in Figure 14, R1, R2, R3, R4, R5, and R6 represent six different sub-search regions, where R1, R2, R3, and R4 are fully reconstructed search regions, and R5 and R6 are undetermined reconstructed search regions. Based on the positional relationship between each sub-search region and the current block, the search region R1 located above the current block within the fully reconstructed search region can be determined as the first initial region, the search regions R2, R3, and R4 located to the left or upper left of the current block within the fully reconstructed search region can be determined as the second initial region, the search region R5 located to the lower left of the current block within the undetermined reconstructed search region can be determined as the third initial region, and the search region R6 located to the upper right of the current block within the undetermined reconstructed search region can be determined as the fourth initial region.
[0191] Furthermore, in the embodiments of the present invention, region selection is performed for the complete reconstruction search region and / or the undetermined reconstruction search region based on scaling parameters, and when determining the selected complete reconstruction search region and / or the selected undetermined reconstruction search region, a first selected region is determined in the first initial region based on the scaling parameters and the positional information of the first initial region, the first selected region is any region within the first initial region, and then the selected complete reconstruction search region can be determined based on the first selected region.
[0192] Understandably, in the embodiments of the present invention, for the upper search region of the current block, for example R1, after obtaining the four boundaries iHorMin, iHorMax, iVerMin, and iVerMax of the search region (first initial region), the first selected region can be obtained by trimming and scaling the search region using the scaling parameters wIndex and hIndex.
[0193] It should be explained that, in the embodiments of this application, with respect to the upper search region of the current block, for example R1, the first selected region after scaling can be any region within the first initial region. That is, the first selected region can be a sub-region in a different direction, such as the top, bottom, left, right, or center, within the first initial region, and this application does not specifically limit it.
[0194] Exemplary, in some embodiments, Figure 15 is a first schematic diagram illustrating region selection, and as shown in Figure 15, if the values of the scaling parameters wIndex and hIndex are both 1 for the upper search region of the current block, e.g., R1, then the first selected region obtained after performing region selection on the first initial region using the scaling parameters wIndex and hIndex is the corresponding first initial region.
[0195] Exemplary, in some embodiments, Figure 16 is a second schematic diagram illustrating region selection, and as shown in Figure 16, for the upper search region of the current block, e.g., R1, if the scaling parameter wIndex is 2 and the hIndex is 1, then the first selected region obtained after performing region selection on the first initial region using the scaling parameters wIndex and hIndex is an intermediate region within the corresponding first initial region.
[0196] Exemplary, in some embodiments, Figure 17 is a third schematic diagram illustrating region selection, and as shown in Figure 17, for the upper search region of the current block, e.g., R1, if the scaling parameter wIndex is 1 and hIndex is 2, then the first selected region obtained after performing region selection on the first initial region using the scaling parameters wIndex and hIndex is an intermediate region within the corresponding first initial region.
[0197] Exemplary, in some embodiments, Figure 18 is a fourth schematic diagram illustrating region selection, and as shown in Figure 18, for the upper search region of the current block, e.g., R1, if the scaling parameter wIndex is 2 and the hIndex is 2, then the first selected region obtained after performing region selection on the first initial region using the scaling parameters wIndex and hIndex is an intermediate region within the corresponding first initial region.
[0198] For example, in some embodiments, as shown in R1 of Figure 14, when regionId is equal to 0, the four boundaries after scaling the search region, i.e., the four boundaries of the first selected region, are defined by iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It is calculated as follows:
[0199] iHorMin regionId =iHorMin+(iHorMax-iHorMin) / (2×wIndex) iHor Max regionId =iHorMax-(iHorMax-iHorMin) / (2×wIndex) iVerMin regionId =iVerMin+(iVerMax-iVerMin) / (2×hIndex) i VerMaxregionId =iVerMax-(iVerMax-iVerMin) / (2×hIndex) Understandably, in the embodiments of this application, the process of selecting a region based on a scaling parameter can be achieved by right shifting the relevant division. For example, if wIndex is set to 2, the same result can be achieved with the >>1 operation.
[0200] Furthermore, in the embodiments of the present invention, region selection is performed for the complete reconstruction search region and / or the undetermined reconstruction search region based on scaling parameters, and when determining the selected complete reconstruction search region and / or the selected undetermined reconstruction search region, a second selected region is determined in the second initial region based on the scaling parameters and the positional information of the second initial region. The second selected region is any region within the second initial region, and then the selected complete reconstruction search region can be determined based on the second selected region.
[0201] Furthermore, in the embodiments of the present invention, region selection is performed for the fully reconstructed search region and / or the undetermined reconstructed search region based on scaling parameters, and when determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, a third selected region is determined in the third initial region based on the scaling parameters and the positional information of the third initial region, the third selected region is any region within the third initial region, and then the selected undetermined reconstructed search region can be determined based on the third selected region.
[0202] Understandably, in the embodiments of the present application, for the search region on the left, upper left, or lower left side of the current block, for example R2, R3, R4, R5, after obtaining the four boundaries iHorMin, iHorMax, iVerMin, and iVerMax of the search region (second initial region or third initial region), the second (or third) selected region can be obtained by trimming and scaling the search region using the scaling parameters wIndex and hIndex.
[0203] It should be explained that, in the embodiments of this application, for the current search area on the left, upper left, or lower left side of the block, for example R2, R3, R4, and R5, the scaled second (or third) selected area can be any area within the second (or third) initial area. That is, the second (or third) selected area can be a sub-area in a different direction, such as above, below, left, right, or center, within the second (or third) initial area, and this application does not specifically limit it.
[0204] Exemplary, in some embodiments, Figure 19 is a fifth schematic diagram illustrating region selection, and as shown in Figure 19, if the values of the scaling parameters wIndex and hIndex are both 1 for the search regions to the left, upper left, or lower left of the current block, e.g., R2, R3, R4, R5, then the first selected region obtained after performing region selection on the first initial region using the scaling parameters wIndex and hIndex is the corresponding first initial region.
[0205] Exemplary, in some embodiments, Figure 20 is a sixth schematic diagram illustrating region selection, and as shown in Figure 20, for the search region to the left, upper left, or lower left of the current block, e.g., R2, R3, R4, R5, if the scaling parameter wIndex is 2 and hIndex is 1, then the first selected region obtained after performing region selection on the first initial region using the scaling parameters wIndex and hIndex is the region to the right of the corresponding first initial region.
[0206] Exemplary, in some embodiments, Figure 21 is a seventh schematic diagram illustrating region selection, and as shown in Figure 21, for the search regions to the left, upper left, or lower left of the current block, e.g., R2, R3, R4, R5, if the scaling parameter wIndex is 1 and hIndex is 2, then the first selected region obtained after performing region selection on the first initial region using the scaling parameters wIndex and hIndex is the upper region of the corresponding first initial region.
[0207] Exemplarily, in some embodiments, FIG. 22 is the eighth schematic diagram showing region selection. As shown in FIG. 22, for the search regions on the left side, upper left side, or lower left side of the current block, such as R2, R3, R4, R5, when the value of the scaling parameter wIndex is 2 and the value of hIndex is 2, after performing region selection on the first initial region using the scaling parameters wIndex and hIndex, the first selected region obtained is the upper right region of the corresponding first initial region.
[0208] Exemplarily, in some embodiments, when regionId is equal to 1, 2, 3, such as R2, R3, R4 in FIG. 14, after scaling the search region, the four boundaries, that is, the four boundaries of the second selected region, can be set to iVerMin regionId , iVerMax regionId , iHorMin regionId , iHorMax regionId . In this case, iHorMin regionId , iHorMax regionId are calculated as follows.
[0209] iHorMin regionId =iHorMax-(iHorMax-iHorMin) / wIndex iHorMax regionId =iHorMax Exemplarily, in some embodiments, when regionId is equal to 1, 2, 3, such as R2, R3, R4 in FIG. 14, after scaling the search region, the four boundaries, that is, the four boundaries of the second selected region, can be set to iVerMin regionId , iVerMax regionId , iHorMin regionId , iHorMax regionId . In this case, iHorMin regionId , iHorMax regionId are calculated as follows.
[0210] iHorMin regionId =iHorMin+(iHorMax-iHorMin) / wIndex iHorMaxregionId =iHorMax Exemplarily, in some embodiments, when the regionId is equal to 1, 2, 3, such as R2, R3, R4 in FIG. 14, after scaling the search region, the four boundaries of the second selection region, i.e., the four boundaries of the region after the second selection, can be set to iVerMin regionId , iVerMax regionId , iHorMin regionId , iHorMax regionId . In this case, iHorMin regionId , iHorMax regionId are calculated as follows.
[0211] When wIndex is 2, iHorMin regionId =(iHorMax + iHorMin) / wIndex, iHorMax regionId =iHorMax Exemplarily, in some embodiments, when the regionId is equal to 1, 2, 3, such as R2, R3, R4 in FIG. 14, after scaling the search region, the four boundaries of the second selection region, i.e., the four boundaries of the region after the second selection, can be set to iVerMin regionId , iVerMax regionId , iHorMin regionId , iHorMax regionId . In this case, iVerMin regionId , iVerMax regionId are calculated as follows.
[0212] iVerMin regionId =iVerMin iVerMax regionId =iVerMax - (iVerMax - iVerMin) / hIndex Exemplarily, in some embodiments, when the regionId is equal to 1, 2, 3, such as R2, R3, R4 in FIG. 14, after scaling the search region, the four boundaries of the second selection region, i.e., the four boundaries of the region after the second selection, can be set to iVerMin regionId , iVerMax regionId , iHorMin regionId , iHorMax regionIdIt can be set to iVerMin. regionId iVerMax regionId It is calculated as follows:
[0213] iVerMin regionId =iVerMin i VerMax regionId =iVerMin+(iVerMax-iVerMin) / hIndex For example, in some embodiments, as shown in Figure 14, R2, R3, and R4, when regionId is equal to 1, 2, and 3, the four boundaries after scaling the search region, i.e., the four boundaries of the second selected region, are defined by iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iVerMin. regionId iVerMax regionId It is calculated as follows:
[0214] iVerMin regionId =iVerMin If hIndex is 2, iVerMax regionId =(iVerMax+iVerMin) / hIndex For example, in some embodiments, as shown in R5 of Figure 14, when regionId is equal to 4, the four boundaries after scaling the search region, i.e., the four boundaries of the third selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iHorMin. regionId iHor Max regionId It is calculated as follows:
[0215] iHorMin regionId =iHorMax-(iHorMax-iHorMin) / wIndex iHor Max regionId =iHor Max For example, in some embodiments, as shown in R5 of Figure 14, when regionId is equal to 4, the four boundaries after scaling the search region, i.e., the four boundaries of the third selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iHorMin. regionId iHor Max regionId It is calculated as follows:
[0216] iHorMin regionId =iHorMin+(iHorMax-iHorMin) / wIndex iHor Max regionId =iHor Max For example, in some embodiments, as shown in R5 of Figure 14, when regionId is equal to 4, the four boundaries after scaling the search region, i.e., the four boundaries of the third selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iHorMin. regionId iHor Max regionId It is calculated as follows:
[0217] If wIndex is 2, iHorMin regionId =(iHorMax+iHorMin) / wIndex, iHor Max regionId =iHor Max For example, in some embodiments, as shown in R5 of Figure 14, when regionId is equal to 4, the four boundaries after scaling the search region, i.e., the four boundaries of the third selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iVerMin. regionId iVerMax regionId It is calculated as follows:
[0218] iVerMin regionId =iVerMin i VerMax regionId =iVerMax-(iVerMax-iVerMin) / hIndex For example, in some embodiments, as shown in R5 of Figure 14, when regionId is equal to 4, the four boundaries after scaling the search region, i.e., the four boundaries of the third selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iVerMin. regionId iVerMax regionId It is calculated as follows:
[0219] iVerMin regionId =iVerMin i VerMax regionId =iVerMin+(iVerMax-iVerMin) / hIndex For example, in some embodiments, as shown in R5 of Figure 14, when regionId is equal to 4, the four boundaries after scaling the search region, i.e., the four boundaries of the third selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iVerMin. regionId iVerMax regionId It is calculated as follows:
[0220] iVerMin regionId =iVerMin If hIndex is 2, iVerMax regionId =(iVerMax+iVerMin) / hIndex Understandably, in the embodiments of the present application, when performing region selection for the second (or third) initial region for the search region on the left, upper left, or lower left side of the current block, for example R2, R3, R4, R5, it is possible to choose to take only the right half of the second (or third) initial region. In this case, wIndex is 2 and iHorMin regionId = (iHorMax + iHorMin) / wIndex is determined, and at the same time, iHorMax regionId =iHorMax,iVerMin regionId =iVerMin, iVerMax regionId =iVerMax is set.
[0221] Understandably, in the embodiments of the present application, when performing region selection for the second (or third) initial region for the search region on the left, upper left, or lower left side of the current block, for example R2, R3, R4, R5, it is possible to choose to take only the upper half of the second (or third) initial region. In this case, hIndex is 2 and iVerMax regionId = (iVerMax + iVerMin) / hIndex is determined, and at the same time, iHorMin regionId =iHorMin, iHorMax regionId =iHorMax,iVerMin regionId =iVerMin is set to this value.
[0222] Understandably, in the embodiments of this application, the process of selecting a region based on a scaling parameter can be achieved by right shifting the relevant division. For example, if wIndex is set to 2, the same result can be achieved with the >>1 operation.
[0223] Furthermore, in the embodiments of the present invention, region selection is performed for the fully reconstructed search region and / or the undetermined reconstructed search region based on scaling parameters, and when determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, a fourth selected region is determined in the fourth initial region based on the scaling parameters and the positional information of the fourth initial region, the fourth selected region is any region within the fourth initial region, and then the selected undetermined reconstructed search region can be determined based on the fourth selected region.
[0224] Understandably, in the embodiment of the present application, for the current upper right search region, for example R6, after obtaining the four boundaries iHorMin, iHorMax, iVerMin, and iVerMax of the search region (fourth initial region), the fourth selected region can be obtained by trimming and scaling the search region using the scaling parameters wIndex and hIndex.
[0225] It should be explained that, in the embodiments of this application, for the current upper right search region of the block, for example R6, the fourth selected region after scaling can be any region within the fourth initial region. That is, the fourth selected region can be a sub-region in a different direction, such as the top, bottom, left, right, or center, within the fourth initial region, and this application does not specifically limit it.
[0226] For illustrative purposes, in some embodiments, Figure 23 is a ninth schematic diagram illustrating region selection, and as shown in Figure 23, for the search region on the upper right side of the current block, for example R6, if the values of the scaling parameters wIndex and hIndex are both 1, the fourth selected region obtained after performing region selection on the fourth initial region using the scaling parameters wIndex and hIndex is the corresponding fourth initial region.
[0227] Exemplary, in some embodiments, Figure 24 is a 10th schematic diagram illustrating region selection, and as shown in Figure 24, for the current upper right search region of the block, for example R6, if the value of the scaling parameter wIndex is 2 and the value of hIndex is 1, then the fourth selected region obtained after performing region selection on the fourth initial region using the scaling parameters wIndex and hIndex is the region to the left of the corresponding fourth initial region.
[0228] Exemplary, in some embodiments, Figure 25 is an eleventh schematic diagram illustrating region selection, and as shown in Figure 25, for the current upper right search region of the block, e.g., R6, if the scaling parameter wIndex is 1 and hIndex is 2, then the fourth selected region obtained after performing region selection on the fourth initial region using the scaling parameters wIndex and hIndex is the lower region of the corresponding fourth initial region.
[0229] Exemplary, in some embodiments, Figure 26 is a 12th schematic diagram illustrating region selection, and as shown in Figure 26, for the current upper right search region of the block, for example R6, if the scaling parameter wIndex is 2 and the hIndex is 2, then the fourth selected region obtained after performing region selection on the fourth initial region using the scaling parameters wIndex and hIndex is the lower left region of the corresponding fourth initial region.
[0230] For example, in some embodiments, as shown in R6 of Figure 14, when regionId is equal to 5, the four boundaries after scaling the search region, i.e., the four boundaries of the first selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iHorMin. regionId iHor Max regionId It is calculated as follows:
[0231] iHor Max regionId=iHorMin+(iHorMax-iHorMin) / wIndex, iHorMin regionId =iHorMin For example, in some embodiments, as shown in R6 of Figure 14, when regionId is equal to 5, the four boundaries after scaling the search region, i.e., the four boundaries of the first selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iHorMin. regionId iHor Max regionId It is calculated as follows:
[0232] iHor Max regionId =iHorMax-(iHorMax-iHorMin) / wIndex iHorMin regionId =iHorMin For example, in some embodiments, as shown in R6 of Figure 14, when regionId is equal to 5, the four boundaries after scaling the search region, i.e., the four boundaries of the first selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iHorMin. regionId iHor Max regionId It is calculated as follows:
[0233] If wIndex is 2, iHorMax regionId =(iHorMax+iHorMin) / wIndex, iHorMin regionId =iHorMin For example, in some embodiments, as shown in R6 of Figure 14, when regionId is equal to 5, the four boundaries after scaling the search region, i.e., the four boundaries of the first selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor MaxregionId It can be set to iVerMin. regionId iVerMax regionId It is calculated as follows:
[0234] iVerMin regionId =iVerMin+(iVerMax-iVerMin) / hIndex i VerMax regionId =iVerMax For example, in some embodiments, as shown in R6 of Figure 14, when regionId is equal to 5, the four boundaries after scaling the search region, i.e., the four boundaries of the first selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iVerMin. regionId iVerMax regionId It is calculated as follows:
[0235] iVerMin regionId =iVerMax-(iVerMax-iVerMin) / hIndex i VerMax regionId =iVerMax For example, in some embodiments, as shown in R6 of Figure 14, when regionId is equal to 5, the four boundaries after scaling the search region, i.e., the four boundaries of the first selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iVerMin. regionId iVerMax regionId It is calculated as follows:
[0236] If hIndex is 2, iVerMin regionId =(iVerMax+iVerMin) / hIndex, i VerMax regionId =iVerMax Understandably, in the embodiment of the present invention, when performing region selection for the fourth initial region in the search region on the upper right side of the current block, for example R6, it is possible to choose to take only the left half of the fourth initial region. wIndex is 2, and iHorMaxregionId = (iHorMax + iHorMin) / wIndex is determined, and at the same time, iHorMin regionId =iHorMin, iVerMin regionId =iVerMin, iVerMax regionId =iVerMax is set.
[0237] Understandably, in the embodiments of the present invention, when performing region selection for the fourth initial region in the search area on the upper right side of the current block, for example R6, it is possible to choose to take only the lower half of the fourth initial region. In this case, hIndex is 2 and iVerMin regionId = (iVerMax + iVerMin) / hIndex is determined, and at the same time, iHorMin regionId =iHorMin, iHorMax regionId =iHorMax, iVerMax regionId =iVerMax is set.
[0238] Understandably, in the embodiments of this application, the process of selecting a region based on a scaling parameter can be achieved by right shifting the relevant division. For example, if wIndex is set to 2, the same result can be achieved with the >>1 operation.
[0239] As a result, in the embodiments of this application, for any sub-search region within the fully reconstructed search region and / or undetermined reconstructed search region, after obtaining the four boundaries of the search region iHorMin, iHorMax, iVerMin, and iVerMax, if wIndex≠1 and / or hIndex≠1, trimming can be performed on the search region based on the scaling parameter. For example, in Figure 14, for region Ri (i=2, 3, 4, 5), four methods of limiting the search range by taking the region to the right or upper right of the Ri region are shown in Figures 19 to 22. For region R6, four methods of limiting the search range by taking the region to the left or lower left of the R6 region are shown in Figures 23 to 26. For region R1, the central position can be taken as the intermediate position of the original search region, and four methods of limiting the search range are shown in Figures 15 to 18.
[0240] In other words, in the embodiments of the present invention, a search point within a search area may be scanned to include all search points within a specified search area, or a different method may be employed to limit the search range to a local area in order to balance computational complexity and coding efficiency. For example, for an undetermined reconstruction search area (corresponding to the two areas R5 and R6 in Figure 14) or a fully reconstruction search area (corresponding to the four areas R1 to R4 in Figure 14), the width of the search range may be limited to 1 / wIndex of the original, and the height may be limited to 1 / hIndex of the original, where both wIndex and hIndex are arbitrary numbers greater than or equal to 1.
[0241] Understandably, in the embodiments of this application, the limited search range, i.e., the fully reconstructed search range after selection and / or the undetermined reconstructed search range after selection, can be a region closer to the unit to be encoded (current block). For example, when reducing the search range of the R5 region, the width and height of the R5 search region can be reduced to half of the original, and the final search range can be the upper right quarter of the R5 region, as shown in Figure 22.
[0242] As described above, in the embodiments of this application, different search regions can be selected using different methods. Specifically, the search region can be classified into three types based on the relative position between the search region and the reference block (for example, to the left of the currently encoded block, above the currently encoded block, or to the upper right of the currently encoded block), and it is possible to restrict the Intra TMP search region for each of the three types of search regions.
[0243] Understandably, in the embodiments of this application, after determining the fully reconstructed search area and / or undetermined reconstructed search area based on the first template, it is possible to further select a region based on the fully reconstructed search area and / or undetermined reconstructed search area and obtain the selected fully reconstructed search area and / or selected undetermined reconstructed search area. Of course, it is also possible to choose to directly set the scope of the fully reconstructed search area and / or undetermined reconstructed search area during the execution of the process of determining the fully reconstructed search area and / or undetermined reconstructed search area. That is, the size of the search area including the fully reconstructed search area and / or undetermined reconstructed search area can be directly limited to the size of the search area of the selected fully reconstructed search area and / or selected undetermined reconstructed search area in the above-described solution.
[0244] For example, in some embodiments, when calculating the search region, one weight term can be added or one clip operation can be added based on the current formula. For example, taking only the right half of the R5 region, If regionId is equal to 4, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0245] 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) For example, in some embodiments, when calculating the search region, one weight term can be added or one clip operation can be added based on the current formula. For example, taking only the upper half of the R5 region, If regionId is equal to 4, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0246] 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) For example, in some embodiments, when calculating the search region, one weight term can be added or one clip operation can be added based on the current formula. For example, when taking only the left half of the R6 region, If regionId is equal to 5, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0247] 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 For example, in some embodiments, when calculating the search region, one weight term can be added or one clip operation can be added based on the current formula. For example, when taking only the lower half of the R6 region, If regionId is equal to 5, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0248] 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 For example, in some embodiments, when calculating the search region, one weight term can be added or one clip operation can be added based on the current formula. For example, when taking only the upper right quarter of the R5 region, If regionId is equal to 4, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0249] 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) For example, in some embodiments, when calculating the search region, one weight term or one clip operation can be added based on the current formula. For example, when taking only the lower left quarter of the R6 region, If regionId is equal to 5, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0250] 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 Furthermore, in the embodiments of the present invention, when performing region selection based on a fully reconstructed search region and / or an undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, first, a region width threshold and a region height threshold are determined based on the size parameters of the current block, and then, region selection is performed on the fully reconstructed search region and / or the undetermined reconstructed search region based on the region width threshold and / or region height threshold to determine the selected fully reconstructed search region and / or the selected undetermined reconstructed search region.
[0251] It should be explained that in the embodiments of this application, the width and height of the search region after region selection can be limited by a region width threshold and a region height threshold, respectively. Here, the region width threshold can be derived using the current block width nTbW, for example, by setting the region width threshold to a multiple of the current block width nTbW by wIndex. The region height threshold can be derived using the current block height nTbH, for example, by setting the region height threshold to a multiple of the current block height nTbH by hIndex.
[0252] In other words, in the embodiments of the present invention, the limit size of the search region can also be derived from the current encoded block size (the size parameter of the current block) in the process of performing region selection. For example, if the width of the search region dw > 2 × nTbW, the width of the search region is reduced, and it is ensured that the reduced width dw' of the search region does not exceed a wIndex multiple of the current block width nTbW. If the width of the search region dh > 2 × nTbH, the height of the search region is reduced, and it is ensured that the reduced height dh' of the search region does not exceed an hIndex multiple of the current block height nTbH.
[0253] Exemplary, in the embodiments of this application, if regionId is equal to 0, iVerMin regionId iVerMax regionId iHorMin regionId iHor Max regionId It is calculated as follows:
[0254] iHorMin regionId =(iHorMax+iHorMin) / 2-wIndex×nTbW / 2 iHor Max regionId =(iHorMax+iHorMin) / 2+wIndex×nTbW / 2 iVerMin regionId =(iVerMax+iVerMin) / 2-hIndex×nTbH / 2 i VerMax regionId =(iVerMax+iVerMin) / 2+hIndex×nTbH / 2 Exemplary, in the embodiments of this application, when regionId is equal to 1, 2, 3, or 4, iVerMin regionId iVerMax regionId iHorMin regionId iHor Max regionId It is calculated as follows:
[0255] iHorMin regionId =iHorMax-windex×nTbW iHor Max regionId =iHor Max i VerMax regionId =iVerMax-hindex×nTbH iVerMin regionId =iVerMin Exemplary, in the embodiments of this application, if regionId is equal to 5, iVerMin regionId iVerMax regionId iHorMin regionId iHor Max regionId It is calculated as follows:
[0256] iHor Max regionId =iHorMin+windex×nTbW iHorMin regionId =iHorMin iVerMin regionId =iVerMin+hindex×nTbH i VerMax regionId =iVerMax Furthermore, in the embodiments of the present invention, a search region in the fully reconstructed search region where any pixel point in the reference block corresponding to the search region overlaps with the current encoded tree block corresponding to the current block can be determined as the first overlap region. Simultaneously, a search region in the undetermined reconstructed search region that overlaps with the current encoded tree block corresponding to the current block can be determined as the second overlap region.
[0257] Accordingly, in the embodiments of the present invention, other regions in the complete reconstruction search region other than the first overlapping region can be determined as the first non-overlapping region, and other regions in the undetermined reconstruction search region other than the second overlapping region can be determined as the second non-overlapping region.
[0258] Furthermore, in the embodiments of the present application, when performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, region selection is performed on the first overlapping region to determine the fourth selected region, and then the selected fully reconstructed search region can be determined based on the fourth selected region and the first non-overlapping region, where the first non-overlapping region is a region in the fully reconstructed search region other than the first overlapping region.
[0259] Furthermore, in the embodiments of the present application, when performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, region selection is performed on the first non-overlapping region to determine the fifth selected region, and then the selected fully reconstructed search region can be determined based on the fifth selected region and the first overlapping region.
[0260] Furthermore, in the embodiments of the present application, region selection is performed based on the fully reconstructed search region and / or the undetermined reconstructed search region. When determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, region selection is performed on the second overlapping region to determine the sixth selected region. Then, the selected undetermined reconstructed search region can be determined based on the sixth selected region and the second non-overlapping region, where the second non-overlapping region is a region in the undetermined reconstructed search region other than the second overlapping region.
[0261] Furthermore, in the embodiments of the present application, when performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region after selection, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, region selection is performed on the second non-overlapping region to determine the seventh selected region, and then the selected undetermined reconstructed search region can be determined based on the seventh selected region and the second overlapping region.
[0262] For example, in the embodiments of the present application, it is possible to choose to restrict only the regions that currently overlap with the CTU (e.g., the first overlapping region and / or the second overlapping region) and not restrict the region reduction for other regions (e.g., the first non-overlapping region and / or the second non-overlapping region).
[0263] For example, in the embodiments of the present application, it is possible to choose to restrict only regions that currently do not have overlapping regions with the CTU (e.g., the first non-overlapping region and / or the second non-overlapping region), and not restrict other regions (e.g., the first overlapping region and / or the second overlapping region).
[0264] For example, in the embodiments of the present application, it is also possible to choose to impose restrictions on regions that currently do not have overlapping regions with the CTU (e.g., the first non-overlapping region and / or the second non-overlapping region) and the undetermined reconstruction search region, while not imposing region reduction restrictions on other regions (e.g., the first overlapping region).
[0265] For example, in some embodiments, if the encoded unit adjacent to the currently encoded unit (current block) is in Intra TMP mode, its block vector is BV neighbor This is denoted as follows, and using this BV, the upper-left corner of the reference block of the adjacent block is found. This point is used as the starting point for the search, and the search is expanded by nTbW in both the positive and negative directions of the X axis and by nTbH in both the positive and negative directions of the Y axis. Subsequently, the region that does not overlap with the fully reconstructed search region and the undetermined reconstructed search region is denoted as R7, and the search points within R7 are scanned. The specific implementation process is as follows.
[0266] Input: A luminance position (xCb, yCb) specifying the top-left corner sample of the current encoded block relative to the luminance sample at the top-left corner of the current image; a variable cbWidth specifying the width of the current encoded block at the luminance sample; a variable cbHeight specifying the height of the current encoded block at the luminance sample; a block vector bv; and a variable cIdx specifying the color component index of the current block.
[0267] Output: Predicted sample sequence predSamples.
[0268] When cIdx is equal to 0, i.e., it is the luminance component, and 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) When cIdx is equal to 0, i.e., it is the chromaticity component, and 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) The four boundaries of the R7 region are calculated as follows:
[0269] 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) After obtaining the R7 region range, it is determined whether R7 overlaps with an existing search region. If at least one of the four boundaries of the R7 region lies within one of the Ri (i=0,1,2,3,4,5) search regions (i.e., at least one of the following conditions is met), then it is determined that the R7 region overlaps with an existing search region. In this case, it is necessary to scan the portion of R7 that does not overlap with the existing search region; otherwise, all search points within the R7 search region are scanned.
[0270] iHorMin[regionId]<=iHorMax<=iHorMax[regionId] iHorMin[regionId]<=iHorMin<=iHorMax[regionId] iVerMin[regionId]<=iVerMax<=iVerMax[regionId] iVerMin[regionId]<=iVerMin<=iVerMax[regionId] Furthermore, in the embodiments of this application, when limiting the search range of a subregion, different values are set for the searchRangeWidth and / or searchRangeHeight of the subregion compared to other regions.
[0271] For example, in some embodiments, when restricting the region corresponding to the undetermined reconstruction search region, the following calculation can be performed:
[0272] If regionId is equal to 4, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0273] 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)) It should be noted that in the embodiments of the present application, scaleFactorW and scaleFactorH may be 1 / 2 or other values.
[0274] 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.
[0275] It should be noted that in the embodiments of the present application, the <<iBvShift operation in the above calculation process may be an operation of shifting after comparison first.
[0276] It should be noted that in the embodiments of the present application, in the process of determining iHorMin, the term (xTbCmp - searchRangeWidth × scaleFactorW)) << iBvShift is added and the maximum value is taken between it and the existing terms. Such an operation can be understood as the outer boundary approaching in the direction of the current block.
[0277] It should be noted that in the embodiments of the present application, in the process of determining iVerMax, the term (yTbCmp + searchRangeHeight × scaleFactorH) << iBvShift is added and takes the minimum value with the existing terms. Such an operation can be understood as the outer boundary approaching in the direction of the current block.
[0278] Exemplarily, in some embodiments, when restricting the region corresponding to the undetermined reconstruction search region, it can be calculated as follows.
[0279] When regionId is equal to 5, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows.
[0280] 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 It should be noted that in the embodiments of the present application, scaleFactorW and scaleFactorH may be 1 / 2 or other values.
[0281] 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.
[0282] It should be noted that in the embodiments of the present application, the <<iBvShift operation in the above calculation process may be an operation of shifting after comparison first.
[0283] It should be noted that in the embodiments of the present application, in the process of determining iHorMax, the term (xTbCmp + searchRangeWidth × scaleFactorW) << iBvShift is added and the minimum value is taken between this term and the existing terms. Such an operation can be understood as the outer boundary approaching in the direction of the current block.
[0284] It should be noted that in the embodiments of the present application, in the process of determining iVerMin, the term (yTbCmp - searchRangeHeight × scaleFactorH)) << iBvShift is added and the maximum value is taken between this term and the existing terms. Such an operation can be understood as the outer boundary approaching in the direction of the current block.
[0285] Furthermore, in the embodiments of the present application, when performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region, it is possible to select to further appropriately increase an offset operation, for example, a +1 operation, based on iHorMin, iHorMax, iVerMin, and iVerMax.
[0286] Furthermore, in the embodiments of the present application, when performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region, an operation of further restricting the selected fully reconstructed search region and / or the selected undetermined reconstructed search region can also be added. For example, controlling the range of its possible minimum value with the min function or controlling the range of its possible maximum value with the max function.
[0287] In step 104, searches are respectively performed in the selected fully reconstructed search region and / or the selected undetermined reconstructed search region to determine one or more block vectors of the current block.
[0288] In the embodiments of this application, region selection is performed based on a fully reconstructed search region and / or an undetermined reconstructed search region. After determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, one or more block vectors of the current block can be determined by further searching in the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, respectively.
[0289] Furthermore, in the embodiments of this application, when performing searches in the selected fully reconstructed search area and / or the selected undetermined reconstructed search area, respectively, and determining one or more block vectors, it is possible to scan the search points in the selected fully reconstructed search area and determine a first matching cost value between the matching template corresponding to the search point in the selected fully reconstructed search area and the first template based on predetermined matching criteria. Alternatively, it is possible to scan the search points in the selected undetermined reconstructed search area and determine a second matching cost value between the matching template corresponding to the search point in the selected undetermined reconstructed search area that satisfies predetermined availability conditions and the first template, according to predetermined matching criteria. Finally, based on the first and second matching cost values, one or more block vectors and one or more candidate templates corresponding to one or more block vectors can be determined.
[0290] It should be explained that in the embodiments of this application, it is not possible to determine whether the sampling points within the selected undetermined reconstruction search region are already reconstructed sampling points. Therefore, it is first necessary to determine whether the sampling points within the selected undetermined reconstruction search region are available for use.
[0291] Understandably, in the embodiments of this application, it is possible to first determine whether the current search point in the selected undetermined reconstruction search region satisfies predetermined availability conditions. If the current search point satisfies the predetermined availability conditions, a second matching cost value is determined between the matching template corresponding to the current search point and the first template based on predetermined matching criteria.
[0292] In response to this, in the embodiment of the present application, after determining whether the current search point in the selected undetermined reconstruction search region satisfies predetermined availability conditions, if the current search point does not satisfy the predetermined availability conditions, the process of determining the second matching cost value is not performed.
[0293] In some embodiments, the predetermined availability 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 reconstruction 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 a predetermined search window range; all sampling points in the reconstruction block corresponding to the matching template of the current search point do not exceed a predetermined 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 reconstruction 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 are reconstructed; all sampling points in the reconstruction block corresponding to the matching template of the current search point do not belong to the current coding block; and all sampling points in the reconstruction block corresponding to the matching template of the current search point are reconstructed.
[0294] It should be noted that in the embodiments of the present application, the predetermined matching criterion includes one of the cost functions for evaluating the mode, such as the absolute difference sum (SAD), absolute transformation difference sum (SATD), sum of squared errors (SSE), mean absolute difference (MAD), mean absolute error (MAE), mean squared error (MSE), and normalized correlation coefficient (NCC).
[0295] For example, in the embodiment of the present invention, when determining the block vector by search, bvYMins and bvYMaxs represent the minimum and maximum vertical offsets of the block vector, respectively.
[0296] qvXMins regionId bvXMaxs regionId bvYMins regionId bvYMaxs regionId iVerMin has already decided regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be obtained by using the following calculation.
[0297] qvXMins regionId =iHorMin regionId -xTbCmp bvXMaxs regionId =iHor Max regionId -xTbCmp bvYMins regionId =iVerMin regionId -yTbCmp bvYUps regionId =iVerMax regionId -yTbCmp qvXMins regionId bvXMaxs regionId bvYMins regionId , and bvYMaxs regionId This determines the range of horizontal and vertical offsets of the search point relative to the current block, i.e., the range of the block vector BV.
[0298] Exemplary, in the embodiments of this application, when performing a search in the selected complete reconstruction search region, (pX, pY) is constructed using the search points (iPosHor, iPoxVer) and each block vector BV (consisting of horizontal and vertical components) within each search region, where pX = iPosHor - xTbCmp and pY = iPosVer - yTbCmp, in which case pX lies between bvXMins and bvXMaxs, and pY lies between bvYMins and bvYMaxs) to find a matching reconstruction block of one current block in the reconstruction region, and the adjacent reconstruction pixels of that one or more matching reconstruction blocks are matching templates. This allows the calculation of the first matching cost between the adjacent template of the current block and the adjacent template of one or more reconstruction blocks, which is denoted as pDiff.
[0299] Exemplary, in the embodiment of this application, when performing a search in the undetermined reconstruction search region after selection, (pX, pY) is constructed from the search points (iPosHor, iPoxVer) and each block vector BV (consisting of horizontal and vertical components) within each search region, where pX = iPosHor - xTbCmp and pY = iPosVer - yTbCmp, in which case pX lies between bvXMins and bvXMaxs, and pY lies between bvYMins and bvYMaxs). The availability is then determined. If available, one or more matching reconstruction blocks of the current block can be found in the reconstruction region, and the adjacent reconstruction pixels of the matching reconstruction block are matching templates. This allows for the calculation of a second matching cost between the adjacent templates of the current block and the adjacent templates of the reconstruction block, which is also denoted as pDiff. If unavailable, the template matching cost is not calculated.
[0300] Exemplary, in embodiments of the present application, availability determination includes, but is not limited to, the simultaneous fulfillment of one or more of the following conditions: that each sampling point in the template does not exceed the effective coordinate range limited by the boundaries of the image sampling points; that each sampling point in the reconstruction block corresponding to the template does not exceed the effective coordinate range limited by the boundaries of the image sampling points; that neither each sampling point in the template nor each sampling point in the corresponding reconstruction block exceeds the specified range of the search window; that each sampling point in the template is in the same tile as the currently encoded region; that each sampling point in the reconstruction block corresponding to the template is in the same tile as the currently encoded region; that each sampling point in the template has been reconstructed; that each sampling point in the reconstruction block corresponding to the template is not currently in the encoded region; and that each sampling point in the reconstruction block corresponding to the template has been reconstructed.
[0301] In some embodiments, the predetermined availability conditions may include at least one or more of the following conditions: namely, the first marked sampling point in the matching template of the current search point does not exceed the coordinate range of the sampling point boundary corresponding to the current image; the second marked sampling point in the reconstruction block corresponding to the matching template of the current search point does not exceed the coordinate range of the sampling point boundary corresponding to the current image; the first marked sampling point in the matching template of the current search point does not exceed a predetermined search window range; the second marked sampling point in the reconstruction block corresponding to the matching template of the current search point does not exceed a predetermined search window range; the first marked sampling point in the matching template of the current search point is in the same tile as the current coding block; the second marked sampling point in the reconstruction block corresponding to the matching template of the current search point is in the same tile as the current coding block; the first marked sampling point in the matching template of the current search point is reconstructed; the second marked sampling point in the reconstruction block corresponding to the matching template of the current search point does not belong to the current coding block; and the second marked sampling point in the reconstruction block corresponding to the matching template of the current search point is reconstructed.
[0302] It should be explained that in the embodiments of the present application, the first labeled sampling point is one or more sampling points in the matching template of the current search point, and the second labeled sampling point is one or more sampling points in the reconstruction block corresponding to the matching template of the current search point.
[0303] In other words, when determining the availability of a search point within the undetermined reconstruction search area after selection, instead of scanning and determining all sampling points in the matching template corresponding to the search point, it is chosen to determine whether the search point is available using the marked sampling points in the matching template. Correspondingly, instead of scanning and determining all sampling points in the reconstruction block corresponding to the matching template of the search point, it is chosen to determine whether the search point is available using the marked sampling points in the reconstruction block.
[0304] Understandably, in the embodiments of this application, the first marked sampling point may be any one or more sampling points within the matching template. For example, the first marked sampling point may be one or more sampling points located at corner positions within the matching template. If only the upper template is present, then the first marked sampling point may be the upper left and lower right corner sampling points, or only the lower right corner sampling point, within the upper template region.
[0305] Understandably, in the embodiments of the present application, the second marked sampling point is any one or more sampling points within the reconstruction block corresponding to the matching template of the current search point. For example, the second marked sampling point may be one or more sampling points located at corner positions within the reconstruction block. For example, the upper-left and lower-right corner sampling points of the reconstruction block region, or only the lower-right corner sampling point of the reconstruction block region.
[0306] Furthermore, in the embodiments of this application, when determining the availability of search points within the undetermined reconstruction search area after selection, the first marked sampling points are scanned in order of priority based on the predetermined availability conditions described above. If the current first marked sampling point does not meet the predetermined availability conditions, the scanning is stopped and it is determined that the current search point does not meet the predetermined availability conditions. If the current first marked sampling point meets the predetermined availability conditions, the scanning of the next first marked sampling point is continued, and if all first marked sampling points meet the predetermined availability conditions, it is determined that the current search point meets the predetermined availability conditions.
[0307] Furthermore, in the embodiments of this application, when determining the availability of a search point within the undetermined reconstruction search area after selection, the second marked sampling points are scanned in order of priority based on the predetermined availability conditions described above. If the current second marked sampling point does not meet the predetermined availability conditions, the scanning is stopped, and it is determined that the current search point does not meet the predetermined availability conditions. If the current second marked sampling point meets the predetermined availability conditions, the scanning of the next second marked sampling point is continued, and if all second marked sampling points meet the predetermined availability conditions, it is determined that the current search point meets the predetermined availability conditions.
[0308] In other words, in the embodiments of the present invention, the use of multiple labeled sampling points may be sequential. For example, first, it is determined whether the upper left corner sampling point is available or not. If it is unavailable, "unavailable" is returned. If it is available, then it is determined whether the lower right corner sampling point is available or not. If it is unavailable, "unavailable" is returned. Only if it is available is "available" returned. Here, the priority of the upper left corner sampling point is higher than that of the lower right corner sampling point.
[0309] It should be explained that in the embodiments of this 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 can be determined, where N is an integer greater than 0.
[0310] In response to this, in the embodiments of the present invention, when performing searches in the selected fully reconstructed search area and / or the selected undetermined reconstructed search area to determine one or more block vectors, it is possible to first determine a predetermined quantity N corresponding to a candidate template, then scan the search points in the selected fully reconstructed search area and determine a first matching cost value between the matching template corresponding to the search point in the selected fully reconstructed search area and the first template based on predetermined matching criteria, and at the same time scan the search points in the selected undetermined reconstructed search area and determine a second matching cost value between the matching template corresponding to the search point in the selected undetermined reconstructed search area that satisfies predetermined availability conditions and the first template according to predetermined matching criteria. Finally, based on the first and second matching cost values, N block vectors and N candidate templates corresponding to the N block vectors can be determined.
[0311] In other words, in the embodiments of the present invention, when a search is performed in the selected fully reconstructed search area and / or the selected undetermined reconstructed search area, and N block vectors corresponding to N matching templates are determined, that is, the process of performing a search within the search area (the selected fully reconstructed search area and / or the selected undetermined reconstructed search area) and determining the block vectors BV corresponding to N matching templates may include determining the value of the number N of candidate templates, determining the comparison criteria for the matching templates, and recording the N block vectors BV corresponding to the N matching templates (the selected N candidate templates).
[0312] Understandably, in the embodiments of the present application, when determining a predetermined quantity N corresponding to a candidate template, N may be determined by decoding the bitstream, N may be determined according to a first predetermined numerical value, or N may be determined according to a predetermined numerical range.
[0313] In other words, in the embodiments of the present invention, it is first necessary to determine the value of N. Here, N is a predetermined constant, for example, N may be 4, or N may be within a certain numerical range, for example, the value of N may be any integer within [2,8]. The range of the value of N is predetermined, and the encoding side can determine the optimal value of N using methods such as coarse selection by cost 1, coarse selection by cost 2, coarse selection by cost 3, or fine selection by cost 4, and transmit that optimal value of N to the decoding side in bitstream format. Here, each of the cost 1, 2, 3, and 4 terms may be one of the cost functions for evaluating modes such as SAD, SATD, MSE, MAD, and RDO. The present invention does not specifically limit the method for determining N.
[0314] Furthermore, in the embodiments of the present invention, when determining N block vectors and N candidate templates corresponding to the N block vectors based on a first matching cost value and a second matching cost value, that is, when determining one or more block vectors and one or more candidate templates corresponding to one or more block vectors, first, N minimum matching cost values can be determined from the first matching cost value and the second matching cost value, and then, based on N search points corresponding to the N minimum matching cost values, N block vectors and N candidate templates corresponding to the N block vectors can be determined.
[0315] From the matching cost values between the matching template corresponding to the search point in the selected fully reconstructed search region and the first template, N minimum matching cost values are determined. Then, N block vectors and N candidate templates corresponding to the N minimum matching cost values are determined.
[0316] In some embodiments, all available search points within the entire search range (e.g., regionId=0,1,2,3,4,5) are scanned, and by comparison, N search points with the minimum matching cost pDiff (including the first and second matching cost values) are obtained. The corresponding matching costs are denoted as pDiff_BEST[n], where n=0,...,N-1. The corresponding block vector BV is denoted as optimal block vector BV_BEST[n], where each term is a single coordinate pair (pX_BEST,pY_BEST), where n=0,...,N-1. The corresponding matching template is optimal matching template T_BEST[n], where n=0,...,N-1. Here, N may be 1 or an integer greater than 1 as needed.
[0317] It should be explained that in the embodiments of this application, when performing the search process, the search methods that can be employed include, but are not limited to, search methods based on different search step lengths, such as a rough search based on a first search step length and / or a fine search based on a second search step length. Here, the first search step length is greater than the second search step length.
[0318] In some embodiments, the first and second search step lengths can be any number greater than 0, that is, they can be integers or not, as long as it is guaranteed that the first search step length is greater than the second search step length. For example, the first search step length could be 3 and the second search step length could be 1 / 2.
[0319] Furthermore, in the embodiments of the present invention, a search is performed in the selected fully reconstructed search area and / or the selected undetermined reconstructed search area according to the first search step length, a first matching cost value corresponding to a search point in the selected fully reconstructed search area and a second matching cost value corresponding to a search point in the selected undetermined reconstructed search area that satisfies predetermined availability conditions are determined, and based on the first and second cost values, it is possible to select N block vectors and N candidate templates corresponding to the N block vectors.
[0320] Exemplary, in embodiments of the present application, the rough search may specifically include obtaining a final candidate template by determining the optimal rough matching template in the search domain with a first predetermined step length (i.e., a first search step length, e.g., 2), or by determining the optimal rough matching template in the search domain using a downsampled template (e.g., with a downsampling factor of 2).
[0321] For example, in the embodiments of this application, if the search method performs only a rough search, then in each region, pX is bvXMins regionId and bvXMaxs regionId It is between and and pY is bvYMins regionId and bvYMaxs regionId Within the search range between [the specified values], a search is performed with a large step length (first search step length) (for example, a step length of 2 or 3), and the first N optimal matching costs obtained by template matching are recorded as pDiff_BEST[n], where n=0,...,N-1. The corresponding block vector BV is denoted as optimal block vector BV_BEST[n], where each term is a single coordinate pair (pX_BEST, pY_BEST), where n=0,...,N-1. Here, N may be 1 or an integer value greater than 1 as needed.
[0322] Furthermore, in the embodiments of the present application, a search is performed in the selected fully reconstructed search area and / or the selected undetermined reconstructed search area according to the second search step length, a first matching cost value corresponding to a search point in the selected fully reconstructed search area and a second matching cost value corresponding to a search point in the selected undetermined reconstructed search area that satisfies predetermined availability conditions are determined, and based on the first and second cost values, it is possible to select N block vectors and N candidate templates corresponding to the N block vectors, where the first search step length is greater than the second search step length.
[0323] Exemplary, in embodiments of the present application, the fine search may specifically include obtaining a final candidate template by determining the optimal fine matching template in the search domain with a second predetermined step length (i.e., a second search step length, e.g., 1), or obtaining a final candidate template by determining the optimal fine matching template in the vicinity of the optimal rough matching template after performing a rough search.
[0324] For example, in the embodiments of this application, if the search method performs only fine search, then in each region, pX is bvXMins regionId and bvXMaxs regionId It is between and and pY is bvYMins regionId and bvYMaxs regionId Within the search range between the specified values, a fine search is performed with a small step length (second search step length) (for example, the step length is 1 or 1 / 2, and if the step length is less than 1, sub-pixel interpolation is required). The first N optimal matching costs obtained by template matching are recorded as pDiff_BEST[n], where n=0,...,N-1. The corresponding block vector BV is denoted as optimal block vector BV_BEST[n], where each term is a single coordinate pair (pX_BEST, pY_BEST), and n=0,...,N-1. Here, N may be 1 or an integer value greater than 1 as needed.
[0325] Furthermore, in the embodiment of the present application, first, a search is performed in the selected fully reconstructed search area and / or the selected undetermined reconstructed search area according to the first search step length, and a first matching cost value corresponding to the search point in the selected fully reconstructed search area and a second matching cost value corresponding to the search point in the selected undetermined reconstructed search area that satisfies predetermined availability conditions are determined, and based on the first cost value and the second cost value, M reference block vectors and M matching reconstruction blocks corresponding to the M reference block vectors are determined, where M is an integer greater than 0, and then the first search area is determined based on the M matching reconstruction blocks. The first search area is determined to be smaller than the total area consisting of the fully reconstructed search area after selection and / or the undetermined reconstructed search area after selection. Subsequently, a search is performed in the first search area according to the second search step length to determine a third matching cost value between the matching template and the first template corresponding to a search point in the first search area that satisfies predetermined availability conditions, where the first search step length is greater than the second search step length. Finally, based on the first matching cost value, the second matching cost value, and / or the third matching cost value, N block vectors and N candidate templates corresponding to the N block vectors can be determined.
[0326] Understandably, in the embodiments of the present application, when determining N block vectors and N candidate templates corresponding to the N block vectors based on a first matching cost value, a second matching cost value, and / or a third matching cost value, first, N minimum matching cost values can be determined from the third matching cost value, and then, based on N search points corresponding to the N minimum matching cost values, N block vectors and N candidate templates corresponding to the N block vectors can be determined.
[0327] It is understandable 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 a first matching cost value, a second matching cost value, and / or a 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 to determine NT block vectors other than the M reference block vectors and NT candidate templates corresponding to the NT block vectors based on the first and second cost values.
[0328] It should be explained that in the embodiment of the present invention, after performing a rough search, P initial block vectors are determined based on a first cost value and a second cost 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.
[0329] For example, in the embodiment of the present invention, if the search method is one in which a rough search is performed followed by a fine search, first a rough search is performed with a step length of 2 (i.e., the first search step length is 2), and the optimal rough matching template (initial matching template) can be obtained by template matching. Next, the optimal fine matching template can be determined in the vicinity of the optimal rough matching template with a step length of 1 (i.e., the second search step length is 1), and thus the final candidate template can be obtained.
[0330] Here, in the rough search stage, in each region, pX is bvXMins regionId and bvXMaxs regionId It is between and and pY is bvYMins regionId and bvYMaxs regionIdWithin the search range between these two points, it is possible to choose to perform a coarse search with a large step length (for example, a step length of 2 or 3). For example, a coarse search is performed with a step length of 2, and the first P optimal matching costs obtained by template matching are recorded as pDiff1_BEST[p], where p=0,...,P-1, and the corresponding block vector BV is recorded as optimal block vector BV1_BEST[p], where p=0,...,P-1. Here, P may be an integer value greater than 1 or 1 as needed, and the search region where the optimal matching search points are located is bestRegionId[p], where p=0,...,P-1. Depending on the algorithm, one or more (here M, 1<=M<=P) fine search reference points are generated in the coarse search stage and sent to the next stage. For example, let M=1.
[0331] Subsequently, in the fine search phase, it is possible to choose to perform a search in the neighborhood using the optimal block vector BV1_BEST[p] (p=0,…,M-1) obtained from the rough search as the reference point for the fine search. Specifically, for each reference point for the fine search, first, the fine search range TmpRefineRangeHor and TmpRefineRangeVer are determined. The fine search range may be a fixed size or may be associated with the encoded block size. For example, both TmpRefineRangeHor and TmpRefineRangeVer can be set to min(nTbW,nTbH) / 2. Next, the position of the optimal matching reconstruction block obtained from the rough search is calculated as the reference position of the fine search region, i.e., BestPosX=xTbCmp+pX1_BEST and BestPosY=yTbCmp+pY1_BEST.
[0332] In one embodiment, the search window can be used directly, and the entire undetermined reconstructed search area after selecting the fine search area can be treated and scanned directly.
[0333] Based on the optimal matching block position obtained through rough search, a new search range is acquired, i.e., iHor Max refine=min(picWidth-nTbW,BestPosX+TmpRefineRangeHor) iHorMin refine =max(iTemplateSizeW,BestPosX-TmpRefineRangeHor) i VerMax refine =min(picHeight-nTbH,BestPosY+TmpRefineRangeVer) iVerMin refine =max(iTemplateSizeH,BestPosY-TmpRefineRangeVer) Next, the adjusted block vectors BVbvXMins, bvXMaxs, bvYMins, bvYMaxs are obtained from iVerMin refine iVerMax refine iHorMin refine iHor Max refine It is obtained by calculation using [this method].
[0334] bvXMins=iHorMin refine -xTbCmp bvXMaxs=iHorMax refine -xTbCmp bvYMins=iVerMin refine -yTbCmp bvYMaxs=iVerMax refine -yTbCmp The fine search is performed within the block vector range where pX lies between bvXMinsrefine and bvXMaxsrefine, and pY lies between bvYMinsrefine and bvYMaxsrefine. That is, a direct scan is performed for all search positions within the fine search window, and availability is determined sequentially. For example, a search is performed with a step length of 1, and the first T optimal matching costs obtained by template matching are recorded as pDiff_BEST[t], where t=0,...,T-1, and the corresponding block vector BV is recorded as optimal block vector BV_BEST[t], where t=0,...,T-1. Here, T is 1 or an integer greater than 1. For example, let T=1.
[0335] After the above operations are completed, the results of the coarse selection and fine selection processes (where the fine selection process includes one or more reference point searches) can be combined to obtain one or more optimal block vectors BV_BEST[n] corresponding to different algorithmic requirements, n=0,…,N-1, where each term is a single coordinate pair (pX_BEST,pY_BEST), where pX_BEST and pY_BEST are the horizontal and vertical offset amounts of the optimal matching template relative to the currently encoded block template, and also the horizontal and vertical offset amounts of the optimal matching reconstruction block relative to the currently encoded block.
[0336] It should be explained that in the embodiments of this application, combining the results of coarse and fine selection processes can result in different block vector selection methods. For example, sorting all according to template cost and then selecting the first N. In another example, the results of M coarse searches are used to obtain T fine search results (obtained by fine searching the first M coarse search results), and then (NT) results are obtained from the (M+1)th coarse search result. In implementation, for example, M=1, T=1, N=5, or M=1, T=1, N=3.
[0337] Thus, in the embodiments of the present invention, the process of performing a search in the search domain and determining one or more block vectors may include three types of search methods: a search method that performs only a rough search, a search method that performs only a fine search, and a search method that performs a rough search followed by a fine search.
[0338] Furthermore, in the embodiments 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 predicted value of the current block can be determined based on the one or more reference blocks.
[0339] Furthermore, in the embodiments of the present application, when determining one or more reference blocks corresponding to the current block based on one or more block vectors, first, one or more initial reconfiguration blocks corresponding to the current block can be determined based on one or more block vectors, and then, a modification process can be performed on one or more initial reconfiguration blocks to determine one or more reference blocks.
[0340] In other words, in the embodiment of the present invention, other methods can be used when obtaining N candidate reconstruction blocks (reference blocks). For example, first, modifications are made to the initial reconstruction block corresponding to the obtained candidate template, and then the corresponding reference block is determined.
[0341] To address this, one may obtain N candidate reconstruction blocks (reference blocks) by copying matching reconstruction blocks (initial reconstruction blocks) corresponding to N BVs, then directly weight these N candidate reconstruction blocks to obtain the predicted value of the current block. Alternatively, one may modify the matching reconstruction blocks (initial reconstruction blocks) corresponding to N BVs to obtain candidate reconstruction blocks (reference blocks), then weight them to obtain the predicted value of the current block.
[0342] Furthermore, in the embodiments of the present application, when performing a modification process on one or more initial reconstruction blocks and determining one or more reference blocks, a filtering process can be performed on one or more initial reconstruction blocks to determine one or more reference blocks.
[0343] Furthermore, in the embodiments of the present application, when performing a modification process on one or more initial reconstruction blocks and determining one or more reference blocks, first, one or more modification parameter vectors can be determined based on one or more candidate templates corresponding to one or more block vectors, and then, based on one or more modification parameter vectors, a modification process can be performed on one or more initial reconstruction blocks to determine one or more reference blocks.
[0344] Furthermore, in the embodiments of the present application, when determining one or more modification parameter vectors based on one or more candidate templates corresponding to one or more block vectors, first, an autocorrelation matrix corresponding to the candidate template can be determined based on the pixel values in the candidate template, then a cross-correlation vector can be determined based on the pixel values in the first template and the pixel values in the candidate template, and finally, a modification parameter vector can be determined based on the autocorrelation matrix and the cross-correlation vector.
[0345] Understandably, in the embodiments of the present invention, the method for modifying the initial reconstructed block may include performing a filtering process directly on the initial reconstructed block, and the filtering method employed when performing the processing may be a conventional filtering method such as a bilingual filter or an average filter, or it may be a filter enhancement based on a neural network.
[0346] Understandably, in the embodiments of the present invention, the method for modifying the initial reconstruction block further includes modifying the matching reconstruction block (initial reconstruction block) using matching template information (candidate templates).
[0347] Furthermore, in the embodiments of the present application, the predicted value of the current block can be determined based on one or more block vectors. Specifically, first, the optimal block vector of the current block can be determined based on one or more block vectors of the current block; next, at least one reference block corresponding to the current block can be determined based on the optimal block vector; and finally, the predicted value of the current block can be determined based on at least one reference block.
[0348] It should be explained that in the embodiments of the present application, when determining the predicted value of the current block based on at least one reference block, first, at least one predicted block is determined based on at least one reference block, and then weighted fusion is performed on at least one predicted block to determine the predicted value of the current block.
[0349] For example, in some embodiments, after determining the optimal block vector for the current block, multiple points are obtained from around the optimal block vector, i.e., multiple reference blocks are obtained, and then a weighted fusion is performed on the predicted values corresponding to the multiple points to obtain a predicted value for the current block.
[0350] Furthermore, in embodiments of the present application, the predicted value of the current block can be determined based on one or more block vectors. Specifically, a first predicted value of the current block can be determined based on one or more block vectors of the current block, then a second predicted value of the current block can be determined based on a predetermined prediction mode, the predetermined prediction mode includes a Planar mode and / or a directional mode, and finally, the predicted value of the current block can be determined based on the first and second predicted values.
[0351] Exemplary, in some embodiments, after determining one or more block vectors of the current block, the final predicted value can be obtained by weighting and combining the predicted value obtained using the said one or more block vectors with the predicted value obtained in another Intra mode. Here, the other Intra mode is a prediction mode other than IntraTMP, such as a Planar mode or a direction mode, where the direction mode may be obtained by deriving from TIMD or by positioning in an Intra candidate table using an Index transmitted in a bitstream. This method may be called the IntraTMP CIIP mode.
[0352] Understandably, in IntraTMP mode, in addition to obtaining predicted values using the basic copy method, it is also possible to obtain predicted values by performing filtering fusion at locations corresponding to multiple BVs, and to perform fused prediction with the normal Intra mode.
[0353] Furthermore, in the embodiments of the present application, after determining the predicted value of the current block based on the block vector of the current block, the reconstructed value of the current block can be determined based on the predicted value of the current block.
[0354] It should be explained that in the embodiments of this application, first, the bitstream can be decoded to determine the predicted difference (residual) corresponding to the current block, and then, based on the predicted difference and the predicted value of the current block, the reconstructed value of the current block can be determined.
[0355] As described above, the decoding method proposed in steps 101 to 104 effectively utilizes reconstruction sampling points that are spatially close to the currently encoded region, while simultaneously reducing the size of the search region, thereby improving prediction accuracy and ensuring encoding complexity.
[0356] In other words, the embodiment of the present invention proposes a method of restricting the IntraTMP search area by partitioning the region, and by correspondingly restricting the search area for search areas at different locations, it is possible to leave reconstruction sampling points that are relatively close to the currently coded unit, thereby improving prediction accuracy to some extent and guaranteeing the complexity of coding.
[0357] It should be explained that the decoding method proposed in the embodiment of this application is a method of reducing the Intra TMP search area by dividing the region. Specifically, by correspondingly reducing the search area for search areas at different locations, the complexity is balanced while ensuring the effectiveness of the algorithm, and coding efficiency is effectively improved.
[0358] Here, the input to Intra TMP-BV is the position (xTbCmp, yTbCmp) of the current encoded block (current block), the width nTbW of the current encoded block, and the height nTbH of the current encoded block. The output of Intra TMP-BV is one or more BVs of the current block and the corresponding predicted block values predSamples[x][y], where x=0...nTbW-1 and y=0...nTbH-1. The predicted block values may be used as the final predicted values, and further processing can be performed to obtain the final predicted value of the current block.
[0359] Understandably, the specific process for obtaining the Intra TMP-BV proposed in the embodiment of this application can be divided into three steps: determining the current template type, obtaining the current template reconstruction pixels, and determining the block vector within a given search range. Here, a set of predicted values for the current block can be obtained corresponding to each acquired BV.
[0360] Herein, in embodiments of the present application, the search range may include a selected fully reconstructed search region and / or a selected undetermined reconstructed search region obtained after region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region. Herein, the fully reconstructed search region includes reconstructed sampling points, and the undetermined reconstructed search region includes reconstructed sampling points and / or unreconstructed sampling points.
[0361] Embodiments of the present invention provide a decoding method. The decoder determines a first template corresponding to the current block, and determines a fully reconstructed search region and / or an undetermined reconstructed search region based on the first template, wherein the fully reconstructed search region includes reconstructed sampling points, and the undetermined reconstructed search region includes reconstructed sampling points and / or unreconstructed sampling points. A region selection is performed based on the fully reconstructed search region and / or the undetermined reconstructed search region, and the selected fully reconstructed search region and / or the selected undetermined reconstructed search region are determined, wherein the selected fully reconstructed search region is smaller than or equal to the fully reconstructed search region, and the selected undetermined reconstructed search region is smaller than or equal to the undetermined reconstructed search region. A search is performed in the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, respectively, to determine one or more block vectors of the current block. Thus, in the embodiments of the present application, after determining a fully reconstructed search area and / or an undetermined reconstructed search area including reconstructed sampling points and / or unreconstructed sampling points based on the first template, a region selection process is performed on the fully reconstructed search area and / or the undetermined reconstructed search area to obtain a selected fully reconstructed search area and / or a selected undetermined reconstructed search area with a relatively small range, and a search can be performed in the selected fully reconstructed search area and / or selected undetermined reconstructed search area. In other words, the encoding and decoding method proposed in the embodiments of the present application can utilize available sampling points within the undetermined reconstructed search area, while simultaneously limiting the search range to some extent, and furthermore, it can sufficiently obtain more effective reference information while reducing the complexity of encoding and decoding, thereby improving the efficiency and performance of encoding and decoding.
[0362] One embodiment of the present invention proposes an encoding method applicable to an encoder, and Figure 27 is a schematic flowchart of the encoding method proposed in the embodiment of the present invention, and as shown in Figure 27, the encoding process by the encoder may include the following steps.
[0363] In step 201, determine the first template corresponding to the current block.
[0364] In the embodiment of the present invention, first, a first template corresponding to the current block can be determined. Here, when obtaining the first template, first, the template type corresponding to the current block can be determined, and then, based on the template type, the first template corresponding to the current block can be determined.
[0365] It should be explained that the encoding method of the embodiment of this application is applied to an encoder. Furthermore, the encoding method may include an intra-prediction method, and more specifically, it may be a color component prediction method. Here, the video image is divided into a plurality of encoding blocks, each encoding block may include a first color component, a second color component, and a third color component, and the current block in the embodiment of this application refers to the encoding block in the video image that is currently subject to intra-prediction.
[0366] Here, if it is necessary to predict the first color component, the component to be predicted is the first color component; if it is necessary to predict the second color component, the component to be predicted is the second color component; and if it is necessary to predict the third color component, the component to be predicted is the third color component. Furthermore, if we make a prediction for the first color component of the current block and assume that the first color component is the luminance component, i.e., the component to be predicted is the luminance component, then the current block may also be called a luminance block. Or, if we make a prediction for the second color component of the current block and assume that the second color component is the chromaticity component, i.e., the component to be predicted is the chromaticity component, then the current block may also be called a chromaticity block.
[0367] Furthermore, in the embodiments of this application, the reference pixel of the current block may refer to a reference pixel point adjacent to the current block. Here, "adjacent" may refer to spatially adjacent, but is not limited to this. For example, adjacent may refer to adjacent in the time domain, adjacent in the spatial domain and time domain, and furthermore, the reference pixel of the current block may be a reference pixel obtained by performing some processing on a reference pixel point adjacent in the spatial domain, adjacent in the time domain, adjacent in spacetime and time domain, and the embodiments of this application are not particularly limited.
[0368] Furthermore, in embodiments of the present application, it may be chosen to determine the template type of the current block based on instruction information in the bitstream, or to determine the template type of the current block based on the size of the current block.
[0369] Furthermore, in embodiments of the present application, it may be chosen to determine the template type of the current block based on the reference pixels of the current block, where the reference pixels of the current block include at least one of 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.
[0370] Understandably, in the embodiments of the present application, the reference pixels of the current block may include adjacent reconstructed pixels of the current block, that is, it is possible to choose to use adjacent reconstructed pixels of the current block as a template to search for a matching template in a predetermined search area.
[0371] It should be explained that in the embodiments of the present application, the reference pixels of the current block, i.e., the adjacent reconstructed pixels of the current block, may include the upper reference pixels, upper left reference pixels, upper right reference pixels, left reference pixels, and lower left reference pixels of the current block.
[0372] Understandably, in the embodiments of the present application, when determining the template type of the current block using the reference pixels of the current block, the template type can be classified and determined based on whether or not adjacent reference pixels are available.
[0373] Understandably, in the embodiments of the present application, when determining the template type of a block, it is also possible to classify and determine the template type based on the instructions in the bitstream.
[0374] Furthermore, in the embodiments of the present application, when determining the template type of the current block based on the reference pixels of the current block, the template type of the current block is determined as the first value 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; the template type of the current block is determined as the second value if the left adjacent reference pixel of the current block is available; the template type of the current block is determined as the third value if the upper adjacent reference pixel of the current block is available; the template type of the current block is determined as the fourth value if the left adjacent reference pixel of the current block and the upper left adjacent reference pixel of the current block are both available; the template type of the current block is determined as the fifth value if the left adjacent reference pixel of the current block and the lower left adjacent reference pixel of the current block are both available; and the template type of the current block is determined as the sixth value if the upper adjacent reference pixel of the current block and the upper right adjacent reference pixel of the current block are both available.
[0375] It should be explained that in the embodiments of this application, the first, second, third, fourth, fifth, and sixth values may be any numerical values and are not specifically limited in this application. For example, the values of the first, second, third, fourth, fifth, and sixth values may be 1, 2, 3, 4, 5, and 6, respectively.
[0376] Exemplary, in the embodiments of the present application, the template type can be represented by refTemplateType, and correspondingly, as shown in Figure 3, the grid-filled blocks are the current blocks, and the adjacent regions of the current blocks are templates T, where six types of templates are shown.
[0377] Exemplary examples of these six template types are shown below. Specifically, when the upper left reference pixel, upper reference pixel, and left reference pixel are all available, the value of refTemplateType is 1 and the template shape is as shown in Figure 3(a); when only the left reference pixel is available, the value of refTemplateType is 2 and the template shape is as shown in Figure 3(b); when only the upper reference pixel is available, the value of refTemplateType is 3 and the template shape is as shown in Figure 3(c); when only the left reference pixel and upper left reference pixel are available, the value of refTemplateType is 4 and the template shape is as shown in Figure 3(d); when only the left reference pixel and lower left reference pixel are available, the value of refTemplateType is 5 and the template shape is as shown in Figure 3(e); and when only the upper reference pixel and upper right reference pixel are available, the value of refTemplateType is 6 and the template shape is as shown in Figure 3(f).
[0378] In some embodiments, the IntraTMP template type can be selected based on instructions within the bitstream, in addition to the availability information of the reference pixels described above. For example, the template type can be determined on the decoding side by assigning a number to each template type and transmitting the number information of the template type actually used within the bitstream.
[0379] In other words, in the embodiments of the present application, it is possible to choose to determine the template type based on the availability information of the reference pixels in the current block, or to choose to determine the template type based on the information shown in the bitstream, or to determine the template type by combining the availability information of the reference pixels and the information shown in the bitstream. The present application is not specifically limited.
[0380] Furthermore, in the embodiments of the present invention, when determining a first template corresponding to the current block based on the template type, the template reference pixels of the current block can first be determined 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.
[0381] It should be explained that in the embodiments of the present application, the first template of the current block may include template reference pixels of the current block. Here, the template reference pixels of the current block can be determined by the template type of the current block and the template size corresponding to the template type.
[0382] It should be explained that in the embodiments of the present application, the first template of the current block may consist of reconstructed pixels in one or more regions of the upper, upper right, left, lower left, and upper left sides of the current block, i.e., it may consist of the reference pixels of the current block described above.
[0383] It should be noted that, in the embodiments of this application, the template size corresponding to the template type may be predefined, indicated by a bitstream syntax element, or adaptively selected based on block size or other information. For example, when retrieving the left template, the template width templateW_size can be set to 4, and when retrieving the upper template, the template height templateH_size can be set to 4.
[0384] In response to this, in the embodiment of the present application, by combining the value of the current block's template type refTemplateType and the template size corresponding to the refTemplateType, it is possible to determine which part of the reconstructed pixels will be obtained as the template reference pixels of the current block, and furthermore, the corresponding first template can be determined.
[0385] Exemplary, in the embodiments of the present application, if the value of refTemplateType is 1, it is possible to choose to obtain the reconstructed pixels on the left, upper left, and top of the current block; if the value of refTemplateType is 2, only the reconstructed pixels of the left four columns of the current block are obtained; and if the value of refTemplateType is 3, only the reconstructed pixels of the top four rows of the currently encoded block are obtained.
[0386] Of course, the pre-set template size value is not limited to 4, but may be any integer greater than 0, and this application does not specifically limit it.
[0387] Understandably, in the embodiments of the present application, the template reference pixels of the current block, determined from the reference pixels of the current block, can be a first template corresponding to the current block, by combining the template type of the current block and the corresponding template size.
[0388] In step 202, the fully reconstructed search area and / or the undetermined reconstructed search area are determined based on the first template, the fully reconstructed search area includes reconstructed sampling points, and the undetermined reconstructed search area includes reconstructed sampling points and / or unreconstructed sampling points.
[0389] In the embodiments of the present invention, after determining a first template corresponding to the current block, a fully reconstructed search region and / or an undetermined reconstructed search region can be determined based on the first template, the fully reconstructed search region including reconstructed sampling points, and the undetermined reconstructed search region including reconstructed sampling points and / or unreconstructed sampling points.
[0390] Understandably, in the embodiments of the present application, the search region selected based on the first template in the prediction process of the Intra TMP may include an undetermined reconstruction search region and / or a fully reconstruction search region. Here, the fully reconstruction search region may include only reconstructed sampling points, i.e., all sampling points within the fully reconstruction search region are reconstructed sampling points. On the other hand, with respect to the undetermined reconstruction search region, it is not possible to determine whether the sampling points within the undetermined reconstruction search region are reconstructed or not, i.e., the undetermined reconstruction search region may include only reconstructed sampling points, only unreconstructed sampling points, or both reconstructed and unreconstructed sampling points.
[0391] To address this, the process of scanning the undetermined reconstruction search area requires the addition of a process to determine the availability of each search location, thereby allowing full use of information on all neighboring reconstructed sampling points.
[0392] It should be explained that, in the embodiments of the present invention, based on the first template, the fully reconstructed search area and / or the undetermined reconstructed search area can be determined, centered on a zero-value block vector, according to the size of the search window and the position information of the current image.
[0393] In other words, in the embodiment of the present invention, the search region is located near a zero-value BV, or it can be said that it is constrained by information such as the size of the search window and image edges, centered around a zero-value BV.
[0394] Furthermore, in the embodiments of the present application, the fully reconstructed search area is a search area that includes a set of positions corresponding to the upper-left corner pixel point of the corresponding reference block at each search position, and the undetermined reconstructed search area is a search cover area that includes a set of pixels of the corresponding reference block at each search position.
[0395] In other words, in the embodiments of the present invention, the search region refers to the set of positions corresponding to the upper-left corner pixel point of the corresponding reference block at each search position, and this region may not include unreconstructed sampling points. On the other hand, the undetermined reconstruction search region is because the lower-right corner pixel of the reference block corresponding to each search position in this region may be located in the upper-right or lower-left region of the currently encoded block and may not have been reconstructed.
[0396] Accordingly, in the embodiment of the present invention, the search region can be the set of upper-left pixels of the search points, and the search cover region includes the set of pixels of the reference block corresponding to all the search points.
[0397] It should be explained that in the embodiments of the present invention, the block vector search process may include parts such as an initialization process, determination of the search region of the first template in the current frame, searching within the search region, and determination of one or more optimal block vectors. Therefore, when performing the search process, the initialization operation must be completed first.
[0398] For example, as shown in Figure 5 above, nTbW and nTbH represent the current block size, templateW_size and templateH_size represent the template size, and uiPatchWidth and uiPatchHeight represent the block size including the current block and its template.
[0399] Correspondingly, during initialization, uiPatchWidth can be initialized as nTbW + templateW_size and uiPatchHeight as nTbH + templateH_size. Here, templateW_size and templateH_size may be fixed constants, may be indicated by bitstream syntax elements, or may be dynamically adjusted based on the encoded block size or other information, and templateW_size and templateH_size may or may not be equal. For example, templateW_size=4 and templateH_size=4, or if the width of the encoded block is greater than 8, templateW_size=4 is set, and if the width of the encoded block is 8 or less, templateW_size=2 is set, and if the height of the encoded block is greater than 8, templateH_size=4 is set, and if the height of the encoded block is 8 or less, templateH_size=2 is set.
[0400] Furthermore, the cost threshold between templates is initialized as diffThreshold. For example, if the cost function is SAD, the threshold is diffThreshold=((1<<bitDepth)> >2) × (uiPatchHeight × uiPatchWidth - nTbH × nTbW). Here, if the bit depth of the image is 10, then diffThreshold represents a distortion threshold of 256 for each pixel point in the template region.
[0401] Furthermore, the positions of the coding tree block CTB, where block CB is currently located, are initialized as ctbRsX and ctbRsY.
[0402] Furthermore, the positional offset of the current block CB in the current CTB is initialized as offsetLCBY=yTbCmp-ctbRsY and offsetLCBX=xTbCmp-ctbRsX.
[0403] Furthermore, initialize iTemplateSizeH=templateH_size and iTemplateSizeW=templateW_size.
[0404] Furthermore, iBvShift is initialized, and iBvShift is the precision of the block vector BV. For example, the precision of BV can be pixel-level precision, in which case iBvShift is 0. Alternatively, the precision of BV can be sub-pixel precision; for example, iBvShift = 1 represents 1 / 2 pixel precision, and iBvShift = 2 represents 1 / 4 pixel precision, and this is not specifically limited here.
[0405] Furthermore, the predetermined search range of the template is initialized. The predetermined search range of the template may be set to a fixed size, or it may be dynamically adjusted based on the encoded block size. For example, searchRangeWidth = TMP_SEARCH_RANGE_MULT_FACTOR × nTbW, searchRangeHeight = TMP_SEARCH_RANGE_MULT_FACTOR × nTbH, where the value of TMP_SEARCH_RANGE_MULT_FACTOR may be a predetermined value, for example, set to 5, may be indicated by a bitstream syntax element, or may be adaptively adjusted based on information such as the encoded block size.
[0406] Furthermore, in the embodiments of the present invention, when determining one or more block vectors corresponding to the current block based on the first template, first, a complete reconstruction search area can be determined based on the first template, and then, a search can be performed in the complete reconstruction search area to determine one or more block vectors.
[0407] It should be explained 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-colored background area is the reconstructed area, the black-colored background block is the current block, and the dashed line frame is the search range window. Therefore, the search area of the IntraTMP technique does not exceed the overlapping portion between the reconstructed area shown by the dark-colored background and the area shown by the dashed line frame.
[0408] Thus, the current search region of the block template may be the reconstructed portion of the CTB where the current block is located, or it may be another reconstructed CTB region. In practice, the search region is the set of all search points. Since the shape of the region cannot often be represented by a single rectangular region, in concrete implementations, searches can be performed in multiple rectangular regions, and the search results from different regions can be combined to obtain the final optimal matching block and optimal block vector.
[0409] As an example, in some embodiments, a region segmentation process is performed on the reconstruction area within the dashed frame in Figure 6 to determine the top, bottom, left, and right boundaries of each region. Then, a search is performed in multiple rectangular regions, and the search results from different regions are combined to obtain the final optimal matching module and optimal block vector.
[0410] For illustrative purposes, referring to Figure 13, which shows four different sub-region division methods. As shown in Figure 13, the black-filled background block is the current block, and the four division methods (a), (b), (c), and (d) all divide the search region into four sub-search regions, where different fill patterns represent one sub-search region. Here, (a), (b), (c), and (d) consider all available search ranges.
[0411] For illustrative purposes, let's assume that different search regions are distinguished and represented by regionId. Considering that the currently encoded block template pixels must be obtained from the image reconstruction region, and the reconstructed block pixels corresponding to the template must also be obtained from the reconstruction region, it is necessary to further determine the searchable locations in the search regions represented by different regionIds based on the current encoded block's position (xTbCmp, yTbCmp), the current encoded block's size (nTbW, nTbH), the current image's size (picWidth, picHeight), the size of the CTB where the current encoded block is located (CtbSizeW, CtbSizeH), a predetermined search range of the template (searchRangeWidth, searchRangeHeight), and the position offset of the current encoded block in the current CTB (offsetLCBY, offsetLCBX), thereby determining the block vector BV. Specifically, iVerMin and iVerMax represent the minimum and maximum absolute coordinate positions that can be searched in the vertical direction, respectively, while iHorMin and iHorMax represent the minimum and maximum absolute coordinate positions that can be searched in the horizontal direction. The values of iVerMin, iVerMax, iHorMin, and iHorMax differ for each search region represented by a different regionId.
[0412] Furthermore, in the embodiments of this application, the search area can be divided based on the shape of the reconstruction area and the certainty of the possibility of obtaining the reconstructed pixels, thereby achieving a balance between computational complexity and coding efficiency. For example, the CTB area encoded before the CTB in which the current block is located, and the areas located to the upper left, directly to the left, and directly above the current block within the CTB in which the current encoded block is located, belong to areas that are definitely reconstructed. In this way, it is possible to select to determine the areas in which it can be determined that all included sampling points have been reconstructed as the complete reconstruction search area. Correspondingly, the areas located to the lower left and upper right of the current encoded block within the CTB in which the current encoded block is located belong to areas that may or may not be reconstructed. In this way, the areas in which it cannot be determined that all included sampling points have been reconstructed are selected as the undetermined reconstruction search area.
[0413] In some embodiments, based on considerations for the fully reconstructed search area and the undetermined reconstructed search area, taking Figure 13(a) as an example, the search area is divided into six sub-search areas. The implementation method is as follows.
[0414] If regionId is equal to 0, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0415] iHorMax0=min((xTbCmp+searchRangeWidth)< <iBvShift,((picWidth-nTbW)<<iBvShift)) iHorMin0=max((iTemplateSizeW)< <iBvShift,(xTbCmp-searchRangeWidth)<<iBvShift) iVerMax0=(yTbCmp-nTbH-offsetLCBY)< <iBvShift iVerMin0=max(((iTemplateSizeH)< <iBvShift),((yTbCmp-searchRangeHeight)<<iBvShift)) If regionId is equal to 1, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0416] iHorMin1=max((iTemplateSizeW)< <iBvShift,(xTbCmp-searchRangeWidth)<<iBvShift) iHorMax1=(xTbCmp-offsetLCBX-nTbW)< <iBvShift iVerMin1=(yTbCmp+1)< <iBvShift iVerMax1=min((picHeight-nTbH)< <iBvShift,(yTbCmp-offsetLCBY+CtbSizeH-nTbH)<<iBvShift) If regionId is equal to 2, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0417] iHorMax2=(xTbCmp-offsetLCBX-nTbW)< <iBvShift iHorMin2=max((iTemplateSizeW)< <iBvShift,(xTbCmp-searchRangeWidth)<<iBvShift) iVerMin2=max((iTemplateSizeH)< <iBvShift,(yTbCmp-nTbH-offsetLCBY)<<iBvShift) iVerMax2=(yTbCmp)< <iBvShift If regionId is equal to 3, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0418] 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 If regionId is equal to 4, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0419] iHorMin=(xTbCmp-offsetLCBX-nTbW)< <iBvShift iHorMax=(xTbCmp-nTbW)< <iBvShift iVerMin=(yTbCmp+1)< <iBvShift iVerMax=min((picHeight-nTbH)< <iBvShift,(yTbCmp-offsetLCBY+CtbSizeH-nTbH)<<iBvShift) If regionId is equal to 5, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0420] 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 In actual applications, iHorMin regionId iHor Max regionId iVerMin regionId iVerMax regionIdThese represent the left, right, top, and bottom edges of different sub-search regions, respectively.
[0421] To intuitively illustrate the different sub-search regions corresponding to different regionIds, Figure 14 is a second schematic diagram showing the search region determination process. As shown in Figure 14, R1, R2, R3, R4, R5, and R6 represent six different sub-search regions, where R1, R2, R3, and R4 are fully reconstructed search regions, and R5 and R6 are undetermined reconstructed search regions. It should be noted that in Figure 14, the upper-left corner pixels of a block are represented by a pixel range that can be aligned.
[0422] In other words, in some embodiments, the search region can be divided into two types: one is a region where it is determined that all sampling points within the region have been reconstructed (called the fully reconstructed search region), which includes, for example, the four regions R1, R2, R3, and R4 in Figure 14; and the other is a region where it is not determined whether all sampling points within the region have been reconstructed (called the undetermined reconstructed search region), which includes, for example, the two regions R5 and R6 in Figure 14.
[0423] Furthermore, in the embodiments of this application, in order to realize a smaller number of search areas and reduce the amount of code, the number of search areas can be reduced by selectively integrating some fully reconstructed search areas and some undetermined reconstructed search areas to construct a new undetermined reconstructed search area.
[0424] In some embodiments, an integrated update process can be performed on the fully reconstructed search area and / or the undetermined reconstructed search area to determine the updated fully reconstructed search area and the updated undetermined reconstructed search area. Here, the first total number of areas in the updated fully reconstructed search area and the updated undetermined reconstructed search area is smaller than the second total number of areas in the fully reconstructed search area and / or the undetermined reconstructed search area.
[0425] In other words, in the embodiments of the present invention, the initially defined undetermined reconstruction search region is relatively large, and the total number of regions is relatively small.
[0426] Exemplary, in the embodiment of the present application, it is possible to perform an integration process on R2 and R5 to form a new undefined reconstruction search area, compared to the four fully reconstructed search areas R1, R2, R3, and R4 in Figure 13 and the two undefined reconstruction search areas R5 and R6. Here, the updated fully reconstructed search area includes R1, R3, and R4, and the updated undefined reconstruction search area includes R6 and a new undefined reconstruction search area composed of R2 and R5.
[0427] Exemplary, in the embodiment of the present application, it is possible to perform an integration process on R4 and R6 to form a new undefined reconstruction search area, compared to the four fully reconstructed search areas R1, R2, R3, and R4 in Figure 13 and the two undefined reconstruction search areas R5 and R6. Here, the updated fully reconstructed search area includes R1, R2, and R3, and the updated undefined reconstruction search area includes R5 and a new undefined reconstruction search area composed of R4 and R6.
[0428] In step 203, a region selection is performed based on the fully reconstructed search region and / or the undetermined reconstructed search region, and the selected fully reconstructed search region and / or the selected undetermined reconstructed search region are determined, the selected fully reconstructed search region being smaller than or equal to the fully reconstructed search region, and the selected undetermined reconstructed search region being smaller than or equal to the undetermined reconstructed search region.
[0429] In the embodiments of the present invention, after determining the search area, i.e., the fully reconstructed search area and / or the undetermined reconstructed search area, based on the first template, it is possible to further perform area selection based on the fully reconstructed search area and / or the undetermined reconstructed search area, thereby determining the corresponding selected fully reconstructed search area and / or the selected undetermined reconstructed search area.
[0430] It should be explained that, in the embodiments of this application, performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region can be understood as performing reduction and restriction processing on the fully reconstructed search region and / or the undetermined reconstructed search region, thereby reducing the range of the search region to be ultimately searched and lowering the complexity of encoding and decoding.
[0431] In response to this, in the embodiments of the present application, after performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region, the determined selected fully reconstructed search region is smaller than or equal to the fully reconstructed search region, and the determined selected undetermined reconstructed search region is smaller than or equal to the undetermined reconstructed search region.
[0432] Furthermore, in the embodiments of the present invention, when performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region, the fully reconstructed search region can be determined as the selected fully reconstructed search region, and at the same time, region selection can be performed on the undetermined reconstructed search region to determine the selected undetermined reconstructed search region.
[0433] In other words, in the embodiments of the present invention, it is possible to select to reduce and restrict only the undetermined reconstruction search area, and furthermore, to obtain the corresponding selected undetermined reconstruction search area, and to construct the search area in which the search is ultimately performed using the selected undetermined reconstruction search area and the fully reconstructed search area.
[0434] Furthermore, in the embodiments of this application, when performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region, region selection can be performed on the fully reconstructed search region to determine the selected fully reconstructed search region, and at the same time, the undetermined reconstructed search region can be determined as the selected undetermined reconstructed search region.
[0435] In other words, in the embodiments of the present invention, it is possible to select to reduce and restrict only the fully reconstructed search area, and furthermore, to obtain the corresponding selected fully reconstructed search area, and to construct the search area in which the search is ultimately performed using the selected fully reconstructed search area and the undetermined reconstructed search area.
[0436] Furthermore, in the embodiments of this application, when performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region, region selection can be performed on the fully reconstructed search region to determine the selected fully reconstructed search region, and at the same time, region selection can be performed on the undetermined reconstructed search region to determine the selected undetermined reconstructed search region.
[0437] In other words, in the embodiments of the present invention, it is possible to simultaneously reduce and restrict the fully reconstructed search area and the undetermined reconstructed search area, and furthermore, the corresponding selected fully reconstructed search area and selected undetermined reconstructed search area can be obtained, and the search area to be ultimately explored can be constructed using the selected fully reconstructed search area and selected undetermined reconstructed search area.
[0438] Furthermore, in the embodiments of the present invention, when performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region, the fully reconstructed search region can be determined as the fully reconstructed search region after selection, and at the same time, the undetermined reconstructed search region can be determined as the undetermined reconstructed search region after selection.
[0439] In other words, in the embodiment of the present invention, the fully reconstructed search area and the undetermined reconstructed search area are not reduced or restricted, and instead the search area in which the final search is performed can be directly constructed using the fully reconstructed search area and the undetermined reconstructed search area.
[0440] Furthermore, in the embodiments of the present invention, when performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, first, a scaling parameter is determined, then region selection is performed on the fully reconstructed search region and / or the undetermined reconstructed search region based on the scaling parameter, and finally the selected fully reconstructed search region and / or the selected undetermined reconstructed search region can be determined.
[0441] It should be explained that in the embodiments of this application, the scaling parameters may include a height scaling parameter hIndex and a width scaling parameter wIndex, where both the height scaling parameter hIndex and the width scaling parameter wIndex are 1 or greater.
[0442] For example, in some embodiments, a search point within a search domain may be scanned by scanning all search points within a specified search domain, and different methods may be employed to restrict the local search range in order to balance computational complexity and coding efficiency. For example, the width of the search range may be restricted to 1 / wIndex of the original range, and the height to 1 / hIndex of the original range, where wIndex and hIndex are both arbitrary numbers greater than or equal to 1.
[0443] It should be explained that in the embodiments of this application, scaling parameters can be determined and written to a bitstream. Here, the scaling parameters are transmitted by one of the following: SPS layer syntax information, PPS layer syntax information, APS layer syntax information, SH layer syntax information, or CU layer syntax information.
[0444] It should be explained that in the embodiments of this application, the scaling parameters may be determined based on predetermined numerical values, for example, both wIndex and hIndex are 2.
[0445] In other words, in the embodiments of the present invention, the scaling parameter that limits the size of the search area may be transmitted by the sps layer syntax, or by the pps layer syntax, aps layer syntax, or sh layer syntax, cu layer syntax, etc.
[0446] It should be explained that in the embodiments of this application, different search regions can be selected using different methods, that is, different search regions can correspond to different reduction methods.
[0447] Furthermore, in the embodiment of the present invention, the search area located above the current block within the fully reconstructed search area can be determined as the first initial area, the search area located to the left or upper left of the current block within the fully reconstructed search area can be determined as the second initial area, the search area located to the lower left of the current block within the undetermined reconstructed search area can be determined as the third initial area, and the search area located to the upper right of the current block within the undetermined reconstructed search area can be determined as the fourth initial area.
[0448] Exemplary, in some embodiments, as shown in Figure 14, R1, R2, R3, R4, R5, and R6 represent six different sub-search regions, where R1, R2, R3, and R4 are fully reconstructed search regions, and R5 and R6 are undetermined reconstructed search regions. Based on the positional relationship between each sub-search region and the current block, the search region R1 located above the current block within the fully reconstructed search region can be determined as the first initial region, the search regions R2, R3, and R4 located to the left or upper left of the current block within the fully reconstructed search region can be determined as the second initial region, the search region R5 located to the lower left of the current block within the undetermined reconstructed search region can be determined as the third initial region, and the search region R6 located to the upper right of the current block within the undetermined reconstructed search region can be determined as the fourth initial region.
[0449] Furthermore, in the embodiments of the present invention, region selection is performed for the complete reconstruction search region and / or the undetermined reconstruction search region based on scaling parameters, and when determining the selected complete reconstruction search region and / or the selected undetermined reconstruction search region, a first selected region is determined in the first initial region based on the scaling parameters and the positional information of the first initial region, the first selected region is any region within the first initial region, and then the selected complete reconstruction search region can be determined based on the first selected region.
[0450] Understandably, in the embodiments of the present invention, for the upper search region of the current block, for example R1, after obtaining the four boundaries iHorMin, iHorMax, iVerMin, and iVerMax of the search region (first initial region), the first selected region can be obtained by trimming and scaling the search region using the scaling parameters wIndex and hIndex.
[0451] It should be explained that, in the embodiments of this application, with respect to the upper search region of the current block, for example R1, the first selected region after scaling can be any region within the first initial region. That is, the first selected region can be a sub-region in a different direction, such as the top, bottom, left, right, or center, within the first initial region, and this application does not specifically limit it.
[0452] Exemplary, in some embodiments, Figure 15 is a first schematic diagram illustrating region selection, and as shown in Figure 15, if the values of the scaling parameters wIndex and hIndex are both 1 for the upper search region of the current block, e.g., R1, then the first selected region obtained after performing region selection on the first initial region using the scaling parameters wIndex and hIndex is the corresponding first initial region.
[0453] Exemplary, in some embodiments, Figure 16 is a second schematic diagram illustrating region selection, and as shown in Figure 16, for the upper search region of the current block, e.g., R1, if the scaling parameter wIndex is 2 and the hIndex is 1, then the first selected region obtained after performing region selection on the first initial region using the scaling parameters wIndex and hIndex is an intermediate region within the corresponding first initial region.
[0454] Exemplary, in some embodiments, Figure 17 is a third schematic diagram illustrating region selection, and as shown in Figure 17, for the upper search region of the current block, e.g., R1, if the scaling parameter wIndex is 1 and hIndex is 2, then the first selected region obtained after performing region selection on the first initial region using the scaling parameters wIndex and hIndex is an intermediate region within the corresponding first initial region.
[0455] Exemplary, in some embodiments, Figure 18 is a fourth schematic diagram illustrating region selection, and as shown in Figure 18, for the upper search region of the current block, e.g., R1, if the scaling parameter wIndex is 2 and the hIndex is 2, then the first selected region obtained after performing region selection on the first initial region using the scaling parameters wIndex and hIndex is an intermediate region within the corresponding first initial region.
[0456] For example, in some embodiments, as shown in R1 of Figure 14, when regionId is equal to 0, the four boundaries after scaling the search region, i.e., the four boundaries of the first selected region, are defined by iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It is calculated as follows:
[0457] iHorMin regionId =iHorMin+(iHorMax-iHorMin) / (2×wIndex) iHor Max regionId =iHorMax-(iHorMax-iHorMin) / (2×wIndex) iVerMin regionId =iVerMin+(iVerMax-iVerMin) / (2×hIndex) i VerMaxregionId =iVerMax-(iVerMax-iVerMin) / (2×hIndex) Understandably, in the embodiments of this application, the process of selecting a region based on a scaling parameter can be achieved by right shifting the relevant division. For example, if wIndex is set to 2, the same result can be achieved with the >>1 operation.
[0458] Furthermore, in the embodiments of the present invention, region selection is performed for the complete reconstruction search region and / or the undetermined reconstruction search region based on scaling parameters, and when determining the selected complete reconstruction search region and / or the selected undetermined reconstruction search region, a second selected region is determined in the second initial region based on the scaling parameters and the positional information of the second initial region. The second selected region is any region within the second initial region, and then the selected complete reconstruction search region can be determined based on the second selected region.
[0459] Furthermore, in the embodiments of the present invention, region selection is performed for the fully reconstructed search region and / or the undetermined reconstructed search region based on scaling parameters, and when determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, a third selected region is determined in the third initial region based on the scaling parameters and the positional information of the third initial region, the third selected region is any region within the third initial region, and then the selected undetermined reconstructed search region can be determined based on the third selected region.
[0460] Understandably, in the embodiments of the present application, for the search region on the left, upper left, or lower left side of the current block, for example R2, R3, R4, R5, after obtaining the four boundaries iHorMin, iHorMax, iVerMin, and iVerMax of the search region (second initial region or third initial region), the second (or third) selected region can be obtained by trimming and scaling the search region using the scaling parameters wIndex and hIndex.
[0461] It should be explained that, in the embodiments of this application, for the current search area on the left, upper left, or lower left side of the block, for example R2, R3, R4, and R5, the scaled second (or third) selected area can be any area within the second (or third) initial area. That is, the second (or third) selected area can be a sub-area in a different direction, such as above, below, left, right, or center, within the second (or third) initial area, and this application does not specifically limit it.
[0462] Exemplary, in some embodiments, Figure 19 is a fifth schematic diagram illustrating region selection, and as shown in Figure 19, if the values of the scaling parameters wIndex and hIndex are both 1 for the search regions to the left, upper left, or lower left of the current block, e.g., R2, R3, R4, R5, then the first selected region obtained after performing region selection on the first initial region using the scaling parameters wIndex and hIndex is the corresponding first initial region.
[0463] Exemplary, in some embodiments, Figure 20 is a sixth schematic diagram illustrating region selection, and as shown in Figure 20, for the search region to the left, upper left, or lower left of the current block, e.g., R2, R3, R4, R5, if the scaling parameter wIndex is 2 and hIndex is 1, then the first selected region obtained after performing region selection on the first initial region using the scaling parameters wIndex and hIndex is the region to the right of the corresponding first initial region.
[0464] Exemplary, in some embodiments, Figure 21 is a seventh schematic diagram illustrating region selection, and as shown in Figure 21, for the search regions to the left, upper left, or lower left of the current block, e.g., R2, R3, R4, R5, if the scaling parameter wIndex is 1 and hIndex is 2, then the first selected region obtained after performing region selection on the first initial region using the scaling parameters wIndex and hIndex is the upper region of the corresponding first initial region.
[0465] Exemplary, in some embodiments, Figure 22 is an eighth schematic diagram illustrating region selection, and as shown in Figure 22, for the search region to the left, upper left, or lower left of the current block, e.g., R2, R3, R4, R5, if the scaling parameter wIndex is 2 and hIndex is 2, then the first selected region obtained after performing region selection on the first initial region using the scaling parameters wIndex and hIndex is the upper right region of the corresponding first initial region.
[0466] For example, in some embodiments, as shown in Figure 14, R2, R3, and R4, when regionId is equal to 1, 2, and 3, the four boundaries after scaling the search region, i.e., the four boundaries of the second selected region, are defined by iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iHorMin. regionId iHor Max regionId It is calculated as follows:
[0467] iHorMin regionId =iHorMax-(iHorMax-iHorMin) / wIndex iHor Max regionId =iHor Max For example, in some embodiments, as shown in Figure 14, R2, R3, and R4, when regionId is equal to 1, 2, and 3, the four boundaries after scaling the search region, i.e., the four boundaries of the second selected region, are defined by iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iHorMin. regionId iHor Max regionId It is calculated as follows:
[0468] iHorMin regionId =iHorMin+(iHorMax-iHorMin) / wIndex iHor MaxregionId =iHor Max For example, in some embodiments, as shown in Figure 14, R2, R3, and R4, when regionId is equal to 1, 2, and 3, the four boundaries after scaling the search region, i.e., the four boundaries of the second selected region, are defined by iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iHorMin. regionId iHor Max regionId It is calculated as follows:
[0469] If wIndex is 2, iHorMin regionId =(iHorMax+iHorMin) / wIndex, iHor Max regionId =iHor Max For example, in some embodiments, as shown in Figure 14, R2, R3, and R4, when regionId is equal to 1, 2, and 3, the four boundaries after scaling the search region, i.e., the four boundaries of the second selected region, are defined by iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iVerMin. regionId iVerMax regionId It is calculated as follows:
[0470] iVerMin regionId =iVerMin i VerMax regionId =iVerMax-(iVerMax-iVerMin) / hIndex For example, in some embodiments, as shown in Figure 14, R2, R3, and R4, when regionId is equal to 1, 2, and 3, the four boundaries after scaling the search region, i.e., the four boundaries of the second selected region, are defined by iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionIdIt can be set to iVerMin. regionId iVerMax regionId It is calculated as follows:
[0471] iVerMin regionId =iVerMin i VerMax regionId =iVerMin+(iVerMax-iVerMin) / hIndex For example, in some embodiments, as shown in Figure 14, R2, R3, and R4, when regionId is equal to 1, 2, and 3, the four boundaries after scaling the search region, i.e., the four boundaries of the second selected region, are defined by iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iVerMin. regionId iVerMax regionId It is calculated as follows:
[0472] iVerMin regionId =iVerMin If hIndex is 2, iVerMax regionId =(iVerMax+iVerMin) / hIndex For example, in some embodiments, as shown in R5 of Figure 14, when regionId is equal to 4, the four boundaries after scaling the search region, i.e., the four boundaries of the third selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iHorMin. regionId iHor Max regionId It is calculated as follows:
[0473] iHorMin regionId =iHorMax-(iHorMax-iHorMin) / wIndex iHor Max regionId =iHor Max For example, in some embodiments, as shown in R5 of Figure 14, when regionId is equal to 4, the four boundaries after scaling the search region, i.e., the four boundaries of the third selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iHorMin. regionId iHor Max regionId It is calculated as follows:
[0474] iHorMin regionId =iHorMin+(iHorMax-iHorMin) / wIndex iHor Max regionId =iHor Max For example, in some embodiments, as shown in R5 of Figure 14, when regionId is equal to 4, the four boundaries after scaling the search region, i.e., the four boundaries of the third selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iHorMin. regionId iHor Max regionId It is calculated as follows:
[0475] If wIndex is 2, iHorMin regionId =(iHorMax+iHorMin) / wIndex, iHor Max regionId =iHor Max For example, in some embodiments, as shown in R5 of Figure 14, when regionId is equal to 4, the four boundaries after scaling the search region, i.e., the four boundaries of the third selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iVerMin. regionId iVerMax regionId It is calculated as follows:
[0476] iVerMin regionId =iVerMin i VerMax regionId =iVerMax-(iVerMax-iVerMin) / hIndex For example, in some embodiments, as shown in R5 of Figure 14, when regionId is equal to 4, the four boundaries after scaling the search region, i.e., the four boundaries of the third selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iVerMin. regionId iVerMax regionId It is calculated as follows:
[0477] iVerMin regionId =iVerMin i VerMax regionId =iVerMin+(iVerMax-iVerMin) / hIndex For example, in some embodiments, as shown in R5 of Figure 14, when regionId is equal to 4, the four boundaries after scaling the search region, i.e., the four boundaries of the third selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iVerMin. regionId iVerMax regionId It is calculated as follows:
[0478] iVerMin regionId =iVerMin If hIndex is 2, iVerMax regionId =(iVerMax+iVerMin) / hIndex Understandably, in the embodiments of the present application, when performing region selection for the second (or third) initial region for the search region on the left, upper left, or lower left side of the current block, for example R2, R3, R4, R5, it is possible to choose to take only the right half of the second (or third) initial region. In this case, wIndex is 2 and iHorMin regionId = (iHorMax + iHorMin) / wIndex is determined, and at the same time, iHorMax regionId =iHorMax,iVerMin regionId =iVerMin, iVerMax regionId =iVerMax is set.
[0479] Understandably, in the embodiments of the present application, when performing region selection for the second (or third) initial region for the search region on the left, upper left, or lower left side of the current block, for example R2, R3, R4, R5, it is possible to choose to take only the upper half of the second (or third) initial region. In this case, hIndex is 2 and iVerMax regionId = (iVerMax + iVerMin) / hIndex is determined, and at the same time, iHorMin regionId =iHorMin, iHorMax regionId =iHorMax,iVerMin regionId =iVerMin is set to this value.
[0480] Understandably, in the embodiments of this application, the process of selecting a region based on a scaling parameter can be achieved by right shifting the relevant division. For example, if wIndex is set to 2, the same result can be achieved with the >>1 operation.
[0481] Furthermore, in the embodiments of the present invention, region selection is performed for the fully reconstructed search region and / or the undetermined reconstructed search region based on scaling parameters, and when determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, a fourth selected region is determined in the fourth initial region based on the scaling parameters and the positional information of the fourth initial region, the fourth selected region is any region within the fourth initial region, and then the selected undetermined reconstructed search region can be determined based on the fourth selected region.
[0482] Understandably, in the embodiment of the present application, for the current upper right search region, for example R6, after obtaining the four boundaries iHorMin, iHorMax, iVerMin, and iVerMax of the search region (fourth initial region), the fourth selected region can be obtained by trimming and scaling the search region using the scaling parameters wIndex and hIndex.
[0483] It should be explained that, in the embodiments of this application, for the current upper right search region of the block, for example R6, the fourth selected region after scaling can be any region within the fourth initial region. That is, the fourth selected region can be a sub-region in a different direction, such as the top, bottom, left, right, or center, within the fourth initial region, and this application does not specifically limit it.
[0484] For illustrative purposes, in some embodiments, Figure 23 is a ninth schematic diagram illustrating region selection, and as shown in Figure 23, for the search region on the upper right side of the current block, for example R6, if the values of the scaling parameters wIndex and hIndex are both 1, the fourth selected region obtained after performing region selection on the fourth initial region using the scaling parameters wIndex and hIndex is the corresponding fourth initial region.
[0485] Exemplary, in some embodiments, Figure 24 is a 10th schematic diagram illustrating region selection, and as shown in Figure 24, for the current upper right search region of the block, for example R6, if the value of the scaling parameter wIndex is 2 and the value of hIndex is 1, then the fourth selected region obtained after performing region selection on the fourth initial region using the scaling parameters wIndex and hIndex is the region to the left of the corresponding fourth initial region.
[0486] Exemplary, in some embodiments, Figure 25 is an eleventh schematic diagram illustrating region selection, and as shown in Figure 25, for the current upper right search region of the block, e.g., R6, if the scaling parameter wIndex is 1 and hIndex is 2, then the fourth selected region obtained after performing region selection on the fourth initial region using the scaling parameters wIndex and hIndex is the lower region of the corresponding fourth initial region.
[0487] Exemplary, in some embodiments, Figure 26 is a 12th schematic diagram illustrating region selection, and as shown in Figure 26, for the current upper right search region of the block, for example R6, if the scaling parameter wIndex is 2 and the hIndex is 2, then the fourth selected region obtained after performing region selection on the fourth initial region using the scaling parameters wIndex and hIndex is the lower left region of the corresponding fourth initial region.
[0488] For example, in some embodiments, as shown in R6 of Figure 14, when regionId is equal to 5, the four boundaries after scaling the search region, i.e., the four boundaries of the first selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iHorMin. regionId iHor Max regionId It is calculated as follows:
[0489] iHor Max regionId=iHorMin+(iHorMax-iHorMin) / wIndex iHorMin regionId =iHorMin For example, in some embodiments, as shown in R6 of Figure 14, when regionId is equal to 5, the four boundaries after scaling the search region, i.e., the four boundaries of the first selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iHorMin. regionId iHor Max regionId It is calculated as follows:
[0490] iHor Max regionId =iHorMax-(iHorMax-iHorMin) / wIndex iHorMin regionId =iHorMin For example, in some embodiments, as shown in R6 of Figure 14, when regionId is equal to 5, the four boundaries after scaling the search region, i.e., the four boundaries of the first selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iHorMin. regionId iHor Max regionId It is calculated as follows:
[0491] If wIndex is 2, iHorMax regionId =(iHorMax+iHorMin) / wIndex, iHorMin regionId =iHorMin For example, in some embodiments, as shown in R6 of Figure 14, when regionId is equal to 5, the four boundaries after scaling the search region, i.e., the four boundaries of the first selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor MaxregionId It can be set to iVerMin. regionId iVerMax regionId It is calculated as follows:
[0492] iVerMin regionId =iVerMin+(iVerMax-iVerMin) / hIndex i VerMax regionId =iVerMax For example, in some embodiments, as shown in R6 of Figure 14, when regionId is equal to 5, the four boundaries after scaling the search region, i.e., the four boundaries of the first selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iVerMin. regionId iVerMax regionId It is calculated as follows:
[0493] iVerMin regionId =iVerMax-(iVerMax-iVerMin) / hIndex i VerMax regionId =iVerMax For example, in some embodiments, as shown in R6 of Figure 14, when regionId is equal to 5, the four boundaries after scaling the search region, i.e., the four boundaries of the first selected region, are defined in iVerMin. regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be set to iVerMin. regionId iVerMax regionId It is calculated as follows:
[0494] If hIndex is 2, iVerMin regionId =(iVerMax+iVerMin) / hIndex, i VerMax regionId =iVerMax Understandably, in the embodiment of the present invention, when performing region selection for the fourth initial region in the search region on the upper right side of the current block, for example R6, it is possible to choose to take only the left half of the fourth initial region. wIndex is 2, and iHorMaxregionId = (iHorMax + iHorMin) / wIndex is determined, and at the same time, iHorMin regionId =iHorMin, iVerMin regionId =iVerMin, iVerMax regionId =iVerMax is set.
[0495] Understandably, in the embodiments of the present invention, when performing region selection for the fourth initial region in the search area on the upper right side of the current block, for example R6, it is possible to choose to take only the lower half of the fourth initial region. In this case, hIndex is 2 and iVerMin regionId = (iVerMax + iVerMin) / hIndex is determined, and at the same time, iHorMin regionId =iHorMin, iHorMax regionId =iHorMax, iVerMax regionId =iVerMax is set.
[0496] Understandably, in the embodiments of this application, the process of selecting a region based on a scaling parameter can be achieved by right shifting the relevant division. For example, if wIndex is set to 2, the same result can be achieved with the >>1 operation.
[0497] As a result, in the embodiments of this application, for any sub-search region within the fully reconstructed search region and / or undetermined reconstructed search region, after obtaining the four boundaries of the search region iHorMin, iHorMax, iVerMin, and iVerMax, if wIndex≠1 and / or hIndex≠1, trimming can be performed on the search region based on the scaling parameter. For example, in Figure 14, for region Ri (i=2, 3, 4, 5), four methods for limiting the search range by taking the region to the right or upper right of the Ri region are shown in Figures 19 to 22. For region R6, four methods for limiting the search range by taking the region to the left or lower left of the R6 region are shown in Figures 23 to 26. For region R1, the central position can be taken as the intermediate position of the original search region, and four methods for limiting the search range are shown in Figures 15 to 18.
[0498] In other words, in the embodiments of the present invention, a search point within a search area may be scanned to include all search points within a specified search area, or a different method may be employed to limit the search range to a local area in order to balance computational complexity and coding efficiency. For example, for an undetermined reconstruction search area (corresponding to the two areas R5 and R6 in Figure 14) or a fully reconstruction search area (corresponding to the four areas R1 to R4 in Figure 14), the width of the search range may be limited to 1 / wIndex of the original, and the height may be limited to 1 / hIndex of the original, where both wIndex and hIndex are arbitrary numbers greater than or equal to 1.
[0499] Understandably, in the embodiments of this application, the limited search range, i.e., the fully reconstructed search range after selection and / or the undetermined reconstructed search range after selection, can be a region closer to the unit to be encoded (current block). For example, when reducing the search range of the R5 region, the width and height of the R5 search region can be reduced to half of the original, and the final search range can be the upper right quarter of the R5 region, as shown in Figure 22.
[0500] As described above, in the embodiments of this application, different search regions can be selected using different methods. Specifically, the search region can be classified into three types based on the relative position between the search region and the reference block (for example, to the left of the currently encoded block, above the currently encoded block, or to the upper right of the currently encoded block), and it is possible to restrict the Intra TMP search region for each of the three types of search regions.
[0501] Understandably, in the embodiments of this application, after determining the fully reconstructed search area and / or undetermined reconstructed search area based on the first template, it is possible to further select a region based on the fully reconstructed search area and / or undetermined reconstructed search area and obtain the selected fully reconstructed search area and / or selected undetermined reconstructed search area. Of course, it is also possible to choose to directly set the scope of the fully reconstructed search area and / or undetermined reconstructed search area during the execution of the process of determining the fully reconstructed search area and / or undetermined reconstructed search area. That is, the size of the search area including the fully reconstructed search area and / or undetermined reconstructed search area can be directly limited to the size of the search area of the selected fully reconstructed search area and / or selected undetermined reconstructed search area in the above-described solution.
[0502] For example, in some embodiments, when calculating the search region, one weight term can be added or one clip operation can be added based on the current formula. For example, taking only the right half of the R5 region, If regionId is equal to 4, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0503] 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) For example, in some embodiments, when calculating the search region, one weight term can be added or one clip operation can be added based on the current formula. For example, taking only the upper half of the R5 region, If regionId is equal to 4, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0504] 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) For example, in some embodiments, when calculating the search region, one weight term can be added or one clip operation can be added based on the current formula. For example, when taking only the left half of the R6 region, If regionId is equal to 5, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0505] 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 For example, in some embodiments, when calculating the search region, one weight term can be added or one clip operation can be added based on the current formula. For example, when taking only the lower half of the R6 region, If regionId is equal to 5, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0506] 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 For example, in some embodiments, when calculating the search region, one weight term can be added or one clip operation can be added based on the current formula. For example, when taking only the upper right quarter of the R5 region, If regionId is equal to 4, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0507] 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) For example, in some embodiments, when calculating the search region, one weight term or one clip operation can be added based on the current formula. For example, when taking only the lower left quarter of the R6 region, If regionId is equal to 5, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0508] 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 Furthermore, in the embodiments of the present invention, when performing region selection based on a fully reconstructed search region and / or an undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, first, a region width threshold and a region height threshold are determined based on the size parameters of the current block, and then, region selection is performed on the fully reconstructed search region and / or the undetermined reconstructed search region based on the region width threshold and / or region height threshold to determine the selected fully reconstructed search region and / or the selected undetermined reconstructed search region.
[0509] It should be explained that in the embodiments of this application, the region width threshold and region height threshold can limit the width and height of the search region after region selection, respectively. Here, the region width threshold can be derived using the current block width nTbW, for example, by setting the region width threshold to a multiple of the current block width nTbW by wIndex. The region height threshold can be derived using the current block height nTbH, for example, by setting the region height threshold to a multiple of the current block height nTbH by hIndex.
[0510] In other words, in the embodiments of the present invention, the limit size of the search region can also be derived from the current encoded block size (the size parameter of the current block) in the process of performing region selection. For example, if the width of the search region dw > 2 × nTbW, the width of the search region is reduced, and it is ensured that the reduced width dw' of the search region does not exceed a wIndex multiple of the current block width nTbW. If the width of the search region dh > 2 × nTbH, the height of the search region is reduced, and it is ensured that the reduced height dh' of the search region does not exceed an hIndex multiple of the current block height nTbH.
[0511] Exemplary, in the embodiments of this application, if regionId is equal to 0, iVerMin regionId iVerMax regionId iHorMin regionId iHor Max regionId It is calculated as follows:
[0512] iHorMin regionId =(iHorMax+iHorMin) / 2-wIndex×nTbW / 2 iHor Max regionId =(iHorMax+iHorMin) / 2+wIndex×nTbW / 2 iVerMin regionId =(iVerMax+iVerMin) / 2-hIndex×nTbH / 2 i VerMax regionId =(iVerMax+iVerMin) / 2+hIndex×nTbH / 2 Exemplary, in the embodiments of this application, when regionId is equal to 1, 2, 3, or 4, iVerMin regionId iVerMax regionId iHorMin regionId iHor Max regionId It is calculated as follows:
[0513] iHorMin regionId =iHorMax-windex×nTbW iHor Max regionId =iHor Max i VerMax regionId =iVerMax-hindex×nTbH iVerMin regionId =iVerMin Exemplary, in the embodiments of this application, if regionId is equal to 5, iVerMin regionId iVerMax regionId iHorMin regionId iHor Max regionId It is calculated as follows:
[0514] iHor Max regionId =iHorMin+windex×nTbW iHorMin regionId =iHorMin iVerMin regionId =iVerMin+hindex×nTbH i VerMax regionId =iVerMax Furthermore, in the embodiments of the present invention, a search region in the fully reconstructed search region where any pixel point in the reference block corresponding to the search region overlaps with the current encoded tree block corresponding to the current block can be determined as the first overlap region. Simultaneously, a search region in the undetermined reconstructed search region that overlaps with the current encoded tree block corresponding to the current block can be determined as the second overlap region.
[0515] Accordingly, in the embodiments of the present invention, other regions in the complete reconstruction search region other than the first overlapping region can be determined as the first non-overlapping region, and other regions in the undetermined reconstruction search region other than the second overlapping region can be determined as the second non-overlapping region.
[0516] Furthermore, in the embodiments of the present application, when performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, region selection is performed on the first overlapping region to determine the fourth selected region, and then the selected fully reconstructed search region can be determined based on the fourth selected region and the first non-overlapping region, where the first non-overlapping region is a region in the fully reconstructed search region other than the first overlapping region.
[0517] Furthermore, in the embodiments of the present application, when performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, region selection is performed on the first non-overlapping region to determine the fifth selected region, and then the selected fully reconstructed search region can be determined based on the fifth selected region and the first overlapping region.
[0518] Furthermore, in the embodiments of the present application, region selection is performed based on the fully reconstructed search region and / or the undetermined reconstructed search region. When determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, region selection is performed on the second overlapping region to determine the sixth selected region. Then, the selected undetermined reconstructed search region can be determined based on the sixth selected region and the second non-overlapping region, where the second non-overlapping region is a region in the undetermined reconstructed search region other than the second overlapping region.
[0519] Furthermore, in the embodiments of the present application, when performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region after selection, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, region selection is performed on the second non-overlapping region to determine the seventh selected region, and then the selected undetermined reconstructed search region can be determined based on the seventh selected region and the second overlapping region.
[0520] For example, in the embodiments of the present application, it is possible to choose to restrict only the regions that currently overlap with the CTU (e.g., the first overlapping region and / or the second overlapping region) and not restrict the region reduction for other regions (e.g., the first non-overlapping region and / or the second non-overlapping region).
[0521] For example, in the embodiments of the present application, it is possible to choose to restrict only regions that currently do not have overlapping regions with the CTU (e.g., the first non-overlapping region and / or the second non-overlapping region), and not restrict other regions (e.g., the first overlapping region and / or the second overlapping region).
[0522] For example, in the embodiments of the present application, it is also possible to choose to impose restrictions on regions that currently do not have overlapping regions with the CTU (e.g., the first non-overlapping region and / or the second non-overlapping region) and the undetermined reconstruction search region, while not imposing region reduction restrictions on other regions (e.g., the first overlapping region).
[0523] For example, in some embodiments, if the encoded unit adjacent to the currently encoded unit (current block) is in Intra TMP mode, its block vector is BV neighbor This is denoted as follows, and using this BV, the upper-left corner of the reference block of the adjacent block is found. This point is used as the starting point for the search, and the search is expanded by nTbW in both the positive and negative directions of the X axis and by nTbH in both the positive and negative directions of the Y axis. Subsequently, the region that does not overlap with the fully reconstructed search region and the undetermined reconstructed search region is denoted as R7, and the search points within R7 are scanned. The specific implementation process is as follows.
[0524] Input: A luminance position (xCb, yCb) specifying the top-left corner sample of the current encoded block relative to the luminance sample at the top-left corner of the current image; a variable cbWidth specifying the width of the current encoded block at the luminance sample; a variable cbHeight specifying the height of the current encoded block at the luminance sample; a block vector bv; and a variable cIdx specifying the color component index of the current block.
[0525] Output: Predicted sample sequence predSamples.
[0526] When cIdx is equal to 0, i.e., it is the luminance component, and 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) When cIdx is equal to 0, i.e., it is the chromaticity component, and 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) The four boundaries of the R7 region are calculated as follows:
[0527] 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) After obtaining the R7 region range, it is determined whether R7 overlaps with an existing search region. If at least one of the four boundaries of the R7 region lies within one of the Ri (i=0,1,2,3,4,5) search regions (i.e., at least one of the following conditions is met), then it is determined that the R7 region overlaps with an existing search region. In this case, it is necessary to scan the portion of R7 that does not overlap with the existing search region; otherwise, all search points within the R7 search region are scanned.
[0528] iHorMin[regionId]<=iHorMax<=iHorMax[regionId] iHorMin[regionId]<=iHorMin<=iHorMax[regionId] iVerMin[regionId]<=iVerMax<=iVerMax[regionId] iVerMin[regionId]<=iVerMin<=iVerMax[regionId] Furthermore, in the embodiments of this application, when limiting the search range of a subregion, different values are set for the searchRangeWidth and / or searchRangeHeight of the subregion compared to other regions.
[0529] For example, in some embodiments, when restricting the region corresponding to the undetermined reconstruction search region, the following calculation can be performed:
[0530] If regionId is equal to 4, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows:
[0531] 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)) It should be noted that in the embodiments of the present application, scaleFactorW and scaleFactorH may be 1 / 2 or other values.
[0532] 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.
[0533] It should be noted that in the embodiments of the present application, the <<iBvShift operation in the above calculation process may be an operation of shifting after comparison first.
[0534] It should be noted that in the process of determining iHorMin in the embodiments of the present application, the term (xTbCmp - searchRangeWidth × scaleFactorW)) << iBvShift is added and the maximum value is taken between it and the existing terms. Such an operation can be understood as the outer boundary approaching in the direction of the current block.
[0535] It should be noted that in the embodiments of the present application, in the process of determining iVerMax, the term (yTbCmp + searchRangeHeight × scaleFactorH) << iBvShift is added and takes the minimum value among the existing terms. Such an operation can be understood as the outer boundary approaching in the direction of the current block.
[0536] Exemplarily, in some embodiments, when restricting the region corresponding to the undetermined reconstruction search region, it can be calculated as follows.
[0537] When regionId is equal to 5, iVerMin, iVerMax, iHorMin, and iHorMax can be calculated as follows.
[0538] 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 It should be noted that in the embodiments of the present application, scaleFactorW and scaleFactorH may be 1 / 2 or other values.
[0539] It should be noted that in the embodiments of the present application, the multiplication in the above calculation process can be replaced by a division or shift operation.
[0540] It should be noted that in the embodiments of the present application, in the above calculation process, the <<iBvShift operation may be an operation of shifting after comparison first.
[0541] It should be noted that in the embodiments of the present application, in the process of determining iHorMax, the term (xTbCmp + searchRangeWidth × scaleFactorW) << iBvShift is added and the minimum value is taken between this term and the existing terms. Such an operation can be understood as the outer boundary approaching in the direction of the current block.
[0542] It should be noted that in the embodiments of the present application, in the process of determining iVerMin, the term (yTbCmp - searchRangeHeight × scaleFactorH)) << iBvShift is added and the maximum value is taken between this term and the existing terms. Such an operation can be understood as the outer boundary approaching in the direction of the current block.
[0543] Furthermore, in the embodiments of the present application, when performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region, it is possible to select to further appropriately increase offset operations, such as +1 operations, based on iHorMin, iHorMax, iVerMin, and iVerMax.
[0544] Furthermore, in the embodiments of the present application, when performing region selection based on the fully reconstructed search region and / or the undetermined reconstructed search region, it is also possible to add an operation to further limit the selected fully reconstructed search region and / or the selected undetermined reconstructed search region. For example, control the possible minimum value range with the min function or control the possible maximum value range with the max function.
[0545] In step 204, perform searches in the selected fully reconstructed search region and / or the selected undetermined reconstructed search region respectively, and determine one or more block vectors of the current block.
[0546] In the embodiments of this application, region selection is performed based on a fully reconstructed search region and / or an undetermined reconstructed search region. After determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, one or more block vectors of the current block can be determined by further searching in the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, respectively.
[0547] Furthermore, in the embodiments of this application, when performing searches in the selected fully reconstructed search area and / or the selected undetermined reconstructed search area, respectively, and determining one or more block vectors, it is possible to scan the search points in the selected fully reconstructed search area and determine a first matching cost value between the matching template corresponding to the search point in the selected fully reconstructed search area and the first template based on predetermined matching criteria. Alternatively, it is possible to scan the search points in the selected undetermined reconstructed search area and determine a second matching cost value between the matching template corresponding to the search point in the selected undetermined reconstructed search area that satisfies predetermined availability conditions and the first template, according to predetermined matching criteria. Finally, based on the first and second matching cost values, one or more block vectors and one or more candidate templates corresponding to one or more block vectors can be determined.
[0548] It should be explained that in the embodiments of this application, it is not possible to determine whether the sampling points within the selected undetermined reconstruction search region are already reconstructed sampling points. Therefore, it is first necessary to determine whether the sampling points within the selected undetermined reconstruction search region are available for use.
[0549] Understandably, in the embodiments of this application, it is possible to first determine whether the current search point in the selected undetermined reconstruction search region satisfies predetermined availability conditions. If the current search point satisfies the predetermined availability conditions, a second matching cost value is determined between the matching template corresponding to the current search point and the first template based on predetermined matching criteria.
[0550] In response to this, in the embodiment of the present application, after determining whether the current search point in the selected undetermined reconstruction search region satisfies predetermined availability conditions, if the current search point does not satisfy the predetermined availability conditions, the process of determining the second matching cost value is not performed.
[0551] In some embodiments, the predetermined availability 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 reconstruction 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 a predetermined search window range; all sampling points in the reconstruction block corresponding to the matching template of the current search point do not exceed a predetermined 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 reconstruction 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 are reconstructed; all sampling points in the reconstruction block corresponding to the matching template of the current search point do not belong to the current coding block; and all sampling points in the reconstruction block corresponding to the matching template of the current search point are reconstructed.
[0552] It should be noted that in the embodiments of the present application, the predetermined matching criterion includes one of the cost functions for evaluating the mode, such as the absolute difference sum (SAD), absolute transformation difference sum (SATD), sum of squared errors (SSE), mean absolute difference (MAD), mean absolute error (MAE), mean squared error (MSE), and normalized correlation coefficient (NCC).
[0553] For example, in the embodiment of the present invention, when determining the block vector by search, bvYMins and bvYMaxs represent the minimum and maximum vertical offsets of the block vector, respectively.
[0554] qvXMins regionId bvXMaxs regionId bvYMins regionId bvYMaxs regionId iVerMin has already decided regionId iVerMax regionId iHorMin regionId iHor Max regionId It can be obtained by using the following calculation.
[0555] qvXMins regionId =iHorMin regionId -xTbCmp bvXMaxs regionId =iHor Max regionId -xTbCmp bvYMins regionId =iVerMin regionId -yTbCmp bvYUps regionId =iVerMax regionId -yTbCmp qvXMins regionId bvXMaxs regionId bvYMins regionId , and bvYMaxs regionId This determines the range of horizontal and vertical offsets of the search point relative to the current block, i.e., the range of the block vector BV.
[0556] Exemplary, in the embodiments of this application, when performing a search in the selected complete reconstruction search region, (pX, pY) is constructed using the search points (iPosHor, iPoxVer) and each block vector BV (consisting of horizontal and vertical components) within each search region, where pX = iPosHor - xTbCmp and pY = iPosVer - yTbCmp, in which case pX lies between bvXMins and bvXMaxs, and pY lies between bvYMins and bvYMaxs) to find a matching reconstruction block of one current block in the reconstruction region, and the adjacent reconstruction pixels of that one or more matching reconstruction blocks are matching templates. This allows the calculation of the first matching cost between the adjacent template of the current block and the adjacent template of one or more reconstruction blocks, which is denoted as pDiff.
[0557] Exemplary, in the embodiment of this application, when performing a search in the undetermined reconstruction search region after selection, (pX, pY) is constructed from the search points (iPosHor, iPoxVer) and each block vector BV (consisting of horizontal and vertical components) within each search region, where pX = iPosHor - xTbCmp and pY = iPosVer - yTbCmp, in which case pX lies between bvXMins and bvXMaxs, and pY lies between bvYMins and bvYMaxs). The availability is then determined. If available, one or more matching reconstruction blocks of the current block can be found in the reconstruction region, and the adjacent reconstruction pixels of the matching reconstruction block are matching templates. This allows for the calculation of a second matching cost between the adjacent templates of the current block and the adjacent templates of the reconstruction block, which is also denoted as pDiff. If unavailable, the template matching cost is not calculated.
[0558] Exemplary, in embodiments of the present application, availability determination includes, but is not limited to, the simultaneous fulfillment of one or more of the following conditions: that each sampling point in the template does not exceed the effective coordinate range limited by the boundaries of the image sampling points; that each sampling point in the reconstruction block corresponding to the template does not exceed the effective coordinate range limited by the boundaries of the image sampling points; that neither each sampling point in the template nor each sampling point in the corresponding reconstruction block exceeds the specified range of the search window; that each sampling point in the template is in the same tile as the currently encoded region; that each sampling point in the reconstruction block corresponding to the template is in the same tile as the currently encoded region; that each sampling point in the template has been reconstructed; that each sampling point in the reconstruction block corresponding to the template is not currently in the encoded region; and that each sampling point in the reconstruction block corresponding to the template has been reconstructed.
[0559] In some embodiments, the predetermined availability conditions may include at least one or more of the following conditions: namely, the first marked sampling point in the matching template of the current search point does not exceed the coordinate range of the sampling point boundary corresponding to the current image; the second marked sampling point in the reconstruction block corresponding to the matching template of the current search point does not exceed the coordinate range of the sampling point boundary corresponding to the current image; the first marked sampling point in the matching template of the current search point does not exceed a predetermined search window range; the second marked sampling point in the reconstruction block corresponding to the matching template of the current search point does not exceed a predetermined search window range; the first marked sampling point in the matching template of the current search point is in the same tile as the current coding block; the second marked sampling point in the reconstruction block corresponding to the matching template of the current search point is in the same tile as the current coding block; the first marked sampling point in the matching template of the current search point is reconstructed; the second marked sampling point in the reconstruction block corresponding to the matching template of the current search point does not belong to the current coding block; and the second marked sampling point in the reconstruction block corresponding to the matching template of the current search point is reconstructed.
[0560] It should be explained that in the embodiments of the present application, the first labeled sampling point is one or more sampling points in the matching template of the current search point, and the second labeled sampling point is one or more sampling points in the reconstruction block corresponding to the matching template of the current search point.
[0561] In other words, when determining the availability of a search point within the undetermined reconstruction search area after selection, instead of scanning and determining all sampling points in the matching template corresponding to the search point, it is chosen to determine whether the search point is available using the marked sampling points in the matching template. Correspondingly, instead of scanning and determining all sampling points in the reconstruction block corresponding to the matching template of the search point, it is chosen to determine whether the search point is available using the marked sampling points in the reconstruction block.
[0562] Understandably, in the embodiments of this application, the first marked sampling point may be any one or more sampling points within the matching template. For example, the first marked sampling point may be one or more sampling points located at corner positions within the matching template. If only the upper template is present, then the first marked sampling point may be the upper left and lower right corner sampling points, or only the lower right corner sampling point, within the upper template region.
[0563] Understandably, in the embodiments of the present application, the second marked sampling point is any one or more sampling points within the reconstruction block corresponding to the matching template of the current search point. For example, the second marked sampling point may be one or more sampling points located at corner positions within the reconstruction block. For example, the upper-left and lower-right corner sampling points of the reconstruction block region, or only the lower-right corner sampling point of the reconstruction block region.
[0564] Furthermore, in the embodiments of this application, when determining the availability of search points within the undetermined reconstruction search area after selection, the first marked sampling points are scanned in order of priority based on the predetermined availability conditions described above. If the current first marked sampling point does not meet the predetermined availability conditions, the scanning is stopped and it is determined that the current search point does not meet the predetermined availability conditions. If the current first marked sampling point meets the predetermined availability conditions, the scanning of the next first marked sampling point is continued, and if all first marked sampling points meet the predetermined availability conditions, it is determined that the current search point meets the predetermined availability conditions.
[0565] Furthermore, in the embodiments of this application, when determining the availability of a search point within the undetermined reconstruction search area after selection, the second marked sampling points are scanned in order of priority based on the predetermined availability conditions described above. If the current second marked sampling point does not meet the predetermined availability conditions, the scanning is stopped, and it is determined that the current search point does not meet the predetermined availability conditions. If the current second marked sampling point meets the predetermined availability conditions, the scanning of the next second marked sampling point is continued, and if all second marked sampling points meet the predetermined availability conditions, it is determined that the current search point meets the predetermined availability conditions.
[0566] In other words, in the embodiments of the present invention, the use of multiple labeled sampling points may be sequential. For example, first, it is determined whether the upper left corner sampling point is available or not, and if it is unavailable, "unavailable" is returned. If it is available, then it is determined whether the lower right corner sampling point is available or not, and if it is unavailable, "unavailable" is returned. Only if it is available is "available" returned. Here, the priority of the upper left corner sampling point is higher than that of the lower right corner sampling point.
[0567] It should be explained that in the embodiments of this 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 can be determined, where N is an integer greater than 0.
[0568] In response to this, in the embodiments of the present invention, when performing searches in the selected fully reconstructed search area and / or the selected undetermined reconstructed search area to determine one or more block vectors, it is possible to first determine a predetermined quantity N corresponding to a candidate template, then scan the search points in the selected fully reconstructed search area and determine a first matching cost value between the matching template corresponding to the search point in the selected fully reconstructed search area and the first template based on predetermined matching criteria, and at the same time scan the search points in the selected undetermined reconstructed search area and determine a second matching cost value between the matching template corresponding to the search point in the selected undetermined reconstructed search area that satisfies predetermined availability conditions and the first template according to predetermined matching criteria. Finally, based on the first and second matching cost values, N block vectors and N candidate templates corresponding to the N block vectors can be determined.
[0569] In other words, in the embodiments of the present invention, when a search is performed in the selected fully reconstructed search area and / or the selected undetermined reconstructed search area, and N block vectors corresponding to N matching templates are determined, that is, the process of performing a search within the search area (the selected fully reconstructed search area and / or the selected undetermined reconstructed search area) and determining the block vectors BV corresponding to N matching templates may include determining the value of the number N of candidate templates, determining the comparison criteria for the matching templates, and recording the N block vectors BV corresponding to the N matching templates (the selected N candidate templates).
[0570] Understandably, in the embodiments of the present application, when determining a predetermined quantity N corresponding to a candidate template, N may be determined by decoding the bitstream, N may be determined according to a first predetermined numerical value, or N may be determined according to a predetermined numerical range.
[0571] In other words, in the embodiments of the present invention, it is first necessary to determine the value of N. Here, N is a predetermined constant, for example, N may be 4, or N may be within a certain numerical range, for example, the value of N may be any integer within [2,8]. The range of the value of N is predetermined, and the encoding side can determine the optimal value of N using methods such as coarse selection by cost 1, coarse selection by cost 2, coarse selection by cost 3, or fine selection by cost 4, and transmit that optimal value of N to the decoding side in bitstream format. Here, each of the cost 1, 2, 3, and 4 terms may be one of the cost functions for evaluating modes such as SAD, SATD, MSE, MAD, and RDO. The present invention does not specifically limit the method for determining N.
[0572] Furthermore, in the embodiments of the present invention, when determining N block vectors and N candidate templates corresponding to the N block vectors based on a first matching cost value and a second matching cost value, that is, when determining one or more block vectors and one or more candidate templates corresponding to one or more block vectors, first, N minimum matching cost values can be determined from the first matching cost value and the second matching cost value, and then, based on N search points corresponding to the N minimum matching cost values, N block vectors and N candidate templates corresponding to the N block vectors can be determined.
[0573] From the matching cost values between the matching template corresponding to the search point in the selected fully reconstructed search region and the first template, N minimum matching cost values are determined. Then, N block vectors and N candidate templates corresponding to the N minimum matching cost values are determined.
[0574] In some embodiments, all available search points within the entire search range (e.g., regionId=0,1,2,3,4,5) are scanned, and by comparison, N search points with the minimum matching cost pDiff (including the first and second matching cost values) are obtained. The corresponding matching costs are denoted as pDiff_BEST[n], where n=0,...,N-1. The corresponding block vector BV is denoted as optimal block vector BV_BEST[n], where each term is a single coordinate pair (pX_BEST,pY_BEST), where n=0,...,N-1. The corresponding matching template is optimal matching template T_BEST[n], where n=0,...,N-1. Here, N may be 1 or an integer greater than 1 as needed.
[0575] It should be explained that in the embodiments of this application, when performing the search process, the search methods that can be employed include, but are not limited to, search methods based on different search step lengths, such as a rough search based on a first search step length and / or a fine search based on a second search step length. Here, the first search step length is greater than the second search step length.
[0576] In some embodiments, the first and second search step lengths can be any number greater than 0, that is, they can be integers or not, as long as it is guaranteed that the first search step length is greater than the second search step length. For example, the first search step length could be 3 and the second search step length could be 1 / 2.
[0577] Furthermore, in the embodiments of the present invention, a search is performed in the selected fully reconstructed search area and / or the selected undetermined reconstructed search area according to the first search step length, a first matching cost value corresponding to a search point in the selected fully reconstructed search area and a second matching cost value corresponding to a search point in the selected undetermined reconstructed search area that satisfies predetermined availability conditions are determined, and based on the first and second cost values, it is possible to select N block vectors and N candidate templates corresponding to the N block vectors.
[0578] Exemplary, in embodiments of the present application, the rough search may specifically include obtaining a final candidate template by determining the optimal rough matching template in the search domain with a first predetermined step length (i.e., a first search step length, e.g., 2), or by determining the optimal rough matching template in the search domain using a downsampled template (e.g., with a downsampling factor of 2).
[0579] For example, in the embodiments of this application, if the search method performs only a rough search, then in each region, pX is bvXMins regionId and bvXMaxs regionId It is between and and pY is bvYMins regionId and bvYMaxs regionId Within the search...
Claims
1. A decoding method applicable to a decoder, Currently, the first template corresponding to the block is determined, The process involves determining a fully reconstructed search area and / or an undetermined reconstructed search area based on the aforementioned first template, wherein the fully reconstructed search area includes reconstructed sampling points, and the undetermined reconstructed search area includes reconstructed sampling points and / or unreconstructed sampling points. The process involves selecting a region based on the aforementioned complete reconstruction search region and / or the aforementioned undetermined reconstruction search region, and determining the selected complete reconstruction search region and / or the selected undetermined reconstruction search region, wherein the selected complete reconstruction search region is smaller than or equal to the aforementioned complete reconstruction search region, and the selected undetermined reconstruction search region is smaller than or equal to the aforementioned undetermined reconstruction search region. A decoding method comprising: performing a search in the selected complete reconstruction search area and / or the selected undetermined reconstruction search area, respectively, to determine one or more block vectors of the current block.
2. Determining the fully reconstructed search area and / or the undetermined reconstructed search area based on the aforementioned first template is: Based on the first template, the fully reconstructed search area and / or the undetermined reconstructed search area are determined according to the size of the search window and the position information of the current image, with a zero-value block vector as the center. The decoding method according to claim 1.
3. The aforementioned complete reconstruction search region is a search region that includes a set of positions corresponding to the upper-left corner pixel point of the corresponding reference block at each search position, The aforementioned undetermined reconstruction search region is a search coverage region that includes the pixel set of the corresponding reference block at each search position. The decoding method according to claim 2.
4. Performing region selection based on the aforementioned fully reconstructed search region and / or the aforementioned undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, The complete reconstruction search area is determined to be the selected complete reconstruction search area, This includes performing region selection on the aforementioned undetermined reconstruction search region and determining the undetermined reconstruction search region after selection. The decoding method according to claim 1.
5. Performing region selection based on the aforementioned fully reconstructed search region and / or the aforementioned undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, To perform region selection on the aforementioned complete reconstruction search region and to determine the selected complete reconstruction search region, This includes determining the aforementioned undetermined reconstruction search region as the selected undetermined reconstruction search region, The decoding method according to claim 1.
6. Performing region selection based on the aforementioned fully reconstructed search region and / or the aforementioned undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, To perform region selection on the aforementioned complete reconstruction search region and to determine the selected complete reconstruction search region, This includes performing region selection on the aforementioned undetermined reconstruction search region and determining the undetermined reconstruction search region after selection. The decoding method according to claim 1.
7. Performing region selection based on the aforementioned fully reconstructed search region and / or the aforementioned undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, The scaling parameters are determined such that the scaling parameters include a height scaling parameter and a width scaling parameter, and both the height scaling parameter and the width scaling parameter are 1 or more. This includes performing region selection on the fully reconstructed search region and / or the undetermined reconstructed search region based on the scaling parameters, and determining the fully reconstructed search region and / or the undetermined reconstructed search region after selection, The decoding method according to claim 1.
8. Determining the scaling parameter means Decoding the bitstream to determine the scaling parameter, or This includes determining the scaling parameter based on a predetermined numerical value. The decoding method according to claim 7.
9. The scaling parameters are transmitted by one of the following: SPS layer syntax information, PPS layer syntax information, APS layer syntax information, SH layer syntax information, or CU layer syntax information. The decoding method according to claim 8.
10. The aforementioned decryption method is Of the aforementioned complete reconstruction search areas, the search area located above the current block is determined to be the first initial area. Of the aforementioned complete reconstruction search areas, the search area located to the left or upper left of the current block is determined to be the second initial area. Of the aforementioned undetermined reconstruction search areas, the search area located to the lower left of the current block is determined to be the third initial area. This further includes determining the search area located to the upper right of the current block among the aforementioned undetermined reconstruction search areas as the fourth initial area, The decoding method according to claim 7.
11. Performing region selection for the fully reconstructed search region and / or the undetermined reconstructed search region based on the scaling parameters, and determining the fully reconstructed search region and / or the undetermined reconstructed search region after selection, Based on the scaling parameters and the positional information of the first initial region, a first selected region is determined within the first initial region, wherein the first selected region is any region within the first initial region. This includes determining the selected complete reconstruction search region based on the first selected region, and / or, Based on the scaling parameters and the positional information of the second initial region, a second selected region is determined within the second initial region, wherein the second selected region is any region within the second initial region. This includes determining the selected complete reconstruction search region based on the second selected region, The decoding method according to claim 10.
12. Performing region selection for the fully reconstructed search region and / or the undetermined reconstructed search region based on the scaling parameters, and determining the fully reconstructed search region and / or the undetermined reconstructed search region after selection, Based on the scaling parameters and the positional information of the third initial region, a third selected region is determined within the third initial region, wherein the third selected region is any region within the third initial region. This includes determining the undetermined reconstruction search region after selection based on the third selected region, The decoding method according to claim 10.
13. Performing region selection for the fully reconstructed search region and / or the undetermined reconstructed search region based on the scaling parameters, and determining the fully reconstructed search region and / or the undetermined reconstructed search region after selection, Based on the scaling parameters and the positional information of the fourth initial region, a fourth selected region is determined within the fourth initial region, wherein the fourth selected region is any region within the fourth initial region. This includes determining the undetermined reconstruction search region after selection based on the fourth selected region, The decoding method according to claim 10.
14. Performing region selection based on the aforementioned fully reconstructed search region and / or the aforementioned undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, The region width threshold and region height threshold are determined based on the size parameters of the current block, This includes performing region selection on the fully reconstructed search region and / or the undetermined reconstructed search region based on the region width threshold and / or the region height threshold, and determining the fully reconstructed search region and / or the undetermined reconstructed search region after selection, The decoding method according to claim 1.
15. Performing region selection based on the aforementioned fully reconstructed search region and / or the aforementioned undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, The complete reconstruction search area is determined to be the selected complete reconstruction search area, This includes determining the aforementioned undetermined reconstruction search region as the selected undetermined reconstruction search region, The decoding method according to claim 1.
16. The aforementioned decryption method is The further step includes determining a first overlapping region where any pixel point in the reference block corresponding to the search region in the complete reconstruction search region overlaps with the current encoding tree block corresponding to the current block. The decoding method according to claim 1.
17. Performing region selection based on the aforementioned fully reconstructed search region and / or the aforementioned undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, To perform region selection on the first overlapping region and determine the fourth selected region, Determining the selected complete reconstruction search region based on the fourth selected region and the first non-overlapping region, wherein the first non-overlapping region is a region other than the first overlapping region in the complete reconstruction search region, The decoding method according to claim 16.
18. Performing region selection based on the aforementioned fully reconstructed search region and / or the aforementioned undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, To perform region selection on the first non-overlapping region and determine the fifth selected region, This includes determining the selected complete reconstruction search region based on the fifth selected region and the first overlapping region, The decoding method according to claim 17.
19. Performing a search in the selected complete reconstruction search area and / or the selected undetermined reconstruction search area, respectively, and determining one or more block vectors of the current block, The process involves scanning the search points within the selected complete reconstruction search area and determining a first matching cost value between the matching template corresponding to the search point within the selected complete reconstruction search area and the first template, according to predetermined matching criteria. The process involves scanning the search points within the selected undetermined reconstruction search area and determining a second matching cost value between the matching template corresponding to the search points in the selected undetermined reconstruction search area that satisfy predetermined availability conditions and the first template, according to predetermined matching criteria. The process includes determining one or more block vectors and one or more candidate templates corresponding to the one or more block vectors based on the first matching cost value and the second matching cost value, The decoding method according to claim 1.
20. The aforementioned decryption method is The process involves determining whether the current search point within the selected undetermined reconstruction search area satisfies the predetermined availability conditions, If the current search point satisfies the predetermined availability conditions, the second matching cost value between the matching template corresponding to the current search point and the first template is determined based on predetermined matching criteria. The decoding method according to claim 19.
21. The aforementioned decryption method is If the current search point does not satisfy the predetermined availability conditions, the process for determining the second matching cost value is further not performed. The decoding method according to claim 20.
22. The aforementioned specified conditions for availability are: All sampling points within 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 within the reconstruction 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 within the matching template of the current search point do not exceed the predetermined search window range. All sampling points within the reconstruction block corresponding to the matching template of the current search point do not exceed the predetermined search window range. All sampling points in the matching template of the current search point are located within the same Tile as the current coding block. All sampling points within the reconstruction block corresponding to the matching template of the current search point are located within the same Tile as the current encoding block. All sampling points in the matching template of the current search point have been reconstructed. All sampling points within the reconstruction block corresponding to the matching template of the current search point do not belong to the current encoding block. One or more of the following conditions are met: all sampling points within the reconstruction block corresponding to the matching template of the current search point have been reconstructed. The decoding method according to claim 20 or 21.
23. The aforementioned decryption method is The process involves determining a predetermined quantity N corresponding to the candidate template, wherein N is an integer greater than 0. The process further includes 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, The decoding method according to claim 22.
24. The aforementioned decryption method is Determining N minimum matching cost values from the first matching cost value and the second matching cost value, The process further includes determining the N block vectors and the N candidate templates corresponding to the N block vectors based on the N search points corresponding to the N minimum matching cost values. The decoding method according to claim 23.
25. The aforementioned decryption method is A search is performed in the selected fully reconstructed search area and / or the selected undetermined reconstructed search area according to the first search step length, a first matching cost value corresponding to a search point in the selected fully reconstructed search area and a second matching cost value corresponding to a search point in the selected undetermined reconstructed search area that satisfies the predetermined availability conditions are determined, and based on the first cost value and the second cost value, the N block vectors and the N candidate templates corresponding to the N block vectors are determined, or The process involves performing a search in the selected fully reconstructed search area and / or the selected undetermined reconstructed search area, respectively, according to the second search step length, determining the first matching cost value corresponding to the search point in the selected fully reconstructed search area and the second matching cost value corresponding to the search point in the selected undetermined reconstructed search area that satisfies the predetermined availability conditions, and determining the N block vectors and the N candidate templates corresponding to the N block vectors based on the first and second cost values, wherein the first search step length is greater than the second search step length. The decoding method according to claim 23.
26. The aforementioned decryption method is The process involves performing searches in the selected fully reconstructed search area and / or the selected undetermined reconstructed search area according to the first search step length, determining the first matching cost value corresponding to the search point in the selected fully reconstructed search area and the second matching cost value corresponding to the search point in the selected undetermined reconstructed search area that satisfies the predetermined availability conditions, and determining the M reference block vectors and the M matching reconstruction blocks corresponding to the M reference block vectors based on the first and second cost values, wherein M is an integer greater than 0. The first search region is determined based on the M matching reconstruction blocks, wherein the first search region is smaller than the total region consisting of the selected complete reconstruction search region and / or the selected undetermined reconstruction search region. The process involves performing a search in the first search region according to the second search step length, and determining a third matching cost value between the matching template corresponding to a search point that satisfies the predetermined availability conditions in the first search region and the first template, wherein the first search step length is greater than the second search step length. The process further includes determining the N block vectors and the 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 decoding method according to claim 23.
27. Determining the N block vectors and the 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 is: From the third matching cost value, determine N minimum matching cost values, The process includes determining the N block vectors and the N candidate templates corresponding to the N block vectors based on the N search points corresponding to the N minimum matching cost values, The decoding method according to claim 26.
28. Determining the N block vectors and the 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 is: Based on the third matching cost value, T block vectors and T candidate templates corresponding to the T block vectors are determined, wherein T is an integer greater than 0 and less than N. This includes determining N-T block vectors other than the M reference block vectors, and N-T candidate templates corresponding to the N-T block vectors, based on the first cost value and the second cost value. The decoding method according to claim 26.
29. The aforementioned decryption method is The P initial block vectors are determined based on the first cost value and the second cost value, wherein P is an integer greater than or equal to M. The further includes determining the M reference block vectors based on the P initial block vectors, The decoding method according to claim 26.
30. The aforementioned decryption method is Determining one or more reference blocks of the current block based on the one or more block vectors, The further comprising determining the predicted value of the current block based on the one or more reference blocks, The decoding method according to claim 1.
31. Determining one or more reference blocks of the current block based on the one or more block vectors is: Determining one or more initial reconfiguration blocks corresponding to the current block based on the one or more block vectors, This includes performing a modification process on one or more of the initial reconstruction blocks and determining one or more of the reference blocks, The decoding method according to claim 30.
32. The aforementioned decryption method is The optimal block vector for the current block is determined based on one or more block vectors of the current block, Based on the aforementioned optimal block vector, determine at least one reference block corresponding to the current block, The further comprising determining the predicted value of the current block based on the at least one reference block, The decoding method according to claim 1.
33. Determining the predicted value of the current block based on the at least one reference block is: Determining at least one prediction block based on the aforementioned at least one reference block, This includes performing weighted fusion on at least one of the prediction blocks and determining the predicted value of the current block, The decoding method according to claim 32.
34. The aforementioned decryption method is The first predicted value of the current block is determined based on one or more block vectors of the current block, Determining a second predicted value for the current block based on a predetermined prediction mode, wherein the predetermined prediction mode includes a Planar mode and / or a directional mode. The further includes determining the predicted value of the current block based on the first predicted value and the second predicted value, The decoding method according to claim 1.
35. The predetermined matching criteria include one of the following: absolute difference sum (SAD), absolute transformation difference sum (SATD), sum of squared errors (SSE), mean absolute difference (MAD), mean absolute error (MAE), mean squared error (MSE), and normalized correlation coefficient (NCC). The decoding method according to claim 19.
36. Determining the first template corresponding to the aforementioned current block is: This includes determining the template type corresponding to the current block and determining a first template corresponding to the current block based on the template type. The decoding method according to claim 1.
37. Determining the template type corresponding to the aforementioned current block is: Based on the reference pixels of the current block, determine the template type of the current block, or Based on the instruction information in the bitstream, determine the template type of the current block, or This includes determining the template type of the current block based on the size of the current block, The reference pixel of the current block includes at least one of the following: the left adjacent reference pixel of the current block, the upper adjacent reference pixel of the current block, the upper left adjacent reference pixel of the current block, the lower left adjacent reference pixel of the current block, and the upper right adjacent reference pixel of the current block. The decoding method according to claim 36.
38. Determining the template type of the current block based on the reference pixels of the current block is: 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, the template type of the current block is determined as the first value. If the left adjacent reference pixel of the current block is available, the template type of the current block is determined as the second value, If the upper adjacent reference pixel of the current block is available, the template type of the current block is determined as a third value, If both the left adjacent reference pixel and the upper left adjacent reference pixel of the current block are available, the template type of the current block is determined as the fourth value. If both the left adjacent reference pixel and the lower left adjacent reference pixel of the current block are available, the template type of the current block is determined as the fifth value, If both the upper adjacent reference pixel of the current block and the upper right adjacent reference pixel of the current block are available, the template type of the current block is determined as the sixth value, including: The decoding method according to claim 36.
39. Determining the first template corresponding to the current block based on the template type is: Based on the template type and the template size corresponding to the template type, the template reference pixels of the current block are determined, This includes determining the first template of the current block based on the template reference pixels, The decoding method according to claim 1.
40. The aforementioned decryption method is Decode the bitstream and determine the predicted difference corresponding to the current block, The further includes determining the reconstruction value of the current block based on the predicted difference and the predicted value of the current block, The decoding method according to any one of claims 30 to 34.
41. An encoding method applied to an encoder, Currently, the first template corresponding to the block is determined, The process involves determining a fully reconstructed search area and / or an undetermined reconstructed search area based on the aforementioned first template, wherein the fully reconstructed search area includes reconstructed sampling points, and the undetermined reconstructed search area includes reconstructed sampling points and / or unreconstructed sampling points. The process involves selecting a region based on the aforementioned complete reconstruction search region and / or the aforementioned undetermined reconstruction search region, and determining the selected complete reconstruction search region and / or the selected undetermined reconstruction search region, wherein the selected complete reconstruction search region is smaller than or equal to the aforementioned complete reconstruction search region, and the selected undetermined reconstruction search region is smaller than or equal to the aforementioned undetermined reconstruction search region. An encoding method comprising: performing a search in the selected complete reconstruction search area and / or the selected undetermined reconstruction search area, respectively, to determine one or more block vectors of the current block.
42. Determining the fully reconstructed search area and / or the undetermined reconstructed search area based on the aforementioned first template is: Based on the first template, the fully reconstructed search area and / or the undetermined reconstructed search area are determined according to the size of the search window and the position information of the current image, with a zero-value block vector as the center. The encoding method according to claim 41.
43. The aforementioned complete reconstruction search region is a search region that includes a set of positions corresponding to the upper-left corner pixel point of the corresponding reference block at each search position, The aforementioned undetermined reconstruction search region is a search coverage region that includes the pixel set of the corresponding reference block at each search position. The encoding method according to claim 42.
44. Performing region selection based on the aforementioned fully reconstructed search region and / or the aforementioned undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, The complete reconstruction search area is determined to be the selected complete reconstruction search area, This includes performing region selection on the aforementioned undetermined reconstruction search region and determining the undetermined reconstruction search region after selection. The encoding method according to claim 41.
45. Performing region selection based on the aforementioned fully reconstructed search region and / or the aforementioned undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, To perform region selection on the aforementioned complete reconstruction search region and to determine the selected complete reconstruction search region, This includes determining the aforementioned undetermined reconstruction search region as the selected undetermined reconstruction search region, The encoding method according to claim 41.
46. Performing region selection based on the aforementioned fully reconstructed search region and / or the aforementioned undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, To perform region selection on the aforementioned complete reconstruction search region and to determine the selected complete reconstruction search region, This includes performing region selection on the aforementioned undetermined reconstruction search region and determining the undetermined reconstruction search region after selection. The encoding method according to claim 41.
47. Performing region selection based on the aforementioned fully reconstructed search region and / or the aforementioned undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, The scaling parameters are determined such that the scaling parameters include a height scaling parameter and a width scaling parameter, and both the height scaling parameter and the width scaling parameter are 1 or more. This includes performing region selection on the fully reconstructed search region and / or the undetermined reconstructed search region based on the scaling parameters, and determining the fully reconstructed search region and / or the undetermined reconstructed search region after selection, The encoding method according to claim 41.
48. Determining the scaling parameter means The process includes determining the scaling parameter based on a predetermined numerical value and writing the scaling parameter to a bitstream. The encoding method according to claim 47.
49. The scaling parameters are transmitted by one of the following: SPS layer syntax information, PPS layer syntax information, APS layer syntax information, SH layer syntax information, or CU layer syntax information. The encoding method according to claim 48.
50. The aforementioned encoding method is Of the aforementioned complete reconstruction search areas, the search area located above the current block is determined to be the first initial area. Of the aforementioned complete reconstruction search areas, the search area located to the left or upper left of the current block is determined to be the second initial area. Of the aforementioned undetermined reconstruction search areas, the search area located to the lower left of the current block is determined to be the third initial area. This further includes determining the search area located to the upper right of the current block among the aforementioned undetermined reconstruction search areas as the fourth initial area, The encoding method according to claim 47.
51. Performing region selection for the fully reconstructed search region and / or the undetermined reconstructed search region based on the scaling parameters, and determining the fully reconstructed search region and / or the undetermined reconstructed search region after selection, Based on the scaling parameters and the positional information of the first initial region, a first selected region is determined within the first initial region, wherein the first selected region is any region within the first initial region. This includes determining the selected complete reconstruction search region based on the first selected region, and / or, Based on the scaling parameters and the positional information of the second initial region, a second selected region is determined within the second initial region, wherein the second selected region is any region within the second initial region. This includes determining the selected complete reconstruction search region based on the second selected region, The encoding method according to claim 50.
52. Performing region selection for the fully reconstructed search region and / or the undetermined reconstructed search region based on the scaling parameters, and determining the fully reconstructed search region and / or the undetermined reconstructed search region after selection, Based on the scaling parameters and the positional information of the third initial region, a third selected region is determined within the third initial region, wherein the third selected region is any region within the third initial region. This includes determining the undetermined reconstruction search region after selection based on the third selected region, The encoding method according to claim 50.
53. Performing region selection for the fully reconstructed search region and / or the undetermined reconstructed search region based on the scaling parameters, and determining the fully reconstructed search region and / or the undetermined reconstructed search region after selection, Based on the scaling parameters and the positional information of the fourth initial region, a fourth selected region is determined within the fourth initial region, wherein the fourth selected region is any region within the fourth initial region. This includes determining the undetermined reconstruction search region after selection based on the fourth selected region, The encoding method according to claim 50.
54. Performing region selection based on the aforementioned fully reconstructed search region and / or the aforementioned undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, The region width threshold and region height threshold are determined based on the size parameters of the current block, This includes performing region selection on the fully reconstructed search region and / or the undetermined reconstructed search region based on the region width threshold and / or the region height threshold, and determining the fully reconstructed search region and / or the undetermined reconstructed search region after selection, The encoding method according to claim 41.
55. Performing region selection based on the aforementioned fully reconstructed search region and / or the aforementioned undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, The complete reconstruction search area is determined to be the selected complete reconstruction search area, This includes determining the aforementioned undetermined reconstruction search region as the selected undetermined reconstruction search region, The encoding method according to claim 41.
56. The aforementioned encoding method is The further step includes determining a first overlapping region where any pixel point in the reference block corresponding to the search region in the complete reconstruction search region overlaps with the current encoding tree block corresponding to the current block. The encoding method according to claim 41.
57. Performing region selection based on the aforementioned fully reconstructed search region and / or the aforementioned undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, To perform region selection on the first overlapping region and determine the fourth selected region, Determining the selected complete reconstruction search region based on the fourth selected region and the first non-overlapping region, wherein the first non-overlapping region is a region other than the first overlapping region in the complete reconstruction search region, The encoding method according to claim 56.
58. Performing region selection based on the aforementioned fully reconstructed search region and / or the aforementioned undetermined reconstructed search region, and determining the selected fully reconstructed search region and / or the selected undetermined reconstructed search region, To perform region selection on the aforementioned second non-overlapping region and determine the seventh selected region, This includes determining the undetermined reconstruction search area after selection based on the seventh selected area and the second overlapping area, The encoding method according to claim 57.
59. Performing a search in the selected complete reconstruction search area and / or the selected undetermined reconstruction search area, respectively, and determining one or more block vectors of the current block, The process involves scanning the search points within the selected complete reconstruction search area and determining a first matching cost value between the matching template corresponding to the search point within the selected complete reconstruction search area and the first template, according to predetermined matching criteria. The process involves scanning the search points within the selected undetermined reconstruction search area and determining a second matching cost value between the matching template corresponding to the search points in the selected undetermined reconstruction search area that satisfy predetermined availability conditions and the first template, according to predetermined matching criteria. The process includes determining one or more block vectors and one or more candidate templates corresponding to the one or more block vectors based on the first matching cost value and the second matching cost value, The encoding method according to claim 41.
60. The aforementioned encoding method is The process involves determining whether the current search point within the selected undetermined reconstruction search area satisfies the predetermined availability conditions, If the current search point satisfies the predetermined availability conditions, the second matching cost value between the matching template corresponding to the current search point and the first template is determined based on predetermined matching criteria. The encoding method according to claim 59.
61. The aforementioned encoding method is If the current search point does not satisfy the predetermined availability conditions, the process for determining the second matching cost value is further not performed. The encoding method according to claim 60.
62. The aforementioned specified conditions for availability are: All sampling points within 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 within the reconstruction 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 within the matching template of the current search point do not exceed the predetermined search window range. All sampling points within the reconstruction block corresponding to the matching template of the current search point do not exceed the predetermined search window range. All sampling points in the matching template of the current search point are located within the same Tile as the current coding block. All sampling points within the reconstruction block corresponding to the matching template of the current search point are located within the same Tile as the current encoding block. All sampling points in the matching template of the current search point have been reconstructed. All sampling points within the reconstruction block corresponding to the matching template of the current search point do not belong to the current encoding block. One or more of the following conditions are met: all sampling points within the reconstruction block corresponding to the matching template of the current search point have been reconstructed. The encoding method according to claim 60 or 61.
63. The aforementioned encoding method is The process involves determining a predetermined quantity N corresponding to the candidate template, wherein N is an integer greater than 0. The process further includes 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, The encoding method according to claim 62.
64. The aforementioned encoding method is Determining N minimum matching cost values from the first matching cost value and the second matching cost value, The process further includes determining the N block vectors and the N candidate templates corresponding to the N block vectors based on the N search points corresponding to the N minimum matching cost values. The encoding method according to claim 63.
65. The aforementioned encoding method is A search is performed in the selected fully reconstructed search area and / or the selected undetermined reconstructed search area according to the first search step length, a first matching cost value corresponding to a search point in the selected fully reconstructed search area and a second matching cost value corresponding to a search point in the selected undetermined reconstructed search area that satisfies the predetermined availability conditions are determined, and based on the first cost value and the second cost value, the N block vectors and the N candidate templates corresponding to the N block vectors are determined, or The process involves performing a search in the selected fully reconstructed search area and / or the selected undetermined reconstructed search area, respectively, according to the second search step length, determining the first matching cost value corresponding to the search point in the selected fully reconstructed search area and the second matching cost value corresponding to the search point in the selected undetermined reconstructed search area that satisfies the predetermined availability conditions, and determining the N block vectors and the N candidate templates corresponding to the N block vectors based on the first and second cost values, wherein the first search step length is greater than the second search step length. The encoding method according to claim 63.
66. The aforementioned encoding method is The process involves performing searches in the selected fully reconstructed search area and / or the selected undetermined reconstructed search area according to the first search step length, determining the first matching cost value corresponding to the search point in the selected fully reconstructed search area and the second matching cost value corresponding to the search point in the selected undetermined reconstructed search area that satisfies the predetermined availability conditions, and determining the M reference block vectors and the M matching reconstruction blocks corresponding to the M reference block vectors based on the first and second cost values, wherein M is an integer greater than 0. The first search region is determined based on the M matching reconstruction blocks, wherein the first search region is smaller than the total region consisting of the selected complete reconstruction search region and / or the selected undetermined reconstruction search region. The process involves performing a search in the first search region according to the second search step length, and determining a third matching cost value between the matching template corresponding to a search point that satisfies the predetermined availability conditions in the first search region and the first template, wherein the first search step length is greater than the second search step length. The process further includes determining the N block vectors and the 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 encoding method according to claim 63.
67. Determining the N block vectors and the 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 is: From the third matching cost value, determine N minimum matching cost values, The process includes determining the N block vectors and the N candidate templates corresponding to the N block vectors based on the N search points corresponding to the N minimum matching cost values, The encoding method according to claim 66.
68. Determining the N block vectors and the 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 is: Based on the third matching cost value, T block vectors and T candidate templates corresponding to the T block vectors are determined, wherein T is an integer greater than 0 and less than N. This includes determining N-T block vectors other than the M reference block vectors, and N-T candidate templates corresponding to the N-T block vectors, based on the first cost value and the second cost value. The encoding method according to claim 66.
69. The aforementioned encoding method is The P initial block vectors are determined based on the first cost value and the second cost value, wherein P is an integer greater than or equal to M. The further includes determining the M reference block vectors based on the P initial block vectors, The encoding method according to claim 66.
70. The aforementioned encoding method is Determining one or more reference blocks of the current block based on the one or more block vectors, The further comprising determining the predicted value of the current block based on the one or more reference blocks, The encoding method according to claim 41.
71. Determining one or more reference blocks of the current block based on the one or more block vectors is: Determining one or more initial reconfiguration blocks corresponding to the current block based on the one or more block vectors, This includes performing a modification process on one or more of the initial reconstruction blocks and determining one or more of the reference blocks, The encoding method according to claim 70.
72. The aforementioned encoding method is The optimal block vector for the current block is determined based on one or more block vectors of the current block, Based on the aforementioned optimal block vector, determine at least one reference block corresponding to the current block, The further comprising determining the predicted value of the current block based on the at least one reference block, The encoding method according to claim 41.
73. Determining the predicted value of the current block based on the at least one reference block is: Determining at least one prediction block based on the aforementioned at least one reference block, This includes performing weighted fusion on at least one of the prediction blocks and determining the predicted value of the current block, The encoding method according to claim 72.
74. The aforementioned encoding method is The first predicted value of the current block is determined based on one or more block vectors of the current block, Determining a second predicted value for the current block based on a predetermined prediction mode, wherein the predetermined prediction mode includes a Planar mode and / or a directional mode. The further includes determining the predicted value of the current block based on the first predicted value and the second predicted value, The encoding method according to claim 41.
75. The predetermined matching criteria include one of the following: absolute difference sum (SAD), absolute transformation difference sum (SATD), sum of squared errors (SSE), mean absolute difference (MAD), mean absolute error (MAE), mean squared error (MSE), and normalized correlation coefficient (NCC). The encoding method according to claim 59.
76. Determining the first template corresponding to the aforementioned current block is: This includes determining the template type corresponding to the current block and determining a first template corresponding to the current block based on the template type. The encoding method according to claim 41.
77. Determining the template type corresponding to the aforementioned current block is: Based on the reference pixels of the current block, determine the template type of the current block, or Based on the instruction information in the bitstream, determine the template type of the current block, or This includes determining the template type of the current block based on the size of the current block, The reference pixel of the current block includes at least one of the following: the left adjacent reference pixel of the current block, the upper adjacent reference pixel of the current block, the upper left adjacent reference pixel of the current block, the lower left adjacent reference pixel of the current block, and the upper right adjacent reference pixel of the current block. The encoding method according to claim 76.
78. Determining the template type of the current block based on the reference pixels of the current block is: 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, the template type of the current block is determined as the first value. If the left adjacent reference pixel of the current block is available, the template type of the current block is determined as the second value, If the upper adjacent reference pixel of the current block is available, the template type of the current block is determined as a third value, If both the left adjacent reference pixel and the upper left adjacent reference pixel of the current block are available, the template type of the current block is determined as the fourth value. If both the left adjacent reference pixel and the lower left adjacent reference pixel of the current block are available, the template type of the current block is determined as the fifth value, If both the upper adjacent reference pixel of the current block and the upper right adjacent reference pixel of the current block are available, the template type of the current block is determined as the sixth value, including: The encoding method according to claim 76.
79. Determining the first template corresponding to the current block based on the template type is: Based on the template type and the template size corresponding to the template type, the template reference pixels of the current block are determined, This includes determining the first template of the current block based on the template reference pixels, The encoding method according to claim 41.
80. The aforementioned encoding method is The process involves determining the predicted difference corresponding to the current block and writing the predicted difference to the bitstream. The further includes determining the reconstruction value of the current block based on the predicted difference and the predicted value of the current block, The encoding method according to any one of claims 70 to 74.
81. It is a bitstream, The bitstream is generated by bit encoding based on the information to be encoded, and the information to be encoded is, A bitstream containing at least one of the following: the predicted difference of the current block, a predetermined quantity N, scaling parameters, template size, and template type indication information.
82. An encoder comprising a first decision unit, The first decision unit is configured to perform the following actions: determine a first template corresponding to the current block; determine a complete reconstruction search region and / or an undetermined reconstruction search region based on the first template, wherein the complete reconstruction search region includes reconstructed sampling points, and the undetermined reconstruction search region includes reconstructed sampling points and / or unreconstructed sampling points; perform region selection based on the complete reconstruction search region and / or the undetermined reconstruction search region to determine a selected complete reconstruction search region and / or a selected undetermined reconstruction search region, wherein the selected complete reconstruction search region is smaller than or equal to the complete reconstruction search region, and the selected undetermined reconstruction search region is smaller than or equal to the undetermined reconstruction search region; and perform a search in the selected complete reconstruction search region and / or the selected undetermined reconstruction search region, respectively, to determine one or more block vectors of the current block.
83. An encoder comprising a first memory and a first processor, The first memory is configured to store a computer program that can be executed by the first processor. An encoder wherein the first processor is configured to perform the method according to any one of claims 41 to 80 when executing the computer program.
84. A decoder comprising a second decision unit, A decoder configured to perform the following actions: determine a first template corresponding to the current block; determine a complete reconstruction search region and / or an undetermined reconstruction search region based on the first template, wherein the complete reconstruction search region includes reconstructed sampling points, and the undetermined reconstruction search region includes reconstructed sampling points and / or unreconstructed sampling points; perform region selection based on the complete reconstruction search region and / or the undetermined reconstruction search region to determine a selected complete reconstruction search region and / or a selected undetermined reconstruction search region, wherein the selected complete reconstruction search region is smaller than or equal to the complete reconstruction search region, and the selected undetermined reconstruction search region is smaller than or equal to the undetermined reconstruction search region; and perform a search in the selected complete reconstruction search region and / or the selected undetermined reconstruction search region, respectively, to determine one or more block vectors of the current block.
85. A decoder comprising a second memory and a second processor, The second memory is configured to store a computer program that can be executed by the second processor. The second processor is configured to perform the method according to any one of claims 1 to 40 when executing the computer program, wherein the second processor is configured to perform the method according to any one of claims 1 to 40.
86. A computer-readable storage medium storing a computer program that, when executed, implements the method according to any one of claims 1 to 40, or the method according to any one of claims 41 to 80.