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

JP2026512364A5Pending Publication Date: 2026-04-22GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing video encoding techniques using intra-block copy (IBC) suffer from reduced prediction accuracy and inefficiencies due to direct use of reconstructed pixels in the best-matching reference block, leading to large deviations and increased bitrate.

Method used

An encoding/decoding method that determines a first template and a block vector candidate list, decodes block vector indication information to find a matching template and reference block, applies filtering based on model parameters, and uses filtered reference blocks for prediction, improving accuracy and efficiency.

Benefits of technology

Enhances prediction accuracy and reduces bitrate by applying filtering to reconstructed pixels, thereby improving encoding/decoding performance and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium, the method comprising: determining a first template for the current block; determining a list of candidate block vectors for the current block; decoding the bitstream to determine block vector instruction information; determining a first block vector based on the block vector instruction information and the list of candidate block vectors; determining a matching template and a corresponding reference block based on the first block vector; determining model parameters based on the first template and the matching template; performing a filtering process on the reference blocks based on the model parameters; determining the filtered reference blocks; and determining a predicted value for the current block based on the filtered reference blocks. This improves prediction accuracy, saves bitrate, and enhances encoding / decoding performance.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] This application relates to the video encoding and decoding technology, and more particularly to encoding and decoding methods, bitstreams, encoders, decoders, and storage media. [Background technology]

[0002] Intra-block copy (IBC) is a block-level coding mode that, similar to interframe technology, uses motion lookup to find the optimal block vector (BV) for each coded block. This block vector points from the current block to a reference block. However, the optimal BV is searched for within the reconstruction region of the frame where the current block is located (i.e., the current coded frame), and the reference block pointed to by the optimal BV is considered the predicted block for the current block.

[0003] However, in the actual encoding process, the relevant techniques typically use the reconstructed pixels in the best-matching reference block directly as the predicted pixels for the current encoding block. However, this approach is insufficient, leading to problems such as large deviations in certain scenes and reduced prediction accuracy. [Overview of the Initiative] [Problems that the invention aims to solve]

[0004] This application provides an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium that can improve the accuracy of intrablock copy prediction, thereby saving bitrate and improving encoding / decoding performance. [Means for solving the problem]

[0005] The technical solution of this application can be realized as follows.

[0006] In a first aspect, an embodiment of the present application provides a decoding method applied to a decoder, the method comprising: determining a first template of a current block and determining a block vector candidate list of the current block; decoding a bit stream to determine block vector indication information, and determining a first block vector based on the block vector indication information and the block vector candidate list; determining a matching template and a corresponding reference block based on the first block vector; determining model parameters based on the first template and the matching template, performing filtering processing on the reference block based on the model parameters, and determining a filtered reference block; and determining a predicted value of the current block based on the filtered reference block.

[0007] In a second aspect, an embodiment of the present application provides an encoding method applied to an encoder, the method comprising: determining a first template of a current block and determining a block vector candidate list of the current block; determining a first block vector based on the block vector candidate list; determining a matching template and a corresponding reference block based on the first block vector; determining model parameters based on the first template and the matching template, performing filtering processing on the reference block based on the model parameters, and determining a filtered reference block; and determining a predicted value of the current block based on the filtered reference block.

[0008] In a third aspect, an embodiment of the present application provides a bit stream, which is generated by performing bit encoding on encoding target information, where the encoding target information is including at least one of a prediction residual of a current block, block vector indication information, the number of coefficients of a target filter, the shape of the target filter, a value of first syntax element identification information, and a value of second syntax element identification information, wherein the first syntax element identification information is used to indicate whether the current block applies intra-block copy, and the second syntax element identification information is used to indicate whether the current block applies a filter model.

[0009] In a fourth aspect, an embodiment of the present application provides an encoder including a first determination unit, a first filtering unit, and a first prediction unit. The first determination unit is configured to determine a first template of a current block and determine a block vector candidate list of the current block. The first determination unit is further configured to determine a first block vector based on the block vector candidate list, and determine a matching template and a corresponding reference block based on the first block vector. The first filtering unit is configured to determine model parameters based on the first template and the matching template, perform filtering processing on the reference block based on the model parameters, and determine a filtered reference block. The first prediction unit is configured to determine a predicted value of the current block based on the filtered reference block.

[0010] In a fifth aspect, an embodiment of the present application provides an encoder including a first memory and a first processor. The first memory is configured to store a computer program executable by the first processor. The first processor is configured to execute the method described in the second aspect by executing the computer program.

[0011] In a sixth embodiment, the present invention provides a decoder comprising a second decision unit, a decoding unit, a second filtering unit, and a second prediction unit. The second decision unit is configured to determine the first template for the current block and to determine the list of candidate block vectors for the current block. The decoding unit is configured to decode the bitstream and determine block vector instruction information. The second decision unit is further configured to determine a first block vector based on block vector instruction information and a list of block vector candidates, and to determine a matching template and a corresponding reference block based on the first block vector. The second filtering unit is configured to determine model parameters based on the first template and the matching template, perform filtering on reference blocks based on the model parameters, and determine the filtered reference blocks. The second prediction unit is configured to determine the predicted value of the current block based on the filtered reference block.

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

[0013] In the eighth embodiment, the present invention provides a computer-readable storage medium storing a computer program for implementing the method described in the first embodiment or the method described in the second embodiment. [Effects of the Invention]

[0014] Embodiments of the present invention provide an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium. On either the encoding or decoding side, a first template for the current block and a list of candidate block vectors for the current block are determined. Based on the candidate block vector list, a first block vector is determined. Then, based on the first block vector, a matching template and a corresponding reference block are determined. Based on the first template and the matching template, model parameters are determined. Based on the model parameters, a filtering process is performed on the reference blocks. The filtered reference blocks are determined, and based on the filtered reference blocks, the predicted value of the current block is determined. On the decoding side, in order to determine the first block vector, the bitstream must be decoded further to determine block vector instruction information. Subsequently, the first block vector is determined based on the block vector instruction information and the candidate block vector list, thereby determining the matching template and the corresponding reference block. Thus, the model parameters are determined based on the first template and the matching template. These model parameters fully reflect the correlation between the matching template and the first template of the current block. By applying this correlation to the reference block, applying filtering to its reconstructed pixels, and using the filtered reconstructed pixels as the predicted pixels of the current block, prediction accuracy is improved, bitrate is saved, and the problem of linear changes between the reference block and the current block is effectively resolved. At the same time, the efficiency of encoding and decoding is improved, and the performance of encoding and decoding can be further enhanced. [Brief explanation of the drawing]

[0015] [Figure 1] This is an illustrative flowchart for obtaining reconstructed pixel values. [Figure 2] This is a schematic diagram showing the template types for IBC mode. [Figure 3] This is a schematic diagram showing the positional relationship between the current block and adjacent blocks. [Figure 4] This is a schematic diagram showing a set of block vector prediction candidate items located in the IBC reference region. [Figure 5] This is a schematic diagram showing the relationship between the template location of the current block and the template location of the referenced block. [Figure 6] This is a schematic diagram showing the clustering of block vector prediction candidates. [Figure 7A] This is a schematic diagram illustrating the diamond-shaped search process. [Figure 7B] This is a schematic diagram illustrating a different diamond-shaped search process. [Figure 8] This is a schematic diagram showing the relationship between block vectors, block vector predictions, and block vector differences. [Figure 9] This is a schematic diagram of the reference area corresponding to the current block. [Figure 10] This is a schematic diagram of the reference area corresponding to the current block. [Figure 11] This is a schematic diagram of the reference area corresponding to the current block. [Figure 12] This is an illustrative structural diagram for determining the BV of the chromaticity component after refinement. [Figure 13A] This is a schematic block diagram of the encoder configuration according to an embodiment of the present invention. [Figure 13B] This is a schematic block diagram of the decoder configuration according to the embodiment of the present invention. [Figure 14] This is a schematic diagram of the network architecture of the coding and decoding system according to an embodiment of the present invention. [Figure 15] This is an illustrative flowchart of the decoding method according to the embodiment of the present application. [Figure 16] This is a schematic diagram of the IBC mode template type according to an embodiment of the present application. [Figure 17] This is an illustrative structural diagram of an available reconstructed pixel according to an embodiment of the present application. [Figure 18A] This is a schematic diagram of the boundary padding region according to the embodiment of the present application. [Figure 18B]This is a schematic diagram of another boundary padding region according to an embodiment of the present application. [Figure 19] This is a schematic diagram of the shape of the filter according to the embodiment of the present invention. [Figure 20A] This is a schematic diagram of the filter coefficient configuration according to the embodiment of the present application. [Figure 20B] This is a schematic diagram of the configuration of the prediction pixels according to the embodiment of the present invention. [Figure 21] This is an illustrative flowchart of the encoding method according to the embodiment of the present invention. [Figure 22] This is an exemplary flowchart illustrating how to perform predictions based on IBC-FLM technology according to the embodiment of the present invention. [Figure 23] This is an illustrative structural diagram of the encoder configuration according to an embodiment of the present invention. [Figure 24] This is a schematic diagram of the specific hardware structure of the encoder according to the embodiment of the present invention. [Figure 25] This is an illustrative structural diagram of the decoder configuration according to an embodiment of the present invention. [Figure 26] This is a schematic diagram of the specific hardware structure of the decoder according to the embodiment of the present invention. [Figure 27] This is an illustrative structural diagram of the configuration of the coding and decoding system according to an embodiment of the present invention. [Modes for carrying out the invention]

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

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

[0018] In the following description, the term “several embodiments” refers to a subset of all possible embodiments, and to the extent that it is understandable, “several embodiments” may be the same subset or different subsets of all possible embodiments, and these can be combined with one another without conflict. The terms “first / second / third” as used in the embodiments of this application are merely for distinguishing similar subjects and do not represent a particular order of subjects, and to the extent that it is understandable, “first / second / third” may, in some cases, be replaced with a particular order or sequence, thereby allowing the embodiments of this application described herein to be carried out in an order other than that shown or described.

[0019] Before describing the embodiments of this application in more detail, we will first explain the nouns and terms referred to in the embodiments of this application, and the following interpretations apply to the nouns and terms referred to in the embodiments of this application.

[0020] Coding Block (CB) Coding Unit (CU) Block Vector Difference (BVD) Block Matching (BM) Template Matching (TM) Merge Advanced Motion Vector Prediction (AMVP) Advanced Block Vector Prediction (ABVP) Combined Inter and Intra Prediction (CIIP) Geometric Partitioning Prediction (GPM:Geometric Partitioning Mode) Local Illumination Compensation (LIC) Reconstruction-Reordered IBC (RRIBC) Sum of Absolute Difference (SAD) Sum of Absolute Transformed Difference (SATD) Mean Squared Error (MSE) Sum of Squared Differences (SSD) Mean Absolute Difference (MAD) Mean Square Differences (MSD) Normalized Cross-Correlation Coefficient (NCC) Essential Video Coding (EVC) H.265 / High Efficiency Video Coding (HEVC) H.266 / Versatile Video Coding (VVC) VVC Reference Software Test Platform (VTM: VVC Test Model) Beyond VVC's reference software testing platform (ECM: Enhanced Compression Model).

[0021] To make it easier to understand, in a video image, an encoded block is generally represented by a first color component, a second color component, and a third color component, where these three color components are one luminance component, one blue difference component, and one red difference component, specifically the luminance component is usually represented by the code Y, the blue difference component is usually represented by the code Cb or U, and the red difference component is usually represented by the code Cr or V. In this way, a video image may be represented in YCbCr format or in YUV format.

[0022] To further understand, Intra-block copy (IBC) is an extension of Screen Content Coding (SCC) that VVC provides for screen content type video sequences, and can significantly improve the coding efficiency of screen content sequences. IBC is a block-level coding mode, and similar to interframe technology, the coding side finds the optimal block vector (BV) for each coded block by motion lookup (block matching), also known as the motion vector (MV), and the block vector is a vector that points from the current block to a reference block. The difference from interframe technology is that the optimal block vector in IBC is looked up in the reconstruction region of the frame in which the current block is located (i.e., the current coded frame), whereas the motion vector in interframe is obtained by looking up adjacent reference frames in the time domain of the current coded frame.

[0023] In coding standards such as H.265 / HEVC SCC, H.266 / VVC, and AV1, AVS3, and EVC, IBC technology is used as an important tool for screen-to-video coding. In ECM, the search model for the next generation of H.266 / VVC coding standards, IBC technology continues to be used as a tool for screen-to-video coding, and has been further extended into a toolset that uses multiple modes in combination. At the same time, it has also been introduced into the field of coding normal natural video, making it a more versatile video coding tool.

[0024] On the decoding side, in IBC mode, the basic decoding process involves several steps: obtaining the BV, obtaining the predicted value using the BV, and determining the reconstructed value. Specifically, Figure 1 is an exemplary flowchart for obtaining the reconstructed pixel value. As shown in Figure 1, the process may include the following steps.

[0025] In step S101, BV is obtained.

[0026] The decoding side can obtain the BV by parsing the syntax. In actual implementation, since there can be multiple methods for obtaining the BV, the bitstream can include mode information regarding the BV acquisition method and corresponding parameter information. For example, if the syntax element indicates that it is in IBC merge mode, the decoder constructs a merge list, parses the item index of the merge list, and then obtains specific BV information from the corresponding item in the merge list based on the index. As another example, in the case of normal IBC mode, the decoder obtains specific BV information by parsing the value of the syntax element in the bitstream that describes the BV or the predicted residual of the BV.

[0027] In step S102, predictive samples are obtained using BV.

[0028] Furthermore, it is worth noting that predicted values ​​can be obtained using BV. Using BV here typically involves copying the corresponding region pointed to by BV, thereby obtaining the predicted value for the current block.

[0029] In step S103, the reconstituted sample is determined based on the predicted sample.

[0030] Furthermore, it should be noted that when obtaining reconstructed values, if prediction residuals exist, it is necessary to analyze the bitstream to obtain the prediction residuals, and then perform processing such as adding the prediction residuals to the predicted values ​​to obtain the final reconstructed values.

[0031] In the embodiments of this application, there are several points related to the use of templates and template matching costs, so we will explain them uniformly here beforehand.

[0032] Figure 2 is a schematic diagram showing the template types in IBC mode. As shown in Figure 2, the grid-patterned blocks are current blocks, and the adjacent regions of the current blocks are template T, where six template types are shown.

[0033] For example, refTemplateType can represent a template type, and these six template types are as follows:

[0034] If the top-left reference pixel, the upper reference pixel, and the left reference pixel are all available, the value of refTemplateType is 1, and the template shape is as shown in Figure 2(a).

[0035] If only the leftmost reference pixel is available, the value of refTemplateType is 2, and the template shape is as shown in Figure 2(b).

[0036] If only the upper reference pixels are available, the value of refTemplateType is 3, and the template shape is as shown in Figure 2(c).

[0037] If only the leftmost and top-leftmost reference pixels are available, the value of refTemplateType is 4, and the template shape is as shown in Figure 2(d).

[0038] If only the leftmost and bottom-leftmost reference pixels are available, the value of refTemplateType is 5, and the template shape is as shown in Figure 2(e).

[0039] When only the upper and upper right reference pixels are available, the value of refTemplateType is 6, and the template shape is as shown in Figure 2(f).

[0040] In other words, there can be multiple types of templates, including but not limited to those shown in Figure 2. They may be valid simultaneously, specified to be used selectively by syntactic elements, or used individually (for example, using only type (a) in Figure 2).

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

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

[0043]

number

[0044] In one specific embodiment, the specific process for deriving BV in step S101 is as follows:

[0045] (1) Luminance component: Input: A luminance position (xCb, yCb) specifying the top-left corner sample of the current block relative to the top-left corner luminance sample of the current image, a variable cbWidth specifying the width of the current block within the luminance sample, and a variable cbHeight specifying the height of the current block within the luminance sample.

[0046] Output: Block vector of luminance (bvL: Block Vector Luma).

[0047] IBC modes can be broadly divided into two main categories: IBC merge and IBC ABVP (similar to the merge and AMVP modes in intermodes in VVC), and the process for obtaining the BV for both can be considered as consisting of the following three steps.

[0048] (1) When deriving bvL, it is necessary to establish a list of candidate IBC block vectors, bvCandList.

[0049] (2) Further, based on the bitstream, the candidate items in the selected candidate list are determined.

[0050] (3) Finally, the final BV is determined based on the candidate items.

[0051] The information that an IBC candidate item specifically remembers includes at least one of the following:

[0052] Prediction direction (L0 or L1, usually L0 by default), BV information (horizontal component, vertical component), Reference frame (default is current image), Inversion type (e.g., no inversion, horizontal inversion, and vertical inversion), Whether or not to use LIC (Linear Inductive Coherence) models.

[0053] The following describes the process for establishing the block vector candidate list. Using the IBC merge list establishment process as an example, the basic list establishment process for IBC ABVP is the same as that for IBC merge, but the maximum number of candidates is not the same (for example, define the length of the IBC merge candidate list as 6 and the length of the IBC ABVP candidate list as 2). The specific establishment process includes the following:

[0054] Step 1: Derivation of candidate spatial domain items If the usage conditions are met (for example, if the size condition IsGt4by4 is TRUE, i.e., the variable IsGt4by4 is TRUE if the product of luminance width and height is greater than 16), the process for deriving spatial block vector candidates from neighboring coding units, as defined in the decoding standard, is invoked, taking the luminance coded block position (xCb, yCb), luminance coded block width cbWidth, and height cbHeight as input, and the output is availability flags, e.g., availableFlagA1, availableFlagB1, and block vectors bvA1 and bvB1.

[0055] Availability detection for each candidate item is as follows: The following conditions are judged, and if all are met, the candidate item is available.

[0056] Whether the sum of the current block position and the offset position due to BVP exceeds the image boundary. Whether the sum of the current block location and the block location pointed to by the BVP does not cover the current block. Whether the sum of the current block position and the offset position due to BVP exceeds the available area of ​​the IBC. Is the sum of the current block position and the block position pointed to by BVP already reconstructed?

[0057] Here, the relative positions of adjacent blocks where A1 and B1 are located and the current block are as shown in Figure 3. The traversal order in Figure 3 could be A1→B1→B0→A0→B2.

[0058] Step 2: Add spatial region candidate items to the candidate list. If the usage conditions are met (for example, if the size condition IsGt4by4 is TRUE), the block vector candidate list bvCandList is constructed as follows:

[0059] i=0 if(availableFlagA1) bvCandList[i++]=bvA1 if(availableFlagB1) bvCandList[i++]=bvB1 ... Step 3: Check the number of valid items in the candidate list. The derivation process for the variable numCurrCand (the number of candidates obtained so far) is as follows:

[0060] If the usage conditions are met (for example, if the size condition IsGt4by4 is TRUE), numCurrCand is set to be equal to the number of candidates in bvCandList; otherwise, numCurrCand is set to 0.

[0061] Step 4: If the candidate list does not reach the specified number of items (for example, 6 items for IBC merge mode, 2 items for IBC ABVP mode), proceed with deriving historical candidate items, detecting availability, and adding them. If numCurrCand is less than MaxNumIbcMergeCand (maximum number of candidates in IBC merge mode) and NumHmvpIbcCand (maximum number of candidates for history-optimal block vectors (Hmvp) in IBC mode) is greater than 0, the history-based IBC block vector candidate derivation process specified in the decoding standard is invoked, with bvCandList and numCurrCand as inputs and the modified bvCandList and numCurrCand as outputs.

[0062] Step 5: Continue checking the number of valid items in the candidate list and adding other available candidate items (e.g., pairwise mean candidate items, zero-value BV candidate items, etc.) until the specified number of items is reached. For example, other available candidate items are as follows:

[0063] (1) Pairwise mean candidates can be constructed using the first and second candidate items, specifically as follows:

[0064] mvAvgLX=(mvCand0LX+mvCand1LX+1)≫1 (2) The zero value BV can be set directly as follows:

[0065] Set bvCandList[numCurrCand][0] to 0. (Horizontal component of bv) Set bvCandList[numCurrCand][1] to 0. (Vertical component of bv) (3) A pair of BVP candidate items located in the IBC reference area can also be made into additional candidate items. The coordinates of a pair of BVP candidate items are determined by the width and height of the current block and the ΔX and ΔY parameters, as shown in Figure 4.

[0066] For each item added, numCurrCand increases by 1.

[0067] In this way, the establishment of the basic block vector candidate list bvCandList is complete.

[0068] Based on this list, the IBC merge mode can further use templates to resort the list, adjusting the order of the candidate list and making full use of high spatial correlation to reduce the transmission of encoded bits and effectively improve encoding efficiency. For example, for the IBC merge mode, after constructing an intermediate candidate list (note that the length of this intermediate candidate list may be greater than or equal to the maximum number of candidates in the IBC merge mode) using the list construction method described above, all candidate items in the list are resorted using templates, sorted in ascending order of template matching cost, and the first N (e.g., N=6) candidate items of the sorted list are selected. The specific process is as follows: the SAD of the template position of the reference block pointed to by each candidate item and the template position of the current block (shown in Figure 5) is calculated, these are arranged in ascending order, and the first 6 candidate items are selected as the candidate list for the IBC merge.

[0069] Based on this list, IBC ABVP mode can further perform operations to remove candidate redundancy based on the distance between candidate items.

[0070] The number of candidates remains unchanged at two, and candidate lists are established separately for integer pixels and 4-pixel precision.

[0071] If a non-RRIBC mode is selected for IBC ABVP and there are more than two valid BVP candidates, the top six BVP candidates in the candidate list are clustered based on the Euclidean distance between them, where the radius (R) is determined as the logarithmic function of the current block width (cbWidth) and height (cbHeight) for a pair of block vectors, and if the Euclidean distance between the reference locations pointed to by several BV candidates is less than R, they are clustered.

[0072] R=log2((cbWidth·cbHeight)>>MIN_PU_SIZE)} (2) Figure 6 is a schematic diagram showing the clustering of block vector prediction candidates. As shown in Figure 6, the filled blocks in the grid are coded blocks CB, and the white blocks are prediction blocks PB. Here, the three prediction blocks pointed to by BVP1, BVP2, and BVP5 form the first set, the two prediction blocks pointed to by BVP3 and BVP6 form the second set, and the prediction block pointed to by BVP4 forms the third set. Here, the three BVP candidates in the first set are clustered, and the two BVP candidates in the second set may also be clustered. It should be noted that the clustering method is performed according to the order of the candidate list, and within each cluster, the BVP with the lowest TM cost is selected as the representative candidate for that set. Then, a template sort is performed on the representative candidates for all clusters, and the first two sets of representative candidates are selected for the motion estimation process.

[0073] When RRIBC mode is selected for IBC ABVP, candidate items can be adjusted to point to the boundaries of the valid IBC search area according to the horizontal or vertical direction of RRIBC mode.

[0074] Furthermore, based on the bitstream, the candidate items in the selected candidate list are determined, and the specific steps are as follows:

[0075] In IBC merge mode (general_merge_flag[xCb][yCb] is true) and IBC ABVP mode (general_merge_flag[xCb][yCb] is false), the candidate index bvIdx is derived in the following way, and general_merge_flag indicates whether or not it is IBC merge mode.

[0076] bvIdx=general_merge_flag[xCb][yCb]?merge_idx[xCb][yCb]:mvp_l0_flag[xCb][yCb].

[0077] Furthermore, the final BV (Business Value) is determined based on these candidate items.

[0078] In IBC merge mode, a specific bvL can be obtained based on the index bvIdx and the block vector candidate list bvCandList.

[0079] bvL[0]=bvCandList[bvIdx][0] bvL[1]=bvCandList[bvIdx][1] This bvL will be the final BV.

[0080] In IBC MBVD mode, similar to MMVD in VVC interframe technology, one candidate item from the IBC merge list is used as a starting point, one candidate item is selected from a set of candidate points corresponding to a predefined set of distances and directions, and the corresponding block vector is used as the final BV.

[0081] For example, in IBC MBVD, the distance set is defined as {1-pel, 2-pel, 4-pel, 8-pel, 12pel, 16pel, 24pel, 32pel, 40pel, 48pel, 56pel, 64pel, 72pel, 80pel, 88pel, 96pel, 104pel, 112pel, 120pel, 128pel}, and the BVD directions are two horizontal directions (positive and negative) and two vertical directions (positive and negative).

[0082] The base candidate items can be selected from the top five candidate items in the re-sorted IBC merge list, and all possible MBVD refinement positions for each base candidate (i.e., 20 × 4 candidate items) are re-sorted based on the SAD cost between the template and its reference to each refinement position. Finally, the top eight refinement positions with the smallest template SAD are retained for MBVD index coding. IBC-MBVD candidate items do not inherit the inversion type from adjacent blocks coded in RR-IBC. The MBVD index is binarized by a Rice code with a parameter equal to 1.

[0083] In IBC TM merge mode, after obtaining bvL based on the above information, TM is used to further refine the BV locally. Specifically, a search is performed within a narrow range centered on the obtained bvL, and the optimal BV within that range is selected as the final BV based on the criterion of minimizing the template matching cost.

[0084] The TM refinement process for the candidate list in IBC merge mode is as follows:

[0085] When constructing candidate items, the inversion type will be set to "no inversion" by default.

[0086] The IBC TM merge mode specifies whether the transmitted syntactic elements undergo integer pixel-precision TM refinement under IBC merge mode. Both the refinement motion vector and the template position used in each refinement step must adhere to the reference area constraints.

[0087] The search is performed in the vicinity of the location pointed to by the candidate item, and the optimal position is determined by the magnitude of the SAD between the template of the reference block and the template of the current block. The following search methods are included, but are not limited to them. The search range is set to [-8,8], and first, as shown in Figures 7A and 7B, a diamond search of integer pixels is performed to search for 8 points in the vicinity of the center position, with a maximum of 375 searches. The search continues even after the first optimal position is determined, and in the subsequent search process, 5 points are searched at even positions and 3 points at odd positions.

[0088] For illustrative purposes, taking Figure 7A as an example, moving counterclockwise from the black dot corresponds to the order of indices 0 to 7. Specifically, the process described above involves searching for five points at the grid points' locations consecutively when the position of the black dot is selected as the optimal position, and, taking Figure 7B as an example, searching for three points at the grid points' locations consecutively when the position of the black dot is selected as the optimal position. This is merely an illustrative explanation and is not intended to impose any specific limitations.

[0089] After the diamond-shaped search process described above, a cross search of integer pixels is performed only once. That is, after the current optimal position is found by the diamond-shaped search, four positions located one pixel away from the current optimal position—below, to the right, above, and to the left—are checked to update the final optimal position, and thus the refined candidate list is updated.

[0090] In IBC ABVP mode, the predicted bvL is obtained using the index bvIdx and the block vector candidate list bvCandList. The true bvL needs to be further calculated by adding the block vector difference (BVD), and the generalized specific process is as follows:

[0091] In step 1, the horizontal and vertical components of BVD are obtained, where MvdL0 is the difference in the forward motion vector.

[0092] bvd[0]=MvdL0[xCb][yCb][0] bvd[1]=MvdL0[xCb][yCb][1] In step 2, a rounding operation is performed on the predicted bvL obtained above, where the right shift parameter AmvrShift is used for rounding, and the left shift parameter AmvrShift is used to improve the resolution. Specifically, this is done as follows:

