Encoding method, decoding method, bitstream, encoder, decoder and storage medium
Patent Information
- Application Number
- AE202602364
- Authority / Receiving Office
- AE · AE
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-01-16
Smart Images

Figure ABST_ABST
Abstract
Description
Full specificationencoding method, decoding method, bitstream, encoder, decoder and storage medium TECHNICAL FIELD[1] The present disclosure relates to the field of video coding technology, and in particular relates to an encoding method, a decoding method, a bitstream, an encoder, a decoder, and a storage medium. BACKGROUND[2] In Intra Template Matching Prediction (Intra TMP) technologies, a template of a Coding Block (CB) is used to search for a matching template having a minimum cost relative to the template of the CB in a predefined search range of a current picture according to a preset cost function, and a best matching reconstructed block corresponding to the matching template is used as a prediction block of the current CB.[3] However, in the prediction process based on Intra TMP, a search strategy in actual implementation is suboptimal, which cannot guarantee the prediction accuracy, thereby reducing coding efficiency. SUMMARY[4] The present disclosure provides an encoding method, a decoding method, a bitstream, an encoder, a decoder, and a storage medium, which can improve the prediction accuracy and thereby improve coding efficiency.[5] The technical solutions of the present disclosure can be implemented as follows.[6] In a first aspect, a decoding method is provided in embodiments of the present disclosure. The method is applied to a decoder and includes the following. A first candidate list of a current block is determined, where the first candidate list includes one or more candidate vector parameters. A second position block is determined according to a candidate vector parameter in the first candidate list and / or a vector parameter of a first position block of the current block. When a decoding parameter of the second position block includes a vector parameter, according to the vector parameter of the second position block, whether the vector parameter of the second position block satisfies a second condition is determined. When the vector parameter of the second position block satisfies the second condition, the first candidate list is updated according to the vector parameter of the second position block. A second search region is determined according to a candidate vector parameter in the updated first candidate list, and a vector parameter of the current block is determined according to the second search region. A prediction value of the current block is determined according to the vector parameter of the current block.[7] In a second aspect, an encoding method is provided in embodiments of the present disclosure. The method is applied to an encoder and includes the following. A first candidate list of a current block is determined, where the first candidate list includes one or more candidate vector parameters. A second position block is determined according to a candidate vector parameter in the first candidate list and / or a vector parameter of a first position block of the current block. When an encoding parameter of the second position block includes a vector parameter, according to the vector parameter of the second position block, whether the vector parameter of the second position block satisfies a second condition is determined. When the vector parameter of the second position block satisfies the second condition, the first candidate list is updated according to the vector parameter of the second position block. A second search region is determined according to a candidate vector parameter in the updated first candidate list, and a vector parameter of the current block is determined according to the second search region. A prediction value of the current block is determined according to the vector parameter of the current block.[8] In a third aspect, a bitstream is provided in embodiments of the present disclosure. The bitstream is generated by bit encoding based on information to be encoded, where the information to be encoded include at least one of: a prediction residual of a current block, a value of a first syntax element, a value of a second syntax element, and a value of a third syntax element. The value of the first syntax element indicates an index of a prediction-value construction mode of the current block in a candidate list of prediction-value construction modes, the value of the second syntax element indicates whether an intra template matching prediction mode is used for the current block, and the value of the third syntax element indicates whether a first prediction mode is used for the current block.[9] In a fourth aspect, an encoder is provided in embodiments of the present disclosure. The encoder includes a first determining unit, a first updating unit, and a first predicting unit. The first determining unit is configured to determine a first candidate list of a current block, where the first candidate list includes one or more candidate vector parameters. The first updating unit is configured to: determine a second position block according to a candidate vector parameter in the first candidate list and / or a vector parameter of a first position block of the current block; when an encoding parameter of the second position block includes a vector parameter, determine, according to the vector parameter of the second position block, whether the vector parameter of the second position block satisfies a second condition; when the vector parameter of the second position block satisfies the second condition, update the first candidate list according to the vector parameter of the second position block; and determine a second search region according to a candidate vector parameter in the updated first candidate list, and determine a vector parameter of the current block according to the second search region. The first predicting unit is configured to determine a prediction value of the current block according to the vector parameter of the current block.
[10] In a fifth aspect, an encoder is provided in embodiments of the present disclosure. The encoder includes a first memory and a first processor. The first memory is configured to store a computer program executable on the first processor. The first processor is configured to perform the method of the second aspect when executing the computer program.
[11] In a sixth aspect, a decoder is provided in embodiments of the present disclosure. The decoder includes a second determining unit, a second updating unit, and a second predicting unit. The second determining unit is configured to determine a first candidate list of a current block, where the first candidate list includes one or more candidate vector parameters. The second updating unit is configured to: determine a second position block according to a candidate vector parameter in the first candidate list and / or a vector parameter of a first position block of the current block; when an encoding parameter of the second position block includes a vector parameter, determine, according to the vector parameter of the second position block, whether the vector parameter of the second position block satisfies a second condition; when the vector parameter of the second position block satisfies the second condition, update the first candidate list according to the vector parameter of the second position block; and determine a second search region according to a candidate vector parameter in the updated first candidate list, and determine a vector parameter of the current block according to the second search region. The second predicting unit is configured to determine a prediction value of the current block according to the vector parameter of the current block.
[12] In a seventh aspect, a decoder is provided in embodiments of the present disclosure. The decoder includes a second memory and a second processor. The second memory is configured to store a computer program executable on the second processor. The second processor is configured to perform the method of the first aspect when executing the computer program.
[13] In an eighth aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program which, when executed, implements the method of the first aspect or the method of the second aspect.
[14] Embodiments of the present disclosure provide an encoding method, a decoding method, a bitstream, an encoder, a decoder, and a storage medium. Whether for an encoding end or a decoding end, a first candidate list of a current block is firstly determined, where the first candidate list includes one or more candidate vector parameters. Then, a second position block is determined according to a candidate vector parameter in the first candidate list and / or a vector parameter of a first position block of the current block. When a decoding parameter of the second position block includes a vector parameter, according to the vector parameter of the second position block, whether the vector parameter of the second position block satisfies a second condition is determined. When the vector parameter of the second position block satisfies the second condition, the first candidate list is updated according to the vector parameter of the second position block. A second search region is determined according to a candidate vector parameter in the updated first candidate list, and a vector parameter of the current block is determined according to the second search region. Finally, a prediction value of the current block is determined according to the vector parameter of the current block. In other words, when updating the first candidate list, it is possible to obtain some vector information of second position blocks by expanding based on the candidate vector parameters in the initial first candidate list and / or the vector parameters of the first position blocks (spatially adjacent and non-adjacent blocks of the current block). This expanded vector information can then be used to supplement the first candidate list. In this way, reconstructed information from both spatially adjacent and non-adjacent blocks are effectively utilized, and according to the reconstructed information, candidate vector information can be derived while maintaining encoding complexity. This approach increases the coverage of the Intra TMP search list, extends the fine search method, and improves the accuracy of the vector parameter of the current block after fine search. Consequently, prediction accuracy is enhanced, further reducing bitrate and improving encoding / decoding efficiency, ultimately improving overall coding performance. BRIEF DESCRIPTION OF THE DRAWINGS
[15] FIG. 1 is a schematic diagram of prediction of Intra TMP;
[16] FIG. 2 is a schematic diagram of a prediction process based on an Intra TMP technology;
[17] FIG. 3 is a schematic diagram of template types of the Intra TMP technology;
[18] FIG. 4 is a schematic diagram of a search process based on the Intra TMP technology;
[19] FIG. 5 is a schematic diagram of definition of parameters for a current block and its template;
[20] FIG. 6 is a schematic diagram of a template search region;
[21] FIG. 7 is a schematic flowchart of executing a search process;
[22] FIG. 8 is a schematic flowchart of constructing a coarse search list;
[23] FIG. 9 is a schematic diagram of spatially adjacent positions and non-adjacent positions of the current block;
[24] FIG. 10 is a first schematic diagram of integer-sample search in a fine search region;
[25] FIG. 11 is a second schematic diagram of integer-sample search in a fine search region;
[26] FIG. 12 is a third schematic diagram of integer-sample search in a fine search region;
[27] FIG. 13 is a first schematic diagram of sub-sample search in a fine search region;
[28] FIG. 14 is a schematic flowchart of generating a prediction value;
[29] FIG. 15A is a schematic diagram of distribution of filter coefficients;
[30] FIG. 15B is a schematic diagram of distribution of predicted samples;
[31] FIG. 16 is a schematic structural diagram of an encoder provided in embodiments of the present disclosure;
[32] FIG. 17 is a schematic structural diagram of a decoder provided in embodiments of the present disclosure;
[33] FIG. 18 is a schematic diagram of a network architecture of a codec system provided in embodiments of the present disclosure;
[34] FIG. 19 is a first schematic flowchart of a decoding method provided in the embodiments of the present disclosure;
[35] FIG. 20 is a second schematic flowchart of a decoding method provided in the embodiments of the present disclosure;
[36] FIG. 21 is a fourth schematic diagram of integer-sample search in a fine search region;
[37] FIG. 22 is a fifth schematic diagram of integer-sample search in a fine search region;
[38] FIG. 23 is a sixth schematic diagram of integer-sample search in a fine search region;
[39] FIG. 24 is a seventh schematic diagram of integer-sample search in a fine search region;
[40] FIG. 25 is a second schematic diagram of sub-sample search in a fine search region;
[41] FIG. 26 is a third schematic diagram of sub-sample search in a fine search region;
[42] FIG. 27 is a first schematic flowchart of an encoding method provided in embodiments of the present disclosure;
[43] FIG. 28 is a second schematic flowchart of an encoding method provided in embodiments of the present disclosure;
[44] FIG. 29 is a first schematic flowchart of executing a search process provided in embodiments of the present disclosure;
[45] FIG. 30 is a second schematic flowchart of executing a search process provided in embodiments of the present disclosure;
[46] FIG. 31 is a third schematic flowchart of executing a search process provided in embodiments of the present disclosure;
[47] FIG. 32 is a fourth schematic flowchart of executing a search process provided in embodiments of the present disclosure;
[48] FIG. 33 is a fifth schematic flowchart of executing a search process provided in embodiments of the present disclosure;
[49] FIG. 34 is a sixth schematic flowchart of executing a search process provided in embodiments of the present disclosure;
[50] FIG. 35 is a schematic structural diagram of an encoder provided in embodiments of the present disclosure;
[51] FIG. 36 is a schematic diagram of a specific hardware structure of an encoder provided in embodiments of the present disclosure;
[52] FIG. 37 is a schematic diagram of a composition structure of a decoder provided in embodiments of the present disclosure;
[53] FIG. 38 is a schematic diagram of a specific hardware structure of a decoder provided in embodiments of the present disclosure;
[54] FIG. 39 is a schematic diagram of a composition structure of an encoding and decoding system provided in embodiments of the present disclosure. DETAILED DESCRIPTION
[55] In order to understand characteristics and technical contents of embodiments of the disclosure more thoroughly, implementations of the embodiments of the disclosure will be described in detail below with reference to the drawings. The drawings are only for the purpose of reference and explanation, and are not intended to limit the embodiments of the disclosure.
[56] Unless otherwise defined, all technical and scientific terms used here have the same meanings as those usually understood by technicians in the technical field to which the disclosure belongs. The terms used herein are only for the purpose of describing the embodiments of the disclosure, and are not intended to limit the disclosure.
[57] In the following descriptions, reference is made to “some embodiments” which describe a subset of all possible embodiments; however, it may be understood that “some embodiments” may be the same or different subsets of all possible embodiments, and may be combined with each other without conflict. It should also be pointed out that terms "first / second / third" involved in the embodiments of the disclosure are only intended to distinguish similar objects and do not represent a specific sequence of the objects. It may be understood that "first / second / third" may be interchanged in a specific order or sequence if allowable, such that the embodiments of the disclosure described here may be implemented in an order besides that illustrated or described here.
[58] Nouns and terms involved in the embodiments of the disclosure are described first before further describing the embodiments of the disclosure in detail. The nouns and terms involved in the embodiments of the disclosure are applicable to the following explanations:Coding Block (CB);Block Matching (BM);Coding Unit (CU);Prediction Unit (PU);Block Vector (BV);Motion Vector (MV);Sum of Absolute Difference (SAD);Sum of Absolute Transformed Difference (SATD);Mean Square Error (MSE);Sum of Squared Errors (SSE);Sum of Squared Differences (SSD);Mean Absolute Deviation (MAD);Mean Absolute Error (MAE);Mean Square Differences (MSD);Normalized Correlation Coefficient (NCC);H.266 / Versatile Video Coding (VVC);VVC Test Model (VTM), a reference software testing platform for VVC;Local Illumination Compensation (LIC);Intra Template Matching Prediction (Intra TMP);Enhanced Compression Model (ECM), a reference software testing platform beyond VVC.
[59] It may be understood that in a video picture, a CB is usually characterized by using a first color component, a second color component, and a third color component. The three color components are a luma component, a blue chroma component, and a red chroma component respectively. Specifically, the luma component is usually represented by a symbol Y, the blue chroma component is usually represented by a symbol Cb or U, and the red chroma component is usually represented by a symbol Cr or V; in this way, the video picture may be represented in a YCbCr format or a YUV format.
[60] It may also be understood that the Intra TMP is a special intra prediction mode. Each of an encoder and a decoder uses a template (T) of a CB to search for a matching template (T_BEST) having a minimum cost relative to the template (T) of the CB in a predefined search range of a current picture according to a preset cost function. An offset of the best matching template relative to the template of the current CB is a best block vector (BV_BEST). Then, a reconstructed block (Ref Block) corresponding to the matching template is used as a prediction block of the current CB (Cur Block). The template of the CB usually uses a neighboring reconstructed region of the current CB.
[61] Exemplarily, taking a neighboring reconstructed region of a current block as an example, FIG. 1 is a schematic diagram of prediction of Intra TMP. As illustrated in FIG. 1, a region filled with slashes represents a reconstructed region, a block filled with grids is the current block, and a neighboring region of the current block is a first template (T); a block filled with vertical lines is a reference block, and a neighboring region of the reference block is a second template (that is, a best matching template T_BEST); an offset of the second template relative to the first template is a best BV (BV_BEST), and in this case, the reference block may be block copied as a prediction block of the current block.
[62] In embodiments of the disclosure, the preset cost function may be SAD, SATD, MSE, SSD, MAD, MSD, NCC or the like, which is not specifically limited herein.
[63] For example, taking SAD as an example, the cost function in this case is as follows:(1)
[64] Here is a template in a search process, and M represents the number of samples in the template.
[65] A prediction process of the Intra TMP technology in the related art will be introduced in detail below.
[66] Input of the Intra TMP: a position (xTbCmp, yTbCmp) of the current block, a width nTbW of the current block, and a height nTbH of the current block.
[67] Output of the Intra TMP: a prediction value predSamples[x][y] of the current block, where x = 0..nTbW-1, y = 0..nTbH-1.
[68] Specifically, a prediction process of the Intra TMP technology may be divided into four steps as follows: determining a current template type, acquiring reconstructed samples of the current template, determining BVs within a predefined search range, and generating prediction values. In this way, a prediction value of the current block may be obtained through the above process. It should be noted that the Intra TMP technology may be used for predicting a luma component or a chroma component, which is not specifically limited herein.
[69] In a possible implementation, FIG. 2 illustrates a schematic diagram of a prediction process based on the Intra TMP technology. As illustrated in FIG. 2, the process may include the following operations S201 to S204.
[70] In operation S201, a type of a current template is determined.
[71] It should be noted that, in the Intra TMP technology, neighboring reconstructed samples of the current block are used as a template to search for a matching template in a predefined search region. Here the neighboring reconstructed samples may be upper reference samples, upper left reference samples, upper right reference samples, left reference samples, and lower left reference samples of the current block, etc. Therefore, template types may be classified and a corresponding template type may be determined, according to availability of the neighboring reconstructed samples.
[72] It should also be noted that the template type may be represented by refTemplateType. FIG. 3 illustrates a schematic diagram of template types of the Intra TMP technology. As illustrated in FIG. 3, a block filled with grids is a current block, a neighboring region of the current block is a template T. Six template types are illustrated.
[73] Exemplarily, the six template types are as follows:when all the upper left reference samples, the upper reference samples, and the left reference samples are available, refTemplateType has a value of 1, and the template shape is illustrated in (a) of FIG. 3; it should be noted that when refTemplateType has the value of 1, for an L-shape template, the upper left reference samples may not be included in some cases;when only the left reference samples are available, refTemplateType has a value of 2, and the template shape is illustrated in (b) of FIG. 3;when only the upper reference samples are available, refTemplateType has a value of 3, and the template shape is illustrated in (c) of FIG. 3;when only the left reference samples and the upper left reference samples are available, refTemplateType has a value of 4, and the template shape is illustrated in (d) of FIG. 3;when only the left reference samples and the lower left reference samples are available, refTemplateType has a value of 5, and the template shape is illustrated in (e) of FIG. 3; andwhen only the upper reference samples and the upper right reference samples are available, refTemplateType has a value of 6, and the template shape is illustrated in (f) in FIG. 3.
[74] In operation S202, samples of the current template are acquired.
[75] It should be noted that the template in the Intra TMP technology may consist of reconstructed samples at one or more of the upper side, upper right side, left side, lower left side, and upper left side of the current block. Furthermore, a template size may be preset. For example, when a left template is acquired, a template width templateW_size may be set to 4, and when an upper template is acquired, a template height templateH_size may be set to 4.
[76] It should also be noted that the value of refTemplateType may determine which part of reconstructed samples is acquired. Exemplarily, when refTemplateType has a value of 1, reconstructed samples at the left side, the upper left side, and the upper side of the current block are acquired. Exemplarily, when refTemplateType has a value of 2, only reconstructed samples on left four columns of the current block are acquired. Exemplarily, when refTemplateType has a value of 3, only reconstructed samples on upper four rows of the current block are acquired.
[77] In operation S203, a BV is determined.
[78] It should be noted that a search process of the Intra TMP technology mainly includes an initialization process, determining a search region for the template in a current frame, and searching in the search region to determine a best BV.
[79] It should also be noted that when the search region is searched for the best matching template, a search strategy of first coarse search and then fine search may be used, or only the fine search may be performed, or only the coarse search may be performed, which is not specifically limited here.
[80] In embodiments of the disclosure, the coarse search here may specifically be as follows. A best coarse matching template is determined in the search region with a first preset step size (such as 3), or the best coarse matching template is determined in the search region by using a downsampling template (such as a downsampling factor of 3).
[81] In embodiments of the disclosure, the fine search herein may specifically be as follows. A best fine matching template is determined in the search region with a second preset step size (such as 1; if sub-sample precision is required, sub-sample interpolation needs be performed on the reconstructed samples, which is not discussed in detail here), or the best fine matching template is determined near the best coarse matching template after completing the coarse search.
[82] In a possible implementation, FIG. 4 is a schematic diagram of a search process based on the Intra TMP technology. As illustrated in FIG. 4, the process may include the following operations S401 to S403.
[83] In operation S401, parameters are initialized.
[84] It should be noted that taking an L-shaped template as an example, uiPatchWidth is initialized to nTbW + templateW_size, and uiPatchHeight is initialized to nTbH + templateH_size. Here templateW_size and templateH_size may be fixed constants, or may be dynamically adjusted according to the size of the current block. Furthermore, templateW_size may be equal or unequal to templateH_size. For example, templateW_size = 4, templateH_size = 4; or when the width of the current block is greater than 8, templateW_size = 4 is set; when the width of the current block is less than or equal to 8, templateW_size = 2 is set; when the height of the current block is greater than 8, templateH_size = 4 is set; when the height of the current block is less than or equal to 8, templateH_size = 2 is set.
[85] Exemplarily, FIG. 5 illustrates a schematic diagram of definition of parameters for a current block and a template of the current block . As illustrated in FIG. 5, specific meanings of the parameters are as follows: nTbW and nTbH represent the width and the height of the current block, templateW_size and templateH_size represent the width and the height of the template, and uiPatchWidth and uiPatchHeight represent the total width and the total height of the region containing both the current block and the template.
[86] Further, a cost threshold between templates that is represented by diffThreshold is initialized. For example, when the cost function is SAD, the threshold may be: diffThreshold= ((1 << bitdepth) >> 2) × (uiPatchHeight × uiPatchWidth – nTbH × nTbW). When a bit depth bitDepth of the picture is 10, diffThreshold represents that a distortion threshold of each sample in the region of the template is 256.
[87] Further, a position ctbRsX, ctbRsY of a Coding Tree Block (CTB) where the current block CB is located, is initialized.
[88] Further, position offsets of the current block CB in the current CTB are initialized as: offsetLCBY = yTbCmp - ctbRsY, offsetLCBX = xTbCmp - ctbRsX.
[89] Further, iTemplateSizeH = templateH_size, iTemplateSizeW = templateW_size are initialized.
[90] Further, iBvShift is initialized, where iBvShift is a precision of the BV. For example, the precision of the BV may be an integer-sample precision, in which case iBvShift is 0. For another example, the precision of the BV may be a sub-sample precision. For instance, when iBvShift is 1, it represents a 1 / 2 sample precision, and when iBvShift is 2, it represents a 1 / 4 sample precision, which is not specifically limited here.
[91] Further, a preset search range for the template is initialized. The preset search range for the template may be set to a fixed size, or the search range may be dynamically adjusted according to the size of the CB. For example:searchRangeWidth = TMP_SEARCH_RANGE_MULT_FACTOR × nTbW,searchRangeHeight = TMP_SEARCH_RANGE_MULT_FACTOR × nTbH.
[92] Here, a value of TMP_SEARCH_RANGE_MULT_FACTOR may be a preset value, such as 5.
[93] In operation S402, a search region for the template in a current frame is determined.
[94] It should be noted that the frame herein may also be referred to as a picture, and therefore the current frame may also be referred to as the current picture. The search region in the Intra TMP technology is the reconstructed part in the current picture, and is limited by the size of the search range. Exemplarily, FIG. 6 is a schematic diagram of a template search region of a current block. As illustrated in FIG. 6, R1, R2, R3, R4, R5, and R6 represent six different search regions. picHeight represents the height of the current picture, picWidth represents the width of the current picture, searchRangeHeight represents the height of the search region, searchRangeWidth represents the width of the search region, CtbSizeH represents the height of the coding tree block, nTbH represents the height of the current block, and nTbW represents the width of the current block.
[95] The search region may be divided into two types:
[96] One type is a surrounding rectangular search region. This type, in turn, is divided into two sub-types: one sub-type is a region where it is certain that all samples in that region have been reconstructed (referred to as a fully reconstructed region), such as the four regions R1-R4 in FIG. 6; and the other sub-type is a region where it is uncertain whether all samples in that region have been reconstructed (referred to as an undetermined reconstructed region), such as the two regions R5 and R6 in FIG. 6.
[97] The other type is an extended search region, which is defined herein as a region pointed to by BVs corresponding to spatially adjacent and non-adjacent PUs. In the embodiment corresponding to FIG. 6, this region may be regarded as R7.
[98] For search points in the search region, all search points in the specified search region may be traversed, or different schemes may be adopted to limit the search to a local search range, so as to balance computational complexity and coding efficiency. For example, for the undetermined reconstructed region (corresponding to the two regions R5 and R6 in FIG. 6) or for the fully reconstructed region (for example corresponding to the four regions R1 to R4 in FIG. 6), the width of the search range may be limited to 1 / wIndex of the original width, and the height may be limited to 1 / hIndex of the original height, where wIndex and hIndex each is any positive integer greater than or equal to 1. The limited search range takes a region closer to the coding unit. For another example, when reducing the search range of region R5, the width of the R5 search region may be reduced to 1 / 2 of the original width, and the width may be reduced to 1 / 2 of the original width, and the final search range may be taken as the upper-right 1 / 4 region of region R5.
[99] In operation S403, searching is performed in the search region to determine a best BV.
[100] It should be noted that bvXMins and bvXMaxs represent a minimum offset and maximum offset of the BV in the horizontal direction respectively; bvYMins and bvYMaxs represent a minimum offset and maximum offset of the BV in the vertical direction, respectively.
[101] bvXMinsregionId, bvXMaxsregionId, bvYMinsregionId, and bvYMaxsregionId may be calculated by usingiVerMinregionId, iVerMaxregionId, iHorMinregionId, and iHorMaxregionId determined in the operation S402:bvXMinsregionId = iHorMinregionId – xTbCmp;bvXMaxsregionId = iHorMaxregionId – xTbCmp;bvYMinsregionId = iVerMinregionId – yTbCmp;bvYMaxsregionId = iVerMaxregionId – yTbCmp.
[102] bvXMinsregionId, bvXMaxsregionId, bvYMinsregionId, and bvYMaxsregionId determine a range of horizontal and vertical offsets of the search point relative to the current block, that is, a range of the BV.
[103] For the fully reconstructed region (for example corresponding to the four regions R1 to R4 in FIG. 6), for each search point (iPosHor, iPoxVer) in the search region, that is, each BV (which is consisted of a horizontal component and a vertical component: (pX, pY), where pX = iPosHor - xTbCmp, pY = iPosVer - yTbCmp, and pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs), a matching reconstructed block of the current block may be found in the reconstructed region, and neighboring reconstructed samples of the matching reconstructed block are used as the matching template. Therefore, a matching cost between a neighboring template of the current block and a neighboring template of the matching reconstructed block may be calculated, denoted as pDiff.
[104] For the undetermined reconstructed region (for example corresponding to the two regions R5 and R6 in FIG. 6), for each search point (iPosHor, iPoxVer) in the search region, that is, each BV (which is consisted of a horizontal component and a vertical component: (pX, pY), where pX = iPosHor - xTbCmp, pY = iPosVer - yTbCmp, then pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs), an availability check is performed.
[105] If available, a matching reconstructed block of the current block may be found in the reconstructed region, and neighboring reconstructed samples of the matching reconstructed block are used as the matching template. Therefore, a matching cost between a neighboring template of the current block and a neighboring template of the matching reconstructed block may be calculated, also denoted as pDiff.
[106] If not available, the calculation of template matching cost is not performed.
[107] The availability check includes, but is not limited to, one or more of the following conditions being satisfied:each sample within the template does not exceed a valid coordinate range limited by the sample boundary of the picture;each sample within the reconstructed block corresponding to the template does not exceed the valid coordinate range limited by the sample boundary of the picture;each sample within the template and each sample within the corresponding reconstructed block do not exceed a range specified by the search window;whether each sample within the template is in the same Tile as the current coding region;whether each sample within the reconstructed block corresponding to the template is in the same Tile as the current coding region;each sample in the template has been reconstructed;each sample in the reconstructed block corresponding to the template is not located in the current coding region;each sample in the reconstructed block corresponding to the template has been reconstructed.
[108] All available search points in all search ranges (regionId=0, 1, 2, 3, 4, 5) are traversed, and 30 search points with the minimum matching costs pDiff are obtained by comparison. The corresponding matching costs are denoted as pDiff_BEST[n], n=0, ..., 29. The corresponding BVs are denoted as the best block vectors BV_BEST[n], each being a coordinate pair (pX_BEST, pY_BEST), n=0, ..., 29. The corresponding matching templates are denoted as the best matching templates T_BEST[n], n=0, ..., 29.
[109] If the search strategy is coarse search only, the specific implementation is as follows.
[110] Within each region, in a search range where pX is between bvXMinsregionId and bvXMaxsregionId and pY is between bvYMinsregionId and bvYMaxsregionId, coarse search is performed with a step size greater than 1. For example, coarse search is performed with a step size of 2. The best matching cost obtained by template matching is denoted as pDiff_BEST, with the corresponding BV denoted as the best block vector BV_BEST(pX_BEST, pY_BEST).
[111] If the search strategy is fine search only, the specific implementation is as follows.
[112] Within each region, in a search range where pX is between bvXMinsregionId and bvXMaxsregionId and pY is between bvYMinsregionId and bvYMaxsregionId, fine search is performed for example with a step size of 1. The best matching cost obtained by template matching is denoted as pDiff_BEST, and the corresponding BV is denoted as the best block vector BV_BEST(pX_BEST, pY_BEST).
[113] If the search strategy is first coarse search and then fine search, the process may be as illustrated in FIG. 7. The specific implementation is as follows.
[114] S701, a coarse search list is constructed within the search region.
[115] S702, a fine search list is determined around BVs in the coarse search list, with a step size of 1.
[116] It should be noted that, for step S701, when constructing the coarse search list within the search region, as illustrated in FIG. 8, the implementation step may include the following.
[117] S801, an initial coarse search list is constructed in the search region with a step size of 3.
[118] Within each region, in a search range where pX is between bvXMinsregionId and bvXMaxsregionId, and pY is between bvYMinsregionId and bvYMaxsregionId, the coarse search is performed with a step size of 3. The first P minimum matching costs obtained by template matching during coarse search with the step size of 3, are denoted as pDiff1_BEST[p], p=0,…,P-1, and the corresponding BVs are denoted as the best block vectors BV1_BEST [p], p=0,…,P-1. P may be 1 or an integer greater than 1 as needed, and the search region where the best matching search point is located is bestRegionId[p], p=0,…,P-1.
[119] S802, an IntraTMP_Merge list is constructed to update the coarse search list.
[120] After P reference points are found out in the search region, multiple predefined search positions are used to construct a candidate BV list for reference by the current block, referred to as the IntraTMP_Merge list herein.
[121] By way of example, the set of predefined search positions may include spatially adjacent and non-adjacent positions of the current block. For example, the five spatially adjacent positions of the current block: left (xTbCmp-1, yTbCmp+nTbH-1), up (xTbCmp+nTbW-1, yTbCmp-1), upper right (xTbCmp+nTbW, yTbCmp-1), lower left (xTbCmp-1, yTbCmp+nTbH), and upper left (xTbCmp-1, yTbCmp-1), and 18 spatially non-adjacent positions (as illustrated in FIG. 9). In FIG. 9, positions 1-5 are referred to as spatially adjacent positions, and the remaining labeled positions are referred to as non-adjacent positions.
[122] An embodiment of the construction process is as follows. Whether the IntraTMP / IBC technology is used for PUs corresponding to these positions is checked. If the IntraTMP / IBC technology is used for a PU, a BV of this PU is stored in the IntraTMP_Merge list. After constructing the IntraTMP_Merge list, the coarse search list is updated. The specific updating process is: sequentially accessing each item in this list, computing a template matching cost corresponding to each BV, comparing this cost with a template matching cost of the initial coarse search list, and if it is less than the maximum template matching cost in the coarse search list, replacing the worse BV in the coarse search list with this BV. A specific replacement operation, for example, is to insert this BV into the coarse search list in order of cost and delete the item with the largest cost from the coarse search list. A search region bestRegionId for this BV is set to 6. It should be noted that this process is actually a list merging process, in which the search list for the results corresponding to R1 to R6 is first constructed, and then the result of R7 is inserted into the appropriate position in that list. In addition, other search orders and merging strategies may also be used, which are not specifically limited herein.
[123] In embodiments of the present disclosure, according to algorithm requirements, the coarse search stage will provide one or more (denoted herein as M, where 1 ≤ M≤ P) fine-search reference points and feed them to the next stage. For example, M=1 may be used.
[124] It should also be noted that, for step S702, searching may be performed around a fine-search reference point, which is the best BV obtained by the coarse search, BV1_BEST[p], p=0,…,M-1.
[125] In embodiments of the present disclosure, within a certain range of the fine-search list, costs of the searched integer-sample positions are compared one by one to determine a position with the minimum cost. Specifically, for each fine-search reference point, the position of the best matching reconstructed block obtained by the coarse search is first calculated as the reference position of the fine search region: BestPosX = xTbCmp + pX1_BEST, BestPosY = yTbCmp + pY1_BEST, and then the refined search range TmpRefineRangeHor and TmpRefineRangeVer are determined. The refined search range may be of a fixed size, or may be related to the search region.
[126] For example, for a reference point in the search region 0 to 5, both TmpRefineRangeHor and TmpRefineRangeVer may be set to 1. That is, in a case where regionId is 0 to 5, the fine search range is a 3×3 sample region within an offset range of [-1,1] in both the vertical and horizontal coordinates, with the fine-search starting position (also referred to as the "fine-search starting point") as coordinate [0,0]. A point-by-point full search is performed within this range, as illustrated in FIG. 10.
[127] For a reference point in the search region 6, both TmpRefineRangeHor and TmpRefineRangeVer may be set to 5. That is, in a case where regionId is 6, the fine search range is an 11×11 sample region within an offset range of [-5,5] in both the vertical and horizontal coordinates, with the fine-search starting position as coordinate [0,0]. A point-by-point full search is performed within this range, as illustrated in FIG. 11.
[128] In addition, for the case where regionId is 6, alternatively, if combined with an IntraTMP-LIC mode, then when the IntraTMP-LIC mode is selected for use for the current block, the fine search range is a 5×5 sample region within an offset range of [-2,2] in both the vertical and horizontal coordinates with the fine-search starting position as coordinate [0,0]; otherwise, when the IntraTMP-LIC mode is not selected for use for the current block, the fine search range is an 11×11 sample region within a offset range of [-5,5] in both the vertical and horizontal coordinates with the fine-search starting position as coordinate [0,0]. A point-by-point full search is performed within the fine search range, as illustrated in FIG. 12. In FIG. 12, (a) illustrates the case where the IntraTMP-LIC mode is selected for use for the current block, that is, a value of a syntax element (flag) corresponding to the IntraTMP-LIC mode of the current block is 1; and (b) illustrates the case where the IntraTMP-LIC mode is not selected for use for the current block, that is, the value of the syntax element (flag) corresponding to the IntraTMP-LIC mode of the current block is 0.
[129] It should also be noted that, the IntraTMP-LIC mode refers to that after a matching position is found for the current block through the template in the IntraTMP mode, an LIC model (for example, a linear model) is established between the template of the current block and the template at the matching position, specifically as follows:I0(x,y)= aI1(x,y) + b (2)
[130] I0(x,y) is a sample value in the current template / current prediction block, and I1(x,y) is a sample value in the reference template / reference block; a and b are linear model parameters. Here, a and b may be obtained from the current block template and the reference block template (for example, by using the least squares method). Then a sample value in the reference block is input to obtain a sample value in the current prediction block.
[131] In a possible implementation, the search window is directly utilized for traversal by taking the fine search region as an entire undetermined reconstructed region.
[132] First, a new search range is acquired according to the best matching block position obtained by the coarse search, as follows:iHorMaxrefine = min(picWidth - nTbW , BestPosX + TmpRefineRangeHor);iHorMinrefine = max( iTemplateSizeW, BestPosX - TmpRefineRangeHor);iVerMaxrefine = min(picHeight - nTbH , BestPosY + TmpRefineRangeVer);iVerMinrefine= max( iTemplateSizeH, BestPosY - TmpRefineRangeVer ).
[133] Then, adjusted BVs bvXMins, bvXMaxs, bvYMins, and bvYMaxs can be calculated from iVerMinrefine, iVerMaxrefine, iHorMinrefine, and iHorMaxrefine as follows:bvXMins = iHorMinrefine – xTbCmp;bvXMaxs = iHorMaxrefine – xTbCmp;bvYMins = iVerMinrefine – yTbCmp;bvYMaxs = iVerMaxrefine – yTbCmp.
[134] The fine search is performed within the block vector range where pX is between bvXMinsrefine and bvXMaxsrefine and pY is between bvYMinsrefine and bvYMaxsrefine. That is, all search positions within the fine search window are directly traversed, and availability check is sequentially performed. For example, searching is performed with a step size of 1, and the top T best matching costs obtained by template matching for available points are recorded as pDiff_BEST[t], t=0,...,T-1, and the corresponding BVs are recorded as the best block vectors BV_BEST[t], t=0,...,T-1. Here, T is 1 or an integer greater than 1. For example, T=1 is used.
[135] It should also be noted that, in embodiments of the present disclosure, sub-sample position search may be further performed on the above basis. For example, an initial direction of a sub-sample position is first determined, and then a sub-sample position index (which may be represented by tmpIsSubPel) and a final direction index (which may be represented by tmpSubIdx) are determined.
[136] Specifically, taking the starting point of the sub-sample search as coordinate [0,0], in 8 directions with vertical and horizontal coordinates both offset by -1 / 2 and 1 / 2, 8 candidate positions are compared one by one in terms of cost, to determine the top 4 directions with smaller costs as initial directions of the sub-sample search. Then, taking the starting point of the sub-sample search as coordinate [0,0], each of the vertical and horizontal coordinates is offset within a range of [-3 / 4, 3 / 4] in the top 4 directions determined above, and searching is performed among multiple 1 / 4-sample precision positions. 10 to 12 candidate positions are compared one by one in terms of cost to determine a position with the minimum cost, that is, the sub-sample position index tmpIsSubPel and the final direction index tmpSubIdx. As illustrated in FIG. 13, the circles filled in white are sub-sample positions, the circles filled with grids are half-sample positions, and the circles filled in black are integer-sample positions.
[137] Exemplarily, tmpIsSubPel may have four values, respectively corresponding to an integer-sample position (0), a 1 / 2-sample position (1), a 1 / 4-sample position (2 or 3), and a 3 / 4-sample position (2 or 3). The serial numbers corresponding to the 1 / 4 and 3 / 4 positions are related to the interpolation positions.
[138] Exemplarily, tmpSubIdx may have eight values, respectively corresponding to 8 directions: left (0), right (1), up (2), down (3), upper left (4), upper right (5), lower left (6), and lower right (7).
[139] In this way, the specific values of the sub-sample position (Dx, Dy) can be calculated according to tmpIsSubPel and tmpSubIdx, and then the best matching coordinate is updated.
[140] After the above operations are completed, by considering the results of both the coarse selection and fine selection (where the fine selection includes the search based on one or more reference-points), one or more best block vectors BV_BEST[n], n=0,…,N-1, required by different algorithms, can be obtained, where each BV is a coordinate pair (pX_BEST, pY_BEST). Here, pX_BEST and pY_BEST are respectively the horizontal offset and vertical offset of the best matching template relative to the template of the current coding block, and are also the horizontal offset and vertical offset of the best matching reconstructed block relative to the current coding block.
[141] In operation S204, a prediction value is generated.
[142] In the IntraTMP mode, in addition to the basic copying method for obtaining a prediction value, there are also other methods for obtaining the prediction value, such as by fusing positions corresponding to multiple BVs, by filtering a reference block corresponding to the BV and then copying, or by performing fractional-sample processing on the BV, interpolating a corresponding reference block, and then copying.
[143] In a possible implementation, after a BV candidate list is obtained by using template matching during the region search process at the decoding side, the top N items therein (for example, N=3) are selected for weighted fusion. This method may be referred to as an IntraTMP Fusion mode.
[144] Alternatively, in another possible implementation, after obtaining a best BV, multiple points are taken around the BV, and prediction values corresponding to the multiple points are weighted and fused to obtain a prediction value. This method may be referred to as an IntraTMP FLM mode.
[145] Alternatively, in yet another possible implementation, after obtaining a best BV, the templates are ranked with fractional-sample precision to select the optimal direction and precision, and an interpolation filter is used to calculate the prediction value. This method may be referred to as an IntraTMP SubPel mode.
[146] The implementation processes of some of the above methods are described in detail below.
[147] In the IntraTMP technology, different prediction modes correspond to different prediction methods. For example, in the IntraTMP Fusion technology, after obtaining BVs corresponding to N candidate templates, N candidate reconstructed blocks are obtained through the BVs, and then the N candidate reconstructed blocks are weighted and fused to obtain a prediction block of the current coding block. Specifically, the final prediction value is generated through the following steps: obtaining N candidate reconstructed blocks, determining weighted fusion weights, and then generating the prediction value through weighted fusion. Specifically, as illustrated in FIG. 14, the process may include the following.
[148] S1401, N candidate reconstructed blocks are obtained.
[149] After obtaining the BVs corresponding to the N candidate templates, a candidate reconstructed block RefBlockn is directly obtained in the current picture according to BVn, where BVn has the horizontal offset of pXn and the vertical offset of pYn, where .
[150] Simple translational copying is implemented. For x=0…nTbW-1, y = 0…nTbH-1, the specific operation is:RefBlockn [x][y] = recSamples[x + pXn][y + pYn] (3)where recSamples represents a reconstructed sample of the current frame.
[151] S1402, weights for weighted fusion are determined.
[152] After obtaining N candidate reconstructed blocks RefBlock, it is necessary to calculate the weights W for weighted fusion of the N candidate reconstructed blocks. The weights may be predefined fixed values, or may be values adaptively calculated using cost values, sample values, and the like.
[153] In embodiments of the present disclosure, in the IntraTMP Fusion technology, the weights for weighted fusion are derived by minimizing the MSE between the reconstructed values of the candidate template refTn and the sample values of the template refpredTn to be predicted.
[154] Specifically, the MSE minimization process takes, as input, an autocorrelation matrix of the first N matching reference samples refT, as well as a cross-correlation vector between the first N matching reference samples refT and the neighboring template samples curT of the current coding block, and outputs the weight of the reconstructed block corresponding to each matching reference item.
[155] S1403, the prediction value is generated through weighted fusion.
[156] The prediction block is calculated according to each candidate reconstructed block and its corresponding weighted fusion weight. Specifically, the value of each candidate reconstructed block is multiplied by its corresponding weight, and the products are accumulated to obtain the current prediction block (that is, a weighted prediction). The calculation formula is as follows.
[157] For x=0…nTbW-1, y = 0…nTbH-1, the prediction value is calculated according to the following formula:… (4)
[158] Finally, each prediction value is spatially stored, yielding the output prediction block of IntraTMP Fusion.
[159] In the IntraTMP FLM mode, a linear filtering model is constructed by using the best matching template obtained from the previous search and the template of the current coding block. This construction mainly includes the following two processes: determining a reconstruction region used for calculating filter coefficients, and calculating the filter coefficients. The specific calculation process of the prediction value is as follows.
[160] Assuming that the number of filter taps nTap is 5, the shape of the filter is as illustrated in FIG. 15A. to are the filter tap coefficients of the filter, where the grid-filled dot corresponding to the tap coefficient C0 represents a reconstructed sample at a position, in the best matching block, corresponding to the current sample to be predicted ; and the remaining white-filled dots are reconstructed samples, in the best matching reconstructed block, adjacent to the current spatial position. Thus, according to the filter in FIG. 15A, the finally obtained predicted sample is as illustrated by the black-filled dot in FIG. 15B.
[161] The specific calculation process of the prediction value is as follows:
[162] For each current sample to be predicted (i, j), a sample position in the filter template is defined as (k, l), and a corresponding reconstructed sample in the best matching block during filtering is defined as ref[i + k][j + l]; a filter coefficient at each position (k, l) in the filter template is defined as :(5)where n=0,…,nTap-1, and k and l each is between –1 to 1.
[163] For i=0,…,nTbW-1, j=0,…,nTbH-1:(6)
[164] The final predicted sample is:(7)
[165] In the above formula,(8)
[166] In the IntraTMP SubPel mode, for the best BV, 1 / 4, 1 / 2, and 3 / 4 directions as well as eight directions of up, down, left, right, upper left, upper right, lower left, and lower right are traversed, sorting is performed according to the template costs, and an interpolation filter is applied on a reference block corresponding to a BV with the minimum template cost to calculate the predicted value.
[167] Simply put, in the IntraTMP technology searches, the template of the coding block is used to search for a matching template having the minimum cost with respect to the template of the coding block within a predefined search range in the current picture according to a preset cost function, and the best matching reconstructed block (Ref Block) corresponding to the matching template is used as the prediction block of the current coding block (Cur Block). The template of the coding block usually uses the adjacent reconstructed region of the current coding block. However, the search strategies in the actual implementation process cannot fully utilize the information of reconstructed neighboring samples, so the accuracy of prediction cannot be guaranteed, thereby affecting coding efficiency.
[168] Based on this, embodiments of the present disclosure provide a coding method. A first candidate list of a current block is firstly determined, where the first candidate list includes one or more candidate vector parameters. Then, a second position block is determined according to a candidate vector parameter in the first candidate list and / or a vector parameter of a first position block of the current block. When a decoding parameter of the second position block includes a vector parameter, according to the vector parameter of the second position block, whether the vector parameter of the second position block satisfies a second condition is determined. When the vector parameter of the second position block satisfies the second condition, the first candidate list is updated according to the vector parameter of the second position block. A second search region is determined according to a candidate vector parameter in the updated first candidate list, and a vector parameter of the current block is determined according to the second search region. Finally, a prediction value of the current block is determined according to the vector parameter of the current block.
[169] As can be seen, in the embodiments of the present disclosure, when updating the first candidate list, it is possible to obtain some vector information of second position blocks by extending based on the candidate vector parameters in the initial first candidate list and / or the vector parameters of the first position blocks (spatially adjacent and non-adjacent blocks of the current block). This extended vector information can then be used to supplement the first candidate list. In this way, reconstructed information from both spatially adjacent and non-adjacent blocks are effectively utilized, and according to the reconstructed information, candidate vector information can be derived while maintaining encoding complexity. This approach increases the coverage of the Intra TMP search list, such that prediction accuracy is enhanced, further reducing bitrate and improving encoding / decoding efficiency and overall coding performance.
[170] The embodiments of the disclosure will be described in detail below with reference to the drawings.
[171] FIG. 16 is a schematic block diagram of an encoder provided in an embodiment of the disclosure. As illustrated in FIG. 16, the 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 decoded picture buffer (DPB) unit 110, etc. The filtering unit 108 may implement de-blocking filtering and Sample Adaptive Offset (SAO) filtering, and the encoding unit 109 may implement header information encoding and Context-based Adaptive Binary Arithmetic Coding (CABAC). For an input original video signal, a video CB may be obtained through division of a Coding Tree Unit (CTU), and then residual sample information obtained after intra or inter prediction is transformed by the transform and quantization unit 101 for the video CB, which includes transforming the residual information from a sample domain to a transform domain, and quantizing the obtained transform coefficients, to further reduce bitrate. The intra estimation unit 102 and the intra prediction unit 103 are configured to perform intra prediction on the video CB. Specifically, the intra estimation unit 102 and the intra prediction unit 103 are configured to determine an intra prediction mode to be used to encode the video CB. The motion compensation unit 104 and the motion estimation unit 105 are configured to perform inter prediction encoding of the received video CB relative to one or more blocks in one or more reference frames, to provide temporal prediction information. Motion estimation performed by the motion estimation unit 105 is a process of generating a Motion Vector (MV), where the MV may be used to estimate motion of the video CB. Then motion compensation is performed by the motion compensation unit 104 based on the MV determined by the motion estimation unit 105. After determining the intra prediction mode, the intra prediction unit 103 is further configured to provide the selected intra prediction data to the encoding unit 109, and the motion estimation unit 105 also sends the calculated MV data to the encoding unit 109. Furthermore, the inverse transform and inverse quantization unit 106 is configured to reconstruct the video CB and reconstruct a residual block in the sample domain, block effect artifacts are removed from the reconstructed residual block by the filter control analysis unit 107 and the filtering unit 108, and then the reconstructed residual block is added to a predictive block in a frame of the DPB unit 110, to generate a reconstructed video CB. The encoding unit 109 is configured to encode various encoding parameters and quantized transform coefficients. In a CABAC-based encoding algorithm, context may be based on neighboring CBs, and may be used to encode information indicating the determined intra prediction mode and output a bitstream of the video signal. The DPB unit 110 is configured to store the reconstructed video CB for reference of prediction. As encoding of the video picture proceeds, new reconstructed video CBs may be generated continuously, and these reconstructed video CBs may be stored in the DPB unit 110.
[172] FIG. 17 is a schematic block diagram of a decoder provided in an embodiment of the disclosure. As illustrated in FIG. 17, the 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 DPB unit 206, etc. The decoding unit 201 may implement header information decoding and CABAC decoding, and the filtering unit 205 may implement de-blocking filtering and SAO filtering. After the input video signal is encoded in FIG. 16, a bitstream of the video signal is output. The bitstream is input to the decoder 200, and passes through the decoding unit 201 first to obtain the decoded transform coefficients. The transform coefficients are processed by the inverse transform and inverse quantization unit 202, to generate a residual block in the sample domain. The intra prediction unit 203 may be configured to generate prediction data of a current video decoding block based on the determined intra prediction mode and data from a previously decoded block of the current frame or picture. The motion compensation unit 204 is configured to determine prediction information for the video decoding block by analyzing the MV and other associated syntax elements, and use the prediction information to generate a predictive block of the video decoding block being decoded. A decoded video block is formed by summing the residual block from the inverse transform and inverse quantization unit 202 and the corresponding predictive block generated by the intra prediction unit 203 or the motion compensation unit 204. The decoded video signal passes through the filtering unit 205 to remove block effect artifacts therefrom, which may improve video quality. Then, the decoded video block is stored in the DPB unit 206, the DPB unit 206 stores reference pictures used for subsequent intra prediction or motion compensation, and is also used for output of the video signal, that is, the restored original video signal is obtained.
[173] Further, an embodiment of the disclosure further provides a network architecture of an encoding and decoding system including an encoder and a decoder. FIG. 18 is a schematic diagram of a network architecture of an encoding and decoding system provided in an embodiment of the disclosure. As illustrated in FIG. 18, the network architecture includes one or more electronic devices 13 to 1N and a communication network 01. Here, the electronic devices 13 to 1N may perform video interaction through the communication network 01. The electronic devices may be various types of devices with video encoding and decoding functions during implementation. For example, the electronic devices may include a smart phone, a tablet computer, a personal computer, a Personal Digital Assistant (PDA), a navigator, a digital phone, a video phone, a television, a sensor device, a server, or the like, which is not specifically limited in the embodiments of the disclosure.
[174] It should be noted that the decoder or the encoder in the embodiments of the disclosure may be the above electronic devices. The encoder may also be referred to as a “video encoder” or a “picture encoder”, and the decoder may also be referred to as a “video decoder” or a “picture decoder”.
[175] It should be noted that methods of the embodiments of the disclosure are mainly applied to the intra prediction unit 103 illustrated in FIG. 16 and the intra prediction unit 203 illustrated in FIG. 17. That is, the embodiments of the disclosure may be applied to the encoder, or may be applied to the decoder, or may even be applied to both the encoder and the decoder, which is not specifically limited in the embodiments of the disclosure.
[176] In an embodiment of the disclosure, FIG. 19 is a first schematic flowchart of a decoding method proposed in the embodiment of the disclosure. As illustrated in FIG. 19, the method may include the following operations.
[177] S1901, a first candidate list of a current block is determined.
[178] It should be noted that the decoding method in the embodiments of the present disclosure is applied to a decoder. In addition, the decoding method may specifically refer to an intra prediction method, and more specifically, an intra prediction method that extends a block vector list based on Intra TMP. Here, by fully utilizing reconstructed information of spatially adjacent and non-adjacent positions, the coverage of the first candidate list is increased, thereby improving prediction accuracy.
[179] It should also be noted that, in the embodiments of the present disclosure, a video picture may be divided into multiple decoding blocks, and each decoding block may include a first color component, a second color component, and a third color component. The current block in the embodiments of the present disclosure refers to a decoding block currently to be subjected to intra prediction in the video picture. If the current block is predicted for the first color component and the first color component is a luma component, the current block may also be referred to as a luma block; or if the current block is predicted for the second color component and the second color component is a chroma component, the current block may also be referred to as a chroma block.
[180] It should also be noted that, in the embodiments of the present disclosure, the first candidate list may include one or more candidate vector parameters. Herein, the vector parameter may include: a block vector parameter and / or a motion vector parameter. That is, the first candidate list here may be a list containing multiple candidate BVs, or may be a list containing multiple candidate MVs.
[181] Illustratively, the block vector parameter may specifically be used to indicate a position of a reference block relative to the current block, i.e., an offset of the current block relative to the reference block is the block vector parameter.
[182] In some embodiments, for determining the first candidate list of the current block, the method may include the following. A first search region of the current block is determined, and the first candidate list of the current block is determined according to the first search region.
[183] It should be noted that, in the embodiments of the present disclosure, the first search region of the current block may be determined as follows. A first template of the current block is determined, and the first search region of the current block is determined according to the first template.
[184] In the embodiments of the present disclosure, a template type of the current block may be determined first, and then the first template of the current block may be determined according to the template type. The template type of the current block may be determined as follows. The template type of the current block is determined according to reference samples of the current block. Alternatively, the template type of the current block is determined according to indication information in a bitstream. Alternatively, the template type of the current block is determined according to a size parameter of the current block.
[185] In the embodiments of the present disclosure, the reference samples of the current block include at least one of the following: left neighboring reference samples of the current block, top neighboring reference samples of the current block, or top-left neighboring reference samples of the current block.
[186] It can be understood that in the embodiments of the disclosure, reference samples of the current block may refer to reference samples neighboring (or adjacent) to the current block. “Neighboring” here may be spatially neighboring / adjacent, but is not limited thereto. For example, “neighboring” may also be temporally neighboring or spatially and temporally neighboring, or even the reference samples of the current block may be reference samples obtained by performing some processing on spatially neighboring reference samples, temporally neighboring reference samples, spatially and temporally neighboring reference samples, or the like, which is not limited in the embodiments of the disclosure.
[187] It can also be understood that, in the embodiments of the present disclosure, the reference samples of the current block may include neighboring reconstructed samples of the current block, i.e., the neighboring reconstructed samples of the current block may be selected as a template to search for a matching template within the first search region. It should be noted that, in the embodiments of the present disclosure, the reference samples of the current block, i.e., the neighboring reconstructed samples of the current block, may include upper reference samples, upper-left reference samples, upper-right reference samples, left reference samples, and bottom-left reference samples of the current block.
[188] It can also be understood that, in the embodiments of the present disclosure, when the template type of the current block is determined by using the reference samples of the current block, the template types may be classified and determined according to availability of the neighboring reference samples.
[189] In some embodiments, when the template type of the current block is determined according to the reference samples of the current block, if the left neighboring reference samples, the upper neighboring reference samples, and the upper-left neighboring reference samples of the current block are all available, then the template type of the current block is determined as a first value. If the left neighboring reference samples of the current block are available, then the template type of the current block is determined as a second value. If the upper neighboring reference samples of the current block are available, then the template type of the current block is determined as a third value. If the left neighboring reference samples and the upper-left neighboring reference samples of the current block are both available, then the template type of the current block is determined as a fourth value. If the left neighboring reference samples and the bottom-left neighboring reference samples of the current block are both available, then the template type of the current block is determined as a fifth value. If the upper neighboring reference samples and the upper-right neighboring reference samples of the current block are both available, then the template type of the current block is determined as a sixth value.
[190] It should be noted that, in the embodiments of the present disclosure, in some cases, if both the left neighboring reference samples and the upper neighboring reference samples of the current block are available, then the template type of the current block is determined as the first value. That is, for an L-shaped template, in some cases, the upper-left neighboring reference sample may not be present.
[191] It should be noted that, in the embodiments of the present disclosure, the first value, the second value, the third value, the fourth value, the fifth value, and the sixth value may be any numerical values, which are not specifically limited in the present disclosure. For example, the values of the first value, the second value, the third value, the fourth value, the fifth value, and the sixth value may be 1, 2, 3, 4, 5, and 6, respectively.
[192] Exemplarily, in the embodiments of the present disclosure, the template type may be represented by refTemplateType. Correspondingly, as illustrated in FIG. 3 described above, a block filled with grids is the current block, and a neighboring region of the current block is a template T, where six template types are illustrated.
[193] Exemplarily, the six template types are as follows: when all the upper left reference samples, the upper reference samples, and the left reference samples are available, refTemplateType has a value of 1, and the template shape is illustrated in (a) of FIG. 3; when only the left reference sample is available, refTemplateType has a value of 2, and the template shape is illustrated in (b) of FIG. 3; when only the upper reference sample is available, refTemplateType has a value of 3, and the template shape is illustrated in (c) of FIG. 3; when only the left reference sample and the upper-left reference sample are available, refTemplateType has a value of 4, and the template shape is illustrated in (d) of FIG. 3; when only the left reference sample and the bottom-left reference sample are available, refTemplateType has a value of 5, and the template shape is illustrated in (e) of FIG. 3; when only the upper reference sample and the upper-right reference sample are available, refTemplateType has a value of 6, and the template shape is illustrated in (f) of FIG. 3.
[194] In some embodiments, the template type for the Intra TMP may also be selected in combination with the availability information of the above reference samples and according to an indication in the bitstream. For example, an index is agreed for each template type, and the actual template index information is transmitted in the bitstream, so that the template type can be determined at the decoding end. That is, in the embodiments of the present disclosure, the template type may be determined based on the availability information of the reference samples of the current block, or based on the information indicated in the bitstream, or based on both the availability information of the reference samples and the information indicated in the bitstream, which is not specifically limited in the disclosure.
[195] Further, in the embodiments of the present disclosure, after the first template corresponding to the current block is determined according to the template type, the method may further include the following. Template reference samples of the current block are determined according to the template type and a template size corresponding to the template type; and then the first template of the current block is determined according to the template reference samples.
[196] It should be noted that, in the embodiments of the present disclosure, the first template of the current block may include the template reference samples of the current block. Here, the template reference samples of the current block may be determined by the template type of the current block and the template size corresponding to the template type.
[197] It should also be noted that, in the embodiments of the present disclosure, the first template of the current block may be composed of reconstructed samples of one or more of an upper region, an upper right region, a left region, a lower left region, or an upper left region of the current block, i.e., may be composed of the reference samples of the current block.
[198] It should also be noted that, in the embodiments of the present disclosure, the template size corresponding to the template type may be preset, may be indicated by a syntax element in the bitstream, or may be adaptively selected according to the block size or other information. For example, when a left template is acquired, the template width templateW_size may be set to 4, and when a top template is acquired, the template height templateH_size may be set to 4.
[199] Correspondingly, in the embodiments of the present disclosure, in combination with the value of the template type refTemplateType of the current block and the template size corresponding to refTemplateType, it is possible to decide which part of reconstructed samples to acquire as the template reference samples of the current block, and then determine the corresponding first template. Exemplarily, when the value of refTemplateType is 1, the left, upper-left, and upper reconstructed samples of the current block may be acquired; when the value of refTemplateType is 2, only the left 4 columns of reconstructed samples of the current block are acquired; when the value of refTemplateType is 3, only the upper 4 rows of reconstructed samples of the current block are acquired.
[200] The value of the preset template size may be any integer greater than 0, not limited to 4, which is not specifically limited herein.
[201] That is, in the embodiments of the present disclosure, the template reference samples of the current block, which are determined from the reference samples of the current block in combination with the template type of the current block and the corresponding template size, may serve as the first template corresponding to the current block.
[202] It can be understood that, in the embodiments of the present disclosure, the search process for the vector parameter may include several parts as follows: an initialization process, a process of determining a search region (first search region) of the first template within the current frame, and a process of searching in the first search region to determine one or more best vector parameters. Therefore, when performing the search process, the initialization operation needs to be completed first.
[203] Exemplarily, as illustrated in FIG. 5 described above, nTbW and nTbH represent sizes of the current block, templateW_size and templateH_size represent template sizes, and uiPatchWidth and uiPatchHeight represent a size of a block including the current block and its template.
[204] Correspondingly, during initialization, uiPatchWidth may be initialized to nTbW + templateW_size, and uiPatchHeight may be initialized to nTbH + templateH_size. Here templateW_size and templateH_size may be fixed constants, or may be indicated by a syntax element in the bitstream, or may be dynamically adjusted according to the size of the CB or other information. templateW_size may be equal or unequal to templateH_size. For example, templateW_size = 4, templateH_size = 4; or when the width of the CB is greater than 8, templateW_size = 4 is set; when the width of the CB is less than or equal to 8, templateW_size = 2 is set; when the height of the CB is greater than 8, templateH_size = 4 is set; when the height of the CB is less than or equal to 8, templateH_size = 2 is set.
[205] Further, a cost threshold between templates that is represented by diffThreshold is initialized. For example, when the cost function is SAD, the threshold may be as follows: diffThreshold = ((1 << bitDepth) >> 2) × (uiPatchHeight × uiPatchWidth - nTbH × nTbW). When a bit depth bitDepth of the picture is 10, diffThreshold represents that a distortion threshold of each sample in the region of the template is 256.
[206] Further, a position ctbRsX, ctbRsY of a CTB where the current block is located, is initialized.
[207] Further, position offsets of the current block in the current CTB are initialized to offsetLCBY = yTbCmp - ctbRsY, offsetLCBX = xTbCmp - ctbRsX.
[208] Further, iTemplateSizeH = templateH_size and iTemplateSizeW = templateW_size are initialized.
[209] Further, iBvShift is initialized, where iBvShift is the precision of the vector parameter BV. For example, the precision of BV may be integer-sample precision, in which case iBvShift is 0; the precision of BV may also be sub-sample precision, e.g., iBvShift of 1 indicates 1 / 2-sample precision, and iBvShift of 2 indicates 1 / 4-sample precision, which is not specifically limited herein.
[210] Further, a preset search range for the template is initialized. The preset search range for the template may be set to a fixed size, or may be dynamically adjusted according to the size of the current block. 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 preset value, may be indicated by a syntax element in the bitstream, or may be adaptively adjusted according to information such as the size of the current block, e.g., set to 5.
[211] It can also be understood that, in the embodiments of the present disclosure, the first search region may include a first-type search region and / or a second-type search region. The first-type search region is a rectangular search region around the current block; the second-type search region is a region pointed to by a vector parameter corresponding to a preset search position of the current block and a region pointed to by automatic relocation.
[212] Here, the first-type search region includes a fully reconstructed region and / or a undetermined reconstructed region. The fully reconstructed region contains only reconstructed samples, and the undetermined reconstructed region contains both reconstructed samples and / or unreconstructed samples.
[213] That is, in the embodiments of the present disclosure, the first search region can be divided into two types.
[214] One type is a surrounding rectangular search region, which can also be divided into two sub-types: one sub-type is a region where it is certain that all samples in that region have been reconstructed (referred to as the fully reconstructed region), such as the four regions R1-R4 in FIG. 6; and the other sub-type is a region where it is uncertain whether all samples in that region have been reconstructed (referred to as the undetermined reconstructed region), such as the two regions R5 and R6 in FIG. 6.
[215] The other type is an extended search region, defined as a region pointed to by BVs corresponding to spatially adjacent and non-adjacent PUs, which in the embodiment corresponding to FIG. 6 may be considered as region R7; and a region pointed to by automatic relocation, which may be considered as region R8. Since search points in R7 and / or R8 are not necessarily adjacent to each other, the search within regions R7 and / or R8 is performed point by point according to a list.
[216] In some embodiments, the first candidate list of the current block may be determined according to the first search region as follows. The first search region is searched using a first search step size to determine one or more first candidate vector parameters, and the one or more first candidate vector parameters are added into the first candidate list of the current block.
[217] In a specific embodiment, The first search region may be searched using a first search step size to determine one or more first candidate vector parameters as follows. Search points in the first search region are traversed according to the first search step size, and according to a preset matching criterion, a first matching cost value between a matching template corresponding to a search point in the first search region and the first template is determined. Then one or more matching search points are determined according to the first matching cost value, and the one or more first candidate vector parameters are determined according to the one or more matching search points.
[218] It should be noted that, in the embodiments of the present disclosure, the first search step size may be set to 3. In this case, the obtained first candidate list may be referred to as an initial coarse search list.
[219] It should also be noted that, in the embodiments of the present disclosure, the preset matching criterion may include any one of SAD, SATD, SSE, MAD, MAE, MSE, and NCC.
[220] In a possible implementation, the search points in the first search region may be traversed specifically as follows.
[221] For the fully reconstructed region (e.g., corresponding to the four regions R1 to R4 in FIG. 6), for each search point (iPosHor, iPoxVer) within the search region, i.e., each BV (consisting of a horizontal component and a vertical component: (pX, pY), where pX = iPosHor - xTbCmp, pY = iPosVer - yTbCmp, and pX is between bvXMins and bvXMaxs, pY is between bvYMins and bvYMaxs), a matching reconstructed block of the current block can be found in the reconstructed region, and the neighboring reconstructed samples of the matching reconstructed block are the matching template. Thus, a matching cost between the neighboring template of the current block and the neighboring template of the reconstructed block can be calculated, denoted as pDiff.
[222] For the undetermined reconstructed region (e.g., corresponding to the two regions R5 to R6 in FIG. 6), for each search point (iPosHor, iPoxVer) within the search region, i.e., each BV (consisting of a horizontal component and a vertical component: (pX, pY), where pX = iPosHor - xTbCmp, pY = iPosVer - yTbCmp, and pX is between bvXMins and bvXMaxs, pY is between bvYMins and bvYMaxs), an availability check is performed.
[223] If available, a matching reconstructed block of the current block can be found in the reconstructed region, and the neighboring reconstructed samples of the matching reconstructed block are the matching template. Thus, a matching cost between the neighboring template of the current block and the neighboring template of the reconstructed block can be calculated, denoted as pDiff.
[224] If not available, the calculation of template matching cost is not performed.
[225] The availability check includes, but is not limited to, one or more of the following conditions being satisfied:each sample within the template does not exceed a valid coordinate range limited by the sample boundary of the picture;each sample within the reconstructed block corresponding to the template does not exceed the valid coordinate range limited by the sample boundary of the picture;each sample within the template and each sample within the corresponding reconstructed block do not exceed a range specified by the search window;whether each sample within the template is in the same Tile as the current coding region;whether each sample within the reconstructed block corresponding to the template is in the same Tile as the current coding region;each sample in the template has been reconstructed;each sample in the reconstructed block corresponding to the template is not located in the current coding region;each sample in the reconstructed block corresponding to the template has been reconstructed.
[226] All available search points in all search ranges (regionId=0, 1, 2, 3, 4, 5) are traversed, and 30 search points with the minimum matching costs pDiff are obtained by comparison. The corresponding matching costs are denoted as pDiff_BEST[n], n=0, ..., 29. The corresponding BVs are denoted as the best block vectors BV_BEST[n], each being a coordinate pair (pX_BEST, pY_BEST), n=0, ..., 29. The corresponding matching templates are denoted as the best matching templates T_BEST[n], n=0, ..., 29.
[227] Thus, in the embodiments of the present disclosure, assuming the first search step size is 3, a search is performed within the first search region with a step size of 3. For example, in a search range where pX is between bvXMinsregionId and bvXMaxsregionId and pY is between bvYMinsregionId and bvYMaxsregionId, coarse search is performed with a step size of 3. Then the top P best matching costs obtained from template matching are recorded as pDiff1_BEST[p], p=0,...,P-1, and the corresponding BVs are denoted as best block vectors BV1_BEST[p], p=0,...,P-1. Here, P may be 1 or an integer value greater than 1 as needed, and the search region where the best matching search point is located is bestRegionId[p], p=0,...,P-1. In this way, the first candidate list may be constructed from the P best block vectors BV1_BEST[p].
[228] S1902, a second position block is determined according to a candidate vector parameter in the first candidate list and / or a vector parameter of a first position block of the current block.
[229] S1903, when a decoding parameter of the second position block includes a vector parameter, whether the vector parameter of the second position block satisfies a second condition is determined according to the vector parameter of the second position block.
[230] It should be noted that, in the embodiments of the present disclosure, the first position block of the current block may include a block at a spatially adjacent position and / or a spatially non-adjacent position. In addition, the number of first position blocks may be one or more.
[231] Exemplarily, for one or more predefined first position blocks, predefined search positions may be, for example, five spatially adjacent positions of the current block: left (xTbCmp-1, yTbCmp+nTbH-1), upper-left (xTbCmp-1, yTbCmp-1), upper (xTbCmp+nTbW-1, yTbCmp-1), upper-right (xTbCmp+nTbW, yTbCmp-1), and bottom-left (xTbCmp-1, yTbCmp+nTbH), and 18 spatially non-adjacent positions (specifically as illustrated in FIG. 9).
[232] It should also be noted that, in the embodiments of the present disclosure, the second position block may be determined as follows. The second position block is determined according to a candidate vector parameter in the first candidate list; and / or the second position block is determined according to a vector parameter of the first position block of the current block.
[233] That is, in the embodiments of the present disclosure, the second position block may be determined according to the candidate vector parameter in the first candidate list, or according to the vector parameter of the first position block, or according to both the candidate vector parameter in the first candidate list and the vector parameter of the first position block, which is not specifically limited herein.
[234] In some embodiments, in terms of determining the second position block according to the vector parameter of the first position block of the current block, the method may further include the following. When a decoding parameter of the first position block of the current block includes a vector parameter, according to the vector parameter of the first position block, whether the vector parameter of the first position block satisfies a first condition is determined; and when the vector parameter of the first position block satisfies the first condition, the second position block is determined according to the vector parameter of the first position block.
[235] It should be noted that, in the embodiments of the present disclosure, when the vector parameter is a BV, if a BV-based prediction technique (i.e., IBC / IntraTMP) is used for the first position block of the current block, then it can be determined that the decoding parameter of the first position block of the current block includes the vector parameter.
[236] It should also be noted that, in the embodiments of the present disclosure, the first condition may include: a cost value corresponding to the vector parameter of the first position block is better than a cost value corresponding to at least one candidate vector parameter in the first candidate list. That is, if the cost value corresponding to the vector parameter of the first position block is better than the cost value corresponding to at least one candidate vector parameter in the first candidate list, then it is determined that the vector parameter of the first position block satisfies the first condition.
[237] In some embodiments, in terms of determining that the vector parameter of the first position block satisfies the first condition, the method further includes the following. A cost value corresponding to the vector parameter of the first position block is determined according to a matching cost value between a matching template corresponding to the vector parameter of the first position block and the first template. A cost value corresponding to at least one candidate vector parameter in the first candidate list is determined according to a matching cost value between a matching template corresponding to the at least one candidate vector parameter in the first candidate list and the first template. When the cost value corresponding to the vector parameter of the first position block is less than the cost value corresponding to the at least one candidate vector parameter in the first candidate list, it is determined that the vector parameter of the first position block satisfies the first condition.
[238] It should also be noted that, in the embodiments of the present disclosure, the method further includes the following. When the vector parameter of the first position block satisfies the first condition, the first candidate list is updated according to the vector parameter of the first position block.
[239] In a specific embodiment, the first candidate list may be updated according to the vector parameter of the first position block as follows. The vector parameter of the first position block is added into the first candidate list.
[240] That is, when the vector parameter of the first position block satisfies the first condition, the first candidate list may be updated using the vector parameter of the first position block. Exemplarily, the vector parameter of the first position block may be added into the first candidate list according to the cost value, and an item with the largest cost value in the first candidate list may be deleted, so as to obtain an updated first candidate list.
[241] It should also be noted that, in the embodiments of the present disclosure, the method further includes the following. A search region where the vector parameter of the first position block is located is determined as R6, i.e., setting the value of bestRegionId to 6.
[242] It should also be noted that, in the embodiments of the present disclosure, during the updating process, it is first checked whether the IntraTMP / IBC technology is used for a PU corresponding to the predefined search position, i.e., whether the decoding parameter of the PU corresponding to the predefined search position includes a vector parameter is checked. If the vector parameter is included, the BV of that PU is determined, and then the first candidate list is updated using this BV. The specific updating process is as follows. Each item in the first candidate list is sequentially accessed, and a template matching cost corresponding to each BV is calculated. This cost is compared with template matching costs of the first candidate list, and if it is less than the largest cost value in the first candidate list, the worse BV in the first candidate list will be replaced with this BV. For example, the specific operation may be: inserting this BV into the first candidate list in order of cost magnitude, and deleting the item with the largest cost value from the first candidate list. The search region bestRegionId for this BV is set to 6.
[243] It can be understood that, in the embodiments of the present disclosure, the number of second position blocks may be one or more.
[244] It should also be noted that, in the embodiments of the present disclosure, the second position block represents a reference block pointed to by the vector parameter of the first position block. Alternatively, the second position block represents a block pointed to by a vector parameter of a reference block pointed to by the vector parameter of the first position block.
[245] It should also be noted that, in the embodiments of the present disclosure, still taking the vector parameter being BV as an example, if a BV-based prediction technique (i.e., IBC / IntraTMP) is used for the second position block, then it can be determined that the decoding parameter of the second position block includes the vector parameter.
[246] Exemplarily, for the second position block, the vector parameter of the first position block is used as a current BV. First, several candidate positions of the current block are determined, for example five candidate positions: center (xTbCmp+nTbW / 2, yTbCmp+nTbH / 2), upper-left (xTbCmp, yTbCmp), upper-right (xTbCmp+nTbW-1, yTbCmp), bottom-left (xTbCmp, yTbCmp+nTbH-1), and bottom-right (xTbCmp+nTbW-1, yTbCmp+nTbH-1). Then it is checked whether the BV-based prediction technique (i.e., IBC / IntraTMP) is used for a PU corresponding to each of these five candidate position coordinates plus the current BV. If the BV-based prediction technique is used, the newly obtained BV is regarded as the current BV. The above operations are repeated to determine the vector parameter of the second position block (also referred to as an “extended BV”). In other words, in the embodiments of the present disclosure, the extended BV may be a BV stored for a block pointed to by the current BV, or a BV stored for a block pointed to by the BV of the block pointed to by the current BV, etc.
[247] In some embodiments, the second condition may include: a cost value corresponding to the vector parameter of the second position block is better than a cost value corresponding to at least one candidate vector parameter in the first candidate list. That is, if the cost value corresponding to the vector parameter of the second position block is better than the cost value corresponding to at least one candidate vector parameter in the first candidate list, then it is determined that the vector parameter of the second position block satisfies the second condition.
[248] It should also be noted that, in the embodiments of the present disclosure, the method further includes the following. A cost value corresponding to the vector parameter of the second position block is determined according to a matching cost value between a matching template corresponding to the vector parameter of the second position block and the first template. A cost value corresponding to at least one candidate vector parameter in the first candidate list is determined according to a matching cost value between a matching template corresponding to the at least one candidate vector parameter in the first candidate list and the first template. When the cost value corresponding to the vector parameter of the second position block is less than the cost value corresponding to the at least one candidate vector parameter in the first candidate list, it is determined that the vector parameter of the second position block satisfies the second condition.
[249] S1904, when the vector parameter of the second position block satisfies the second condition, updating the first candidate list according to the vector parameter of the second position block.
[250] It should be noted that, in the embodiments of the present disclosure, the vector parameter of the second position block may be one or more. All vector parameters of the first position blocks may be traversed, or determination of the vector parameters of the second position block may be stopped when the number of obtained vector parameters of the second position block is greater than a first threshold.
[251] It should also be noted that, in the embodiments of the present disclosure, the first threshold may be represented by V. Exemplarily, the value of V may be 15, but may also be other values, such as 1, 2, 5, 10, etc., which is not specifically limited herein.
[252] In some embodiments, the first candidate list may be updated according to the vector parameter of the second position block as follows. The vector parameter of the second position block is added into the first candidate list.
[253] That is, when the vector parameter of the second position block satisfies the second condition, the first candidate list may be updated using the vector parameter of the second position block. Exemplarily, the vector parameter of the second position block may be added into the first candidate list according to the magnitude of the cost value, and an item with the largest cost value in the first candidate list may be deleted, to obtain an updated first candidate list.
[254] In some embodiments, the method further includes the following. The search region where the vector parameter of the second position block is located is determined as R7, i.e., the value of bestRegionId is set to 7.
[255] It should be noted that, in the embodiments of the present disclosure, for the obtained vector parameter of the first position block, first, for each current BV, five positions of the current block are determined: center (xTbCmp+nTbW / 2, yTbCmp+nTbH / 2), upper-left (xTbCmp, yTbCmp), upper-right (xTbCmp+nTbW-1, yTbCmp), bottom-left (xTbCmp, yTbCmp+nTbH-1), and bottom-right (xTbCmp+nTbW-1, yTbCmp+nTbH-1). It is checked whether the BV-based prediction technique (i.e., IBC / IntraTMP) is used for a PU corresponding to each of these five position coordinates plus the current BV. If the BV-based prediction technique is used, a sum (vector sum, i.e., adding the horizontal and vertical components separately) of a BV stored for the corresponding PU and the current BV is denoted as BV’, and the above operations are repeated for this BV’ by regarding the BV’ as the current BV, so as to determine available options of extended BVs. If the BV-based prediction technique is not used, the next position is checked. The above operations are repeated, and when all five positions have been checked or the number of determined extended BVs is greater than V, the determination of the vector parameters of the second position block is stopped.
[256] It should also be noted that, after obtaining multiple extended BVs, the first candidate list is further updated. The specific updating operation is as follows. For the multiple extended BVs, corresponding template matching costs are calculated and compared with template matching costs of BVs in the first candidate list. If a template matching cost is less than the largest template matching cost in the first candidate list, the worse BV in the first candidate list is replaced with the corresponding BV. A specific example of the replacement operation is: inserting this BV into the first candidate list in order of cost magnitude, and deleting the item with the largest cost value from the first candidate list. A search region bestRegionId for the BV newly inserted into the first candidate list is set to 7.
[257] That is, in the embodiments of the present disclosure, when the BV of the first position block (spatially adjacent position and / or non-adjacent position of the current block) is better than at least one BV in the first candidate list (the first condition), then the block pointed to by the BV of the first position block is checked. If the block pointed to by the BV of the first position block also has a BV, it is determined (based on the second condition) whether to add that BV into the first candidate list. In this case, the embodiments of the present disclosure have another feature that the first position block may contribute two candidate BVs to the first candidate list (adding one BV when the first condition is satisfied, and adding another BV when the second condition is satisfied), to obtain an updated first candidate list (i.e., the final coarse search list).
[258] In another embodiment of the present disclosure, FIG. 20 is a second schematic flowchart of a decoding method provided in an embodiment of the present disclosure. As illustrated in FIG. 20, the method may include the following.
[259] S2001, a first candidate list of a current block is determined.
[260] It should be noted that, in the embodiments of the present disclosure, firstly, a first template of the current block is determined; then, a first search region of the current block is determined according to the first template; and then a search is performed in the first search region with 3 a step size of to construct an initial coarse search list (i.e., the first candidate list). The first candidate list may include one or more candidate vector parameters.
[261] S2002, when a decoding parameter of a first position block of the current block includes a vector parameter, whether the vector parameter of the first position block satisfies a first condition is determined according to the vector parameter of the first position block.
[262] S2003, when the vector parameter of the first position block satisfies the first condition, a first candidate set of the current block is determined according to the vector parameter of the first position block, and the first candidate list is updated according to the first candidate set.
[263] It should also be noted that, in the embodiments of the present disclosure, the first position block of the current block may include blocks at spatially adjacent positions and / or non-adjacent positions. In addition, the number of first position blocks may be one or more.
[264] Exemplarily, for one or more predefined first position blocks, predefined search positions may be, for example, five spatially adjacent positions of the current block: left (xTbCmp-1, yTbCmp+nTbH-1), upper-left (xTbCmp-1, yTbCmp-1), upper (xTbCmp+nTbW-1, yTbCmp-1), upper-right (xTbCmp+nTbW, yTbCmp-1), and bottom-left (xTbCmp-1, yTbCmp+nTbH), as well as 18 spatially non-adjacent positions (specifically as illustrated in FIG. 9).
[265] It should also be noted that, in the embodiments of the present disclosure, the first candidate set may be represented by IntraTMP_Merge. In some embodiments, the first candidate list may be updated according to the first candidate set as follows. A cost value corresponding to a second candidate vector parameter in the first candidate set is determined, and a maximum cost value corresponding to one or more candidate vector parameters in the first candidate list is determined. When the cost value corresponding to the second candidate vector parameter is smaller than the maximum cost value in the first candidate list, the candidate vector parameter corresponding to the maximum cost value in the first candidate list is replaced with the second candidate vector parameter, thus updating the first candidate list. The second candidate vector parameter is any one vector parameter in the first candidate set.
[266] In a specific embodiment, the candidate vector parameter corresponding to the maximum cost value in the first candidate list may be replaced with the second candidate vector parameter as follows. The second candidate vector parameter is added into the first candidate list, and the candidate vector parameter corresponding to the maximum cost value from the first candidate list is deleted.
[267] Exemplarily, in the embodiments of the present disclosure, the construction process of the IntraTMP_Merge set (or IntraTMP_Merge list) may specifically be as follows. Whether the IntraTMP / IBC technology is used for PUs corresponding to these positions is checked. If the IntraTMP / IBC technology is used for a PU, a BV of that PU is stored into the IntraTMP_Merge set. After constructing the IntraTMP_Merge set, the first candidate list is updated according to the IntraTMP_Merge set. The specific updating operation is: sequentially accessing each item in the IntraTMP_Merge set, calculating a template matching cost corresponding to each BV, comparing this cost with template matching costs of the first candidate list, and if this cost is less than the largest template matching cost in the first candidate list, replacing the worse BV in the first candidate list with that BV. An example of the specific replacement operation is: inserting this BV into the first candidate list in order of cost magnitude, and deleting the item with the largest cost value from the first candidate list. A search region bestRegionId for the BV is set to 6.
[268] S2004, when a vector parameter of a second position block satisfies a second condition, a second candidate set of the current block is determined according to the vector parameter of the second position block, and the first candidate list is updated according to the second candidate set.
[269] It should be noted that, in the embodiments of the present disclosure, after updating the first candidate list according to the first candidate set, the second position block may be determined according to at least part of the candidate vector parameters in the updated first candidate list. When the vector parameter of the second position block satisfies the second condition, the second candidate set of the current block is constructed according to the vector parameter of the second position block.
[270] In a possible implementation, the at least part of the candidate vector parameters in the updated first candidate list may be one or more second candidate vector parameters that were updated from the first candidate set into the first candidate list. Therefore, in some embodiments, the second candidate set of the current block may be determined as follows. One or more second candidate vector parameters updated from the first candidate set to the first candidate list are determined. The second position block is determined according to the one or more second candidate vector parameters. The second candidate set of the current block is determined according to the vector parameter of the second position block.
[271] In another possible implementation, the at least part of the candidate vector parameters in the updated first candidate list may be all candidate vector parameters in the updated first candidate list. Therefore, in some embodiments, the second candidate set of the current block may be determined as follows. After the first candidate list is updated according to the first candidate set, the second position block is determined according to all candidate vector parameters in the first candidate list, and the second candidate set of the current block is determined according to the vector parameter of the second position block.
[272] In another possible implementation, the at least part of the candidate vector parameters in the updated first candidate list may be a preset number of candidate vector parameters in the updated first candidate list. Therefore, in some embodiments, the second candidate set of the current block may be determined as follows. After the first candidate list is updated according to the first candidate set, first N candidate vector parameters in the first candidate list are determined. The second position block is determined according to the N candidate vector parameters. The second candidate set of the current block is determined according to the vector parameter of the second position block. Here, N is a positive integer.
[273] It should be noted that, in the embodiments of the present disclosure, the method further includes the following. A value of N is determined according to a size parameter of the current block. That is, the number of checks may be limited according to the size of the current block. Exemplarily, for a current block with a size less than or equal to 16×16, the first 5 are checked; for other sizes, the first 10 are checked.
[274] In yet another possible implementation, the second candidate set of the current block may be determined as follows. After the first candidate list is updated according to the first candidate set, clustering is performed on the first candidate list to determine M candidate vector parameters at cluster centers. The second position block is determined according to the M candidate vector parameters. The second candidate set of the current block is determined according to the vector parameter of the second position block. Here, M is a positive integer.
[275] It should also be noted that, in the embodiments of the present disclosure, the second candidate set may be represented by IntraTMP_EBVP. For the construction of the IntraTMP_EBVP set (or IntraTMP_EBVP list), only all BVs in the IntraTMP_Merge set that have been added into the first candidate list may be checked. Alternatively, an EBVP-based update may be performed on all candidates in the updated first candidate list.
[276] In addition, in the embodiments of the present disclosure, the BVs to be checked and the number thereof in the IntraTMP_EBVP set may also be adjusted. Exemplarily, the first 5 in the corresponding BV set may be checked, or the first 10 in the corresponding BV set may be checked. Alternatively, the number of checks may be limited according to the size of the current block. For examples, for a CU with a size less than or equal to 16×16, the first 5 are checked; for other sizes, the first 10 are checked. Alternatively, clustering may be performed on the updated first candidate list, with the clustering rule being the geometric distance to the cluster center. The number of cluster centers is 2 to 5, and EBVP operations are performed, for example, only on the cluster centers.
[277] In yet another possible implementation, the second candidate set may not be constructed. The method further includes the following. When the first candidate set of the current block is not full, the vector parameter of the second position block is filled into the first candidate set until the first candidate set is full, and the first candidate list is updated according to the first candidate set that is full.
[278] That is, in the embodiments of the present disclosure, it is also possible to add EBVP BVs after the IntraTMP_Merge set until the IntraTMP_Merge set is full, and then update the first candidate list with this IntraTMP_Merge set, i.e., the number is limited to the number of unfilled items in the IntraTMP_Merge set.
[279] Exemplarily, in the embodiments of the present disclosure, after the first candidate list is updated according to the IntraTMP_Merge set, for each BV that has been added from the IntraTMP_Merge set into the first candidate list, an IntraTMP_EBVP set is constructed and the first candidate list is updated again according to this IntraTMP_EBVP set.
[280] Firstly, for each current BV, its corresponding IntraTMP_EBVP set is constructed from scratch. Five positions of the current CU are determined: center (xTbCmp+nTbW / 2, yTbCmp+nTbH / 2), upper-left (xTbCmp, yTbCmp), upper-right (xTbCmp+nTbW-1, yTbCmp), bottom-left (xTbCmp, yTbCmp+nTbH-1), and bottom-right (xTbCmp+nTbW-1, yTbCmp+nTbH-1). For a PU corresponding to one of these five position coordinates plus the current BV, whether the BV-based prediction technique (i.e., IBC / IntraTMP) is used for the PU is checked. If the BV-based prediction technique is used for the PU, a sum (vector sum, i.e., adding the horizontal and vertical components separately) of a BV stored for the corresponding PU and the current BV is denoted as BV’ and added into the TMP_EBVP set. Then the above operation is repeated for this BV’ by regarding the BV’ as the current BV, to continue constructing available options in the TMP_EBVP set. If the BV-based prediction technique is not used for the PU, the next position is checked.
[281] In some embodiments, the method further includes the following. When all vector parameters of the second position blocks have been traversed or when the number of candidate vector parameters in the second candidate set is greater than a first threshold, it is determined that the construction of the third candidate set is completed.
[282] It should be noted that, in the embodiments of the present disclosure, the first threshold may be represented by V, in other words, the length of the second candidate set is V. Exemplarily, V may has a value of 15. Alternatively, the length V of the IntraTMP_EBVP set may change to another value, for example, the value of V is limited to 1, 2, 5, or 10.
[283] In this way, the above operations are repeated until all five positions have been checked or the number of IntraTMP_EBVP sets being constructed is greater than V, thereby completing the construction of the current IntraTMP_EBVP set.
[284] In some embodiments, after the construction of the second candidate set is completed, the method further includes the following. According to a preset matching criterion, a second matching cost value between a matching template corresponding to a third candidate vector parameter in the second candidate set and the first template is determined. When the second matching cost value is greater than a second threshold, the third candidate vector parameter is deleted from the second candidate set to update the second candidate set. The third candidate vector parameter is any one vector parameter in the second candidate set.
[285] That is, in the embodiments of the present disclosure, a cost threshold may be imposed based on the template cost (e.g., SAD, SATD, etc.) corresponding to the BV. The template cost is first calculated for each BV in the second candidate set, and only BVs not exceeding the threshold are added to the IntraTMP_EBVP set to obtain the final second candidate set.
[286] In some embodiments, the first candidate list may be updated according to the second candidate set as follows. A cost value corresponding to a third candidate vector parameter in the second candidate set is determined, and a maximum cost value corresponding to one or more candidate vector parameters in the first candidate list is determined. When the cost value corresponding to the third candidate vector parameter is smaller than the maximum cost value in the first candidate list, the candidate vector parameter corresponding to the maximum cost value in the first candidate list is replaced with the third candidate vector parameter, to update the first candidate list. Here, the third candidate vector parameter is any one vector parameter in the first candidate set.
[287] In a specific embodiment, the candidate vector parameter corresponding to the maximum cost value in the first candidate list may be replaced with the second candidate vector parameter as follows. The third candidate vector parameter is added into the first candidate list, and the candidate vector parameter corresponding to the maximum cost value is deleted from the first candidate list.
[288] Exemplarily, in the embodiments of the present disclosure, after the construction of the current IntraTMP_EBVP set is completed, the first candidate list is updated. The specific updating operation is as follows. Each BV in this IntraTMP_EBVP set is accessed to calculate a corresponding template matching cost, and this cost is compared with the template matching costs of the BVs in the first candidate list. If this cost is less than the largest template matching cost in the first candidate list, the worse BV in the first candidate list is replaced with that BV. An example of the replacement operation is: inserting this BV into the first candidate list in order of cost magnitude, and deleting the item with the largest cost value from the first candidate list. A search region bestRegionId for the BV newly inserted into the first candidate list is set to 7.
[289] It should also be noted that, in the embodiments of the present disclosure, the extension may not be used in conjunction with the IntraTMP_Merge set, i.e., may be performed based solely on the BVs obtained by direct search within the search window in IntraTMP.
[290] It should also be noted that, in the embodiments of the present disclosure, it is also possible to perform a single search, without dividing into coarse search and fine search steps, and then BV options may be extended based on the single search result to obtain the final BV result.
[291] In some embodiments, for updating the first candidate list, the method further includes the following. First K candidate vector parameters in the first candidate set are determined, and the first candidate list is updated according to the first K candidate vector parameters. Here, K is a positive integer.
[292] That is, in the embodiments of the present disclosure, only the first K (e.g., K may be 5) in the IntraTMP_Merge set are used to update the coarse search list, and extension is performed only on the basis of the BVs in the IntraTMP_Merge set.
[293] In some embodiments, for updating the first candidate list, the method further includes the following. First P candidate vector parameters in the first candidate set are determined. The second position block is determined according to the P candidate vector parameters, and the vector parameter of the second position block is determined. When the vector parameter of the second position block satisfies the second condition, a fourth candidate set of the current block is constructed according to the vector parameter of the second position block, and it is determined that the construction of the fourth candidate set is completed when all P candidate vector parameters have been traversed or when the fourth candidate set is full. A cost value corresponding to one or more candidate vector parameters in the fourth candidate set is determined, and Q candidate vector parameters are selected from the fourth candidate set according to the cost value corresponding to the one or more candidate vector parameters. The first candidate list is updated according to the Q candidate vector parameters. Here, P and Q are positive integers.
[294] That is, in the embodiments of the present disclosure, it is also possible to use IntraTMP_Merge and IntraTMP_EBVP together to maintain a merge set or list. Exemplarily, the first P items (e.g., P may be 5) of the IntraTMP_Merge set may be firstly taken to perform IntraTMP_EBVP extension, so as to construct a new merge set of length L (e.g., L may be 28). When the extended BVs fill the new merge set or the extension of the P BVs is completed, costs of BVs in the new merge set are calculated and sorted, and then the first Q items (e.g., Q may be 5) of the sorted list are taken to update the first candidate list.
[295] S1905, a second search region is determined according to a candidate vector parameter in the updated first candidate list, and a vector parameter of the current block is determined according to the second search region.
[296] It should be noted that, in the embodiments of the present disclosure, after obtaining the final coarse search list, a fine search may be performed for that coarse search list. That is, the search process in the embodiments of the present disclosure may be first performing a coarse search and then performing a fine search.
[297] It should also be noted that, in the embodiments of the present disclosure, the second search region here is a fine search region. In some embodiments, the second search region may be determined according to the candidate vector parameter in the updated first candidate list as follows. A starting position of the second search region is determined based on the candidate vector parameter in the first candidate list. The starting position is offset by a first preset range in both the vertical direction and the horizontal direction, and the obtained sample region is determined as the second search region.
[298] In the embodiments of the present disclosure, firstly, the starting position of the second search region (i.e., the fine search starting point) is determined. Here, the fine search starting point may be set as coordinate [0,0], and then offset by the first preset range in both the vertical direction and the horizontal direction to obtain the second search region.
[299] In the embodiments of the present disclosure, the first preset range may be [-2,2]. In this case, the second search region is the obtained 5×5 sample region. In addition, the first preset range may also be other preset ranges, such as [-1,1], [-3,3], [-4,4], [-5,5], etc. In these cases, the second search region is the correspondingly obtained sample region. In addition, it should be noted that the offset ranges in the vertical and horizontal directions may be the same or different. For example, the offset range in the horizontal direction may be [-2,2], and the offset range in the vertical direction may be [-3,3].
[300] That is, the second search region may be a square, i.e. the offset ranges in the vertical and horizontal directions are the same; or the search region may be a non-square, i.e. the offset ranges in the vertical and horizontal directions are different, which is not limited in any way.
[301] In the embodiments of the present disclosure, different first preset ranges yield different second search regions. In some embodiments, the method may include the following. When the first preset range is [-1,1], the second search region may be the obtained 3×3 sample region, as illustrated in FIG. 10. Alternatively, when the first preset range is [-2,2], the second search region may be the obtained 5×5 sample region, as illustrated in FIG. 21. Alternatively, when the first preset range is [-3,3], the second search region may be the obtained 7×7 sample region, as illustrated in FIG. 22. Alternatively, when the first preset range is [-4,4], the second search region may be the obtained 9×9 sample region, as illustrated in FIG. 23. Alternatively, when the first preset range is [-5,5], the second search region may be the obtained 11×11 sample region, as illustrated in FIG. 11.
[302] That is, for the case where the search region is 7, both TmpRefineRangeHor and TmpRefineRangeVer may be set to 2. That is, the fine search starting position is coordinate [0,0], with the vertical and horizontal coordinates offset within the range of [-2,2], i.e., a 5×5 sample region, and a point-by-point full search is performed within this range.
[303] Exemplarily, for a 5×5 sample region, code description is as follows:for (dY=-2; dY <=2; dY ++){for (dX=-2; dX<=2; dX ++){if(sadArray[dX+2][dY+2] < minSad){minSad = sadArray[dX+2][dY+2];intOffX = dX;intOffY = dY;}}}
[304] Here, intOffX represents an integer-sample offset in the horizontal direction, and intOffY represents an integer-sample offset in the vertical direction.
[305] In some embodiments, the method may also be used in combination with a first prediction mode. The method may further include the following. A bitstream is decoded to determine a value of a third syntax element; when the third syntax element indicates that the first prediction mode is used for the current block, it is determined that the second search region is within the 5×5 sample region obtained when the first preset range is [-2,2].
[306] Further, in some embodiments, the method further includes the following. When the third syntax element indicates that the first prediction mode is not used for the current block, it is determined that the second search region is within a sample region obtained when a preset range other than the first preset range of [-2,2] is used.
[307] In a specific embodiment, when the third syntax element indicates that the first prediction mode is not used for the current block, it is determined that the second search region is within the 7×7 sample region obtained when the first preset range is [-3,3].
[308] It should be noted that, in the embodiments of the present disclosure, the third syntax element may be used to indicate whether the first prediction mode is used for the current block. If the value of the third syntax element is a first preset value, it is determined that the first prediction mode is used for the current block; if the value of the third syntax element is a second preset value, it is determined that the first prediction mode is not used for the current block.
[309] It should also be noted that, in the embodiments of the present disclosure, the first preset value is different from the second preset value. The first preset value may be set to 1, and the second preset value may be set to 0; or the first preset value may be set to 0, and the second preset value may be set to 1; or the first preset value may be set to true, and the second preset value may be set to false; or the first preset value may be set to false, and the second preset value may be set to true.
[310] It should also be noted that, in the embodiments of the present disclosure, the first prediction mode may be the IntraTMP-LIC mode, but is not limited thereto. Exemplarily, the first preset value may be set to 1, and the second preset value may be set to 0. When used in combination with the IntraTMP-LIC mode, as illustrated in FIG. 24, when the IntraTMP-LIC mode is chosen for the current block, the fine search range is a 5×5 sample region with the fine search starting position as coordinate [0,0] and the vertical and horizontal coordinates offset within the range of [-2,2], specifically as illustrated in (a) of FIG. 24. Otherwise, when the IntraTMP-LIC mode is not chosen for the current block, the fine search range is a 7×7 sample region with the fine search starting position as coordinate [0,0] and the vertical and horizontal coordinates offset within the range of [-3,3], specifically as illustrated in (b) of FIG. 24. Here, when the IntraTMP-LIC mode is not chosen for the current block, the fine search range may also correspond to other preset regions, such as the cases illustrated in FIG. 10, FIG. 11, FIG. 21, or FIG. 23. Subsequently, a point-by-point full search may be performed within this range. It should be noted that this method is similar to the processing in the case where regionId is 6 and the IntraTMP-LIC mode is enabled.
[311] In some embodiments, the vector parameter of the current block may be determined according to the second search region as follows. The vector parameter of the current block is determined by searching within the second search region using a second search step size. Here, the value of the second search step size is smaller than the value of the first search step size.
[312] It should be noted that, in the embodiments of the present disclosure, the second search step size may be 1, but may also be another value. Here, the second search step size needs to be smaller than the value of the first search step size in the coarse search stage.
[313] It should also be noted that, in the embodiments of the present disclosure, the second search step size being 1 may mean that a point-by-point full search is performed within the second search region to determine the vector parameter of the current block.
[314] In a specific embodiment, the best block vector BV1_BEST[p], p=0,...,M-1, obtained in the first candidate list, is used as a fine search reference point, and searching is performed near the fine search reference point.
[315] For each fine search reference point, firstly, the position of the optimal matching reconstructed block obtained from the coarse search is used as the reference position of the fine search region: BestPosX = xTbCmp + pX1_BEST, BestPosY = yTbCmp + pY1_BEST. Then, the refinement search ranges TmpRefineRangeHor and TmpRefineRangeVer are determined. The refinement search ranges may be fixed in size or may be related to the search region.
[316] Exemplarily, for reference points within search region 0 to 5, both TmpRefineRangeHor and TmpRefineRangeVer may be set to 1. That is, for the case where regionId is 0 to 5, the fine search range is a 3×3 sample region with the fine search starting position as the coordinate [0,0] and the vertical and horizontal coordinates offset within the range of [-1,1]. A point-by-point full search is performed within this range, as illustrated in FIG. 10 described above.
[317] For a reference point within search region 6, both TmpRefineRangeHor and TmpRefineRangeVer may be set to 5. That is, for the case where regionId is 6, the fine search range is an 11×11 sample region with the fine search starting position as the coordinate [0,0] and the vertical and horizontal coordinates offset within the range of [-5,5]. A point-by-point full search is performed within this range, as illustrated in FIG. 11 described above.
[318] For a search region of 7: both TmpRefineRangeHor and TmpRefineRangeVer may be set to 2. That is, the fine search range is a 5×5 sample region with the fine search starting position as the coordinate [0,0] and the vertical and horizontal coordinates offset within the range of [-2,2], as illustrated in FIG. 21 described above. A point-by-point full search is performed within this range. It should be noted that this method is consistent with the processing in the case where regionId is 6 and the flag of the IntraTMP-LIC mode is true when the IntraTMP-LIC mode is enabled.
[319] The fine search region is regarded as an entire undetermined reconstructed region and traversed directly by using the search window.
[320] A new search range according to the best matching block position obtained from the coarse search, is obtained as follows:iHorMaxrefine = min(picWidth - nTbW, BestPosX + TmpRefineRangeHor);iHorMinrefine = max(iTemplateSizeW, BestPosX - TmpRefineRangeHor);iVerMaxrefine = min(picHeight - nTbH, BestPosY + TmpRefineRangeVer);iVerMinrefine= max(iTemplateSizeH, BestPosY - TmpRefineRangeVer).
[321] Then, the adjusted block vector bvXMins, bvXMaxs, bvYMins, bvYMaxs can be calculated from iVerMinrefine, iVerMaxrefine, iHorMinrefine, iHorMaxrefine as follows:bvXMins = iHorMinrefine – xTbCmp;bvXMaxs = iHorMaxrefine – xTbCmp;bvYMins = iVerMinrefine – yTbCmp;bvYMaxs = iVerMaxrefine – yTbCmp.
[322] The fine search is performed within the block vector range where pX is between bvXMinsrefine and bvXMaxsrefine, and pY is between bvYMinsrefine and bvYMaxsrefine, i.e., directly traverse all search positions within the fine search window, sequentially performing availability checks. For example, the second search step size is 1, and top T best matching costs of available points from template matching are denoted as pDiff_BEST[t], t=0,...,T-1, and the corresponding BVs are denoted as best BVs BV_BEST[t], t=0,...,T-1, where T is 1 or an integer greater than 1. For example, T=1.
[323] It should also be noted that, in the embodiments of the present disclosure, a sub-sample position search may be further performed on the above basis. In some embodiments, the method may further include the following. After the point-by-point full search within the second search region, a new candidate vector parameter of the current block is determined. A sub-sample search is performed based on the new candidate vector parameter to determine the vector parameter of the current block.
[324] In a possible implementation, after the point-by-point full search within the second search region, the new candidate vector parameter of the current block may be determined as follows. According to a preset matching criterion, third matching cost values between matching templates corresponding to multiple search points in the second search region and the first template of the current block are determined. A minimum matching cost value is determined from the third matching cost values of the multiple search points, and the new candidate vector parameter is determined according to a search point corresponding to the minimum matching cost value.
[325] That is, in the embodiments of the present disclosure, within a certain fine search list range (e.g., the second search region), the costs of the searched integer-sample position are compared one by one to determine the position with the minimum cost, thereby determining the new candidate vector parameter.
[326] It should also be noted that, in the embodiments of the present disclosure, the preset matching criterion may include any one of Sum of Absolute Differences (SAD), Sum of Absolute Transformed Differences (SATD), Sum of Squared Errors (SSE), Mean Absolute Difference (MAD), Mean Absolute Error (MAE), Mean Squared Error (MSE), or Normalized Cross Correlation (NCC).
[327] In some embodiments, the sub-sample search may be performed based on the new candidate vector parameter to determine the vector parameter of the current block as follows. A third search region indicated by the new candidate vector parameter is determined. An initial direction of the sub-sample search is determined by searching based on multiple candidate positions in the third search region. A fourth search region is determined based on the initial direction of the sub-sample search, and a sub-sample position index and a direction index of the current block are determined by searching according to multiple candidate positions in the fourth search region. The vector parameter of the current block is determined according to the sub-sample position index and the direction index.
[328] It should be noted that, in the embodiments of the present disclosure, the third search region indicated by the new candidate vector parameter may be determined as follows. A starting position of the third search region is determined based on the new candidate vector parameter. Multiple candidate positions obtained by performing a half-sample position search based on the starting position are determined as the third search region.
[329] It should also be noted that, in the embodiments of the present disclosure, the initial direction of the sub-sample search may be determined by searching based on the multiple candidate positions in the third search region as follows. According to a preset matching criterion, fourth matching cost values between matching templates corresponding to the multiple candidate positions in the third search region and the first template of the current block are determined. The fourth matching cost values corresponding to the multiple candidate positions are sorted in ascending order to determine the top-ranked H matching cost values. The initial direction of the sub-sample search is determined according to candidate positions corresponding to the H matching cost values. Here, H is a positive integer.
[330] It should be noted that, in the embodiments of the present disclosure, when performing the half-sample position search based on the starting position, eight directions with offsets of -1 / 2 and 1 / 2 in the vertical and horizontal directions may be used, resulting in eight candidate positions. Then the third search region may be determined from these eight candidate positions. In addition, in the embodiments of the present disclosure, the value of H may be set to 4, i.e., the first four candidate directions with relatively smaller cost values may be selected as the initial directions for the sub-sample search.
[331] It should also be noted that, in the embodiments of the present disclosure, the sub-sample search range is always within (-1,1). Here, 1 / 2 is the furthest value reached within this range for half-sample precision, and 3 / 4 is the furthest value reached within this range for 1 / 4-sample precision.
[332] Exemplarily, the starting position of the sub-sample search is coordinate [0,0], and eight directions with vertical and horizontal coordinate offsets of -1 / 2 and 1 / 2 are considered. The eight candidate positions are compared in terms of cost, and the first four directions with smaller costs are determined as initial directions for the sub-sample search.
[333] In some embodiments, the fourth search region may be determined based on the initial direction of the sub-sample search as follows. A sub-sample position search is performed based on the starting position and the initial direction of the sub-sample search, and the obtained multiple candidate positions are determined as the fourth search region.
[334] It should be noted that, in the embodiments of the present disclosure, when performing the sub-sample position search based on the starting position and the initial direction of the sub-sample search, the search may be performed within the range of [-3 / 4, 3 / 4] offsets in the vertical and horizontal directions, among multiple 1 / 4-sample precision positions. For example, when the initial directions are the first four directions, there may be 10 to 12 corresponding candidate positions. In some embodiments, the sub-sample position index and the direction index of the current block may be determined as follows. According to a preset matching criterion, fifth matching cost values between matching templates corresponding to multiple candidate positions in the fourth search region and the first template of the current block are determined. A minimum matching cost value is determined from the fifth matching cost values of the multiple candidate positions. The sub-sample position index and the direction index of the current block are determined according to a candidate position corresponding to the minimum matching cost value.
[335] It should also be noted that, in the embodiments of the present disclosure, the sub-sample position index may be represented by tmpIsSubPel, and the direction index may be represented by tmpSubIdx. Exemplarily, tmpIsSubPel may have four values, respectively corresponding to the integer-sample position (0), the 1 / 2-sample position (1), the 1 / 4-sample position (2 or 3), and the 3 / 4-sample position (2 or 3), where the values for 1 / 4 and 3 / 4 positions are related to the interpolation position. tmpSubIdx may have eight values, respectively corresponding to eight directions: left (0), right (1), upper (2), bottom (3), upper-left (4), upper-right (5), bottom-left (6), and bottom-right (7).
[336] In addition, it should be noted that when determining the fourth search region, the offset ranges in the vertical and horizontal directions may be the same or different. For example, the offset range in the horizontal direction may be [-3 / 4, 3 / 4], and the offset range in the vertical direction may be [-1 / 2, 1 / 2]. That is, for the fourth search region, the search region may be a square, meaning that the offset ranges in the vertical and horizontal directions are the same; or the search region may be a non-square, meaning that the offset ranges in the vertical and horizontal directions are different, which is not limited herein.
[337] Exemplarily, the starting position of the sub-sample search is coordinate [0,0], the first four directions determined above are offset by the range of [-3 / 4, 3 / 4] in the vertical and horizontal coordinates, and the search is performed among multiple 1 / 4-sample precision positions. Specifically, 10 to 12 candidate positions are compared in terms of cost, and a position with the minimum cost is determined to obtain the sub-sample position index tmpIsSubPel and the final direction index tmpSubIdx.
[338] In this way, values (Dx, Dy) of the sub-sample position coordinates can be obtained from tmpIsSubPel and tmpSubIdx, and then the best matching coordinates are updated.
[339] After completing the above operations, the results of the coarse selection and fine selection (where the fine selection process includes one or more reference point searches) are combined to obtain one or more best block vectors BV_BEST[n], n=0,...,N-1, for different algorithm requirements, where each item is a coordinate pair (pX_BEST, pY_BEST). Here, pX_BEST and pY_BEST are the horizontal and vertical offsets of the best matching template relative to the template of the current coding block, respectively, and are also the horizontal and vertical offsets of the best matching reconstructed block relative to the current coding block.
[340] In some embodiments, for determining the vector parameter of the current block by performing the sub-sample search based on the new candidate vector parameter, the method may further include the following. A starting position of the sub-sample search and multiple candidate positions around the starting position are determined. Cost values respectively corresponding to the multiple candidate positions are calculated, and a preset cost model is constructed according to the multiple candidate positions and the corresponding cost values. The preset cost model is used to indicate a mapping relationship between candidate positions and cost values. According to the preset cost model, a candidate position corresponding to a minimum cost value is determined, and the candidate position corresponding to the minimum cost value is determined as the vector parameter of the current block.
[341] That is, for the sub-sample search, the position with the minimum cost may also be solved by building a model. For example, take the starting position of the sub-sample search as the center, a few coordinate points around the center are selected to build a model using the cost values at these points. The position corresponding to the minimum value of the model is solved and selected as the search result.
[342] Exemplarily, taking a quadratic model as an example, assume that the relationship model between Vcost and the positions near MVint is as follows:Vcost(x,y)=A(x-xmin)2+B(y-ymin)2+C (9)
[343] Here, (xmin, ymin) is the sub-sample position where Vcost is minimized, and A, B, C are model parameters. The model parameters A, B, C, xmin, ymin can be solved using the Vcost at the position corresponding to MVint and its four neighboring positions (top, bottom, left, right). Suppose the Vcost at the position corresponding to MVint is Vcost(0,0), and the Vcost at the top, bottom, left, and right positions are Vcost(0,-1), Vcost(0,1), Vcost(-1,0), Vcost(1,0), respectively.
[344] The calculation methods for xmin and ymin are:xmin=(Vcost(-1,0)- Vcost(1,0)) / (Vcost(-1,0)+Vcost(1,0)-2Vcost(0,0)) (10)ymin=(Vcost(0,-1)- Vcost(0,1)) / (Vcost(0,-1)+Vcost(0,1)-2Vcost(0,0)) (11)
[345] Here, the search result may be stored in units such as half-sample, 1 / 4 luma integer-sample, 1 / 8 luma integer-sample, or 1 / 16 luma integer-sample as needed.
[346] In addition, Vcost may be calculated according to a preset cost function, for example, SAD, SATD, SSE, MAD, MAE, MSE, and NCC, etc.
[347] It should also be noted that, in the embodiments of the present disclosure, the sub-sample search may also be a search among multiple half-sample positions. That is, with the starting position of the sub-sample search as coordinate [0,0], a square region with vertical and horizontal coordinate offsets within the range of [-1 / 2, 1 / 2] is used, and 9 candidate positions are compared in terms of cost, as illustrated in FIG. 25. Alternatively, the sub-sample search may be a search among multiple 1 / 4-sample precision positions. That is, with the starting position of the sub-sample search as coordinate [0,0], a square region with vertical and horizontal coordinate offsets within the range of [-3 / 4, 3 / 4] is used, and 49 candidate positions are compared in terms of cost, as illustrated in FIG. 26. The present disclosure is not limited thereto.
[348] It should also be noted that, in the embodiments of the present disclosure, for different search steps, the cost function may be of the same type, e.g., SAD, or may be of different types, e.g., SAD for coarse search, SAD or SATD for fine search, and SAD, SATD, SSE, etc. for sub-sample search, which is not specifically limited herein.
[349] After completing the above operations, the results of the coarse search and fine search (where the fine search process includes searches based on one or more reference points) are combined to obtain one or more best block vectors BV_BEST[n], n=0,...,N-1, for different algorithm requirements, where each item is a coordinate pair (pX_BEST, pY_BEST). Here, pX_BEST and pY_BEST are the horizontal and vertical offsets of the best matching template relative to the template of the current block, respectively, and are also the horizontal and vertical offsets of the best matching reconstructed block relative to the current block. Thus, the vector parameter of the current block is obtained.
[350] In some embodiments, the vector parameter of the current block may be determined by searching within the second search region using the second search step size as follows. A sub-sample search is performed within the second search region using the second search step size to determine the vector parameter of the current block. That is, the sub-sample search may be implemented in the fine search stage.
[351] S1906, a prediction value of the current block is determined according to the vector parameter of the current block.
[352] It should be noted that, in the embodiments of the present disclosure, there may be one or more vector parameters of the current block. Here, if there are multiple vector parameters of the current block, the prediction value of the current block may be determined by performing weighted fusion on using the positions corresponding to the multiple BVs.
[353] In some embodiments, if there is one vector parameter of the current block, the prediction value of the current block is determined according to the vector parameter of the current block as follows. A reference block of the current block is determined according to the vector parameter of the current block, and the prediction value of the current block is determined according to the reference block.
[354] Exemplarily, in the embodiments of the present disclosure, the reference block of the current block may be determined by a simple translation copy. The specific operation is: for x=0...nTbW-1, y=0...nTbH-1, determining reconstructed samples recSamples of the current frame (i.e., the reference block of the current block) by RefBlockn [x][y] = recSamples[x + pXn][y + pYn].
[355] It should be noted that, in the embodiments of the present disclosure, when determining the reference block of the current block according to the vector parameter of the current block, an initial reconstructed block of the current block may be determined according to the vector parameter of the current block, and then the initial reconstructed block may be refined to determine the reference block of the current block. Alternatively, the reference block may be filtered to determine a filtered reference block, and the prediction value of the current block may be determined according to the filtered reference block.
[356] It should also be noted that, in the embodiments of the present disclosure, the prediction value determined by the vector parameter of the current block may be used as the final prediction value, or may be further refined (e.g., through a clip operation) to determine the final prediction value of the current block.
[357] In some embodiments, when determining the prediction value of the current block according to the reference block, the method may include the following. A first prediction block of the current block is determined according to the reference block. A second prediction block of the current block is determined by performing prediction on the current block according to a second prediction mode, where the second prediction mode is a mode other than an intra template matching prediction mode. The prediction value of the current block is determined according to the first prediction block and the second prediction block.
[358] It should be noted that, in the embodiments of the present disclosure, the second prediction mode may be a prediction mode different from the intra template matching prediction mode used for the current block, such as PLANAR mode, CCLM mode, angular prediction mode, etc. Here, the first prediction block and the second prediction block may be weighted and fused to determine the prediction value of the current block.
[359] That is, in the embodiments of the present disclosure, when determining the prediction value of the current block, the prediction value may be refined by local filtering, or may be refined by weighting multiple prediction values, etc.
[360] In some embodiments, when there are multiple vector parameters of the current block, the prediction value of the current block may be according to the vector parameters of the current block as follows. Multiple reference blocks of the current block are determined according to the multiple vector parameters of the current block, and the prediction value of the current block is determined according to the multiple reference blocks.
[361] It should also be noted that, in the embodiments of the present disclosure, the prediction value of the current block may be determined according to the multiple reference blocks as follows. Multiple prediction blocks of the current block are determined according to the multiple reference blocks; and weighted fusion is performed on the multiple prediction blocks to determine the prediction value of the current block.
[362] It can be understood that, in the IntraTMP mode, in addition to the basic copy method for obtaining the prediction value, there are also a method of obtaining the prediction value by filtering and fusing the positions corresponding to multiple BVs, and a method of fusing with the normal Intra mode.
[363] In some embodiments, for determining the prediction value of the current block according to the vector parameter of the current block, the method may further include the following. A bitstream is decoded to determine a value of a first syntax element. A prediction-value construction mode of the current block is determined according to the value of the first syntax element and a candidate list of prediction-value construction modes of the current block. The prediction value of the current block is determined according to the vector parameter of the current block and the prediction-value construction mode.
[364] That is, when determining the prediction value of the current block, the candidate list of prediction-value construction modes may be determined by using various single prediction values, filtered prediction values, weighted prediction values, and / or prediction-value construction modes of these prediction values, and the syntax element transmitted in the bitstream may be used to determine at the decoding end which item in the candidate list of prediction-value construction modes to use to obtain the actual prediction value.
[365] In some embodiments, the method further includes the following. A bitstream is decoded to determine a value of a second syntax element, and when the second syntax element indicates that the intra template matching prediction mode is used for the current block, the step of determining the first candidate list of the current block is performed.
[366] It should be noted that, in the embodiments of the present disclosure, the value of the first syntax element is used to indicate an index of the prediction-value construction mode of the current block in the candidate list of prediction-value construction modes, and the value of the second syntax element is used to indicate whether the intra template matching prediction mode is used for the current block.
[367] It should be noted that, in the embodiments of the present disclosure, if the value of the second syntax element is a first preset value, it is determined that the intra template matching prediction mode is used for the current block; if the value of the second syntax element is a second preset value, it is determined that the intra template matching prediction mode is not used for the current block.
[368] In the embodiments of the present disclosure, the first preset value is different from the second preset value. The first preset value may be set to 1, and the second preset value may be set to 0; or the first preset value may be set to 0, and the second preset value may be set to 1; or the first preset value may be set to true, and the second preset value may be set to false; or the first preset value may be set to false, and the second preset value may be set to true.
[369] In a specific embodiment, the first preset value is set to 1, and the second preset value is set to 0. Exemplarily, if the value of the second syntax element is 1, the second syntax element indicates that the intra template matching prediction mode is used for the current block, and then the decoding method illustrated in FIG. 15 is executed. That is, the method of this embodiment of the present disclosure is applied to the intra template matching prediction mode.
[370] Further, in the embodiments of the present disclosure, after determining the prediction value of the current block according to the vector parameter of the current block, a reconstructed value of the current block may be further determined according to the prediction value of the current block.
[371] In some embodiments, the method further includes the following. A bitstream is decoded to determine a prediction residual of the current block. A reconstructed value of the current block is determined according to the prediction residual and the prediction value of the current block.
[372] It should also be noted that, in the embodiments of the present disclosure, by performing an addition operation on the prediction residual and the prediction value of the current block, the reconstructed value of the current block can be determined, thereby achieving reconstruction of the current block.
[373] It should also be noted that, in the embodiments of the present disclosure, the search may not be divided into coarse search and fine search. A single search may be performed, and then BV options may be extended based on the single search result to obtain the final vector parameter. Then the prediction value of the current block is determined according to the final vector parameter.
[374] It should also be noted that, in the IntraTMP mode, in addition to the basic copy method for obtaining the prediction value, there are also a method of obtaining the prediction value by fusing positions corresponding to multiple BVs, a method of copying after filtering the reference block corresponding to a BV, and a method of interpolating the reference block corresponding to a BV by sub-sample and then copying. Exemplarily, after obtaining a BV candidate list by template matching during the region search at the decoding end, the first N items (e.g., N=3) are selected for weighted fusion. This method may be referred to as the IntraTMP Fusion mode. Alternatively, after obtaining a best BV, multiple points are taken around that BV, and prediction values corresponding to the multiple points are weighted and fused to obtain the prediction value. This method may be referred to as the IntraTMP FLM mode. Alternatively, after obtaining the best BV, the template is sorted with sub-sample precision, the optimal direction and precision are selected, and an interpolation filter is used to calculate the prediction value. This method may be referred to as the IntraTMP SubPel mode. These are not specifically limited herein.
[375] The embodiments of the present disclosure provide the decoding method, specifically the method for extending the coverage of the Intra TMP search list. First, the first candidate list of the current block is determined, the first candidate list including one or more candidate vector parameters; then, the second position block is determined according to the candidate vector parameter in the first candidate list and / or the vector parameter of the first position block of the current block; when the decoding parameter of the second position block includes the vector parameter, it is determined, according to the vector parameter of the second position block, whether the vector parameter of the second position block satisfies a second condition; when the vector parameter of the second position block satisfies the second condition, the first candidate list is updated according to the vector parameter of the second position block; a second search region is determined according to a candidate vector parameter in the updated first candidate list, and a vector parameter of the current block is determined according to the second search region; finally, a prediction value of the current block is determined according to the vector parameter of the current block. In this way, when updating the first candidate list, some vector information of a second position block can be extended according to the candidate vector parameter in the initial first candidate list and / or the vector parameter of the first position block (spatially adjacent blocks and non-adjacent blocks of the current block), and then the first candidate list is supplemented with the extended vector information. Thus, the reconstructed information of spatially adjacent and non-adjacent positions can be effectively utilized, candidate vector information can be derived from the vector information of these reconstructed blocks while maintaining coding complexity. Therefore, the coverage of the IntraTMP search list is increased. The fine search mode is also extended, so that the vector parameter of the current block after the fine search is more accurate. In this way, the prediction accuracy is improved and the bitrate is saved, improving coding efficiency, and thus enhancing coding performance.
[376] In another embodiment of the disclosure, FIG. 27 is a first schematic flowchart of an encoding method proposed in the embodiment of the disclosure. As illustrated in FIG. 27, the method may include the following operations.
[377] S2701, a first candidate list of a current block is determined.
[378] It should be noted that the encoding method in the embodiments of the present disclosure is applied to an encoder. In addition, the encoding method may specifically refer to an intra prediction method, and more specifically, an intra prediction method that extends a block vector list based on Intra TMP. Here, by fully utilizing reconstructed information of spatially adjacent and non-adjacent positions, the coverage of the first candidate list is increased, thereby improving prediction accuracy.
[379] It should also be noted that, in the embodiments of the present disclosure, a video picture may be divided into multiple encoding blocks, and each encoding block may include a first color component, a second color component, and a third color component. The current block in the embodiments of the present disclosure refers to an encoding block currently to be subjected to intra prediction in the video picture. If the current block is predicted for the first color component and the first color component is a luma component, the current block may also be referred to as a luma block; or if the current block is predicted for the second color component and the second color component is a chroma component, the current block may also be referred to as a chroma block.
[380] It should also be noted that, in the embodiments of the present disclosure, the first candidate list may include one or more candidate vector parameters. Herein, the vector parameter may include: a block vector parameter and / or a motion vector parameter. That is, the first candidate list here may be a list containing multiple candidate BVs, or may be a list containing multiple candidate MVs.
[381] Illustratively, the block vector parameter may specifically be used to indicate a position of a reference block relative to the current block, i.e., an offset of the current block relative to the reference block is the block vector parameter.
[382] In some embodiments, for determining the first candidate list of the current block, the method may include the following. A first search region of the current block is determined, and the first candidate list of the current block is determined according to the first search region.
[383] It should be noted that, in the embodiments of the present disclosure, the first search region of the current block may be determined as follows. A first template of the current block is determined, and the first search region of the current block is determined according to the first template.
[384] In the embodiments of the present disclosure, a template type of the current block may be determined first, and then the first template of the current block may be determined according to the template type. The template type of the current block may be determined as follows. The template type of the current block is determined according to reference samples of the current block. Alternatively, the template type of the current block is determined according to indication information in a bitstream. Alternatively, the template type of the current block is determined according to a size parameter of the current block.
[385] In the embodiments of the present disclosure, the reference samples of the current block include at least one of the following: left neighboring reference samples of the current block, top neighboring reference samples of the current block, or top-left neighboring reference samples of the current block.
[386] It can be understood that in the embodiments of the disclosure, reference samples (reference samples) of the current block may refer to reference samples neighboring to the current block. "Neighboring" here may be spatially neighboring, but is not limited thereto. For example, "neighboring" may also be temporally neighboring or spatially and temporally neighboring, or even the reference samples of the current block may be reference samples obtained by performing some processing on spatially neighboring reference samples, temporally neighboring reference samples, spatially and temporally neighboring reference samples, or the like, which is not limited in the embodiments of the disclosure.
[387] It can also be understood that, in the embodiments of the present disclosure, the reference samples of the current block may include neighboring reconstructed samples of the current block, i.e., the neighboring reconstructed samples of the current block may be selected as a template to search for a matching template within the first search region. It should be noted that, in the embodiments of the present disclosure, the reference samples of the current block, i.e., the neighboring reconstructed samples of the current block, may include upper reference samples, upper-left reference samples, upper-right reference samples, left reference samples, and bottom-left reference samples of the current block.
[388] It can also be understood that, in the embodiments of the present disclosure, when the template type of the current block is determined by using the reference samples of the current block, the template types may be classified and determined according to availability of the neighboring reference samples.
[389] In some embodiments, when the template type of the current block is determined according to the reference samples of the current block, if the left neighboring reference samples, the upper neighboring reference samples, and the upper-left neighboring reference samples of the current block are all available, then the template type of the current block is determined as a first value. If the left neighboring reference samples of the current block are available, then the template type of the current block is determined as a second value. If the upper neighboring reference samples of the current block are available, then the template type of the current block is determined as a third value. If the left neighboring reference samples and the upper-left neighboring reference samples of the current block are both available, then the template type of the current block is determined as a fourth value. If the left neighboring reference samples and the bottom-left neighboring reference samples of the current block are both available, then the template type of the current block is determined as a fifth value. If the upper neighboring reference samples and the upper-right neighboring reference samples of the current block are both available, then the template type of the current block is determined as a sixth value.
[390] It should be noted that, in the embodiments of the present disclosure, in some cases, if both the left neighboring reference samples and the upper neighboring reference samples of the current block are available, then the template type of the current block is determined as the first value. That is, for an L-shaped template, in some cases, the upper-left neighboring reference sample may not be present.
[391] It should be noted that, in the embodiments of the present disclosure, the first value, the second value, the third value, the fourth value, the fifth value, and the sixth value may be any numerical values, which are not specifically limited in the present disclosure. For example, the values of the first value, the second value, the third value, the fourth value, the fifth value, and the sixth value may be 1, 2, 3, 4, 5, and 6, respectively.
[392] Exemplarily, in the embodiments of the present disclosure, the template type may be represented by refTemplateType. Correspondingly, as illustrated in FIG. 3 described above, a block filled with grids is the current block, and a neighboring region of the current block is a template T, where six template types are illustrated.
[393] Exemplarily, the six template types are as follows: when all the upper left reference samples, the upper reference samples, and the left reference samples are available, refTemplateType has a value of 1, and the template shape is illustrated in (a) of FIG. 3; when only the left reference sample is available, refTemplateType has a value of 2, and the template shape is illustrated in (b) of FIG. 3; when only the upper reference sample is available, refTemplateType has a value of 3, and the template shape is illustrated in (c) of FIG. 3; when only the left reference sample and the upper-left reference sample are available, refTemplateType has a value of 4, and the template shape is illustrated in (d) of FIG. 3; when only the left reference sample and the bottom-left reference sample are available, refTemplateType has a value of 5, and the template shape is illustrated in (e) of FIG. 3; when only the upper reference sample and the upper-right reference sample are available, refTemplateType has a value of 6, and the template shape is illustrated in (f) of FIG. 3.
[394] In some embodiments, the template type for the Intra TMP may also be selected in combination with the availability information of the above reference samples and according to an indication in the bitstream. For example, an index is agreed for each template type, and the actual template index information is transmitted in the bitstream, so that the template type can be determined at the decoding end. That is, in the embodiments of the present disclosure, the template type may be determined based on the availability information of the reference samples of the current block, or based on the information indicated in the bitstream, or based on both the availability information of the reference samples and the information indicated in the bitstream, which is not specifically limited in the disclosure.
[395] Further, in the embodiments of the present disclosure, after the first template corresponding to the current block is determined according to the template type, the method may further include the following. Template reference samples of the current block are determined according to the template type and a template size corresponding to the template type; and then the first template of the current block is determined according to the template reference samples.
[396] It should be noted that, in the embodiments of the present disclosure, the first template of the current block may include the template reference samples of the current block. Here, the template reference samples of the current block may be determined by the template type of the current block and the template size corresponding to the template type.
[397] It should also be noted that, in the embodiments of the present disclosure, the first template of the current block may be composed of reconstructed samples of one or more of an upper region, an upper right region, a left region, a lower left region, or an upper left region of the current block, i.e., may be composed of the reference samples of the current block.
[398] It should also be noted that, in the embodiments of the present disclosure, the template size corresponding to the template type may be preset, may be indicated by a syntax element in the bitstream, or may be adaptively selected according to the block size or other information. For example, when a left template is acquired, the template width templateW_size may be set to 4, and when a top template is acquired, the template height templateH_size may be set to 4.
[399] Correspondingly, in the embodiments of the present disclosure, in combination with the value of the template type refTemplateType of the current block and the template size corresponding to refTemplateType, it is possible to decide which part of reconstructed samples to acquire as the template reference samples of the current block, and then determine the corresponding first template. Exemplarily, when the value of refTemplateType is 1, the left, upper-left, and upper reconstructed samples of the current block may be acquired; when the value of refTemplateType is 2, only the left 4 columns of reconstructed samples of the current block are acquired; when the value of refTemplateType is 3, only the upper 4 rows of reconstructed samples of the current block are acquired.
[400] The value of the preset template size may be any integer greater than 0, not limited to 4, which is not specifically limited herein.
[401] That is, in the embodiments of the present disclosure, the template reference samples of the current block, which are determined from the reference samples of the current block in combination with the template type of the current block and the corresponding template size, may serve as the first template corresponding to the current block.
[402] It can be understood that, in the embodiments of the present disclosure, the search process for the vector parameter may include several parts as follows: an initialization process, a process of determining a search region (first search region) of the first template within the current frame, and a process of searching in the first search region to determine one or more best vector parameters. Therefore, when performing the search process, the initialization operation needs to be completed first.
[403] Exemplarily, as illustrated in FIG. 5 described above, nTbW and nTbH represent sizes of the current block, templateW_size and templateH_size represent template sizes, and uiPatchWidth and uiPatchHeight represent a size of a block including the current block and its template.
[404] Correspondingly, during initialization, uiPatchWidth may be initialized to nTbW + templateW_size, and uiPatchHeight may be initialized to nTbH + templateH_size. Here templateW_size and templateH_size may be fixed constants, or may be indicated by a syntax element in the bitstream, or may be dynamically adjusted according to the size of the CB or other information. templateW_size may be equal or unequal to templateH_size. For example, templateW_size = 4, templateH_size = 4; or when the width of the CB is greater than 8, templateW_size = 4 is set; when the width of the CB is less than or equal to 8, templateW_size = 2 is set; when the height of the CB is greater than 8, templateH_size = 4 is set; when the height of the CB is less than or equal to 8, templateH_size = 2 is set.
[405] Further, a cost threshold between templates that is represented by diffThreshold is initialized. For example, when the cost function is SAD, the threshold may be as follows: diffThreshold = ((1 << bitDepth) >> 2) × (uiPatchHeight × uiPatchWidth - nTbH × nTbW). When a bit depth bitDepth of the picture is 10, diffThreshold represents that a distortion threshold of each sample in the region of the template is 256.
[406] Further, a position ctbRsX, ctbRsY of a CTB where the current block is located, is initialized.
[407] Further, position offsets of the current block in the current CTB are initialized to offsetLCBY = yTbCmp - ctbRsY, offsetLCBX = xTbCmp - ctbRsX.
[408] Further, iTemplateSizeH = templateH_size and iTemplateSizeW = templateW_size are initialized.
[409] Further, iBvShift is initialized, where iBvShift is the precision of the vector parameter BV. For example, the precision of BV may be integer-sample precision, in which case iBvShift is 0; the precision of BV may also be sub-sample precision, e.g., iBvShift of 1 indicates 1 / 2-sample precision, and iBvShift of 2 indicates 1 / 4-sample precision, which is not specifically limited herein.
[410] Further, a preset search range for the template is initialized. The preset search range for the template may be set to a fixed size, or may be dynamically adjusted according to the size of the current block. 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 preset value, may be indicated by a syntax element in the bitstream, or may be adaptively adjusted according to information such as the size of the current block, e.g., set to 5.
[411] It can also be understood that, in the embodiments of the present disclosure, the first search region may include a first-type search region and / or a second-type search region. The first-type search region is a rectangular search region around the current block; the second-type search region is a region pointed to by a vector parameter corresponding to a preset search position of the current block and a region pointed to by automatic relocation.
[412] Here, the first-type search region includes a fully reconstructed region and / or a undetermined reconstructed region. The fully reconstructed region contains only reconstructed samples, and the undetermined reconstructed region contains both reconstructed samples and / or unreconstructed samples.
[413] That is, in the embodiments of the present disclosure, the first search region can be divided into two types.
[414] One type is a surrounding rectangular search region, which can also be divided into two sub-types: one sub-type is a region where it is certain that all samples in that region have been reconstructed (referred to as the fully reconstructed region), such as the four regions R1-R4 in FIG. 6; and the other sub-type is a region where it is uncertain whether all samples in that region have been reconstructed (referred to as the undetermined reconstructed region), such as the two regions R5 and R6 in FIG. 6.
[415] The other type is an extended search region, defined as a region pointed to by BVs corresponding to spatially adjacent and non-adjacent PUs, which in the embodiment corresponding to FIG. 6 may be considered as region R7; and a region pointed to by automatic relocation, which may be considered as region R8. Since search points in R7 and / or R8 are not necessarily adjacent to each other, the search within regions R7 and / or R8 is performed point by point according to a list.
[416] In some embodiments, the first candidate list of the current block may be determined according to the first search region as follows. The first search region is searched using a first search step size to determine one or more first candidate vector parameters, and the one or more first candidate vector parameters are added into the first candidate list of the current block.
[417] In a specific embodiment, The first search region may be searched using a first search step size to determine one or more first candidate vector parameters as follows. Search points in the first search region are traversed according to the first search step size, and according to a preset matching criterion, a first matching cost value between a matching template corresponding to a search point in the first search region and the first template is determined. Then one or more matching search points are determined according to the first matching cost value, and the one or more first candidate vector parameters are determined according to the one or more matching search points.
[418] It should be noted that, in the embodiments of the present disclosure, the first search step size may be set to 3. In this case, the obtained first candidate list may be referred to as an initial coarse search list.
[419] It should also be noted that, in the embodiments of the present disclosure, the preset matching criterion may include any one of SAD, SATD, SSE, MAD, MAE, MSE, and NCC.
[420] In a possible implementation, the search points in the first search region may be traversed specifically as follows.
[421] For the fully reconstructed region (e.g., corresponding to the four regions R1 to R4 in FIG. 6), for each search point (iPosHor, iPoxVer) within the search region, i.e., each BV (consisting of a horizontal component and a vertical component: (pX, pY), where pX = iPosHor - xTbCmp, pY = iPosVer - yTbCmp, and pX is between bvXMins and bvXMaxs, pY is between bvYMins and bvYMaxs), a matching reconstructed block of the current block can be found in the reconstructed region, and the neighboring reconstructed samples of the matching reconstructed block are the matching template. Thus, a matching cost between the neighboring template of the current block and the neighboring template of the reconstructed block can be calculated, denoted as pDiff.
[422] For the undetermined reconstructed region (e.g., corresponding to the two regions R5 to R6 in FIG. 6), for each search point (iPosHor, iPoxVer) within the search region, i.e., each BV (consisting of a horizontal component and a vertical component: (pX, pY), where pX = iPosHor - xTbCmp, pY = iPosVer - yTbCmp, and pX is between bvXMins and bvXMaxs, pY is between bvYMins and bvYMaxs), an availability check is performed:
[423] If available, a matching reconstructed block of the current block can be found in the reconstructed region, and the neighboring reconstructed samples of the matching reconstructed block are the matching template. Thus, a matching cost between the neighboring template of the current block and the neighboring template of the reconstructed block can be calculated, denoted as pDiff.
[424] If not available, the calculation of template matching cost is not performed.
[425] The availability check includes, but is not limited to, one or more of the following conditions being satisfied:each sample within the template does not exceed a valid coordinate range limited by the sample boundary of the picture;each sample within the reconstructed block corresponding to the template does not exceed the valid coordinate range limited by the sample boundary of the picture;each sample within the template and each sample within the corresponding reconstructed block do not exceed a range specified by the search window;whether each sample within the template is in the same Tile as the current coding region;whether each sample within the reconstructed block corresponding to the template is in the same Tile as the current coding region;each sample in the template has been reconstructed;each sample in the reconstructed block corresponding to the template is not located in the current coding region;each sample in the reconstructed block corresponding to the template has been reconstructed.
[426] All available search points in all search ranges (regionId=0, 1, 2, 3, 4, 5) are traversed, and 30 search points with the minimum matching costs pDiff are obtained by comparison. The corresponding matching costs are denoted as pDiff_BEST[n], n=0, ..., 29. The corresponding BVs are denoted as the best block vectors BV_BEST[n], each being a coordinate pair (pX_BEST, pY_BEST), n=0, ..., 29. The corresponding matching templates are denoted as the best matching templates T_BEST[n], n=0, ..., 29.
[427] Thus, in the embodiments of the present disclosure, assuming the first search step size is 3, a search is performed within the first search region with a step size of 3. For example, in a search range where pX is between bvXMinsregionId and bvXMaxsregionId and pY is between bvYMinsregionId and bvYMaxsregionId, coarse search is performed with a step size of 3. Then the top P best matching costs obtained from template matching are recorded as pDiff1_BEST[p], p=0,...,P-1, and the corresponding BVs are denoted as best block vectors BV1_BEST[p], p=0,...,P-1. Here, P may be 1 or an integer value greater than 1 as needed, and the search region where the best matching search point is located is bestRegionId[p], p=0,...,P-1. In this way, the first candidate list may be constructed from the P best block vectors BV1_BEST[p].
[428] S2702, a second position block is determined according to a candidate vector parameter in the first candidate list and / or a vector parameter of a first position block of the current block.
[429] S2703, when an encoding parameter of the second position block includes a vector parameter, whether the vector parameter of the second position block satisfies a second condition is determined according to the vector parameter of the second position block.
[430] It should be noted that, in the embodiments of the present disclosure, the first position block of the current block may include a block at a spatially adjacent position and / or a spatially non-adjacent position. In addition, the number of first position blocks may be one or more.
[431] Exemplarily, for one or more predefined first position blocks, predefined search positions may be, for example, five spatially adjacent positions of the current block: left (xTbCmp-1, yTbCmp+nTbH-1), upper-left (xTbCmp-1, yTbCmp-1), upper (xTbCmp+nTbW-1, yTbCmp-1), upper-right (xTbCmp+nTbW, yTbCmp-1), and bottom-left (xTbCmp-1, yTbCmp+nTbH), and 18 spatially non-adjacent positions (specifically as illustrated in FIG. 9).
[432] It should also be noted that, in the embodiments of the present disclosure, the second position block may be determined as follows. The second position block is determined according to a candidate vector parameter in the first candidate list; and / or the second position block is determined according to a vector parameter of the first position block of the current block.
[433] That is, in the embodiments of the present disclosure, the second position block may be determined according to the candidate vector parameter in the first candidate list, or according to the vector parameter of the first position block, or according to both the candidate vector parameter in the first candidate list and the vector parameter of the first position block, which is not specifically limited herein.
[434] In some embodiments, in terms of determining the second position block according to the vector parameter of the first position block of the current block, the method may further include the following. When an encoding parameter of the first position block of the current block includes a vector parameter, according to the vector parameter of the first position block, whether the vector parameter of the first position block satisfies a first condition is determined; and when the vector parameter of the first position block satisfies the first condition, the second position block is determined according to the vector parameter of the first position block.
[435] It should be noted that, in the embodiments of the present disclosure, when the vector parameter is a BV, if a BV-based prediction technique (i.e., IBC / IntraTMP) is used for the first position block of the current block, then it can be determined that the encoding parameter of the first position block of the current block includes the vector parameter.
[436] It should also be noted that, in the embodiments of the present disclosure, the first condition may include: a cost value corresponding to the vector parameter of the first position block is better than a cost value corresponding to at least one candidate vector parameter in the first candidate list. That is, if the cost value corresponding to the vector parameter of the first position block is better than the cost value corresponding to at least one candidate vector parameter in the first candidate list, then it is determined that the vector parameter of the first position block satisfies the first condition.
[437] In some embodiments, in terms of determining that the vector parameter of the first position block satisfies the first condition, the method further includes the following. A cost value corresponding to the vector parameter of the first position block is determined according to a matching cost value between a matching template corresponding to the vector parameter of the first position block and the first template. A cost value corresponding to at least one candidate vector parameter in the first candidate list is determined according to a matching cost value between a matching template corresponding to the at least one candidate vector parameter in the first candidate list and the first template. When the cost value corresponding to the vector parameter of the first position block is less than the cost value corresponding to the at least one candidate vector parameter in the first candidate list, it is determined that the vector parameter of the first position block satisfies the first condition.
[438] It should also be noted that, in the embodiments of the present disclosure, the method further includes the following. When the vector parameter of the first position block satisfies the first condition, the first candidate list is updated according to the vector parameter of the first position block.
[439] In a specific embodiment, the first candidate list may be updated according to the vector parameter of the first position block as follows. The vector parameter of the first position block is added into the first candidate list.
[440] That is, when the vector parameter of the first position block satisfies the first condition, the first candidate list may be updated using the vector parameter of the first position block. Exemplarily, the vector parameter of the first position block may be added into the first candidate list according to the cost value, and an item with the largest cost value in the first candidate list may be deleted, to obtain an updated first candidate list.
[441] It should also be noted that, in the embodiments of the present disclosure, the method further includes the following. A search region where the vector parameter of the first position block is located is determined as R6, i.e., setting the value of bestRegionId to 6.
[442] It should also be noted that, in the embodiments of the present disclosure, during the updating process, it is first checked whether the IntraTMP / IBC technology is used for a PU corresponding to the predefined search position, i.e., whether the encoding parameter of the PU corresponding to the predefined search position includes a vector parameter is checked. If the vector parameter is included, the BV of that PU is determined, and then the first candidate list is updated using this BV. The specific updating process is as follows. Each item in the first candidate list is sequentially accessed, and a template matching cost corresponding to each BV is calculated. This cost is compared with template matching costs of the first candidate list, and if it is less than the largest cost value in the first candidate list, the worse BV in the first candidate list will be replaced with this BV. For example, the specific operation may be: inserting this BV into the first candidate list in order of cost magnitude, and deleting the item with the largest cost value from the first candidate list. The search region bestRegionId for this BV is set to 6.
[443] It can be understood that, in the embodiments of the present disclosure, the number of second position blocks may be one or more.
[444] It should also be noted that, in the embodiments of the present disclosure, the second position block represents a reference block pointed to by the vector parameter of the first position block. Alternatively, the second position block represents a block pointed to by a vector parameter of a reference block pointed to by the vector parameter of the first position block.
[445] It should also be noted that, in the embodiments of the present disclosure, still taking the vector parameter being BV as an example, if a BV-based prediction technique (i.e., IBC / IntraTMP) is used for the second position block, then it can be determined that the encoding parameter of the second position block includes the vector parameter.
[446] Exemplarily, for the second position block, the vector parameter of the first position block is used as a current BV. First, several candidate positions of the current block are determined, for example five candidate positions: center (xTbCmp+nTbW / 2, yTbCmp+nTbH / 2), upper-left (xTbCmp, yTbCmp), upper-right (xTbCmp+nTbW-1, yTbCmp), bottom-left (xTbCmp, yTbCmp+nTbH-1), and bottom-right (xTbCmp+nTbW-1, yTbCmp+nTbH-1). Then it is checked whether the BV-based prediction technique (i.e., IBC / IntraTMP) is used for a PU corresponding to each of these five candidate position coordinates plus the current BV. If the BV-based prediction technique is used, the newly obtained BV is regarded as the current BV. The above operations are repeated to determine the vector parameter of the second position block (also referred to as an “extended BV”). In other words, in the embodiments of the present disclosure, the extended BV may be a BV stored for a block pointed to by the current BV, or a BV stored for a block pointed to by the BV of the block pointed to by the current BV, etc.
[447] In some embodiments, the second condition may include: a cost value corresponding to the vector parameter of the second position block is better than a cost value corresponding to at least one candidate vector parameter in the first candidate list. That is, if the cost value corresponding to the vector parameter of the second position block is better than the cost value corresponding to at least one candidate vector parameter in the first candidate list, then it is determined that the vector parameter of the second position block satisfies the second condition.
[448] It should also be noted that, in the embodiments of the present disclosure, the method further includes the following. A cost value corresponding to the vector parameter of the second position block is determined according to a matching cost value between a matching template corresponding to the vector parameter of the second position block and the first template. A cost value corresponding to at least one candidate vector parameter in the first candidate list is determined according to a matching cost value between a matching template corresponding to the at least one candidate vector parameter in the first candidate list and the first template. When the cost value corresponding to the vector parameter of the second position block is less than the cost value corresponding to the at least one candidate vector parameter in the first candidate list, it is determined that the vector parameter of the second position block satisfies the second condition.
[449] S2704, when the vector parameter of the second position block satisfies the second condition, updating the first candidate list according to the vector parameter of the second position block.
[450] It should be noted that, in the embodiments of the present disclosure, the vector parameter of the second position block may be one or more. All vector parameters of the first position blocks may be traversed, or determination of the vector parameters of the second position block may be stopped when the number of obtained vector parameters of the second position block is greater than a first threshold.
[451] It should also be noted that, in the embodiments of the present disclosure, the first threshold may be represented by V. Exemplarily, the value of V may be 15, but may also be other values, such as 1, 2, 5, 10, etc., which is not specifically limited herein.
[452] In some embodiments, the first candidate list may be updated according to the vector parameter of the second position block as follows. The vector parameter of the second position block is added into the first candidate list.
[453] That is, when the vector parameter of the second position block satisfies the second condition, the first candidate list may be updated using the vector parameter of the second position block. Exemplarily, the vector parameter of the second position block may be added into the first candidate list according to the magnitude of the cost value, and an item with the largest cost value in the first candidate list may be deleted, to obtain an updated first candidate list.
[454] In some embodiments, the method further includes the following. The search region where the vector parameter of the second position block is located is determined as R7, i.e., the value of bestRegionId is set to 7.
[455] It should be noted that, in the embodiments of the present disclosure, for the obtained vector parameter of the first position block, first, for each current BV, five positions of the current block are determined: center (xTbCmp+nTbW / 2, yTbCmp+nTbH / 2), upper-left (xTbCmp, yTbCmp), upper-right (xTbCmp+nTbW-1, yTbCmp), bottom-left (xTbCmp, yTbCmp+nTbH-1), and bottom-right (xTbCmp+nTbW-1, yTbCmp+nTbH-1). It is checked whether the BV-based prediction technique (i.e., IBC / IntraTMP) is used for a PU corresponding to each of these five position coordinates plus the current BV. If the BV-based prediction technique is used, a sum (vector sum, i.e., adding the horizontal and vertical components separately) of a BV stored for the corresponding PU and the current BV is denoted as BV’, and the above operations are repeated for this BV’ by regarding the BV’ as the current BV, so as to determine available options of extended BVs. If the BV-based prediction technique is not used, the next position is checked. The above operations are repeated, and when all five positions have been checked or the number of determined extended BVs is greater than V, the determination of the vector parameters of the second position block is stopped.
[456] It should also be noted that, after obtaining multiple extended BVs, the first candidate list is further updated. The specific updating operation is as follows. For the multiple extended BVs, corresponding template matching costs are calculated and compared with template matching costs of BVs in the first candidate list. If a template matching cost is less than the largest template matching cost in the first candidate list, the worse BV in the first candidate list is replaced with the corresponding BV. A specific example of the replacement operation is: inserting this BV into the first candidate list in order of cost magnitude, and deleting the item with the largest cost value from the first candidate list. A search region bestRegionId for the BV newly inserted into the first candidate list is set to 7.
[457] That is, in the embodiments of the present disclosure, when the BV of the first position block (spatially adjacent position and / or non-adjacent position of the current block) is better than at least one BV in the first candidate list (the first condition), then the block pointed to by the BV of the first position block is checked. If the block pointed to by the BV of the first position block also has a BV, it is determined (based on the second condition) whether to add that BV into the first candidate list. In this case, the embodiments of the present disclosure have another feature that the first position block may contribute two candidate BVs to the first candidate list (adding one BV when the first condition is satisfied, and adding another BV when the second condition is satisfied), to obtain an updated first candidate list (i.e., the final coarse search list).
[458] In some embodiments, for updating the first candidate list, the method may further include the following. When the vector parameter of the first position block satisfies the first condition, a first candidate set of the current block is determined according to the vector parameter of the first position block, and the first candidate list is updated according to the first candidate set. When a vector parameter of a second position block satisfies the second condition, a second candidate set of the current block is determined according to the vector parameter of the second position block, and the first candidate list is updated according to the second candidate set.
[459] It should also be noted that, in the embodiments of the present disclosure, the first candidate set may be represented by IntraTMP_Merge, and the second candidate set may be represented by IntraTMP_EBVP.
[460] It should also be noted that, in some embodiments, the first candidate list may be updated according to the first candidate set as follows. A cost value corresponding to a second candidate vector parameter in the first candidate set is determined, and a maximum cost value corresponding to one or more candidate vector parameters in the first candidate list is determined. When the cost value corresponding to the second candidate vector parameter is smaller than the maximum cost value in the first candidate list, the candidate vector parameter corresponding to the maximum cost value in the first candidate list is replaced with the second candidate vector parameter, thus updating the first candidate list. The second candidate vector parameter is any one vector parameter in the first candidate set.
[461] In a specific embodiment, the candidate vector parameter corresponding to the maximum cost value in the first candidate list may be replaced with the second candidate vector parameter as follows. The second candidate vector parameter is added into the first candidate list, and the candidate vector parameter corresponding to the maximum cost value from the first candidate list is deleted.
[462] Exemplarily, in the embodiments of the present disclosure, the construction process of the IntraTMP_Merge set (or IntraTMP_Merge list) may specifically be as follows. Whether the IntraTMP / IBC technology is used for PUs corresponding to these positions is checked. If the IntraTMP / IBC technology is used for a PU, a BV of that PU is stored into the IntraTMP_Merge set. After constructing the IntraTMP_Merge set, the first candidate list is updated according to the IntraTMP_Merge set. The specific updating operation is: sequentially accessing each item in the IntraTMP_Merge set, calculating a template matching cost corresponding to each BV, comparing this cost with template matching costs of the first candidate list, and if this cost is less than the largest template matching cost in the first candidate list, replacing the worse BV in the first candidate list with that BV. An example of the specific replacement operation is: inserting this BV into the first candidate list in order of cost magnitude, and deleting the item with the largest cost value from the first candidate list. A search region bestRegionId for the BV is set to 6.
[463] It should be noted that, in the embodiments of the present disclosure, after updating the first candidate list according to the first candidate set, the second position block may be determined according to at least part of the candidate vector parameters in the updated first candidate list. When the vector parameter of the second position block satisfies the second condition, the second candidate set of the current block is constructed according to the vector parameter of the second position block.
[464] In a possible implementation, the at least part of the candidate vector parameters in the updated first candidate list may be one or more second candidate vector parameters that were updated from the first candidate set into the first candidate list. Therefore, in some embodiments, the second candidate set of the current block may be determined as follows. One or more second candidate vector parameters updated from the first candidate set to the first candidate list are determined. The second position block is determined according to the one or more second candidate vector parameters. The second candidate set of the current block is determined according to the vector parameter of the second position block.
[465] In another possible implementation, the at least part of the candidate vector parameters in the updated first candidate list may be all candidate vector parameters in the updated first candidate list. Therefore, in some embodiments, the second candidate set of the current block may be determined as follows. After the first candidate list is updated according to the first candidate set, the second position block is determined according to all candidate vector parameters in the first candidate list, and the second candidate set of the current block is determined according to the vector parameter of the second position block.
[466] In another possible implementation, the at least part of the candidate vector parameters in the updated first candidate list may be a preset number of candidate vector parameters in the updated first candidate list. Therefore, in some embodiments, the second candidate set of the current block may be determined as follows. After the first candidate list is updated according to the first candidate set, first N candidate vector parameters in the first candidate list are determined. The second position block is determined according to the N candidate vector parameters. The second candidate set of the current block is determined according to the vector parameter of the second position block. Here, N is a positive integer.
[467] It should be noted that, in the embodiments of the present disclosure, the method further includes the following. A value of N is determined according to a size parameter of the current block. That is, the number of checks may be limited according to the size of the current block. Exemplarily, for a current block with a size less than or equal to 16×16, the first 5 are checked; for other sizes, the first 10 are checked.
[468] In yet another possible implementation, the second candidate set of the current block may be determined as follows. After the first candidate list is updated according to the first candidate set, clustering is performed on the first candidate list to determine M candidate vector parameters at cluster centers. The second position block is determined according to the M candidate vector parameters. The second candidate set of the current block is determined according to the vector parameter of the second position block. Here, M is a positive integer.
[469] It should also be noted that, in the embodiments of the present disclosure, for the construction of the IntraTMP_EBVP set (or IntraTMP_EBVP list), only all BVs in the IntraTMP_Merge set that have been added into the first candidate list may be checked. Alternatively, an EBVP-based update may be performed on all candidates in the updated first candidate list.
[470] In addition, in the embodiments of the present disclosure, the BVs to be checked and the number thereof in the IntraTMP_EBVP list may also be adjusted. Exemplarily, the first 5 in the corresponding BV set may be checked, or the first 10 in the corresponding BV set may be checked. Alternatively, the number of checks may be limited according to the size of the current block. For examples, for a CU with a size less than or equal to 16×16, the first 5 are checked; for other sizes, the first 10 are checked. Alternatively, clustering may be performed on the updated first candidate list, with the clustering rule being the geometric distance to the cluster center. The number of cluster centers is 2 to 5, and EBVP operations are performed, for example, only on the cluster centers.
[471] In yet another possible implementation, the second candidate set may not be constructed. The method further includes the following. When the first candidate set of the current block is not full, the vector parameter of the second position block is filled into the first candidate set until the first candidate set is full, and the first candidate list is updated according to the first candidate set that is full.
[472] That is, in the embodiments of the present disclosure, it is also possible to add EBVP BVs after the IntraTMP_Merge set until the IntraTMP_Merge set is full, and then update the first candidate list with this IntraTMP_Merge set, i.e., the number is limited to the number of unfilled items in the IntraTMP_Merge set.
[473] Exemplarily, in the embodiments of the present disclosure, after the first candidate list is updated according to the IntraTMP_Merge set, for each BV that has been added from the IntraTMP_Merge set into the first candidate list, an IntraTMP_EBVP set is constructed and the first candidate list is updated again according to this IntraTMP_EBVP set.
[474] Firstly, for each current BV, its corresponding IntraTMP_EBVP set is constructed from scratch. Five positions of the current CU are determined: center (xTbCmp+nTbW / 2, yTbCmp+nTbH / 2), upper-left (xTbCmp, yTbCmp), upper-right (xTbCmp+nTbW-1, yTbCmp), bottom-left (xTbCmp, yTbCmp+nTbH-1), and bottom-right (xTbCmp+nTbW-1, yTbCmp+nTbH-1). For a PU corresponding to one of these five position coordinates plus the current BV, whether the BV-based prediction technique (i.e., IBC / IntraTMP) is used for the PU is checked. If the BV-based prediction technique is used for the PU, a sum (vector sum, i.e., adding the horizontal and vertical components separately) of a BV stored for the corresponding PU and the current BV is denoted as BV’ and added into the TMP_EBVP list. Then the above operation is repeated for this BV’ by regarding the BV’ as the current BV, to continue constructing available options in the TMP_EBVP list. If the BV-based prediction technique is not used for the PU, the next position is checked.
[475] In some embodiments, the method further includes the following. When all vector parameters of the second position blocks have been traversed or when the number of candidate vector parameters in the second candidate set is greater than a first threshold, it is determined that the construction of the third candidate set is completed.
[476] It should be noted that, in the embodiments of the present disclosure, the first threshold may be represented by V, in other words, the length of the second candidate set is V. Exemplarily, V may has a value of 15. Alternatively, the length V of the IntraTMP_EBVP set may change to another value, for example, the value of V is limited to 1, 2, 5, or 10.
[477] In this way, the above operations are repeated until all five positions have been checked or the number of IntraTMP_EBVP sets being constructed is greater than V, thereby completing the construction of the current IntraTMP_EBVP set.
[478] In some embodiments, after the construction of the second candidate set is completed, the method further includes the following. According to a preset matching criterion, a second matching cost value between a matching template corresponding to a third candidate vector parameter in the second candidate set and the first template is determined. When the second matching cost value is greater than a second threshold, the third candidate vector parameter is deleted from the second candidate set to update the second candidate set. The third candidate vector parameter is any one vector parameter in the second candidate set.
[479] In the embodiments of the present disclosure, the preset matching criterion may include any one of Sum of Absolute Differences (SAD), Sum of Absolute Transformed Differences (SATD), Sum of Squared Errors (SSE), Mean Absolute Difference (MAD), Mean Absolute Error (MAE), Mean Squared Error (MSE), and Normalized Cross Correlation (NCC). That is, a cost threshold may be imposed based on the template cost (e.g., SAD, SATD, etc.) corresponding to the BV. The template cost is first calculated for each BV in the second candidate set, and only BVs not exceeding the threshold are added to the IntraTMP_EBVP set to obtain the final second candidate set.
[480] In some embodiments, the first candidate list may be updated according to the second candidate set as follows. A cost value corresponding to a third candidate vector parameter in the second candidate set is determined, and a maximum cost value corresponding to one or more candidate vector parameters in the first candidate list is determined. When the cost value corresponding to the third candidate vector parameter is smaller than the maximum cost value in the first candidate list, the candidate vector parameter corresponding to the maximum cost value in the first candidate list is replaced with the third candidate vector parameter, to update the first candidate list. Here, the third candidate vector parameter is any one vector parameter in the first candidate set.
[481] In a specific embodiment, the candidate vector parameter corresponding to the maximum cost value in the first candidate list may be replaced with the second candidate vector parameter as follows. The third candidate vector parameter is added into the first candidate list, and the candidate vector parameter corresponding to the maximum cost value is deleted from the first candidate list.
[482] Exemplarily, in the embodiments of the present disclosure, after the construction of the current IntraTMP_EBVP set is completed, the first candidate list is updated. The specific updating operation is as follows. Each BV in this IntraTMP_EBVP set is accessed to calculate a corresponding template matching cost, and this cost is compared with the template matching costs of the BVs in the first candidate list. If this cost is less than the largest template matching cost in the first candidate list, the worse BV in the first candidate list is replaced with that BV. An example of the replacement operation is: inserting this BV into the first candidate list in order of cost magnitude, and deleting the item with the largest cost value from the first candidate list. A search region bestRegionId for the BV newly inserted into the first candidate list is set to 7.
[483] It should also be noted that, in the embodiments of the present disclosure, the extension may not be used in conjunction with the IntraTMP_Merge set, i.e., may be performed based solely on the BVs obtained by direct search within the search window in IntraTMP.
[484] It should also be noted that, in the embodiments of the present disclosure, it is also possible to perform a single search, without dividing into coarse search and fine search steps, and then BV options may be extended based on the single search result to obtain the final BV result.
[485] In some embodiments, for updating the first candidate list, the method further includes the following. First K candidate vector parameters in the first candidate set are determined, and the first candidate list is updated according to the first K candidate vector parameters. Here, K is a positive integer.
[486] That is, in the embodiments of the present disclosure, only the first K (e.g., K may be 5) in the IntraTMP_Merge set are used to update the coarse search list, and extension is performed only on the basis of the BVs in the IntraTMP_Merge set.
[487] In some embodiments, for updating the first candidate list, the method further includes the following. First P candidate vector parameters in the first candidate set are determined. The second position block is determined according to the P candidate vector parameters, and the vector parameter of the second position block is determined. When the vector parameter of the second position block satisfies the second condition, a fourth candidate set of the current block is constructed according to the vector parameter of the second position block, and it is determined that the construction of the fourth candidate set is completed when all P candidate vector parameters have been traversed or when the fourth candidate set is full. A cost value corresponding to one or more candidate vector parameters in the fourth candidate set is determined, and Q candidate vector parameters are selected from the fourth candidate set according to the cost value corresponding to the one or more candidate vector parameters. The first candidate list is updated according to the Q candidate vector parameters. Here, P and Q are positive integers.
[488] That is, in the embodiments of the present disclosure, it is also possible to use IntraTMP_Merge and IntraTMP_EBVP together to maintain a merge set or list. Exemplarily, the first P items (e.g., P may be 5) of the IntraTMP_Merge set may be firstly taken to perform IntraTMP_EBVP extension, so as to construct a new merge set of length L (e.g., L may be 28). When the extended BVs fill the new merge set or the extension of the P BVs is completed, costs of BVs in the new merge set are calculated and sorted, and then the first Q items (e.g., Q may be 5) of the sorted list are taken to update the first candidate list.
[489] S2705, a second search region is determined according to a candidate vector parameter in the updated first candidate list, and a vector parameter of the current block is determined according to the second search region.
[490] It should be noted that, in the embodiments of the present disclosure, after obtaining the final coarse search list, a fine search may be performed for that coarse search list. That is, the search process in the embodiments of the present disclosure may be first performing a coarse search and then performing a fine search.
[491] It should also be noted that, in the embodiments of the present disclosure, the second search region here is a fine search region. In some embodiments, the second search region may be determined according to the candidate vector parameter in the updated first candidate list as follows. A starting position of the second search region is determined based on the candidate vector parameter in the first candidate list. The starting position is offset by a first preset range in both the vertical direction and the horizontal direction, and the obtained sample region is determined as the second search region.
[492] In the embodiments of the present disclosure, firstly, the starting position of the second search region (i.e., the fine search starting point) is determined. Here, the fine search starting point may be set as coordinate [0,0], and then offset by the first preset range in both the vertical direction and the horizontal direction to obtain the second search region.
[493] In the embodiments of the present disclosure, the first preset range may be [-2,2]. In this case, the second search region is the obtained 5×5 sample region. In addition, the first preset range may also be other preset ranges, such as [-1,1], [-3,3], [-4,4], [-5,5], etc. In these cases, the second search region is the correspondingly obtained sample region. In addition, it should be noted that the offset ranges in the vertical and horizontal directions may be the same or different. For example, the offset range in the horizontal direction may be [-2,2], and the offset range in the vertical direction may be [-3,3].
[494] That is, the second search region may be a square, i.e. the offset ranges in the vertical and horizontal directions are the same; or the search region may be a non-square, i.e. the offset ranges in the vertical and horizontal directions are different, which is not limited in any way.
[495] In the embodiments of the present disclosure, different first preset ranges yield different second search regions. In some embodiments, the method may include the following. When the first preset range is [-1,1], the second search region may be the obtained 3×3 sample region, as illustrated in FIG. 10. Alternatively, when the first preset range is [-2,2], the second search region may be the obtained 5×5 sample region, as illustrated in FIG. 21. Alternatively, when the first preset range is [-3,3], the second search region may be the obtained 7×7 sample region, as illustrated in FIG. 22. Alternatively, when the first preset range is [-4,4], the second search region may be the obtained 9×9 sample region, as illustrated in FIG. 23. Alternatively, when the first preset range is [-5,5], the second search region may be the obtained 11×11 sample region, as illustrated in FIG. 11.
[496] That is, for the case where the search region is 7, both TmpRefineRangeHor and TmpRefineRangeVer may be set to 2. That is, the fine search starting position is coordinate [0,0], with the vertical and horizontal coordinates offset within the range of [-2,2], i.e., a 5×5 sample region, and a point-by-point full search is performed within this range.
[497] Exemplarily, for a 5×5 sample region, code description is as follows:for (dY=-2; dY <=2; dY ++){for (dX=-2; dX<=2; dX ++){if(sadArray[dX+2][dY+2] < minSad){minSad = sadArray[dX+2][dY+2];intOffX = dX;intOffY = dY;}}}
[498] Here, intOffX represents an integer-sample offset in the horizontal direction, and intOffY represents an integer-sample offset in the vertical direction.
[499] In some embodiments, the method may also be used in combination with a first prediction mode. In some embodiments, the method may further include the following. When the first prediction mode is used for the current block, it is determined that the second search region is within the 5×5 sample region obtained when the first preset range is [-2,2]. Further, in some embodiments, the method further includes the following. When the first prediction mode is not used for the current block, it is determined that the second search region is within a sample region obtained when a preset range other than the first preset range of [-2,2] is used.
[500] In a specific embodiment, when the first prediction mode is not used for the current block, it may be determined that the second search region is within the 7×7 sample region obtained when the first preset range is [-3,3].
[501] In the embodiments of the present disclosure, the third syntax element may be set. The third syntax element may be used to indicate whether the first prediction mode is used for the current block. In some embodiments, the method may further include the following. A value of the third syntax element is determined. The value of the third syntax element is encoded, and the obtained encoding bits are signalled into a bitstream.
[502] It should be noted that the embodiments of the present disclosure, if the first prediction mode is used for the current block, the value of the third syntax element is determined as a first preset value; if the first prediction mode is not used for the current block, the value of the third syntax element is determined as a second preset value.
[503] It should also be noted that, in the embodiments of the present disclosure, the first preset value is different from the second preset value. The first preset value may be set to 1, and the second preset value may be set to 0; or the first preset value may be set to 0, and the second preset value may be set to 1; or the first preset value may be set to true, and the second preset value may be set to false; or the first preset value may be set to false, and the second preset value may be set to true.
[504] It should also be noted that, in the embodiments of the present disclosure, the first prediction mode may be the IntraTMP-LIC mode, but is not limited thereto. Exemplarily, the first preset value may be set to 1, and the second preset value may be set to 0. When used in combination with the IntraTMP-LIC mode, as illustrated in FIG. 24, when the IntraTMP-LIC mode is chosen for the current block, the fine search range is a 5×5 sample region with the fine search starting position as coordinate [0,0] and the vertical and horizontal coordinates offset within the range of [-2,2], specifically as illustrated in (a) of FIG. 24. Otherwise, when the IntraTMP-LIC mode is not chosen for the current block, the fine search range is a 7×7 sample region with the fine search starting position as coordinate [0,0] and the vertical and horizontal coordinates offset within the range of [-3,3], specifically as illustrated in (b) of FIG. 24. Here, when the IntraTMP-LIC mode is not chosen for the current block, the fine search range may also correspond to other preset regions, such as the cases illustrated in FIG. 10, FIG. 11, FIG. 21, or FIG. 23. Subsequently, a point-by-point full search may be performed within this range. It should be noted that this method is similar to the processing in the case where regionId is 6 and the IntraTMP-LIC mode is enabled.
[505] In some embodiments, the vector parameter of the current block may be determined according to the second search region as follows. The vector parameter of the current block is determined by searching within the second search region using a second search step size. Here, the value of the second search step size is smaller than the value of the first search step size.
[506] It should be noted that, in the embodiments of the present disclosure, the second search step size may be 1, but may also be another value. Here, the second search step size needs to be smaller than the value of the first search step size in the coarse search stage.
[507] It should also be noted that, in the embodiments of the present disclosure, the second search step size being 1 may mean that a point-by-point full search is performed within the second search region to determine the vector parameter of the current block.
[508] In a specific embodiment, the best block vector BV1_BEST[p], p=0,...,M-1, obtained in the first candidate list, is used as a fine search reference point, and searching is performed near the fine search reference point.
[509] For each fine search reference point, firstly, the position of the optimal matching reconstructed block obtained from the coarse search is used as the reference position of the fine search region: BestPosX = xTbCmp + pX1_BEST, BestPosY = yTbCmp + pY1_BEST. Then, the refinement search ranges TmpRefineRangeHor and TmpRefineRangeVer are determined. The refinement search ranges may be fixed in size or may be related to the search region.
[510] Exemplarily, for reference points within search region 0 to 5, both TmpRefineRangeHor and TmpRefineRangeVer may be set to 1. That is, for the case where regionId is 0 to 5, the fine search range is a 3×3 sample region with the fine search starting position as the coordinate [0,0] and the vertical and horizontal coordinates offset within the range of [-1,1]. A point-by-point full search is performed within this range, as illustrated in FIG. 10 described above.
[511] For a reference point within search region 6, both TmpRefineRangeHor and TmpRefineRangeVer may be set to 5. That is, for the case where regionId is 6, the fine search range is an 11×11 sample region with the fine search starting position as the coordinate [0,0] and the vertical and horizontal coordinates offset within the range of [-5,5]. A point-by-point full search is performed within this range, as illustrated in FIG. 11 described above.
[512] For a search region of 7: both TmpRefineRangeHor and TmpRefineRangeVer may be set to 2. That is, the fine search range is a 5×5 sample region with the fine search starting position as the coordinate [0,0] and the vertical and horizontal coordinates offset within the range of [-2,2], as illustrated in FIG. 21 described above. A point-by-point full search is performed within this range. It should be noted that this method is consistent with the processing in the case where regionId is 6 and the flag of the IntraTMP-LIC mode is true when the IntraTMP-LIC mode is enabled.
[513] The fine search region is regarded as an entire undetermined reconstructed region and traversed directly by using the search window.
[514] A new search range according to the best matching block position obtained from the coarse search, is obtained as follows:iHorMaxrefine = min(picWidth - nTbW, BestPosX + TmpRefineRangeHor);iHorMinrefine = max(iTemplateSizeW, BestPosX - TmpRefineRangeHor);iVerMaxrefine = min(picHeight - nTbH, BestPosY + TmpRefineRangeVer);iVerMinrefine= max(iTemplateSizeH, BestPosY - TmpRefineRangeVer).
[515] Then, the adjusted block vector BV bvXMins, bvXMaxs, bvYMins, bvYMaxs can be calculated from iVerMinrefine, iVerMaxrefine, iHorMinrefine, iHorMaxrefine as follow:bvXMins = iHorMinrefine – xTbCmp;bvXMaxs = iHorMaxrefine – xTbCmp;bvYMins = iVerMinrefine – yTbCmp;bvYMaxs = iVerMaxrefine – yTbCmp.
[516] The fine search is performed within the block vector range where pX is between bvXMinsrefine and bvXMaxsrefine, and pY is between bvYMinsrefine and bvYMaxsrefine, i.e., directly traverse all search positions within the fine search window, sequentially performing availability checks. For example, the second search step size is 1, and top T best matching costs of available points from template matching are denoted as pDiff_BEST[t], t=0,...,T-1, and the corresponding BVs are denoted as best BVs BV_BEST[t], t=0,...,T-1, where T is 1 or an integer greater than 1. For example, T=1.
[517] It should also be noted that, in the embodiments of the present disclosure, a sub-sample position search may be further performed on the above basis. In some embodiments, the method may further include the following. After the point-by-point full search within the second search region, a new candidate vector parameter of the current block is determined. A sub-sample search is performed based on the new candidate vector parameter to determine the vector parameter of the current block.
[518] In a possible implementation, after the point-by-point full search within the second search region, the new candidate vector parameter of the current block may be determined as follows. According to a preset matching criterion, third matching cost values between matching templates corresponding to multiple search points in the second search region and the first template of the current block are determined. A minimum matching cost value is determined from the third matching cost values of the multiple search points, and the new candidate vector parameter is determined according to a search point corresponding to the minimum matching cost value.
[519] That is, in the embodiments of the present disclosure, within a certain fine search list range (e.g., the second search region), the costs of the searched integer-sample position are compared one by one to determine the position with the minimum cost, thereby determining the new candidate vector parameter.
[520] It should also be noted that, in the embodiments of the present disclosure, the preset matching criterion may include any one of Sum of Absolute Differences (SAD), Sum of Absolute Transformed Differences (SATD), Sum of Squared Errors (SSE), Mean Absolute Difference (MAD), Mean Absolute Error (MAE), Mean Squared Error (MSE), or Normalized Cross Correlation (NCC).
[521] In some embodiments, the sub-sample search may be performed based on the new candidate vector parameter to determine the vector parameter of the current block as follows. A third search region indicated by the new candidate vector parameter is determined. An initial direction of the sub-sample search is determined by searching based on multiple candidate positions in the third search region. A fourth search region is determined based on the initial direction of the sub-sample search, and a sub-sample position index and a direction index of the current block are determined by searching according to multiple candidate positions in the fourth search region. The vector parameter of the current block is determined according to the sub-sample position index and the direction index.
[522] It should be noted that, in the embodiments of the present disclosure, the third search region indicated by the new candidate vector parameter may be determined as follows. A starting position of the third search region is determined based on the new candidate vector parameter. Multiple candidate positions obtained by performing a half-sample position search based on the starting position are determined as the third search region.
[523] It should also be noted that, in the embodiments of the present disclosure, the initial direction of the sub-sample search may be determined by searching based on the multiple candidate positions in the third search region as follows. According to a preset matching criterion, fourth matching cost values between matching templates corresponding to the multiple candidate positions in the third search region and the first template of the current block are determined. The fourth matching cost values corresponding to the multiple candidate positions are sorted in ascending order to determine the top-ranked H matching cost values. The initial direction of the sub-sample search is determined according to candidate positions corresponding to the H matching cost values. Here, H is a positive integer.
[524] It should be noted that, in the embodiments of the present disclosure, when performing the half-sample position search based on the starting position, eight directions with offsets of -1 / 2 and 1 / 2 in the vertical and horizontal directions may be used, resulting in eight candidate positions. Then the third search region may be determined from these eight candidate positions. In addition, in the embodiments of the present disclosure, the value of H may be set to 4, i.e., the first four candidate directions with relatively smaller cost values may be selected as the initial directions for the sub-sample search.
[525] It should also be noted that, in the embodiments of the present disclosure, the sub-sample search range is always within (-1,1). Here, 1 / 2 is the furthest value reached within this range for half-sample precision, and 3 / 4 is the furthest value reached within this range for 1 / 4-sample precision.
[526] Exemplarily, the starting position of the sub-sample search is coordinate [0,0], and eight directions with vertical and horizontal coordinate offsets of -1 / 2 and 1 / 2 are considered. The eight candidate positions are compared in terms of cost, and the first four directions with smaller costs are determined as initial directions for the sub-sample search.
[527] In some embodiments, the fourth search region may be determined based on the initial direction of the sub-sample search as follows. A sub-sample position search is performed based on the starting position and the initial direction of the sub-sample search, and the obtained multiple candidate positions are determined as the fourth search region.
[528] It should be noted that, in the embodiments of the present disclosure, when performing the sub-sample position search based on the starting position and the initial direction of the sub-sample search, the search may be performed within the range of [-3 / 4, 3 / 4] offsets in the vertical and horizontal directions, among multiple 1 / 4-sample precision positions. For example, when the initial directions are the first four directions, there may be 10 to 12 corresponding candidate positions. In some embodiments, the sub-sample position index and the direction index of the current block may be determined as follows. According to a preset matching criterion, fifth matching cost values between matching templates corresponding to multiple candidate positions in the fourth search region and the first template of the current block are determined. A minimum matching cost value is determined from the fifth matching cost values of the multiple candidate positions. The sub-sample position index and the direction index of the current block are determined according to a candidate position corresponding to the minimum matching cost value.
[529] It should also be noted that, in the embodiments of the present disclosure, the sub-sample position index may be represented by tmpIsSubPel, and the direction index may be represented by tmpSubIdx. Exemplarily, tmpIsSubPel may have four values, respectively corresponding to the integer-sample position (0), the 1 / 2-sample position (1), the 1 / 4-sample position (2 or 3), and the 3 / 4-sample position (2 or 3), where the values for 1 / 4 and 3 / 4 positions are related to the interpolation position. tmpSubIdx may have eight values, respectively corresponding to eight directions: left (0), right (1), upper (2), bottom (3), upper-left (4), upper-right (5), bottom-left (6), and bottom-right (7).
[530] In addition, it should be noted that when determining the fourth search region, the offset ranges in the vertical and horizontal directions may be the same or different. For example, the offset range in the horizontal direction may be [-3 / 4, 3 / 4], and the offset range in the vertical direction may be [-1 / 2, 1 / 2]. That is, for the fourth search region, the search region may be a square, meaning that the offset ranges in the vertical and horizontal directions are the same; or the search region may be a non-square, meaning that the offset ranges in the vertical and horizontal directions are different, which is not limited herein.
[531] Exemplarily, the starting position of the sub-sample search is coordinate [0,0], the first four directions determined above are offset by the range of [-3 / 4, 3 / 4] in the vertical and horizontal coordinates, and the search is performed among multiple 1 / 4-sample precision positions. Specifically, 10 to 12 candidate positions are compared in terms of cost, and a position with the minimum cost is determined to obtain the sub-sample position index tmpIsSubPel and the final direction index tmpSubIdx.
[532] In this way, values (Dx, Dy) of the sub-sample position coordinates can be obtained from tmpIsSubPel and tmpSubIdx, and then the best matching coordinates are updated.
[533] After completing the above operations, the results of the coarse selection and fine selection (where the fine selection process includes one or more reference point searches) are combined to obtain one or more best block vectors BV_BEST[n], n=0,...,N-1, for different algorithm requirements, where each item is a coordinate pair (pX_BEST, pY_BEST). Here, pX_BEST and pY_BEST are the horizontal and vertical offsets of the best matching template relative to the template of the current coding block, respectively, and are also the horizontal and vertical offsets of the best matching reconstructed block relative to the current coding block.
[534] In some embodiments, for determining the vector parameter of the current block by performing the sub-sample search based on the new candidate vector parameter, the method may further include the following. A starting position of the sub-sample search and multiple candidate positions around the starting position are determined. Cost values respectively corresponding to the multiple candidate positions are calculated, and a preset cost model is constructed according to the multiple candidate positions and the corresponding cost values. The preset cost model is used to indicate a mapping relationship between candidate positions and cost values. According to the preset cost model, a candidate position corresponding to a minimum cost value is determined, and the candidate position corresponding to the minimum cost value is determined as the vector parameter of the current block.
[535] That is, for the sub-sample search, the position with the minimum cost may also be solved by building a model. For example, take the starting position of the sub-sample search as the center, a few coordinate points around the center are selected to build a model using the cost values at these points. The position corresponding to the minimum value of the model is solved and selected as the search result.
[536] Exemplarily, taking a quadratic model as an example, assume that the relationship between Vcost and the positions near MVint is as illustrated in formula (9) above. Here, (xmin, ymin) is the sub-sample position where Vcost is minimized, and A, B, C are model parameters. The model parameters A, B, C, xmin, ymin can be solved using the Vcost at the position corresponding to MVint and its four neighboring positions (top, bottom, left, right). Suppose the Vcost at the position corresponding to MVint is Vcost(0,0), and the Vcost at the top, bottom, left, and right positions are Vcost(0,-1), Vcost(0,1), Vcost(-1,0), Vcost(1,0), respectively.
[537] The calculation methods for xmin and ymin are as illustrated in formula (10) and formula (11) above. Here, the search result may be stored in units such as half-sample, 1 / 4 luma integer-sample, 1 / 8 luma integer-sample, or 1 / 16 luma integer-sample as needed.
[538] In addition, Vcost may be calculated according to a preset cost function, for example, Sum of Absolute Differences (SAD), Sum of Absolute Transformed Differences (SATD), Mean Squared Error (MSE), Sum of Squared Differences (SSD), Mean Absolute Difference (MAD), Mean Squared Difference (MSD), Normalized Cross Correlation (NCC), etc.
[539] It should also be noted that, in the embodiments of the present disclosure, the sub-sample search may also be a search among multiple half-sample positions. That is, with the starting position of the sub-sample search as coordinate [0,0], a square region with vertical and horizontal coordinate offsets within the range of [-1 / 2, 1 / 2] is used, and 9 candidate positions are compared in terms of cost, as illustrated in FIG. 25. Alternatively, the sub-sample search may be a search among multiple 1 / 4-sample precision positions. That is, with the starting position of the sub-sample search as coordinate [0,0], a square region with vertical and horizontal coordinate offsets within the range of [-3 / 4, 3 / 4] is used, and 49 candidate positions are compared in terms of cost, as illustrated in FIG. 26. The present disclosure is not limited thereto.
[540] It should also be noted that, in the embodiments of the present disclosure, for different search steps, the cost function may be of the same type, e.g., SAD, or may be of different types, e.g., SAD for coarse search, SAD or SATD for fine search, and SAD, SATD, SSE, etc. for sub-sample search, which is not specifically limited herein.
[541] S2706, a prediction value of the current block is determined according to the vector parameter of the current block.
[542] It should be noted that, in the embodiments of the present disclosure, there may be one or more vector parameters of the current block. Here, if there are multiple vector parameters of the current block, the prediction value of the current block may be determined by performing weighted fusion on using the positions corresponding to the multiple BVs.
[543] In some embodiments, if there is one vector parameter of the current block, the prediction value of the current block is determined according to the vector parameter of the current block as follows. A reference block of the current block is determined according to the vector parameter of the current block, and the prediction value of the current block is determined according to the reference block.
[544] Exemplarily, in the embodiments of the present disclosure, the reference block of the current block may be determined by a simple translation copy. The specific operation is: for x=0...nTbW-1, y=0...nTbH-1, determining reconstructed samples recSamples of the current frame (i.e., the reference block of the current block) by RefBlockn [x][y] = recSamples[x + pXn][y + pYn].
[545] It should be noted that, in the embodiments of the present disclosure, when determining the reference block of the current block according to the vector parameter of the current block, an initial reconstructed block of the current block may be determined according to the vector parameter of the current block, and then the initial reconstructed block may be refined to determine the reference block of the current block. Alternatively, the reference block may be filtered to determine a filtered reference block, and the prediction value of the current block may be determined according to the filtered reference block.
[546] It should also be noted that, in the embodiments of the present disclosure, the prediction value determined by the vector parameter of the current block may be used as the final prediction value, or may be further refined (e.g., through a clip operation) to determine the final prediction value of the current block.
[547] In some embodiments, when determining the prediction value of the current block according to the reference block, the method may include the following. A first prediction block of the current block is determined according to the reference block. A second prediction block of the current block is determined by performing prediction on the current block according to a second prediction mode, where the second prediction mode is a mode other than an intra template matching prediction mode. The prediction value of the current block is determined according to the first prediction block and the second prediction block.
[548] It should be noted that, in the embodiments of the present disclosure, the second prediction mode may be a prediction mode different from the intra template matching prediction mode used for the current block, such as PLANAR mode, CCLM mode, angular prediction mode, etc. Here, the first prediction block and the second prediction block may be weighted and fused to determine the prediction value of the current block.
[549] That is, in the embodiments of the present disclosure, when determining the prediction value of the current block, the prediction value may be refined by local filtering, or may be refined by weighting multiple prediction values, etc.
[550] In some embodiments, when there are multiple vector parameters of the current block, the prediction value of the current block may be according to the vector parameters of the current block as follows. Multiple reference blocks of the current block are determined according to the multiple vector parameters of the current block, and the prediction value of the current block is determined according to the multiple reference blocks.
[551] It should also be noted that, in the embodiments of the present disclosure, the prediction value of the current block may be determined according to the multiple reference blocks as follows. Multiple prediction blocks of the current block are determined according to the multiple reference blocks; and weighted fusion is performed on the multiple prediction blocks to determine the prediction value of the current block.
[552] It can be understood that, in the IntraTMP mode, in addition to the basic copy method for obtaining the prediction value, there are also a method of obtaining the prediction value by filtering and fusing the positions corresponding to multiple BVs, and a method of fusing with the normal Intra mode.
[553] In some embodiments, for determining the prediction value of the current block according to the vector parameter of the current block, the method may further include the following. A prediction-value construction mode of the current block is determined. The prediction value of the current block is determined according to the vector parameter of the current block and the prediction-value construction mode.
[554] In a specific embodiment, the prediction-value construction mode of the current block may be determined as follows. A candidate list of prediction-value construction modes of the current block is determined, where the candidate list includes at least one candidate prediction-value construction mode. Cost calculation is performed for the at least one candidate prediction-value construction mode separately to determine at least one cost result. A minimum cost result is determined from the at least one cost result, and a candidate prediction-value construction mode corresponding to the minimum cost result is determined as the prediction-value construction mode of the current block.
[555] It should be noted that in the embodiments of the present disclosure, the cost result may be determined using a distortion value. Specifically, the cost result may be determined by a rate-distortion cost. However, the criterion for cost determination may also be SAD, MSE, SSE, or the like, which is not specifically limited herein.
[556] In some embodiments, the method may further include the following. A value of a first syntax element is determined, where the value of the first syntax element is used to indicate an index of the prediction-value construction mode of the current block in the candidate list of prediction-value construction modes. The value of the first syntax element is encoded, and a resulting encoded bit is signalled into the bitstream.
[557] That is, when determining the prediction value of the current block, the candidate list of prediction-value construction modes may be determined by using various single prediction values, filtered prediction values, weighted prediction values, and / or prediction-value construction modes of these prediction values, and the syntax element in the bitstream may be transmitted to the decoding side, such that the decoding side can decode the bitstream to determine which item in the candidate list of prediction-value construction modes to use to obtain the actual prediction value.
[558] In some embodiments, the method further includes the following. A value of a second syntax element is determined. The value of the second syntax element is encoded, and a resulting encoded bit is signalled into the bitstream.
[559] It should be noted that in the embodiments of the present disclosure, the value of the second syntax element is used to indicate whether an intra template matching prediction mode is used for the current block. If the intra template matching prediction mode is used for the current block, the value of the second syntax element is determined as a first preset value. If the intra template matching prediction mode is not used for the current block, the value of the second syntax element is determined as a second preset value.
[560] In the embodiments of the present disclosure, the first preset value is different from the second preset value. The first preset value may be set to 1, and the second preset value may be set to 0; or the first preset value may be set to 0, and the second preset value may be set to 1; or the first preset value may be set to true, and the second preset value may be set to false; or the first preset value may be set to false, and the second preset value may be set to true. For example, here, the first preset value is set to 1 and the second preset value is set to 0.
[561] It should also be noted that in the embodiments of the present disclosure, when the intra template matching prediction mode is used for the current block, the step of determining the first candidate list for the current block is performed, that is, the encoding method illustrated in FIG. 17 is performed. In other words, the method in the embodiments of the present disclosure is applied to the intra template matching prediction mode.
[562] That is, in the IntraTMP mode, in addition to the basic copy method for obtaining the prediction value, there are also a method of obtaining the prediction value by fusing positions corresponding to multiple BVs, a method of copying after filtering the reference block corresponding to a BV, and a method of interpolating the reference block corresponding to a BV by sub-sample and then copying. Exemplarily, after obtaining a BV candidate list by template matching during the region search at the decoding end, the first N items (e.g., N=3) are selected for weighted fusion. This method may be referred to as the IntraTMP Fusion mode. Alternatively, after obtaining a best BV, multiple points are taken around that BV, and prediction values corresponding to the multiple points are weighted and fused to obtain the prediction value. This method may be referred to as the IntraTMP FLM mode. Alternatively, after obtaining the best BV, the template is sorted with sub-sample precision, the optimal direction and precision are selected, and an interpolation filter is used to calculate the prediction value. This method may be referred to as the IntraTMP SubPel mode. These are not specifically limited herein.
[563] In some embodiments, after the step S2706, referring to FIG. 28, the method may further include the following.
[564] S2801, a prediction residual of the current block is determined according to the prediction value of the current block.
[565] S2802, the prediction residual of the current block is encoded, and a resulting encoded bit is signalled into the bitstream.
[566] It should be noted that, in the embodiments of the present disclosure, after determining the prediction value of the current block based on the vector parameter of the current block, the prediction residual of the current block may be further determined based on the prediction value of the current block. Specifically, an initial value of the current block is determined, a subtraction operation is performed between the initial value and the prediction value of the current block to obtain the prediction residual of the current block. In this way, the prediction residual of the current block is signalled into the bitstream and transmitted to the decoding end, enabling the decoding end to obtain the prediction residual of the current block by decoding the bitstream, further to determine the reconstructed value of the current block, thereby achieving reconstruction of the current block.
[567] In some embodiments, embodiments of the present disclosure provide a bitstream generated by bit encoding based on information to be encoded. The information to be encoded includes at least one of the following: a prediction residual of a current block, a value of a first syntactic element, a value of a second syntactic element, or a value of a third syntactic element.
[568] In the embodiments of the present disclosure, the value of the first syntax element indicates an index of a prediction-value construction mode of the current block in a candidate list of prediction-value construction modes, the value of the second syntax element indicates whether an intra template matching prediction mode is used for the current block, and the value of the third syntax element indicates whether a first prediction mode is used for the current block. For example, the first prediction mode is the IntraTMP-LIC mode.
[569] The embodiments of the present disclosure provide the encoding method, specifically the method for extending the coverage of the Intra TMP search list. First, the first candidate list of the current block is determined, the first candidate list including one or more candidate vector parameters; then, the second position block is determined according to the candidate vector parameter in the first candidate list and / or the vector parameter of the first position block of the current block; when the encoding parameter of the second position block includes the vector parameter, it is determined, according to the vector parameter of the second position block, whether the vector parameter of the second position block satisfies a second condition; when the vector parameter of the second position block satisfies the second condition, the first candidate list is updated according to the vector parameter of the second position block; a second search region is determined according to a candidate vector parameter in the updated first candidate list, and a vector parameter of the current block is determined according to the second search region; finally, a prediction value of the current block is determined according to the vector parameter of the current block. In this way, when updating the first candidate list, some vector information of a second position block can be extended according to the candidate vector parameter in the initial first candidate list and / or the vector parameter of the first position block (spatially adjacent blocks and non-adjacent blocks of the current block), and then the first candidate list is supplemented with the extended vector information. Thus, the reconstructed information of spatially adjacent and non-adjacent positions can be effectively utilized, candidate vector information can be derived from the vector information of these reconstructed blocks while maintaining coding complexity. Therefore, the coverage of the IntraTMP search list is increased. The fine search mode is also extended, so that the vector parameter of the current block after the fine search is more accurate. In this way, the prediction accuracy is improved and the bitrate is saved, improving coding efficiency, and thus enhancing coding performance.
[570] In yet another embodiment of the present disclosure, based on the encoding and decoding methods in the foregoing embodiments, it is propose to construct an adaptive relocated BV list during the prediction process of IntraTMP, so as to fully utilize information of all neighboring reconstructed samples. Further, different schemes are used to reduce search ranges for search regions with different relative positions from the current block, so as to balance complexity.
[571] The prediction process in the embodiments of the present disclosure is described in detail below.
[572] Input of IntraTMP: a position of a current block (xTbCmp, yTbCmp), a width nTbW of the current block, and a height nTbH of the current block.
[573] Output of IntraTMP: a prediction value predSamples[x][y] of the current block, where x = 0..nTbW – 1, and y = 0..nTbH – 1.
[574] Specifically, the prediction process of the IntraTMP technology can be divided into four steps: determining a type of a current template, obtaining reconstructed samples of the current template, determining a block vector (also referred to as a “block motion vector”) within a predefined search range, and generating a prediction value. Thus, the prediction value of the current block can be obtained through the above process. It should be noted that the Intra TMP technology may be used for predicting a luma component, and may also be used for predicting a chroma component, which is not specifically limited herein.
[575] For determining the block vector, the IntraTMP search process mainly includes an initialization process, determining the search region for the template in the current frame, and searching the search region to determine the best block vector, as illustrated in FIG. 4 above. Here, when searching for the best matching template in the search region, a search strategy of first coarse search and then fine search may be used.
[576] The coarse search here may specifically be: determining the optimal coarse matching template in the search region with a first search step size (for example, 3), or determining the optimal coarse matching template in the search region using a downsampled template (for example, with a downsampling factor of 3).
[577] The fine search here may specifically be: determining the optimal fine matching template in the search region with a second search step size (for example, 1; if sub-sample precision is involved, sub-sample interpolation is required for the reconstructed samples, which is not detailed here), or determining the optimal fine matching template near the optimal coarse matching template after the coarse search is completed.
[578] Step 1: Initialization.
[579] Here, uiPatchWidth is initialized to nTbW + templateW_size, and uiPatchHeight is initialized to nTbH + templateH_size, where templateW_size and templateH_size may be fixed constants or may be dynamically adjusted according to the size of the coding block; templateW_size and templateH_size may be equal or may be different. For example, templateW_size = 4 and templateH_size = 4; or when the width of the coding block is greater than 8, templateW_size is set to 4, and when the width of the coding block is less than or equal to 8, templateW_size is set to 2; when the height of the coding block is greater than 8, templateH_size is set to 4, and when the height of the coding block is less than or equal to 8, templateH_size is set to 2. The specific meanings of the parameters are as illustrated in FIG. 5 above.
[580] Initialize a cost threshold diffThreshold between templates. For example: when the cost function is SAD, the threshold may be: diffThreshold= ((1 << bitDepth) >> 2) * (uiPatchHeight * uiPatchWidth - nTbH * nTbW). When the picture bit depth bitDepth is 10, diffThreshold indicates that the distortion threshold for each sample in the template region is 256.
[581] Initialize a position of a CTB where the current CB is located: ctbRsX, ctbRsY.
[582] Initialize a position offset of the current CB within the current CTB: offsetLCBY = yTbCmp – ctbRsY, offsetLCBX = xTbCmp – ctbRsX.
[583] Initialize iTemplateSizeH = templateH_size, iTemplateSizeW = templateW_size.
[584] Initialize iBvShift, where iBvShift is a precision of a block vector BV. The precision of the BV may be integer-sample precision, in which case iBvShift is 0; the precision of the BV may also be sub-sample precision, for example, when iBvShift is 1, it indicates 1 / 2-sample precision, and when iBvShift is 2, it indicates 1 / 4-sample precision.
[585] Initialize a preset search range of the template. The preset search range of the template may be set to a fixed size, or the search range may be dynamically adjusted according to the size of the coding block, for example:searchRangeWidth = TMP_SEARCH_RANGE_MULT_FACTOR * nTbW;searchRangeHeight = TMP_SEARCH_RANGE_MULT_FACTOR * nTbH.
[586] Here, the value of TMP_SEARCH_RANGE_MULT_FACTOR is a preset value, for example, a fixed value of 5.
[587] Step 2: a search region of the template within the current frame is determined.
[588] Here, the search region described herein is divided into two types:
[589] One type is a surrounding rectangular search region. This type, in turn, is divided into two sub-types: one sub-type is a region where it is certain that all samples in that region have been reconstructed (referred to as a fully reconstructed region), such as the four regions R1-R4 in FIG. 6; and the other sub-type is a region where it is uncertain whether all samples in that region have been reconstructed (referred to as an undetermined reconstructed region), such as the two regions R5 and R6 in FIG. 6.
[590] The other type is an extended search region, defined as a region pointed to by BVs corresponding to spatially adjacent and non-adjacent PUs, which in the embodiment corresponding to FIG. 6 may be considered as region R7; and a region pointed to by automatic relocation, which may be considered as region R8. Since search points in R7 and / or R8 are not necessarily adjacent to each other, the search within regions R7 and / or R8 is performed point by point according to a list.
[591] For search points in the search region, all search points in the specified search region may be traversed, or different schemes may be adopted to limit the search to a local search range, so as to balance computational complexity and coding efficiency. For example, for the undetermined reconstructed region (corresponding to the two regions R5 and R6 in FIG. 6) or for the fully reconstructed region (for example corresponding to the four regions R1 to R4 in FIG. 6), the width of the search range may be limited to 1 / wIndex of the original width, and the height may be limited to 1 / hIndex of the original height, where wIndex and hIndex each is any positive integer greater than or equal to 1. The limited search range takes a region closer to the coding unit. For another example, when reducing the search range of region R5, the width of the R5 search region may be reduced to 1 / 2 of the original width, and the width may be reduced to 1 / 2 of the original width, and the final search range may be taken as the upper-right 1 / 4 region of region R5.
[592] Step 3: searching is performed in the search region to determine a best BV.
[593] Let bvXMins and bvXMaxs respectively represent the minimum offset and maximum offset of the block vector in the horizontal direction; and let bvYMins and bvYMaxs respectively represent the minimum offset and maximum offset of the block vector in the vertical direction.
[594] bvXMinsregionId, bvXMaxsregionId, bvYMinsregionId, and bvYMaxsregionId may be calculated by usingiVerMinregionId, iVerMaxregionId, iHorMinregionId, and iHorMaxregionId determined in step 2:bvXMinsregionId = iHorMinregionId – xTbCmp;bvXMaxsregionId = iHorMaxregionId – xTbCmp;bvYMinsregionId = iVerMinregionId – yTbCmp;bvYMaxsregionId = iVerMaxregionId – yTbCmp.
[595] bvXMinsregionId, bvXMaxsregionId, bvYMinsregionId, and bvYMaxsregionId determine a range of horizontal and vertical offsets of the search point relative to the current block, that is, a range of the BV.
[596] For the fully reconstructed region (for example corresponding to the four regions R1 to R4 in FIG. 6), for each search point (iPosHor, iPoxVer) in the search region, that is, each BV (which is consisted of a horizontal component and a vertical component: (pX, pY), where pX = iPosHor - xTbCmp, pY = iPosVer - yTbCmp, and pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs), a matching reconstructed block of the current block may be found in the reconstructed region, and neighboring reconstructed samples of the matching reconstructed block are used as the matching template. Therefore, a matching cost between a neighboring template of the current block and a neighboring template of the matching reconstructed block may be calculated, denoted as pDiff.
[597] For the undetermined reconstructed region (for example corresponding to the two regions R5 and R6 in FIG. 6), for each search point (iPosHor, iPoxVer) in the search region, that is, each BV (which is consisted of a horizontal component and a vertical component: (pX, pY), where pX = iPosHor - xTbCmp, pY = iPosVer - yTbCmp, then pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs), an availability check is performed.
[598] If available, a matching reconstructed block of the current block may be found in the reconstructed region, and neighboring reconstructed samples of the matching reconstructed block are used as the matching template. Therefore, a matching cost between a neighboring template of the current block and a neighboring template of the matching reconstructed block may be calculated, also denoted as pDiff.
[599] If not available, the calculation of template matching cost is not performed.
[600] The availability check includes, but is not limited to, one or more of the following conditions being satisfied:each sample within the template does not exceed a valid coordinate range limited by the sample boundary of the picture;each sample within the reconstructed block corresponding to the template does not exceed the valid coordinate range limited by the sample boundary of the picture;each sample within the template and each sample within the corresponding reconstructed block do not exceed a range specified by the search window;whether each sample within the template is in the same Tile as the current coding region;whether each sample within the reconstructed block corresponding to the template is in the same Tile as the current coding region;each sample in the template has been reconstructed;each sample in the reconstructed block corresponding to the template is not located in the current coding region;each sample in the reconstructed block corresponding to the template has been reconstructed.
[601] All available search points in all search ranges (regionId=0, 1, 2, 3, 4, 5) are traversed, and 30 search points with the minimum matching costs pDiff are obtained by comparison. The corresponding matching costs are denoted as pDiff_BEST[n], n=0, ..., 29. The corresponding BVs are denoted as the best block vectors BV_BEST[n], each being a coordinate pair (pX_BEST, pY_BEST), n=0, ..., 29. The corresponding matching templates are denoted as the best matching templates T_BEST[n], n=0, ..., 29.
[602] In a possible implementation, if the search strategy is: first performing coarse search and then performing fine search, the process may be as illustrated in FIG. 7. The specific implementation is as follows: constructing a coarse search list in the search region, and determining a fine search list near the BVs in the coarse search list with a step size of 1.
[603] In a possible implementation, for the coarse search stage, referring to FIG. 29, the specific implementation is as follows.
[604] S2901: an initial coarse search list is constructed in the search region with a step size of 3.
[605] It should be noted that, within each region, in a search range where pX is between bvXMinsregionId and bvXMaxsregionId, and pY is between bvYMinsregionId and bvYMaxsregionId, the coarse search is performed with a step size of 3. The first P minimum matching costs obtained by template matching during coarse search with the step size of 3, are denoted as pDiff1_BEST[p], p=0,…,P-1, and the corresponding BVs are denoted as the best block vectors BV1_BEST [p], p=0,…,P-1. P may be 1 or an integer greater than 1 as needed, and the search region where the best matching search point is located is bestRegionId[p], p=0,…,P-1.
[606] S2902: an Intra TMP_Merge list is constructed to update the coarse search list.
[607] After P reference points are found out in the search region, multiple predefined search positions are used to construct a candidate BV list for reference by the current block, referred to as the IntraTMP_Merge list herein.
[608] The set of predefined search positions may include, for example: five spatially adjacent positions of the current block, namely, left (xTbCmp-1, yTbCmp+nTbH-1 ), upper left (xTbCmp-1, yTbCmp-1 ), upper (xTbCmp+nTbW-1, yTbCmp-1 ), upper right (xTbCmp+nTbW, yTbCmp-1 ), lower left ( xTbCmp-1, yTbCmp+nTbH ), as well as 18 spatially non-adjacent positions (as illustrated in FIG. 9).
[609] In the embodiments of the present disclosure, an example of the construction process is as follows. Whether the IntraTMP / IBC technology is used for PUs corresponding to these positions is checked. If the IntraTMP / IBC technology is used for a PU, a BV of this PU is stored in the IntraTMP_Merge list. After constructing the IntraTMP_Merge list, the coarse search list is updated. The specific updating process is: sequentially accessing each item in this list, computing a template matching cost corresponding to each BV, comparing this cost with a template matching cost of the initial coarse search list, and if it is less than the maximum template matching cost in the coarse search list, replacing the worse BV in the coarse search list with this BV. A specific replacement operation, for example, is to insert this BV into the coarse search list in order of cost and delete the item with the largest cost from the coarse search list. A search region bestRegionId for this BV is set to 6. It should be noted that this process is actually a list merging process, in which the search list for the results corresponding to R1 to R6 is first constructed, and then the result of R7 is inserted into the appropriate position in that list. In practical application, other search orders and merging strategies may also be used.
[610] In the embodiments of the present disclosure, according to algorithm requirements, the coarse search stage will provide one or more (denoted herein as M, where 1 ≤ M≤ P) fine-search reference points and feed them to the next stage. For example, M=1 may be used.
[611] S2903, an IntraTMP_EBVP list is constructed to update the coarse search list.
[612] After updating the coarse search list according to the IntraTMP_Merge list, for each BV replaced into the coarse search list from the Merge list, the IntraTMP_EBVP list is constructed and the coarse search list is updated according to this list.
[613] Firstly, for each current BV, its corresponding IntraTMP_EBVP list is constructed from scratch. Five positions of the current block are determined: center (xTbCmp+nTbW / 2, yTbCmp+nTbH / 2), upper-left (xTbCmp, yTbCmp), upper-right (xTbCmp+nTbW-1, yTbCmp), bottom-left (xTbCmp, yTbCmp+nTbH-1), and bottom-right (xTbCmp+nTbW-1, yTbCmp+nTbH-1). For a PU corresponding to one of these five position coordinates plus the current BV, whether the BV-based prediction technique (i.e., IBC / IntraTMP) is used for the PU is checked.
[614] If the BV-based prediction technique is used for the PU, a sum (vector sum, i.e., adding the horizontal and vertical components separately) of a BV stored for the corresponding PU and the current BV is denoted as BV’ and added into the TMP_EBVP list. Then the above operation is repeated for this BV’ by regarding the BV’ as the current BV, to continue constructing available options in the TMP_EBVP list. If the BV-based prediction technique is not used for the PU, the next position is checked.
[615] In this way, the above operations are repeated until all five positions have been checked, or the number of IntraTMP_EBVP lists being constructed is greater than T (for example, T may be 15), thereby completing the construction of the current IntraTMP_EBVP list. In addition, the number may be limited here to a smaller value such as 1, 2, 5, or 10. Optionally, it may be specified that if the SAD exceeds a certain threshold, subsequent operations will no longer continue. Optionally, the total number of extensions may be limited (similar to the IBC-ARBVP method, optional items are added into the end of a merge list with a limited length until the list is full, in which case R7 and the new R7 may be regarded as the same candidate region). Optionally, limitation may be imposed based on both the number and the SAD, and so on.
[616] In the embodiments of the present disclosure, after the current IntraTMP_EBVP list is constructed, the coarse search list is updated. The specific update operation is as follows. Each BV in this IntraTMP_EBVP list is accessed to calculate a corresponding template matching cost, and this cost is compared with the template matching costs of the BVs in the coarse search list to-be-updated. If this cost is less than the largest template matching cost in the coarse search list, the worse BV in the coarse search list is replaced with the corresponding BV. An example of the replacement operation is: inserting this BV into the coarse search list in order of cost value, and deleting the item with the largest cost value from the coarse search list. A search region bestRegionId for the BV newly inserted into the coarse search list is set to 7. It should be noted that the search region bestRegionId here is originally to provide a basis for access to surrounding samples during fine search and filtering.
[617] It should also be noted that, for step S2902 and step S2903, the so-called "update" here is merely a process of merging result lists, and there is not necessarily such an update order. It should also be noted that, in memory space, there are three lists: the coarse search list, the Intra TMP-Merge list, and the Intra TMP-EBVP list. Among them, the coarse search list must exist, while the other two lists need not actually be constructed, but may instead serve as a checking order, where once a suitable option is found, it is used to update the coarse search list.
[618] Further, after the coarse search is completed, a fine search list may be determined around the BVs in the coarse search list with a step size of 1. Specifically, the best block vector BV1_BEST[p], p=0,…,M-1, obtained in the coarse search is used as a fine search reference point for searching.
[619] In a specific embodiment, for each fine search reference point, the position of the best matching reconstructed block obtained by the coarse search is first calculated as the reference position of the fine search region: BestPosX = xTbCmp + pX1_BEST, BestPosY = yTbCmp + pY1_BEST, and then the refined search range TmpRefineRangeHor and TmpRefineRangeVer are determined. The refined search range may be of a fixed size, or may be related to the search region.
[620] Exemplarily, for a reference point in the search region 0 to 5, both TmpRefineRangeHor and TmpRefineRangeVer may be set to 1. That is, in a case where regionId is 0 to 5, the fine search range is a 3×3 sample region within an offset range of [-1,1] in both the vertical and horizontal coordinates, with the fine-search starting position (also referred to as the "fine-search starting point") as coordinate [0,0]. A point-by-point full search is performed within this range, as illustrated in FIG. 10.
[621] For a reference point in the search region 6, both TmpRefineRangeHor and TmpRefineRangeVer may be set to 5. That is, in a case where regionId is 6, the fine search range is an 11×11 sample region within an offset range of [-5,5] in both the vertical and horizontal coordinates, with the fine-search starting position as coordinate [0,0]. A point-by-point full search is performed within this range, as illustrated in FIG. 11.
[622] In addition, for the case where regionId is 6, alternatively, if combined with an IntraTMP-LIC mode, then when the IntraTMP-LIC mode is selected for use for the current block, the fine search range is a 5×5 sample region within an offset range of [-2,2] in both the vertical and horizontal coordinates with the fine-search starting position as coordinate [0,0]; otherwise, when the IntraTMP-LIC mode is not selected for use for the current block, the fine search range is an 11×11 sample region within a offset range of [-5,5] in both the vertical and horizontal coordinates with the fine-search starting position as coordinate [0,0]. A point-by-point full search is performed within the fine search range, as illustrated in FIG. 12. In FIG. 12, (a) illustrates the case where the IntraTMP-LIC mode is selected for use for the current block, that is, a value of a syntax element (flag) corresponding to the IntraTMP-LIC mode of the current block is 1; and (b) illustrates the case where the IntraTMP-LIC mode is not selected for use for the current block, that is, the value of the syntax element (flag) corresponding to the IntraTMP-LIC mode of the current block is 0.
[623] It should also be noted that, the IntraTMP-LIC mode refers to that after a matching position is found for the current block through the template in the IntraTMP mode, an LIC model (for example, a linear model) is established between the template of the current block and the template at the matching position, specifically as illustrated in formula (2) above. I0(x,y) is a sample value in the current template / current prediction block, and I1(x,y) is a sample value in the reference template / reference block; a and b are linear model parameters. Here, a and b may be obtained from the current block template and the reference block template (for example, by using the least squares method). Then a sample value in the reference block is input to obtain a sample value in the current prediction block.
[624] For search region 7, both TmpRefineRangeHor and TmpRefineRangeVer may be set to 2. That is, the fine search range is a 5×5 sample region with the fine search starting position as the coordinate [0,0] and the vertical and horizontal coordinates offset within the range of [-2,2], as illustrated in FIG. 21 described above. A point-by-point full search is performed within this range. It should be noted that this method is consistent with the processing in the case where regionId is 6 and the flag of the IntraTMP-LIC mode is true when the IntraTMP-LIC mode is enabled.
[625] The fine search region is regarded as an entire undetermined reconstructed region and traversed directly by using the search window.
[626] A new search range is obtained according to the best matching block position obtained by the coarse search, as follows:iHorMaxrefine = min(picWidth - nTbW, BestPosX + TmpRefineRangeHor);iHorMinrefine = max(iTemplateSizeW, BestPosX - TmpRefineRangeHor);iVerMaxrefine = min(picHeight - nTbH, BestPosY + TmpRefineRangeVer);iVerMinrefine= max(iTemplateSizeH, BestPosY - TmpRefineRangeVer).
[627] Then, the adjusted block vector BVbvXMins, bvXMaxs, bvYMins, and bvYMaxs can be calculated from iVerMinrefine, iVerMaxrefine, iHorMinrefine, iHorMaxrefine as follows:bvXMins = iHorMinrefine – xTbCmp;bvXMaxs = iHorMaxrefine – xTbCmp;bvYMins = iVerMinrefine – yTbCmp;bvYMaxs = iVerMaxrefine – yTbCmp.
[628] The fine search is performed within the block vector range where pX is between bvXMinsrefine and bvXMaxsrefine, and pY is between bvYMinsrefine and bvYMaxsrefine, i.e., directly traverse all search positions within the fine search window, sequentially performing availability checks. For example, the second search step size is 1, and top T best matching costs of available points from template matching are denoted as pDiff_BEST[t], t=0,...,T-1, and the corresponding BVs are denoted as best BVs BV_BEST[t], t=0,...,T-1, where T is 1 or an integer greater than 1. For example, T=1.
[629] It should also be noted that, in the embodiments of the present disclosure, sub-sample position search may further be performed on the basis above. Referring to FIG. 30, the method may include the following.
[630] S3001: costs of the integer-sample positions found within the second search region are compared one by one to determine a position with the minimum cost.
[631] S3002: sub-sample position search is performed.
[632] In the embodiments of the present disclosure, for the sub-sample position search, an initial direction of the sub-sample position is first determined, and then a sub-sample position index and a final direction index are determined. In a possible implementation, with reference to FIG. 31, the specific implementation is as follows.
[633] S3101: the initial direction of the sub-sample position is determined.
[634] S3102: the sub-sample position index and the final direction index are determined.
[635] For S3101, the starting position of the sub-sample search is coordinate [0,0], and eight directions with vertical and horizontal coordinate offsets of -1 / 2 and 1 / 2 are considered. The eight candidate positions are compared in terms of cost, and the first four directions with smaller costs are determined as initial directions for the sub-sample search.
[636] For S3102, the starting position of the sub-sample search is coordinate [0,0], the first four directions determined above are offset by the range of [-3 / 4, 3 / 4] in the vertical and horizontal coordinates, and the search is performed among multiple 1 / 4-sample precision positions. Specifically, 10 to 12 candidate positions are compared in terms of cost, and a position with the minimum cost is determined to obtain the sub-sample position index tmpIsSubPel and the final direction index tmpSubIdx. As illustrated in FIG. 13, white-filled dots represent sub-sample positions, grid-filled dots represent half-sample positions, and black-filled dots represent integer-sample positions.
[637] For example, tmpIsSubPel may have four values, respectively corresponding to an integer-sample position (0), a 1 / 2-sample position (1), a 1 / 4-sample position (2 or 3), and a 3 / 4-sample position (2 or 3). The indices corresponding to the 1 / 4 and 3 / 4 positions depend on the interpolation positions.
[638] For example, tmpSubIdx may have eight values, respectively corresponding to eight directions: left (0), right (1), up (2), down (3), upper left (4), upper right (5), lower left (6), and lower right (7).
[639] In this way, values (Dx, Dy) of the sub-sample position coordinates can be obtained from tmpIsSubPel and tmpSubIdx, and then the best matching coordinates are updated.
[640] After completing the above operations, the results of the coarse selection and fine selection (where the fine selection process includes one or more reference point searches) are combined to obtain one or more best block vectors BV_BEST[n], n=0,...,N-1, for different algorithm requirements, where each item is a coordinate pair (pX_BEST, pY_BEST). Here, pX_BEST and pY_BEST are the horizontal and vertical offsets of the best matching template relative to the template of the current coding block, respectively, and are also the horizontal and vertical offsets of the best matching reconstructed block relative to the current coding block.
[641] It should also be noted that, in the embodiments of the present disclosure, the foregoing search scheme may be adjusted.
[642] In a possible implementation, the BV list updated from the IntraTMP_Merge list by IntraTMP_EBVP and the list of the original rectangular search region may be merged into a new coarse search list, and then fine search is performed. Referring to FIG. 32, the specific implementation is as follows.
[643] S3201: an IntraTMP_Merge list is constructed to update the coarse search list.
[644] S3202: an IntraTMP_EBVP list is constructed to update the coarse search list.
[645] S3203: an initial coarse search list is constructed in the search region with a step size of 3.
[646] S3204: a new coarse search list is determined.
[647] S3205: a fine search list is determined near the BVs in the coarse search list with a step size of 1.
[648] In another possible implementation, the list of the original rectangular search region may be updated by EBVP, which is then merged with the IntraTMP_Merge list to form a new coarse search list, and then fine search is performed. Referring to FIG. 33, the specific implementation is as follows.
[649] S3301: an initial coarse search list is constructed in the search region with a step size of 3.
[650] S3302: an IntraTMP_EBVP list is constructed to update the coarse search list.
[651] S3303: an IntraTMP_Merge list is constructed to update the coarse search list.
[652] S3304: a new coarse search list is determined.
[653] S3305: a fine search list is determined near the BVs in the coarse search list with a step size of 1.
[654] In yet another possible implementation, the list of the original rectangular search region may first be updated by the IntraTMP_Merge list, and then this updated list may be further updated by EBVP. During the second update, IntraTMP_EBVP list construction may be performed for all entries in the updated coarse search list, and the final list is used as the new coarse search list for fine search. Referring to FIG. 34, the specific implementation is as follows.
[655] S3401: an initial coarse search list is constructed in the search region with a step size of 3.
[656] S3402: am IntraTMP_Merge list is constructed to update the coarse search list.
[657] S3403: an IntraTMP_EBVP list is constructed to update the coarse search list.
[658] S3404: a fine search list is determined near the BVs in the coarse search list with a step size of 1.
[659] It should also be noted that, in the embodiments of the present disclosure, all BVs replaced from the IntraTMP_Merge list in the coarse search list may be checked. Optionally, the BVs to be checked for the IntraTMP_EBVP list and the number thereof may also be adjusted.
[660] Exemplarily, the first 5 BVs in the corresponding BV set may be checked, or the first 10 BVs in the corresponding BV set may be checked. Alternatively, the number of checks may be limited according to the size of the current block. For example, for blocks with a size less than or equal to 16x16, the first 5 BVs are checked, and for other sizes, the first 10 BVs are checked. Alternatively, clustering may be performed on the coarse search list, with the clustering rule being the geometric distance to the cluster center. The number of cluster centers is 2 to 5, and EBVP operations are performed only on the cluster centers. Alternatively, EBVP BVs may be added after the IntraTMP_Merge list until the IntraTMP_Merge list is full, and then this IntraTMP_Merge list is used to update the initial coarse search list, that is, the quantity limit is the number of unfilled entries in the IntraTMP_Merge list.
[661] It should also be noted that, in the embodiments of the present disclosure, the length of the IntraTMP_EBVP list may be modified to other values. Exemplarily, the list length may be limited to 1, 2, 5, or 10.
[662] It should also be noted that, in the embodiments of the present disclosure, constraints may be imposed according to the template cost corresponding to the BV (such as SAD, SATD, and the like). A template cost may first be calculated for each BV of the EBVP, a cost threshold may be set, and a BV not exceeding the threshold may then be added to the EBVP list.
[663] It should also be noted that, in the embodiments of the present disclosure, sub-sample search may be implemented in the fine search stage.
[664] It should also be noted that, in the embodiments of the present disclosure, when constructing the prediction value of the current block, the prediction value may be corrected by a local filtering method. Alternatively, when constructing the prediction value of the current block, the prediction value may be corrected by weighting multiple prediction values. Alternatively, when constructing the prediction value, a prediction value candidate list may be constructed by using a variety of single prediction value, filtered prediction value, weighted prediction value, and / or construction schemes of these prediction values, and a syntax element transmitted through the bitstream may be used at the decoding end to determine which item in the candidate list is used to obtain the actual prediction value.
[665] It should also be noted that, in the embodiments of the present disclosure, the extension may not be used in conjunction with the IntraTMP_Merge set, i.e., may be performed based solely on the BVs obtained by direct search within the search window in IntraTMP.
[666] It should also be noted that, in the embodiments of the present disclosure, it is also possible to perform a single search, without dividing into coarse search and fine search steps, and then BV options may be extended based on the single search result to obtain the final BV result.
[667] It should also be noted that, in the embodiments of the present disclosure, only the top K items (for example, K may be 5) of the IntraTMP_Merge list are taken to update the coarse search list, and extension is performed only on the basis of the BVs in the IntraTMPMerge list.
[668] It should also be noted that, in the embodiments of the present disclosure, IntraTMP_Merge and IntraTMP_EBVP are used together to maintain a Merge list. First, the first P items (for example, P may be 5) of BVs in the IntraTMP_Merge list are taken, and IntraTMP_EBVP extension is performed based on these P BVs to construct a new Merge list having a length of L (for example, L may be 28). When the extended BVs fill the new Merge list or the extension of the P BVs is all completed, the costs of the BVs in the new Merge list are calculated and sorted, and then the first Q items (for example, Q may be 5) of the sorted list are taken to update the coarse selection list.
[669] It should also be noted that, in the embodiments of the present disclosure, for the case where regionId is 7, the fine search range may also be selected as a 3×3 sample region with the fine search starting position as coordinate [0,0] and the vertical and horizontal coordinate offset within the range of [-1,1] respectively, as illustrated in FIG. 10; or a 7×7 sample region within the range of [-3,3], as illustrated in FIG. 22; or a 9×9 sample region within the range of [-4,4], as illustrated in FIG. 23; or an 11×11 sample region within the range of [-5,5], as illustrated in FIG. 11. The point-by-point full search is performed within the sample range. It should be noted that, when the 3×3 sample region is selected, this method is consistent with the case where regionId is 0 to 5 in the related art. In addition, when the 11×11 sample region is selected, this method is the same as the method when regionId is 6, or is consistent with the processing in the related art where regionId is 6 and the IntraTMP-LIC flag is false when the IntraTMP-LIC mode is enabled.
[670] It should also be noted that, in the embodiments of the present disclosure, for the case where regionId is 7, it is also possible to use in combination with the IntraTMP-LIC mode. Then, as illustrated in FIG. 24, when the IntraTMP-LIC mode is chosen for the current block, the fine search range is a 5×5 sample region with the fine search starting position as coordinate [0,0] and the vertical and horizontal coordinates offset within the range of [-2,2]. Otherwise, when the IntraTMP-LIC mode is not chosen for the current block, the fine search range is a 7×7 sample region with the fine search starting position as coordinate [0,0] and the vertical and horizontal coordinates offset within the range of [-3,3] (or other cases in the above embodiments). The point-by-point full search may be performed within this fine search range. It should be noted that this search method is similar to the processing in the case where regionId is 6 and the IntraTMP-LIC mode is enabled.
[671] It should also be noted that, in the embodiments of the present disclosure, the sub-sample search may also be a search among multiple half-sample positions. That is, with the starting position of the sub-sample search as coordinate [0,0], a square region with vertical and horizontal coordinate offsets within the range of [-1 / 2, 1 / 2] is used, and 9 candidate positions are compared in terms of cost, as illustrated in FIG. 25. Alternatively, the sub-sample search may be a search among multiple 1 / 4-sample precision positions. That is, with the starting position of the sub-sample search as coordinate [0,0], a square region with vertical and horizontal coordinate offsets within the range of [-3 / 4, 3 / 4] is used, and 49 candidate positions are compared in terms of cost, as illustrated in FIG. 26.
[672] It should also be noted that, for the sub-sample search, the position with the minimum cost may also be solved by building a model. For example, take the starting position of the sub-sample search as the center, a few coordinate points around the center are selected to build a model using the cost values at these points. The position corresponding to the minimum value of the model is solved and selected as the search result.
[673] By taking a quadratic model as an example, it is assumed that the relationship model between Vcost and the positions near MVint is as illustrated in the aforementioned formula (9). Here, (xmin, ymin) is the sub-sample position where Vcost is minimized, and A, B, C are model parameters. The model parameters A, B, C, xmin, ymin can be solved using the Vcost at the position corresponding to MVint and its four neighboring positions (top, bottom, left, right). Suppose the Vcost at the position corresponding to MVint is Vcost(0,0), and the Vcost at the top, bottom, left, and right positions are Vcost(0,-1), Vcost(0,1), Vcost(-1,0), Vcost(1,0), respectively.
[674] Here, the calculation methods for xmin and ymin are as illustrated in the aforementioned formulas (10) and (11). Here, the search result may be stored as units such as half-sample, 1 / 4 luma integer-sample, 1 / 8 luma integer-sample, or 1 / 16 luma integer-sample, according to requirements.
[675] In addition, Vcost may be calculated according to a preset cost function, for example, SAD, SATD, MSE, SSD, MAD, MSD, NCC, and the like.
[676] It should also be noted that, in the embodiments of the present disclosure, the cost functions may be selected to be of the same type among different search steps, for example, both may be SAD. Alternatively, the cost functions may be of different types, e.g., SAD for coarse search, SAD or SATD for fine search, and SAD, SATD, SSE, etc. for sub-sample search, which is not specifically limited herein.
[677] In the embodiments of the present disclosure, the specific implementations of the foregoing embodiments have been described in detail through the above embodiments. It can be seen therefrom that, according to the technical solutions of the foregoing embodiments, a method for extending the coverage range of the IntraTMP search list is proposed herein, which introduces BV candidate positions derived according to the BV information of reconstructed blocks, thereby effectively improving coding accuracy. That is, the technical solution can effectively utilize information of spatially adjacent and non-adjacent reconstructed blocks, and, on the premise of not significantly increasing coding complexity, increases the search region range of IntraTMP. Further, the search manner of fine search is extended, so that the vector parameter of the current block obtained from fine search is more accurate, thereby improving prediction accuracy, and further improving coding efficiency and coding performance.
[678] In yet another embodiment of the present disclosure, based on the same inventive concept as the previous embodiments, FIG. 35 is a schematic structural diagram of an encoder according to an embodiment of the present disclosure. As illustrated in FIG. 35, the encoder 350 may include a first determining unit 3501, a first updating unit 3502, and a first predicting unit 3503.
[679] The first determining unit 3501 is configured to determine a first candidate list of a current block, where the first candidate list includes one or more candidate vector parameters.
[680] The first updating unit 3502 is configured to: determine a second position block according to a candidate vector parameter in the first candidate list and / or a vector parameter of a first position block of the current block; when an encoding parameter of the second position block includes a vector parameter, determine whether the vector parameter of the second position block satisfies a second condition according to the vector parameter of the second position block; when the vector parameter of the second position block satisfies the second condition, update the first candidate list according to the vector parameter of the second position block; and determine a second search region according to a candidate vector parameter in the updated first candidate list, and determine a vector parameter of the current block according to the second search region.
[681] The first predicting unit 3503 is configured to determine a prediction value of the current block according to the vector parameter of the current block.
[682] In some embodiments, the first determining unit 3501 is further configured to: when the encoding parameter of the first position block of the current block includes a vector parameter, according to the vector parameter of the first position block, determine whether the vector parameter of the first position block satisfies a first condition; and when the vector parameter of the first position block satisfies the first condition, determine the second position block according to the vector parameter of the first position block.
[683] In some embodiments, the vector parameter includes a block vector parameter and / or a motion vector parameter.
[684] In some embodiments, the first determining unit 3501 is further configured to: determine a first search region of the current block; and determine the first candidate list of the current block according to the first search region.
[685] In some embodiments, the first determining unit 3501 is further configured to: determine a first template of the current block; and determine the first se...
Claims
1. A decoding method, applied to a decoder and comprising:determining a first candidate list of a current block, wherein the first candidate list comprises one or more candidate vector parameters;determining a second position block according to a vector parameter of a first position block of the current block;when a decoding parameter of the second position block comprises a vector parameter, determining, according to the vector parameter of the second position block, whether the vector parameter of the second position block satisfies a second condition;when the vector parameter of the second position block satisfies the second condition, updating the first candidate list according to the vector parameter of the second position block;determining a second search region according to a candidate vector parameter in the updated first candidate list, and determining a vector parameter of the current block according to the second search region; anddetermining a prediction value of the current block according to the vector parameter of the current block. 2. The method of claim 1, wherein determining the first candidate list of the current block comprises:determining a first search region of the current block; determining one or more first candidate vector parameters by searching within the first search region using a first search step size; andadding the one or more first candidate vector parameters into the first candidate list of the current block. 3. The method of claim 1, wherein the second position block represents a reference block pointed to by the vector parameter of the first position block; orthe second position block represents a block pointed to by a vector parameter of the reference block pointed to by the vector parameter of the first position block. 4. The method of claim 1, wherein determining the second search region according to the candidate vector parameters in the updated first candidate list comprises:determining a starting position of the second search region based on the candidate vector parameter in the first candidate list; anddetermining a sample region, obtained by offsetting the starting position by a first preset range in both the vertical direction and the horizontal direction, as the second search region. 5. The method of claim 4, further comprising:when the first preset range is [-1,1], the second search region is a 3×3 sample region; orwhen the first preset range is [-2,2], the second search region is a 5×5 sample region; orwhen the first preset range is [-3,3], the second search region is a 7×7 sample region; orwhen the first preset range is [-4,4], the second search region is a 9×9 sample region; orwhen the first preset range is [-5,5], the second search region is an 11×11 sample region. 6. The method of claim 2, wherein determining the vector parameter of the current block according to the second search region comprises:determining the vector parameter of the current block by searching within the second search region using a second search step size,wherein a value of the second search step size is smaller than a value of the first search step size. 7. The method of claim 1, wherein determining the vector parameter of the current block according to the second search region comprises:determining the vector parameter of the current block by performing a point-by-point full search within the second search region. 8. The method of claim 7, further comprising:after performing the point-by-point full search within the second search region, determining a new candidate vector parameter of the current block; anddetermining the vector parameter of the current block by performing sub-sample search based on the new candidate vector parameter. 9. An encoding method, applied to an encoder and comprising:determining a first candidate list of a current block, wherein the first candidate list comprises one or more candidate vector parameters;determining a second position block according to a vector parameter of a first position block of the current block;when an encoding parameter of the second position block comprises a vector parameter, determining, according to the vector parameter of the second position block, whether the vector parameter of the second position block satisfies a second condition;when the vector parameter of the second position block satisfies the second condition, updating the first candidate list according to the vector parameter of the second position block;determining a second search region according to a candidate vector parameter in the updated first candidate list, and determining a vector parameter of the current block according to the second search region; anddetermining a prediction value of the current block according to the vector parameter of the current block. 10. The method of claim 9, wherein determining the first candidate list of the current block comprises:determining a first search region of the current block; determining one or more first candidate vector parameters by searching within the first search region using a first search step size; andadding the one or more first candidate vector parameters into the first candidate list of the current block. 11. The method of claim 9, wherein the second position block represents a reference block pointed to by the vector parameter of the first position block; orthe second position block represents a block pointed to by a vector parameter of the reference block pointed to by the vector parameter of the first position block. 12. The method of claim 9, wherein determining the second search region according to the candidate vector parameters in the updated first candidate list comprises:determining a starting position of the second search region based on the candidate vector parameter in the first candidate list; anddetermining a sample region, obtained by offsetting the starting position by a first preset range in both the vertical direction and the horizontal direction, as the second search region. 13. The method of claim 12, further comprising:when the first preset range is [-1,1], the second search region is a 3×3 sample region; orwhen the first preset range is [-2,2], the second search region is a 5×5 sample region; orwhen the first preset range is [-3,3], the second search region is a 7×7 sample region; orwhen the first preset range is [-4,4], the second search region is a 9×9 sample region; orwhen the first preset range is [-5,5], the second search region is an 11×11 sample region. 14. The method of claim 10, wherein determining the vector parameter of the current block according to the second search region comprises:determining the vector parameter of the current block by searching within the second search region using a second search step size,wherein a value of the second search step size is smaller than a value of the first search step size. 15. A non-transitory computer-readable storage medium, storing a bitstream and a computer program, wherein when executed by a processor, the computer program causes the processor to generate the bitstream according to an encoding method, the encoding method comprising:determining a first candidate list of a current block, wherein the first candidate list comprises one or more candidate vector parameters;determining a second position block according to a vector parameter of a first position block of the current block;when an encoding parameter of the second position block comprises a vector parameter, determining, according to the vector parameter of the second position block, whether the vector parameter of the second position block satisfies a second condition;when the vector parameter of the second position block satisfies the second condition, updating the first candidate list according to the vector parameter of the second position block;determining a second search region according to a candidate vector parameter in the updated first candidate list, and determining a vector parameter of the current block according to the second search region; anddetermining a prediction value of the current block according to the vector parameter of the current block.