[0093] Offset=(AmvrShift==0)?0:((1<<(AmvrShift-1))-1) bvL[0]=Sign(bvL[0])×(((Abs(bvL[0])+offset)>>AmvrShift)< <AmvrShift) bvL[1]=Sign(bvL[1])×(((Abs(bvL[1])+offset)>>AmvrShift)< <AmvrShift) In step 3, the true bvL must be within the range of -217 to 217-1, which is derived as follows.

[0094] u[0]=(bvL[0]+bvd[0]+218)%218 bvL[0]=(u[0]>=217)?(u[0]-218):u[0] u[1]=(bvL[1]+bvd[1]+218)%218 bvL[1]=(u[1]>=217)?(u[1]-218):u[1] Furthermore, the method for obtaining the BVD in Step 1 can also be derived from syntactic elements obtained by other encoding methods. IBC ABVP's BVD uses subpixels, integer pixels, or 4 pixels as units. During encoding, the code can be predicted, and the suffix of the exponential Golomb code obtained after binarization can also be predicted. Therefore, the syntactic elements can be defined by multiple pieces of information from the BVD value: a flag of 0 or not, a prefix, a code, and a suffix. The actual value of the BVD can be obtained by analyzing the combination of this information. A specific example is as follows.

[0095] The identifier for whether BVD is 0 or not employs context coding. Values ​​(absolute value -1) are binarized using a first-order exponential Golomb, the first five binary data (bin:Binary) of the EG1 prefix are coded using context coding, and the remaining prefix is ​​bypass coded. Up to four bins of the EG1 suffix transmit the predicted index using context coding, while the other bins of the EG1 suffix employ bypass coding. The two bins of the sign bit transmit the sign predicted index using context coding. Figure 8 is a schematic diagram showing the relationship between block vectors (BV), block vector predictions (BVP), and block vector differences (BVD). As shown in Figure 8, dashed lines represent BV, dotted lines represent BVP, and thick lines represent BVD. This is a prediction process for suffix bins that transmit one prediction index each in the horizontal and vertical directions, and bins that transmit one sign index each in the horizontal and vertical directions. The current block template and the corresponding BV template are used for sorting, and the prediction indices for the suffix and sign are derived.

[0096] In this way, the final derived BV must fall within the specified range (a coordinate range based on rows and columns).

[0097] For example, in VVC, the reference area of ​​the IBC is 128×128, and for a 128×128 size CTU, the reference area is as shown in Figure 9. In Figure 9, in any case of (a), (b), (c), or (d), there are two CTUs, the diagonally filled area is the reference area, the small vertically filled block represents a 64×64 size current block, and "×" represents an unavailable reference area.

[0098] In ECM7.0, as shown in Figure 10, each rectangle represents a CTU, a rectangle filled with vertical lines represents the CTU where the current block is located, and a rectangle filled with diagonal lines represents its reference region. Specifically, assuming that the current block to be encoded is located at CTU(m,n), the reference region includes CTUs with indices (m-2,n-2)...(W,n-2)...(0,n-1)...(W,n-1) and (0,n)...(m,n). Here, W represents the largest horizontal index in the current Tile, Slice, or Picture.

[0099] If the CTU size is 256x256, the two rows of CTUs shown above may require additional memory. To prevent the IBC from occupying additional memory, the reference area is adjusted as shown in Figure 11. Here, one rectangle represents one CTU, a rectangle filled with vertical lines represents the CTU where the block is currently located, and a rectangle filled with diagonal lines represents its reference area.

[0100] The range over which each block performs a block vector search (or local search) is limited horizontally [-(C<<1),C>>2] and vertically [-C,C>>2] to accommodate the expansion of the reference domain, where C represents the CTU size.

[0101] (2) Chromaticity component: In the IBC mode for the chromaticity component, the BV of the chromaticity component can be derived based on the BV of the luminance component, and prediction and reconstruction can then be performed based on the BV of the chromaticity component. The process for deriving the BV of the chromaticity component based on the BV of the luminance component is as follows.

[0102] Input: Brightness bvL (1 / 16 pixel precision) Output: Chromaticity component BVC (Block Vector Chroma) (1 / 32 pixel precision) The derivation process may involve direct scaling or scaling followed by refinement using TM.

[0103] An example of a scaling operation is as follows:

[0104] bvC[0]=((bvL[0]>>(3+SubWidthC))×32) bvC[1]=((bvL[1]>>(3+SubHeightC))×32) Here, the variables SubWidthC and SubHeightC specifically depend on the chromaticity format sampling structure specified by sps_chroma_format_idc, and please refer to Table 1 for the specific correspondence. Table 1 shows the correspondence between sps_chroma_format_idc and the chromaticity format sampling structure.

[0105] [Table 1] The refinement operation may include the following methods:

[0106] Using TM, refinement is performed, that is, after obtaining the BV of the luminance component, the offset position is found using the position of the chromaticity block and the BV, and a detailed search is performed in the vicinity of the offset position using a template, and the optimal BV (i.e., the refined BV) is obtained based on the criterion that minimizes TMcost. As shown in Figure 12, the shaded area represents the chromaticity reconstruction area, and for the current block, the template matching method can be adopted to find the optimal matching template and the corresponding refined BV, the reference block at the optimal offset position obtained by the refined BV can be copied, and furthermore, the chromaticity prediction value of the current block can be determined.

[0107] In one specific embodiment, the specific process for obtaining predictive samples using BV in step S102 is as follows:

[0108] Input: Luminance position (xCb, yCb) specifying the top-left corner sample of the current block relative to the top-left corner luminance sample of the current image, variable cbWidth specifying the width of the current block within the luminance sample, variable cbHeight specifying the height of the current block within the luminance sample, block vector bv, variable cIdx specifying the color component index of the current block.

[0109] Output: Predicted sample sequence predSamples.

[0110] One implementation method involves the following example of a derivation process for obtaining a predicted block by direct copying:

[0111] When cIdx is 0, i.e., for the luminance component, the following applies to x = xCb ... xCb + cbWidth - 1 and y = yCb ... yCb + cbHeight - 1.

[0112] xVb=(x+(bvL[0]>>4))&(IbcBufWidthY-1) yVb=(y+(bvL[1]>>4))&(CtbSizeY-1) predSamples[x][y]=ibcVirBuf[0][xVb][yVb] Here, IbcBufWidthY is the width of the luminance pixels of the reconstructed buffer stored in the IBC, CtbSizeY is the size of the CTU (Coding Tree Unit), and ibcVirBuf is the reconstructed pixel stored in the IBC.

[0113] When cIdx is not 0, i.e., in the case of the chromaticity component, for x = xCb / SubWidthC..xCb / SubWidthC + cbWidth / SubWidthC-1 and y = yCb / SubHeightC..yCb / SubHeightC + cbHeight / SubHeightC-1, the following applies:

[0114] xVb=(x+(bvC[0]>>4))&(IbcBufWidthC-1) yVb=(y+(bvC[1]>>4))&((CtbSizeY / subHeightC)-1) predSamples[x][y]=ibcVirBuf[cIdx][xVb][yVb] In addition to the basic acquisition methods described above, there is an IBC inversion mode, which requires a method to obtain the predicted value after horizontally or vertically inverting the prediction region. For example, one syntax element indicates whether or not to invert, and if so, whether to horizontally or vertically invert. The decoding side obtains the predicted pixel value of the encoded block by rearranging the reference region pixels in reverse order horizontally or vertically based on the instructions of the syntax.

[0115] In addition to the acquisition process described above, it is also possible to use templates to establish a model between the current block and the predicted region, process the predicted block based on the model, and then obtain the predicted value of the current block. For example, the IBC LIC mode is applied to IBC merge and IBC ABVP and compensates for local illumination changes using a linear equation. Similar to the LIC for interpretation of VVCs, the parameters of the linear equation can be expressed in terms of a scaling parameter α and an offset parameter β, i.e., α × p[x] + β compensates for illumination changes, where p[x] is the reference sample pointed to by the BV at position x in the current image. The linear model parameters are derived using the least squares method.

[0116] Based on the predicted values ​​obtained above, weighted predictions using other intra-prediction methods can be performed, and the results after weighted prediction can be used as the final prediction results.

[0117] The weighted prediction method includes a method that weights and combines the results obtained by the above prediction process at each pixel position with the prediction results obtained by the normal intra-directional prediction mode, based on VVC's inter / intra composite prediction (CIIP). Furthermore, it also includes a method that, based on VVC's inter-prediction geometric prediction mode (GPM), uses a single wedge division as a basis, uses results obtained by different prediction modes in different wedge regions, and performs weighted mixing according to a certain rule near the wedge division line.

[0118] An example of the operation process in IBC CIIP mode: The IBC prediction value of the current block and the prediction value of a certain intra-mode are weighted and merged, and the conventional merge, TM merge, MBVD, and ABVP modes can be applied to the IBC prediction portion.

[0119] If the IBC prediction portion is in the conventional IBC merge, TM merge, or MBVD mode, the weight ratio of IBC prediction to intra prediction is 13:3. The intra mode includes the TIMD mode of the current block and the intra prediction mode in the candidate BV. If the second prediction mode of the intra mode is the same as the first prediction mode, it is determined whether the first prediction mode is in PLANAR mode. If so, the second prediction mode is replaced with the horizontal prediction mode; otherwise, the second prediction mode is replaced with PLANAR mode.

[0120] If the IBC prediction portion is in ABVP mode, the weight ratio between IBC prediction and intra prediction is 1:1. The TIMD mode is obtained as the first prediction mode of the intra prediction mode. If the derived prediction mode is the horizontal prediction mode, PLANAR is obtained as the second prediction mode of the intra prediction mode; otherwise, the horizontal prediction mode is obtained as the second prediction mode of the intra prediction mode.

[0121] An example of the operation process in IBC GPM mode: Conventional merge and TM merge can be applied to the IBC prediction portion. Only a mode is created where one partition is IBC and one partition is INTRA, and the intra prediction mode (IPM) candidate list is constructed using the same method as interGPM, with the size of the IPM candidate list defined as 3 in advance.

[0122] In practical implementation, there are a total of 48 geometric partitioning modes, which can be divided into two sets of geometric partitioning modes. Table 2 shows the first geometric partitioning mode set, and Table 3 shows the second geometric partitioning mode set.

[0123] [Table 2]

[0124] [Table 3]

[0125] When using IBC GPM, transmit the IBC GPM geometric partition mode set flag to indicate whether the first or second geometric partition mode set is selected, followed by the geometric partition mode index. Furthermore, transmit the IBC-GPM intra-partition flag to indicate whether intra-prediction is used for the first subpartition. Here, the intra-prediction portion must transmit the intra-prediction mode index, and the IBC prediction portion must transmit the MERGE index.

[0126] Furthermore, in step S103, a reconstituted sample is obtained. Specifically, this may be as follows:

[0127] If residuals exist, the decoding process for the residual signal as defined in the decoding standard is invoked.

[0128] This invokes the image reconstruction process for the specified color components defined in the decoding standard.

[0129] In other words, after obtaining the predicted value, if there are residuals, the decoding process of the residual signal as defined in the decoding standard can be invoked to obtain the residual value, and then the reconstructed value can be obtained based on the sum of the predicted value and the residual value.

[0130] As can be seen, IBC is a block-level encoding mode, and similar to interframe technology, the encoding side finds the optimal block vector for each encoded block through motion lookup (block matching), and this block vector is a vector that points from the current block to the reference block. However, in the actual encoding process, directly using the reconstructed pixels of the optimally matching reference block as the predicted pixels of the current block is not optimal in some situations. For example, if there is a linear change in illumination between the optimally matching reference block and the current block, using the reconstructed pixels of the optimally matching reconstructed block as the predicted pixels of the current encoded block will result in a large deviation, and the optimal prediction effect cannot be achieved. Also, when using IBC to encode natural scene video, the limited accuracy of the BV is often a cause of insufficient prediction effect. Even if LIC mode is applied or weighted fusion with other intra modes is performed, good prediction accuracy cannot be achieved.

[0131] In view of this, the embodiment of the present application provides an encoding method for determining a first template of the current block, determining a list of candidate block vectors for the current block, determining a first block vector based on the list of candidate block vectors, and determining a matching template and a corresponding reference block based on the first block vector. Based on the first template and the matching template, model parameters are determined. Based on the model parameters, a filtering process is performed on the reference blocks. The filtered reference blocks are determined, and based on the filtered reference blocks, the predicted value of the current block is determined.

[0132] Embodiments of the present invention further provide a decoding method which involves determining a first template for the current block, determining a list of candidate block vectors for the current block, decoding the bitstream to determine block vector indication information, determining a first block vector based on the block vector indication information and the list of candidate block vectors, determining a matching template and a corresponding reference block based on the first block vector, determining model parameters based on the first template and the matching template, performing a filtering process on the reference blocks based on the model parameters, determining the filtered reference blocks, and determining the predicted value of the current block based on the filtered reference blocks.

[0133] Thus, the model parameters are determined based on the first template and the matching template. These model parameters fully reflect the correlation between the matching template and the first template of the current block. By applying this correlation to the reference block, applying filtering to its reconstructed pixels, and using the filtered reconstructed pixels as the predicted pixels of the current block, prediction accuracy is improved, bitrate is saved, and the problem of linear changes between the reference block and the current block is effectively resolved. At the same time, the efficiency of encoding and decoding is improved, and the performance of encoding and decoding can be further enhanced.

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

[0135] Referring to Figure 13A, a schematic block diagram of the encoder configuration according to an embodiment of the present invention is shown. As shown in Figure 13A, the encoder (specifically, the "video encoder") 100 includes 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 image buffer unit 110, etc. Here, the filtering unit 108 can implement deblocking filtering and sample adaptive offset (SAO) filtering, and the encoding unit 109 can implement header information encoding and context-based adaptive binary arithmetic coding (CABAC). For the input original video signal, a video coding block can be obtained by dividing it into a Coding Tree Unit (CTU). Then, the residual pixel information obtained by intra-prediction or inter-prediction is transformed by the transformation and quantization unit 101, which includes transforming the residual information from the pixel region to the transformation region and quantizing the resulting transformation coefficients, thereby further reducing the bitrate. The intra-estimation unit 102 and the intra-prediction unit 103 are configured to perform intra-prediction on the video coding block. Specifically, the intra-estimation unit 102 and the intra-prediction unit 103 are configured to determine the intra-prediction mode used to encode the video coding block. The motion compensation unit 104 and the motion estimation unit 105 are configured to perform inter-prediction coding on the received video coding block for one or more blocks in one or more reference frames to provide time prediction information.Motion estimation performed by the motion estimation unit 105 is a process that generates motion vectors, which are used to estimate the motion of the video coding block, and the motion compensation unit 104 performs motion compensation based on the motion vectors determined by the motion estimation unit 105. After the intra-prediction mode is determined, the intra-prediction unit 103 is further configured to provide selected intra-prediction data to the coding unit 109, and the motion estimation unit 105 is configured to send the computationally determined motion vector data to the coding unit 109. Furthermore, the inverse transform and inverse quantization unit 106 is configured to reconstruct the video coding block. The residual block is reconstructed in the pixel region, the reconstructed residual block has blocking artifacts removed by the filter control analysis unit 107 and the filtering unit 108, and the reconstructed residual block is added to one prediction block in the frame of the decoded image buffer unit 110 to generate the reconstructed video coding block. The encoding unit 109 is configured to encode various encoding parameters and quantized transformation coefficients, and in a CABAC-based encoding algorithm, the context content is based on adjacent encoding blocks and can encode information indicating the determined intra-prediction mode and be used to output the bitstream of the video signal, and the decoding image buffer unit 110 is configured to store reconstructed video encoding blocks used for prediction reference. As the encoding of the video image progresses, newly reconstructed video encoding blocks are continuously generated, and all of these reconstructed video encoding blocks are stored in the decoding image buffer unit 110.

[0136] Referring to Figure 13B, a schematic block diagram of the decoder configuration according to an embodiment of the present invention is shown. As shown in Figure 13B, the decoder (specifically, the "video decoder") 200 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra prediction unit 203, a motion compensation unit 204, a filtering unit 205, and a decoded image buffer unit 206, etc. Here, the decoding unit 201 can perform header information decoding and CABAC decoding, and the filtering unit 205 can perform deblocking filtering and SAO filtering. After performing the encoding process shown in Figure 13A on the input video signal, the bitstream of the video signal is output and input to the decoder 200. First, the decoding unit 201 processes the decoded transformation coefficients, and these transformation coefficients are processed by the inverse transform and inverse quantization unit 202 to generate residual blocks in the pixel region. The intra-prediction unit 203 is configured to generate prediction data for the current video decoding block based on the determined intra-prediction mode and data from previous decoding blocks from the current frame or picture. The motion compensation unit 204 is configured to determine prediction information for the video decoding block by analyzing the motion vector and other relevant syntactic elements, and to use this prediction information to generate a prediction block for the video decoding block currently being decoded. The decoded video block is formed by adding the residual block from the inverse transform and inverse quantization unit 202 with the corresponding prediction block generated by the intra-prediction unit 203 or the motion compensation unit 204. The decoded video signal can then be filtered by the filtering unit 205 to remove blocking artifacts and improve video quality. The decoded video block is then stored in the decoded image buffer unit 206, which stores a reference image used for subsequent intra-prediction or motion compensation, and is also used for outputting the video signal, i.e., obtaining the restored original video signal.

[0137] Furthermore, embodiments of the present application further provide a network architecture for an encoding / decoding system comprising an encoder and a decoder, where Figure 14 shows a schematic diagram of the network architecture of the encoding / decoding system according to embodiments of the present application. As shown in Figure 14, the network architecture includes one or more electronic devices 13 to 1N and a communication network 01, where the electronic devices 13 to 1N can perform video interaction through the communication network 01. In implementation, the electronic devices may be various types of devices equipped with video encoding / decoding functions, for example, the electronic devices may include smartphones, tablet computers, personal computers, personal information terminals, navigation devices, digital telephones, video phones, televisions, sensing devices, servers, etc., and embodiments of the present application are not particularly limited thereto. Here, the decoder or encoder described in embodiments of the present application may be the above-mentioned electronic devices.

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

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

[0140] In one embodiment of the present application, with reference to Figure 15, an illustrative flowchart of the decoding method according to the embodiment of the present application is shown. As shown in Figure 15, the method may include the following steps.

[0141] In step S1501, the first template of the current block is determined, and the candidate list of block vectors for the current block is determined.

[0142] The decoding method of the embodiment of this application is applied to a decoder. More specifically, this decoding method may refer to an intra prediction method, and more specifically, an intra prediction method of an intra-block copy technique based on a filter-based linear model (IBC-FLM). However, it is not limited to the IBC mode and is applicable to all other modes to which block vectors are applied. Here, a video image can be divided into multiple decoding blocks, and the current block in the embodiment of this application refers to the decoding block in the video image that is currently subject to intra prediction. Furthermore, the decoding method of the embodiment of this application can be used for both predicting luminance components and predicting chromaticity components, and is not specifically limited here.

[0143] Furthermore, it should be noted that in the embodiments of this application, in order to facilitate the determination of the matching template and the corresponding reference block based on the first template, it is necessary to first determine the first template of the current block. In some embodiments, determining the first template of the current block is Currently, the template type of the block is determined, This may include determining the first template of the current block based on the current block's template type.

[0144] Here, the template type can be represented by refTemplateType. In some embodiments, determining the template type of the current block may involve determining the template type of the current block based on the reference pixels of the current block.

[0145] Here, the reference pixel of the current block includes at least one of the adjacent reference pixels to the left of the current block, the adjacent reference pixels above the current block, and the adjacent reference pixel to the upper left of the current block.

[0146] Exemplary, Figure 16 shows a schematic diagram of the IBC mode template type according to an embodiment of the present application. Here, when the upper left, upper, and left reference pixels are all available, the value of refTemplateType is 1 and the shape of the template type is as shown in Figure 16(a); when only the left reference pixel is available, the value of refTemplateType is 2 and the shape of the template type is as shown in Figure 16(b); and when only the upper reference pixel is available, the value of refTemplateType is 3 and the shape of the template type is as shown in Figure 16(c).

[0147] In other words, in the embodiments of the present application, the reference pixels of the current block are determined based on the adjacent reconstructed region of the current block. Here, the adjacent reconstructed region of the current block includes at least one of the left adjacent region, the upper adjacent region, and the upper-left adjacent region. For example, the left adjacent reference pixels of the current block may be determined by at least one column of reconstructed pixels in the left adjacent region, the upper adjacent reference pixels of the current block may be determined by at least one row of reconstructed pixels in the upper adjacent region, and the upper-left adjacent reference pixels of the current block may be determined by at least one column of reconstructed pixels in the upper-left adjacent region, but this is not specifically limited here.

[0148] Furthermore, the template type can be classified based on whether adjacent reference pixels are available, and the template type of the current block can be determined. In some embodiments, determining the template type of the current block is: If both the adjacent reference pixel to the left of the current block and the adjacent reference pixel above the current block are available, the bitstream may be decoded and the template type of the current block may be determined.

[0149] In the embodiments of this application, the template type of the current block may be predetermined or determined by decoding the bitstream. Here, if the left adjacent reference pixel of the current block, the upper adjacent reference pixel of the current block, and the upper-left adjacent reference pixel of the current block are all available, the template type of the current block is determined to be a first type value; if the left adjacent reference pixel of the current block is available, the template type of the current block is determined to be a second type value; and if the upper adjacent reference pixel of the current block is available, the template type of the current block is determined to be a third type value. Exemplarily, if both the left adjacent reference pixel and the upper adjacent reference pixel are available, it is also possible to use a second or third type template. In this case, the bitstream can be used to specify which template to use.

[0150] In the embodiments of this application, the first type value, the second type value, and the third type value may be different from each other. For example, the first type value can be set to 1, the second type value can be set to 2, and the third type value can be set to 3. For these three template types, please refer specifically to Figures 16(a), (b), and (c).

[0151] Furthermore, it should be noted that in the embodiments of this application, the template type of the current block is typically L-shaped, i.e., Figure 16(a). The L-shaped template may consist of the adjacent reference pixel to the left of the current block and the adjacent reference pixel to the top of the current block, or it may consist of the adjacent reference pixel to the left of the current block, the adjacent reference pixel to the top of the current block, and the adjacent reference pixel to the top left of the current block. Here, the upper left adjacent reference pixel generally does not need to be specifically mentioned. This is because, in practice, the L-shaped template may not include the upper left pixel. Alternatively, if both the left and top pixels are available, the upper left adjacent pixel is also available.

[0152] In some embodiments, determining the first template of the current block based on the template type of the current block may include obtaining the template pixels of the current block based on the template type of the current block and the corresponding template size, and determining the template pixels of the current block as the first template of the current block.

[0153] In the embodiments of this application, the template size may be predetermined, determined based on the size of the current block, or related to the template type of the current block, but is not specifically limited thereto.

[0154] For example, if the template type indicates that only the left template should be retrieved, the template width templateW_size can be set to 4, and if the template type indicates that only the top template should be retrieved, the template height templateH_size can be set to 4.

[0155] Furthermore, based on the template type value, it is possible to determine which parts of the first template's reconstructed pixels to retrieve. For example, if the value of refTemplateType is 1, the reconstructed pixels on the left, top-left, and top of the current block are retrieved; if the value of refTemplateType is 2, only the reconstructed pixels in the left four columns of the current block are retrieved; and if the value of refTemplateType is 3, only the reconstructed pixels in the top four rows of the current block are retrieved.

[0156] Furthermore, it should be noted that in the embodiments of this application, the template type of the current block can also be written to the bitstream. In this way, the decryption side can determine the template type of the current block by decoding the bitstream, and then determine the first template of the current block based on the template type, and is not particularly limited thereto.

[0157] To make it easier to understand, in the embodiments of this application, for the IBC mode, it is necessary to construct a block vector candidate list. Taking the process of establishing the IBC merge candidate list as an example, the process of establishing the IBC ABVP candidate list is basically the same as that of IBC merge, but the maximum number of candidates for each is not the same. For example, the length of the IBC merge candidate list can be defined as 6, and the length of the IBC ABVP candidate list can be defined as 2.

[0158] In some embodiments, determining the current block's block vector candidate list may include determining at least one first candidate block vector adjacent to the current block based on a spatial block vector candidate derivation method, adding at least one first candidate block vector to the block vector candidate list, and, if the number of candidates in the block vector candidate list satisfies a predetermined threshold, making the current block vector candidate list the current block's block vector candidate list.

[0159] When constructing the block vector candidate list, the spatial region candidate items are derived first. Specifically, if the usage conditions are met (for example, if the size condition IsGt4by4 is TRUE, the variable IsGt4by4 is TRUE if the product of the luminance width and height is greater than 16), the process for deriving spatial block vector candidates from adjacent coding units, as defined in the decoding standard, is called, taking the luminance coded block position (xCb, yCb), luminance coded block width cbWidth, and height cbHeight as inputs. The output is the availability flags, e.g., availableFlagA1, availableFlagB1, and block vectors bvA1 and bvB1.

[0160] Availability detection for each candidate item is as follows: The following conditions are judged, and if all are met, the candidate item is available.

[0161] Whether the sum of the current block position and the offset position due to BVP exceeds the image boundary. Whether the sum of the current block location and the block location pointed to by the BVP does not cover the current block. Whether the sum of the current block position and the offset position due to BVP exceeds the available area of ​​the IBC. Is the sum of the current block position and the block position pointed to by BVP already reconstructed?

[0162] Furthermore, it should be noted that, in the embodiments of this application, taking Figure 3 as an example, the relative positions of adjacent blocks where A1 and B1 are located and the current block should be seen in Figure 3. The traversal sequence in Figure 3 could be A1→B1→B0→A0→B2.

[0163] Next, we add the spatial domain candidate items to the candidate list. If the usage conditions are met (for example, if the size condition IsGt4by4 is TRUE), the block vector candidate list bvCandList is constructed as follows:

[0164] i=0 if(availableFlagA1) bvCandList[i++]=bvA1 if(availableFlagB1) bvCandList[i++]=bvB1 ... Next, we check the number of valid candidates in the block vector candidate list. The derivation process for the variable numCurrCand (the number of candidates obtained so far) is as follows:

[0165] If the usage conditions are met (for example, if the size condition IsGt4by4 is TRUE), numCurrCand is set to be equal to the number of candidates in bvCandList; otherwise, numCurrCand is set to 0.

[0166] Furthermore, in some embodiments, the method may further include, if the number of candidates in the block vector candidate list does not meet a predetermined threshold, determining at least one second candidate block vector based on a history block vector candidate derivation method and subsequently adding at least one second candidate block vector to the block vector candidate list, and, if the number of candidates in the block vector candidate list meets a predetermined threshold, making the current block vector candidate list the block vector candidate list for the current block.

[0167] Furthermore, it should be noted that if the candidate list does not reach the specified number of items (for example, 6 items for IBC merge mode, 2 items for IBC ABVP mode), the derivation, availability detection, and addition of historical candidate items will continue.

[0168] If numCurrCand is less than MaxNumIbcMergeCand (maximum number of candidates in IBC merge mode) and NumHmvpIbcCand (maximum number of candidates for history-optimal block vectors (Hmvp) in IBC mode) is greater than 0, the history-based IBC block vector candidate derivation process specified in the decoding standard is invoked, with bvCandList and numCurrCand as inputs and the modified bvCandList and numCurrCand as outputs.

[0169] Furthermore, in some embodiments, the method may further include determining at least one third candidate block vector based on a method for deriving other available candidates if the number of candidates in the block vector candidate list does not meet a predetermined threshold, and continuing to add at least one third candidate block vector to the block vector candidate list until the number of candidates in the block vector candidate list meets a predetermined threshold.

[0170] In embodiments of the present invention, other available candidate derivation methods may include at least one of the following: a pairwise mean candidate derivation method, a zero-value block vector candidate derivation method, and a candidate derivation method for a reference region corresponding to an intrablock copy.

[0171] Furthermore, it should be noted that after adding at least one second candidate block vector to the block vector candidate list, the check for valid items in the candidate list and the addition of other available candidate items (e.g., pairwise mean candidate items, zero-value BV candidate items, etc.) should continue until the specified number of items is reached.

[0172] For example, other available candidate items are as follows:

[0173] (1) Pairwise mean candidates can be constructed using the first and second candidate items, specifically as follows: mvAvgLX=(mvCand0LX+mvCand1LX+1)≫1

[0174] (2) The zero value BV can be set directly as follows: Set bvCandList[numCurrCand][0] to 0. (Horizontal component of bv) Set bvCandList[numCurrCand][1] to 0. (Vertical component of bv)

[0175] (3) A pair of BVP candidate items located in the IBC reference area can also be made into additional candidate items. The coordinates of a pair of BVP candidate items are determined by the width and height of the current block and the ΔX and ΔY parameters, as shown in Figure 4.

[0176] Furthermore, it should be noted that in the embodiments of this application, numCurrCand increments by 1 for each additional item. Thus, the process continues until numCurrCand satisfies a predetermined threshold, completing the establishment of the basic block vector candidate list bvCandList.

[0177] Furthermore, after the construction of the block vector candidate list is complete, the method may further include determining the block vector candidate list for the current block and then sorting the block vector candidate list.

[0178] Furthermore, in the embodiment of this invention, in IBC merge mode, templates can be used to further resort the order of the list, adjusting the order of the candidate list and making full use of high spatial correlation to reduce the transmission of encoded bits and effectively improve encoding efficiency. For example, in IBC merge mode, after constructing an intermediate candidate list (note that the length of the intermediate candidate list may be greater than or equal to the maximum number of candidates in IBC merge mode) using the list construction method described above, a template is used to resort all candidate items in the list, sort them in ascending order of template matching cost, and the first N (e.g., N=6) candidate items of the sorted list are selected. The specific process is as follows: the SAD of the template position of the reference block pointed to by each candidate item and the template position of the current block (shown in Figure 5) is calculated, these are arranged in ascending order, and the first 6 candidate items are selected as the candidate list for IBC merge.

[0179] Furthermore, after the construction of the block vector candidate list is complete, the method may further include determining the block vector candidate list for the current block and then removing redundancy based on the distances between candidate block vectors in the block vector candidate list.

[0180] In the embodiments of the present invention, removing redundancy may include, if the current block has selected non-inverting intra-block copy mode, deleting at least one of at least two candidate block vectors in the block vector candidate list when the distance between at least two candidate block vectors satisfies a predetermined condition.

[0181] Furthermore, it should be noted that in the embodiments of this application, in IBC ABVP mode, an operation can be performed to remove candidate redundancy based on the distance between candidate items, the number of candidates remains at two, and candidate lists are established for integer pixels and 4-pixel precision, respectively.

[0182] If a non-RRIBC mode is selected for IBC ABVP and there are more than two valid BVP candidates, the top six BVP candidates in the candidate list are clustered based on the Euclidean distance between them, where the radius (R) is determined as the logarithmic function of the current block width (cbWidth) and height (cbHeight) for a pair of block vectors, and if the Euclidean distance between the reference locations pointed to by several BV candidates is less than R, they are clustered.

[0183] R=log2((cbWidth·cbHeight)≫MIN_PU_SIZE) Furthermore, in some embodiments, the method may further include, if the current block has selected the inverted intra-block copy mode, adjusting the candidate block vectors in the block vector candidate list to point to the boundaries of a valid block copy search area based on a predetermined direction of the inverted intra-block copy mode. That is, if the RRIBC mode is selected for IBC ABVP, the candidate items can be adjusted to point to the boundaries of a valid IBC search area according to the horizontal or vertical direction of the RRIBC mode.

[0184] In this way, the construction of the block vector candidate list is completed.

[0185] In step S1502, the bitstream is decoded to determine block vector instruction information, and a first block vector is determined based on the block vector instruction information and the block vector candidate list.

[0186] In the embodiments of this invention, the block vector indication information may differ depending on the prediction mode. For example, it may be a block vector index number, a block vector difference value, etc., but this is not specifically limited here.

[0187] In one possible embodiment, the block vector designation information may include a block vector index number. Determining a first block vector based on the block vector designation information and the block vector candidate list may include determining a candidate block vector in the block vector candidate list that corresponds to a block vector index number, and setting the candidate block vector as the first block vector.

[0188] For example, in IBC merge mode, a specific bvL can be obtained based on the block vector index number bvIdx and the block vector candidate list bvCandList.

[0189] bvL[0]=bvCandList[bvIdx][0] bvL[1]=bvCandList[bvIdx][1] This bvL will be the final BV.

[0190] In another possible embodiment, the block vector designation information includes a block vector index number and a block vector difference value. Determining a first block vector based on the block vector designation information and the block vector candidate list may include determining a candidate block vector in the block vector candidate list that corresponds to a block vector index number, and determining the first block vector based on the candidate block vector and the block vector difference value.

[0191] For example, in IBC ABVP mode, the predicted bvL is obtained using the block vector index number bvIdx and the block vector candidate list bvCandList, and the true bvL needs to have the block vector difference (BVD) added to it, and the generalized specific process is as follows.

[0192] In step 1, the horizontal and vertical components of BVD are obtained, where MvdL0 is the difference in the forward motion vector.

[0193] bvd[0]=MvdL0[xCb][yCb][0] bvd[1]=MvdL0[xCb][yCb][1] In step 2, a rounding operation is performed on the predicted bvL obtained above, where the right shift parameter AmvrShift is used for rounding, and the left shift parameter AmvrShift is used to improve the resolution. Specifically, this is done as follows:

[0194] Offset=(AmvrShift==0)?0:((1<<(AmvrShift-1))-1) bvL[0]=Sign(bvL[0])×(((Abs(bvL[0])+offset)>>AmvrShift)< <AmvrShift) bvL[1]=Sign(bvL[1])×(((Abs(bvL[1])+offset)>>AmvrShift)< <AmvrShift) In step 3, the true bvL must be within the range of -217 to 217-1, which is derived as follows.

[0195] u[0]=(bvL[0]+bvd[0]+218)%218 bvL[0]=(u[0]>=217)?(u[0]-218):u[0] u[1]=(bvL[1]+bvd[1]+218)%218 bvL[1]=(u[1]>=217)?(u[1]-218):u[1] Furthermore, the method for obtaining the BVD in Step 1 can also be derived from syntactic elements obtained by other encoding methods. IBC ABVP's BVD uses subpixels, integer pixels, or 4 pixels as units. During encoding, the code can be predicted, and the suffix of the exponential Golomb code obtained after binarization can also be predicted. Therefore, the syntactic elements can be defined by multiple pieces of information from the BVD value: a flag of 0 or not, a prefix, a code, and a suffix. The actual value of the BVD can be obtained by analyzing the combination of this information. A specific example is as follows.

[0196] Furthermore, it should be noted that context coding is used for the identifier of whether the BVD is 0 or not. The value (absolute value -1) is binarized using a first-order exponential Golomb, the first five binary data (bin:Binary) of the EG1 prefix are coded using context coding, and the remaining prefix is ​​bypass coded. Up to four bins of the EG1 suffix transmit the predicted index using context coding, while the other bins of the EG1 suffix employ bypass coding. The two bins of the sign bit transmit the sign predicted index using context coding. Figure 8 is a schematic diagram showing the relationship between block vectors (BV), block vector predictions (BVP), and block vector differences (BVD). As shown in Figure 8, here is the prediction process for suffix bins that transmit one predicted index each in the horizontal and vertical directions, and bins that transmit one sign index each in the horizontal and vertical directions, sorting is performed using the current block template and the corresponding BV template to derive the predicted indices for the suffix and sign.

[0197] In another embodiment, the block vector instruction information includes a block vector index number. Determining a first block vector based on the block vector instruction information and the block vector candidate list may include determining a candidate block vector corresponding to a block vector index number in the block vector candidate list, determining a first candidate set based on the candidate block vectors and predefined parameters, and performing a block vector search within the first candidate set to determine the first block vector.

[0198] For example, in IBC MBVD mode, similar to MMVD in VVC interframe technology, one candidate item from the IBC merge list is used as a starting point, one candidate item is selected from a set of candidate points corresponding to a predefined set of distances and directions, and the corresponding block vector is taken as the final BV.

[0199] For example, in IBC MBVD, the distance set is defined as {1-pel, 2-pel, 4-pel, 8-pel, 12pel, 16pel, 24pel, 32pel, 40pel, 48pel, 56pel, 64pel, 72pel, 80pel, 88pel, 96pel, 104pel, 112pel, 120pel, 128pel}, and the BVD directions are two horizontal directions (positive and negative) and two vertical directions (positive and negative).

[0200] Thus, the base candidate items can be selected from the top five candidate items in the re-sorted IBC merge list, and all possible MBVD refinement positions for each base candidate (i.e., 20 × 4 candidate items) are re-sorted based on the SAD cost between the template and its reference to each refinement position. Finally, the top eight refinement positions with the smallest template SAD are retained for MBVD index coding. IBC-MBVD candidate items do not inherit the inversion type from adjacent blocks coded in RR-IBC. The MBVD index is binarized by a Rice code with a parameter equal to 1.

[0201] In another embodiment, the block vector instruction information includes a block vector index number. Determining a first block vector based on the block vector instruction information and the block vector candidate list may include determining a candidate block vector corresponding to the block vector index number in the block vector candidate list, determining a first search area centered on the candidate block vector, performing a search within the first search area based on a template matching method, and determining the first block vector.

[0202] In IBC TM merge mode, after obtaining bvL based on the above information, TM is used to further refine the BV locally. Specifically, a search is performed within a narrow range centered on the obtained bvL, and the optimal BV within that range is selected as the final BV based on the criterion of minimizing the template matching cost.

[0203] The TM refinement process for the candidate list in IBC merge mode is as follows:

[0204] When constructing candidate items, the inversion type will be set to "no inversion" by default.

[0205] The IBC TM merge mode specifies whether the transmitted syntactic elements undergo integer pixel-precision TM refinement under IBC merge mode. Both the refinement motion vector and the template position used in each refinement step must adhere to the reference area constraints.

[0206] The search is performed in the vicinity of the location pointed to by the candidate item, and the optimal position is determined by the magnitude of the SAD between the template of the reference block and the template of the current block. The following search methods are included, but are not limited to them. The search range is set to [-8,8], and first, as shown in Figures 7A and 7B, a diamond search of integer pixels is performed to search for 8 points in the vicinity of the center position, with a maximum of 375 searches. The search continues even after the first optimal position is determined, and in the subsequent search process, 5 points are searched at even positions and 3 points at odd positions.

[0207] After the diamond-shaped search process described above, a cross search of integer pixels is performed only once. That is, after the current optimal position is found by the diamond-shaped search, four positions located one pixel away from the current optimal position—below, to the right, above, and to the left—are checked to update the final optimal position, and thus the refined candidate list is updated.

[0208] It should be noted that in the embodiments of this application, the final derived BV must fall within a specified range (a coordinate range in terms of rows and columns), as shown in Figures 9, 10, and 11.

[0209] To ensure understanding, in the embodiments of the present application, the first block vector may be a luminance block vector or a chromaticity block vector, and is not particularly limited thereto. Here, if the first block vector is a luminance block vector, the luminance block vector is used to determine a predicted value based on the luminance component of the current block, and if the first block vector is a chromaticity block vector, the chromaticity block vector is used to determine a predicted value based on the luminance component of the current block.

[0210] Furthermore, in the IBC mode of the chrominance component, the chrominance block vector can be derived based on the luminance block vector. In one possible embodiment, the first block vector is the luminance block vector, and the method may further include performing a scaling process on the luminance block vector based on a predetermined chrominance sampling format to determine the chrominance block vector, where the chrominance block vector is used to determine a predicted value based on the chrominance component of the current block.

[0211] In another possible embodiment, the first block vector is the luminance block vector, and the method may further include performing a scaling process on the luminance block vector based on a predetermined chrominance sampling format to determine the scaled block vector, and performing a correction process on the scaled block vector to determine the chrominance block vector, where the chrominance block vector is used to determine a predicted value based on the chrominance component of the current block.

[0212] In the embodiments of this application, the process of deriving the BV of the chrominance component based on the BV of the luminance component is as follows.

[0213] Input: bvL of luminance (1 / 16 pixel precision), Output: BVC (Block Vector Chroma) of chrominance component (1 / 32 pixel precision).

[0214] The derivation process may be to directly scale or perform refinement using TM after scaling, but it is not specifically limited here.

[0215] Regarding the scaling operation, an example is as follows.

[0216] bvC[0]=((bvL[0]>>(3+SubWidthC))×32) bvC[1]=((bvL[1]>>(3+SubHeightC))×32) Here, the variables SubWidthC and SubHeightC specifically depend on the chromaticity format sampling structure specified by sps_chroma_format_idc, and please refer to Table 1 for the specific correspondence. Table 1 shows the correspondence between sps_chroma_format_idc and the chromaticity format sampling structure.

[0217] The refinement operation may include the following methods: Refinement is performed using TM, that is, after obtaining the BV of the luminance component, the offset position is found using the position and BV of the chromaticity block, a detailed search is performed in the vicinity of the offset position using a template, and the optimal BV (i.e., the refined BV) is obtained based on the criterion that minimizes TMcost. As shown in Figure 12, the shaded area represents the chromaticity reconstruction area, and for the current block, the template matching method can be adopted to find the optimal matching template and the corresponding refined BV, the reference block at the optimal offset position obtained by the refined BV can be copied, and furthermore, the chromaticity prediction value of the current block can be determined.

[0218] In step S1503, the matching template and the corresponding reference block are determined based on the first block vector.

[0219] In the embodiments of this application, after determining the first block vector, the matching template and the corresponding reference block can be determined based on the first block vector. In some embodiments, determining the matching template and the corresponding reference block based on the first block vector is possible. Based on the first block vector, determine the reference template and the corresponding reference block, This may include, if the reference template satisfies a first predetermined condition, performing a first process on the adjacent regions of the reference template to determine the matching template.

[0220] In some embodiments, determining the matching template and the corresponding reference block based on the first block vector is possible. Based on the first block vector, determine the reference template and the corresponding reference block, This may include, if the reference template satisfies the second predetermined condition, making the reference template a matching template.

[0221] Furthermore, it should be noted that in the embodiments of this application, the matching template may include sample points within the reference template and sample points in adjacent regions of the reference template.

[0222] Furthermore, it should be noted that in the embodiments of this application, the available reconstructed pixels can be determined based on the template type refTemplateType of the current block. For example, if the template type refTemplateType is 1, it indicates that the adjacent left, upper left, and upper reconstructed pixels are available, as shown in Figure 17. The number of available reconstructed pixels on the left is templateW_size × nTbH, the number of available reconstructed pixels on the upper is templateH_size × nTbW, and the number of available reconstructed pixels on the upper left is templateW_size × templateH_size.

[0223] In the embodiments of this application, the first predetermined condition differs from the second predetermined condition. In some embodiments, the method may further include determining that the reference template satisfies the first predetermined condition when sample points other than the reference template and reference block are used.

[0224] In some embodiments, the method may further include determining that the reference template satisfies a second predetermined condition if no sample points other than the reference template and reference block are used.

[0225] In the embodiments of this application, since the filter may use reconstructed pixels other than the reference template and reference block, padding is required for boundary pixels. The boundary region requiring padding differs depending on the shape of the filter. One example of a boundary padding region is shown in Figure 18A, and another boundary padding region is shown in Figure 18B, where the grid-like region is the area requiring padding.

[0226] In some embodiments, if the reference template satisfies a first predetermined condition, performing the first process on the adjacent region of the reference template may include performing a padding process on the sample points in the adjacent region of the reference template if sample points other than the reference template and the reference block are used.

[0227] In the embodiments of this application, for padding, it is first necessary to determine whether sample points in the adjacent regions of the reference template are available. In some embodiments, padding is performed on sample points in the adjacent regions of the reference template. Determine whether sample points are available for adjacent regions of the reference template, If sample points for the adjacent regions of the reference template are available, use the sample points for the adjacent regions of the direct reference template. If sample points for the adjacent regions of the reference template are unavailable, this may include performing padding on the adjacent regions of the reference template by copying reconstructed sample points in the adjacent reference template or adjacent reference block of the sample points to obtain sample points for the adjacent regions of the reference template.

[0228] Furthermore, the availability of sample points in the adjacent regions of the reference template is indicated by: The sample points must not exceed the specified search range. The sample points must not extend beyond the image boundary. The sample points must not extend beyond the tile boundary. This includes at least one of the following: the sample points have been reconstructed.

[0229] In the embodiments of the present application, for the padding process, a direct copy operation may be performed without determining whether the sample points in the adjacent area of the reference template are available. In some embodiments, performing a padding process on the sample points in the adjacent area of the reference template may include performing a padding process on the adjacent area of the reference template and obtaining the sample points in the adjacent area of the reference template by directly copying the reconstructed sample points in the adjacent reference template or adjacent reference block of the sample points. It should be noted that "direct copy" here means that it is not necessary to determine whether the sample points in the adjacent area of the reference template are available.

[0230] In some embodiments, for the padding process, when using sample points other than the reference template and reference block, the method may further include skipping the sample points when determining the model parameters without performing a padding process on the sample points in the adjacent area of the reference template.

[0231] That is, there are multiple different methods for the padding process in the embodiments of the present application. One padding method is to determine whether the grid-like area is available. If it is available, the reconstructed pixels are directly used. If it is not available, the reconstructed pixels of the adjacent reference template or reference block are copied to pad the grid-like area. Or, another padding method is to pad the grid-like area by directly copying the reconstructed pixels of the adjacent reference template or reference block without considering whether the grid-like area is available. Or, as yet another padding method, padding may not be performed, and when encountering the boundary position, the use of the corresponding data for calculation can also be abandoned, which is not specifically limited here.

[0232] In step S1504, model parameters are determined based on the first template and the matching template, a filtering process is performed on the reference blocks based on the model parameters, and the filtered reference blocks are determined.

[0233] In the embodiments of this application, after determining the number of available reconstructed pixels, a reconstruction region for calculating filter coefficients (i.e., model parameters) is determined based on the available reconstructed pixels. This region is referred to as R, and R typically includes all available reconstructed pixels in the template. For example, if refTemplateType is 1, R includes all available reconstructed pixels on the left, upper left, and upper sides.

[0234] Furthermore, it should be noted that in embodiments of the present application, the model parameters may include the coefficients of the target filter. In some embodiments, the method may further include determining the coefficients of the target filter based on the pixel reference values ​​in the first template and the pixel reference values ​​in the matching template.

[0235] Furthermore, it should be noted that in embodiments of the present application, the coefficients of the target filter may be determined by solving an optimization problem. Correspondingly, in some embodiments, the method may further include the coefficients of the target filter being coefficients used by the target filter when a first error between the pixel reference values ​​in the matching template and the output values ​​after they have been processed by the target filter satisfies a first condition.

[0236] It should be understood that for the first error to satisfy the first condition, in one possible embodiment, the first condition is that the first error is the smallest possible value. Or, in another possible embodiment, the first condition is that the first error is within a first predetermined threshold range. Or, in yet another possible embodiment, the first condition is that the change in the first error is within a second predetermined threshold range.

[0237] Furthermore, it should be understood that both the first predetermined threshold range and the second predetermined threshold range are evaluation criteria set in advance by the decoding side to determine whether the first error satisfies the first condition. Moreover, the first error here may be the mean squared error (MSE), the sum of squared errors (SSE), the sum of absolute errors (SAD), the sum of absolute errors after Hadamard transformation (SATD), or the mean absolute error (MAE), and the embodiments of this application are not specifically limited to these.

[0238] In some embodiments, determining the coefficients of the target filter based on the pixel reference values ​​in the first template and the pixel reference values ​​in the matching template is possible. Determining the autocorrelation parameter based on the pixel reference values ​​within the matching template, The cross-correlation parameters are determined based on the pixel reference values ​​in the first template and the pixel reference values ​​in the matching template. This may include determining the coefficients of the target filter based on autocorrelation and cross-correlation parameters.

[0239] In the embodiments of this application, the pixel reference value includes at least one of the pixel reconstruction value, pixel gradient value, and pixel position information.

[0240] In other words, in the embodiments of the present application, the target filter functions as the filter model of the embodiments of the present application, and the input information of the target filter is the pixel reference value in the matching template. Here, the coefficient of the target filter is c k,lThis can be expressed as and in this embodiment, it may also be called the filter coefficient. Here, the input information for calculating the filter coefficient may be the available reconstructed pixels of the matching template, or the gradient (including but not limited to horizontal gradient, vertical gradient, etc.) of each reconstructed pixel in the matching template may be calculated and the calculated gradient may be used as input information for calculating the filter coefficient, or the position information of each reconstructed pixel may be used as input information for calculating the filter coefficient. Here, the position information may be the absolute position information of each reconstructed pixel in the entire image, or the relative position information of each reconstructed pixel with respect to a certain reference point, but is not specifically limited here.

[0241] In one specific embodiment, a set of filter coefficients can be derived by first determining a reconstruction region R for calculating the filter coefficients, and then minimizing the MSE between the reconstructed pixels in region R and the reconstructed pixels of the first template.

[0242]

number

[0243]

number

[0244] Furthermore, the process for deriving the filter coefficients by minimizing the MSE is specifically as follows:

[0245] First, c k,l We take the partial derivative with respect to and set the result to 0, that is,

number

[0246] Next, rearranging based on equations (5) and (6), we get the following:

[0247]

number

[0248]

number

[0249]

number

[0250]

number

[0251] In the embodiments of this application, it is also necessary to determine the number of coefficients and the shape of the target filter. Here, the number of coefficients and the shape of the target filter may both be fixed values ​​set in advance, or they may be determined directly by decoding the bitstream.

[0252] In some embodiments, the method may further include the fact that the number of coefficients in the target filter is equal to a first predetermined value.

[0253] In some embodiments, regarding the number of coefficients of the target filter, the method may further include decoding the bitstream and determining the number of coefficients of the target filter.

[0254] The number of coefficients in the target filter can be expressed as nTap. For example, the value of nTap may be 4, 5, 6, 7, 8, 9, etc., but it is not specifically limited to these values.

[0255] Furthermore, it should be noted that the number of coefficients in the target filter may also be called the number of taps in the target filter. Here, the number of coefficients in the target filter may be a predetermined constant value, determined by decoding the bitstream, or determined based on the syntactic element identifier of the current block.

[0256] In some embodiments, regarding the shape of the target filter, the method may further include the fact that the target filter is a one-dimensional or two-dimensional filter of a predetermined shape.

[0257] In some embodiments, regarding the shape of the target filter, the method may further include decoding the bitstream and determining the shape of the target filter.

[0258] In some embodiments, regarding the shape of the target filter, the method may further include decoding the bitstream and determining the value of a filter shape parameter, where the filter shape parameter represents the shape of the target filter.

[0259] The filter shape parameter can be represented by FilterIdx, which is used to indicate the shape of the target filter. In the embodiments of this application, the shape of the target filter may be a rhombus, rectangle, cross, bar, or even a one-dimensional filter or a two-dimensional filter, but is not particularly limited thereto.

[0260] For example, if the value of FilterIdx is equal to 0, the shape of the target filter is determined to be a rhombus; if the value of FilterIdx is equal to 1, the shape of the target filter is determined to be a cross; and if the value of FilterIdx is equal to 2, the shape of the target filter is determined to be a rectangle.

[0261] As an example, Figure 19 is a schematic diagram of the shape of a filter according to an embodiment of the present invention. As shown in Figure 19, the filter shape is cross-shaped, and the number of taps in the filter is 5. Here, the number of taps in the filter can be dynamically adjusted based on the current block size.

[0262] Furthermore, it should be noted that the shape of the target filter may be a predetermined shape, may be determined by decoding the bitstream, or may be determined based on the syntactic element identification information of the current block.

[0263] In the embodiment of this application, after determining the model parameters, the predicted value of the current block can be determined based on the model parameters and the reference block. Specifically, a filtering process is performed on the reference block based on the model parameters, and then the predicted value of the current block is determined based on the filtered reference block.

[0264] In some embodiments, filtering reference blocks based on model parameters and determining the filtered reference blocks may include filtering reference blocks based on model parameters and determining a first output value of the target filter, and determining the filtered reference blocks based on the first output value of the target filter.

[0265] In some embodiments, filtering reference blocks based on model parameters and determining the filtered reference blocks may include padding the sample points of the adjacent regions of the reference blocks if sample points of the adjacent regions of the reference blocks are used. In other words, in embodiments of the present application, it is necessary to use sample points of the adjacent regions of the reference blocks, i.e., it is necessary to pad the sample points of the adjacent regions of the reference blocks.

[0266] In the embodiments of this invention, a first output value of the target filter can be calculated based on the pixel reconstruction value of the reference block and the coefficient of the target filter in the model parameters, and then the filtered reference block can be determined based on the first output value of the target filter. The target filter here may be a linear filtering model or a nonlinear filtering model, but is not specifically limited thereto.

[0267] In one possible embodiment, filtering is performed on a reference block based on model parameters to determine the first output value of the target filter. Calculate the product of the pixel reconstruction value of the reference block and the coefficient of the corresponding target filter, This may include setting the first output value of the target filter to be equal to the sum of n products, where n is the number of coefficients of the target filter and n is a positive integer.

[0268] The target filter in the embodiment of this application is a linear filtering model. The first output value of the target filter can be calculated using the following formula.

[0269]

number

[0270] In another possible embodiment, filtering is performed on a reference block based on model parameters to determine the first output value of the target filter. Determine the first value in the first mapping relationship of the pixel reconstruction value of the reference block, Calculate the product of the first value and the corresponding target filter coefficient, This may include setting the first output value of the target filter to be equal to the sum of n products, where n is the number of coefficients of the target filter and n is a positive integer.

[0271] The target filter in the embodiment of this application is a nonlinear filtering model. For example, the formula for minimizing the MSE of the filter coefficients is adjusted as follows.

[0272]

number

[0273]

number

[0274] Furthermore, it should be noted that in the embodiments of the present application, determining the filtered reference block based on the first output value of the target filter may be directly using the first output value of the target filter as the filtered reference block, or performing first filtering on the first output value of the target filter to obtain the filtered reference block. Here, the first filtering may be low-pass filtering, up / down sampling filtering, etc., but is not specifically limited here.

[0275] Furthermore, it should be noted that in the embodiments of the present application, after determining the first output value of the target filter, the filtered reference block can also be determined by adding a first offset value (represented by bias) to the first output value.

[0276] In some embodiments, determining the filtered reference block based on the first output value of the target filter may include determining the first offset value and performing an addition operation based on the first output value and the first offset value to determine the filtered reference block.

[0277] In one possible embodiment, determining the first offset value may include setting the first offset value equal to a second predetermined value.

[0278] In another possible embodiment, determining the first offset value may include determining the number of pixels involved in filtering corresponding to the target filter based on the shape of the target filter, determining m+1 coefficients of the target filter if the number of pixels of the reference filter corresponding to the target filter is m (where m is a positive integer), and determining the first offset value based on one of the m+1 coefficients and the second offset value.

[0279] In the embodiments of this application, if the number of pixels involved in the filtering operation is m for the target filter, then, considering the second offset value, the target filter needs to determine m+1 coefficients, and then, based on these m+1 coefficients, a weighting calculation is performed on the m pixels involved in the operation and one second offset value. Here, the coefficient used for the second offset value may be the (m+1)th coefficient or any other coefficient, but is not specifically limited here.

[0280] In embodiments of the present application, the method may further include setting the second offset value to be equal to a third predetermined value, or setting the second offset value to be equal to the value in the second mapping relationship of the pixel reconstruction value of the reference block.

[0281] The second mapping relationship may be a linear mapping relationship or a nonlinear mapping relationship, and there may be multiple nonlinear mapping relationships; there are no particular limitations on which one it may be here.

[0282] In the embodiments of this application, the calculated filter coefficients are the number of taps corresponding to the filter template, that is, the number of filter coefficients is equal to the number of taps nTap of the filter template. In addition, several bias terms (bias) may be added to the filter template. For example, in the embodiments of this application, when nTap=5, the filter coefficients are the tap coefficients c0~c4 corresponding to the filter template, and the predicted values ​​of the (i,j) position in the filtered reference block are as follows.

[0283]

number

number

[0284] In step S1505, the predicted value of the current block is determined based on the filtered reference block.

[0285] In the embodiments of this application, determining the predicted value of the current block based on the filtered reference blocks may include performing a second process on the filtered reference blocks to obtain the predicted value of the current block.

[0286] In the embodiment of the present application, for the second process, the second process may be to set the predicted value of the current block equal to the filtered reference block, or the second process may be a clip operation that restricts the filtered reference block within a predetermined numerical range, or the second process may be other operations, but it is not specifically limited here.

[0287] Exemplarily, assuming that the number of taps nTap of the filter is 5 and the shape of the filter is as shown in FIG. 20A, c0 to c4 are the respective tap coefficients of the filter. Here, the lattice-shaped filled dots corresponding to the tap coefficient C0 are the reconstructed pixel ref[i][j] at the corresponding position in the reference block of the current prediction target pixel Y pred [i][j], and the remaining white dots are the reconstructed pixels adjacent to the current spatial position in the reference block. In this way, based on the filter in FIG. 20A, the finally obtained predicted pixel Y pred [i][j] is shown by the black dots in FIG. 20B.

[0288] Also, in the embodiment of the present application, for the clip operation, the predetermined numerical range here may be between 0 and (1<<BitDepth)-1, where BitDepth represents the bit depth. When the filtered reference block takes a value exceeding the predetermined numerical range, it is necessary to perform a corresponding correction operation on the filtered reference block. Exemplarily, the filtered reference block can also be represented by Y pred [i][j], and at this time, a correction operation can be performed on Y pred [i][j], specifically as follows.

[0289] Y pred If the value of [i][j] is less than 0, set it to 0; Y pred If the value of [i][j] is greater than or equal to 0 and less than or equal to (1<<BitDepth)-1, it is equal to Y pred [i][j]; Ypred If the value of [i][j] is greater than (1<<BitDepth)-1, set it to (1<<BitDepth)-1.

[0290] In this way, Y pred By performing a correction operation on [i][j], it is possible to ensure that all pixel values in the filtered reference block are within the range of 0 to (1<<BitDepth)-1.

[0291] Furthermore, the number of filter models can be extended. In addition to establishing only one filter model, it is also possible to establish multiple filter models. Therefore, in some embodiments, the method determines multiple sets of model parameters based on the first template and the matching template, constructs multiple filter models based on the multiple sets of model parameters, performs filtering processing on each of the reference blocks based on the multiple filter models, and determines multiple filtered reference blocks, and may include determining a predicted value of the current block based on the multiple filtered reference blocks.

[0292] In some embodiments, determining multiple sets of model parameters based on the first template and the matching template may include classifying the reconstructed pixels in the first template and the matching template according to a predetermined method respectively to obtain multiple sets of sub-templates and multiple sets of sub-matching templates, and determining multiple sets of model parameters based on the multiple sets of sub-templates and the multiple sets of sub-matching templates.

[0293] In the embodiments of this application, the predetermined method may be the magnitude of the reconstructed pixel values, the positional information of the reconstructed pixels, or the shape of the filter, and is not limited to these. After classification according to the predetermined method, each set of subtemplates and the corresponding submatching template can calculate a set of model parameters, and each set of model parameters can determine one filter model, thereby constructing multiple filter models.

[0294] In one possible embodiment, the method may further include decoding a bitstream to determine a target model index value, determining a corresponding target filter from among a plurality of filter models based on the target model index value, and performing a filtering operation on a reference block based on the target filter to determine a predicted value for the current block.

[0295] In another possible embodiment, filtering can be performed on each reference block based on multiple filter models, and multiple filtered reference blocks can be determined. In some embodiments, determining the predicted value of the current block based on multiple filtered reference blocks may include performing weight calculations on the multiple filtered reference blocks to determine the predicted value of the current block.

[0296] Furthermore, it should be noted that if the weight values ​​of each filtered reference block are equal and all are equal to the reciprocal of the number of reference blocks, then the weighting calculation here can be considered as calculating the average. In other words, the average is calculated for multiple filtered reference blocks to determine the predicted value of the current block.

[0297] Exemplary, the input information for calculating filter coefficients is classified, and a filtering model is established for each category of input information. For example, when establishing a filter model using reconstruction information, one feasible form is to classify by the mean value of the reconstruction information, establishing one filter model for reconstruction information greater than the mean and another filter model for reconstruction information less than the mean. Another feasible form is to classify using the position of the reconstruction information, for example, establishing one filter model using the available reconstruction information on the left and top, and establishing a second filter model using the available reconstruction information on the left and top-left, with the encoding side deciding which model to use. One feasible decision method is for the encoding side to decide which model to use using a rate-distortion optimization method and transmit the corresponding decoding parameters to the decoding side so that the decoding side can clearly identify which filter model to select. Another feasible form is to classify using the shape of the filter, using multiple different filter shapes, establishing a filter model for each shape, and having the encoding side decide which shape of filter to use. One feasible decision method is for the encoding side to decide which filter to use using a rate-distortion optimization scheme and transmit the corresponding decoding parameters to the decoding side, thereby clearly specifying which filter model the decoding side will choose.

[0298] Furthermore, it should be noted that in the embodiments of the present application, after determining the predicted value of the current block, it is possible to further restore the reconstructed value of the current block, and in some embodiments, the method may further include decoding the bitstream and determining the predicted residual of the current block, and determining the reconstructed value of the current block based on the predicted value and the predicted residual of the current block.

[0299] In one specific embodiment, determining the reconstructed value of the current block based on the predicted value of the current block and the predicted residual of the current block may include performing an addition operation on the predicted value of the current block and the predicted residual of the current block to determine the reconstructed value of the current block.

[0300] Furthermore, it should be noted that in the embodiments of this application, whether the current block applies an intra-block copy or a filter model can be determined by different syntactic element identifiers. In some embodiments, the method involves decoding the bitstream and determining the value of the first syntactic element identifier, If the first syntactic element identifier indicates that the current block applies an intra-block copy, decode the bitstream and determine the value of the second syntactic element identifier. If the second syntactic element identifier indicates that the current block applies a filter model, the process may further include the steps of filtering the reference blocks based on the model parameters to determine the filtered reference blocks, and determining the predicted value of the current block based on the filtered reference blocks.

[0301] Furthermore, in some embodiments, the method may further include taking the reconstructed pixel value in the reference block as the predicted value for the current block if the second syntactic element identifier indicates that the current block does not have a filter model applied.

[0302] In the embodiments of the present application, with respect to the first syntactic element identifier, if the value of the first syntactic element identifier is a first value, it is determined that the first syntactic element identifier indicates that the current block applies an intrablock copy, or if the value of the first syntactic element identifier is a second value, it is determined that the first syntactic element identifier indicates that the current block does not apply an intrablock copy.

[0303] In embodiments of the present application, with respect to the second syntactic element identifier, if the value of the second syntactic element identifier is a first value, it is determined that the second syntactic element identifier indicates that the current block applies a filter model, or if the value of the second syntactic element identifier is a second value, it is determined that the second syntactic element identifier indicates that the current block does not apply a filter model.

[0304] In the embodiments of this application, the first and second values ​​are different, and the first and second values ​​may be in parameter format or numerical format. Specifically, the first syntactic element identifier information and the second syntactic element identifier information may be parameters written in the profile or flag values, and there are no particular limitations to these here.

[0305] For example, regarding the first and second values, the first value could be set to 1 and the second value to 0, or the first value could be set to true and the second value to false, but we will not specifically limit ourselves to these options here.

[0306] Furthermore, it should be noted that in the embodiments of this application, the current block is determined by several conditional decisions to determine whether or not to use the filtered reference block as the final predicted value, but is not limited to the following three methods. These three methods are, for example, as follows:

[0307] In Method 1, the filtering of the matching template is determined by comparing the distortion between the matching template and the template of the current block, such as SAD, MSE, SATD, or SSE, with a threshold T_Distortion1.

[0308] In Method 2, after satisfying the requirement of using a filter model in Method 1, the distortion between the filtered matching template and the current block template, such as SAD, MSE, SATD, or SSE, is compared with a threshold T_Distortion2 to determine whether or not to filter the reference block.

[0309] In method 3, the encoding side transmits a Flag to indicate whether or not to apply a filter model. tmpFlag indicates whether intra-template matching is applied to the current block, and filterFlag indicates whether or not a filter model is applied to the current block. If tmpFlag is 1, the encoding side decides whether or not to filter the reference block by comparing the distortion between the reference block and the current block before and after filtering, for example, SAD, MSE, SATD, or SSE. If the distortion after filtering is smaller than the distortion before filtering, filterFlag becomes 1, and the current block uses the filtered reference block as the prediction block. Otherwise, filterFlag becomes 0, and the current block uses the reference block before filtering as the prediction block. The encoding side then transmits filterFlag to the decoding side.

[0310] Furthermore, in some embodiments, the method may further include determining a plurality of reference blocks in a second search area and the model parameters of each of the plurality of reference blocks; performing a filtering process on each of the plurality of reference blocks based on the model parameters of each of the plurality of reference blocks to determine a plurality of filtered reference blocks; and determining the predicted value of the current block based on the plurality of filtered reference blocks.

[0311] In one specific embodiment, determining the predicted value of the current block based on a plurality of filtered reference blocks may include decoding the bitstream and determining the reference block index number, and determining the filtered reference block based on the reference block index number among the plurality of filtered reference blocks.

[0312] In the embodiments of this application, regarding the reference blocks to which the filter coefficient is applied, the above embodiments calculate the filter coefficient only for the optimal matching template after the search and apply the filter coefficient to the reference block that best matches. In addition, it is also possible to apply the filter coefficient to all or some of the reference blocks in the search area and determine which filtered reference block will be the final predicted block by several conditional judgments, but the invention is not limited to the following methods.

[0313] In Method 1, a filter coefficient is calculated for templates within the search range, filtering is performed, and the cost value (Cost) with the current template is calculated to determine which template to use. That is, a filter coefficient is calculated for some or all of the target templates within the search range, then the filter coefficient is applied to the target template, the cost with the current template is calculated, the optimal matching template after filtering is selected based on the cost, the reference blocks corresponding to the optimal matching template are filtered, and the final predicted value is obtained.

[0314] In method 2, the encoding side transmits a Flag to indicate which filtered reference block will be the final predicted block. tmpFlag indicates whether template matching is applied to the current encoded block, and filterIdx indicates which reference block within the current search range the filtering model is applied to. If tmpFlag is 1, the encoding side selects the optimal reference block by comparing the distortion between the reference block with the applied filter coefficients within the search range and the current original block, e.g., SAD, MSE, SATD, or SSE, and transmits the corresponding index to the decoding side.

[0315] Furthermore, in some embodiments, “each sample point in the template” can be replaced with “identified sample point in the template,” and “each sample point in the reconstruction block corresponding to the template” can be replaced with “identified sample point in the reconstruction block corresponding to the template.” Here, identified sample points in the template refer to one or more sample points located at the corners of the template region, for example, if only an upper template exists, it refers to the sample points at the upper left and lower right corners of the upper template region, or only the sample point at the lower right corner. Here, identified sample points in the reconstruction block corresponding to the template refer to one or more sample points located at the corners of the reconstruction block region, for example, the sample points at the upper left and lower right corners of the reconstruction block region, or only the sample point at the lower right corner of the reconstruction block region.

[0316] In the embodiments of this application, since the filter may use reconstruction sample points other than the reference template and reference block, it is necessary to perform padding on boundary sample points. An example of boundary padding is shown in Figures 18A and 18B, where the grid-like region is the region where padding is required.

[0317] In some embodiments, the padding method involves determining whether each sample point in the grid region is available, using the reconstructed pixels directly if available, and padding the grid region by copying the reconstructed pixels from the nearest reference template or reference block if unavailable.

[0318] Here, the method for determining whether something is available includes, but is not limited to, the fulfillment of one or more of the following conditions simultaneously.

[0319] The sample point must be within the image boundary. The sample point must be within the tile boundary. The sample points must have been reconstructed.

[0320] In some other embodiments, the padding method is determined based on the BV search range to determine whether the padding region's location exceeds the BV search range. If it does not exceed the search range, the reconstruction sample points are used directly; if it does exceed the search range, the grid region is padded by copying reconstruction sample points from an adjacent reference template or reference block. Specifically, it is determined whether boundary padding is necessary based on the derived iVerMin, iVerMax, iHorMin, and iHorMax.

[0321] leftPadding, rightPadding, topPadding, and bottomPadding indicate whether the left grid region, right grid region, upper grid region, and lower grid region copy the closest reconstructed sample point. That is, as follows:

[0322] leftPadding=!(pX_Best>iHorMin) rightPadding=!(pX_Best <iHorMax) topPadding=!(pY_Best>iVerMin) BottomPadding=!(pY_Best <iverMax) Here, if leftPadding is true, it indicates that the pixels in the left grid region are beyond the BV search range, and the reconstruction sample point from the nearest adjacent reference template is copied; otherwise, the reconstruction pixel at that position is used directly. If rightPadding is true, it indicates that the pixels in the right grid region are beyond the BV search range, and the reconstruction sample point from the nearest adjacent reference template or reference block is copied; otherwise, the reconstruction sample point at that position is used directly. If topPadding is true, it indicates that the pixels in the upper grid region are beyond the BV search range, and the reconstruction sample point from the nearest adjacent reference template is copied; otherwise, the reconstruction sample point at that position is used directly. If bottomPadding is true, it indicates that the pixels in the lower grid region are beyond the BV search range, and the reconstruction sample point from the nearest adjacent reference template or reference block is copied; otherwise, the reconstruction sample point at that position is used directly.

[0323] Furthermore, in the embodiments of the present invention, the associated mode selection flag (ibcFilterFlag) is transmitted at the CU layer, and the encoding scheme for the ibcFilterFlag can have multiple embodiments, one feasible scheme being to use equiprobability coding, another feasible scheme being to use context coding, which may use a default context initial state and context update rate, or may determine the context initial state and context update rate by statistics, and is not specifically limited herein.

[0324] Furthermore, in the embodiments of the present application, the decoding method can be implemented in combination with various submodes in IBC, including but not limited to, conventional IBC merge, IBC™ merge, MBVD, IBC CIIP, IBC ABVP, etc., and is not specifically limited thereto.

[0325] Furthermore, in the embodiments of the present application, the decoding method is not limited to the intra-prediction mode, nor is it limited to the IBC mode, but is also applicable to other modes to which BV is applied. Alternatively, the block vector in the decoding method is not limited to the BV used in IBC, nor is the template limited to the template used in IBC; there are no limitations to either of these.

[0326] An embodiment of the present invention provides a decoding method which first determines a first template of the current block, determines a list of candidate block vectors for the current block, then decodes the bitstream to determine block vector indication information, determines a first block vector based on the block vector indication information and the list of candidate block vectors, further determines a matching template and a corresponding reference block based on the first block vector, determines model parameters based on the first template and the matching template, performs filtering on the reference block based on the model parameters to determine the filtered reference block, and finally determines the predicted value of the current block based on the filtered reference block. In this way, the model parameters are determined based on the first template and the matching template, and these model parameters fully reflect the correlation between the matching template and the first template of the current block. By applying this correlation to the reference block, performing filtering modifications on its reconstructed pixels, and using the filtered reconstructed pixels as the predicted pixels of the current block, prediction accuracy can be improved, bitrate can be saved, and the problem of linear changes between the reference block and the current block can be effectively solved. At the same time, the efficiency of encoding and decoding can be improved, and the performance of encoding and decoding can be further improved.

[0327] In another embodiment of the present application, with reference to Figure 21, an illustrative flowchart of the encoding method according to an embodiment of the present application is shown. As shown in Figure 21, the method may include the following steps:

[0328] In step S2101, the first template of the current block is determined, and the list of candidate block vectors for the current block is determined.

[0329] The encoding method of the embodiment of this application is applied to an encoder. More specifically, this encoding method may refer to an intra prediction method, and more specifically, an intra prediction method of an intra-block copy technique based on a filter-based linear model (IBC-FLM). However, it is not limited to the IBC mode and is applicable to all other modes to which block vectors are applied. Here, a video image can be divided into multiple encoding blocks, and the current block in the embodiment of this application refers to the encoding block in the video image to which intra prediction is currently being performed. Furthermore, the encoding method of the embodiment of this application can be used for both luminance component prediction and chromaticity component prediction, and is not specifically limited here.

[0330] Furthermore, it should be noted that in the embodiments of this application, in order to facilitate the determination of the matching template and the corresponding reference block based on the first template, it is necessary to first determine the first template of the current block. In some embodiments, determining the first template of the current block is Currently, the template type of the block is determined, This may include determining the first template of the current block based on the current block's template type.

[0331] Here, the template type can be represented by refTemplateType. In some embodiments, determining the template type of the current block may involve determining the template type of the current block based on the reference pixels of the current block.

[0332] Here, the reference pixel of the current block includes at least one of the adjacent reference pixels to the left of the current block, the adjacent reference pixels above the current block, and the adjacent reference pixel to the upper left of the current block.

[0333] Exemplary, Figure 16 shows a schematic diagram of the IBC mode template type according to an embodiment of the present application. Here, when the upper left, upper, and left reference pixels are all available, the value of refTemplateType is 1 and the shape of the template type is as shown in Figure 16(a); when only the left reference pixel is available, the value of refTemplateType is 2 and the shape of the template type is as shown in Figure 16(b); and when only the upper reference pixel is available, the value of refTemplateType is 3 and the shape of the template type is as shown in Figure 16(c).

[0334] In other words, in the embodiments of the present application, the reference pixels of the current block are determined based on the adjacent reconstructed region of the current block. Here, the adjacent reconstructed region of the current block includes at least one of the left adjacent region, the upper adjacent region, and the upper-left adjacent region. For example, the left adjacent reference pixels of the current block may be determined by at least one column of reconstructed pixels in the left adjacent region, the upper adjacent reference pixels of the current block may be determined by at least one row of reconstructed pixels in the upper adjacent region, and the upper-left adjacent reference pixels of the current block may be determined by at least one column of reconstructed pixels in the upper-left adjacent region, but this is not specifically limited here.

[0335] Furthermore, the template type can be classified based on whether adjacent reference pixels are available, and the template type of the current block can be determined. In some embodiments, determining the template type of the current block may further include encoding the template type of the current block and writing the resulting encoded bits to a bitstream if both the adjacent reference pixels to the left and the adjacent reference pixels above the current block are available.

[0336] In the embodiments of this invention, the template type of the current block may be pre-set, or it may be determined by writing the template type to the bitstream. Here, if the adjacent reference pixel to the left of the current block, the adjacent reference pixel above the current block, and the adjacent reference pixel to the upper left of the current block are all available, the template type of the current block is determined to be a first type value; if the adjacent reference pixel to the left of the current block is available, the template type of the current block is determined to be a second type value; and if the adjacent reference pixel above the current block is available, the template type of the current block is determined to be a third type value. Exemplarily, if both the adjacent reference pixel to the left and the adjacent reference pixel above are available, it is also possible to use a second or third type template. In this case, the bitstream can be used to specify which template to use.

[0337] In the embodiments of this application, the first type value, the second type value, and the third type value may be different from each other. For example, the first type value can be set to 1, the second type value can be set to 2, and the third type value can be set to 3. For these three template types, please refer specifically to Figures 16(a), (b), and (c).

[0338] Furthermore, it should be noted that in the embodiments of this application, the template type of the current block is typically L-shaped, i.e., Figure 16(a). The L-shaped template may consist of the adjacent reference pixel to the left of the current block and the adjacent reference pixel to the top of the current block, or it may consist of the adjacent reference pixel to the left of the current block, the adjacent reference pixel to the top of the current block, and the adjacent reference pixel to the top left of the current block. Here, the top-left adjacent pixel generally does not need to be specifically mentioned. This is because, in practice, the L-shaped template may not include the top-left pixel. Alternatively, if both the left and top pixels are available, the top-left adjacent pixel is also available.

[0339] In some embodiments, determining the first template of the current block based on the template type of the current block may include obtaining the template pixels of the current block based on the template type of the current block and the corresponding template size, and determining the template pixels of the current block as the first template of the current block.

[0340] In the embodiments of this application, the template size may be predetermined, determined based on the size of the current block, or related to the template type of the current block, but is not specifically limited thereto.

[0341] For example, if the template type indicates that only the left template should be retrieved, the template width templateW_size can be set to 4, and if the template type indicates that only the top template should be retrieved, the template height templateH_size can be set to 4.

[0342] Furthermore, based on the template type value, it is possible to determine which parts of the first template's reconstructed pixels to retrieve. For example, if the value of refTemplateType is 1, the reconstructed pixels on the left, top-left, and top of the current block are retrieved; if the value of refTemplateType is 2, only the reconstructed pixels in the left four columns of the current block are retrieved; and if the value of refTemplateType is 3, only the reconstructed pixels in the top four rows of the current block are retrieved.

[0343] Furthermore, it should be noted that in embodiments of the present application, the template type of the current block may also be written to the bitstream. In one specific embodiment, the method may further include encoding the template type of the current block and writing the resulting encoded bits to the bitstream. In this way, a subsequent decoding side can determine the template type of the current block by decoding the bitstream, and then, based on the template type, determine, but is not limited to, the first template of the current block.

[0344] To make it easier to understand, in the embodiments of this application, for the IBC mode, it is necessary to construct a block vector candidate list. Taking the process of establishing the IBC merge candidate list as an example, the process of establishing the IBC ABVP candidate list is basically the same as that of IBC merge, but the maximum number of candidates for each is not the same. For example, the length of the IBC merge candidate list can be defined as 6, and the length of the IBC ABVP candidate list can be defined as 2.

[0345] In some embodiments, determining the current block's block vector candidate list may include determining at least one first candidate block vector adjacent to the current block based on a spatial block vector candidate derivation method, adding at least one first candidate block vector to the block vector candidate list, and, if the number of candidates in the block vector candidate list satisfies a predetermined threshold, making the current block vector candidate list the current block's block vector candidate list.

[0346] When constructing the block vector candidate list, the spatial region candidate items are derived first. Specifically, if the usage conditions are met (for example, if the size condition IsGt4by4 is TRUE, the variable IsGt4by4 is TRUE if the product of the luminance width and height is greater than 16), the process for deriving spatial block vector candidates from adjacent coding units, as defined in the decoding standard, is called, taking the luminance coded block position (xCb, yCb), luminance coded block width cbWidth, and height cbHeight as inputs. The output is the availability flags, e.g., availableFlagA1, availableFlagB1, and block vectors bvA1 and bvB1.

[0347] Availability detection for each candidate item is as follows: The following conditions are judged, and if all are met, the candidate item is available.

[0348] Whether the sum of the current block position and the offset position due to BVP exceeds the image boundary. Whether the sum of the current block location and the block location pointed to by the BVP does not cover the current block. Whether the sum of the current block position and the offset position due to BVP exceeds the available area of ​​the IBC. Is the sum of the current block position and the block position pointed to by BVP already reconstructed?

[0349] Furthermore, it should be noted that, in the embodiments of this application, taking Figure 3 as an example, the relative positions of adjacent blocks where A1 and B1 are located and the current block should be seen in Figure 3. The traversal sequence in Figure 3 could be A1→B1→B0→A0→B2.

[0350] Next, we add the spatial domain candidate items to the candidate list. If the usage conditions are met (for example, if the size condition IsGt4by4 is TRUE), the block vector candidate list bvCandList is constructed as follows:

[0351] i=0 if(availableFlagA1) bvCandList[i++]=bvA1 if(availableFlagB1) bvCandList[i++]=bvB1 ... Next, we check the number of valid candidates in the block vector candidate list. The derivation process for the variable numCurrCand (the number of candidates obtained so far) is as follows:

[0352] If the usage conditions are met (for example, if the size condition IsGt4by4 is TRUE), numCurrCand is set to be equal to the number of candidates in bvCandList; otherwise, numCurrCand is set to 0.

[0353] Furthermore, in some embodiments, the method may further include, if the number of candidates in the block vector candidate list does not meet a predetermined threshold, determining at least one second candidate block vector based on a history block vector candidate derivation method and subsequently adding at least one second candidate block vector to the block vector candidate list, and, if the number of candidates in the block vector candidate list meets a predetermined threshold, making the current block vector candidate list the block vector candidate list for the current block.

[0354] Furthermore, it should be noted that if the candidate list does not reach the specified number of items (for example, 6 items for IBC merge mode, 2 items for IBC ABVP mode), the derivation, availability detection, and addition of historical candidate items will continue.

[0355] If numCurrCand is less than MaxNumIbcMergeCand (maximum number of candidates in IBC merge mode) and NumHmvpIbcCand (maximum number of candidates for history-optimal block vectors (Hmvp) in IBC mode) is greater than 0, the history-based IBC block vector candidate derivation process specified in the decoding standard is invoked, with bvCandList and numCurrCand as inputs and the modified bvCandList and numCurrCand as outputs.

[0356] Furthermore, in some embodiments, the method may further include determining at least one third candidate block vector based on a method for deriving other available candidates if the number of candidates in the block vector candidate list does not meet a predetermined threshold, and continuing to add at least one third candidate block vector to the block vector candidate list until the number of candidates in the block vector candidate list meets a predetermined threshold.

[0357] In embodiments of the present invention, other available candidate derivation methods may include at least one of the following: a pairwise mean candidate derivation method, a zero-value block vector candidate derivation method, and a candidate derivation method for a reference region corresponding to an intrablock copy.

[0358] Furthermore, it should be noted that after adding at least one second candidate block vector to the block vector candidate list, the check for valid items in the candidate list and the addition of other available candidate items (e.g., pairwise mean candidate items, zero-value BV candidate items, etc.) should continue until the specified number of items is reached.

[0359] For example, other available candidate items are as follows:

[0360] (1) Pairwise mean candidates can be constructed using the first and second candidate items, specifically as follows:

[0361] mvAvgLX=(mvCand0LX+mvCand1LX+1)≫1

[0362] (2) The zero value BV can be set directly as follows:

[0363] Set bvCandList[numCurrCand][0] to 0. (Horizontal component of bv) Set bvCandList[numCurrCand][1] to 0. (Vertical component of bv)

[0364] (3) A pair of BVP candidate items located in the IBC reference area can also be made into additional candidate items. The coordinates of a pair of BVP candidate items are determined by the width and height of the current block and the ΔX and ΔY parameters, as shown in Figure 4.

[0365] Furthermore, it should be noted that in the embodiments of this application, numCurrCand increments by 1 for each additional item. Thus, the process continues until numCurrCand satisfies a predetermined threshold, completing the establishment of the basic block vector candidate list bvCandList.

[0366] Furthermore, after the construction of the block vector candidate list is complete, the method may further include determining the block vector candidate list for the current block and then sorting the block vector candidate list.

[0367] Furthermore, in the embodiment of this invention, in IBC merge mode, templates can be used to further resort the order of the list, adjusting the order of the candidate list and making full use of high spatial correlation to reduce the transmission of encoded bits and effectively improve encoding efficiency. For example, in IBC merge mode, after constructing an intermediate candidate list (note that the length of the intermediate candidate list may be greater than or equal to the maximum number of candidates in IBC merge mode) using the list construction method described above, a template is used to resort all candidate items in the list, sort them in ascending order of template matching cost, and the first N (e.g., N=6) candidate items of the sorted list are selected. The specific process is as follows: the SAD of the template position of the reference block pointed to by each candidate item and the template position of the current block (shown in Figure 5) is calculated, these are arranged in ascending order, and the first 6 candidate items are selected as the candidate list for IBC merge.

[0368] Furthermore, after the construction of the block vector candidate list is complete, the method may further include determining the block vector candidate list for the current block and then removing redundancy based on the distances between candidate block vectors in the block vector candidate list.

[0369] In the embodiments of the present invention, removing redundancy may include, if the current block has selected non-inverting intra-block copy mode, deleting at least one of at least two candidate block vectors in the block vector candidate list when the distance between at least two candidate block vectors satisfies a predetermined condition.

[0370] Furthermore, it should be noted that in the embodiments of this application, in IBC ABVP mode, an operation can be performed to remove candidate redundancy based on the distance between candidate items, the number of candidates remains at two, and candidate lists are established for integer pixels and 4-pixel precision, respectively.

[0371] If a non-RRIBC mode is selected for IBC ABVP and there are more than two valid BVP candidates, the top six BVP candidates in the candidate list are clustered based on the Euclidean distance between them, where the radius (R) is determined as the logarithmic function of the current block width (cbWidth) and height (cbHeight) for a pair of block vectors, and if the Euclidean distance between the reference locations pointed to by several BV candidates is less than R, they are clustered.

[0372] R=log2((cbWidth·cbHeight)≫MIN_PU_SIZE).

[0373] Furthermore, in some embodiments, the method may further include, if the current block has selected the inverted intra-block copy mode, adjusting the candidate block vectors in the block vector candidate list to point to the boundaries of a valid block copy search area based on a predetermined direction of the inverted intra-block copy mode. That is, if the RRIBC mode is selected for IBC ABVP, the candidate items can be adjusted to point to the boundaries of a valid IBC search area according to the horizontal or vertical direction of the RRIBC mode.

[0374] In this way, the construction of the block vector candidate list is completed.

[0375] In step S2102, the first block vector is determined based on the block vector candidate list.

[0376] In some embodiments, determining a first block vector based on a block vector candidate list may include: performing cost calculations for at least two candidate block vectors in the block vector candidate list to determine the cost value of each of the at least two candidate block vectors; determining a minimum cost value based on the cost values ​​of each of the at least two candidate block vectors; and designating the candidate block vector corresponding to the minimum cost value as the first block vector.

[0377] Furthermore, it should be noted that in the embodiments of this application, the cost value of each candidate block vector may be calculated by calculating the matching cost between the template corresponding to each candidate block vector and the first template based on a predetermined cost function. Here, the predetermined cost function may be the sum of absolute errors (SAD), the sum of transformed absolute errors (SATD), the mean squared error (MSE), the sum of squared errors (SSD), the mean absolute difference (MAD), the mean squared difference (MSD), the normalized cross-correlation coefficient (NCC), etc., and is not specifically limited to these.

[0378] In some embodiments, the method may further include determining a block vector index number corresponding to a first block vector based on a block vector candidate list, encoding the block vector index number, and writing the resulting encoded bits to a bitstream. Here, the block vector index number can be written to the bitstream as block vector instruction information; that is, the block vector instruction information can be encoded, and the resulting encoded bits can be written to the bitstream.

[0379] In some embodiments, the method may further include determining a block vector index number corresponding to a first block vector based on a block vector candidate list, determining a block vector difference value based on the initial block vector of the current block and the first block vector, encoding the block vector index number and the block vector difference value, and writing the resulting encoded bits to a bitstream. Here, the block vector index number and the block vector difference value can be written to the bitstream as block vector instruction information; that is, the block vector instruction information can be encoded, and the resulting encoded bits can be written to the bitstream.

[0380] In the embodiments of this invention, the block vector indication information may differ depending on the prediction mode. For example, it may be a block vector index number, a block vector difference value, etc., but this is not specifically limited here.

[0381] In one possible embodiment, block vector indication information may include a block vector index number. Exemplary, in IBC merge mode, after determining the block vector index number bvIdx, the subsequent decoding side can obtain a specific bvL based on the block vector index number bvIdx and the block vector candidate list bvCandList.

[0382] bvL[0]=bvCandList[bvIdx][0] bvL[1]=bvCandList[bvIdx][1] This bvL will be the final BV.

[0383] In another possible embodiment, the block vector instruction information may include a block vector index number. Exemplarily, in IBC MBVD mode, similar to MMVD in the interframe technology of VVC, one candidate item from any of the IBC merge lists is taken as a starting point, one candidate item is selected from a set of candidate points corresponding to a predefined set of distances and directions, and the corresponding block vector is taken as the final BV.

[0384] For example, in IBC MBVD, the distance set is defined as {1-pel, 2-pel, 4-pel, 8-pel, 12pel, 16pel, 24pel, 32pel, 40pel, 48pel, 56pel, 64pel, 72pel, 80pel, 88pel, 96pel, 104pel, 112pel, 120pel, 128pel}, and the BVD directions are two horizontal directions (positive and negative) and two vertical directions (positive and negative).

[0385] Thus, the base candidate items can be selected from the top five candidate items in the re-sorted IBC merge list, and all possible MBVD refinement positions for each base candidate (i.e., 20 × 4 candidate items) are re-sorted based on the SAD cost between the template and its reference to each refinement position. Finally, the top eight refinement positions with the smallest template SAD are retained for MBVD index coding. IBC-MBVD candidate items do not inherit the inversion type from adjacent blocks coded in RR-IBC. The MBVD index is binarized by a Rice code with a parameter equal to 1.

[0386] In yet another possible embodiment, the block vector instruction information may include a block vector index number. Exemplaryly, in IBC TM merge mode, after obtaining bvL based on the block vector index number bvIdx, local refinement can be performed on the BV using TM. The specific operation involves searching within a narrow range centered on the obtained bvL and selecting the optimal BV within that range as the final BV based on the criterion of minimizing the template matching cost.

[0387] The TM refinement process for the candidate list in IBC merge mode is as follows:

[0388] When constructing candidate items, the inversion type will be set to "no inversion" by default.

[0389] The IBC TM merge mode specifies whether the transmitted syntactic elements undergo integer pixel-precision TM refinement under IBC merge mode. Both the refinement motion vector and the template position used in each refinement step must adhere to the reference area constraints.

[0390] The search is performed in the vicinity of the location pointed to by the candidate item, and the optimal position is determined by the magnitude of the SAD between the template of the reference block and the template of the current block. The following search methods are included, but are not limited to them. The search range is set to [-8,8], and first, as shown in Figures 7A and 7B, a diamond search of integer pixels is performed to search for 8 points in the vicinity of the center position, with a maximum of 375 searches. The search continues even after the first optimal position is determined, and in the subsequent search process, 5 points are searched at even positions and 3 points at odd positions.

[0391] After the diamond-shaped search process described above, a cross search of integer pixels is performed only once. That is, after the current optimal position is found by the diamond-shaped search, four positions located one pixel away from the current optimal position—below, to the right, above, and to the left—are checked to update the final optimal position, and thus the refined candidate list is updated.

[0392] In yet another possible embodiment, the block vector instruction information may include a block vector index number and a block vector difference value. Exemplaryly, in IBC ABVP mode, the predicted bvL is obtained using the block vector index number bvIdx and the block vector candidate list bvCandList, and the true bvL must be further calculated by adding the block vector difference (BVD), the generalized specific process being as follows:

[0393] In step 1, the horizontal and vertical components of BVD are obtained, where MvdL0 is the difference in the forward motion vector.

[0394] bvd[0]=MvdL0[xCb][yCb][0] bvd[1]=MvdL0[xCb][yCb][1] In step 2, a rounding operation is performed on the predicted bvL obtained above, where the right shift parameter AmvrShift is used for rounding, and the left shift parameter AmvrShift is used to improve the resolution. Specifically, this is done as follows:

[0395] Offset=(AmvrShift==0)?0:((1<<(AmvrShift-1))-1) bvL[0]=Sign(bvL[0])×(((Abs(bvL[0])+offset)>>AmvrShift)< <AmvrShift) bvL[1]=Sign(bvL[1])×(((Abs(bvL[1])+offset)>>AmvrShift)< <AmvrShift) In step 3, the true bvL must be within the range of -217 to 217-1, which is derived as follows.

[0396] u[0]=(bvL[0]+bvd[0]+218)%218 bvL[0]=(u[0]>=217)?(u[0]-218):u[0] u[1]=(bvL[1]+bvd[1]+218)%218 bvL[1]=(u[1]>=217)?(u[1]-218):u[1] Furthermore, the method for obtaining the BVD in Step 1 can also be derived from syntactic elements obtained by other encoding methods. IBC ABVP's BVD uses subpixels, integer pixels, or 4 pixels as units. During encoding, the code can be predicted, and the suffix of the exponential Golomb code obtained after binarization can also be predicted. Therefore, the syntactic elements can be defined by multiple pieces of information from the BVD value: a flag of 0 or not, a prefix, a code, and a suffix. The actual value of the BVD can be obtained by analyzing the combination of this information. A specific example is as follows.

[0397] Furthermore, it should be noted that context coding is used for the identifier of whether the BVD is 0 or not. The value (absolute value -1) is binarized using a first-order exponential Golomb, the first five binary data (bin:Binary) of the EG1 prefix are coded using context coding, and the remaining prefix is ​​bypass coded. Up to four bins of the EG1 suffix transmit the predicted index using context coding, while the other bins of the EG1 suffix employ bypass coding. The two bins of the sign bit transmit the sign predicted index using context coding. Figure 8 is a schematic diagram showing the relationship between block vectors (BV), block vector predictions (BVP), and block vector differences (BVD). As shown in Figure 8, here is the prediction process for suffix bins that transmit one predicted index each in the horizontal and vertical directions, and bins that transmit one sign index each in the horizontal and vertical directions, sorting is performed using the current block template and the corresponding BV template to derive the predicted indices for the suffix and sign.

[0398] It should be noted that in the embodiments of this application, the final derived BV must fall within a specified range (a coordinate range in terms of rows and columns), as shown in Figures 9, 10, and 11.

[0399] To ensure understanding, in the embodiments of the present application, the first block vector may be a luminance block vector or a chromaticity block vector, and is not particularly limited thereto. Here, if the first block vector is a luminance block vector, the luminance block vector is used to determine a predicted value based on the luminance component of the current block, and if the first block vector is a chromaticity block vector, the chromaticity block vector is used to determine a predicted value based on the luminance component of the current block.

[0400] Furthermore, in the IBC mode of the chromaticity component, a chromaticity block vector can be derived based on the luminance block vector. In one possible embodiment, the first block vector is a luminance block vector, and the method may further include scaling the luminance block vector based on a predetermined chromaticity sampling format to determine a chromaticity block vector, which is used to determine a predicted value based on the chromaticity component of the current block.

[0401] In another possible embodiment, the first block vector is a luminance block vector, and the method may further include scaling the luminance block vector based on a predetermined chromaticity sampling format to determine a scaled block vector, and modifying the scaled block vector to determine a chromaticity block vector, where the chromaticity block vector is used to determine a predicted value based on the chromaticity component of the current block.

[0402] In the embodiments of this application, the process for deriving the BV of the chromaticity component based on the BV of the luminance component is as follows.

[0403] Input: Luminance bvL (1 / 16 pixel precision), Output: Chromaticity component BVC (Block Vector Chroma) (1 / 32 pixel precision).

[0404] The derivation process may involve direct scaling or refinement using TM after scaling, but this is not specifically limited here.

[0405] An example of a scaling operation is as follows:

[0406] bvC[0]=((bvL[0]>>(3+SubWidthC))×32) bvC[1]=((bvL[1]>>(3+SubHeightC))×32) Here, the variables SubWidthC and SubHeightC specifically depend on the chromaticity format sampling structure specified by sps_chroma_format_idc, and please refer to Table 1 for the specific correspondence. Table 1 shows the correspondence between sps_chroma_format_idc and the chromaticity format sampling structure.

[0407] The refinement operation may include the following methods: Refinement is performed using TM, that is, after obtaining the BV of the luminance component, the offset position is found using the position and BV of the chromaticity block, a detailed search is performed in the vicinity of the offset position using a template, and the optimal BV (i.e., the refined BV) is obtained based on the criterion that minimizes TMcost. As shown in Figure 12, the shaded area represents the chromaticity reconstruction area, and for the current block, the template matching method can be adopted to find the optimal matching template and the corresponding refined BV, the reference block at the optimal offset position obtained by the refined BV can be copied, and furthermore, the chromaticity prediction value of the current block can be determined.

[0408] In step S2103, the matching template and the corresponding reference block are determined based on the first block vector.

[0409] In the embodiments of this application, after determining the first block vector, the matching template and the corresponding reference block can be determined based on the first block vector. In some embodiments, determining the matching template and the corresponding reference block based on the first block vector is possible. Based on the first block vector, determine the reference template and the corresponding reference block, This may include, if the reference template satisfies a first predetermined condition, performing a first process on the adjacent regions of the reference template to determine the matching template.

[0410] In some embodiments, determining the matching template and the corresponding reference block based on the first block vector is possible. Based on the first block vector, determine the reference template and the corresponding reference block, This may include, if the reference template satisfies the second predetermined condition, making the reference template a matching template.

[0411] Furthermore, it should be noted that in the embodiments of this application, the matching template may include sample points within the reference template and sample points in adjacent regions of the reference template.

[0412] Furthermore, it should be noted that in the embodiments of this application, the available reconstructed pixels can be determined based on the template type refTemplateType of the current block. For example, if the template type refTemplateType is 1, it indicates that the adjacent left, upper left, and upper reconstructed pixels are available, as shown in Figure 17. The number of available reconstructed pixels on the left is templateW_size × nTbH, the number of available reconstructed pixels on the upper is templateH_size × nTbW, and the number of available reconstructed pixels on the upper left is templateW_size × templateH_size.

[0413] In the embodiments of this application, the first predetermined condition differs from the second predetermined condition. In some embodiments, the method may further include determining that the reference template satisfies the first predetermined condition when sample points other than the reference template and reference block are used.

[0414] In some embodiments, the method may further include determining that the reference template satisfies a second predetermined condition if no sample points other than the reference template and reference block are used.

[0415] In the embodiments of this application, since the filter may use reconstructed pixels other than the reference template and reference block, padding is required for boundary pixels. The boundary region requiring padding differs depending on the shape of the filter. One example of a boundary padding region is shown in Figure 18A, and another boundary padding region is shown in Figure 18B, where the grid-like region is the area requiring padding.

[0416] In some embodiments, if the reference template satisfies a first predetermined condition, performing the first process on the adjacent region of the reference template may include performing a padding process on the sample points in the adjacent region of the reference template if sample points other than the reference template and the reference block are used.

[0417] In the embodiments of this application, for padding, it is first necessary to determine whether sample points in the adjacent regions of the reference template are available. In some embodiments, padding is performed on sample points in the adjacent regions of the reference template. Determine whether sample points are available for adjacent regions of the reference template, If sample points for the adjacent regions of the reference template are available, use the sample points for the adjacent regions of the direct reference template. If sample points for the adjacent regions of the reference template are unavailable, this may include performing padding on the adjacent regions of the reference template by copying reconstructed sample points in the adjacent reference template or adjacent reference block of the sample points to obtain sample points for the adjacent regions of the reference template.

[0418] Furthermore, the availability of sample points in the adjacent regions of the reference template is indicated by: The sample points must not exceed the specified search range. The sample points must not extend beyond the image boundary. The sample points must not extend beyond the tile boundary. This includes at least one of the following: the sample points have been reconstructed.

[0419] In embodiments of the present application, the padding process may be performed by directly copying the sample points of the adjacent region of the reference template without determining whether or not sample points of the adjacent region of the reference template are available. In some embodiments, performing padding on sample points of the adjacent region of the reference template may include performing padding on the adjacent region of the reference template and obtaining sample points of the adjacent region of the reference template by directly copying the reconstructed sample points in the adjacent reference template or adjacent reference block of the sample points. It should be noted that "direct copying" here means that it is not necessary to determine whether or not sample points of the adjacent region of the reference template are available.

[0420] In some embodiments, the padding process may further include skipping padding on sample points in adjacent regions of a reference template when sample points other than those in a reference template and reference block are used, and skipping sample points when determining model parameters.

[0421] In other words, there are several different methods for padding in the embodiments of this application. One padding method involves determining whether a grid region is available and, if available, directly using the reconstructed pixels; if unavailable, copying the reconstructed pixels from an adjacent reference template or reference block to pad the grid region. Alternatively, another padding method involves directly copying the reconstructed pixels from an adjacent reference template or reference block to pad the grid region without considering whether the grid region is available. Or, as yet another padding method, padding may be omitted, and if a boundary location is encountered, the use of the corresponding data in calculations may be abandoned, and this is not specifically limited here.

[0422] In step S2104, model parameters are determined based on the first template and the matching template, a filtering process is performed on the reference blocks based on the model parameters, and the filtered reference blocks are determined.

[0423] In the embodiments of this application, after determining the number of available reconstructed pixels, a reconstruction region for calculating filter coefficients (i.e., model parameters) is determined based on the available reconstructed pixels. This region is referred to as R, and R typically includes all available reconstructed pixels in the template. For example, if refTemplateType is 1, R includes all available reconstructed pixels on the left, upper left, and upper sides.

[0424] Furthermore, it should be noted that in embodiments of the present application, the model parameters may include the coefficients of the target filter. In some embodiments, the method may further include determining the coefficients of the target filter based on the pixel reference values ​​in the first template and the pixel reference values ​​in the matching template.

[0425] Furthermore, it should be noted that in embodiments of the present application, the coefficients of the target filter may be determined by solving an optimization problem. Correspondingly, in some embodiments, the method may further include the coefficients of the target filter being coefficients used by the target filter when a first error between the pixel reference values ​​in the matching template and the output values ​​after they have been processed by the target filter satisfies a first condition.

[0426] It should be understood that for the first error to satisfy the first condition, in one possible embodiment, the first condition is that the first error is the smallest possible value. Or, in another possible embodiment, the first condition is that the first error is within a first predetermined threshold range. Or, in yet another possible embodiment, the first condition is that the change in the first error is within a second predetermined threshold range.

[0427] Furthermore, it should be understood that both the first predetermined threshold range and the second predetermined threshold range are evaluation criteria set in advance by the decoding side to determine whether the first error satisfies the first condition. Moreover, the first error here may be the mean squared error (MSE), the sum of squared errors (SSE), the sum of absolute errors (SAD), the sum of absolute errors after Hadamard transformation (SATD), or the mean absolute error (MAE), and the embodiments of this application are not specifically limited to these.

[0428] In some embodiments, determining the coefficients of the target filter based on the pixel reference values ​​in the first template and the pixel reference values ​​in the matching template is possible. Determining the autocorrelation parameter based on the pixel reference values ​​within the matching template, The cross-correlation parameters are determined based on the pixel reference values ​​in the first template and the pixel reference values ​​in the matching template. This may include determining the coefficients of the target filter based on autocorrelation and cross-correlation parameters.

[0429] In the embodiments of this application, the pixel reference value includes at least one of the pixel reconstruction value, pixel gradient value, and pixel position information.

[0430] In other words, in the embodiments of the present application, the target filter functions as the filter model of the embodiments of the present application, and the input information of the target filter is the pixel reference value in the matching template. Here, the coefficient of the target filter is c k,lThis can be expressed as and in this embodiment, it may also be called the filter coefficient. Here, the input information for calculating the filter coefficient may be the available reconstructed pixels of the matching template, or the gradient (including but not limited to horizontal gradient, vertical gradient, etc.) of each reconstructed pixel in the matching template may be calculated and the calculated gradient may be used as input information for calculating the filter coefficient, or the position information of each reconstructed pixel may be used as input information for calculating the filter coefficient. Here, the position information may be the absolute position information of each reconstructed pixel in the entire image, or the relative position information of each reconstructed pixel with respect to a certain reference point, but is not specifically limited here.

[0431] In one specific embodiment, a set of filter coefficients can be derived by first determining a reconstruction region R for calculating the filter coefficients, and then minimizing the MSE between the reconstructed pixels in region R and the reconstructed pixels of the first template, as shown in equations (3) and (4) above.

[0432] Furthermore, the process for deriving the filter coefficients by minimizing the MSE is specifically as follows:

[0433] First, c k,l We take the partial derivative with respect to and set the result to 0, as shown in equations (5) and (6) above, where k and l are in the range of -1 to 1, and m and n are also in the range of -1 to 1.

[0434] Next, rearranging based on equations (5) and (6), we obtain the equation shown in equation (7).

[0435] Next, after determining the reconstruction region R, equation (7) is expanded in matrix form, which is specifically as shown in equations (8) to (10) above.

[0436] Thus, since the autocorrelation matrix of refTemp in the reconstructed region R, and the cross-correlation vector between refTemp and recTemp are both known quantities, the filter coefficient c can be obtained by solving the system of equations shown in equation (7). k,l The filter coefficient c can be calculated, and k,l It may or may not be a fixed-point number.

[0437] Furthermore, in the embodiments of this application, it is also necessary to determine the number of coefficients and the shape of the target filter. Here, the number of coefficients and the shape of the target filter may both be fixed values ​​set in advance, or they may be associated with the size of the current block.

[0438] In some embodiments, the method may further include the fact that the number of coefficients in the target filter is equal to a first predetermined value.

[0439] In some embodiments, regarding the number of coefficients of a target filter, the method may further include determining the number of coefficients of a target filter, encoding the number of coefficients of the target filter, and writing the resulting encoded bits to a bitstream.

[0440] The number of coefficients in the target filter can be expressed as nTap. For example, the value of nTap may be 4, 5, 6, 7, 8, 9, etc., but it is not specifically limited to these values.

[0441] Furthermore, it should be noted that the number of coefficients in the target filter can also be called the number of taps in the target filter. Here, the number of coefficients in the target filter may be a predetermined constant value, or it may be determined based on the current block size, and is not specifically limited here.

[0442] In some embodiments, regarding the shape of the target filter, the method may further include the fact that the target filter is a one-dimensional or two-dimensional filter of a predetermined shape.

[0443] In some embodiments, the method may further include determining the shape of the target filter, encoding the shape of the target filter, and writing the resulting encoded bits to a bitstream.

[0444] In some embodiments, the method may further include determining a value for a filter shape parameter, where the filter shape parameter represents the shape of a target filter. Furthermore, the method may further include encoding the value of the filter shape parameter and writing the resulting encoded bits to a bitstream.

[0445] The filter shape parameter can be represented by FilterIdx, which is used to indicate the shape of the target filter. In the embodiments of this application, the shape of the target filter may be a rhombus, rectangle, cross, bar, or even a one-dimensional filter or a two-dimensional filter, but is not particularly limited thereto.

[0446] For example, if the value of FilterIdx is equal to 0, the shape of the target filter is determined to be a rhombus; if the value of FilterIdx is equal to 1, the shape of the target filter is determined to be a cross; and if the value of FilterIdx is equal to 2, the shape of the target filter is determined to be a rectangle.

[0447] As an example, Figure 19 is a schematic diagram of the shape of a filter according to an embodiment of the present invention. As shown in Figure 19, the filter shape is cross-shaped, and the number of taps in the filter is 5. Here, the number of taps in the filter can be dynamically adjusted based on the current block size.

[0448] Furthermore, it should be noted that the shape of the target filter may be a predetermined shape, determined by the value of the filter shape parameter, or determined based on the size of the current block; it is not specifically limited here.

[0449] In the embodiment of this application, after determining the model parameters, the predicted value of the current block can be determined based on the model parameters and the reference block. Specifically, a filtering process is performed on the reference block based on the model parameters, and then the predicted value of the current block is determined based on the filtered reference block.

[0450] In some embodiments, filtering reference blocks based on model parameters and determining the filtered reference blocks may include filtering reference blocks based on model parameters and determining a first output value of the target filter, and determining the filtered reference blocks based on the first output value of the target filter.

[0451] In some embodiments, filtering reference blocks based on model parameters and determining the filtered reference blocks may include padding the sample points of the adjacent regions of the reference blocks if sample points of the adjacent regions of the reference blocks are used. In other words, in embodiments of the present application, it is necessary to use sample points of the adjacent regions of the reference blocks, i.e., it is necessary to pad the sample points of the adjacent regions of the reference blocks.

[0452] In the embodiments of this invention, a first output value of the target filter can be calculated based on the pixel reconstruction value of the reference block and the coefficient of the target filter in the model parameters, and then the filtered reference block can be determined based on the first output value of the target filter. The target filter here may be a linear filtering model or a nonlinear filtering model, but is not specifically limited thereto.

[0453] In one possible embodiment, filtering is performed on a reference block based on model parameters to determine the first output value of the target filter. Calculate the product of the pixel reconstruction value of the reference block and the coefficient of the corresponding target filter, This may include setting the first output value of the target filter to be equal to the sum of n products, where n is the number of coefficients of the target filter and n is a positive integer.

[0454] The target filter in the embodiment of this application is a linear filtering model. The first output value of the target filter can be calculated using equation (11) above.

[0455] In another possible embodiment, filtering is performed on a reference block based on model parameters to determine the first output value of the target filter. Determine the first value in the first mapping relationship of the pixel reconstruction value of the reference block, Calculate the product of the first value and the corresponding target filter coefficient, This may include setting the first output value of the target filter to be equal to the sum of n products, where n is the number of coefficients of the target filter and n is a positive integer.

[0456] The target filter in the embodiment of this application is a nonlinear filtering model. For example, when minimizing the MSE of the filter coefficients, it can be calculated using equations (12) and (13) above.

[0457] Furthermore, it should be noted that in the embodiments of this application, determining the filtered reference block based on the first output value of the target filter may be done by directly making the first output value of the target filter the filtered reference block, or by performing a first filtering on the first output value of the target filter to obtain the filtered reference block. The first filtering here may be low-pass filtering, up / down-sampling filtering, etc., but is not specifically limited here.

[0458] Furthermore, it should be noted that in the embodiments of this application, after determining the first output value of the target filter, the filtered reference block can also be determined by adding a first offset value (represented by bias) to the first output value.

[0459] In some embodiments, determining the filtered reference block based on the first output value of the target filter may include determining a first offset value and performing an addition operation based on the first output value and the first offset value to determine the filtered reference block.

[0460] In one possible embodiment, determining a first offset value may include setting the first offset value equal to a second predetermined value.

[0461] In another possible embodiment, determining the first offset value may include determining the number of pixels involved in filtering corresponding to the target filter based on the shape of the target filter, determining m+1 coefficients of the target filter if the number of pixels of the reference filter corresponding to the target filter is m (where m is a positive integer), and determining the first offset value based on one of the m+1 coefficients and the second offset value.

[0462] In the embodiments of this application, if the number of pixels involved in the filtering operation is m for the target filter, then, considering the second offset value, the target filter needs to determine m+1 coefficients, and then, based on these m+1 coefficients, a weighting calculation is performed on the m pixels involved in the operation and one second offset value. Here, the coefficient used for the second offset value may be the (m+1)th coefficient or any other coefficient, but is not specifically limited here.

[0463] In embodiments of the present application, the method may further include setting the second offset value to be equal to a third predetermined value, or setting the second offset value to be equal to the value in the second mapping relationship of the pixel reconstruction value of the reference block.

[0464] The second mapping relationship may be a linear mapping relationship or a nonlinear mapping relationship, and there may be multiple nonlinear mapping relationships; there are no particular limitations on which one it may be here.

[0465] In the embodiment of the present invention, the calculated filter coefficients are the number of taps corresponding to the filter template, that is, the number of filter coefficients is equal to the number of taps nTap of the filter template. In addition, several bias terms (bias) may be added to the filter template. For example, in the embodiment of the present invention, when nTap=5, the filter coefficients are the tap coefficients c0~c4 corresponding to the filter template, and the calculated predicted value of the (i,j) position in the filtered reference block is as shown in equation (14) above. In this case, a bias term can be added, as shown in equation (15) above.

[0466] In the embodiments of this application, c n =c i,j,k,l Here, Constant may be a fixed constant, for example, Constant=1≪(BitDepth-1), or a number related to the reconstructed pixel value at position (i,j) in the reference block, for example, Constant=f(ref[i][j]), or a number related to the reconstructed pixel value corresponding to any tap in the filter template other than position (i,j), for example, Constant=f(ref[k][l]). Here, Constant=f(ref[i][j]) or Constant=f(ref[k][l]) may be a linear mapping relationship or a nonlinear mapping relationship. One or more bias terms may be added, and are not specifically limited here.

[0467] In step S2105, based on the filtered reference blocks, determine the predicted value of the current block.

[0468] Furthermore, in some embodiments, determining the predicted value of the current block based on the filtered reference blocks may include performing a second process on the filtered reference blocks to obtain the predicted value of the current block.

[0469] In the embodiments of the present application, for the second process, the second process may be to set the predicted value of the current block equal to the filtered reference block, or the second process may be a clip operation that limits the filtered reference block within a predetermined numerical range, or the second process may be other operations, but it is not specifically limited here.

[0470] Here, for the clip operation, the predetermined numerical range here may be between 0 and (1<<BitDepth)-1, where BitDepth represents the bit depth. When the filtered reference block takes a value exceeding the predetermined numerical range, it is necessary to perform a corresponding correction operation on the filtered reference block. Exemplarily, the filtered reference block can also be represented by Y pred [i][j], and at this time, a correction operation can be performed on Y pred [i][j], specifically as follows.

[0471] Y pred If the value of Y [i][j] is less than 0, set it to 0; pred If the value of Y pred [i][j] is greater than or equal to 0 and less than or equal to (1<<BitDepth)-1, it is equal to Y Y pred [i][j]; Y pred If the value of Y Y pred [i][j] is greater than (1<<BitDepth)-1, set it to (1<<BitDepth)-1.

[0472] In this way, for Y pred [i][j], by performing a correction operation, all pixel values in the filtered reference block can be made to be within the range of 0 to (1 << BitDepth)-1.

[0473] Furthermore, the number of filter models can be expanded. In addition to establishing only one filter model, multiple filter models can also be established. Therefore, in some embodiments, the method determines multiple sets of model parameters based on the first template and the matching template, constructs multiple filter models based on the multiple sets of model parameters, performs filtering processing on each of the reference blocks based on the multiple filter models, and determines multiple filtered reference blocks, and may include determining a predicted value of the current block based on the multiple filtered reference blocks.

[0474] In some embodiments, determining multiple sets of model parameters based on the first template and the matching template may include classifying the reconstructed pixels in the first template and the matching template according to a predetermined method respectively to obtain multiple sets of sub-templates and multiple sets of sub-matching templates, and determining multiple sets of model parameters based on the multiple sets of sub-templates and the multiple sets of sub-matching templates.

[0475] In the embodiments of this application, the predetermined method may be the magnitude of the reconstructed pixel values, the positional information of the reconstructed pixels, or the shape of the filter, and is not limited to these. After classification according to the predetermined method, each set of subtemplates and the corresponding submatching template can calculate a set of model parameters, and each set of model parameters can determine one filter model, thereby constructing multiple filter models.

[0476] In one possible embodiment, the method may further include determining a target filter from among a plurality of filter models, and performing a filtering process on a reference block based on the target filter to determine a predicted value for the current block.

[0477] Furthermore, in some embodiments, the method may further include determining a target model index value, where the target model index value is used to indicate the index number in multiple filter models of the target filter, and encoding the target model index value and writing the resulting encoded bits to a bitstream.

[0478] Furthermore, in some embodiments, determining a target filter from among multiple filter models may include determining the original value of the current block, calculating costs based on the original value of the current block and multiple initial predicted values ​​of the current block, determining the cost value for each of the multiple initial predicted values, determining the minimum cost value from among the cost values ​​for each of the multiple initial predicted values, and setting the filter model corresponding to the minimum cost value as the target filter. It should be noted that the cost value here may be a distortion value, a rate-distortion cost value determined based on a rate-distortion optimization method, or any other cost value, but is not specifically limited here.

[0479] In another possible embodiment, filtering can be performed on each reference block based on multiple filter models, and multiple filtered reference blocks can be determined. In some embodiments, determining the predicted value of the current block based on multiple filtered reference blocks may include performing weight calculations on the multiple filtered reference blocks to determine the predicted value of the current block.

[0480] Furthermore, if the weight values ​​of each filtered reference block are equal and all are equal to the reciprocal of the number of reference blocks, then the weighting calculation here can be considered as calculating the average. In other words, the average is calculated for multiple filtered reference blocks to determine the predicted value of the current block.

[0481] Exemplary, the input information for calculating filter coefficients is classified, and a filtering model is established for each category of input information. For example, when establishing a filter model using reconstruction information, one feasible form is to classify by the mean value of the reconstruction information, establishing one filter model for reconstruction information greater than the mean and another filter model for reconstruction information less than the mean. Another feasible form is to classify using the position of the reconstruction information, for example, establishing one filter model using the available reconstruction information on the left and top, and establishing a second filter model using the available reconstruction information on the left and top-left, with the encoding side deciding which model to use. One feasible decision method is for the encoding side to decide which model to use using a rate-distortion optimization method, and transmit the corresponding decoding parameters to the decoding side so that the decoding side can clearly identify which filter model to select later. Another feasible form is to classify using the shape of the filter, using multiple different filter shapes, establishing a filter model for each shape, and having the encoding side decide which shape of filter to use. One feasible decision method is for the encoding side to decide which filter to use using a rate-distortion optimization method, and transmit the corresponding decoding parameters to the decoding side so that the decoding side can then clearly identify which filter model to select.

[0482] Furthermore, it should be noted that in the embodiments of this application, after determining the predicted value of the current block, the predicted residual of the current block can be calculated, and in some embodiments, determining the predicted residual of the current block based on the predicted value of the current block may include determining the original value of the current block and determining the predicted residual of the current block based on the original value of the current block and the predicted value of the current block.

[0483] In one specific embodiment, determining the predicted residual of the current block based on the original value of the current block and the predicted value of the current block may include performing a subtraction operation on the original value of the current block and the predicted value of the current block to determine the predicted residual of the current block.

[0484] Furthermore, it should be noted that in embodiments of the present application, whether the current block applies an intra-block copy or a filter model can be determined by different syntactic element identifiers. In some embodiments, the method may further include determining a value of a first syntactic element identifier, which is used to indicate whether the current block applies an intra-block copy, and encoding the value of the first syntactic element identifier and writing the resulting encoded bits to a bitstream.

[0485] In embodiments of the present application, determining the value of the first syntactic element identifier may include determining that the value of the first syntactic element identifier is a first value if the current block applies an intrablock copy, or determining that the value of the first syntactic element identifier is a second value if the current block does not apply an intrablock copy.

[0486] Furthermore, in some embodiments, if the first syntactic element identifier indicates that the current block applies an intra-block copy, the method may further include determining the value of a second syntactic element identifier, where the second syntactic element identifier is used to indicate whether the current block applies a filter model, and encoding the value of the second syntactic element identifier and writing the resulting encoded bits to a bitstream.

[0487] In embodiments of the present application, determining the value of the second syntactic element identifier may include determining that the value of the second syntactic element identifier is the first value if the current block applies a filter model, or determining that the value of the second syntactic element identifier is the second value if the current block does not apply a filter model.

[0488] Furthermore, in some uses, the method is When the current block applies a filter model, it performs the following steps: filtering the reference block based on the model parameters and determining the filtered reference block; and determining the predicted value of the current block based on the filtered reference block. This may further include, if no filter model is applied to the current block, the reconstructed pixel values ​​in the reference block are used as the predicted values ​​for the current block.

[0489] In the embodiments of this application, the first and second values ​​are different, and the first and second values ​​may be in parameter format or numerical format. Specifically, the first syntactic element identifier and the second syntactic element identifier may be parameters written in the profile or flag values, and there is no particular limitation to these here. For example, the first value may be set to 1 and the second value to 0, or the first value may be set to true and the second value to false, but there is no particular limitation here.

[0490] Furthermore, it should be noted that in the embodiments of this application, the current block is determined by several conditional decisions to determine whether or not to use the filtered reference block as the final predicted value, but is not limited to the following three methods. These three methods are, for example, as follows:

[0491] In Method 1, the filtering of the matching template is determined by comparing the distortion between the matching template and the template of the current block, such as SAD, MSE, SATD, or SSE, with a threshold T_Distortion1.

[0492] In Method 2, after satisfying the requirement of using a filter model in Method 1, the distortion between the filtered matching template and the current block template, such as SAD, MSE, SATD, or SSE, is compared with a threshold T_Distortion2 to determine whether or not to filter the reference block.

[0493] In method 3, the encoding side transmits a Flag to indicate whether or not to apply a filter model. tmpFlag indicates whether intra-template matching is applied to the current block, and filterFlag indicates whether or not a filter model is applied to the current block. If tmpFlag is 1, the encoding side decides whether or not to filter the reference block by comparing the distortion between the reference block and the current block before and after filtering, for example, SAD, MSE, SATD, or SSE. If the distortion after filtering is smaller than the distortion before filtering, filterFlag becomes 1, and the current block uses the filtered reference block as the prediction block. Otherwise, filterFlag becomes 0, and the current block uses the reference block before filtering as the prediction block. The encoding side then transmits filterFlag to the decoding side.

[0494] Furthermore, in some embodiments, the method may further include determining a plurality of reference blocks in a second search area and the model parameters of each of the plurality of reference blocks; performing a filtering process on each of the plurality of reference blocks based on the model parameters of each of the plurality of reference blocks to determine a plurality of filtered reference blocks; performing cost calculations between the plurality of filtered reference blocks and the current block to determine the cost value of each of the plurality of filtered reference blocks; determining the minimum cost value from among the cost values ​​of each of the plurality of filtered reference blocks, determining the filtered reference block and the corresponding reference block index number based on the minimum cost value; encoding the reference block index number and writing the resulting encoded bits to a bitstream.

[0495] In the embodiments of this application, the cost value may be a distortion value, a rate distortion cost value determined based on a rate distortion optimization method, or any other cost value, but is not specifically limited thereto.

[0496] Furthermore, it should be noted that in the embodiments of this application, regarding the reference blocks to which the filter coefficient is applied, the above embodiments calculate the filter coefficient only for the optimal matching template after the search and apply the filter coefficient to the reference block that best matches. In addition, it is also possible to apply the filter coefficient to all or some of the reference blocks in the search area and determine which filtered reference block will be the final predicted block by several conditional judgments, but is not limited to the following methods.

[0497] In Method 1, a filter coefficient is calculated for templates within the search range, filtering is performed, and the cost with the current template is calculated to determine which template to use. That is, a filter coefficient is calculated for some or all of the target templates within the search range, then the filter coefficient is applied to the target template, the cost with the current template is calculated, the optimal matching template after filtering is selected based on the cost, the reference blocks corresponding to the optimal matching template are filtered, and the final predicted value is obtained.

[0498] In method 2, the encoding side transmits a Flag to indicate which filtered reference block will be the final predicted block. tmpFlag indicates whether template matching is applied to the current encoded block, and filterIdx indicates which reference block within the current search range the filtering model is applied to. If tmpFlag is 1, the encoding side selects the optimal reference block by comparing the distortion between the reference block with the applied filter coefficients within the search range and the current original block, e.g., SAD, MSE, SATD, or SSE, and transmits the corresponding index to the decoding side.

[0499] Furthermore, in some embodiments, “each sample point in the template” can be replaced with “identified sample point in the template,” and “each sample point in the reconstruction block corresponding to the template” can be replaced with “identified sample point in the reconstruction block corresponding to the template.” Here, identified sample points in the template refer to one or more sample points located at the corners of the template region, for example, if only an upper template exists, it refers to the sample points at the upper left and lower right corners of the upper template region, or only the sample point at the lower right corner. Here, identified sample points in the reconstruction block corresponding to the template refer to one or more sample points located at the corners of the reconstruction block region, for example, the sample points at the upper left and lower right corners of the reconstruction block region, or only the sample point at the lower right corner of the reconstruction block region.

[0500] In the embodiments of this application, since the filter may use reconstruction sample points other than the reference template and reference block, it is necessary to perform padding on boundary sample points. An example of boundary padding is shown in Figures 18A and 18B, where the grid-like region is the region where padding is required.

[0501] In some embodiments, the padding method involves determining whether each sample point in the grid region is available, using the reconstructed pixels directly if available, and padding the grid region by copying the reconstructed pixels from the nearest reference template or reference block if unavailable.

[0502] Here, the method for determining whether something is available includes, but is not limited to, the fulfillment of one or more of the following conditions simultaneously.

[0503] The sample point must be within the image boundary. The sample point must be within the tile boundary. The sample points must have been reconstructed.

[0504] In some other embodiments, the padding method is determined based on the BV search range to determine whether the padding region's location exceeds the BV search range. If it does not exceed the search range, the reconstruction sample points are used directly; if it does exceed the search range, the grid region is padded by copying reconstruction sample points from an adjacent reference template or reference block. Specifically, it is determined whether boundary padding is necessary based on the derived iVerMin, iVerMax, iHorMin, and iHorMax.

[0505] leftPadding, rightPadding, topPadding, and bottomPadding indicate whether the left grid region, right grid region, upper grid region, and lower grid region copy the closest reconstructed sample point. That is, as follows:

[0506] leftPadding=!(pX_Best>iHorMin) rightPadding=!(pX_Best <iHorMax) topPadding=!(pY_Best>iVerMin) BottomPadding=!(pY_Best <iverMax) Here, if leftPadding is true, it indicates that the pixels in the left grid region are beyond the BV search range, and the reconstruction sample point from the nearest adjacent reference template is copied; otherwise, the reconstruction pixel at that position is used directly. If rightPadding is true, it indicates that the pixels in the right grid region are beyond the BV search range, and the reconstruction sample point from the nearest adjacent reference template or reference block is copied; otherwise, the reconstruction sample point at that position is used directly. If topPadding is true, it indicates that the pixels in the upper grid region are beyond the BV search range, and the reconstruction sample point from the nearest adjacent reference template is copied; otherwise, the reconstruction sample point at that position is used directly. If bottomPadding is true, it indicates that the pixels in the lower grid region are beyond the BV search range, and the reconstruction sample point from the nearest adjacent reference template or reference block is copied; otherwise, the reconstruction sample point at that position is used directly.

[0507] Furthermore, in the embodiments of the present invention, the associated mode selection flag (ibcFilterFlag) is transmitted at the CU layer, and the encoding scheme for the ibcFilterFlag can have multiple embodiments, one feasible scheme being to use equiprobability coding, another feasible scheme being to use context coding, which may use a default context initial state and context update rate, or may determine the context initial state and context update rate by statistics, and is not specifically limited herein.

[0508] Furthermore, in the embodiments of the present application, the encoding method can be implemented in combination with various submodes in IBC, including but not limited to, ordinary IBC merge, IBC TM merge, MBVD, IBC CIIP, IBC ABVP, etc., and is not specifically limited thereto.

[0509] Furthermore, in the embodiments of the present application, the encoding method is not limited to the intra-prediction mode, nor is it limited to the IBC mode, but is also applicable to other modes to which BV is applied. Moreover, the block vector in the encoding method is not limited to the BV used in IBC, nor is the template limited to the template used in IBC; there is no specific limitation to either of these here.

[0510] Furthermore, embodiments of the present application further provide a bitstream generated by bit encoding based on information to be encoded, wherein the information to be encoded includes at least one of the following: the predicted residual of the current block, block vector indication information, reference block index number, number of coefficients of the target filter, shape of the target filter, value of first syntactic element identifier information, and value of second syntactic element identifier information.

[0511] In the embodiments of the present invention, the block vector reference information may include at least one of a block vector index number and a block vector difference value. Furthermore, the first syntactic element identifier information is used to indicate whether the current block applies an intrablock copy, and the second syntactic element identifier information is used to indicate whether the current block applies a filter model.

[0512] This embodiment provides an encoding method that first determines a first template for the current block, determines a list of candidate block vectors for the current block, then determines a first block vector based on the candidate block vector list, further determines a matching template and a corresponding reference block based on the first block vector, determines model parameters based on the first template and the matching template, performs filtering on the reference block based on the model parameters, determines the filtered reference block, and finally determines the predicted value of the current block based on the filtered reference block. In this way, the model parameters are determined based on the first template and the matching template, and these model parameters fully reflect the correlation between the matching template and the first template of the current block. By applying this correlation to the reference block, performing filtering modifications on its reconstructed pixels, and using the filtered reconstructed pixels as the predicted pixels of the current block, prediction accuracy is improved, bitrate is saved, and the problem of linear changes between the reference block and the current block can be effectively solved. At the same time, the efficiency of encoding and decoding can be improved, and the performance of encoding and decoding can be further improved.

[0513] In another embodiment of the present invention, based on the encoding / decoding method in the above embodiment, the embodiment of the present invention proposes that in the IBC prediction process, the optimal matching reconstruction block is modified and the modified reconstructed pixels are used as the predicted pixels of the current encoding block. Specifically, a linear filtering model is established using the pixels of the matching template and the current encoding block template, and this linear filtering model is applied to the optimal matching reconstruction block, with the filtered pixels being the final predicted pixels. This technical solution is referred to as Intra Block Copy based on a Filter-based linear model (IBC-FLM).

[0514] The following section provides a detailed explanation of the prediction process of IBC-FLM technology.

[0515] IBC-FLM input: current block position (xTbCmp, yTbCmp), current block width nTbW, current block height nTbH.

[0516] IBC-FLM output: Predicted values ​​for the current block predSamples[x][y], where x=0..nTbW-1, y=0..nTbH-1.

[0517] The specific prediction process of the IBC-FLM technique can be divided into five steps: determining the current template type, obtaining the current template reconstruction pixels, determining the block vector within a predefined search range, establishing a linear filtering model, and generating predicted values. It should be noted that the Intra TMP-FLM technique may be used to predict either the luminance component or the chromaticity component, and is not specifically limited to this use.

[0518] Referring to Figure 22, an exemplary flowchart is shown of making predictions based on the IBC-FLM technology according to an embodiment of the present application. As shown in Figure 22, the process may include the following steps:

[0519] In step S2201, the current template type is determined.

[0520] The IBC technology currently uses adjacent reconstructed pixels of a block as templates and searches for matching templates within a predefined search area. Here, adjacent reconstructed pixels may be the upper reference pixels, upper left reference pixels, and left reference pixels of the encoded block. Therefore, the template type can be classified and determined based on whether adjacent reference pixels are available or not. The template type is represented by refTemplateType. For example, if the upper left, upper, and left reference pixels are all available, the value of refTemplateType is 1, and the shape of the template type is as shown in Figure 16(a). If only the left reference pixel is available, the value of refTemplateType is 2, and the shape of the template type is as shown in Figure 16(b). If only the upper reference pixel is available, the value of refTemplateType is 3, and the shape of the template type is as shown in Figure 16(c).

[0521] In step S2202, the current template pixel is obtained.

[0522] An IBC template may consist of reconstructed pixels from one or more regions above, to the left, and to the upper left of an encoded block. The template size is predetermined; for example, when obtaining the left template, the template width templateW_size can be set to 4, and when obtaining the top template, the template height templateH_size can be set to 4.

[0523] Specifically, based on the value of refTemplateType, it is possible to determine which part of the reconstructed pixels to retrieve.

[0524] For example, if the value of refTemplateType is 1, the reconstructed pixels to the left, top left, and top of the current coding block are retrieved; if the value of refTemplateType is 2, only the reconstructed pixels in the left four columns of the current coding block are retrieved; and if the value of refTemplateType is 3, only the reconstructed pixels in the top four rows of the current coding block are retrieved.

[0525] In step S2203, the block vector is determined.

[0526] In the embodiments of this application, the block vector may be a block vector based on the luminance component and / or a block vector based on the chromaticity component, and each will be described in detail below.

[0527] (1) Luminance component: Input: A luminance position (xCb, yCb) specifying the top-left corner sample of the current block relative to the top-left corner luminance sample of the current image, a variable cbWidth specifying the width of the current block within the luminance sample, and a variable cbHeight specifying the height of the current block within the luminance sample.

[0528] Output: Block vector of luminance (bvL: Block Vector Luma).

[0529] IBC modes can be broadly divided into two main categories: IBC merge and IBC ABVP (similar to the merge and AMVP modes in intermodes in VVC), and the process for obtaining the BV for both can be considered as consisting of the following three steps.

[0530] (1) When deriving bvL, it is necessary to establish a list of candidate IBC block vectors, bvCandList.

[0531] (2) Further, based on the bitstream, the candidate items in the selected candidate list are determined.

[0532] (3) Finally, the final BV is determined based on the candidate items.

[0533] The information that an IBC candidate item specifically remembers includes at least one of the following:

[0534] Prediction direction (L0 or L1, usually L0 by default), BV information (horizontal component, vertical component), Reference frame (default is current image), Inversion type (e.g., no inversion, horizontal inversion, and vertical inversion), Whether or not to use LIC (Linear Inductive Coherence) models.

[0535] The following describes the process for establishing the block vector candidate list. Using the IBC merge list establishment process as an example, the basic list establishment process for IBC ABVP is the same as that for IBC merge, but the maximum number of candidates is not the same (for example, define the length of the IBC merge candidate list as 6 and the length of the IBC ABVP candidate list as 2). The specific establishment process includes the following:

[0536] Step 1: Derivation of candidate spatial domain items If the usage conditions are met (for example, if the size condition IsGt4by4 is TRUE, i.e., the variable IsGt4by4 is TRUE if the product of luminance width and height is greater than 16), the process for deriving spatial block vector candidates from neighboring coding units, as defined in the decoding standard, is invoked, taking the luminance coded block position (xCb, yCb), luminance coded block width cbWidth, and height cbHeight as input, and the output is availability flags, e.g., availableFlagA1, availableFlagB1, and block vectors bvA1 and bvB1.

[0537] Availability detection for each candidate item is as follows: The following conditions are judged, and if all are met, the candidate item is available.

[0538] Whether the sum of the current block position and the offset position due to BVP exceeds the image boundary. Whether the sum of the current block location and the block location pointed to by the BVP does not cover the current block. Whether the sum of the current block position and the offset position due to BVP exceeds the available area of ​​the IBC. Is the sum of the current block position and the block position pointed to by BVP already reconstructed?

[0539] Here, the relative positions of adjacent blocks where A1 and B1 are located and the current block are as shown in Figure 3, and the traversal sequence can be A1→B1→B0→A0→B2.

[0540] Step 2: Add spatial region candidate items to the candidate list. If the usage conditions are met (for example, if the size condition IsGt4by4 is TRUE), the block vector candidate list bvCandList is constructed as follows:

[0541] i=0 if(availableFlagA1) bvCandList[i++]=bvA1 if(availableFlagB1) bvCandList[i++]=bvB1 ... Step 3: Check the number of valid items in the candidate list. The derivation process for the variable numCurrCand (the number of candidates obtained so far) is as follows:

[0542] If the usage conditions are met (for example, if the size condition IsGt4by4 is TRUE), numCurrCand is set to be equal to the number of candidates in bvCandList; otherwise, numCurrCand is set to 0.

[0543] Step 4: If the candidate list does not reach the specified number of items (for example, 6 items for IBC merge mode, 2 items for IBC ABVP mode), proceed with deriving historical candidate items, detecting availability, and adding them. If numCurrCand is less than MaxNumIbcMergeCand (maximum number of candidates in IBC merge mode) and NumHmvpIbcCand (maximum number of candidates for history-optimal block vectors (Hmvp) in IBC mode) is greater than 0, the history-based IBC block vector candidate derivation process specified in the decoding standard is invoked, with bvCandList and numCurrCand as inputs and the modified bvCandList and numCurrCand as outputs.

[0544] Step 5: Continue checking the number of valid items in the candidate list and adding other available candidate items (e.g., pairwise mean candidate items, zero-value BV candidate items, etc.) until the specified number of items is reached. For example, other available candidate items are as follows:

[0545] (1) Pairwise mean candidates can be constructed using the first and second candidate items, specifically as follows: mvAvgLX=(mvCand0LX+mvCand1LX+1)≫1

[0546] (2) The zero value BV can be set directly as follows: Set bvCandList[numCurrCand][0] to 0. (Horizontal component of bv) Set bvCandList[numCurrCand][1] to 0. (Vertical component of bv)

[0547] (3) A pair of BVP candidate items located in the IBC reference area can also be made into additional candidate items. The coordinates of a pair of BVP candidate items are determined by the width and height of the current block and the ΔX and ΔY parameters, as shown in Figure 4.

[0548] For each item added, numCurrCand increases by 1.

[0549] In this way, the establishment of the basic block vector candidate list bvCandList is complete.

[0550] Based on this list, the IBC merge mode can further use templates to resort the list, adjusting the order of the candidate list and making full use of high spatial correlation to reduce the transmission of encoded bits and effectively improve encoding efficiency. For example, for the IBC merge mode, after constructing an intermediate candidate list (note that the length of this intermediate candidate list may be greater than or equal to the maximum number of candidates in the IBC merge mode) using the list construction method described above, all candidate items in the list are resorted using templates, sorted in ascending order of template matching cost, and the first N (e.g., N=6) candidate items of the sorted list are selected. The specific process is as follows: the SAD of the template position of the reference block pointed to by each candidate item and the template position of the current block (shown in Figure 5) is calculated, these are arranged in ascending order, and the first 6 candidate items are selected as the candidate list for the IBC merge.

[0551] Based on this list, IBC ABVP mode can further perform operations to remove candidate redundancy based on the distance between candidate items.

[0552] The number of candidates remains unchanged at two, and candidate lists are established separately for integer pixels and 4-pixel precision.

[0553] If a non-RRIBC mode is selected for IBC ABVP and there are more than two valid BVP candidates, the maximum of six BVP candidates in the candidate list are clustered based on the Euclidean distance between them, where the radius (R) is determined as a logarithmic function of the current block width (cbWidth) and height (cbHeight) for a pair of block vectors, and if the Euclidean distance between the reference locations pointed to by some BV candidates is less than R, they are clustered, and the calculation of R is as shown in equation (2) above.

[0554] Here, the clustering method is performed according to the order of the candidate list, and within each cluster, the BVP with the lowest TM cost is selected as the representative candidate for that pair. Then, a template sort is performed on all the representative candidates for the clusters, and the top two pairs of representative candidates are selected for the motion estimation process.

[0555] When RRIBC mode is selected for IBC ABVP, candidate items can be adjusted to point to the boundaries of the valid IBC search area according to the horizontal or vertical direction of RRIBC mode.

[0556] Furthermore, based on the bitstream, the candidate items in the selected candidate list are determined, and the specific steps are as follows:

[0557] In IBV merge mode (general_merge_flag[xCb][yCb] is true) and IBC ABVP mode (general_merge_flag[xCb][yCb] is false), the candidate index bvIdx is derived in the following way, and general_merge_flag indicates whether or not it is IBC merge mode.

[0558] bvIdx=general_merge_flag[xCb][yCb]?merge_idx[xCb][yCb]:mvp_l0_flag[xCb][yCb].

[0559] The final BV will be determined based on the candidate items.

[0560] In IBC merge mode, a specific bvL can be obtained based on the index bvIdx and the block vector candidate list bvCandList.

[0561] bvL[0]=bvCandList[bvIdx][0] bvL[1]=bvCandList[bvIdx][1] This bvL will be the final BV.

[0562] In IBC MBVD mode, similar to MMVD in VVC interframe technology, one candidate item from the IBC merge list is used as a starting point, one candidate item is selected from a set of candidate points corresponding to a predefined set of distances and directions, and the corresponding block vector is used as the final BV.

[0563] For example, in IBC MBVD, the distance set is defined as {1-pel, 2-pel, 4-pel, 8-pel, 12pel, 16pel, 24pel, 32pel, 40pel, 48pel, 56pel, 64pel, 72pel, 80pel, 88pel, 96pel, 104pel, 112pel, 120pel, 128pel}, and the BVD directions are two horizontal directions (positive and negative) and two vertical directions (positive and negative).

[0564] The base candidate items can be selected from the top five candidate items in the re-sorted IBC merge list, and all possible MBVD refinement positions for each base candidate (i.e., 20 × 4 candidate items) are re-sorted based on the SAD cost between the template and its reference to each refinement position. Finally, the top eight refinement positions with the smallest template SAD are retained for MBVD index coding. IBC-MBVD candidate items do not inherit the inversion type from adjacent blocks coded in RR-IBC. The MBVD index is binarized by a Rice code with a parameter equal to 1.

[0565] In IBC TM merge mode, after obtaining bvL based on the above information, TM is used to further refine the BV locally. Specifically, a search is performed within a narrow range centered on the obtained bvL, and the optimal BV within that range is selected as the final BV based on the criterion of minimizing the template matching cost.

[0566] The TM refinement process for the candidate list in IBC merge mode is as follows:

[0567] When constructing candidate items, the inversion type will be set to "no inversion" by default.

[0568] The IBC TM merge mode specifies whether the transmitted syntactic elements undergo integer pixel-precision TM refinement under IBC merge mode. Both the refinement motion vector and the template position used in each refinement step must adhere to the reference area constraints.

[0569] The search is performed in the vicinity of the location pointed to by the candidate item, and the optimal position is determined by the magnitude of the SAD between the template of the reference block and the template of the current block. The following search methods are included, but are not limited to them. The search range is set to [-8,8], and first, as shown in Figures 7A and 7B, a diamond search of integer pixels is performed to search for 8 points in the vicinity of the center position, with a maximum of 375 searches. The search continues even after the first optimal position is determined, and in the subsequent search process, 5 points are searched at even positions and 3 points at odd positions.

[0570] For example, moving counterclockwise from the black dot corresponds to the order of indices 0 to 7. Specifically, the process described above involves searching for five or three points at the grid point locations once the position of the black dot is selected as the optimal position; Figures 7A and 7B are merely illustrative examples.

[0571] After the diamond-shaped search process described above, a cross search of integer pixels is performed only once. That is, after the current optimal position is found by the diamond-shaped search, four positions located one pixel away from the current optimal position—below, to the right, above, and to the left—are checked to update the final optimal position, and thus the refined candidate list is updated.

[0572] On the other hand, in IBC ABVP mode, the predicted bvL is obtained using the index bvIdx and the block vector candidate list bvCandList, and the true bvL needs to have the block vector difference (BVD) added to it, and the generalized specific process for this is as follows.

[0573] In step 1, the horizontal and vertical components of BVD are obtained, where MvdL0 is the difference in the forward motion vector.

[0574] bvd[0]=MvdL0[xCb][yCb][0] bvd[1]=MvdL0[xCb][yCb][1] In step 2, a rounding operation is performed on the predicted bvL obtained above, where the right shift parameter AmvrShift is used for rounding, and the left shift parameter AmvrShift is used to improve the resolution. Specifically, this is done as follows:

[0575] Offset=(AmvrShift==0)?0:((1<<(AmvrShift-1))-1) bvL[0]=Sign(bvL[0])×(((Abs(bvL[0])+offset)>>AmvrShift)< <AmvrShift) bvL[1]=Sign(bvL[1])×(((Abs(bvL[1])+offset)>>AmvrShift)< <AmvrShift) In step 3, the true bvL must be within the range of -217 to 217-1, which is derived as follows.

[0576] u[0]=(bvL[0]+bvd[0]+218)%218 bvL[0]=(u[0]>=217)?(u[0]-218):u[0] u[1]=(bvL[1]+bvd[1]+218)%218 bvL[1]=(u[1]>=217)?(u[1]-218):u[1] Furthermore, the method for obtaining the BVD in Step 1 can also be derived from syntactic elements obtained by other encoding methods. IBC ABVP's BVD uses subpixels, integer pixels, or 4 pixels as units. During encoding, the code can be predicted, and the suffix of the exponential Golomb code obtained after binarization can also be predicted. Therefore, the syntactic elements can be defined by multiple pieces of information from the BVD value: a flag of 0 or not, a prefix, a code, and a suffix. The actual value of the BVD can be obtained by analyzing the combination of this information. A specific example is as follows.

[0577] The identifier for whether BVD is 0 or not employs context coding. Values ​​(absolute value -1) are binarized using a first-order exponential Golomb, the first five binary data (bin:Binary) of the EG1 prefix are coded using context coding, and the remaining prefixes are bypass coded. Up to four bins of the EG1 suffix transmit the predicted index using context coding, while the other bins of the EG1 suffix employ bypass coding. The two bins of the sign bit transmit the sign predicted index using context coding. Figure 8 shows the prediction process for suffix bins that transmit one predicted index each in the horizontal and vertical directions, and bins that transmit one sign index each in the horizontal and vertical directions, sorted using the current block template and the corresponding BV template, and deriving the predicted indices for the suffix and sign.

[0578] In this way, the final derived BV must fall within the specified range (a coordinate range based on rows and columns).

[0579] For example, in VVC, the reference area of ​​the IBC is 128×128, and for a 128×128 size CTU, the reference area is as shown in Figure 9. In Figure 9, in any case of (a), (b), (c), or (d), there are two CTUs, the diagonally filled area is the reference area, the small vertically filled block represents a 64×64 size current block, and "×" represents an unavailable reference area.

[0580] In ECM7.0, as shown in Figure 10, each rectangle represents a CTU, a rectangle filled with vertical lines represents the CTU where the current block is located, and a rectangle filled with diagonal lines represents its reference region. Specifically, assuming that the current block to be encoded is located at CTU(m,n), the reference region includes CTUs with indices (m-2,n-2)...(W,n-2)...(0,n-1)...(W,n-1) and (0,n)...(m,n). Here, W represents the largest horizontal index in the current Tile, Slice, or Picture.

[0581] If the CTU size is 256x256, the two rows of CTUs shown above may require additional memory. To prevent the IBC from occupying additional memory, the reference area is adjusted as shown in Figure 11. Here, one rectangle represents one CTU, a rectangle filled with vertical lines represents the CTU where the block is currently located, and a rectangle filled with diagonal lines represents its reference area.

[0582] The range over which each block performs a block vector search (or local search) is limited horizontally [-(C<<1),C>>2] and vertically [-C,C>>2] to accommodate the expansion of the reference domain, where C represents the CTU size.

[0583] (2) Chromaticity component: In the IBC mode for the chromaticity component, the BV of the chromaticity component can be derived based on the BV of the luminance component, and prediction and reconstruction can then be performed based on the BV of the chromaticity component. The process for deriving the BV of the chromaticity component based on the BV of the luminance component is as follows.

[0584] Input: Brightness bvL (1 / 16 pixel precision) Output: Chromaticity component BVC (Block Vector Chroma) (1 / 32 pixel precision) The derivation process may involve direct scaling or scaling followed by refinement using TM.

[0585] An example of a scaling operation is as follows:

[0586] bvC[0]=((bvL[0]>>(3+SubWidthC))×32) bvC[1]=((bvL[1]>>(3+SubHeightC))×32) Here, the variables SubWidthC and SubHeightC specifically depend on the chromaticity format sampling structure specified by sps_chroma_format_idc, and please refer to Table 1 above for the specific correspondence.

[0587] The refinement operation may include the following methods:

[0588] Using TM, refinement is performed, that is, after obtaining the BV of the luminance component, the offset position is found using the position of the chromaticity block and the BV, and a detailed search is performed in the vicinity of the offset position using a template, and the optimal BV (i.e., the refined BV) is obtained based on the criterion that minimizes TMcost, as shown in Figure 12.

[0589] In step S2204, a linear filtering model is established.

[0590] Furthermore, a linear filtering model can be established using the optimal matching template found in the above steps and the current coded block template. This mainly involves two processes: determining the reconstruction region for calculating the filter coefficients, and calculating the filter coefficients.

[0591] Furthermore, it should be noted that the number of taps in a filter is defined as nTap. nTap may be a constant or a variable; for example, the number of taps in a filter can be dynamically adjusted based on the block size. In the embodiments of this application, various filter shapes can be selected. Exemplarily, a fixed-shape filter shown in Figure 19 can be selected, resulting in a filter tap count of nTap of 5.

[0592] (a) Determine the reconstruction region for calculating the filter coefficients.

[0593] Furthermore, the available reconstructed pixels are determined based on the template type refTemplateType. For example, if the template type refTemplateType is 1, it indicates that the adjacent left, upper left, and upper reconstructed pixels are available, as shown in Figure 17. The number of available reconstructed pixels on the left is templateW_size × nTbH, the number of available reconstructed pixels on the upper side is templateH_size × nTbW, and the number of available reconstructed pixels on the upper left is templateW_size × templateH_size.

[0594] Furthermore, it should be noted that boundary pixels need to be padded because filters may use reconstructed pixels other than the reference template and reference block. The boundary regions requiring padding will differ depending on the filter shape. One example of a boundary padding region is shown in Figure 18A, and another example is shown in Figure 18B, where the grid-like regions are the areas that require padding.

[0595] In the embodiments of this application, there are several different methods of padding, including, but not limited to, the following methods.

[0596] One padding method involves determining whether a grid region is available; if available, using the reconstructed pixels directly; otherwise, padding the grid region by copying the reconstructed pixels from an adjacent reference template or reference block.

[0597] Another padding method involves directly copying reconstructed pixels from adjacent reference templates or reference blocks to pad the grid areas.

[0598] Alternatively, another padding method is to not perform padding at all, and if a boundary location is encountered, the corresponding data is discarded for use in calculations.

[0599] In the embodiments of this application, the determination of availability includes, but is not limited to, one or more of the following conditions:

[0600] The sample points at that location have been reconstructed. The location must not exceed the search range of MV / BV. The location in question must not extend beyond the image boundary. The location must not extend beyond the tile boundary.

[0601] Thus, after determining the number of available reconstructed pixels, the reconstruction region for calculating the filter coefficients is determined based on the available reconstructed pixels. This region is called R, and R typically includes all available reconstructed pixels in the template. For example, if refTemplateType is 1, R includes all available reconstructed pixels on the left, upper left, and upper sides.

[0602] (b) Calculate the filter coefficients.

[0603] After determining the reconstruction region R for calculating the filter coefficients, a set of filter coefficients is derived by minimizing the MSE between the reconstructed pixels in region R and the reconstructed pixels of the current coded block template, namely, as follows:

[0604]

number

[0605]

number

[0606] The process for deriving the filter coefficients by minimizing the MSE is specifically as follows:

[0607] 1) First, c k,l Take the partial derivative with respect to and set the result to 0.

[0608]

number

[0609]

number

[0610]

number

[0611]

number

[0612] In other words, in the process of solving the system of linear equations, first, the autocorrelation matrix of the reconstructed pixels refTemp in the reconstruction region R is calculated, then the cross-correlation vector between refTemp and the current template reconstructed pixels recTemp is calculated, then Cholesky decomposition or LDL decomposition is performed on the autocorrelation matrix, and finally, each filter coefficient c is recursively calculated by back substitution. n These are calculated sequentially, and the filter coefficients for that set may or may not be fixed-point.

[0613] In step S2205, predicted values ​​are generated.

[0614] Furthermore, each currently encoded block can be obtained using the above method, and the filter coefficients of that set are c0, c2...c nTap-1Next, based on the filter shape and filter coefficients, the optimal matching reconstruction block is filtered, that is, weighted addition is performed on the filter coefficients and the reference pixels at the corresponding positions to obtain the currently predicted pixel. Ref is defined as the optimal matching reconstruction block, as follows.

[0615] ref[i][j]=recSamples[i+pX_BEST][j+pY_BEST] Here, i=0,…,nTbW-1 and j=0,…,nTbH-1, recSamples are the reconstructed pixels of the current image, and pX_BEST and pY_BEST are the horizontal and vertical components of the optimal block vector.

[0616] The specific calculation process for the predicted values ​​is as follows:

[0617] Assuming that the filter has 5 taps nTap and its shape is as shown in Figure 20A, then c0 to c4 are the respective tap coefficients of the filter, where the grid circle point corresponding to tap coefficient C0 is the currently predicted pixel Y. pred The reconstructed pixels ref[i][j] at the corresponding positions in the optimal matching block for [i][j] are shown, and the remaining white circles are the reconstructed pixels adjacent to the current spatial position in the optimal matching reconstruction block. The black circles in Figure 20B represent the obtained predicted pixels Y pred [i][j]

[0618] For each currently predicted pixel (i,j), if we define the pixel position in the filter template as (k,l), then we define the corresponding reconstructed pixel of the optimal matching block during filtering as ref[i+k][j+l], and each filter coefficient at the (k,l) position in the filter template as c k,l This is how it is defined.

[0619] c k,l =c n Here, n=0,...,nTap-1, and k and l are in the range from -1 to 1.

[0620] For i=0,…,nTbW-1 and j=0,…,nTbH-1,

number

[0621] The final predicted pixels are: predSamples[i][j]=Clip3(0,(1≪BitDepth)-1,Y pred [i][j])

[0622] Here,

number

[0623] In short, the embodiment of the present invention proposes IBC-FLM technology, establishes a linear filtering model using the matching template and the template information of the current coded block, fully utilizes the correlation between the matching template and the current coded block template, applies filtering correction to the pixels of the optimal matching reconstructed block, and uses the filtered reconstructed pixels as prediction pixels, thereby improving prediction accuracy to some extent and effectively solving the problem of linear changes between the optimal matching reconstructed block and the current coded block.

[0624] Furthermore, in the embodiment of this application, a linear filtering model is established between the optimal matching template obtained by the search and the current coded block template. Filter coefficients are calculated by minimizing the MSE between the prediction template (prediction template = filter coefficient × matching template) and the current coded block template. The optimal matching reconstructed block is then modified by filtering, and the filtered reconstructed pixels are obtained as the final prediction pixels.

[0625] Here, the input information for calculating the filter coefficients may be the available reconstructed pixels of the matching template, or the gradient of each pixel in the matching template (including, but not limited to, horizontal gradients and vertical gradients) may be calculated and the calculated gradients may be used as input information for calculating the filter coefficients. Furthermore, the position information of each pixel may also be used as input information for calculating the filter coefficients, and the position information may be the absolute position information of each pixel in the entire image, or the relative position information of each pixel with respect to a certain reference point.

[0626] Furthermore, in the embodiments of this application, for the calculation of filter coefficients, the filter coefficients finally calculated above are used as the tap coefficients corresponding to the filter template; that is, the number of filter coefficients is equal to the number of taps nTap in the filter template. In addition, several bias terms bias can be added to the filter template, for example, as follows.

[0627] In the main technical proposal, when nTap=5, the filter coefficients are the tap coefficients c0~c4 corresponding to the filter template, and the predicted value calculated at position (i,j) is:

number

[0628] At this point, a bias term can be added, specifically,

number

[0629] Here, c n =c i,j,k,lHere, Constant may be a fixed constant, for example Constant=1≪(BitDepth-1), or a number related to the reconstructed pixel value at position (i,j) in the reference block, for example Constant=f(ref[i][j]), or a number related to the reconstructed pixel value corresponding to a tap in the filter template other than position (i,j), for example Constant=f(ref[k][l]). Here, Constant=f(ref[i][j]) or Constant=f(ref[k][l]) may be a linear mapping relation or a nonlinear mapping relation. One or more bias terms may be added.

[0630] Furthermore, in the embodiments of the present application, the number of filtering models may be limited to establishing only one linear filtering model or multiple linear filtering models. Exemplarily, input information for calculating filter coefficients is classified, and a filtering model is established for each category of input information. For example, when establishing models using reconstructed information, one feasible form is to classify the reconstructed information by its mean value, establishing one model for reconstructed information greater than the mean and another model for reconstructed information less than the mean.

[0631] Another feasible form is to classify using the location of the reconstructed information. For example, one model could be established using the available reconstructed information on the left and top, and a second model could be established using the available reconstructed information on the left and top-left. The encoding side would then decide which model to use. One feasible decision-making method is for the encoding side to determine which model to use using a rate-distortion optimization method and transmit the corresponding Flag to the decoding side.

[0632] Another feasible approach involves classification using filter shapes, where multiple different filter shapes can be used, and a filtering model can be established for each shape. The encoding side decides which filter shape to use, and one feasible decision method is for the encoding side to determine which filter to use using a rate-distortion optimization method and transmit the corresponding flag to the decoding side.

[0633] Furthermore, in the embodiments of this application, a linear filtering model may be established, or a nonlinear filtering model may be established and filtering performed; the invention is not limited to either.

[0634] For example, one feasible approach is to establish a nonlinear filtering model by introducing a squared term. For instance, when minimizing the MSE of the filter coefficients, the calculation method is modified as follows:

[0635]

number

[0636] At the same time, the calculation method for predicting values ​​will be changed as follows:

[0637]

number

[0638] Furthermore, in the embodiments of this application, when calculating the predicted value, it is possible to determine whether or not to use the filtered predicted value of the current block as the final predicted value by several conditional judgments. For example, there are several methods such as the following.

[0639] (i) Determine whether to filter the matching template by comparing the distortion between the matching template and the currently encoded template, e.g., SAD, MSE, SATD, or SSE, etc., with a threshold T_Distortion1.

[0640] (ii) After the condition that a filter model is used in (i) is met, the filter model further compares the distortion between the filtered matching template and the template of the current encoded block, such as SAD, MSE, SATD, or SSE, with a threshold T_Distortion2 to determine whether or not to filter the reference block.

[0641] (iii) The encoder transmits a Flag to indicate whether or not to apply a filtering model. ibcFlag indicates whether or not the current encoded block applies an intra-block copy, and filterFlag indicates whether or not the current encoded block applies a filtering model. If ibcFlag is 1, the encoder decides whether or not to filter the reference block by comparing the distortion between the reference block and the original block before and after filtering, e.g., SAD, MSE, SATD, or SSE. If the distortion after filtering is smaller than the distortion before filtering, filterFlag is 1, and the current encoded block uses the filtered reference block as the prediction block. Otherwise, filterFlag is 0, and the current encoded block uses the reference block before filtering as the prediction block. The encoder then transmits filterFlag to the decoder.

[0642] Furthermore, in the embodiments of the present invention, in addition to calculating the filter coefficient only for the optimal matching template after the search and applying the filter coefficient to the reference block that best matches, it is also possible to apply the filter coefficient to all or some of the reference blocks in the search area and determine which filtered reference block will be the final predicted block based on several conditional judgments. Several methods for doing this are listed below.

[0643] (i) Determine the filter coefficients for templates within the search range, perform filtering, calculate the cost with the current template to determine which template to use; that is, calculate the filter coefficients for some or all of the target templates within the search range, then apply the filter coefficients to the target templates and calculate the cost with the current template, select the optimal matching template after filtering based on the cost, filter the reference blocks corresponding to the optimal matching template to obtain the final predicted value.

[0644] (ii) The encoding side transmits a Flag to indicate which filtered reference block will be the final predicted block. tmpFlag indicates whether template matching is applied to the current encoded block, and filterIdx indicates which reference block within the current search range the filtering model is applied to. If tmpFlag is 1, the encoding side selects the optimal reference block by comparing the distortion between the reference block with the applied filter coefficients within the search range and the current original block, e.g., SAD or MSE or SATD or SSE, and transmits the corresponding index to the decoding side.

[0645] Furthermore, in the embodiments of the present invention, when determining availability, "each sample point in the template" may be replaced with "identification sample point in the template," and "each sample point in the reconstructed block corresponding to the template" may be replaced with "identification sample point in the reconstructed block corresponding to the template."

[0646] Here, the identification sample points within the template refer to one or more sample points located at the corners of the template region. For example, if only the upper template exists, this would refer to the sample points at the top-left and bottom-right corners of the upper template region, or just the sample point at the bottom-right corner.

[0647] Here, the identification sample points within the reconstruction block corresponding to the template refer to one or more sample points located at the corners of the reconstruction block region. For example, it may refer to the sample points at the top-left and bottom-right corners of the reconstruction block region, or just the sample point at the bottom-right corner of the reconstruction block region.

[0648] In other words, in the embodiments of the present application, since the filter may use reconstruction sample points other than the reference template and reference block, it is necessary to perform padding on the boundary sample points. One example of boundary padding is shown in Figure 26, where the grid-like region is the region where padding is required.

[0649] In one embodiment, the padding method determines whether each sample point in the grid region is available or not. If available, the reconstructed pixel is used directly; if unavailable, the reconstructed pixel from the nearest reference template or reference block is copied to pad the grid region.

[0650] Here, the method for determining whether something is available includes, but is not limited to, the fulfillment of one or more of the following conditions simultaneously.

[0651] The sample point must be within the image boundary. The sample point must be within the tile boundary. The sample points must have been reconstructed.

[0652] In some embodiments, the padding method is determined based on the search range of the BV to determine whether the location of the padding region exceeds the search range of the BV. If it does not exceed the search range, the reconstruction sample points are used directly; if it exceeds the search range, the grid region is padded by copying the reconstruction sample points of an adjacent reference template or reference block. Specifically, it is determined whether boundary padding is necessary based on the iVerMin, iVerMax, iHorMin, and iHorMax derived in step s902.

[0653] leftPadding, rightPadding, topPadding, and bottomPadding indicate whether the left grid region, right grid region, upper grid region, and lower grid region copy the closest reconstructed sample point. That is, as follows:

[0654] leftPadding=!(pX_Best>iHorMin) rightPadding=!(pX_Best <iHorMax) topPadding=!(pY_Best>iVerMin) BottomPadding=!(pY_Best <iverMax) Here, if leftPadding is true, it indicates that the pixels in the left grid region are beyond the BV search range, and the reconstruction sample point from the nearest adjacent reference template is copied; otherwise, the reconstruction pixel at that position is used directly. If rightPadding is true, it indicates that the pixels in the right grid region are beyond the BV search range, and the reconstruction sample point from the nearest adjacent reference template or reference block is copied; otherwise, the reconstruction sample point at that position is used directly. If topPadding is true, it indicates that the pixels in the upper grid region are beyond the BV search range, and the reconstruction sample point from the nearest adjacent reference template is copied; otherwise, the reconstruction sample point at that position is used directly. If bottomPadding is true, it indicates that the pixels in the lower grid region are beyond the BV search range, and the reconstruction sample point from the nearest adjacent reference template or reference block is copied; otherwise, the reconstruction sample point at that position is used directly.

[0655] Furthermore, in the embodiments of the present application, the technical solution can be implemented in combination with various submodes in IBC, including but not limited to, conventional IBC merge, IBC™ merge, MBVD, IBC CIIP, IBC ABVP, etc.

[0656] In one possible embodiment, there is an IBC inversion mode, which requires a method for obtaining the predicted value after horizontally or vertically inverting the prediction region. For example, one syntax element indicates whether to invert or not, and if so, whether to horizontally or vertically invert. The decoding side obtains the predicted pixel value of the encoded block by reversing the order of the reference region pixels horizontally or vertically based on the instructions of the syntax.

[0657] In another possible embodiment, a template can be used to further establish a model between the current block and the predicted region, and the predicted value of the current block can be obtained after processing the predicted block based on the model. For example, the IBC LIC mode is applied to IBC merge and IBC ABVP and compensates for local illumination changes using a linear equation. Similar to the LIC for interpretation of VVCs, the parameters of the linear equation can be expressed in terms of a scaling parameter α and an offset parameter β, i.e., compensation for illumination changes is given by α × p[x] + β, where p[x] is a reference sample pointed to by the BV at position x in the current image. The linear model parameters are derived using the least squares method.

[0658] In yet another possible embodiment, based on the predicted values ​​obtained above, weighted predictions using other intra-prediction methods can be performed, and the results after weighted prediction can be used as the final prediction results.

[0659] Here, the weighted prediction method includes a method that weights and combines the results obtained by the above prediction process at each pixel position with the prediction results obtained by the normal intra-directional prediction mode, based on VVC's inter / intra composite prediction (CIIP). Furthermore, it also includes a method that, based on VVC's inter-geometric prediction mode (GPM), uses a single wedge division as a basis, uses results obtained by different prediction modes in different wedge regions, and performs weighted mixing according to a certain rule near the wedge division line.

[0660] An example of the operation process in IBC CIIP mode: The IBC prediction value of the current block and the prediction value of a certain intra-mode are weighted and merged, and the conventional merge, TM merge, MBVD, and ABVP modes can be applied to the IBC prediction portion.

[0661] If the IBC prediction portion is in the conventional IBC merge, TM merge, or MBVD mode, the weight ratio of IBC prediction to intra prediction is 13:3. The intra mode includes the TIMD mode of the current block and the intra prediction mode in the candidate BV. If the second prediction mode of the intra mode is the same as the first prediction mode, it is determined whether the first prediction mode is in PLANAR mode. If so, the second prediction mode is replaced with the horizontal prediction mode; otherwise, the second prediction mode is replaced with PLANAR mode.

[0662] If the IBC prediction portion is in ABVP mode, the weight ratio between IBC prediction and intra prediction is 1:1. The TIMD mode is obtained as the first prediction mode of the intra prediction mode. If the derived prediction mode is the horizontal prediction mode, PLANAR is obtained as the second prediction mode of the intra prediction mode; otherwise, the horizontal prediction mode is obtained as the second prediction mode of the intra prediction mode.

[0663] An example of the operation process in IBC GPM mode: Conventional merge and TM merge can be applied to the IBC prediction portion. Only a mode is created in which one partition is IBC and one partition is INTRA, and the intra prediction mode (IPM) candidate list is constructed using the same method as interGPM, with the size of the IPM candidate list defined as 3 in advance. In specific implementation, there are a total of 48 geometric partition modes, which can be divided into two geometric partition mode sets. Table 2 is the first geometric partition mode set, and Table 3 is the second geometric partition mode set.

[0664] When using IBC GPM, transmit the IBC GPM geometric partition mode set flag to indicate whether the first or second geometric partition mode set is selected, followed by the geometric partition mode index. Furthermore, transmit the IBC-GPM intra-partition flag to indicate whether intra-prediction is used for the first subpartition. Here, the intra-prediction portion must transmit the intra-prediction mode index, and the IBC prediction portion must transmit the MERGE index.

[0665] Furthermore, in the embodiments of the present invention, the associated mode selection flag (ibcFilterFlag) is transmitted at the CU layer, and the encoding scheme for the ibcFilterFlag can have multiple embodiments, one feasible scheme being to use equiprobability coding, another feasible scheme being to use context coding, which may use a default context initial state and context update rate, or may determine the context initial state and context update rate by statistics, but is not specifically limited thereto.

[0666] In the embodiment of the present invention, prediction accuracy can be improved by effectively modifying the predicted values ​​of the intrablock copy technology. Specifically, a linear filtering model is established between the optimal matching template obtained by the search and the current coded block template. Filter coefficients are calculated by minimizing the MSE between the predicted template (predicted template = filter coefficient × matching template) and the current coded block template. These filter coefficients sufficiently reflect the correlation between the matching template and the current coded block template. This correlation is applied to the optimal matching reconstructed block, and the reconstructed pixels are modified by filtering. By using the filtered reconstructed pixels as predicted pixels, prediction accuracy can be improved to some extent.

[0667] In another embodiment of the present application, based on the same inventive concept as the above embodiment, with reference to Figure 23, an exemplary structural diagram of the encoder configuration according to the embodiment of the present application is shown. As shown in Figure 23, the encoder 230 may include a first determination unit 2301, a first filtering unit 2302, and a first prediction unit 2303. The first decision unit 2301 is configured to determine the first template of the current block, determine the candidate list of block vectors for the current block, determine the first block vector based on the candidate list of block vectors, and determine the matching template and the corresponding reference block based on the first block vector. The first filtering unit 2302 is configured to determine model parameters based on the first template and the matching template, perform filtering on reference blocks based on the model parameters, and determine the filtered reference blocks. The first prediction unit 2303 is configured to determine the predicted value of the current block based on the filtered reference block.

[0668] In some embodiments, the first decision unit 2301 is further configured to determine the template type of the current block and, based on the template type of the current block, to determine the first template of the current block.

[0669] In some embodiments, the first decision unit 2301 is further configured to determine the template type of the current block based on the reference pixels of the current block, where the reference pixels of the current block include at least one of the adjacent reference pixels to the left of the current block, the adjacent reference pixels above the current block, and the adjacent reference pixels to the upper left of the current block.

[0670] In some embodiments, the first decision unit 2301 is further configured to encode the template type of the current block and write the resulting encoded bits to a bitstream if both the adjacent reference pixel to the left of the current block and the adjacent reference pixel to the top of the current block are available.

[0671] In some embodiments, the first decision unit 2301 is configured to further determine at least one first candidate block vector adjacent to the current block based on a spatial block vector candidate derivation method, add at least one first candidate block vector to the block vector candidate list, and if the number of candidates in the block vector candidate list satisfies a predetermined threshold, the current block vector candidate list becomes the block vector candidate list for the current block.

[0672] In some embodiments, the first decision unit 2301 is further configured to determine at least one second candidate block vector based on a history block vector candidate derivation method if the number of candidates in the block vector candidate list does not meet a predetermined threshold, and to subsequently add at least one second candidate block vector to the block vector candidate list, and if the number of candidates in the block vector candidate list meets a predetermined threshold, the current block vector candidate list becomes the block vector candidate list for the current block.

[0673] In some embodiments, the first decision unit 2301 is further configured to determine at least one third candidate block vector based on a method for deriving other available candidates if the number of candidates in the block vector candidate list does not meet a predetermined threshold, and to continue adding at least one third candidate block vector to the block vector candidate list until the number of candidates in the block vector candidate list meets a predetermined threshold.

[0674] In some embodiments, other available candidate derivation methods include at least one of the following: a pairwise mean candidate derivation method, a zero-value block vector candidate derivation method, and a candidate derivation method for candidates located in a reference region corresponding to an intrablock copy.

[0675] In some embodiments, the first decision unit 2301 is further configured to sort the list of block vector candidates after determining the list of block vector candidates for the current block.

[0676] In some embodiments, the first decision unit 2301 is further configured to determine a list of candidate block vectors for the current block and then remove redundancy based on the distances between candidate block vectors in the list of candidate block vectors.

[0677] In some embodiments, the first decision unit 2301 is further configured to delete at least one of at least two candidate block vectors when the current block has selected non-inverted intra-block copy mode and the distance between at least two candidate block vectors in the block vector candidate list satisfies a predetermined condition.

[0678] In some embodiments, the first decision unit 2301 is further configured to perform cost calculations for at least two candidate block vectors in the block vector candidate list, determine the cost value for each of the at least two candidate block vectors, determine a minimum cost value based on the cost values ​​for each of the at least two candidate block vectors, and set the candidate block vector corresponding to the minimum cost value as the first block vector.

[0679] In some embodiments, as shown in Figure 23, the encoder 230 may further include an encoding unit 2304. The first decision unit 2301 is further configured to determine the block vector index number corresponding to the first block vector based on the block vector candidate list. The encoding unit 2304 is configured to encode the block vector index number and write the resulting encoded bits to the bitstream.

[0680] In some embodiments, the first decision unit 2301 is further configured to determine a block vector index number corresponding to a first block vector based on a block vector candidate list, and to determine a block vector difference value based on the initial block vector of the current block and the first block vector.

[0681] The encoding unit 2304 is further configured to encode the block vector index number and the block vector difference value, and to write the resulting encoded bits to the bitstream.

[0682] In some embodiments, the first block vector is a luminance block vector, which is used to determine a predicted value based on the luminance component of the current block.

[0683] In some embodiments, the first decision unit 2301 is further configured to perform a scaling operation on the luminance block vector based on a predetermined chromaticity sampling format to determine a chromaticity block vector, which is used to determine a predicted value based on the chromaticity component of the current block.

[0684] In some embodiments, the first determination unit 2301 is further configured to perform a scaling process on the luminance block vector based on a predetermined chromaticity sampling format to determine the scaled block vector, perform a modification process on the scaled block vector to determine the chromaticity block vector, where the chromaticity block vector is used to determine a predicted value based on the chromaticity component of the current block.

[0685] In some embodiments, the first determination unit 2301 is further configured to determine a reference template and a corresponding reference block based on a first block vector, and, if the reference template satisfies a first predetermined condition, to perform a first process on the adjacent region of the reference template and determine a matching template.

[0686] In some embodiments, the first decision unit 2301 is further configured to determine a reference template and a corresponding reference block based on a first block vector, and to set the reference template as a matching template if the reference template satisfies a second predetermined condition.

[0687] In some embodiments, the matching template includes sample points within the reference template and sample points in adjacent regions of the reference template.

[0688] In some embodiments, the first decision unit 2301 is further configured to determine that the reference template satisfies a first predetermined condition when sample points other than the reference template and reference block are used.

[0689] In some embodiments, the first decision unit 2301 is further configured to determine that the reference template satisfies a second predetermined condition if no sample points other than the reference template and reference block are used.

[0690] In some embodiments, the first decision unit 2301 is further configured to perform padding on sample points in adjacent regions of the reference template when sample points other than the reference template and reference block are used.

[0691] In some embodiments, the first decision unit 2301 is further configured to determine whether sample points for adjacent regions of the reference template are available, and if sample points for adjacent regions of the reference template are available, it uses the sample points for adjacent regions of the reference template directly, and if sample points for adjacent regions of the reference template are unavailable, the padding unit is further configured to copy the reconstructed sample points in the adjacent reference template or adjacent reference block of the sample points and perform padding on the adjacent regions of the reference template to obtain sample points for adjacent regions of the reference template.

[0692] In some embodiments, the first decision unit 2301 is further configured to perform padding on adjacent regions of the reference template by directly copying reconstructed sample points in adjacent reference templates or adjacent reference blocks of sample points to obtain sample points in adjacent regions of the reference template.

[0693] In some embodiments, the first decision unit 2301 is further configured to skip sample points when determining model parameters, by not performing padding on sample points in adjacent regions of the reference template when sample points other than the reference template and reference block are used.

[0694] In some embodiments, sample points are available for adjacent regions of the reference template. The sample points must not exceed the specified search range. The sample points must not extend beyond the image boundary. The sample points must not extend beyond the tile boundary. This includes at least one of the following: the sample points have been reconstructed.

[0695] In some embodiments, the first decision unit 2301 is further configured to perform padding on the sample points of the adjacent region of the reference block when sample points of the adjacent region of the reference block are used.

[0696] In some embodiments, the model parameters include the coefficients of the target filter.

[0697] In some embodiments, the first decision unit 2301 is further configured to determine the coefficients of the target filter based on the pixel reference values ​​in the first template and the pixel reference values ​​in the matching template.

[0698] In some embodiments, the first decision unit 2301 is further configured such that the coefficients of the target filter are coefficients used by the target filter when the first error between the output value after the pixel reference value in the matching template has been processed by the target filter and the pixel reference value in the first template satisfies a first condition.

[0699] In some examples, the first condition is that the first error is the smallest.

[0700] In some embodiments, the first condition is that the first error is within a first predetermined threshold range.

[0701] In some embodiments, the first condition is that the change in the first error is within a second predetermined threshold range.

[0702] In some embodiments, the first decision unit 2301 is further configured to determine autocorrelation parameters based on pixel reference values ​​in the matching template, determine cross-correlation parameters based on the pixel reference values ​​in the first template and the pixel reference values ​​in the matching template, and determine the coefficients of the target filter based on the autocorrelation parameters and the cross-correlation parameters.

[0703] In some embodiments, the pixel reference value includes at least one of the pixel reconstruction value, pixel gradient value, and pixel position information.

[0704] In some embodiments, the number of coefficients in the target filter is equal to a first predetermined value.

[0705] In some embodiments, the first decision unit 2301 is further configured to determine the number of coefficients of the target filter. The encoding unit 2304 is further configured to encode the number of coefficients of the target filter and write the resulting encoded bits to the bitstream.

[0706] In some embodiments, the target filter is a one-dimensional or two-dimensional filter of a predetermined shape.

[0707] In some embodiments, the first decision unit 2301 is further configured to determine the shape of the target filter, and the encoding unit is further configured to encode the shape of the target filter and write the resulting encoded bits to a bitstream.

[0708] In some embodiments, the first filtering unit 2302 is further configured to perform a filtering process on reference blocks based on model parameters, determine a first output value of the target filter, and determine the filtered reference blocks based on the first output value of the target filter.

[0709] In some embodiments, the first filtering unit 2302 is further configured to calculate the product of the pixel reconstruction value of the reference block and the coefficients of the corresponding target filter, and to set the first output value of the target filter to be equal to the sum of n products, where n is the number of coefficients of the target filter and n is a positive integer.

[0710] In some embodiments, the first filtering unit 2302 is further configured to determine a first value in a first mapping relationship of the pixel reconstruction values ​​of a reference block, calculate the product of the first value and the coefficients of the corresponding target filter, and set the first output value of the target filter to be equal to the sum of n products, where n is the number of coefficients of the target filter and is a positive integer.

[0711] In some embodiments, the first filtering unit 2302 is further configured to determine a first offset value, perform an addition operation based on the first output value and the first offset value, and determine the filtered reference block.

[0712] In some embodiments, the first determination unit 2301 is further configured to set the first offset value equal to a second predetermined value.

[0713] In some embodiments, the first determination unit 2301 is further configured to determine the number of pixels involved in filtering corresponding to the target filter based on the shape of the target filter, to determine m+1 coefficients of the target filter if the number of pixels of the reference filter corresponding to the target filter is m (where m is a positive integer), and to determine a first offset value based on one of the m+1 coefficients and a second offset value.

[0714] In some embodiments, the first decision unit 2301 is further configured to set the second offset value to equal to a third predetermined value, or to set the second offset value to equal to the value in the second mapping relationship of the pixel reconstruction value of the reference block.

[0715] In some embodiments, the first prediction unit 2303 is further configured to perform a second process on the filtered reference blocks to obtain a predicted value for the current block.

[0716] In some embodiments, the second step is to set the predicted value of the current block to be equal to that of the filtered reference block.

[0717] In some embodiments, the second process is a clipping operation that restricts the filtered reference block to a predetermined numerical range.

[0718] In some embodiments, the first decision unit 2301 is further configured to determine multiple sets of model parameters based on a first template and a matching template, construct multiple filter models based on the multiple sets of model parameters, perform filtering on each of the reference blocks based on the multiple filter models, determine multiple filtered reference blocks, and determine the predicted value of the current block based on the multiple filtered reference blocks.

[0719] In some embodiments, the first prediction unit 2303 is further configured to perform weighting calculations on multiple filtered reference blocks to determine the predicted value for the current block.

[0720] In some embodiments, the first decision unit 2301 is further configured to determine a target filter from among multiple filter models. The first filtering unit 2302 is further configured to perform filtering on the reference block based on the target filter and to determine the predicted value of the current block.

[0721] In some embodiments, the first decision unit 2301 is further configured to determine a target model index value, where the target model index value is used to indicate the index number of the target filter in multiple filter models. The encoding unit 2304 is further configured to encode the target model index value and write the resulting encoded bits to the bitstream.

[0722] In some embodiments, the first decision unit 2301 is configured to further determine the original value of the current block, perform cost calculations based on the original value of the current block and a plurality of initial predicted values ​​of the current block, determine the cost value of each of the plurality of initial predicted values, determine the minimum cost value from among the cost values ​​of the plurality of initial predicted values, and set the filter model corresponding to the minimum cost value as the target filter.

[0723] In some embodiments, the first decision unit 2301 is further configured to classify the reconstructed pixels in the first template and the matching template according to a predetermined method, obtain multiple sets of subtemplates and multiple sets of submatching templates, and determine multiple sets of model parameters based on the multiple sets of subtemplates and multiple sets of submatching templates.

[0724] In some embodiments, the first decision unit 2301 is further configured to determine the value of a first syntactic element identifier, where the first syntactic element identifier is used to indicate whether the current block applies an intrablock copy. The encoding unit 2304 is further configured to encode the value of the first syntactic element identifier information and write the resulting encoded bits to the bitstream.

[0725] In some embodiments, the first decision unit 2301 is further configured to determine that the value of the first syntactic element identifier is the first value if the current block applies an intrablock copy, and to determine that the value of the first syntactic element identifier is the second value if the current block does not apply an intrablock copy.

[0726] In some embodiments, the first decision unit 2301 is further configured to determine the value of a second syntactic element identifier, where the second syntactic element identifier is used to indicate whether the current block applies a filter model. The encoding unit 2304 is further configured to encode the value of the second syntactic element identifier information and write the resulting encoded bits to the bitstream.

[0727] In some embodiments, the first decision unit 2301 is further configured to determine that the value of the second syntactic element identifier is the first value if the current block applies a filter model, and to determine that the value of the second syntactic element identifier is the second value if the current block does not apply a filter model.

[0728] In some embodiments, the first decision unit 2301 is further configured to perform the steps of: if the current block applies a filter model, performing a filtering process on the reference block based on the model parameters and determining the filtered reference block; and determining the predicted value of the current block based on the filtered reference block; and if the current block does not apply a filter model, the reconstructed pixel value in the reference block is set to the predicted value of the current block.

[0729] In some embodiments, the first decision unit 2301 is configured to further determine a plurality of reference blocks in the second search area and the model parameters of each of the plurality of reference blocks, to perform a filtering process on each of the plurality of reference blocks based on the model parameters of each of the plurality of reference blocks, to determine a plurality of filtered reference blocks, to perform cost calculations between the plurality of filtered reference blocks and the current block, to determine the cost value of each of the plurality of filtered reference blocks, to determine the minimum cost value from among the cost values ​​of each of the plurality of filtered reference blocks, and to determine the filtered reference blocks and the corresponding reference block index numbers based on the minimum cost value.

[0730] The encoding unit 2304 is further configured to encode the reference block index number and write the resulting encoded bits to the bitstream.

[0731] In some embodiments, the first decision unit 2301 is further configured to determine the original value of the current block and to determine the predicted residual of the current block based on the original value of the current block and the predicted value of the current block.

[0732] In this embodiment, the "unit" may be part of a circuit, part of a processor, part of a program or software, and of course, the "unit" may be a module or a non-modular structure. Furthermore, each component in this embodiment may be integrated into a single processing unit, each unit may be a separate, independent physical unit, or two or more units may be integrated into a single unit. The integrated unit described above may be implemented in hardware form or in the form of a software functional module.

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

[0734] Accordingly, the embodiments of the present application provide a computer-readable storage medium applicable to an encoder 230, the computer-readable storage medium storing a computer program, the computer program causing a first processor to execute the method in any of the above embodiments.

[0735] Referring to Figure 24, based on the configuration of the encoder 230 and the computer-readable storage medium, a schematic diagram of the specific hardware structure of the encoder 230 according to an embodiment of the present application is shown. As shown in Figure 24, the encoder 230 may comprise a first communication interface 2401, a first memory 2402, and a first processor 2403, each component being coupled to one another by a first bus system 2404. To make it clear, the first bus system 2404 is configured to enable connection communication between these components. In addition to the data bus, the first bus system 2404 also includes a power bus, a control bus, and a status signal bus. However, for clarity of explanation, in Figure 24, the various buses are denoted as the first bus system 2404.

[0736] The first communication interface 2401 is configured to send and receive signals in the process of sending and receiving information with other external network elements.

[0737] The first memory 2402 is configured to store computer programs that can be executed by the first processor 2403.

[0738] The first processor 2403 is configured to execute the following process by running the computer program, and the process is as follows: Currently, the first template for the block is determined, and the list of candidate block vectors for the block is determined. Based on the list of block vector candidates, the first block vector is determined, and based on the first block vector, the matching template and the corresponding reference block are determined. This includes determining model parameters based on a first template and a matching template, filtering reference blocks based on the model parameters, determining the filtered reference blocks, and determining the predicted value of the current block based on the filtered reference blocks.

[0739] It should be understood that the first memory 2402 in the embodiments of this application may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Here, non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may be random access memory (RAM) used as an external cache. To the extent that this is not an exhaustive description, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory...

Claims

1. A decoding method applied to a decoder, The first template of the current block is determined, and the list of candidate block vectors for the current block is determined, The bitstream is decoded to determine block vector instruction information, and a first block vector is determined based on the block vector instruction information and the block vector candidate list. Based on the first block vector, a matching template and a corresponding reference block are determined, Based on the first template and the matching template, model parameters are determined; based on the model parameters, a filtering process is performed on the reference blocks; and the filtered reference blocks are determined. A decoding method comprising determining a predicted value for the current block based on the filtered reference block.

2. Determining the candidate list of block vectors for the current block means that At least one candidate block vector determined based on the derivation method for spatial block vector candidates, At least one candidate block vector determined based on the derivation method for history block vector candidates, At least one candidate block vector determined based on the derivation method for pairwise mean candidates, This includes constructing a list of candidate block vectors for the current block based on at least one candidate block vector determined by at least one of the methods for deriving zero-value block vector candidates, The decoding method according to claim 1.

3. The block vector instruction information includes a block vector index number, Determining the first block vector based on the block vector instruction information and the block vector candidate list is: In the aforementioned list of candidate block vectors, determine the candidate block vector corresponding to the block vector index number, This includes setting the candidate block vector as the first block vector, The decoding method according to claim 1.

4. The block vector instruction information includes the block vector index number and the block vector difference value. Determining the first block vector based on the block vector instruction information and the block vector candidate list is: In the aforementioned list of candidate block vectors, determine the candidate block vector corresponding to the block vector index number, The process includes determining the first block vector based on the candidate block vector and the block vector difference value, The decoding method according to claim 1.

5. The first block vector is a luminance block vector, and the luminance block vector is used to determine a predicted value based on the luminance component of the current block. The decoding method according to claim 1.

6. The first block vector is a luminance block vector, and the decoding method is Based on a predetermined chromaticity sampling format, the luminance block vector is subjected to scaling to determine the scaled block vector, The process further includes performing a modification on the scaled block vector to determine a chromaticity block vector, wherein the chromaticity block vector is used to determine a predicted value based on the chromaticity component of the current block. The decoding method according to claim 1.

7. Determining the matching template and the corresponding reference block based on the first block vector is: Based on the first block vector, determine the reference template and the corresponding reference block, If the reference template satisfies a first predetermined condition, the process includes performing padding on a sample of an adjacent region of the reference template to determine the matching template, The decoding method according to claim 1.

8. Determining the matching template and the corresponding reference block based on the first block vector is: Based on the first block vector, determine the reference template and the corresponding reference block, If the aforementioned reference template satisfies the second predetermined condition, the aforementioned reference template is made the aforementioned matching template, including the following: The decoding method according to claim 1.

9. Performing padding on sample points in adjacent regions of the aforementioned reference template is: To determine whether sample points are available in the adjacent region of the aforementioned reference template, If sample points for adjacent regions of the aforementioned reference template are available, use the sample points for adjacent regions of the aforementioned reference template directly. If sample points in the adjacent region of the reference template are unavailable, the process includes performing padding on the adjacent region of the reference template by copying reconstructed sample points in the adjacent reference template or adjacent reference block of the sample points to obtain sample points in the adjacent region of the reference template. The decoding method according to claim 7.

10. The availability of sample points in the adjacent region of the aforementioned reference template means that The aforementioned sample points do not exceed a predetermined search range. The aforementioned sample points do not extend beyond the image boundary. The aforementioned sample point does not extend beyond the tile boundary. The at least one of the following is that the sample points have been reconstructed: The decoding method according to claim 9.

11. Performing a filtering process on the reference blocks based on the aforementioned model parameters and determining the filtered reference blocks is: When using sample points in the adjacent region of the reference block, the process includes performing padding on the sample points in the adjacent region of the reference block. The decoding method according to claim 7.

12. The model parameters include the coefficients of the target filter, and the model parameters are determined based on the first template and the matching template. The further includes determining the coefficients of the target filter based on the pixel reference values ​​in the first template and the pixel reference values ​​in the matching template, The decoding method according to claim 1.

13. The aforementioned decoding method is Decode the bitstream and determine the value of the first syntactic element identifier, If the first syntactic element identifier indicates that the current block applies an intra-block copy, the bitstream is decoded and the value of the second syntactic element identifier is determined. If the second syntactic element identifier indicates that the current block applies a filter model, the process further includes: performing a filtering process on the reference block based on the model parameters to determine the filtered reference block; and determining the predicted value of the current block based on the filtered reference block. The decoding method according to claim 1.

14. An encoding method applied to an encoder, The first template of the current block is determined, and the list of candidate block vectors for the current block is determined, Based on the aforementioned list of candidate block vectors, the first block vector is determined, Based on the first block vector, a matching template and a corresponding reference block are determined, Based on the first template and the matching template, model parameters are determined; based on the model parameters, a filtering process is performed on the reference blocks; and the filtered reference blocks are determined. An encoding method comprising determining a predicted value for the current block based on the filtered reference block.

15. The aforementioned encoding method is Based on the aforementioned list of candidate block vectors, the block vector index number corresponding to the first block vector is determined, The process further includes encoding the block vector index number and writing the resulting encoded bits to a bitstream. The encoding method according to claim 14.

16. The aforementioned encoding method is Based on the aforementioned list of candidate block vectors, the block vector index number corresponding to the first block vector is determined, Based on the initial block vector of the current block and the first block vector, the block vector difference value is determined, The process further includes encoding the block vector index number and the block vector difference value, and writing the resulting encoded bits to a bitstream. The encoding method according to claim 14.

17. Determining the matching template and the corresponding reference block based on the first block vector is: Based on the first block vector, determine the reference template and the corresponding reference block, If the reference template satisfies a first predetermined condition, the process includes performing padding on a sample of an adjacent region of the reference template to determine the matching template, The encoding method according to claim 14.

18. Performing a filtering process on the reference blocks based on the aforementioned model parameters and determining the filtered reference blocks is: When using sample points in the adjacent region of the reference block, the process includes performing padding on the sample points in the adjacent region of the reference block. The encoding method according to claim 17.

19. The model parameters include the coefficients of the target filter, and the model parameters are determined based on the first template and the matching template. The further includes determining the coefficients of the target filter based on the pixel reference values ​​in the first template and the pixel reference values ​​in the matching template, The encoding method according to claim 14.

20. A non-temporary computer-readable storage medium storing a computer program and a bitstream, wherein the computer program, when executed by a processor, causes the processor to perform an operation to generate the bitstream, The first template of the current block is determined, and the list of candidate block vectors for the current block is determined, The first block vector is determined based on the aforementioned list of block vector candidates, Based on the first block vector, a matching template and a corresponding reference block are determined, Based on the first template and the matching template, model parameters are determined; based on the model parameters, a filtering process is performed on the reference blocks; and the filtered reference blocks are determined. A non-temporary computer-readable storage medium, comprising determining a predicted value for the current block based on the filtered reference block.