Decoding method, encoding method, code stream, decoder, encoder, and storage medium

AU2023478750A1Pending Publication Date: 2026-08-06GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
AU · AU
Patent Type
Applications
Current Assignee / Owner
GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
Filing Date
2023-12-28
Publication Date
2026-08-06

AI Technical Summary

Technical Problem

In the prior art, the candidate block vector diversity of intra template matching prediction (IntraTMP) is low, affecting the encoding and decoding efficiency.

Method used

By constructing a block vector candidate list based on template matching technology and merging candidate technology, including the construction of relocating the block vector on the first block vector candidate list, and forming a second block vector candidate list to improve the diversity of the candidate block vector.

Benefits of technology

It improves the accuracy of motion estimation and encoding and decoding efficiency, reduces the transmission of redundant information, and enhances the performance of video decoding.

✦ 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 provide a decoding method, an encoding method, a code stream, a decoder, an encoder, and a storage medium. The decoding method comprises: at a decoding end, parsing a code stream to determine first syntax element information; when the first syntax element information indicates that a current block uses a prediction mode of intra template matching, determining a first block vector candidate list of the current block, wherein the first block vector candidate list is determined on the basis of a first candidate list constructed on the basis of template matching technology and / or a second candidate list constructed on the basis of merging candidate technology; determining a second block vector candidate list on the basis of the first block vector candidate list, wherein the second block vector candidate list comprises a relocation block vector constructed from a first candidate block vector in the first block vector candidate list; and determining a predicted value of the current block on the basis of the second block vector candidate list. In this way, the present application can improve the diversity of candidate block vectors, thereby improving the encoding and decoding efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

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

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

[0002] In the related art, Intra Template Matching Prediction (IntraTMP) can perform predictions through a template matching process within a predefined search area, where the search area can be related to factors such as the position and size of the current block. IntraTMP, combined with the merged candidate technology, proposes constructing a Merge list as candidate blocks in the search process. This utilizes motion information from adjacent coding blocks, effectively improving the effectiveness of the IntraTMP search and increasing coding efficiency.

[0003] However, the candidate block vectors in the above-mentioned IntraTMP technology are selected as candidate block vectors based on template matching or a merge list, which results in low diversity of the candidate block vectors, thereby affecting encoding and decoding efficiency.

[0004] Summary of the Invention

[0005] The embodiments of the present application provide a coding and decoding method, a code stream, a decoder, an encoder, and a storage medium, which can increase the diversity of candidate block vectors, thereby improving coding and decoding efficiency.

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

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

[0008] Parsing the code stream to determine the first syntax element information;

[0009] When the first syntax element information indicates that the current block adopts the intra template matching prediction mode, determining a first block vector candidate list for the current block; wherein the first block vector candidate list is determined according to the first candidate list constructed based on the template matching technology and / or the second candidate list constructed based on the merge candidate technology;

[0010] Determine a second block vector candidate list based on the first block vector candidate list; wherein the second block vector candidate list includes relocated block vectors constructed from the first candidate block vector in the first block vector candidate list;

[0011] Based on the second block vector candidate list, a prediction value of the current block is determined.

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

[0013] Determining a prediction mode adopted by a current block, and determining first syntax element information according to the prediction mode adopted by the current block; wherein the first syntax element information is used to indicate whether the current block adopts an intra template matching prediction mode;

[0014] When the prediction mode of the current block is an intra template matching prediction mode, determining a first block vector candidate list for the current block; wherein the first block vector candidate list is determined according to a first candidate list constructed based on a template matching technique and / or a second candidate list constructed based on a merge candidate technique;

[0015] Determine a second block vector candidate list based on the first block vector candidate list; wherein the second block vector candidate list includes relocated block vectors constructed from the first candidate block vector in the first block vector candidate list;

[0016] Based on the second block vector candidate list, a prediction value of the current block is determined.

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

[0018] First syntax element information, second syntax element information, a first maximum list length, and a prediction difference value; the first syntax element information is used to indicate whether the current block adopts a prediction mode based on intra template matching; the second syntax element information is used to indicate a prediction mode based on intra template matching adopted by the current block.

[0019] In a fourth aspect, an embodiment of the present application provides a decoder, comprising a decoding part and a first determining part, wherein:

[0020] The decoding part is configured to parse the code stream and determine the first syntax element information;

[0021] The first determining portion is configured to, when the first syntax element information indicates that the current block adopts the intra template matching prediction mode, determine a first block vector candidate list for the current block; wherein the first block vector candidate list is determined based on the first candidate list constructed based on the template matching technology and / or the second candidate list constructed based on the merge candidate technology;

[0022] Determine a second block vector candidate list based on the first block vector candidate list; wherein the second block vector candidate list includes relocated block vectors constructed from the first candidate block vector in the first block vector candidate list;

[0023] Based on the second block vector candidate list, a prediction value of the current block is determined.

[0024] In a fifth aspect, an embodiment of the present application provides an encoder, comprising a second determining part, wherein:

[0025] The second determining part is configured to determine a prediction mode adopted by the current block, and determine first syntax element information according to the prediction mode adopted by the current block; wherein the first syntax element information is used to indicate whether the current block adopts the prediction mode of intra template matching;

[0026] When the prediction mode of the current block is an intra template matching prediction mode, determining a first block vector candidate list for the current block; wherein the first block vector candidate list is determined according to a first candidate list constructed based on a template matching technique and / or a second candidate list constructed based on a merge candidate technique;

[0027] Determine a second block vector candidate list based on the first block vector candidate list; wherein the second block vector candidate list includes relocated block vectors constructed from the first candidate block vector in the first block vector candidate list;

[0028] Based on the second block vector candidate list, a prediction value of the current block is determined.

[0029] In a sixth aspect, an embodiment of the present application provides a decoder, comprising a first memory and a first processor, wherein:

[0030] The first memory is configured to store a computer program that can be executed on the first processor;

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

[0032] In a seventh aspect, an embodiment of the present application provides an encoder, comprising a second memory and a second processor, wherein:

[0033] The second memory is configured to store a computer program that can be executed on the second processor;

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

[0035] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed, it implements the method described in the first aspect or the second aspect.

[0036] The embodiments of the present application provide a coding and decoding method, a bitstream, a decoder, an encoder, and a storage medium. At the decoding end, the bitstream is parsed to determine first syntax element information; when the first syntax element information indicates that the current block adopts an intra-frame template matching prediction mode, a first block vector candidate list for the current block is determined; wherein the first block vector candidate list is determined based on a first candidate list constructed based on a template matching technique and / or a second candidate list constructed based on a merge candidate technique; based on the first block vector candidate list, a second block vector candidate list is determined; wherein the second block vector candidate list includes a relocated block vector constructed for the first candidate block vector in the first block vector candidate list; and based on the second block vector candidate list, a prediction value for the current block is determined. On the one hand, by constructing relocated block vectors for the first candidate block vectors in the first block vector candidate list to determine the second block vector candidate list, further refinement or adjustment of the first candidate block vector in the first block vector candidate list is achieved, thereby increasing the diversity of the candidate block vectors, more accurately describing motion information, and improving the accuracy of motion estimation. On the other hand, determining the first block vector candidate list based on the first candidate list constructed based on the template matching technology and / or the second candidate list constructed based on the merged candidate technology improves the diversity of the candidate list, is beneficial to the subsequent expansion of candidate block vectors, and makes it possible to more effectively select suitable block vectors during the decoding process, thereby improving the diversity of candidate block vectors, reducing the transmission of redundant information, and thus improving the decoding efficiency.

[0037] Similarly, at the encoding end, the prediction mode used by the current block is determined, and first syntax element information is determined based on the prediction mode used by the current block; wherein the first syntax element information is used to indicate whether the current block uses an intra-frame template matching prediction mode; when the prediction mode of the current block is an intra-frame template matching prediction mode, a first block vector candidate list for the current block is determined; wherein the first block vector candidate list is determined based on a first candidate list constructed based on a template matching technique and / or a second candidate list constructed based on a merge candidate technique; based on the first block vector candidate list, a second block vector candidate list is determined; wherein the second block vector candidate list includes a relocated block vector constructed for the first candidate block vector in the first block vector candidate list; and based on the second block vector candidate list, a prediction value for the current block is determined. On the one hand, by constructing relocated block vectors for the first candidate block vectors in the first block vector candidate list to determine the second block vector candidate list, further refinement or adjustment of the first candidate block vectors in the first block vector candidate list is achieved, thereby increasing the diversity of the candidate block vectors, more accurately describing motion information, and improving the accuracy of motion estimation. On the other hand, the first block vector candidate list is determined based on the first candidate list constructed based on the template matching technology and / or the second candidate list constructed based on the merged candidate technology, which improves the diversity of the candidate list and is conducive to the subsequent expansion of candidate block vectors, so that suitable block vectors can be selected more effectively during the encoding process, thereby improving the diversity of candidate block vectors and reducing the transmission of redundant information, thereby improving the efficiency of encoding. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] FIG1 is a flowchart of an optional hybrid coding framework provided in an embodiment of the present application;

[0039] FIG2 is a first schematic diagram of template matching of an optional IntraTMP technology provided in an embodiment of the present application;

[0040] FIG3 is a schematic diagram of an optional method for determining a matching block of a current block according to an embodiment of the present application;

[0041] FIG4 a is a schematic diagram of a template type 1 of an optional Intra TMP technology provided in an embodiment of the present application;

[0042] FIG4 b is a second schematic diagram of a template type of an optional Intra TMP technology provided in an embodiment of the present application;

[0043] FIG4 c is a schematic diagram of a third template type of an optional Intra TMP technology provided in an embodiment of the present application;

[0044] FIG4 d is a fourth schematic diagram of a template type of an optional Intra TMP technology provided in an embodiment of the present application;

[0045] FIG4e is a schematic diagram of a fifth template type of an optional Intra TMP technology provided in an embodiment of the present application;

[0046] FIG4 f is a sixth schematic diagram of a template type of an optional Intra TMP technology provided in an embodiment of the present application;

[0047] FIG5 a is a second schematic diagram of template matching of an optional IntraTMP technology provided in an embodiment of the present application;

[0048] FIG5 b is a third schematic diagram of template matching of an optional IntraTMP technology provided in an embodiment of the present application;

[0049] FIG6 is a schematic diagram of positions of an optional adjacent candidate and non-adjacent candidate of a current block provided by an embodiment of the present application;

[0050] FIG7 is a first schematic diagram of an optional automatic relocation block vector provided in an embodiment of the present application;

[0051] FIG8 is a second schematic diagram of an optional automatic relocation block vector provided in an embodiment of the present application;

[0052] FIG9 is a schematic diagram of an optional IntraTMP combined fusion prediction provided in an embodiment of the present application;

[0053] FIG10 is a schematic diagram of the structure of an optional filter provided in an embodiment of the present application;

[0054] FIG11 is a schematic diagram of an optional structure for determining filter coefficients provided in an embodiment of the present application;

[0055] FIG12 is a block diagram of an optional encoder according to an embodiment of the present application;

[0056] FIG13 is a block diagram of an optional decoder according to an embodiment of the present application;

[0057] FIG14 is a schematic diagram of a network architecture of an optional encoding and decoding system provided in an embodiment of the present application;

[0058] FIG15 is a schematic diagram of a flow chart of an optional decoding method provided in an embodiment of the present application;

[0059] FIG16 is a schematic diagram of a flow chart of an optional encoding method provided in an embodiment of the present application;

[0060] FIG17 is a schematic diagram of the composition structure of an optional decoder provided in an embodiment of the present application;

[0061] FIG18 is a schematic diagram of a specific hardware structure of an optional decoder provided in an embodiment of the present application;

[0062] FIG19 is a schematic diagram of the composition structure of an optional encoder provided in an embodiment of the present application;

[0063] FIG20 is a schematic diagram of a specific hardware structure of an optional encoder provided in an embodiment of the present application;

[0064] FIG21 is a schematic diagram of the composition structure of an optional encoding and decoding system provided in an embodiment of the present application. DETAILED DESCRIPTION

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

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

[0067] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0068] It should also be pointed out that the terms "first\second\third" involved in the embodiments of the present application are only used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.

[0069] Currently, common video codec standards all adopt a block-based hybrid coding framework. Each image, sub-image, or frame in a video is divided into square maximum coding units (LCUs) or coding tree units (CTUs) of the same size (e.g., 256×256, 128×128, 64×64, etc.). Each LCU or CTU can be divided into rectangular CUs according to a rule. Coding units may also be divided into prediction units (PUs), transform units (TUs), etc. Specifically, as shown in Figure 1, the hybrid coding framework includes a prediction module 11, a transform and quantization module 12, an entropy coding module 13, an inverse quantization and inverse transform module 14, a loop filter module 15, and a decoded picture buffer module 16. The prediction module 11 may include an intra-frame prediction module 11a and an inter-frame prediction module 11b. The inter-frame prediction module 11b may include a motion estimation module and a motion compensation module. Because there is a strong correlation between adjacent pixels in a video image, intra-frame prediction is used in video codec technology to eliminate spatial redundancy between adjacent pixels. In addition, since there is a strong similarity between adjacent images in a video, the inter-image prediction method is used in video coding and decoding technology to eliminate the temporal redundancy between adjacent images, thereby improving coding efficiency.

[0070] The basic process of a video codec is as follows: On the encoder side, an image is divided into blocks. Intra-frame prediction or inter-frame prediction is used on the current block to generate a prediction block for the current block. The prediction block is subtracted from the original block to obtain a residual block. The residual block is transformed and quantized to obtain a quantization coefficient matrix. This quantization coefficient matrix is ​​entropy-encoded and output to the bitstream. On the decoder side, intra-frame prediction or inter-frame prediction is used on the current block to generate a prediction block for the current block. The bitstream is then parsed to obtain a quantization coefficient matrix. This quantization coefficient matrix is ​​inversely quantized and inversely transformed to obtain a residual block. The prediction block and residual block are added together to obtain a reconstructed block. The reconstructed blocks form a reconstructed image, which is then subjected to image-based or block-based loop filtering to obtain a decoded image. The encoder side also performs similar operations as the decoder side to obtain a decoded image. The decoded image can serve as a reference image for inter-frame prediction of subsequent images. Block division information, prediction, transform, quantization, entropy coding, loop filtering, and other mode or parameter information determined by the encoder are output to the bitstream if necessary. The decoding end determines the same block division information as the encoding end by parsing the bit stream and analyzing the existing information, as well as the mode information or parameter information such as prediction, transformation, quantization, entropy coding, and loop filtering, thereby ensuring that the decoded image obtained by the encoding end is the same as the decoded image obtained by the decoding end. The decoded image obtained by the encoding end is also usually called a reconstructed image. The current block can be divided into prediction units during prediction, and the current block can be divided into transformation units during transformation. The division of prediction units and transformation units can be different. The above is the basic process of the video codec under the block-based hybrid coding framework. With the development of technology, some modules or steps of the framework or process may be optimized. The embodiment of the present application is applicable to the basic process of the video codec under the block-based hybrid coding framework, but is not limited to the framework and process.

[0071] In addition, in the embodiments of the present application, the current block (CB) can be the current coding unit, the current prediction unit, or the current transform unit. Due to the need for parallel processing, the image can be divided into slices, etc. Slices in the same image can be processed in parallel, that is, there is no data dependency between them. "Frame" is a commonly used term, and it can generally be understood that a frame is an image. The frame described in the embodiments of the present application can also be replaced by an image or a slice, etc.

[0072] Digital video compression technology primarily compresses large amounts of digital video data for easier transmission and storage. In other words, digital video compression reduces the amount of video data to save storage space and transmission bandwidth. Video data typically takes up a large amount of space, and compression technology can effectively reduce file size while maintaining imperceptible quality loss to the human eye. With the surge in internet video and the increasing demand for higher video clarity, while existing digital video compression standards can save significant video data, there is still a need for better digital video compression technologies to reduce the bandwidth and traffic pressure of digital video transmission.

[0073] Video compression typically relies on specific coding standards. Common video coding standards include H.264 / AVC, H.265 / HEVC, VP9, ​​and AV1. These standards define video compression algorithms and specifications to ensure compatibility across different devices. Video compression technologies are primarily categorized as intra-frame compression and inter-frame compression. Intra-frame compression relies on encoding individual video frames, while inter-frame compression exploits similarities between frames. Motion compensation is a key technique in inter-frame compression. By detecting motion between adjacent frames and predicting pixel positions based on this motion information, data size can be reduced while maintaining video quality. Quantization is the process of mapping pixel values ​​in an image or video to a smaller set, thereby reducing the range of data representation. Entropy coding further reduces data size by utilizing statistical information in the data to optimize the encoding process. Adjacent pixels in a video often exhibit spatial and temporal correlations. Compression algorithms exploit these correlations to reduce data redundancy through prediction and differential coding. Compression technologies typically allow users to choose different resolutions and bit rates while maintaining acceptable quality. This allows for better adaptation to diverse storage and transmission requirements. Certain applications, such as video conferencing and real-time surveillance, require high real-time video transmission. Consequently, some compression standards and technologies focus on providing low-latency solutions. Overall, digital video compression technology has been widely used in the multimedia field, impacting not only the efficiency of video storage and transmission but also the user experience of video applications.

[0074] Video compression includes multiple modules, including intra-frame prediction (spatial domain) and inter-frame prediction (temporal domain) to reduce or remove inherent redundancy in video, quantization and inverse quantization of residual information, and loop filtering and entropy coding to improve subjective and objective reconstruction quality. Most mainstream video compression standards describe block-based compression techniques. A video clip, a frame, or a series of pictures is divided into basic units called CTUs, which are further divided into blocks called CUs. Intra-frame blocks are predicted using neighboring pixels as reference, while inter-frame blocks refer to spatially adjacent blocks and reference information from other frames. In contrast to the prediction signal, the residual information is transformed, quantized, and entropy-coded into a bitstream on a block-by-block basis. These techniques are described in standards and implemented in various areas related to video compression. Internationally, the current mainstream standards include H.264 / Advanced Video Coding (AVC), H.265 / High Efficiency Video Coding (HEVC) standard, H.266 / Versatile Video Coding (VVC) and extensions of these standards. Video devices can achieve more efficient video encoding and decoding and transmission and storage by implementing these technologies.

[0075] In some embodiments, digital video is a video recorded in digital form, which is composed of a series of digital images, each image is composed of several rows and columns of pixels, and each pixel is represented by a digital value. In order to express the colors observed by the human eye, people have defined a series of different color models from a mathematical model, including RGB, YUV, etc. In order to project these color models into corresponding mathematical expressions, different color spaces are generated according to different processing methods and storage formats of different color data. Color space is a specific form of color organization, which defines a way to represent and organize color information. Different color spaces use different coordinate systems or parameters to describe colors, which makes it easy to represent, edit, analyze and process colors.

[0076] 1) IntraTMP technology

[0077] Intra TMP technology, abbreviated as IntraTMP, is a specialized intra-frame prediction technology. It is a specialized intra-frame prediction coding tool primarily used for screen content encoding. IntraTMP is implemented through the following process: Reconstructed pixels adjacent to the current coding block are selected as a template. The most similar template is searched for within the reconstructed region of the given current frame. The reconstructed block corresponding to the most similar template is then used as a matching block, which is then used as the prediction block for the current coding block. The template for the coding block is typically selected from the reconstructed region adjacent to the current coding block.

[0078] For example, taking the adjacent reconstructed area of ​​the current block as an example, as shown in Figure 2, the area filled with a grid represents the reconstructed area. In the reconstructed area, R1, R2, R3, and R4 are search areas. R1 to R4 search for matching blocks in sequence. The adjacent area of ​​the current block is the first template (T); and the adjacent area of ​​the matching block (also called the "reference block") is the second template (i.e., the "reference block template" or "matching template", T_BEST). As shown in Figure 3, both the encoder and the decoder search the predefined search range in the current image using the template (T) of the coding block to determine the matching template (T_BEST) with the smallest template error value, and then use the reconstructed block (Ref Block) corresponding to the matching template as the prediction block for the current coding block (Cur Block). The degree of similarity between templates is represented by the size of the template error value. The smaller the template error value, the higher the degree of similarity. In an embodiment of the present application, the template error value can be the absolute error sum SAD, the absolute transformation difference sum SATD, the mean square error MSE, the error square sum SSD, the mean absolute difference MAD, the mean error square sum MSD, the normalized correlation coefficient NCC, etc., which is not specifically limited here.

[0079] For example, taking absolute error and SAD as an example, the template error value at this time is as follows:

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

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

[0082] It should also be noted that refTemplateType can be used to represent a template type. Figures 4a, 4b, 4c, 4d, 4e, and 4f illustrate template types for the Intra TMP technique. As shown in Figures 4a, 4b, 4c, 4d, 4e, and 4f, the block filled with a grid is the current block, and the adjacent area of ​​the current block is the template T. Six template types are shown.

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

[0084] When the upper left reference pixel, the upper reference pixel, and the left reference pixel are all available, the value of refTemplateType is 1, and the template shape is as shown in 4a;

[0085] When only the left reference pixel is available, the value of refTemplateType is 2, and the template shape is shown in Figure 4b;

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

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

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

[0089] When only the upper reference pixel and the upper right reference pixel are available, the value of refTemplateType is 6 and the template shape is shown in FIG4f .

[0090] In intra TMP technology, the codec uses the flag intra_tmp_flag to indicate whether the current coded block is encoded using the intraTMP mode. If so, the decoder performs the same template matching process to obtain the same predicted block, eliminating the need for additional encoding of the block vector information from the current coded block to the matching block. The following example illustrates intra TMP technology.

[0091] 2) IntraTMP adaptation technology for camera-captured content

[0092] The IntraTMP adaptation for camera-captured content technology builds on the existing IntraTMP technology by performing template matching with a step size S (i.e., every S points horizontally and vertically, where S>1) (as shown in Figure 5a). For example, rather than searching for matching blocks point by point using a raster scan, the search area is searched at alternate points horizontally and vertically. For example, if the current template matching block vector is (X0, Y0), the next template matching block vector should be (X0+S, Y0), and the vertical coordinate of the next template matching block vector should be Y0+S. After template matching is complete, the best matching block is refined within a certain range (as shown in Figure 5b, where template matching is performed with a smaller step size S') to optimize the matching result. This technology effectively reduces the complexity of the IntraTMP mode while maintaining good coding efficiency.

[0093] 3) IntraTMP multi-candidate technology

[0094] IntraTMP multi-candidate technology uses a template matching process to obtain N candidate matching blocks within the reference area, or to construct a candidate block list of length N. The candidate matching blocks in the list can be sorted by the template error value between them and the current block. A candidate block in the list is selected as the final prediction block by index. For a coded block using IntraTMP multi-candidate technology, after decoding the IntraTMP flag intra_tmp_flag as true, it continues to decode intra_tmp_idx. The intra_tmp_idx syntax element can represent the index of the selected candidate block.

[0095] Exemplarily, a template matching process for constructing a candidate block list is as follows:

[0096] The first step is to perform the first search with a certain step size, for example, both the horizontal step size and the vertical step size are 4. N optimal matching blocks with a certain spacing are obtained (the first N with the smallest template error value);

[0097] In the second step, a second search is performed in the N neighboring areas of the matching blocks obtained in the first step. These neighboring areas can be set to multiple non-overlapping areas based on the step size in the first step. M optimal matching blocks are obtained from these areas (which may include the matching blocks obtained in the first step).

[0098] The same construction process is used at the encoding and decoding ends to obtain a consistent list of candidate blocks.

[0099] Intra_tmp_idx may use fixed-length encoding or variable-length encoding, for example, truncated binary encoding.

[0100] A variable length encoding method is:

[0101] The smaller the index (the smaller the intra_tmp_idx value), the smaller the template error value of the corresponding candidate block, and the greater the probability of being selected statistically. A shorter codeword can be set for a smaller intra_tmp_idx. For example, as shown in Table 1:

[0102] Table 1

[0103] If the maximum value N of intra_tmp_idx is large, a codeword of the same length can be allocated to the larger intra_tmp_idx. For example, N is 15. As shown in Table 2:

[0104] Table 2

[0105] In Table 2 above, x can be obtained using truncated binary.

[0106] 4) Combine the candidate IntraTMP

[0107] The IntraTMP (IntraTMP with Merge Candidates) technology proposes that the IntraTMP search process or candidate block vector list can be expanded based on the block vectors of the adjacent blocks of the current coding block. For example, a merge list is constructed for the current coding block with reference to the merge list construction method of IBC, and the list contains motion information such as the block vectors of the adjacent blocks. When performing an IntraTMP search (intra-frame template matching), a first-round candidate block vector list is first obtained by searching with a certain step size, which can be composed of the top N block vectors with the smallest template error values ​​in this round of search. The candidate block vector list and the merge list are merged to obtain a larger candidate block vector list. A second round of IntraTMP search can be performed based on the new list (for example, template matching is performed in the adjacent area of ​​the candidate block vector) to obtain a final IntraTMP candidate block vector list consisting of the top M block vectors with the smallest template error values ​​in the entire search process.

[0108] In addition, an index can be used to identify candidate block vectors obtained by different processes (for example, obtained from different search areas, obtained from a merge list). Block vectors with different identifiers can have adjacent areas of different sizes in the second round of search.

[0109] 5) Intra-frame block copy technology.

[0110] Intra Block Copy (IBC) is an intra-frame prediction technique that uses block matching to obtain predicted pixels. Similar to inter-frame prediction, prediction is achieved by using a block vector pointing from the current block to a reference block. The difference is that the reference block for inter-frame prediction comes from the encoded reconstructed frame, while the reference block for IBC comes from the reconstructed portion of the current frame. Block vector information needs to be transmitted in the codestream, so similar to intra-frame prediction, there are IBC-AMVP mode and IBC-Merge mode.

[0111] IBC-AMVP mode: The predicted block vector is obtained by constructing a merge candidate list, and the reference block and the corresponding final block vector of the current block are obtained through hash search, full search, etc. The final block vector is encoded according to the predicted block vector to improve coding efficiency;

[0112] IBC-Merge mode: Prediction is performed using a constructed list of merge candidates. The best merge candidate in the list is selected through coding processes such as SATD and RDO. The block vector of the merge candidate is inherited to obtain the reference block for prediction. The index of the merge candidate in the list is encoded instead of the block vector itself, improving coding efficiency.

[0113] The merge candidate list can be composed of coding information such as adjacent and non-adjacent coded blocks, historical coded blocks, temporal coded blocks, and the average of candidate block vectors. After constructing the merge candidate list, the list can be reordered based on the template error value of each candidate in the list. The template error value can be obtained by the template error value between each candidate's reference block template and the current block template, such as the SAD value.

[0114] The merge candidate may include information such as the LIC flag. If the LIC flag of a candidate is true, the IBC-LIC technology is used for prediction when the current block selects the candidate.

[0115] Building on the IBC-Merge mode, there's the IBC-MBVD mode. For the merged BV candidates, the block vector difference (BVD) can be determined based on the offset and direction to modify the original BV. For example, if the direction is up, the offset is k, and the original BV is BV0 = (x0, y0), then the new BV0' after BVD can be expressed as: BV0' = (x0, y0 - k).

[0116] 6) Non-adjacent candidates for Inter-Merge.

[0117] When constructing the merge list for inter-frame coding blocks in Merge mode, non-adjacent candidates can be added. Based on the size of the current block, non-adjacent points are selected and attempted to be merged candidates. The positions of non-adjacent points and the current block are shown in Figure 6. In Figure 6, the point-filled block is the current block. Points 1-5 in Figure 6 are called adjacent candidates, and the rest are called non-adjacent candidates.

[0118] 7) Block vector prediction for automatic relocation

[0119] The Auto-Relocated Block Vector Prediction (AR-BVP) technique proposes a method to construct a new block vector by using the block vector of the reference block. As shown in Figure 7, a guiding block vector (BV) is determined for the current coding block B0. 0,1 And determine the reference block B1 based on the block vector. If there is a block vector BV in the area of ​​the reference block B1 1,2 (The motion vector corresponding to the block with the greatest similarity in the area around B1, or the motion vector corresponding to the block with the best template match), then a new block vector BV can be constructed 0,2 =BV 0,1 +BV 1,2, as the candidate block vector of the current coding block. Recursively (cutoff conditions: reaching a certain recursion depth, the block error corresponding to the constructed new block vector is less than the threshold, exceeding the preset area, meeting the maximum recursion time, etc., which can be expanded in the specification), according to BV 0,n The reference block B can be determined n , if in B n There is a block vector BV in the region n,n+1 , then a new block vector BV can be constructed 0,n+1 =BV 0,1 +BV 1,2 +…+BV n,n+1 .

[0120] Among them, when determining the reference block B n The corresponding block vector BV n,n+1 For example, as shown in Figure 8, the reference block center (CTR), upper left (LT), upper right (RT), lower left (LB) and lower right (RB) are checked in turn to see if there is a coding block predicted by IBC or IntraTMP mode. If so, the saved block vector is used as the block vector BV. n,n+1 .

[0121] 8) IntraTMP fusion prediction technology.

[0122] Through intra-frame template matching, the template error values ​​between the reconstructed block and the current block at different positions can be obtained. These reconstructed blocks can be represented by block vectors pointing to the reconstructed blocks from the current block. A candidate block vector list is constructed to record the block vectors with the smallest template error values ​​during the template matching process. One or more block vectors are selected from the candidate block vector list based on conditions such as the block vector spacing and the template error value, and the reconstructed blocks they point to are used as the matching blocks for the current block. A weight value is determined for each matching block. These matching blocks are weighted and fused according to their weight values ​​to obtain the final prediction block, realizing IntraTMP combined fusion prediction. The specific process is shown in Figure 9. The grid-filled area represents the template area, the diagonal-line-filled area represents the reconstructed area, the dot-filled area represents the search area, and the arrows represent the block vectors. For the current block, after matching block 1, matching block 2, and matching block 3 are determined based on the different block vectors, matching block 1, matching block 2, and matching block 3 are weighted and fused according to weight values ​​W1, W2, and W3 to obtain the prediction block for the current block.

[0123] It should be noted that the number of matching blocks to be fused can be a fixed number or determined based on the size of the template error values ​​of each matching block. For example, for the N available matching blocks, a threshold Threshold = minSAD << 1 is set, where minSAD is the minimum template error value among these matching blocks. Only matching blocks with a template error value less than or equal to this threshold are used in the fusion process. This method can determine the matching blocks for fusion.

[0124] After the matching blocks for fusion are determined, the weight of each matching block can be determined by using a preset fixed value, calculating based on the template error value, or deducing based on the template.

[0125] (9)IntraTMP filtering technology.

[0126] The matching block (also called reference block) obtained by intra-frame template matching is usually directly used as the prediction block of the current block. The prediction block can be filtered to improve the prediction effect. Here, a block-level flag can be used to indicate whether the current block uses the filtering process for the prediction block. There are many types of filters, and one possible filter form is as follows: PredC = c0C + c1N + c2S + c3E + c4W + c5B (2)

[0127] Where C is the pixel to be filtered, N is the pixel above it, S is the pixel below it, W is the pixel to its left, and E is the pixel to its right, as shown in Figure 10. B (Bias) is a fixed value, for example, B is the median of the pixel range. c0 to c5 are the filter coefficients.

[0128] In one possible implementation, the filter coefficients are determined by training the filter coefficients using a reference block template and a current block template. For example, the template area is the reconstruction area four rows above and four columns to the left of the current block. For the reference block, an additional row of areas above, below, to the left, and to the right of the template area is also required as a reference, as shown in Figure 11. If part of the additional area is not fully encoded, it can be copied from the template area. In Figure 11, the diagonally filled areas represent the additional row of areas above, below, to the left, and to the right of the reference template area.

[0129] In one possible implementation, a method for training filter coefficients is to calculate a set of coefficients so that the MSE (Mean Square Error) of the filtered reference block template and the current block template is minimized.

[0130] If the current block uses IntraTMP filtering, then the prediction block directly obtained from the reference block is filtered. One possible method is to filter each pixel in order from left to right and from top to bottom, and use the filtered value as the prediction value.

[0131] (10) Template-derived IntraTMP fusion technology.

[0132] IntraTMP fusion prediction can obtain multiple reference blocks through the intra-frame template matching process and perform weighted fusion on these reference blocks. The weight values ​​are usually predefined fixed values ​​or calculated based on the template error of each reference block. For example, the template error values ​​of the reference blocks are SAD1 to SADn, and one way to calculate the weight is: SADi = (SADi == 0)? 1:SADi (3) Wi=(SUM-SADi) / ((n-1)*SUM) (5)

[0133] Where n is the total number of reference blocks, and Wi is the weight value corresponding to the reference block with a template error value of SADi. The form of the prediction block after weighted fusion can be as follows:

[0134] The template-derived IntraTMP fusion method uses a method similar to filter coefficient training to obtain weights for fusion prediction based on the training of each reference block template and the current block template. For example, using 5 reference blocks for weighted fusion, the form is as follows:

[0135] Another weighted method is to calculate a set of coefficients so that the MSE of the reference block template fused with the current block template is minimized.

[0136] (11) Adaptive reordering of merging candidates based on template error.

[0137] The adaptive reordering of merge candidates with template matching (ARMC-TM) technology is mainly used for inter-frame prediction. This technology proposes that in the process of constructing a merge list for inter-frame coding blocks, the error between the merge candidate and the template of the current block, such as SAD, can be calculated, and different merge candidates can be reordered according to the error. The index codeword corresponding to the merge candidate at the front of the list is shorter, thereby improving coding efficiency. When the motion information of a merge candidate is bidirectionally predicted, the template of the candidate can also be obtained by bidirectional prediction.

[0138] Furthermore, this technique proposes dividing the merge candidate list into multiple sublists, allowing for reordering of candidates within each sublist. To reduce complexity, certain sublists may not be reordered. For example, if the current sublist is not the first sublist but the last, the current sublist is not reordered.

[0139] (12) Template-based intra-frame mode derivation technology.

[0140] The Template-Based Intra Mode Derivation (TIMD) technique uses the reconstructed pixels in the L-shaped region adjacent to the current block as a template. By traversing the MPM list, it calculates the predicted pixels of the template area under different intra prediction modes. The resulting template error between the predicted and reconstructed pixels under different intra prediction modes is expressed as the Sum of Absolute Transformed Difference (SATD). The optimal intra prediction mode is selected based on the template error. At the decoding end, the intra prediction mode is derived using the same derivation method, thereby reducing the coding bits of the mode information.

[0141] (13) Joint intra-frame and inter-frame prediction technology.

[0142] Combined Inter and Intra Prediction (CIIP) technology combines intra prediction and inter prediction to obtain the prediction block of the current block using a weighted combination of intra prediction blocks and inter prediction blocks. CIIP in ECM is combined with template-based prediction technology, and different weight values ​​are assigned to different regions, further improving the accuracy of prediction. Specifically, its intra prediction block pred_intra is obtained by the TIMD mode, and the inter prediction block pred_inter is obtained by the template-based Merge mode. According to the derived intra prediction mode and the position of the pixel to be predicted, the weight values ​​wIntra and wInter are determined. The final prediction block Pred is calculated as follows: Pred = (wIntra*pred_intra+wInter*pred_inter+4)>>3 (8)

[0143] wIntra and wInter are determined by the intra prediction mode intra_dir derived from TIMD. ECM has 65 intra angular prediction modes (2≤intra_dir<=66). When 2≤intra_dir<34, the current block is divided into four equal parts vertically; when 34<=intra_dir<=66, the current block is divided into four equal parts horizontally. The weights wIntra and wInter for each region are shown in Table 3.

[0144] Table 3

[0145] In particular, when intra_dir is equal to 0 or 1, the sub-region is not divided, and wIntra and wInter can be selected from (3, 1), (2, 2), (1, 3) according to the coding type (intra-frame or inter-frame) of the two coding blocks located on the left and the upper side.

[0146] (14) Local illumination compensation technology.

[0147] Local Illumination Compensation (LIC) is a block-level linear transformation technology. The motion information between the current block and the reference block is MV, and LIC technology assumes that there is a linear relationship between the prediction block of the current block and the reference block, which can be expressed as: Pred = α·ref + β (9)

[0148] Among them, α and β can be derived from pixels in a reconstructed area adjacent to the current block and pixels in a reconstructed area adjacent to the reference block, and obtained by methods such as the least squares method.

[0149] In addition, the threshold can be set, and different linear parameters can be selected according to the size relationship between the reference block pixels and the threshold, which can be expressed as:

[0150] (15) Multimodal IBC-LIC technology.

[0151] The multi-modal IBC-LIC technique is further divided into multiple sub-methods based on the template area used to derive linear parameters and the number of linear transformation models. One example is to divide IBC-LIC into the following four methods:

[0152] ①Use L-shaped template area and single model;

[0153] ②Use the left template area and a single model;

[0154] ③Use the template area on the right and a single model;

[0155] ④ Use L-shaped template area and two models (select different models for linear transformation according to the threshold).

[0156] A specific IBC-LIC sub-method can be selected by means of a code index.

[0157] In summary, in the related art, Intra Template Matching Prediction (IntraTMP) can complete prediction through a template matching process within a predefined search area, where the search area can be related to factors such as the position and size of the current block. In combination with the IntraTMP technology of merging candidates, it is proposed to construct a Merge list as a candidate block in the search process. However, the candidate block vectors in the above-mentioned IntraTMP technology are based on template matching or merge lists as candidate block vectors. This results in a low diversity of candidate block vectors, thereby affecting the encoding and decoding efficiency.

[0158] Based on this, an embodiment of the present application provides a decoding method, which includes: parsing a code stream to determine first syntax element information; when the first syntax element information indicates that the current block adopts an intra-frame template matching prediction mode, determining a first block vector candidate list for the current block; wherein the first block vector candidate list is determined based on a first candidate list constructed based on template matching technology and / or a second candidate list constructed based on a merge candidate technology; based on the first block vector candidate list, determining a second block vector candidate list; wherein the second block vector candidate list includes at least a relocated block vector constructed for the first candidate block vector in the first block vector candidate list; based on the second block vector candidate list, determining a prediction value of the current block.

[0159] In this way, whether at the encoding or decoding end, on the one hand, by constructing repositioned block vectors for the first candidate block vectors in the first block vector candidate list to determine the second block vector candidate list, further refinement or adjustment of the first candidate block vectors in the first block vector candidate list is achieved, thereby increasing the diversity of the candidate block vectors, more accurately describing motion information, and improving the accuracy of motion estimation. On the other hand, determining the first block vector candidate list based on the first candidate list constructed based on the template matching technology and / or the second candidate list constructed based on the merged candidate technology increases the diversity of the candidate list, which is beneficial to the subsequent expansion of the candidate block vectors, making it possible to more effectively select appropriate block vectors during the encoding and decoding process, thereby increasing the diversity of the candidate block vectors and reducing the transmission of redundant information, thereby improving the efficiency of encoding and decoding.

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

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

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

[0163] Furthermore, FIG14 is a schematic diagram of a network architecture of a codec system provided in an embodiment of the present application. As shown in FIG14 , the network architecture includes one or more electronic devices 31 to 3N and a communication network 01, wherein the electronic devices 31 to 3N can perform video interaction through the communication network 01. During implementation, the electronic devices can be various types of devices with video codec functions. For example, the electronic devices can include smartphones, tablet computers, personal computers, personal digital assistants, navigators, digital phones, video phones, televisions, sensor devices, servers, etc., and are not specifically limited in the embodiments of the present application.

[0164] In an embodiment of the present application, a network architecture of a video encoding and decoding system including a decoding method and an encoding method is provided. The decoder or encoder in the embodiment of the present application can be the aforementioned electronic device. In other words, the electronic device in the embodiment of the present application has video encoding and decoding capabilities and can generally include a video encoder (i.e., an encoder) and a video decoder (i.e., a decoder).

[0165] It should also be noted that the embodiments of the present application are mainly applied to the intra-frame prediction part and / or inter-frame prediction part (indicated by a bold frame) as shown in Figure 12 and the intra-frame prediction part and / or inter-frame prediction part (indicated by a bold frame) as shown in Figure 13. In other words, the embodiments of the present application can be applied to both the encoder and the decoder, and can even be applied to both the encoder and the decoder at the same time.

[0166] It should also be noted that when the embodiment of the present application is applied to the encoder as shown in Figure 12, the "current block" specifically refers to the encoding block to be predicted at the moment; when the embodiment of the present application is applied to the decoder as shown in Figure 13, the "current block" specifically refers to the decoding block to be predicted at the moment.

[0167] In one embodiment of the present application, FIG15 is a flowchart of a decoding method provided by the embodiment of the present application. As shown in FIG15 , the method may include S301 to S304:

[0168] S301: parse a bitstream to determine first syntax element information.

[0169] It should be noted that the decoding method of the embodiment of the present application is applied to a decoder. Furthermore, the decoding method may specifically refer to a method for expanding intra-frame template matching candidates. Specifically, in the prediction mode of intra-frame template matching, this method mainly focuses on a technical improvement for constructing a candidate list. More specifically, it may be a mode prediction method based on IntraTMP technology to avoid the problem of low diversity of candidate block vectors in related technologies, which affects decoding efficiency.

[0170] In an embodiment of the present application, the decoder determines first syntax identification information by parsing the bitstream, wherein the first syntax identification information is used to indicate whether the current block adopts the intra-frame template matching prediction mode.

[0171] In some embodiments of the present application, the implementation of parsing the bitstream and determining the first syntax element information in S301 may include:

[0172] If the value of the first syntax element information is the first value, it is determined that the current block adopts the intra template matching prediction mode; or,

[0173] If the value of the first syntax element information is the second value, it is determined that the current block does not adopt the intra template matching prediction mode.

[0174] It should be noted that in the embodiment of the present application, the first value and the second value are different, and the first value and the second value can be in parameter form or in digital form. Specifically, the first syntax identification information can be a parameter written in the profile or a flag value, which is not specifically limited here.

[0175] Exemplarily, for the first value and the second value, the first value can be set to 1 and the second value can be set to 0; or, the first value can be set to 0 and the second value can be set to 1; or, the first value can be set to true and the second value can be set to false; or, the first value can be set to false and the second value can be set to true; but this is not specifically limited here.

[0176] In an embodiment of the present application, taking the flag written into the bitstream as an example, assuming that the first value is set to 1 (true) and the second value is set to 0 (false), if the value of the first syntax identification information is 0 (false), then it can be determined that the current block does not adopt the intra-frame template matching prediction mode, that is, there is no need to execute the decoding method of the embodiment of the present application; if the value of the first syntax identification information is 1 (true), then it can be determined that the current block adopts the intra-frame template matching prediction mode, that is, it may be necessary to execute the decoding method of the embodiment of the present application.

[0177] It is understood that when the value of the first syntax identification information is the first value, it is determined that the current block adopts the intra-frame template matching prediction mode, and redundant information is reduced through intra-frame template matching, thereby achieving a compression effect. When the value of the first syntax identification information is the second value, it is determined that the current chroma block does not adopt the intra-frame template matching prediction mode, which can avoid or limit the use of intra-frame template matching, improve decoding stability, or avoid performance issues in certain situations.

[0178] S302. When the first syntax element information indicates that the current block adopts the prediction mode of intra-frame template matching, determine the first block vector candidate list of the current block; wherein the first block vector candidate list is determined according to the first candidate list constructed based on the template matching technology and / or the second candidate list constructed based on the merge candidate technology.

[0179] In an embodiment of the present application, when the first syntax element information indicates that the current block adopts the intra template matching prediction mode, the decoder determines a first block vector candidate list for the current block.

[0180] In the embodiment of the present application, the construction of the first block vector candidate list relies on two key information sources, namely the following two:

[0181] 1) First Candidate List: This means that the first candidate list searches for the block most similar to the current block within the reference frame using template matching. Template matching compares pixel values ​​or other features between blocks to find the most similar blocks and generates a first candidate list containing multiple block vectors obtained through template matching.

[0182] 2) Second Candidate List: This indicates that the construction of the first block vector candidate list may also utilize a merge candidate technique. In video codecs, merging typically involves combining information from adjacent blocks or other blocks to reduce redundancy and improve decoding efficiency. This technique can be used to construct a second candidate list containing multiple merged block vectors.

[0183] As you can see, combining the first and second candidate lists constructed using these two techniques yields the first block vector candidate list. This list contains multiple possible block vectors for use in the subsequent motion prediction process. This design leverages the strengths of both template matching and candidate merging techniques to provide a more comprehensive and diverse selection of block vectors, thereby improving video decoding efficiency and quality.

[0184] In some embodiments of the present application, the first block vector candidate list includes any one of the following:

[0185] A first candidate list; wherein the first candidate list is determined by performing intra-frame template matching on a preset search range corresponding to the current block;

[0186] A second candidate list; wherein the second candidate list is determined by merging block vectors corresponding to one or more candidate blocks having similar motion to the current block;

[0187] The third candidate list is determined based on the first candidate list and the second candidate list.

[0188] In this embodiment of the present application, the first candidate list is determined by performing intra-frame template matching on a preset search range corresponding to the current block. That is, the system (decoder) performs intra-frame template matching within the predefined search range to find the block vector that is most similar to the current block and construct the first candidate list.

[0189] Exemplarily, the decoder searches within a preset search range corresponding to the current block. The goal of the search is to find the block most similar to the current block in order to obtain information about the current block's motion. During the search, intra-frame template matching techniques are typically used, involving comparing pixel values ​​or other features of the current block with those of blocks within the search range to find the most similar block. For each similar block found, its block vector is calculated—that is, the motion vector describing the current block relative to the block found in the reference frame. These block vectors form the elements of the first candidate list. The purpose of the first candidate list is to provide a variety of motion vector options. Due to differences in the search range and variations in similar blocks, the first candidate list may contain multiple block vectors, representing different motion hypotheses. Each candidate block vector is typically accompanied by a template error, which represents the difference between the current block and the reference block. The smaller the template error, the more likely the candidate block vector is to be the optimal choice. During the subsequent decoding process, the decoder may select the optimal block vector from the first candidate list, typically based on the minimum template error or other optimization criteria.

[0190] It can be understood that the first candidate list is generated by searching for similar blocks within the search range within the frame, calculating block vectors, and generating a list containing multiple candidate block vectors to provide options for different motion hypotheses. This list construction is part of motion estimation in video decoding and helps improve the accuracy of the current block motion.

[0191] In an embodiment of the present application, the second candidate list is determined by merging block vectors corresponding to one or more candidate blocks having similar motion to the current block. The merging method may involve adjacent blocks, historical cache blocks, etc., and the second candidate list is obtained by merging these block vectors.

[0192] For example, during video decoding, there may be other blocks with similar motion to the current block. These blocks can come from adjacent areas, historical caches, or other similarity criteria. Constructing the second candidate list involves merging the block vectors corresponding to these candidate blocks with similar motion. The purpose of merging is to provide richer motion information to better predict the motion of the current block. Merging can use various techniques, such as block vector averaging and motion compensation, and the specific merging strategy may depend on the system design and video decoding standard. The results of the merging form the elements of the second candidate list. Each element is a block vector that describes the motion vector of a combination of blocks with similar motion to the current block. The construction of the second candidate list aims to provide more diverse and adaptable motion vector options. By merging motion information from different blocks, it can better adapt to complex scenes and motion changes. During the subsequent decoding process, the system may select the optimal block vector from the second candidate list, typically based on the minimum template error or other optimization criteria.

[0193] It can be understood that the construction of the second candidate list provides more comprehensive motion information by combining the block vectors corresponding to candidate blocks with similar motion, thereby enhancing the modeling and prediction of the current block's motion. This list construction is part of motion estimation in video decoding, helping to improve decoding efficiency and video quality.

[0194] In the embodiment of the present application, the third candidate list is determined based on the first candidate list and the second candidate list, which means that the construction of the third candidate list may combine the information of the first two lists and comprehensively consider the results of intra-frame template matching and motion merging.

[0195] Exemplarily, the third candidate list is constructed based on the first candidate list. The first candidate list is determined by performing intra-frame template matching within a preset search range corresponding to the current block. This means that the first candidate list contains a set of candidate block vectors found through template matching techniques. The third candidate list is also based on the second candidate list. The second candidate list is determined by merging block vectors corresponding to one or more candidate blocks with similar motion to the current block. This means that the second candidate list contains a set of candidate block vectors obtained through merging techniques. The purpose of the third candidate list is to combine the information from the first and second candidate lists to provide more comprehensive and diverse motion vector options. This combination can enhance the modeling and prediction of the current block's motion. By combining the first and second candidate lists, the third candidate list aims to provide more diverse and adaptable motion vector options. This is important for coping with different scenarios and motion characteristics. During the subsequent decoding process, the system may select an optimal block vector from the third candidate list, typically based on the minimum template error or other optimization criteria.

[0196] It's understandable that the third candidate list is constructed to improve video decoding performance by integrating information from different sources to provide richer and more diverse motion vector options. This comprehensive approach helps more accurately predict motion in different scenarios, improving decoding efficiency and video quality.

[0197] It can be understood that, on the one hand, the combined use of intra-frame template matching and merging techniques can improve the accuracy of the current block's motion. Intra-frame template matching considers spatial similarity, while merging allows for richer motion information to be obtained from adjacent blocks. On the other hand, combining different candidate lists helps adapt to different scenarios and motion characteristics. Intra-frame template matching is more suitable for static or slowly changing areas, while merging may be more effective for rapidly moving or dynamically changing areas. On the other hand, considering different candidate lists can more effectively select block vectors, thereby improving video decoding efficiency. Reducing the residual difference between a block and a reference block helps reduce bitrate. By utilizing multiple sources of information, this integrated approach can better handle complex scenes, such as those with rapid motion and rich textures. Overall, the above process aims to fully utilize different techniques and information to improve video decoding performance, reduce distortion, and provide better visual quality. However, the specific results depend on implementation details and application scenarios.

[0198] In some embodiments of the present application, the first block vector candidate list includes the following cases:

[0199] Case 1: When the first block vector candidate list is the first candidate list, the first candidate block vector includes:

[0200] All candidate block vectors in the first candidate list; or

[0201] M candidate block vectors with minimum template costs in the first candidate list; where M is a positive integer greater than or equal to 1.

[0202] As can be appreciated, considering all candidate block vectors in the first candidate list provides a more comprehensive selection of motion vectors, which helps more accurately simulate and predict video block motion during decoding, thereby improving decoding efficiency and video quality. Furthermore, limiting the number of candidate block vectors considered helps reduce the computational burden, particularly when computing resources are limited. Selecting the M candidate block vectors with the lowest template cost can maintain decoding efficiency to a certain extent while reducing computational complexity.

[0203] Case 2: When the first block vector candidate list is the second candidate list, the first candidate block vector includes:

[0204] All candidate block vectors in the second candidate list; or

[0205] N candidate block vectors with minimum template costs in the second candidate list; where N is a positive integer greater than or equal to 1.

[0206] Case 3: When the first block vector candidate list is the third candidate list, the first candidate block vector includes:

[0207] All candidate block vectors in the first candidate list and all candidate block vectors in the second candidate list; or

[0208] The M candidate block vectors with the minimum template cost in the first candidate list and all candidate block vectors in the second candidate list; or

[0209] All candidate block vectors in the first candidate list and N candidate block vectors with minimum template costs in the second candidate list;

[0210] The M candidate block vectors with minimum template costs in the first candidate list and the N candidate block vectors with minimum template costs in the second candidate list;

[0211] H candidate block vectors with minimum template costs are obtained by combining all candidate block vectors in the first candidate list and all candidate block vectors in the second candidate list; where H is a positive integer greater than or equal to 1.

[0212] More specifically, when the first block vector candidate list is the third candidate list, the decoder can first construct the first candidate list, then construct the second candidate list, relocate the block of the first candidate block vector in the second candidate list, obtain an updated second candidate list, and then merge the updated second candidate list with the first candidate list to obtain the final second block vector candidate list.

[0213] As can be appreciated, providing all candidate block vectors in both the first and second candidate lists contains more motion information. This helps improve the comprehensiveness and accuracy of motion estimation, thereby improving the efficiency and quality of video decoding. Limiting the number of candidate block vectors in the first candidate list reduces the computational burden to a certain extent. At the same time, retaining all candidate block vectors in the second candidate list provides more motion information. While providing all candidate block vectors in the first candidate list and limiting the number of candidate block vectors in the second candidate list reduces computational complexity, the optimal candidate block vector in the second candidate list is still considered. The combined approach simultaneously limits the number of candidate block vectors in both lists, allowing for more precise control of computational complexity. At the same time, the candidate block vector with the lowest template cost in both lists is retained. By merging the candidate block vectors in the two lists and selecting the H candidate block vectors with the lowest template cost after merging, information from both lists is integrated. This helps provide more comprehensive and accurate motion estimation. Overall, these selection approaches offer the benefit of offering different trade-offs to meet the varying requirements of decoding systems for computational burden, motion estimation accuracy, and real-time performance. Choosing the method that best suits the specific application scenario helps optimize video decoding performance.

[0214] S303 . Determine a second block vector candidate list based on the first block vector candidate list; wherein the second block vector candidate list includes relocated block vectors constructed from the first candidate block vector in the first block vector candidate list.

[0215] In the embodiment of the present application, the composition of the second block vector candidate list includes the following situations:

[0216] Case 1: the block vector in the first candidate list (the list corresponding to template matching), and the relocated block vector corresponding to the first candidate block vector in the first candidate list;

[0217] Case 2: The block vector in the second candidate list (Merge list), and the relocated block vector corresponding to the first candidate block vector in the second candidate list;

[0218] Case 3: The block vector in the first candidate list (the list corresponding to template matching), the block vector in the second candidate list (Merge list), and the relocated block vector corresponding to the first candidate block vector in the second candidate list;

[0219] Case 4: the block vector in the first candidate list (the list corresponding to template matching), the block vector in the second candidate list (Merge list), and the relocated block vector corresponding to the first candidate block vector in the first candidate list;

[0220] Case 5: The block vector in the first candidate list (the list corresponding to template matching), the block vector in the second candidate list (Merge list), the relocated block vector corresponding to the first candidate block vector in the second candidate list, and the relocated block vector corresponding to the first candidate block vector in the first candidate list.

[0221] It should be noted that the composition of the second block vector candidate list listed above is only an example, and other methods may be included in practical applications, and the embodiments of the present application do not impose any limitation on this.

[0222] S304: Determine a prediction value of the current block based on the second block vector candidate list.

[0223] In some embodiments of the present application, the implementation of determining the prediction value of the current block based on the second block vector candidate list in S304 may include S3041 to S3043:

[0224] S3041. Parse the code stream to determine second syntax element information.

[0225] In an embodiment of the present application, the second syntax element information is used to indicate the prediction mode based on intra template matching adopted by the current block. Exemplarily, the second syntax element information may be intra_tmp_flag.

[0226] S3042 . Perform template matching on each of the second candidate block vectors in the second block vector candidate list to obtain a third block vector candidate list.

[0227] In some embodiments of the present application, performing template matching on each of the second candidate block vectors in the second block vector candidate list to obtain the third block vector candidate list in S3042 may include:

[0228] For any second candidate block vector among the second candidate block vectors, determining a neighborhood area of ​​any second candidate block vector according to index identification information of any second candidate block vector;

[0229] Searching in a neighborhood area of ​​any second candidate block vector with a preset step size to obtain a second matching block vector corresponding to any second candidate block vector;

[0230] Determine a third block vector having a minimum template cost among the second matching block vectors corresponding to any second candidate block vector;

[0231] A third block vector candidate list is determined according to the third block vector corresponding to the second candidate block vector.

[0232] In an embodiment of the present application, for the second candidate block vector, a corresponding neighborhood area is determined based on its index identification information. This neighborhood area is an area to be searched within a certain range around the second candidate block vector. Within the determined neighborhood area, a search is performed with a preset step size. The step size can be a distance in the horizontal and vertical directions, which is used to sample possible second matching block vector positions within the neighborhood area. Further, within the neighborhood area, a search is performed based on the preset step size to obtain a second matching block vector that matches the second candidate block vector. This is the block found in the neighborhood that best matches the second candidate block vector. Further, template matching is performed for the second matching block vector to determine a third block vector with the minimum template cost, for example, by searching within the template area around the second matching block vector to find the best matching block. Further, the determined third block vector with the minimum template cost is added to a third block vector candidate list, which contains the optimal third block vector corresponding to each second candidate block vector.

[0233] In an embodiment of the present application, the index identification information may include the position, size, and other relevant information of the second candidate block vector in the image or video frame, and this information can be used to determine the range of the neighborhood area.

[0234] In this embodiment of the present application, the obtained index identification information is used to calculate or define a neighborhood region of the second candidate block vector. The neighborhood region can be a rectangular region or another shaped region centered on the second candidate block vector. Search and template matching are performed within the neighborhood region calculated based on the index identification information to find the optimal third block vector.

[0235] For example, if the index identifier includes location information, a neighborhood region can be defined with that location as the center. If block size information is available, the neighborhood region can be defined based on the location information and the block size. The neighborhood region can be further adjusted based on other possible relevant information, such as image structure and motion direction.

[0236] It should be understood that determining the neighborhood area of ​​the second candidate block vector is a process of dynamic calculation based on specific index identification information, which helps ensure that the search range adapts to different video content and motion characteristics, thereby improving the accuracy of template matching.

[0237] As can be appreciated, performing a detailed search and template matching within the neighborhood of the second candidate block vector allows for a more accurate estimation of the third block vector, thereby improving overall motion estimation accuracy. Dynamically determining the neighborhood for each second candidate block vector based on its index identification information helps adapt to varying video content and motion characteristics. This makes the algorithm more versatile and capable of performing well in various scenarios. While the search with a preset step size can be performed within a larger neighborhood, once the second matching block vector is obtained, the third block vector with the minimum template cost typically falls within a smaller area, reducing the scope of further searches and improving search efficiency. Furthermore, performing template matching within the neighborhood of the second matching block vector to determine the third block vector with the minimum template cost helps refine the matching results, ensuring more accurate motion estimation. Overall, the above process, through multiple rounds of search and matching, improves the accuracy and robustness of motion estimation, contributing to improved video decoding performance.

[0238] S3043. Determine a prediction value of the current block according to the intra template matching-based prediction mode adopted by the current block indicated by the second syntax element information and the third block vector candidate list.

[0239] In the embodiment of the present application, the prediction mode based on intra-frame template matching adopted by the current block can be: IntraTMP fusion prediction technology, IntraTMP multiple candidate technology, etc., and the embodiment of the present application does not impose any limitation on this.

[0240] In an embodiment of the present application, the results of template matching and the prediction mode are used to match and predict the information of adjacent blocks to estimate the content of the current block, which helps to improve the efficiency of video decoding and compression performance, especially when the scene changes are small.

[0241] It can be understood that, on the one hand, the third block vector candidate list is obtained by performing template matching on each second candidate block vector in the second block vector candidate list. Such a multi-round search process helps to select the most matching block vector in the candidate blocks, thereby improving the prediction accuracy. On the one hand, the generation of the third block vector candidate list takes into account the matching results of multiple candidate blocks, thereby improving the robustness to noise and interference. By combining multiple candidate block vectors, the impact of a single matching result can be reduced. On the other hand, by utilizing the prediction mode of intra-frame template matching, combined with the third block vector candidate list, the content of the current block can be more accurately estimated, thereby improving the efficiency and compression performance of video decoding. The prediction value generation process is based on multiple rounds of template matching and precise block vector selection, which helps to improve the quality of the video, reduce estimation errors, and make the decoded image closer to the original image.

[0242] In some embodiments of the present application, the decoding method further includes:

[0243] Parse the code stream and determine the prediction difference of the current block;

[0244] A reconstructed value of the current block is determined according to the predicted value of the current block and the predicted difference value of the current block.

[0245] In an embodiment of the present application, the decoder reads the corresponding information from the video code stream, including the coding mode, motion vector, prediction mode, etc. Based on the parsed information, the decoder calculates the predicted value of the current block. The predicted value is obtained through techniques such as motion estimation and prediction mode, and represents an estimate of the content of the current block. Then, the predicted difference value of the current block is calculated, that is, the difference between the original block and the predicted block. Using the predicted value and the predicted difference value of the current block, the reconstructed value of the current block is calculated. The reconstructed value is obtained by adding the predicted difference value to the predicted value and is used to approximate the content of the original block.

[0246] It's understandable that, on the one hand, the prediction difference is one of the key pieces of information transmitted during the decoding process. By predicting the original block and transmitting only the difference, the bitstream size can be reduced, achieving video compression. On the other hand, at the decoding end, the combination of the prediction value and the prediction difference allows for more efficient reconstruction of the original block, reducing the computational and storage overhead required for decoding. On the other hand, the appropriate combination of the prediction value and the prediction difference can maintain video quality while compressing, making the decoded image close to the original.

[0247] In an embodiment of the present application, a decoding method is provided, the method comprising: parsing a bitstream to determine first syntax element information; determining a first block vector candidate list for the current block when the first syntax element information indicates that the current block adopts an intra-frame template matching prediction mode; wherein the first block vector candidate list is determined based on a first candidate list constructed based on a template matching technique and / or a second candidate list constructed based on a merge candidate technique; determining a second block vector candidate list based on the first block vector candidate list; wherein the second block vector candidate list at least includes a relocated block vector constructed for a first candidate block vector in the first block vector candidate list; and determining a prediction value for the current block based on the second block vector candidate list. On the one hand, by constructing relocated block vectors for each first candidate block vector in the first block vector candidate list to determine the second block vector candidate list, further refinement or adjustment of the first candidate block vector in the first block vector candidate list is achieved, thereby increasing the diversity of the candidate block vectors, more accurately describing motion information, and improving the accuracy of motion estimation. On the other hand, determining the first block vector candidate list based on the first candidate list constructed based on the template matching technology and / or the second candidate list constructed based on the merged candidate technology improves the diversity of the candidate list, is beneficial to the subsequent expansion of candidate block vectors, and makes it possible to more effectively select suitable block vectors during the decoding process, thereby improving the diversity of candidate block vectors, reducing the transmission of redundant information, and thus improving the decoding efficiency.

[0248] It can be appreciated that the first candidate list constructed based on template matching technology and / or the second candidate list constructed based on merged candidate technology can improve the accuracy of the prediction of the current block content, facilitate more precise estimation of block content in video prediction, and reduce prediction error. The generation of the first block vector candidate list takes into account multiple factors, including template matching and merged candidate technology. This comprehensive consideration helps adapt to different video scenarios and makes the prediction mode more flexible and adaptable. The generation process of the first block vector candidate list, through multiple rounds of search and matching, can better capture the motion relationships between blocks, thereby reducing prediction overhead and improving prediction efficiency. With more accurate prediction values, the original block can be more accurately reconstructed at the decoding end, thereby improving video quality. This helps reduce distortion and maintain a high-quality visual experience. The second block vector candidate list, particularly the relocated block vector, can more effectively represent the motion information of the current block, thereby achieving better compression performance while maintaining video quality. Overall, the above process can improve prediction accuracy, adapt to different scenarios, reduce prediction overhead, improve video quality, and optimize overall compression performance.

[0249] In some embodiments of the present application, the implementation of determining the second block vector candidate list based on the first block vector candidate list in S303 may include S3031 to S3032:

[0250] S3031. Determine a first candidate block vector in a first block vector candidate list; wherein the first candidate block vector is all or part of the candidate block vectors in the first block vector candidate list.

[0251] S3032: Construct a relocated block vector for the first candidate block vector to obtain a second block vector candidate list.

[0252] In some embodiments of the present application, the implementation of constructing the relocated block vectors for the first candidate block vectors in S3032 to obtain the second block vector candidate list may include S401 to S404:

[0253] S401: Determine a guide block vector of the current round that meets a first preset condition from among first candidate block vectors.

[0254] In some embodiments of the present application, the first preset condition includes one or more of the following:

[0255] The template cost value corresponding to the guiding block vector is less than or equal to a second threshold value; wherein the second threshold value is obtained based on the template cost values ​​corresponding to the block vectors added to the first block vector candidate list and / or the second block vector candidate list;

[0256] The reference block corresponding to the reconstructed guide block vector;

[0257] The reference block corresponding to the guide block vector does not exceed the search range of the Intra TMP;

[0258] The reference block corresponding to the index block vector does not exceed the search range of the IBC mode.

[0259] In this embodiment of the present application, the second threshold is determined based on the template cost values ​​corresponding to the block vectors already added to the first block vector candidate list and / or the second block vector candidate list. This relationship may be used to dynamically adjust the second threshold based on previous search and matching results to adapt to the specific circumstances of the current video frame.

[0260] Exemplarily, relevant information is obtained from the added block vectors in the first block vector candidate list and / or the second block vector candidate list. For each added block vector, its corresponding template cost value in template matching is obtained. A comprehensive reference value may be obtained by comprehensively considering the template cost values ​​corresponding to the added block vectors, perhaps using an average, weighted average, or other statistical method. The second threshold is dynamically adjusted based on the comprehensive reference value.

[0261] It should be understood that through the above mechanism, the system can adaptively determine the second threshold according to actual conditions during runtime, thereby better coping with different video frames and motion scenes, and improving the performance and adaptability of the template matching prediction mode.

[0262] In an embodiment of the present application, in video encoding and decoding, intra-frame template matching prediction generally involves searching within the current frame for a pattern similar to the block to be decoded. To avoid unnecessary calculations and improve search efficiency, the search range may be limited to a certain area, which is the search range of the Intra TMP. Therefore, the reference block corresponding to the guide block vector does not exceed the search range of the Intra TMP, which means that in this intra-frame template matching prediction mode, the search range for the reference block indicated by the guide block vector is subject to certain restrictions, thereby ensuring that areas that are too far away or irrelevant will not be searched during the template matching process, thereby improving the efficiency and accuracy of the search.

[0263] In the embodiments of the present application, the search range in IBC mode represents a limited area within the current frame for searching for similar blocks. This search range restriction helps reduce the search space and improve decoding efficiency, and is typically based on some prior knowledge or statistical information. Therefore, the reference block corresponding to the guide block vector does not exceed the search range in IBC mode. This means that when using IBC mode, the search range for the reference block indicated by the guide block vector is restricted to ensure that the search range is not too wide when copying blocks within the current frame, thereby improving search efficiency.

[0264] It will be appreciated that, on the one hand, the second threshold mentioned in the first preset condition is obtained by considering the template cost corresponding to the added block vector, which helps control the accuracy of template matching, avoid unnecessary calculations, and select block vectors with smaller template costs, thereby improving decoding efficiency. On the other hand, if the reference block corresponding to the guide block vector has already been reconstructed in a previous decoding, repeated calculations can be avoided, redundant operations can be reduced, and decoding efficiency can be improved. On the other hand, the search range of the reference block is limited so that it does not exceed the search range of the Intra TMP or IBC mode. This helps to reduce the search space and increase the search speed, while ensuring that the selected reference block is within a reasonable range, thereby improving decoding performance.

[0265] S402: Add the relocated block vector corresponding to the guide block vector of the current round to the current second block vector candidate list to obtain an updated current second block vector candidate list.

[0266] In this embodiment of the present application, the relocated block vector corresponding to the current round's guide block vector is added to the current second block vector candidate list to update the list. Generally speaking, the current second block vector candidate list may contain multiple block vectors, each corresponding to a different reference block. By adding the relocated block vector corresponding to the current round's guide block vector to the current second block vector candidate list, more block vectors can be considered for matching, thereby improving the accuracy and effectiveness of the matching.

[0267] It is understood that utilizing previously acquired information about the guidance block vector and the relocation block vector to more comprehensively consider the selection of block vectors helps improve matching accuracy. Adding more block vectors to the candidate list may provide more options for subsequent template matching or other prediction processes, thereby increasing the likelihood of finding the best match.

[0268] It should be noted that the current second block vector candidate list may also include all or part of the block vectors inherited from the first block vector candidate list.

[0269] S403 : For any current reference block vector in the current round of reference block vectors, determine a relocation block vector corresponding to any current reference block vector according to the current reference block and / or current block corresponding to the current reference block vector.

[0270] In some embodiments of the present application, the implementation of determining the relocation block vector corresponding to any current reference block vector according to the current reference block and / or the current block corresponding to any current reference block vector in S403 may include S4031 to S4032:

[0271] S4031. Perform offset processing on any current reference block vector according to the current reference block and / or the current block to obtain a reference block offset vector corresponding to any current reference block vector.

[0272] In an embodiment of the present application, the guide block vector is offset by taking into account information about the current reference block and / or the current block. This offset may be caused by object motion or scene changes. By calculating the offset, better adaptation to motion and changes in the video can be achieved. The vector obtained after the offset process is called the guide block offset vector. This vector describes the displacement relative to the guide block, helping to more accurately locate the block.

[0273] It should be understood that by considering the offset, the position of the current block relative to the reference frame can be estimated more accurately, improving the accuracy of the position. Objects in the video may move and change, and offset processing can help the model better adapt to these changes.

[0274] In some embodiments of the present application, the reference block offset vector includes one or more of the following:

[0275] A first reference block offset vector; wherein the first reference block offset vector is used to indicate a first candidate reference block located in the middle of the current reference block;

[0276] A second reference block offset vector; wherein the second reference block offset vector is used to indicate a second candidate reference block located at the upper left position of the current reference block;

[0277] A third reference block offset vector; wherein the third reference block offset vector is used to indicate a third candidate reference block located at the lower left position of the current reference block;

[0278] A fourth reference block offset vector; wherein the fourth reference block offset vector is used to indicate a fourth candidate reference block located at the upper right position of the current reference block;

[0279] A fifth reference block offset vector; wherein the fifth reference block offset vector is used to indicate a fifth candidate reference block located at the upper right position of the current reference block.

[0280] In an embodiment of the present application, the first guide block offset vector can be expressed as CTR, the second guide block offset vector can be expressed as LT, the third guide block offset vector can be expressed as LB, the fourth guide block offset vector can be expressed as RT, and the fifth guide block offset vector can be expressed as RB.

[0281] In an embodiment of the present application, the first guide block offset vector guides the decoder to find the reference block in the middle position corresponding to the current reference block. The setting of the second guide block offset vector can guide the decoder to consider the reference block in the upper left position. The third guide block offset vector can guide the decoder to pay attention to the reference block in the lower left position. The fourth guide block offset vector helps the decoder consider the reference block in the upper right position. The fifth guide block offset vector can guide the decoder to pay attention to the reference block in the lower right position. The setting of these guide block offset vectors helps to explore possible reference block positions more comprehensively within the search area to improve the accuracy and adaptability of motion estimation. In actual applications, the settings of these guide block offset vectors can be adjusted according to the characteristics and needs of the scene.

[0282] S4032: Determine the relocation block vector corresponding to any current reference block vector based on the reference block offset vector.

[0283] In some embodiments of the present application, the implementation of determining the relocation block vector corresponding to any current reference block vector based on the reference block offset vector in S4032 may include:

[0284] In the guide block offset vector, determining a current guide block offset vector;

[0285] If the current reference block offset vector is available, determining a relocation block vector corresponding to the current reference block offset vector based on the block vector of the candidate reference block corresponding to the current reference block offset vector and the current reference block offset vector; wherein the relocation block vector corresponding to the current reference block offset vector is one of the relocation block vectors corresponding to any one of the current reference block vectors; or

[0286] In the case that the current reference block offset vector is unavailable, the current reference block offset vector is skipped and the step of determining the next reference block offset vector in the reference block offset vector is continued.

[0287] In some embodiments of the present application, if the current guide block offset vector exists, the candidate reference block indicated by the current guide block offset vector has been reconstructed, the template cost value corresponding to the current guide block offset vector is less than or equal to a first threshold, the candidate reference block indicated by the current guide block offset vector is within a preset range, and the prediction mode of the candidate reference block indicated by the current guide block offset vector is one or more of the IBC mode and the IntraTMP mode, it is determined that the current guide block offset vector is available; or,

[0288] The current guidance block offset vector is determined to be unavailable when the current guidance block offset vector does not exist, the candidate reference block indicated by the current guidance block offset vector has not been reconstructed, the template cost value corresponding to the current guidance block offset vector is greater than a first threshold, the candidate reference block indicated by the current guidance block offset vector is not within a preset range, and the prediction mode of the candidate reference block indicated by the current guidance block offset vector is not one or more of the IBC mode or the IntraTMP mode.

[0289] In the embodiment of the present application, the existence of a current reference block offset vector means that in the current round of processing, the algorithm has generated a reference block offset vector, which is usually obtained through template matching or other technologies.

[0290] In an embodiment of the present application, the candidate reference block indicated by the reconstructed current guidance block offset vector means that the current guidance block offset vector indicates the candidate reference block used in the current round, and this reference block may have been reconstructed in previous processing or obtained by other means.

[0291] In this embodiment of the present application, the template cost value corresponding to the current reference block offset vector is less than or equal to the first threshold, which means that the performance of the current reference block offset vector in template matching is determined to be sufficiently good, and its template cost value is less than or equal to a predetermined threshold. This threshold is typically determined based on application requirements and performance considerations.

[0292] In the embodiment of the present application, the candidate reference block indicated by the current reference block offset vector is within a preset range, which means that the position of the candidate reference block is ensured to be within a preset search range. This search range can be determined based on factors such as prior knowledge and image resolution.

[0293] In an embodiment of the present application, the prediction mode of the candidate reference block indicated by the current guidance block offset vector is the IBC mode or the IntraTMP mode, ensuring that the candidate reference block adopts the specified prediction mode, which may be the bidirectional intra-frame block copy (IBC) mode or the intra-frame template matching prediction (IntraTMP) mode.

[0294] In the embodiment of the present application, based on the above conditions, if the current reference block offset vector meets these conditions, then the vector is considered "usable" and can be used in subsequent processing steps, such as reconstructing the block and updating the block vector list. The goal of this process is to screen candidate blocks with good performance in the template matching process to improve overall prediction accuracy.

[0295] As can be understood, by satisfying a series of conditions, the candidate reference blocks corresponding to the selected guide block offset vectors are ensured to meet requirements in all aspects, including template matching cost, location, and prediction mode. This helps improve block reconstruction accuracy, thereby enhancing overall video decoding performance. Furthermore, by selectively using guide block offset vectors that meet these conditions, the computational complexity of subsequent processing is reduced. Block vectors and candidate reference blocks that do not meet these conditions can be eliminated, thereby optimizing overall algorithm performance. Furthermore, by eliminating unsuitable candidate reference blocks and block vectors, the potential for errors is reduced, contributing to improved stability and reliability. Furthermore, by eliminating unsuitable block vectors at an early stage, the video decoding process is accelerated. This is particularly important for speed-sensitive applications such as real-time video decoding and streaming. By selectively using high-quality block vectors and candidate reference blocks, decoder resources are better utilized, thereby optimizing video decoding performance.

[0296] In the embodiment of the present application, the current guide block offset vector is first determined. The guide block offset vector is a set of vectors, each vector representing an offset relative to the current reference block position. The guide block offset vector here generally includes offsets in multiple directions, such as upper left, lower left, upper right, lower right, etc. Then, based on the block vector of the candidate reference block corresponding to the current guide block offset vector and the current guide block offset vector, the relocation block vector corresponding to the current guide block offset vector is determined. This process can be divided into two cases:

[0297] Case 1: If the current reference block offset vector is available, then the relocation block vector corresponding to the current reference block offset vector is determined based on the block vector of the candidate reference block corresponding to the current reference block offset vector. This relocation block vector can be any of the relocation block vectors corresponding to the current reference block vector.

[0298] Specifically, the current reference block offset vector is used to determine the position of the reference block. Based on this position, the block vector of the candidate reference block is obtained. This block vector represents the position information relative to the current block. If the reference block offset vector is available, the block vector of the candidate reference block is used to determine the relocation block vector corresponding to the current reference block offset vector. This relocation block vector represents the correction of the current block's position relative to the candidate reference block. If multiple reference block offset vectors are available, processing continues with the next reference block offset vector. This may involve iterating through all reference block offset vectors to find the most appropriate relocation block vector.

[0299] Case 2: If the current guide block offset vector is not available, the current guide block offset vector is skipped and the step of determining the next guide block offset vector in the guide block offset vector is continued. This means that in the current case, the current guide block offset vector is not considered and other available guide block offset vectors are continued to be tried.

[0300] It can be understood that, through the above steps, a suitable relocation block vector is found for the current reference block to more accurately predict the position of the current block, which helps to improve the accuracy of block vector prediction, especially when complex motion situations are involved.

[0301] In some embodiments of the present application, the implementation of determining the relocation block vector corresponding to the current reference block offset vector based on the block vector of the candidate reference block corresponding to the current reference block offset vector and the current reference block offset vector may include the following two cases:

[0302] Case 1: When the candidate reference block does not adopt the prediction mode of bidirectional intra block copy (IBC), the block vector of the candidate reference block corresponding to the current reference block offset vector and the current reference block vector are added to obtain the relocated block vector corresponding to the current reference block offset vector.

[0303] In an embodiment of the present application, a vector addition operation is performed on the block vector of the candidate reference block corresponding to the current reference block offset vector and the current reference block vector. The purpose of this operation is to correct the block vector of the candidate reference block, taking into account the offset of the current reference block. For example, if the block vector of the candidate reference block is represented by BV1 and the current reference block vector is represented by BV2, then the vector addition BV1+BV2 will result in a corrected block vector, i.e., the relocated block vector corresponding to the current reference block offset vector. The result of the vector addition operation is the relocated block vector corresponding to the current reference block offset vector.

[0304] It should be understood that in the above process, the block vector of the candidate reference block is corrected according to the offset information of the current reference block, so as to more accurately predict the position of the current block.

[0305] Case 2: When the candidate reference block adopts the bidirectional IBC prediction mode, a first reference block vector and a second reference block vector corresponding to the candidate reference block are determined;

[0306] Performing a vector addition operation on the first reference block vector and the current guide block vector to determine a first relocation block vector corresponding to the current guide block offset vector;

[0307] A vector addition operation is performed on the second reference block vector and the current reference block vector to determine a second relocated block vector corresponding to the current reference block offset vector.

[0308] In this embodiment of the present application, for bidirectional IBC, a block may have two reference blocks: a first reference block and a second reference block. Both reference blocks have corresponding block vectors. Therefore, the decoder needs to obtain the first reference block vector and the second reference block vector corresponding to the candidate reference block.

[0309] In this embodiment of the present application, the first relocated block vector = the first reference block vector + the current reference block vector. The second relocated block vector = the first reference block vector + the current reference block vector. By adding these two vectors, the first and second relocated block vectors corresponding to the current reference block offset vector are obtained. This more accurately represents the position of the candidate reference block in the bidirectional IBC prediction mode, helping to improve block prediction accuracy.

[0310] It's understandable that, on the one hand, the bidirectional IBC prediction mode considers reference blocks in two different directions, helping to more accurately capture the motion information of the target block. This can improve prediction accuracy, especially in complex motion scenarios. On the other hand, bidirectional IBC allows for modeling of the target block in both directions, which can better adapt to various motion patterns in complex motion scenes and improve overall video decoding efficiency. Because bidirectional IBC simultaneously considers motion information in both directions, it more comprehensively covers the possible diversity of motion, allowing the decoding process to better adapt to the motion characteristics of different blocks in the video sequence.

[0311] S404: Continue to determine the next round's guide block vector that meets the first preset condition from the relocated block vectors corresponding to the current round's guide block vectors, thereby obtaining an updated next second block vector candidate list. This continues until the next round's guide block vector meets the second preset condition, and the last updated second block vector candidate list is used as the second block vector candidate list.

[0312] In an embodiment of the present application, there may be multiple candidate block vectors in the first candidate block vector. First, a first preset condition is applied to select a guide block vector for the current round that meets the condition. This condition may include a template cost value less than or equal to a certain threshold, a reference block corresponding to the reconstructed guide block vector, etc. Furthermore, for the selected guide block vector for the current round, a corresponding relocation block vector is generated using a corresponding algorithm or rule, and the generated relocation block vector is added to the current second block vector candidate list to obtain an updated current second block vector candidate list. Furthermore, for the guide block vector for the current round, a corresponding relocation block vector is determined using the reference block and / or the current block. Using the first preset condition, the guide block vector for the next round that meets the condition is screened and determined. In each round, the next second block vector candidate list is gradually obtained through an iterative update process. This process may be repeated multiple times until the second preset condition is met, i.e., the final second block vector candidate list is obtained.

[0313] It should be understood that the above process is a process of determining the appropriate block vector according to preset conditions through multiple rounds of iterative screening and updating to generate the final second block vector candidate list, which helps to more accurately predict the motion information of the current block in video decoding.

[0314] In the embodiment of the present application, the second preset condition is a cutoff condition for multiple rounds of iterative screening.

[0315] In some embodiments of the present application, the second preset condition includes one or more of the following:

[0316] The next round is greater than or equal to the iteration round threshold;

[0317] The number of guidance block vectors in the next round is less than or equal to a third threshold;

[0318] A template cost value corresponding to at least one guide block vector in the next round of guide block vectors is greater than or equal to a fourth threshold;

[0319] The list length of the next second block vector candidate list updated corresponding to the next round is greater than or equal to the maximum list length threshold.

[0320] In an embodiment of the present application, the next round being greater than or equal to the iteration round threshold can ensure that the next round of iteration is performed only after the number of iterations reaches a certain threshold, so as to avoid infinite iteration or stopping iteration when the number of iterations is low.

[0321] In an embodiment of the present application, the number of guidance block vectors in the next round is less than or equal to the third threshold. This condition limits the number of guidance block vectors selected in each round, possibly to control computational complexity and prevent the selection of too many guidance block vectors.

[0322] In this embodiment of the present application, the template cost value corresponding to at least one of the guide block vectors in the next round is greater than or equal to a fourth threshold. This condition requires that at least one of the guide block vectors in the next round has a certain level of template cost, which helps ensure that the selected block vector is more relevant. This condition may also require that at least one of the guide block vectors in the next round has a sufficiently low template cost to ensure the quality of the candidate block.

[0323] In this embodiment of the present application, the length of the next second block vector candidate list, updated in the next round, is greater than or equal to a maximum list length threshold. This condition ensures that the updated second block vector candidate list in the next round contains sufficient information to ensure sufficient candidate block vectors for the next iteration. This condition can also control the length of the candidate list to prevent it from being too large, thereby saving computing resources or meeting other algorithm design requirements.

[0324] It should be noted that the second preset condition listed above is only an example. In actual application scenarios, other condition settings may also be included, and this application does not impose any limitations on this.

[0325] It can be appreciated that, on the one hand, through an iterative process, a guide block vector that meets certain conditions can be selected in each round, which may lead to more accurate block vector selection, thereby improving the accuracy of motion estimation for the current block. Adding the relocation block vector corresponding to the guide block vector of the current round to the current second block vector candidate list helps to concentrate the screened block vectors in the second block vector candidate list, reducing redundant block vector selection and improving computational efficiency. On the other hand, by adjusting the selection of guide block vectors and relocation block vectors in each round, this method may have a certain degree of flexibility and can better adapt to the changes and complexity of motion in the video. By selecting and updating block vectors according to preset conditions, motion estimation may be more efficient in terms of computational cost and avoid processing large amounts of redundant information.

[0326] In some embodiments of the present application, when the first block vector candidate list is the first candidate list, the implementation of determining the first block vector candidate list of the current block in S302 may include:

[0327] Determine a first candidate list, and use the first candidate list as a first block vector candidate list;

[0328] Determine the first candidate list, including:

[0329] Searching within a preset search range with a preset step size to obtain a first matching block vector;

[0330] Determining a first block vector having a minimum template cost among the first matching block vectors;

[0331] A first candidate list is determined according to the first block vector.

[0332] In an embodiment of the present application, the preset search range refers to a search area defined in advance in the motion estimation process for finding the best matching block. The size of the search range is usually set by the codec standard or the decoder parameters, which determines the spatial range for finding the matching block in the reference frame. This search process is completed by calculating the similarity between the current block and each possible position block in the reference frame. In order to reduce the computational complexity, the search is usually performed with a certain step size, which is also preset. A larger search range can better handle larger motions, but it will also increase the computational complexity. A smaller search range can reduce the computational burden, but it may not be possible to find the best match, especially in the presence of large motions.

[0333] In the embodiment of the present application, the preset search range is a parameter for balancing decoding performance and computational complexity. By appropriately setting the search range, the video codec can meet performance requirements while maintaining low computational overhead.

[0334] In an embodiment of the present application, the template cost is an indicator that measures the similarity between two blocks. After finding the first matching block vector within the search range, it is necessary to calculate the template cost of each matching block, and then select the block vector with the minimum template cost as the best matching block vector. The template cost is usually calculated by comparing the pixel values ​​of the current block with the corresponding position block in the reference frame. Common template cost calculation methods include Mean Squared Error (MSE) and Sum of Absolute Differences (SAD). The process of calculating the template cost is to traverse each pixel in the two blocks, calculate the difference between them, and then sum or square the sum. Determining the block vector with the minimum template cost means selecting the reference block that best matches the current block within the search range.

[0335] In an embodiment of the present application, a search is performed within a given search range with a preset step size to find a block that matches the current block. During the search, the block most similar to the current block is found, and a first matching block vector is obtained. This vector represents the position offset of the matching block found during the search. For the first matching block vector, a template matching cost is calculated within the neighborhood of the matching block. The first block vector with the minimum template cost is found, indicating the best match. Using this first block vector, a first candidate list can be determined. For example, the first block vector and its related information can be added to the candidate list for subsequent processing.

[0336] As you can see, searching for the best matching block within a preset search range allows for a more accurate description of the current block's motion. This helps improve decoding efficiency, as motion estimation is used to reduce redundant information in video compression. Finding the best match also allows for the exploitation of similarities between adjacent frames, better utilizing spatial correlations. This improves video compression performance and reduces video file size. By more accurately estimating motion, the video decoder can better reconstruct frames, improving video quality and detail.

[0337] In some embodiments of the present application, when the first block vector candidate list is the second candidate list, the implementation of determining the first block vector candidate list of the current block in S302 may include:

[0338] Determine a second candidate list, and use the second candidate list as the first block vector candidate list;

[0339] Determine the second candidate list, including:

[0340] A second candidate list is determined according to the second block vectors, wherein the matching blocks corresponding to the second block vectors have similar motions to the current block.

[0341] In an embodiment of the present application, the matching block corresponding to the second block vector is a block vector that has similar motion to the current block in the first round of search. This means that the second block vectors are selected during the first round of search, indicating that they have similar motion to the current block. Based on these matching blocks with similar motion, a second candidate list can be constructed. Specifically, the second block vector usually forms a candidate block pair together with its corresponding matching block. The matching block of this candidate block pair has similar motion to the current block and can therefore be considered as a potential motion vector. The information of these candidate block pairs is organized into a second candidate list for use in subsequent steps. The construction of the second candidate list is to more finely locate blocks with similar motion to improve the accuracy of motion estimation. Such a two-round search strategy can better adapt to different motion scenes in the video while ensuring a certain computational efficiency.

[0342] In some embodiments of the present application, the second candidate list includes one or more of the following:

[0343] One or more block vectors corresponding to respective spatially adjacent candidate blocks;

[0344] a block vector corresponding to each of one or more spatial non-adjacent candidate blocks;

[0345] One or more IBC historical block vector caches;

[0346] an average block vector corresponding to one or more block vectors currently in the second candidate list;

[0347] One or more predefined block vectors based on the size of the current block;

[0348] One or more relocated block vectors constructed based on the first candidate block vector.

[0349] In an embodiment of the present application, the block vectors corresponding to the spatially adjacent candidate blocks are: the spatially adjacent candidate blocks refer to blocks that are adjacent to the current block in the image space. In video encoding and decoding or image processing, "spatial" is usually used to represent adjacent areas in an image. Therefore, spatially adjacent blocks refer to blocks that are adjacent to the current block in the image. The selection of adjacent blocks usually depends on the specific application scenario and algorithm. For example, four adjacent blocks above, below, left and right of the current block can be selected, or a more complex spatial proximity relationship can be used. The block vectors (motion vectors) of these adjacent blocks may be used as a reference in video decoding or image processing to improve compression efficiency or reconstruct images.

[0350] In the embodiment of the present application, the spatial non-adjacent candidate blocks refer to blocks that are not adjacent to the current block in the image space. For example, some blocks far away from the current block may be selected as non-adjacent candidate blocks to better capture motion and texture information.

[0351] In an embodiment of the present application, the block vector obtained by the IBC historical block vector cache refers to a block vector obtained through the information stored in the historical block vector cache. In video decoding, IBC (intra-frame block copy) is a technology that allows a block in the current frame to be directly copied from a block in the previous frame without motion estimation. These historical block vector caches store block vector information in past frames for use in the current frame. When the information stored in the historical block vector cache is chosen to be used, the system checks whether there is a block similar to the current block in the cache, and then directly uses the block vector as the block vector of the current block. This can reduce the computational overhead of motion estimation and improve decoding efficiency in some cases. The actual effect of this method may be affected by factors such as the content of the video sequence, the nature of the motion, and the caching strategy.

[0352] In an embodiment of the present application, the average block vector corresponding to the block vectors already in the current second candidate list refers to the average block vector formed by the block vectors already in the second candidate list in the current processing stage. Generally, in order to improve decoding efficiency, the system may consider using some already determined block vectors when processing the current block. These block vectors may be obtained in the previously processed frame. Averaging these existing block vectors can obtain an average block vector, which represents the average motion characteristics of known similar blocks. The purpose of using the average block vector is to improve the accuracy and efficiency of motion estimation when there is a certain similarity between the current block and the previous block.

[0353] In the embodiments of the present application, the block vectors predefined based on the current block size refer to a set of block vectors predefined during decoding or processing based on the current block size. These block vectors are typically predefined based on the video decoding standard or specific application requirements. A set of possible block sizes and corresponding block vectors are typically defined based on certain rules and standards to accommodate motions of varying sizes. Such predefined block vectors can be used to select an appropriate motion vector for the current block during the motion estimation phase. This approach aims to reduce the complexity of motion estimation by providing a limited set of possibilities and provide sufficient flexibility in practical applications.

[0354] In an embodiment of the present application, constructing a relocated block vector based on a first candidate block vector means using the first candidate block vector to generate a set of block vectors related thereto. These block vectors are generally referred to as relocated block vectors. The relocated block vector may be a vector that is adjusted relative to the first candidate block vector to better adapt to the motion in the video sequence. This adjustment may involve spatially adjacent blocks, non-adjacent blocks, a historical block vector cache, or other information. By adjusting the first candidate block vector, a set of block vectors related thereto may be obtained. These block vectors may more accurately reflect the motion characteristics of the current block, helping to improve the accuracy of motion estimation and thereby improve the efficiency of video decoding.

[0355] It is understandable that the contents of the second candidate list listed above provide diverse block vectors. Selecting appropriate block vectors from these sources as needed can improve the accuracy and stability of motion estimation, thereby improving the effect of video decoding or image processing.

[0356] In some embodiments of the present application, determining a second candidate list according to the second block vector includes S501 to S504:

[0357] S501: parse the code stream and determine the first maximum list length.

[0358] In the embodiment of the present application, the decoder parses the code stream and obtains the first maximum list length to indicate the maximum list length of the second candidate list.

[0359] S502 : For the current second block vector in the second block vectors, add the current second block vector to the current second candidate list to obtain an updated current second candidate list.

[0360] In this embodiment of the present application, the decoder first selects the current second block vector as a candidate based on a previous motion estimation or other algorithm and adds the selected current second block vector to the current second candidate list. Then, the decoder adds the new current second block vector to the existing second candidate list to form an updated current second candidate list.

[0361] In some embodiments of the present application, the implementation of adding the current second block vector to the current second candidate list in S502 to obtain an updated current second candidate list may include:

[0362] If the current second block vector meets the third preset condition, add the current second block vector to the current second candidate list to obtain an updated current second candidate list; or

[0363] If the current second block vector does not meet the third preset condition, the current second block vector is skipped, and the step of adding the next second block vector to the updated current second candidate list to obtain an updated next second candidate list is continued.

[0364] In an embodiment of the present application, the satisfaction of the third preset condition may mean that the current second block vector has certain specific properties or qualities, making it eligible to be added to the current second candidate list. Such a condition may be to ensure that the block vectors in the updated list have certain qualities or characteristics to improve video decoding performance. The following are some examples of possible third preset conditions:

[0365] 1) Quality standard: If the template cost of the second block vector is lower than a preset threshold, it means that the vector has good matching quality;

[0366] 2) Direction of motion vector: The motion direction or mode of the current second block vector meets a specific motion model or requirement;

[0367] 3) Stability criterion: The motion estimation result of the current second block vector is relatively stable compared to the motion estimation result of the previous frame and is not easily affected by noise or interference;

[0368] 4) Quality of the reference block: The quality of the reference block corresponding to the current second block vector meets some preset conditions, such as the clarity and texture of the reference block in the image.

[0369] It can be understood that by satisfying the third preset condition, adding the current second block vector to the current second candidate list helps ensure that the block vectors in the list have a certain quality and accuracy, thereby improving the performance of subsequent video decoding steps. This can optimize image decoding and reconstruction by selecting more reliable and accurate motion information.

[0370] In some embodiments of the present application, the third preset condition includes one or more of the following:

[0371] The reference block corresponding to the current second block vector does not exceed the search range of the Intra TMP mode;

[0372] The reference block corresponding to the current second block vector does not exceed the size of the image boundary of the current block;

[0373] The reference block corresponding to the current second block vector does not exceed the size of the reconstructed area in the current frame;

[0374] The reference block corresponding to the current second block vector does not exceed the size of the coding tree unit corresponding to the current block;

[0375] The template cost value corresponding to the current second block vector is less than or equal to a preset threshold; wherein the preset threshold is obtained according to the template cost values ​​corresponding to the block vectors added to the first block vector candidate list and / or the second block vector candidate list.

[0376] In the embodiment of the present application, the third preset condition includes the following two restrictions:

[0377] 1) Reference block position restriction

[0378] The reference block corresponding to the current second block vector does not exceed the search range of the Intra TMP mode: Ensure that the selected reference block is within the search range of intra template matching.

[0379] The reference block corresponding to the current second block vector does not exceed the size of the image boundary of the current block: preventing the selection of a reference block outside the image boundary of the current block.

[0380] The reference block corresponding to the current second block vector does not exceed the size of the reconstructed area in the current frame: the reference block is restricted to within the reconstructed area.

[0381] The reference block corresponding to the current second block vector does not exceed the size of the coding tree unit corresponding to the current block: ensure that the reference block is within the coding unit of the current block.

[0382] 2) Template cost value limit

[0383] The template cost corresponding to the current second block vector is less than or equal to a preset threshold: This ensures that the template matching cost of the selected block vector is within an acceptable range, preventing low-quality motion estimation. By setting a preset threshold, the system can filter out block vectors with excessively high template matching costs, ensuring that the selected motion vector is of high quality.

[0384] It can be understood that the above conditions help optimize the selection of reference blocks, ensuring that the selected vectors and reference blocks can provide good performance in video encoding and decoding. Limiting the location, quality, and search range of reference blocks helps prevent the selection of inappropriate motion vectors, thereby improving video decoding performance.

[0385] S503. When the number of second block vectors in the updated current second candidate list is less than the first maximum list length, continue to add the next second block vector to the updated current second candidate list to obtain an updated next second candidate list. Until the number of second block vectors in the updated next second candidate list is equal to the first maximum list length, the last updated second candidate list is used as the second candidate list.

[0386] S504 : When the number of second block vectors in the updated current second candidate list is equal to the first maximum list length, use the updated current second candidate list as the second candidate list.

[0387] In this embodiment of the present application, under initial conditions, the number of second block vectors in the updated current second candidate list is less than the first maximum list length. A check is performed for the next second block vector to determine whether it satisfies a third preset condition. If so, the next second block vector is added to the updated current second candidate list. A check is continued to determine whether the number of second block vectors in the updated current second candidate list is less than the first maximum list length. If so, the above steps are repeated, adding the next second block vector, until the number of second block vectors in the updated current second candidate list equals the first maximum list length.

[0388] It should be understood that the purpose of the above process is to limit the length of the second candidate list to control computational complexity and ensure efficient processing in subsequent processing. By adding the second block vectors one by one and checking the conditions, an updated second candidate list can be dynamically constructed to ensure that the list length remains within a controllable range.

[0389] It should be noted that S503 and S504 are parallel solutions, that is, the decoder can execute S503 or S504, and this application does not limit this.

[0390] In an embodiment of the present application, the decoder parses the bitstream to obtain necessary information. After parsing the bitstream, the decoder determines a first maximum list length, which is the maximum allowable length of the second candidate list. Furthermore, the decoder adds the current second block vector in the second block vectors to the current second candidate list, thereby obtaining an updated current second candidate list. Furthermore, if the number of second block vectors in the updated current second candidate list is less than the first maximum list length, the decoder proceeds to the next step; otherwise, the updated current second candidate list is directly used as the final second candidate list. Furthermore, if the length of the updated current second candidate list does not reach the first maximum list length, the decoder continues to add the next second block vector to the updated current second candidate list, thereby obtaining an updated next second candidate list. Furthermore, if the number of second block vectors in the updated current second candidate list is equal to the first maximum list length, the decoder uses the updated current second candidate list as the final second candidate list. This list contains second block vectors that meet preset conditions and can be used in subsequent steps.

[0391] It is understandable that by gradually constructing the second candidate list, the decoder can flexibly control the length of the list and obtain a set of second block vectors that can be used for subsequent processing when conditions are met, thereby improving the performance and effects of applications such as video decoding.

[0392] In some embodiments of the present application, the decoding method further includes:

[0393] A redundancy removal operation is performed on the added second block vector in the current second candidate list.

[0394] In some embodiments of the present application, the implementation of performing a redundancy removal operation on the added second block vector in the current second candidate list may include:

[0395] For any added second block vector in the current second candidate list, if a horizontal difference value between the current second block vector and any added second block vector is less than or equal to a fifth threshold, and a vertical difference value between the current second block vector and any added second block vector is less than or equal to the fifth threshold, performing a step of adding the current second block vector to the current second candidate list to obtain an updated current second candidate list; or

[0396] If a horizontal difference value between the current second block vector and any of the added second block vectors is greater than a fifth threshold, or a vertical difference value between the current second block vector and any of the added second block vectors is greater than the fifth threshold, the current second block vector is skipped, and the step of adding the next second block vector to the updated current second candidate list is continued to obtain an updated next second candidate list.

[0397] In the embodiment of the present application, the fifth threshold is a preset value. For example, the fifth threshold is 0.

[0398] In this embodiment of the present application, any one of the added second block vectors is selected from the current second candidate list. The horizontal and vertical differences between the current second block vector and the selected added second block vector are calculated. A determination is made as to whether the horizontal difference is less than or equal to a fifth threshold, and whether the vertical difference is less than or equal to a fifth threshold. If the determination conditions are met, i.e., the horizontal and vertical differences are both within the threshold range, the system adds the current second block vector to the current second candidate list, thereby obtaining an updated current second candidate list. The above steps are repeated for the remaining added second block vectors in the current second candidate list.

[0399] It can be understood that through this step, the decoder can further filter and update the current second candidate list based on the horizontal and vertical adjacency judgment to ensure that the second block vectors therein are more consistent or similar in position, which helps to improve the stability and quality of applications such as video decoding.

[0400] In some embodiments of the present application, the implementation of performing a redundancy removal operation on the added second block vector in the current second candidate list may include:

[0401] When the first candidate list is constructed, a redundancy removal operation is performed on the added second block vectors in the current second candidate list according to the first candidate list.

[0402] In some embodiments of the present application, performing a de-redundancy operation on the added second block vector in the current second candidate list according to the first candidate list may include:

[0403] For any added second block vector in the current second candidate list, if a horizontal difference value between the current second block vector and any added second block vector, and any added first block vector in the first candidate list, is less than or equal to a fifth threshold, and a vertical difference value between the current second block vector and any added second block vector, and any added first block vector, is less than or equal to the fifth threshold, performing a step of adding the current second block vector to the current second candidate list to obtain an updated current second candidate list; or,

[0404] If the horizontal difference between the current second block vector and any of the added second block vectors and any of the added first block vectors is greater than the fifth threshold, or the vertical difference between the current second block vector and any of the added second block vectors and any of the added first block vectors is greater than the fifth threshold, the current second block vector is skipped, and the step of adding the next second block vector to the updated current second candidate list to obtain an updated next second candidate list is continued.

[0405] It is understandable that the decoder can make judgments based on the horizontal and vertical adjacency, comprehensively consider the differences between the second block vectors and the first block vectors, and further screen and update the current second candidate list, which helps to improve the stability and quality of applications such as video encoding and decoding.

[0406] In some embodiments of the present application, the fifth threshold is related to the size of the current block and / or the vector accuracy of the current second block vector.

[0407] In this embodiment of the present application, the fifth threshold is related to the size of the current block and / or the vector precision of the current second block vector. This means that the fifth threshold may be adjusted based on the size of the processed video frame or image block and the precision level of the vector representation of the current second block vector. This correlation may be to accommodate processing requirements under different resolutions, image sizes, or codec settings.

[0408] In the embodiment of the present application, the adjustment of the fifth threshold may include the following two situations:

[0409] Case 1: Size of the current block: If the size of the video frame or image block changes, the fifth threshold may be adjusted accordingly. Larger blocks may require a larger threshold to more flexibly adapt to the differences between large-sized blocks. Smaller blocks may require a smaller threshold to more sensitively detect similarities between small-sized blocks.

[0410] Case 2: Vector precision of the second current block vector: Vector precision refers to the number of bits or precision of the quantity representation. Higher vector precision provides a more accurate representation, but may also result in small differences between adjacent blocks. Therefore, the threshold associated with vector precision can be increased appropriately at high precision to handle these small variations, while a smaller threshold may be required at low precision.

[0411] It can be understood that by adjusting the fifth threshold, the decoder can flexibly adapt to different video processing requirements in different scenarios and configurations to obtain better performance and quality.

[0412] In some embodiments of the present application, the decoding method further includes:

[0413] Adjusting the first reference value according to the size of the current block to obtain a fifth threshold;

[0414] The first reference value is adjusted according to the size of the current block to obtain a fifth threshold value, including:

[0415] When the size of the current block is greater than or equal to the first preset value, the first reference value is increased to obtain a fifth threshold; or

[0416] When the size of the current block is smaller than the first preset value, the first reference value is reduced to obtain a fifth threshold.

[0417] In the embodiment of the present application, the first reference value is adjusted by a condition related to the first preset value to obtain the fifth threshold value. This adjustment method indicates that the system may dynamically adjust the threshold value according to the size of the currently processed block to better adapt to blocks of different sizes. Specifically, there are the following two situations:

[0418] Case 1: The size of the current block is greater than or equal to the first preset value: In this case, the decoder chooses to increase the first reference value, which means that for smaller blocks, the decoder wants to increase the tolerance for differences between blocks and thus use a larger fifth threshold.

[0419] Case 2: The size of the current block is smaller than the first preset value: In contrast, in this case, the decoder chooses to lower the first reference value. This means that for larger blocks, the decoder is more concerned about smaller inter-block differences, and therefore uses a smaller fifth threshold.

[0420] It is understandable that this dynamic adjustment method helps achieve better performance and adaptability on blocks of different sizes. Depending on the size of the block, the decoder can flexibly adjust the threshold for more efficient matching and processing.

[0421] In some embodiments of the present application, the decoding method further includes:

[0422] Adjusting the second reference value according to the vector accuracy of the current second block vector to obtain a fifth threshold;

[0423] The second reference value is adjusted according to the vector accuracy of the current second block vector to obtain a fifth threshold value, including:

[0424] When the vector accuracy of the current second block vector is greater than or equal to the second preset value, the second reference value is reduced to obtain a fifth threshold; or

[0425] When the vector accuracy of the current second block vector is less than the second preset value, the second reference value is increased to obtain a fifth threshold.

[0426] In this embodiment of the present application, the adjustment of the fifth threshold may depend on the vector accuracy of the current second block vector, which may be in the following two cases:

[0427] Case 1: The vector precision of the current second block vector is greater than or equal to the second preset value: In this case, the decoder will lower the second reference value to obtain a smaller fifth threshold value. This means that the decoder pays more attention to smaller differences between blocks for vectors with higher precision.

[0428] Case 2: The vector accuracy of the current second block vector is less than the second preset value: In this case, the decoder will increase the second reference value to obtain a larger fifth threshold. This means that the system is more tolerant of differences between blocks when the vector accuracy is low.

[0429] It's understandable that this dynamic adjustment method helps achieve better performance and adaptability in situations with varying vector precision. By adjusting the threshold based on vector precision, the decoder can more flexibly handle vectors of varying precision to better match features between blocks. This helps improve the decoder's robustness and performance.

[0430] In some embodiments of the present application, when the first block vector candidate list is the third candidate list, the implementation of determining the first block vector candidate list of the current block in S302 may include:

[0431] determining a first candidate list and determining a second candidate list;

[0432] Determine a third candidate list based on the first candidate list and the second candidate list, and use the third candidate list as the first block vector candidate list;

[0433] Determining a third candidate list according to the first candidate list and the second candidate list includes:

[0434] The K first block vectors in the first candidate list and the L second block vectors in the second candidate list are merged to obtain a third candidate list; wherein K and L are positive integers greater than or equal to 1.

[0435] In some embodiments of the present application, the implementation of merging the K first block vectors in the first candidate list and the L second block vectors in the second candidate list to obtain the third candidate list may include the following two cases:

[0436] Case 1: Among the K first block vectors and L second block vectors, determine P candidate block vectors with the minimum template cost; where P is a positive integer greater than or equal to 1 and less than or equal to the sum of K and L; determine a third candidate list based on the P candidate block vectors.

[0437] In an embodiment of the present application, given K first block vectors and L second block vectors, to determine P candidate block vectors with the minimum template cost, it is usually necessary to perform template matching or other cost calculation operations on these vectors. Exemplarily, for each combination of the first block vector and the second block vector, its template matching cost or other related cost value is calculated. P combinations with the minimum cost are selected from all combinations. This may involve sorting or other selection algorithms to ensure that the selected P combinations have the minimum cost. Based on the selected P combinations, a third candidate list is constructed. This list contains P candidate block vectors with the minimum template cost. The above process involves calculating and selecting vector combinations to find P combinations with the minimum cost, and then using them as part of the third candidate list.

[0438] Case 2: For the j-th candidate block vector among the K first block vectors and the L second block vectors, add the j-th candidate block vector to the current third candidate list to obtain an updated current third candidate list; where j is a positive integer greater than or equal to 1 and less than or equal to the sum of K and L;

[0439] If the number of candidate block vectors in the updated current third candidate list is less than the second maximum list length, continue with the j+1th candidate block vector and add the j+1th candidate block vector to the updated current third candidate list to obtain an updated next third candidate list; until the number of candidate block vectors in the updated next third candidate list is equal to the second maximum list length, the last updated third candidate list is used as the third candidate list; or,

[0440] In a case where the number of candidate block vectors in the updated current third candidate list is equal to the second maximum list length, the updated current third candidate list is used as the third candidate list.

[0441] It can be understood that, on the one hand, by selecting P candidate block vectors with the minimum template cost, the candidate block vectors in the current third candidate list are ensured to be closer to the actual scene in the spatial domain, thereby improving image quality. On the other hand, considering the combination of K first block vectors and L second block vectors helps to improve the diversity of matching, enabling the algorithm to cope with different scenes and motion conditions. On the other hand, by adjusting the fifth threshold, the size of the current block and the vector precision of the second block vector are taken into account, making the selected candidate blocks more adaptable to image blocks of different sizes and precisions, thereby improving the adaptability of the algorithm. On the other hand, in the process of generating the current third candidate list, by controlling the list length, excessive redundant information is avoided, thereby improving the efficiency and speed of the algorithm. In summary, the above process helps to select the optimal set of candidate blocks when considering multiple candidate block vectors, providing better input for subsequent steps, and more accurate image processing and decoding.

[0442] In some embodiments of the present application, the decoding method further includes:

[0443] A redundancy removal operation is performed on the added candidate block vectors in the current third candidate list.

[0444] In some embodiments of the present application, the implementation of the redundancy removal operation on the added candidate block vector in the current third candidate list may include:

[0445] For any added first block vector and any added second block vector in the current third candidate list, if a difference value between the jth candidate block vector and any second block vector in the horizontal direction is less than or equal to a fifth threshold, and a difference value between the jth candidate block vector and any second block vector in the vertical direction is less than or equal to the fifth threshold, and a difference value between the jth candidate block vector and any first block vector in the horizontal direction is less than or equal to a sixth threshold, and a difference value between the jth candidate block vector and any first block vector in the vertical direction is less than or equal to the sixth threshold, performing a step of adding the jth candidate block vector to the current third candidate list to obtain an updated current third candidate list; wherein any first block vector is from the first candidate list, and any second block vector is from the second candidate list; or,

[0446] If the horizontal difference value between the j-th candidate block vector and any second block vector is greater than the fifth threshold, or the vertical difference value between the j-th candidate block vector and any second block vector is greater than the fifth threshold, or the horizontal difference value between the j-th candidate block vector and any first block vector is greater than the sixth threshold, or the vertical difference value between the j-th candidate block vector and any first block vector is greater than the sixth threshold, the j-th candidate block vector is skipped and the step of adding the j+1-th candidate block vector to the updated current third candidate list is continued to obtain an updated next third candidate list.

[0447] In this embodiment of the present application, two thresholds, a fifth threshold and a sixth threshold, are set in the horizontal and vertical directions for any added first block vector and any added second block vector in the current third candidate list. If the jth candidate block vector's horizontal and vertical differences with any second block vector are both less than or equal to the fifth threshold, and its vertical difference with any first block vector is less than or equal to the sixth threshold, the jth candidate block vector is added to the current third candidate list. Otherwise, if the jth candidate block vector's horizontal and vertical differences with any second block vector are greater than the fifth threshold, or if the jth candidate block vector's horizontal and vertical differences with any first block vector are greater than the sixth threshold, the jth candidate block vector is skipped and the next candidate block vector is added to the updated current third candidate list. By iterating this process for any added first block vector and any added second block vector, candidate block vectors that meet the matching criteria can be screened out, thereby gradually constructing an updated current third candidate list. By setting two sets of thresholds, the control over the matching process is enhanced, making the algorithm more flexible and adaptable to different scenes and motion situations.

[0448] As can be appreciated, setting horizontal and vertical difference thresholds allows for fine-tuning of candidate block vectors in the third candidate list. This eliminates candidate block vectors that do not meet specific criteria, thereby improving matching accuracy. The introduction of the fifth and sixth thresholds reduces the risk of mismatches due to factors such as image noise or motion blur. The difference value settings can better adapt to different image scenes and motion conditions, resulting in more reliable matching results. Adjusting the fifth and sixth thresholds allows for flexible adaptation to different scenarios and requirements. This adjustability enables the algorithm to perform well under diverse conditions, broadening its applicability. By carefully controlling the matching conditions, the algorithm is more likely to perform robust matches even in the presence of poor image quality or partial occlusion, thereby enhancing its robustness. Overall, the above steps beneficially improve the accuracy, robustness, and adaptability of the matching process, enabling subsequent steps to be based on more reliable information, thereby improving video decoding and image processing.

[0449] In some embodiments of the present application, the fifth threshold is related to the size of the current block and / or the block-level flag of the reference block indicated by the j-th candidate block vector.

[0450] In an embodiment of the present application, the fifth threshold is related to the size of the current block and / or the block-level flag of the reference block indicated by the j-th candidate block vector, indicating that the threshold may be adjusted according to the size of the current block or the block-level flag of the reference block. Specifically, the block-level flag is generally used to indicate the type of reference block, which may include intra-block and inter-block. These two types of blocks have different characteristics in motion estimation and compensation. In practical applications, in order to adapt to different types of blocks, the fifth threshold can be adjusted according to the information of the block-level flag to better adapt to the characteristics of different block types.

[0451] For example, for intra-frame blocks, since they generally have greater similarity and lower motion variation, a smaller fifth threshold may be selected to be more tolerant to differences in the horizontal and vertical directions. However, for inter-frame blocks, since they may contain greater motion, a larger fifth threshold may be required to reduce the risk of mismatching.

[0452] It can be understood that by considering the size of the current block and the block-level flag of the reference block, the accuracy and robustness of the matching can be better balanced in different scenarios, thereby improving the adaptability of the algorithm.

[0453] In some embodiments of the present application, the decoding method further includes:

[0454] Adjusting the third reference value according to the size of the current block to obtain a sixth threshold;

[0455] The third reference value is adjusted according to the size of the current block to obtain a sixth threshold value, including:

[0456] When the size of the current block is greater than or equal to the third preset value, the third reference value is increased to obtain a sixth threshold; or

[0457] When the size of the current block is smaller than the third preset value, the third reference value is reduced to obtain a sixth threshold.

[0458] In an embodiment of the present application, when the size of the current block is greater than or equal to the third preset value, the sixth threshold is obtained by increasing the third reference value; conversely, when the size of the current block is less than the third preset value, the sixth threshold is obtained by lowering the third reference value. Such an adjustment mechanism can make the sixth threshold flexible for blocks of different sizes and better adapt to blocks of different sizes. For example, for smaller blocks, stricter matching conditions may be required, so increasing the sixth threshold helps limit differences; while for larger blocks, some differences can be more tolerated, so lowering the sixth threshold helps improve robustness. Such a dynamic adjustment mechanism helps optimize the performance of the matching algorithm in scenarios of different sizes and improves the flexibility and adaptability of the algorithm.

[0459] In some embodiments of the present application, the decoding method further includes:

[0460] Adjusting the fourth reference value according to the block-level flag of the reference block indicated by the j-th candidate block vector to obtain a sixth threshold;

[0461] Adjusting the fourth reference value according to the block-level flag of the reference block indicated by the j-th candidate block vector to obtain a sixth threshold value includes:

[0462] When the block-level flag indicates that the reference block corresponding to the j-th candidate block vector satisfies a preset prediction mode and / or preset block feature, the fourth reference value is reduced to obtain a sixth threshold; or

[0463] When the block-level flag indicates that the reference block corresponding to the j-th candidate block vector does not satisfy the preset prediction mode and / or preset block feature, the fourth reference value is increased to obtain a sixth threshold.

[0464] In an embodiment of the present application, when the block-level flag indicates that the reference block corresponding to the j-th candidate block vector satisfies a preset prediction mode and / or preset block characteristics, lowering the fourth reference value can obtain the sixth threshold value; conversely, if the block-level flag indicates that the reference block corresponding to the j-th candidate block vector does not satisfy the preset prediction mode and / or preset block characteristics, then increasing the fourth reference value can obtain the sixth threshold value. This mechanism enables the adjustment of the sixth threshold value to be adaptive according to the characteristics of the reference block. If the reference block meets the preset conditions, lowering the fourth reference value helps lower the sixth threshold value, making the matching algorithm more tolerant; conversely, if the reference block does not meet the preset conditions, increasing the fourth reference value helps increase the sixth threshold value, making the matching algorithm more stringent. Such a mechanism helps adjust the sensitivity of the matching algorithm according to the characteristics of the reference block, making the matching more accurate and adaptable to different types of reference blocks.

[0465] In some embodiments of the present application, the candidate block vectors in the first block vector candidate list and the second block vector candidate list are both integer pixel precision; the decoding method further includes:

[0466] In the case that any candidate block vector in the first block vector candidate list and the second block vector candidate list has fractional pixel precision, a precision conversion process is performed on any candidate block vector so that any candidate block vector has integer pixel precision.

[0467] In this embodiment of the present application, for any candidate block vector in the first block vector candidate list or the second block vector candidate list, if it is originally represented with fractional pixel precision, a precision conversion process is performed to convert it to integer pixel precision. Fractional pixel precision generally means that the value of a coordinate or vector can be a decimal, that is, it includes a fine part after the decimal point. Integer pixel precision, on the other hand, only contains integer values, without decimal parts.

[0468] In embodiments of the present application, the purpose of precision conversion may be to normalize coordinates or vectors to better adapt to or match image processing requirements. This process may include rounding off coordinates or vectors that originally had decimal precision to obtain integer values, thereby simplifying subsequent processing or meeting specific algorithm requirements.

[0469] Understandably, integer pixel coordinates are easier to calculate and process in many image processing algorithms. Converting coordinates to integer precision can reduce computational complexity and improve algorithm execution efficiency. Integer pixel coordinates typically require less storage space because they eliminate the need to store fractional values. This can be beneficial for memory-sensitive applications. In some image processing tasks, integer pixel coordinates can be more easily aligned with the image's pixel grid, which can be helpful for matching and alignment tasks. If an entire algorithm or process requires integer pixel precision for input or intermediate result coordinates, converting to integer pixel precision can maintain algorithm consistency.

[0470] In another embodiment of the present application, referring to FIG16 , a schematic flow chart of an encoding method provided by the embodiment of the present application is shown. As shown in FIG16 , the method may include S601 to S604:

[0471] S601. Determine a prediction mode adopted by a current block, and determine first syntax element information according to the prediction mode adopted by the current block; wherein the first syntax element information is used to indicate whether the current block adopts an intra template matching prediction mode.

[0472] It should be noted that the encoding method of the embodiment of the present application is applied to an encoder. Furthermore, the encoding method may specifically refer to a method for expanding intra-frame template matching candidates. Specifically, in the intra-frame template matching prediction mode, this method primarily addresses a technical improvement in constructing a candidate list. More specifically, it may be a mode prediction method based on IntraTMP technology to avoid the problem of low diversity of candidate block vectors in related technologies, thereby affecting encoding efficiency.

[0473] In some embodiments of the present application, the implementation of determining the prediction mode adopted by the current block in S601 may include S6011 to S6013:

[0474] S6011. Use multiple candidate prediction modes to pre-encode the current block to obtain loss values ​​corresponding to each of the multiple candidate prediction modes; wherein the multiple candidate prediction modes include a prediction mode of intra-frame template matching.

[0475] S6012: Perform rate-distortion cost calculation on the loss values ​​corresponding to the multiple candidate prediction modes to obtain rate-distortion cost values ​​corresponding to the multiple candidate prediction modes.

[0476] S6013: Determine a prediction mode for the current block according to rate-distortion cost values ​​corresponding to each of the multiple candidate prediction modes.

[0477] In some embodiments of the present application, the implementation of determining the prediction mode used for the current block according to the rate-distortion cost values ​​corresponding to the multiple candidate prediction modes in S6013 includes:

[0478] When the rate-distortion cost value corresponding to the intra template matching prediction mode is less than or equal to the rate-distortion cost values ​​corresponding to the candidate prediction modes other than the intra template matching prediction mode among the multiple candidate prediction modes, determining that the current block adopts the intra template matching prediction mode;

[0479] When the rate-distortion cost value corresponding to the intra template matching prediction mode is greater than the rate-distortion cost value corresponding to any candidate prediction mode other than the intra template matching prediction mode among multiple candidate prediction modes, it is determined that the current block does not adopt the intra template matching-based prediction mode.

[0480] In some embodiments of the present application, the implementation of determining the first syntax identification information according to the prediction mode adopted by the current block in S601 may include:

[0481] When it is determined that the current block adopts the prediction mode based on intra template matching, the value of the first syntax element information is set to the first value; or

[0482] When it is determined that the current block does not adopt the prediction mode based on intra template matching, the value of the first syntax element information is set to the second value.

[0483] It should be noted that in the embodiment of the present application, the first value and the second value are different, and the first value and the second value can be in parameter form or in digital form. Specifically, the first syntax identification information can be a parameter written in the profile or a flag value, which is not specifically limited here.

[0484] Exemplarily, for the first value and the second value, the first value can be set to 1 and the second value can be set to 0; or, the first value can be set to 0 and the second value can be set to 1; or, the first value can be set to true and the second value can be set to false; or, the first value can be set to false and the second value can be set to true; but this is not specifically limited here.

[0485] In an embodiment of the present application, taking the flag written into the bitstream as an example, assuming that the first value is set to 1 (true) and the second value is set to 0 (false), if the value of the first syntax identification information is 0 (false), then it can be determined that the current block does not adopt the intra-frame template matching prediction mode, that is, there is no need to execute the encoding method of the embodiment of the present application; if the value of the first syntax identification information is 1 (true), then it can be determined that the current block adopts the intra-frame template matching prediction mode, that is, it may be necessary to execute the encoding method of the embodiment of the present application.

[0486] In some embodiments of the present application, the encoding method further includes: encoding the first syntax element information, and writing the obtained encoding bits into a bitstream.

[0487] In some embodiments of the present application, the encoding method further includes: determining second syntax element information when the prediction mode adopted by the current block is a prediction mode based on intra-frame template matching; wherein the second syntax element information is used to indicate the prediction mode based on intra-frame template matching adopted by the current block;

[0488] The second syntax element information is coded, and the obtained coded bits are written into a bitstream.

[0489] In some embodiments of the present application, the encoding method further includes: determining a prediction difference value of the current block based on the prediction value of the current block and the original value of the current block; and determining a reconstructed value of the current block based on the prediction value of the current block and the prediction difference value of the current block.

[0490] In an embodiment of the present application, the predicted value of the current block and the predicted difference value of the current block may be added to obtain a reconstructed value of the current block.

[0491] In the embodiment of the present application, the difference between the original value of the current block and the predicted value of the current block is used as the predicted difference value of the current block.

[0492] It's understandable that, on the one hand, the prediction difference is one of the key pieces of information transmitted during the encoding process. By predicting the original block and transmitting only the difference, the bitstream size can be reduced, achieving video compression. On the other hand, at the encoding end, the combination of the prediction value and the prediction difference allows for more efficient reconstruction of the original block, reducing the computational and storage overhead required for encoding. On the other hand, the appropriate combination of the prediction value and the prediction difference can maintain video quality while compressing, making the encoded image close to the original.

[0493] In some embodiments of the present application, the encoding method further includes: encoding the prediction difference and writing the obtained encoding bits into the bit stream.

[0494] S602. When the prediction mode of the current block is the intra-frame template matching prediction mode, determine the first block vector candidate list of the current block; wherein the first block vector candidate list is determined according to the first candidate list constructed based on the template matching technology and / or the second candidate list constructed based on the merge candidate technology.

[0495] In the embodiment of the present application, the construction of the first block vector candidate list relies on two key information sources, namely the following two:

[0496] 1) First Candidate List: This means that the first candidate list searches for the block most similar to the current block within the reference frame using template matching. Template matching compares pixel values ​​or other features between blocks to find the most similar blocks and generates a first candidate list containing multiple block vectors obtained through template matching.

[0497] 2) Second Candidate List: This indicates that the first block vector candidate list may also have been constructed using a merge candidate technique. In video coding, merging typically involves combining information from adjacent blocks or other blocks to reduce redundancy and improve coding efficiency. This technique can be used to construct a second candidate list containing multiple merged block vectors.

[0498] In some embodiments of the present application, the first block vector candidate list includes any one of the following:

[0499] A first candidate list; wherein the first candidate list is determined by performing intra-frame template matching on a preset search range corresponding to the current block;

[0500] A second candidate list; wherein the second candidate list is determined by merging block vectors corresponding to one or more candidate blocks having similar motion to the current block;

[0501] The third candidate list is determined based on the first candidate list and the second candidate list.

[0502] In this embodiment of the present application, the first candidate list is determined by performing intra-frame template matching on a preset search range corresponding to the current block. That is, the system (encoder) performs intra-frame template matching within the predefined search range to find the block vector that is most similar to the current block and construct the first candidate list.

[0503] It can be understood that the first candidate list is generated by searching for similar blocks within the search range within the frame, calculating block vectors, and generating a list containing multiple candidate block vectors to provide options for different motion hypotheses. This list construction is part of motion estimation in video coding and helps improve the accuracy of the current block motion.

[0504] In an embodiment of the present application, the second candidate list is determined by merging block vectors corresponding to one or more candidate blocks having similar motion to the current block. The merging method may involve adjacent blocks, historical cache blocks, etc., and the second candidate list is obtained by merging these block vectors.

[0505] It can be understood that the construction of the second candidate list provides more comprehensive motion information by combining the block vectors corresponding to candidate blocks with similar motion, thereby enhancing the modeling and prediction of the current block's motion. This list construction is part of motion estimation in video coding, helping to improve coding efficiency and video quality.

[0506] In the embodiment of the present application, the third candidate list is determined based on the first candidate list and the second candidate list, which means that the construction of the third candidate list may combine the information of the first two lists and comprehensively consider the results of intra-frame template matching and motion merging.

[0507] It is understandable that the third candidate list is constructed to improve video coding performance by integrating information from different sources to provide richer and more diverse motion vector options. This comprehensive approach helps to more accurately predict motion in different scenarios, improving coding efficiency and video quality.

[0508] It can be understood that, on the one hand, the combined use of intra-frame template matching and merging techniques can improve the accuracy of the current block's motion. Intra-frame template matching considers spatial similarity, while merging allows for richer motion information to be obtained from adjacent blocks. On the other hand, combining different candidate lists helps adapt to different scenarios and motion characteristics. Intra-frame template matching is more suitable for static or slowly changing areas, while merging may be more effective for rapidly moving or dynamically changing areas. On the other hand, considering different candidate lists can more effectively select block vectors, thereby improving video coding efficiency. Reducing the residual difference between a block and a reference block helps reduce bitrate. By utilizing multiple sources of information, this integrated approach can better handle complex scenes, such as those with rapid motion and rich textures. Overall, the above process aims to fully utilize different techniques and information to improve video coding performance, reduce distortion, and provide better visual quality. However, the specific results depend on implementation details and application scenarios.

[0509] In some embodiments of the present application, the first block vector candidate list includes the following cases:

[0510] Case 1: When the first block vector candidate list is the first candidate list, the first candidate block vector includes:

[0511] All candidate block vectors in the first candidate list; or

[0512] M candidate block vectors with minimum template costs in the first candidate list; where M is a positive integer greater than or equal to 1.

[0513] As can be appreciated, considering all candidate block vectors in the first candidate list provides a more comprehensive range of motion vector options, which helps more accurately simulate and predict video block motion during encoding, thereby improving coding efficiency and video quality. Furthermore, limiting the number of candidate block vectors considered helps reduce the computational burden, particularly when computing resources are limited. Selecting the M candidate block vectors with the lowest template cost can maintain coding efficiency to a certain extent while reducing computational complexity.

[0514] Case 2: When the first block vector candidate list is the second candidate list, the first candidate block vector includes:

[0515] All candidate block vectors in the second candidate list; or

[0516] N candidate block vectors with minimum template costs in the second candidate list; where N is a positive integer greater than or equal to 1.

[0517] Case 3: When the first block vector candidate list is the third candidate list, the first candidate block vector includes:

[0518] All candidate block vectors in the first candidate list and all candidate block vectors in the second candidate list; or

[0519] The M candidate block vectors with the minimum template cost in the first candidate list and all candidate block vectors in the second candidate list; or

[0520] All candidate block vectors in the first candidate list and N candidate block vectors with minimum template costs in the second candidate list;

[0521] The M candidate block vectors with minimum template costs in the first candidate list and the N candidate block vectors with minimum template costs in the second candidate list;

[0522] H candidate block vectors with minimum template costs are obtained by combining all candidate block vectors in the first candidate list and all candidate block vectors in the second candidate list; where H is a positive integer greater than or equal to 1.

[0523] More specifically, when the first block vector candidate list is the third candidate list, the encoder can first construct the first candidate list, then construct the second candidate list, relocate the block of the first candidate block vector in the second candidate list, obtain an updated second candidate list, and then merge the updated second candidate list with the first candidate list to obtain the final second block vector candidate list.

[0524] As can be appreciated, providing all candidate block vectors in both the first and second candidate lists contains more motion information. This helps improve the comprehensiveness and accuracy of motion estimation, thereby improving video coding efficiency and quality. Limiting the number of candidate block vectors in the first candidate list reduces the computational burden to a certain extent. At the same time, retaining all candidate block vectors in the second candidate list provides more motion information. While providing all candidate block vectors in the first candidate list and limiting the number of candidate block vectors in the second candidate list reduces computational complexity, the optimal candidate block vector in the second candidate list is still considered. The combined approach simultaneously limits the number of candidate block vectors in both lists, allowing for more precise control of computational complexity. At the same time, the candidate block vector with the lowest template cost in both lists is retained. By merging the candidate block vectors in the two lists and selecting the H candidate block vectors with the lowest template cost after merging, information from both lists is integrated. This helps provide more comprehensive and accurate motion estimation. Overall, these selection approaches offer the benefit of offering different trade-offs to meet the varying requirements of coding systems for computational burden, motion estimation accuracy, and real-time performance. Choosing the method that best suits the specific application scenario helps optimize video encoding performance.

[0525] S603 : Determine a second block vector candidate list based on the first block vector candidate list; wherein the second block vector candidate list includes a relocated block vector constructed from the first candidate block vector in the first block vector candidate list.

[0526] In the embodiment of the present application, the composition of the second block vector candidate list includes the following situations:

[0527] Case 1: the block vector in the first candidate list (the list corresponding to template matching), and the relocated block vector corresponding to the first candidate block vector in the first candidate list;

[0528] Case 2: The block vector in the second candidate list (Merge list), and the relocated block vector corresponding to the first candidate block vector in the second candidate list;

[0529] Case 3: The block vector in the first candidate list (the list corresponding to template matching), the block vector in the second candidate list (Merge list), and the relocated block vector corresponding to the first candidate block vector in the second candidate list;

[0530] Case 4: the block vector in the first candidate list (the list corresponding to template matching), the block vector in the second candidate list (Merge list), and the relocated block vector corresponding to the first candidate block vector in the first candidate list;

[0531] Case 5: The block vector in the first candidate list (the list corresponding to template matching), the block vector in the second candidate list (Merge list), the relocated block vector corresponding to the first candidate block vector in the second candidate list, and the relocated block vector corresponding to the first candidate block vector in the first candidate list.

[0532] It should be noted that the composition of the second block vector candidate list listed above is only an example, and other methods may be included in practical applications, and the embodiments of the present application do not impose any limitation on this.

[0533] S604: Determine a prediction value of the current block based on the second block vector candidate list.

[0534] In some embodiments of the present application, the implementation of determining the prediction value of the current block based on the second block vector candidate list in S604 may include S6041 to S6043:

[0535] S6041. Determine a prediction mode based on intra-frame template matching adopted by the current block.

[0536] S6042 . Perform template matching on each of the second candidate block vectors in the second block vector candidate list to obtain a third block vector candidate list.

[0537] In some embodiments of the present application, performing template matching on each of the second candidate block vectors in the second block vector candidate list to obtain the third block vector candidate list in S6042 may include:

[0538] For any second candidate block vector among the second candidate block vectors, determining a neighborhood area of ​​any second candidate block vector according to index identification information of any second candidate block vector;

[0539] Searching in a neighborhood area of ​​any second candidate block vector with a preset step size to obtain a second matching block vector corresponding to any second candidate block vector;

[0540] Determine a third block vector having a minimum template cost among the second matching block vectors corresponding to any second candidate block vector;

[0541] A third block vector candidate list is determined according to the third block vector corresponding to the second candidate block vector.

[0542] It should be noted that the relevant explanation of S6042 can refer to the description in S3042 in the previous text, and will not be repeated here.

[0543] As can be appreciated, performing a detailed search and template matching within the neighborhood of the second candidate block vector allows for a more accurate estimation of the third block vector, thereby improving overall motion estimation accuracy. Dynamically determining the neighborhood for each second candidate block vector based on its index identification information helps adapt to varying video content and motion characteristics. This makes the algorithm more versatile and capable of performing well in various scenarios. While the search with a preset step size can be performed within a larger neighborhood, once the second matching block vector is obtained, the third block vector with the minimum template cost will typically fall within a smaller area, reducing the scope of further searches and improving search efficiency. Furthermore, performing template matching within the neighborhood of the second matching block vector to determine the third block vector with the minimum template cost helps refine the matching results, ensuring more accurate motion estimation. Overall, the above process, through multiple rounds of search and matching, improves the accuracy and robustness of motion estimation, contributing to improved video coding performance.

[0544] S6043. Determine a prediction value of the current block according to the intra-frame template matching-based prediction mode adopted by the current block and the third block vector candidate list.

[0545] In the embodiment of the present application, the prediction mode based on intra-frame template matching adopted by the current block can be: IntraTMP fusion prediction technology, IntraTMP multiple candidate technology, etc., and the embodiment of the present application does not impose any limitation on this.

[0546] In an embodiment of the present application, the results of template matching and the prediction mode are used to match and predict the information of adjacent blocks to estimate the content of the current block, which helps to improve the efficiency and compression performance of video encoding, especially when the scene changes are small.

[0547] It can be understood that, on the one hand, the third block vector candidate list is obtained by performing template matching on each second candidate block vector in the second block vector candidate list. Such a multi-round search process helps to select the most matching block vector in the candidate blocks, thereby improving the prediction accuracy. On the other hand, the generation of the third block vector candidate list takes into account the matching results of multiple candidate blocks, thereby improving the robustness to noise and interference. By combining multiple candidate block vectors, the impact of a single matching result can be reduced. On the other hand, by utilizing the prediction mode of intra-frame template matching, combined with the third block vector candidate list, the content of the current block can be more accurately estimated, thereby improving the efficiency and compression performance of video encoding. The prediction value generation process is based on multiple rounds of template matching and precise block vector selection, which helps to improve the quality of the video, reduce estimation errors, and make the encoded image closer to the original image.

[0548] In an embodiment of the present application, a coding method is provided, comprising: determining a prediction mode used by a current block, and determining first syntax element information based on the prediction mode used by the current block; wherein the first syntax element information is used to indicate whether the current block uses an intra-frame template matching prediction mode; if the prediction mode of the current block is an intra-frame template matching prediction mode, determining a first block vector candidate list for the current block; wherein the first block vector candidate list is determined based on a first candidate list constructed based on a template matching technique and / or a second candidate list constructed based on a merge candidate technique; determining a second block vector candidate list based on the first block vector candidate list; wherein the second block vector candidate list includes a relocated block vector constructed for the first candidate block vector in the first block vector candidate list; and determining a prediction value for the current block based on the second block vector candidate list. On the one hand, by constructing relocated block vectors for the first candidate block vectors in the first block vector candidate list to determine the second block vector candidate list, further refinement or adjustment of the first candidate block vectors in the first block vector candidate list is achieved, thereby increasing the diversity of the candidate block vectors, more accurately describing motion information, and improving the accuracy of motion estimation. On the other hand, the first block vector candidate list is determined based on the first candidate list constructed based on the template matching technology and / or the second candidate list constructed based on the merged candidate technology, which improves the diversity of the candidate list and is conducive to the subsequent expansion of candidate block vectors, so that suitable block vectors can be selected more effectively during the encoding process, thereby improving the diversity of candidate block vectors and reducing the transmission of redundant information, thereby improving the efficiency of encoding.

[0549] It can be appreciated that the first candidate list constructed based on template matching technology and / or the second candidate list constructed based on merged candidate technology can improve the accuracy of the prediction of the current block content, facilitate more precise estimation of block content in video prediction, and reduce prediction error. The generation of the first block vector candidate list takes into account multiple factors, including template matching and merged candidate technology. This comprehensive consideration helps adapt to different video scenarios, making the prediction mode more flexible and adaptable. The generation process of the first block vector candidate list, through multiple rounds of search and matching, can better capture the motion relationships between blocks, thereby reducing prediction overhead and improving prediction efficiency. With more accurate prediction values, the original block can be more accurately reconstructed at the encoding end, thereby improving video quality. This helps reduce distortion and maintain a high-quality visual experience. The second block vector candidate list, particularly the relocated block vectors, can more effectively represent the motion information of the current block, thereby achieving better compression performance while maintaining video quality. Overall, the above process can improve prediction accuracy, adapt to different scenarios, reduce prediction overhead, improve video quality, and optimize overall compression performance.

[0550] In some embodiments of the present application, the implementation of determining the second block vector candidate list based on the first block vector candidate list may include: determining a first candidate block vector in the first block vector candidate list; wherein the first candidate block vector is all or part of the candidate block vectors in the first block vector candidate list; and constructing a repositioning block vector for the first candidate block vector to obtain a second block vector candidate list.

[0551] In some embodiments of the present application, the steps of constructing the relocated block vectors for the first candidate block vectors to obtain the second block vector candidate list may include S701 to S704:

[0552] S701: Determine a guide block vector of the current round that meets a first preset condition from among first candidate block vectors.

[0553] In some embodiments of the present application, the first preset condition includes one or more of the following:

[0554] The template cost value corresponding to the guiding block vector is less than or equal to a second threshold value; wherein the second threshold value is obtained based on the template cost values ​​corresponding to the block vectors added to the first block vector candidate list and / or the second block vector candidate list;

[0555] The reference block corresponding to the reconstructed guide block vector;

[0556] The reference block corresponding to the guide block vector does not exceed the search range of the Intra TMP;

[0557] The reference block corresponding to the index block vector does not exceed the search range of the IBC mode.

[0558] In this embodiment of the present application, the second threshold is determined based on the template cost values ​​corresponding to the block vectors already added to the first block vector candidate list and / or the second block vector candidate list. This relationship may be used to dynamically adjust the second threshold based on previous search and matching results to adapt to the specific circumstances of the current video frame.

[0559] It should be understood that through the above mechanism, the system can adaptively determine the second threshold according to actual conditions during runtime, thereby better coping with different video frames and motion scenes, and improving the performance and adaptability of the template matching prediction mode.

[0560] It will be appreciated that, on the one hand, the second threshold mentioned in the first preset condition is obtained by considering the template cost corresponding to the added block vector, which helps control the accuracy of template matching, avoid unnecessary calculations, and select block vectors with smaller template costs, thereby improving encoding efficiency. On the other hand, if the reference block corresponding to the guide block vector has already been reconstructed in a previous encoding, repeated calculations can be avoided, redundant operations can be reduced, and encoding efficiency can be improved. On the other hand, the search range of the reference block is limited so that it does not exceed the search range of the Intra TMP or IBC mode. This helps to reduce the search space and increase the search speed, while ensuring that the selected reference block is within a reasonable range, thereby improving encoding performance.

[0561] S702: Add the relocated block vector corresponding to the guide block vector of the current round to the current second block vector candidate list to obtain an updated current second block vector candidate list.

[0562] In this embodiment of the present application, the relocated block vector corresponding to the current round's guide block vector is added to the current second block vector candidate list to update the list. Generally speaking, the current second block vector candidate list may contain multiple block vectors, each corresponding to a different reference block. By adding the relocated block vector corresponding to the current round's guide block vector to the current second block vector candidate list, more block vectors can be considered for matching, thereby improving the accuracy and effectiveness of the matching.

[0563] It is understood that utilizing previously acquired information about the guidance block vector and the relocation block vector to more comprehensively consider the selection of block vectors helps improve matching accuracy. Adding more block vectors to the candidate list may provide more options for subsequent template matching or other prediction processes, thereby increasing the likelihood of finding the best match.

[0564] It should be noted that the current second block vector candidate list may also include all or part of the block vectors inherited from the first block vector candidate list.

[0565] S703 : For any current reference block vector in the current round of reference block vectors, determine a relocation block vector corresponding to any current reference block vector according to the current reference block and / or current block corresponding to the current reference block vector.

[0566] In some embodiments of the present application, the implementation of determining the relocation block vector corresponding to any current reference block vector according to the current reference block and / or the current block corresponding to any current reference block vector in S703 may include S7031 to S7032:

[0567] S7031. Perform offset processing on any current reference block vector according to the current reference block and / or the current block to obtain a reference block offset vector corresponding to any current reference block vector.

[0568] It should be understood that by considering the offset, the position of the current block relative to the reference frame can be estimated more accurately, improving the accuracy of the position. Objects in the video may move and change, and offset processing can help the model better adapt to these changes.

[0569] In some embodiments of the present application, the reference block offset vector includes one or more of the following:

[0570] A first reference block offset vector; wherein the first reference block offset vector is used to indicate a first candidate reference block located in the middle of the current reference block;

[0571] A second reference block offset vector; wherein the second reference block offset vector is used to indicate a second candidate reference block located at the upper left position of the current reference block;

[0572] A third reference block offset vector; wherein the third reference block offset vector is used to indicate a third candidate reference block located at the lower left position of the current reference block;

[0573] A fourth reference block offset vector; wherein the fourth reference block offset vector is used to indicate a fourth candidate reference block located at the upper right position of the current reference block;

[0574] A fifth reference block offset vector; wherein the fifth reference block offset vector is used to indicate a fifth candidate reference block located at the upper right position of the current reference block.

[0575] In an embodiment of the present application, the first guide block offset vector can be expressed as CTR, the second guide block offset vector can be expressed as LT, the third guide block offset vector can be expressed as LB, the fourth guide block offset vector can be expressed as RT, and the fifth guide block offset vector can be expressed as RB.

[0576] In an embodiment of the present application, the first guide block offset vector guides the encoder to find a reference block in the middle position corresponding to the current reference block. The setting of the second guide block offset vector can guide the encoder to consider the reference block in the upper left position. The third guide block offset vector can guide the encoder to pay attention to the reference block in the lower left position. The fourth guide block offset vector helps the encoder consider the reference block in the upper right position. The fifth guide block offset vector can guide the encoder to pay attention to the reference block in the lower right position. The setting of these guide block offset vectors helps to explore possible reference block positions more comprehensively within the search area to improve the accuracy and adaptability of motion estimation. In actual applications, the settings of these guide block offset vectors can be adjusted according to the characteristics and needs of the scene.

[0577] S7032. Determine the relocation block vector corresponding to any current reference block vector based on the reference block offset vector.

[0578] In some embodiments of the present application, the implementation of determining the relocation block vector corresponding to any current reference block vector based on the reference block offset vector in S7032 may include:

[0579] In the guide block offset vector, determining a current guide block offset vector;

[0580] If the current reference block offset vector is available, determining a relocation block vector corresponding to the current reference block offset vector based on the block vector of the candidate reference block corresponding to the current reference block offset vector and the current reference block offset vector; wherein the relocation block vector corresponding to the current reference block offset vector is one of the relocation block vectors corresponding to any one of the current reference block vectors; or

[0581] In the case that the current reference block offset vector is unavailable, the current reference block offset vector is skipped and the step of determining the next reference block offset vector in the reference block offset vector is continued.

[0582] In some embodiments of the present application, if the current guide block offset vector exists, the candidate reference block indicated by the current guide block offset vector has been reconstructed, the template cost value corresponding to the current guide block offset vector is less than or equal to a first threshold, the candidate reference block indicated by the current guide block offset vector is within a preset range, and the prediction mode of the candidate reference block indicated by the current guide block offset vector is one or more of the IBC mode and the IntraTMP mode, it is determined that the current guide block offset vector is available; or,

[0583] The current guidance block offset vector is determined to be unavailable when the current guidance block offset vector does not exist, the candidate reference block indicated by the current guidance block offset vector has not been reconstructed, the template cost value corresponding to the current guidance block offset vector is greater than a first threshold, the candidate reference block indicated by the current guidance block offset vector is not within a preset range, and the prediction mode of the candidate reference block indicated by the current guidance block offset vector is not one or more of the IBC mode or the IntraTMP mode.

[0584] In the embodiment of the present application, based on the above conditions, if the current reference block offset vector meets these conditions, then the vector is considered "usable" and can be used in subsequent processing steps, such as reconstructing the block and updating the block vector list. The goal of this process is to screen candidate blocks with good performance in the template matching process to improve overall prediction accuracy.

[0585] As can be understood, by satisfying a series of conditions, the candidate reference blocks corresponding to the selected guide block offset vectors are ensured to meet requirements in all aspects, including template matching cost, location, and prediction mode. This helps improve block reconstruction accuracy, thereby enhancing overall video coding performance. Furthermore, by selectively using guide block offset vectors that meet these conditions, the computational complexity of subsequent processing is reduced. Block vectors and candidate reference blocks that do not meet these conditions can be eliminated, thereby optimizing overall algorithm performance. Furthermore, by eliminating unsuitable candidate reference blocks and block vectors, the potential for errors is reduced, thus improving stability and reliability. Furthermore, by eliminating unsuitable block vectors at an early stage, the video coding process is accelerated. This is particularly important for speed-sensitive applications such as real-time video coding and streaming. By selectively using high-quality block vectors and candidate reference blocks, encoder resources can be better utilized, thereby optimizing video coding performance.

[0586] In the embodiment of the present application, the current guide block offset vector is first determined. The guide block offset vector is a set of vectors, each vector representing an offset relative to the current reference block position. The guide block offset vector here generally includes offsets in multiple directions, such as upper left, lower left, upper right, lower right, etc. Then, based on the block vector of the candidate reference block corresponding to the current guide block offset vector and the current guide block offset vector, the relocation block vector corresponding to the current guide block offset vector is determined. This process can be divided into two cases:

[0587] Case 1: If the current reference block offset vector is available, then the relocation block vector corresponding to the current reference block offset vector is determined based on the block vector of the candidate reference block corresponding to the current reference block offset vector. This relocation block vector can be any of the relocation block vectors corresponding to the current reference block vector.

[0588] Case 2: If the current guide block offset vector is not available, the current guide block offset vector is skipped and the step of determining the next guide block offset vector in the guide block offset vector is continued. This means that in the current case, the current guide block offset vector is not considered and other available guide block offset vectors are continued to be tried.

[0589] In some embodiments of the present application, the implementation of determining the relocation block vector corresponding to the current reference block offset vector based on the block vector of the candidate reference block corresponding to the current reference block offset vector and the current reference block offset vector may include the following two cases:

[0590] Case 1: When the candidate reference block does not adopt the prediction mode of bidirectional intra block copy (IBC), the block vector of the candidate reference block corresponding to the current reference block offset vector and the current reference block vector are added to obtain the relocated block vector corresponding to the current reference block offset vector.

[0591] In an embodiment of the present application, a vector addition operation is performed on the block vector of the candidate reference block corresponding to the current reference block offset vector and the current reference block vector. The purpose of this operation is to correct the block vector of the candidate reference block, taking into account the offset of the current reference block. For example, if the block vector of the candidate reference block is represented by BV1 and the current reference block vector is represented by BV2, then the vector addition BV1+BV2 will result in a corrected block vector, i.e., the relocated block vector corresponding to the current reference block offset vector. The result of the vector addition operation is the relocated block vector corresponding to the current reference block offset vector.

[0592] It should be understood that in the above process, the block vector of the candidate reference block is corrected according to the offset information of the current reference block, so as to more accurately predict the position of the current block.

[0593] Case 2: When the candidate reference block adopts the bidirectional IBC prediction mode, a first reference block vector and a second reference block vector corresponding to the candidate reference block are determined;

[0594] Performing a vector addition operation on the first reference block vector and the current guide block vector to determine a first relocation block vector corresponding to the current guide block offset vector;

[0595] A vector addition operation is performed on the second reference block vector and the current reference block vector to determine a second relocated block vector corresponding to the current reference block offset vector.

[0596] In this embodiment of the present application, for bidirectional IBC, a block may have two reference blocks: a first reference block and a second reference block. Both reference blocks have corresponding block vectors. Therefore, the encoder needs to obtain the first reference block vector and the second reference block vector corresponding to the candidate reference block.

[0597] In this embodiment of the present application, the first relocated block vector = the first reference block vector + the current reference block vector. The second relocated block vector = the first reference block vector + the current reference block vector. By adding these two vectors, the first and second relocated block vectors corresponding to the current reference block offset vector are obtained. This more accurately represents the position of the candidate reference block in the bidirectional IBC prediction mode, helping to improve block prediction accuracy.

[0598] It's understandable that, on the one hand, the bidirectional IBC prediction mode considers reference blocks in two different directions, helping to more accurately capture the motion information of the target block. This can improve prediction accuracy, especially in complex motion scenarios. On the other hand, bidirectional IBC allows for modeling of the target block in both directions, which can better adapt to various motion patterns in complex motion scenes and improve overall video coding efficiency. Because bidirectional IBC simultaneously considers motion information in both directions, it more comprehensively covers the possible diversity of motion, allowing the encoding process to better adapt to the motion characteristics of different blocks in the video sequence.

[0599] S704: Continue to determine the next round's guide block vector that meets the first preset condition from the relocated block vectors corresponding to the current round's guide block vectors, thereby obtaining an updated next second block vector candidate list. This continues until the next round's guide block vector meets the second preset condition, and the last updated second block vector candidate list is used as the second block vector candidate list.

[0600] It should be understood that the above process is a process of determining the appropriate block vector according to preset conditions through multiple rounds of iterative screening and updating to generate the final second block vector candidate list, which helps to more accurately predict the motion information of the current block in video encoding and decoding.

[0601] In the embodiment of the present application, the second preset condition is a cutoff condition for multiple rounds of iterative screening.

[0602] In some embodiments of the present application, the second preset condition includes one or more of the following:

[0603] The next round is greater than or equal to the iteration round threshold;

[0604] The number of guidance block vectors in the next round is less than or equal to a third threshold;

[0605] A template cost value corresponding to at least one guide block vector in the next round of guide block vectors is greater than or equal to a fourth threshold;

[0606] The list length of the next second block vector candidate list updated corresponding to the next round is greater than or equal to the maximum list length threshold.

[0607] It should be noted that the second preset condition listed above is only an example. In actual application scenarios, other condition settings may also be included, and this application does not impose any limitations on this.

[0608] It can be appreciated that, on the one hand, through an iterative process, a guide block vector that meets certain conditions can be selected in each round, which may lead to more accurate block vector selection, thereby improving the accuracy of motion estimation for the current block. Adding the relocation block vector corresponding to the guide block vector of the current round to the current second block vector candidate list helps to concentrate the screened block vectors in the second block vector candidate list, reducing redundant block vector selection and improving computational efficiency. On the other hand, by adjusting the selection of guide block vectors and relocation block vectors in each round, this method may have a certain degree of flexibility and can better adapt to the changes and complexity of motion in the video. By selecting and updating block vectors according to preset conditions, motion estimation may be more efficient in terms of computational cost and avoid processing large amounts of redundant information.

[0609] In some embodiments of the present application, when the first block vector candidate list is the first candidate list, the implementation of determining the first block vector candidate list for the current block may include:

[0610] Determine a first candidate list, and use the first candidate list as a first block vector candidate list;

[0611] Determine the first candidate list, including:

[0612] Searching within a preset search range with a preset step size to obtain a first matching block vector;

[0613] Determining a first block vector having a minimum template cost among the first matching block vectors;

[0614] A first candidate list is determined according to the first block vector.

[0615] In the embodiment of the present application, the preset search range is a parameter for balancing encoding performance and computational complexity. By appropriately setting the search range, the video codec can meet performance requirements while maintaining low computational overhead.

[0616] In an embodiment of the present application, a search is performed within a given search range with a preset step size to find a block that matches the current block. During the search, the block most similar to the current block is found, and a first matching block vector is obtained. This vector represents the position offset of the matching block found during the search. For the first matching block vector, a template matching cost is calculated within the neighborhood of the matching block. The first block vector with the minimum template cost is found, indicating the best match. Using this first block vector, a first candidate list can be determined. For example, the first block vector and its related information can be added to the candidate list for subsequent processing.

[0617] As you can see, searching for the best matching block within a preset search range allows for a more accurate description of the current block's motion. This helps improve coding efficiency, as motion estimation is used to reduce redundant information in video compression. Finding the best match also allows for the exploitation of similarities between adjacent frames, better utilizing spatial correlations. This improves video compression performance and reduces video file size. By more accurately estimating motion, the video encoder can better reconstruct frames, improving video quality and detail.

[0618] In some embodiments of the present application, when the first block vector candidate list is the second candidate list, the implementation of determining the first block vector candidate list for the current block may include:

[0619] Determine a second candidate list, and use the second candidate list as the first block vector candidate list;

[0620] Determine the second candidate list, including:

[0621] A second candidate list is determined according to the second block vectors, wherein the matching blocks corresponding to the second block vectors have similar motions to the current block.

[0622] In an embodiment of the present application, the matching block corresponding to the second block vector is a block vector that has similar motion to the current block in the first round of search. This means that the second block vectors are selected during the first round of search, indicating that they have similar motion to the current block. Based on these matching blocks with similar motion, a second candidate list can be constructed. Specifically, the second block vector usually forms a candidate block pair together with its corresponding matching block. The matching block of this candidate block pair has similar motion to the current block and can therefore be considered as a potential motion vector. The information of these candidate block pairs is organized into a second candidate list for use in subsequent steps. The construction of the second candidate list is to more finely locate blocks with similar motion to improve the accuracy of motion estimation. Such a two-round search strategy can better adapt to different motion scenes in the video while ensuring a certain computational efficiency.

[0623] In some embodiments of the present application, the second candidate list includes one or more of the following:

[0624] One or more spatially adjacent candidate blocks each corresponding to a block vector;

[0625] a block vector corresponding to each of one or more spatial non-adjacent candidate blocks;

[0626] One or more IBC historical block vector caches;

[0627] an average block vector corresponding to one or more block vectors currently in the second candidate list;

[0628] One or more predefined block vectors based on the size of the current block;

[0629] One or more relocated block vectors constructed based on the first candidate block vector.

[0630] It is understandable that the contents of the second candidate list listed above provide diverse block vectors. Selecting appropriate block vectors from these sources as needed can improve the accuracy and stability of motion estimation, thereby improving the effect of video encoding or image processing.

[0631] In some embodiments of the present application, determining a second candidate list according to the second block vector includes S801 to S804:

[0632] S801: Determine a first maximum list length.

[0633] In this embodiment of the present application, the first maximum list length is used to indicate the maximum list length of the second candidate list.

[0634] In some embodiments of the present application, the first maximum list length is encoded, and the encoded bits are written into a bitstream.

[0635] S802 : For the current second block vector in the second block vectors, add the current second block vector to the current second candidate list to obtain an updated current second candidate list.

[0636] In some embodiments of the present application, the implementation of adding the current second block vector to the current second candidate list in S802 to obtain an updated current second candidate list may include:

[0637] If the current second block vector meets the third preset condition, add the current second block vector to the current second candidate list to obtain an updated current second candidate list; or

[0638] If the current second block vector does not meet the third preset condition, the current second block vector is skipped, and the step of adding the next second block vector to the updated current second candidate list to obtain an updated next second candidate list is continued.

[0639] It can be understood that by satisfying the third preset condition, adding the current second block vector to the current second candidate list helps ensure that the block vectors in the list have a certain quality and accuracy, thereby improving the performance of subsequent video encoding steps. This can optimize image encoding and reconstruction by selecting more reliable and accurate motion information.

[0640] In some embodiments of the present application, the third preset condition includes one or more of the following:

[0641] The reference block corresponding to the current second block vector does not exceed the search range of the Intra TMP mode;

[0642] The reference block corresponding to the current second block vector does not exceed the size of the image boundary of the current block;

[0643] The reference block corresponding to the current second block vector does not exceed the size of the reconstructed area in the current frame;

[0644] The reference block corresponding to the current second block vector does not exceed the size of the coding tree unit corresponding to the current block;

[0645] The template cost value corresponding to the current second block vector is less than or equal to a preset threshold; wherein the preset threshold is obtained according to the template cost values ​​corresponding to the block vectors added to the first block vector candidate list and / or the second block vector candidate list.

[0646] It can be understood that the above conditions help optimize the selection of reference blocks, ensuring that the selected vectors and reference blocks can provide good performance in video coding. Limiting the location, quality, and search range of reference blocks helps prevent the selection of inappropriate motion vectors, thereby improving video coding performance.

[0647] S803. When the number of second block vectors in the updated current second candidate list is less than the first maximum list length, continue to add the next second block vector to the updated current second candidate list to obtain an updated next second candidate list. Until the number of second block vectors in the updated next second candidate list is equal to the first maximum list length, the last updated second candidate list is used as the second candidate list.

[0648] S804 : When the number of second block vectors in the updated current second candidate list is equal to the first maximum list length, use the updated current second candidate list as the second candidate list.

[0649] It should be understood that the purpose of the above process is to limit the length of the second candidate list to control computational complexity and ensure efficient processing in subsequent processing. By adding the second block vectors one by one and checking the conditions, an updated second candidate list can be dynamically constructed to ensure that the list length remains within a controllable range.

[0650] It should be noted that S803 and S804 are parallel solutions, that is, the encoder can execute S803 or S804, and this application does not limit this.

[0651] It is understandable that by gradually constructing the second candidate list, the encoder can flexibly control the length of the list and obtain a set of second block vectors that can be used for subsequent processing when conditions are met, thereby improving the performance and effects of applications such as video encoding.

[0652] In some embodiments of the present application, the encoding method further includes:

[0653] A redundancy removal operation is performed on the added second block vector in the current second candidate list.

[0654] In some embodiments of the present application, the implementation of performing a redundancy removal operation on the added second block vector in the current second candidate list may include:

[0655] For any added second block vector in the current second candidate list, if a horizontal difference value between the current second block vector and any added second block vector is less than or equal to a fifth threshold, and a vertical difference value between the current second block vector and any added second block vector is less than or equal to the fifth threshold, performing a step of adding the current second block vector to the current second candidate list to obtain an updated current second candidate list; or

[0656] If a horizontal difference value between the current second block vector and any of the added second block vectors is greater than a fifth threshold, or a vertical difference value between the current second block vector and any of the added second block vectors is greater than the fifth threshold, the current second block vector is skipped, and the step of adding the next second block vector to the updated current second candidate list is continued to obtain an updated next second candidate list.

[0657] It can be understood that through this step, the encoder can further screen and update the current second candidate list based on the horizontal and vertical adjacency judgment to ensure that the second block vectors therein are more consistent or similar in position, which helps to improve the stability and quality of applications such as video encoding.

[0658] In some embodiments of the present application, the implementation of performing a redundancy removal operation on the added second block vector in the current second candidate list may include:

[0659] When the first candidate list is constructed, a redundancy removal operation is performed on the added second block vectors in the current second candidate list according to the first candidate list.

[0660] In some embodiments of the present application, performing a de-redundancy operation on the added second block vector in the current second candidate list according to the first candidate list may include:

[0661] For any added second block vector in the current second candidate list, if a horizontal difference value between the current second block vector and any added second block vector, and any added first block vector in the first candidate list, is less than or equal to a fifth threshold, and a vertical difference value between the current second block vector and any added second block vector, and any added first block vector, is less than or equal to the fifth threshold, performing a step of adding the current second block vector to the current second candidate list to obtain an updated current second candidate list; or,

[0662] If the horizontal difference between the current second block vector and any of the added second block vectors and any of the added first block vectors is greater than the fifth threshold, or the vertical difference between the current second block vector and any of the added second block vectors and any of the added first block vectors is greater than the fifth threshold, the current second block vector is skipped, and the step of adding the next second block vector to the updated current second candidate list to obtain an updated next second candidate list is continued.

[0663] It is understandable that the encoder can make judgments based on the horizontal and vertical adjacency, comprehensively consider the differences between the second block vectors and the first block vectors, and further screen and update the current second candidate list, which helps to improve the stability and quality of applications such as video encoding.

[0664] In some embodiments of the present application, the fifth threshold is related to the size of the current block and / or the vector accuracy of the current second block vector.

[0665] It can be understood that by adjusting the fifth threshold, the encoder can flexibly adapt to different video processing requirements in different scenarios and configurations to obtain better performance and quality.

[0666] In some embodiments of the present application, the encoding method further includes:

[0667] Adjusting the first reference value according to the size of the current block to obtain a fifth threshold;

[0668] The first reference value is adjusted according to the size of the current block to obtain a fifth threshold value, including:

[0669] When the size of the current block is greater than or equal to the first preset value, the first reference value is increased to obtain a fifth threshold; or

[0670] When the size of the current block is smaller than the first preset value, the first reference value is reduced to obtain a fifth threshold.

[0671] It is understandable that this dynamic adjustment method helps achieve better performance and adaptability on blocks of different sizes. Depending on the size of the block, the encoder can flexibly adjust the threshold for more efficient matching and processing.

[0672] In some embodiments of the present application, the encoding method further includes:

[0673] Adjusting the second reference value according to the vector accuracy of the current second block vector to obtain a fifth threshold;

[0674] The second reference value is adjusted according to the vector accuracy of the current second block vector to obtain a fifth threshold value, including:

[0675] When the vector accuracy of the current second block vector is greater than or equal to the second preset value, the second reference value is reduced to obtain a fifth threshold; or

[0676] When the vector accuracy of the current second block vector is less than the second preset value, the second reference value is increased to obtain a fifth threshold.

[0677] It's understandable that this dynamic adjustment method helps achieve better performance and adaptability in situations with varying vector precision. By adjusting the threshold based on vector precision, the encoder can more flexibly handle vectors of varying precision to better match features between blocks. This helps improve the robustness and performance of the encoder.

[0678] In some embodiments of the present application, when the first block vector candidate list is the third candidate list, the implementation of determining the first block vector candidate list of the current block may include:

[0679] determining a first candidate list and determining a second candidate list;

[0680] Determine a third candidate list based on the first candidate list and the second candidate list, and use the third candidate list as the first block vector candidate list;

[0681] Determining a third candidate list according to the first candidate list and the second candidate list includes:

[0682] The K first block vectors in the first candidate list and the L second block vectors in the second candidate list are merged to obtain a third candidate list; wherein K and L are positive integers greater than or equal to 1.

[0683] In some embodiments of the present application, the implementation of merging the K first block vectors in the first candidate list and the L second block vectors in the second candidate list to obtain the third candidate list may include the following two cases:

[0684] Case 1: Among the K first block vectors and L second block vectors, determine P candidate block vectors with the minimum template cost; where P is a positive integer greater than or equal to 1 and less than or equal to the sum of K and L; determine a third candidate list based on the P candidate block vectors.

[0685] In an embodiment of the present application, given K first block vectors and L second block vectors, to determine P candidate block vectors with the minimum template cost, it is usually necessary to perform template matching or other cost calculation operations on these vectors. Exemplarily, for each combination of the first block vector and the second block vector, its template matching cost or other related cost value is calculated. P combinations with the minimum cost are selected from all combinations. This may involve sorting or other selection algorithms to ensure that the selected P combinations have the minimum cost. Based on the selected P combinations, a third candidate list is constructed. This list contains P candidate block vectors with the minimum template cost. The above process involves calculating and selecting vector combinations to find P combinations with the minimum cost, and then using them as part of the third candidate list.

[0686] Case 2: For the j-th candidate block vector among the K first block vectors and the L second block vectors, add the j-th candidate block vector to the current third candidate list to obtain an updated current third candidate list; where j is a positive integer greater than or equal to 1 and less than or equal to the sum of K and L;

[0687] If the number of candidate block vectors in the updated current third candidate list is less than the second maximum list length, continue with the j+1th candidate block vector and add the j+1th candidate block vector to the updated current third candidate list to obtain an updated next third candidate list; until the number of candidate block vectors in the updated next third candidate list is equal to the second maximum list length, the last updated third candidate list is used as the third candidate list; or,

[0688] In a case where the number of candidate block vectors in the updated current third candidate list is equal to the second maximum list length, the updated current third candidate list is used as the third candidate list.

[0689] It can be understood that, on the one hand, by selecting P candidate block vectors with the smallest template cost, the candidate block vectors in the current third candidate list are ensured to be closer to the actual scene in the spatial domain, thereby improving image quality. On the other hand, considering the combination of K first block vectors and L second block vectors helps to improve the diversity of matching, enabling the algorithm to cope with different scenes and motion conditions. On the other hand, by adjusting the fifth threshold, the size of the current block and the vector precision of the second block vector are taken into account, making the selected candidate blocks more adaptable to image blocks of different sizes and precisions, thereby improving the adaptability of the algorithm. On the other hand, in the process of generating the current third candidate list, by controlling the list length, excessive redundant information is avoided, thereby improving the efficiency and speed of the algorithm. In summary, the above process helps to select the optimal set of candidate blocks when considering multiple candidate block vectors, providing better input for subsequent steps, and more accurate image processing and encoding.

[0690] In some embodiments of the present application, the encoding method further includes:

[0691] A redundancy removal operation is performed on the added candidate block vectors in the current third candidate list.

[0692] In some embodiments of the present application, the implementation of the redundancy removal operation on the added candidate block vector in the current third candidate list may include:

[0693] For any added first block vector and any added second block vector in the current third candidate list, if a difference value between the jth candidate block vector and any second block vector in the horizontal direction is less than or equal to a fifth threshold, and a difference value between the jth candidate block vector and any second block vector in the vertical direction is less than or equal to the fifth threshold, and a difference value between the jth candidate block vector and any first block vector in the horizontal direction is less than or equal to a sixth threshold, and a difference value between the jth candidate block vector and any first block vector in the vertical direction is less than or equal to the sixth threshold, performing a step of adding the jth candidate block vector to the current third candidate list to obtain an updated current third candidate list; wherein any first block vector is from the first candidate list, and any second block vector is from the second candidate list; or,

[0694] If the horizontal difference value between the j-th candidate block vector and any second block vector is greater than the fifth threshold, or the vertical difference value between the j-th candidate block vector and any second block vector is greater than the fifth threshold, or the horizontal difference value between the j-th candidate block vector and any first block vector is greater than the sixth threshold, or the vertical difference value between the j-th candidate block vector and any first block vector is greater than the sixth threshold, the j-th candidate block vector is skipped and the step of adding the j+1-th candidate block vector to the updated current third candidate list is continued to obtain an updated next third candidate list.

[0695] As can be appreciated, setting horizontal and vertical difference thresholds allows for fine-tuning of candidate block vectors in the third candidate list. This eliminates candidate block vectors that do not meet specific criteria, thereby improving matching accuracy. The introduction of the fifth and sixth thresholds reduces the risk of mismatches due to factors such as image noise or motion blur. The difference value settings can better adapt to different image scenes and motion conditions, resulting in more reliable matching results. Adjusting the fifth and sixth thresholds allows for flexible adaptation to different scenarios and requirements. This adjustability enables the algorithm to perform well under diverse conditions, broadening its applicability. By carefully controlling the matching conditions, the algorithm is more likely to perform robust matches even in the presence of poor image quality or partial occlusion, thereby enhancing its robustness. Overall, the above steps beneficially improve the accuracy, robustness, and adaptability of the matching process, enabling subsequent steps to be based on more reliable information, thereby improving video encoding and image processing.

[0696] In some embodiments of the present application, the fifth threshold is related to the size of the current block and / or the block-level flag of the reference block indicated by the j-th candidate block vector.

[0697] It can be understood that by considering the size of the current block and the block-level flag of the reference block, the accuracy and robustness of the matching can be better balanced in different scenarios, thereby improving the adaptability of the algorithm.

[0698] In some embodiments of the present application, the encoding method further includes:

[0699] Adjusting the third reference value according to the size of the current block to obtain a sixth threshold;

[0700] The third reference value is adjusted according to the size of the current block to obtain a sixth threshold value, including:

[0701] When the size of the current block is greater than or equal to the third preset value, the third reference value is increased to obtain a sixth threshold; or

[0702] When the size of the current block is smaller than the third preset value, the third reference value is reduced to obtain a sixth threshold.

[0703] In some embodiments of the present application, the encoding method further includes:

[0704] Adjusting the fourth reference value according to the block-level flag of the reference block indicated by the j-th candidate block vector to obtain a sixth threshold;

[0705] Adjusting the fourth reference value according to the block-level flag of the reference block indicated by the j-th candidate block vector to obtain a sixth threshold value includes:

[0706] When the block-level flag indicates that the reference block corresponding to the j-th candidate block vector satisfies a preset prediction mode and / or preset block feature, the fourth reference value is reduced to obtain a sixth threshold; or

[0707] When the block-level flag indicates that the reference block corresponding to the j-th candidate block vector does not satisfy the preset prediction mode and / or preset block feature, the fourth reference value is increased to obtain a sixth threshold.

[0708] In some embodiments of the present application, the candidate block vectors in the first block vector candidate list and the second block vector candidate list are both integer pixel precision; the encoding method further includes:

[0709] In the case that any candidate block vector in the first block vector candidate list and the second block vector candidate list has fractional pixel precision, a precision conversion process is performed on any candidate block vector so that any candidate block vector has integer pixel precision.

[0710] In this embodiment of the present application, for any candidate block vector in the first block vector candidate list or the second block vector candidate list, if it is originally represented with fractional pixel precision, a precision conversion process is performed to convert it to integer pixel precision. Fractional pixel precision generally means that the value of a coordinate or vector can be a decimal, that is, it includes a fine part after the decimal point. Integer pixel precision, on the other hand, only contains integer values, without decimal parts.

[0711] Understandably, integer pixel coordinates are easier to calculate and process in many image processing algorithms. Converting coordinates to integer precision can reduce computational complexity and improve algorithm execution efficiency. Integer pixel coordinates typically require less storage space because they eliminate the need to store fractional values. This can be beneficial for memory-sensitive applications. In some image processing tasks, integer pixel coordinates can be more easily aligned with the image's pixel grid, which can be helpful for matching and alignment tasks. If an entire algorithm or process requires integer pixel precision for input or intermediate result coordinates, converting to integer pixel precision can maintain algorithm consistency.

[0712] The encoding and decoding method provided by this application is described below in a specific embodiment.

[0713] In an embodiment of the present application, the IntraTMP technology can complete the prediction through the template matching process within a predefined search area, wherein the search area can be related to factors such as the position and size of the current block. In combination with the IntraTMP technology of merging candidates, it is proposed to construct a merge list as a candidate in the search process, and the motion information of adjacent coding blocks is utilized to effectively improve the effect of the IntraTMP search and improve the coding efficiency. The automatic repositioning block vector prediction (AR-BVP) technology proposes that for the IBC prediction block, the block vector of the reference block can be used to construct a new candidate block vector, which reasonably improves the diversity of block vector prediction and thus improves the coding efficiency of IBC. Combining the above two technologies, the present application proposes that the IntraTMP coding block can use the motion information of adjacent coding blocks and reference blocks to expand the template matching search process, thereby improving coding efficiency.

[0714] In the embodiment of the present application, in the IntraTMP mode, a merge candidate list is constructed for the current coding block and the intra template matching process is extended according to the candidate block vectors in the list. The decoding process is as follows:

[0715] 1) Decode the cu_intra_tmp_flag flag (equivalent to the first syntax element information). If cu_intra_tmp_flag is true, it indicates that the current block uses the IntraTMP intra-frame template matching prediction mode.

[0716] 2) Perform the first search in a predefined search area with a certain step size, for example, the horizontal step size and the vertical step size are both 3. Obtain N optimal matching block vectors with a certain spacing (the first N with the smallest template error value) as the first candidate list, including candidate block vectors T1-T N ;

[0717] 3) Construct a merge list, which can include spatially adjacent candidates, spatially non-adjacent candidates, historical candidates, average candidates, predefined candidates, etc. It can include all or part of the candidates used by the IBC mode to construct the merge list;

[0718] 4) When constructing the Merge list, the candidate block vectors can be checked for redundancy based on the first candidate list and the existing Merge list. For example, the nth candidate block vector C is obtained from the coded block or the history cache. n . C n Need to merge with the candidate C1-C already in the list n-1 Compare, if Cn With any candidate C i The horizontal absolute difference and vertical absolute difference of are both less than the threshold value X (fifth threshold), then it is considered that C n Redundant, not added to the merge list. Similarly, C n With T1-T N Compare, if C n With any candidate T i If both the horizontal and vertical absolute differences are less than the threshold Y, it is considered that C n Redundant, not added to the merge list.,Threshold Y (sixth threshold) can be related to information such as block size,,block-level flags, etc.;

[0719] 5) When constructing a merge list, the maximum length of the merge list can be expressed according to the sequence-level parameters. For example, sps_intra_tmp_merge_num is used to express the maximum length of the merge list when constructing the merge list in IntraTMP mode. If the current block is in IntraTMP mode, when constructing the merge list, the list length reaches sps_intra_tmp_merge_num, then the construction is terminated;

[0720] 6) When constructing the Merge list, it is possible to determine whether a candidate block vector can be added based on the predefined IntraTMP search area. For example, if the candidate block vector to be added exceeds the search area of ​​the current coding block, the candidate block vector will not be added; in addition, it is possible to determine whether a spatial candidate is available based on the predefined IntraTMP search area. For example, if the position of a spatial candidate is outside the search area of ​​the current coding block, the candidate block vector will not be obtained from the spatial candidate;

[0721] 7) When constructing AR-BVP candidate block vectors, the block vectors in the first candidate list and the block vectors in the Merge list can be used as guide block vectors. For example, the first N block vectors with the smallest template error in the first candidate list and the M block vectors in the Merge list are selected as guide block vectors to derive the AR-BVP (repositioned block vector). The guide block vector is combined with the reference block vector determined by the guide block vector to obtain the AR-BVP;

[0722] 8) When constructing AR-BVP candidate block vectors, multiple different offset values ​​can be applied to the reference block vector, and the presence of reference block vectors at these positions can be checked respectively, thereby constructing multiple AR-BVPs;

[0723] 9) The AR-BVP construction process can be repeated in multiple rounds. For example, the first round is the same as step 7. According to steps 7 and 8, AR-BVPs_1 is obtained. AR-BVPs_1 represents all AR-BVPs constructed and added to the Merge list in the first round. In the second round, AR-BVPs_1 is used as the guide block vector and AR-BVPs_2 is obtained according to step 8. The construction process ends when the Merge list reaches the maximum length or the number of AR-BVP_n in a certain round is 0.

[0724] 10) When constructing the Merge list, if the motion information to be merged is a bidirectional IBC prediction, the two block vectors used for the bidirectional prediction can be added in sequence. For example, when merging the motion information corresponding to the spatial domain or historical cache, the two block vectors for the bidirectional prediction are added in sequence. For example, when constructing an AR-BVP, the guide block vector points to a bidirectional IBC prediction block, and two AR-BVPs are constructed in sequence from the two block vectors for the bidirectional prediction;

[0725] 11) The merge list obtained according to steps 3-10 can be merged with the first candidate list to obtain a second candidate list. The second candidate list can be used to confirm the search area for the second round of template matching. The merge can be performed based on the template error of the block vectors. For example, if the merge list has m candidates and the first candidate list has n candidates, the template error of these m+n block vectors is used to obtain the first k block vectors, and these k block vectors form the second candidate list.

[0726] 12) Determine the neighboring regions of these block vectors based on the block vectors in the second candidate list, perform a second round of template matching, and obtain x optimal block vectors (which may include the block vectors in the second candidate list). Candidate block vectors obtained by different processes (e.g., obtained from different search areas, obtained from the Merge list) can be identified by indices. Block vectors with different identifiers in the second candidate list can have neighboring regions of different sizes and shapes.

[0727] 13) The same construction process is used at the encoding and decoding ends to obtain a consistent optimal block vector list. Based on the decoded information, the IntraTMP prediction method is determined to determine how to use the block vector list to complete the decoding of the current block.

[0728] In the embodiments of this application, a method (i.e., encoding and decoding method) combining the IntraTMP template matching process with the merge list construction process is proposed, and a method for constructing AR-BVP candidates using the IntraTMP mode is provided. This can improve the accuracy of the merge list candidate block vectors, thereby improving coding efficiency.

[0729] In the embodiments of the present application, this can be achieved without performing the first round of template matching. Specifically, a merge list is constructed and used as the first candidate list. The search area for the next round of template matching is then determined based on the first candidate list. The merge list can be reordered based on template error. For example, when constructing the merge list, candidates are added to a maximum length of N. These N candidates are reordered based on template error, retaining the first n candidates as the first candidate list.

[0730] In this embodiment, a merge list can be implemented without constructing one. Instead, block vectors obtained from the template matching process can be used as guide block vectors to construct AR-BVPs to expand the search area. For example, after the first round of search, a first candidate list is obtained. AR-BVPs can be constructed using the block vectors in the first candidate list as guide block vectors. These AR-BVPs are then merged with the first candidate list to obtain a second candidate list, which is then used for the second round of search.

[0731] In this embodiment of the present application, additional conditions may be added to the guide block vector: the template error of the guide block vector is less than a threshold, the reference block is available (reconstructed, not exceeding the boundary), and the reference area (IBC) (which can be determined by the template area size, the template error of the existing block vector candidate, etc.). If these conditions are not met, the current guide block vector is not used to construct the AR-BVP.

[0732] In an embodiment of the present application, the conditions for the availability of AR-BVP may include: AR-BVP should be within the IntraTMP search area, or should be within the reference area of ​​IBC, and the template error should be less than a threshold (which can be determined by the template area size, the template error of the existing block vector candidate, etc.).

[0733] In the embodiment of the present application, the process of constructing the Merge list may be independent of the first candidate list. For example, the first candidate list is not used to check for redundancy; the first candidate list is not used as a guide block vector, etc.

[0734] In the embodiment of the present application, the block vector involved should be of integer pixel precision. For example, if the block vector has fractional pixel precision, it can be converted to integer pixel precision by rounding.

[0735] In one embodiment of the present application, based on the same inventive concept as the aforementioned embodiment, a code stream is provided, wherein the code stream is generated by bit encoding based on information to be encoded; wherein the information to be encoded includes at least one of the following:

[0736] First syntax element information, second syntax element information, a first maximum list length, and a prediction difference value; the first syntax element information is used to indicate whether the current block adopts a prediction mode based on intra template matching; the second syntax element information is used to indicate a prediction mode based on intra template matching adopted by the current block.

[0737] In yet another embodiment of the present application, based on the same inventive concept as the aforementioned embodiment, see FIG17 , which shows a schematic diagram of the structure of a decoder provided in an embodiment of the present application. As shown in FIG17 , the decoder 1000 includes a decoding part 1001 and a first determining part 1002, wherein:

[0738] The decoding part 1001 is configured to parse the code stream and determine the first syntax element information;

[0739] The first determining portion 1002 is configured to, when the first syntax element information indicates that the current block adopts the intra template matching prediction mode, determine a first block vector candidate list for the current block; wherein the first block vector candidate list is determined based on the first candidate list constructed based on the template matching technology and / or the second candidate list constructed based on the merge candidate technology;

[0740] Determine a second block vector candidate list based on the first block vector candidate list; wherein the second block vector candidate list includes relocated block vectors constructed from the first candidate block vector in the first block vector candidate list;

[0741] Based on the second block vector candidate list, a prediction value of the current block is determined.

[0742] In some embodiments, the first determination part 1002 is further configured to determine a first candidate block vector in the first block vector candidate list; wherein the first candidate block vector is all or part of the candidate block vectors in the first block vector candidate list; and construct a repositioning block vector for the first candidate block vector to obtain the second block vector candidate list.

[0743] In some embodiments, the first determination part 1002 is further configured to determine the current round of guidance block vectors that meet the first preset condition among the first candidate block vectors; add the relocation block vector corresponding to the guidance block vector of the current round to the current second block vector candidate list to obtain an updated current second block vector candidate list; for any current guidance block vector among the guidance block vectors of the current round, determine the relocation block vector corresponding to any current guidance block vector according to the current reference block and / or current block corresponding to the any current guidance block vector; continue to determine the next round of guidance block vectors that meet the first preset condition among the relocation block vectors corresponding to the guidance block vectors of the current round, thereby obtaining an updated next second block vector candidate list, until the guidance block vector of the next round meets the second preset condition, and use the last updated second block vector candidate list as the second block vector candidate list.

[0744] In some embodiments, the first determination part 1002 is further configured to perform offset processing on any one of the current guidance block vectors according to the current reference block and / or current block to obtain a guidance block offset vector corresponding to any one of the current guidance block vectors; and determine the relocation block vector corresponding to any one of the current guidance block vectors based on the guidance block offset vector.

[0745] In some embodiments, the guide block offset vector includes one or more of the following: a first guide block offset vector; wherein the first guide block offset vector is used to indicate a first candidate reference block located in the middle position of the current reference block; a second guide block offset vector; wherein the second guide block offset vector is used to indicate a second candidate reference block located in the upper left position of the current reference block; a third guide block offset vector; wherein the third guide block offset vector is used to indicate a third candidate reference block located in the lower left position of the current reference block; a fourth guide block offset vector; wherein the fourth guide block offset vector is used to indicate a fourth candidate reference block located in the upper right position of the current reference block; a fifth guide block offset vector; wherein the fifth guide block offset vector is used to indicate a fifth candidate reference block located in the upper right position of the current reference block.

[0746] In some embodiments, the first determining part 1002 is further configured to determine a current guidance block offset vector in the guidance block offset vector; when the current guidance block offset vector is available, determine the relocation block vector corresponding to the current guidance block offset vector according to the block vector of the candidate reference block corresponding to the current guidance block offset vector; wherein the relocation block vector corresponding to the current guidance block offset vector is one of the relocation block vectors corresponding to any one of the current guidance block vectors; or, when the current guidance block offset vector is unavailable, skip the current guidance block offset vector and continue to execute the step of determining the next guidance block offset vector in the guidance block offset vector.

[0747] In some embodiments, the first determination part 1002 is further configured to perform a vector addition operation on the block vector of the candidate reference block corresponding to the current reference block offset vector and the current reference block vector when the candidate reference block does not adopt the prediction mode of bidirectional intra block copy (IBC) to obtain the repositioning block vector corresponding to the current reference block offset vector.

[0748] In some embodiments, the first determination part 1002 is further configured to determine the first reference block vector and the second reference block vector corresponding to the candidate reference block when the candidate reference block adopts the bidirectional IBC prediction mode; perform vector addition operation on the first reference block vector and the current guidance block vector to determine the first repositioning block vector corresponding to the current guidance block offset vector; perform vector addition operation on the second reference block vector and the current guidance block vector to determine the second repositioning block vector corresponding to the current guidance block offset vector.

[0749] In some embodiments, the first determination part 1002 is further configured to determine that the current guidance block offset vector is available if the current guidance block offset vector exists, the candidate reference block indicated by the current guidance block offset vector has been reconstructed, the template cost value corresponding to the current guidance block offset vector is less than or equal to a first threshold, the candidate reference block indicated by the current guidance block offset vector is within a preset range, and the prediction mode of the candidate reference block indicated by the current guidance block offset vector is one or more of the IBC mode or the IntraTMP mode; or, determine that the current guidance block offset vector is unavailable if the current guidance block offset vector does not exist, the candidate reference block indicated by the current guidance block offset vector has not been reconstructed, the template cost value corresponding to the current guidance block offset vector is greater than the first threshold, the candidate reference block indicated by the current guidance block offset vector is not within the preset range, and the prediction mode of the candidate reference block indicated by the current guidance block offset vector is not one or more of the IBC mode or the IntraTMP mode.

[0750] In some embodiments, the first preset condition includes one or more of the following: the template cost value corresponding to the guide block vector is less than or equal to a second threshold; wherein the second threshold is obtained based on the template cost value corresponding to the block vector added to the first block vector candidate list and / or the second block vector candidate list; the reference block corresponding to the guide block vector has been reconstructed; the reference block corresponding to the guide block vector does not exceed the search range of the Intra TMP; the reference block corresponding to the guide block vector does not exceed the search range of the IBC mode.

[0751] In some embodiments, the second preset condition includes one or more of the following: the next round is greater than or equal to the iteration round threshold; the number of guidance block vectors in the next round is less than or equal to a third threshold; the template cost value corresponding to at least one guidance block vector in the guidance block vectors in the next round is greater than or equal to a fourth threshold; the list length of the updated next second block vector candidate list corresponding to the next round is greater than or equal to a maximum list length threshold.

[0752] In some embodiments, the first block vector candidate list includes any one of the following: a first candidate list; wherein the first candidate list is determined by performing intra-frame template matching on a preset search range corresponding to the current block; a second candidate list; wherein the second candidate list is determined by merging block vectors corresponding to one or more candidate blocks having similar motion to the current block; a third candidate list; wherein the third candidate list is determined based on the first candidate list and the second candidate list.

[0753] In some embodiments, when the first block vector candidate list is the first candidate list, the first candidate block vector includes: all candidate block vectors in the first candidate list; or, M candidate block vectors with the minimum template cost in the first candidate list; where M is a positive integer greater than or equal to 1.

[0754] In some embodiments, when the first block vector candidate list is the second candidate list, the first candidate block vector includes: all candidate block vectors in the second candidate list; or, N candidate block vectors with the minimum template cost in the second candidate list; where N is a positive integer greater than or equal to 1.

[0755] In some embodiments, when the first block vector candidate list is the third candidate list, the first candidate block vector includes: all candidate block vectors in the first candidate list and all candidate block vectors in the second candidate list; or, the M candidate block vectors with minimum template cost in the first candidate list and all candidate block vectors in the second candidate list; or, all candidate block vectors in the first candidate list and N candidate block vectors with minimum template cost in the second candidate list; M candidate block vectors with minimum template cost in the first candidate list and N candidate block vectors with minimum template cost in the second candidate list; H candidate block vectors with minimum template cost after all candidate block vectors in the first candidate list and all candidate block vectors in the second candidate list are merged; wherein H is a positive integer greater than or equal to 1.

[0756] In some embodiments, the first determining portion 1002 is further configured to determine the first candidate list and use the first candidate list as the first block vector candidate list.

[0757] In some embodiments, the first determination part 1002 is further configured to search within the preset search range with a preset step size to obtain a first matching block vector; determine the first block vector with the minimum template cost among the first matching block vectors; and determine the first candidate list based on the first block vector.

[0758] In some embodiments, the first determining portion 1002 is further configured to determine the second candidate list and use the second candidate list as the first block vector candidate list.

[0759] In some embodiments, the first determining portion 1002 is further configured to determine the second candidate list based on second block vectors; wherein the matching blocks corresponding to the second block vectors have similar motions to the current block.

[0760] In some embodiments, the second candidate list includes one or more of the following: block vectors corresponding to one or more spatially adjacent candidate blocks; block vectors corresponding to one or more spatially non-adjacent candidate blocks; block vectors obtained by caching one or more IBC historical block vectors; average block vectors corresponding to one or more block vectors already in the current second candidate list; one or more block vectors predefined based on the size of the current block; one or more repositioned block vectors constructed based on the first candidate block vector.

[0761] In some embodiments, the first determining portion 1002 is further configured to parse the codestream to determine a first maximum list length; for a current second block vector in the second block vectors, add the current second block vector to the current second candidate list to obtain an updated current second candidate list; if the number of second block vectors in the updated current second candidate list is less than the first maximum list length, continue to add the next second block vector to the updated current second candidate list to obtain an updated next second candidate list, until the number of second block vectors in the updated next second candidate list equals the first maximum list length, and then use the last updated second candidate list as the second candidate list; or, if the number of second block vectors in the updated current second candidate list equals the first maximum list length, use the updated current second candidate list as the second candidate list.

[0762] In some embodiments, the first determining portion 1002 is further configured to, if the current second block vector satisfies a third preset condition, add the current second block vector to the current second candidate list to obtain an updated current second candidate list; or, if the current second block vector does not satisfy the third preset condition, skip the current second block vector and continue to add the next second block vector to the updated current second candidate list to obtain an updated next second candidate list.

[0763] In some embodiments, the third preset condition includes one or more of the following: the reference block corresponding to the current second block vector does not exceed the search range of the Intra TMP mode; the reference block corresponding to the current second block vector does not exceed the size of the image boundary of the current block; the reference block corresponding to the current second block vector does not exceed the size of the reconstructed area in the current frame; the reference block corresponding to the current second block vector does not exceed the size of the coding tree unit corresponding to the current block; the template cost value corresponding to the current second block vector is less than or equal to a preset threshold; wherein the preset threshold is obtained based on the template cost value corresponding to the block vector added to the first block vector candidate list and / or the second block vector candidate list.

[0764] In some embodiments, the first determining portion 1002 is further configured to perform a de-redundancy operation on the added second block vector in the current second candidate list.

[0765] In some embodiments, the first determining portion 1002 is further configured to, for any added second block vector in the current second candidate list, perform the step of adding the current second block vector to the current second candidate list to obtain an updated current second candidate list if a horizontal difference value between the current second block vector and the added second block vector is less than or equal to a fifth threshold, and a vertical difference value between the current second block vector and the added second block vector is less than or equal to the fifth threshold; or, if a horizontal difference value between the current second block vector and the added second block vector is greater than the fifth threshold, or a vertical difference value between the current second block vector and the added second block vector is greater than the fifth threshold, skip the current second block vector and continue to perform the step of adding the next second block vector to the updated current second candidate list to obtain an updated next second candidate list.

[0766] In some embodiments, the first determining part 1002 is further configured to perform a redundancy removal operation on the added second block vector in the current second candidate list according to the first candidate list when the first candidate list is constructed.

[0767] In some embodiments, the first determining portion 1002 is further configured to, for any added second block vector in the current second candidate list, perform the step of adding the current second block vector to the current second candidate list to obtain an updated current second candidate list if a horizontal difference value between the current second block vector and the any added second block vector and the any added first block vector in the first candidate list is less than or equal to a fifth threshold, and a vertical difference value between the current second block vector and the any added second block vector and the any added first block vector is less than or equal to the fifth threshold; or, if a horizontal difference value between the current second block vector and the any added second block vector and the any added first block vector in the horizontal direction is greater than the fifth threshold, or a vertical difference value between the current second block vector and the any added second block vector and the any added first block vector is greater than the fifth threshold, skip the current second block vector and continue to perform the step of adding the next second block vector to the updated current second candidate list to obtain an updated next second candidate list.

[0768] In some embodiments, the fifth threshold is related to the size of the current block and / or the vector precision of the current second block vector.

[0769] In some embodiments, the first determining part 1002 is further configured to adjust the first reference value according to the size of the current block to obtain the fifth threshold.

[0770] In some embodiments, the first determination part 1002 is further configured to increase the first reference value to obtain the fifth threshold value when the size of the current block is greater than or equal to the first preset value; or to lower the first reference value to obtain the fifth threshold value when the size of the current block is less than the first preset value.

[0771] In some embodiments, the first determining part 1002 is further configured to adjust the second reference value according to the vector accuracy of the current second block vector to obtain the fifth threshold.

[0772] In some embodiments, the first determination part 1002 is further configured to, when the vector accuracy of the current second block vector is greater than or equal to a second preset value, lower the second benchmark value to obtain the fifth threshold; or, when the vector accuracy of the current second block vector is less than the second preset value, increase the second benchmark value to obtain the fifth threshold.

[0773] In some embodiments, the first determining part 1002 is further configured to determine the first candidate list and the second candidate list; determine the third candidate list based on the first candidate list and the second candidate list, and use the third candidate list as the first block vector candidate list.

[0774] In some embodiments, the first determining part 1002 is further configured to merge the K first block vectors in the first candidate list and the L second block vectors in the second candidate list to obtain the third candidate list; wherein K and L are positive integers greater than or equal to 1.

[0775] In some embodiments, the first determination part 1002 is further configured to determine P candidate block vectors with minimum template cost among the K first block vectors and the L second block vectors; wherein P is a positive integer greater than or equal to 1 and less than or equal to the sum of K and L; and determine the third candidate list based on the P candidate block vectors.

[0776] In some embodiments, the first determining part 1002 is further configured to add the j-th candidate block vector among the K first block vectors and the L second block vectors to the current third candidate list to obtain an updated current third candidate list; wherein j is a positive integer greater than or equal to 1 and less than or equal to the sum of K and L; when the number of candidate block vectors in the updated current third candidate list is less than the second maximum list length, continue to add the j+1-th candidate block vector to the updated current third candidate list to obtain an updated next third candidate list; until the number of candidate block vectors in the updated next third candidate list is equal to the second maximum list length, the last updated third candidate list is used as the third candidate list; or, when the number of candidate block vectors in the updated current third candidate list is equal to the second maximum list length, the updated current third candidate list is used as the third candidate list.

[0777] In some embodiments, the first determining portion 1002 is further configured to perform a de-redundancy operation on the added candidate block vectors in the current third candidate list.

[0778] In some embodiments, the first determining portion 1002 is further configured to, for any first block vector and any second block vector added to the current third candidate list, if a horizontal difference value between the j-th candidate block vector and any second block vector is less than or equal to a fifth threshold, and a vertical difference value between the j-th candidate block vector and any second block vector is less than or equal to the fifth threshold, and a horizontal difference value between the j-th candidate block vector and any first block vector is less than or equal to a sixth threshold, and a vertical difference value between the j-th candidate block vector and any first block vector is less than or equal to the sixth threshold, perform the step of adding the j-th candidate block vector to the current third candidate list to obtain an updated current third candidate list; , any one of the first block vectors comes from the first candidate list, and any one of the second block vectors comes from the second candidate list; or, when the horizontal difference value between the j-th candidate block vector and any one of the second block vectors is greater than the fifth threshold, or the vertical difference value between the j-th candidate block vector and any one of the second block vectors is greater than the fifth threshold, or the horizontal difference value between the j-th candidate block vector and any one of the first block vectors is greater than the sixth threshold, or the vertical difference value between the j-th candidate block vector and any one of the first block vectors is greater than the sixth threshold, skip the j-th candidate block vector, and continue to execute the step of adding the j+1-th candidate block vector to the updated current third candidate list to obtain an updated next third candidate list.

[0779] In some embodiments, the sixth threshold is related to the size of the current block and / or a block-level flag of the reference block indicated by the j-th candidate block vector.

[0780] In some embodiments, the first determining portion 1002 is further configured to adjust the third reference value according to the size of the current block to obtain the sixth threshold.

[0781] In some embodiments, the first determination part 1002 is further configured to increase the third reference value to obtain the sixth threshold value when the size of the current block is greater than or equal to the third preset value; or to lower the third reference value to obtain the sixth threshold value when the size of the current block is less than the third preset value.

[0782] In some embodiments, the first determining part 1002 is further configured to adjust the fourth reference value according to the block-level flag of the reference block indicated by the j-th candidate block vector to obtain the sixth threshold.

[0783] In some embodiments, the first determination part 1002 is further configured to lower the fourth benchmark value to obtain the sixth threshold value when the block-level flag indicates that the reference block corresponding to the j-th candidate block vector satisfies the preset prediction mode and / or preset block feature; or to increase the fourth benchmark value to obtain the sixth threshold value when the block-level flag indicates that the reference block corresponding to the j-th candidate block vector does not satisfy the preset prediction mode and / or preset block feature.

[0784] In some embodiments, the first determination part 1002 is further configured to perform precision conversion processing on any candidate block vector in the first block vector candidate list and the second block vector candidate list when the any candidate block vector in the first block vector candidate list and the second block vector candidate list has fractional pixel precision, so that the any candidate block vector has integer pixel precision.

[0785] In some embodiments, the first determination part 1002 is further configured to parse the code stream to determine second syntax element information; perform template matching on the second candidate block vectors in the second block vector candidate list to obtain a third block vector candidate list; and determine the prediction value of the current block based on the intra-frame template matching prediction mode indicated by the second syntax element information and the third block vector candidate list.

[0786] In some embodiments, the first determination part 1002 is further configured to determine, for any second candidate block vector among the second candidate block vectors, a neighborhood area of ​​the any second candidate block vector based on the index identification information of the any second candidate block v...

Claims

1. A decoding method, applied to a decoder, the method comprising: Parsing a bitstream to determine first syntax element information; When the first syntax element information indicates that the current block adopts an intra-frame template matching prediction mode, determining a first block vector candidate list for the current block; wherein, the first block vector candidate list is determined according to a first candidate list constructed based on template matching technology and / or a second candidate list constructed based on merge candidate technology; Based on the first block vector candidate list, determining a second block vector candidate list; wherein, the second block vector candidate list includes relocated block vectors constructed for first candidate block vectors in the first block vector candidate list; Based on the second block vector candidate list, determining a predicted value for the current block.

2. The method according to claim 1, wherein The determining the second block vector candidate list based on the first block vector candidate list includes: In the first block vector candidate list, determining a first candidate block vector; wherein, the first candidate block vector is all or part of the candidate block vectors in the first block vector candidate list; Constructing relocated block vectors for the first candidate block vector to obtain the second block vector candidate list.

3. The method according to claim 2, wherein The constructing the relocated block vectors for the first candidate block vector to obtain the second block vector candidate list includes: In the first candidate block vector, determining a guiding block vector of the current round that satisfies a first preset condition; Adding the relocated block vector corresponding to the guiding block vector of the current round to the current second block vector candidate list to obtain an updated current second block vector candidate list; For any current guiding block vector in the guiding block vectors of the current round, determining the relocated block vector corresponding to the any current guiding block vector according to the current reference block and / or the current block corresponding to the any current guiding block vector; Continuing to determine the guiding block vector of the next round that satisfies the first preset condition in the relocated block vectors corresponding to the guiding block vectors of the current round, so as to obtain an updated second block vector candidate list of the next round, until the guiding block vector of the next round satisfies a second preset condition, and taking the updated last second block vector candidate list as the second block vector candidate list.

4. The method according to claim 3, wherein, The determining the relocated block vector corresponding to the any current guiding block vector according to the current reference block and / or the current block corresponding to the any current guiding block vector includes: Performing an offset process on the any current guiding block vector according to the current reference block and / or the current block to obtain a guiding block offset vector corresponding to the any current guiding block vector; Based on the guiding block offset vector, determining the relocated block vector corresponding to the any current guiding block vector.

5. The method according to claim 4, wherein The guiding block offset vector includes one or more of the following: A first guiding block offset vector; wherein, the first guiding block offset vector is used to indicate a first candidate reference block located at the middle position of the current reference block; A second guiding block offset vector; wherein, the second guiding block offset vector is used to indicate a second candidate reference block located at the upper left position of the current reference block; The third guiding block offset vector; wherein, the third guiding block offset vector is used to indicate a third candidate reference block located at the lower left position of the current reference block; The fourth guiding block offset vector; wherein, the fourth guiding block offset vector is used to indicate a fourth candidate reference block located at the upper right position of the current reference block; The fifth guiding block offset vector; wherein, the fifth guiding block offset vector is used to indicate a fifth candidate reference block located at the upper right position of the current reference block.

6. The method according to claim 4 or 5, wherein Determining the relocation block vector corresponding to any current guiding block vector based on the guiding block offset vector includes: Determining a current guiding block offset vector in the guiding block offset vector; When the current guiding block offset vector is available, determining the relocation block vector corresponding to the current guiding block offset vector according to the block vector of the candidate reference block corresponding to the current guiding block offset vector; wherein, the relocation block vector corresponding to the current guiding block offset vector is one of the relocation block vectors corresponding to any current guiding block vector; or, When the current guiding block offset vector is unavailable, skipping the current guiding block offset vector and continuing to execute the step of determining the next guiding block offset vector in the guiding block offset vector.

7. The method according to claim 6, wherein, Determining the relocation block vector corresponding to the current guiding block offset vector according to the block vector of the candidate reference block corresponding to the current guiding block offset vector includes: When the candidate reference block does not adopt the prediction mode of bidirectional intra-block copy (IBC), performing vector addition operation on the block vector of the candidate reference block corresponding to the current guiding block offset vector and the current guiding block vector to obtain the relocation block vector corresponding to the current guiding block offset vector.

8. The method according to claim 6, wherein Determining the relocation block vector corresponding to the current guiding block offset vector according to the block vector of the candidate reference block corresponding to the current guiding block offset vector includes: When the candidate reference block adopts the prediction mode of bidirectional IBC, determining the first reference block vector and the second reference block vector corresponding to the candidate reference block; Performing vector addition operation on the first reference block vector and the current guiding block vector to determine the first relocation block vector corresponding to the current guiding block offset vector; Performing vector addition operation on the second reference block vector and the current guiding block vector to determine the second relocation block vector corresponding to the current guiding block offset vector.

9. The method according to any one of claims 6 to 8, wherein The method further includes: When one or more of the following conditions are met: there exists the current guiding block offset vector, the candidate reference block indicated by the current guiding block offset vector has been reconstructed, the template cost value corresponding to the current guiding block offset vector is less than or equal to the first threshold, the candidate reference block indicated by the current guiding block offset vector is within the preset range, and the prediction mode of the candidate reference block indicated by the current guiding block offset vector is the IBC mode or the IntraTMP mode, determining that the current guiding block offset vector is available; or, In the case where there is no such current guiding block offset vector, the candidate reference block indicated by the current guiding block offset vector has not been reconstructed, the template cost value corresponding to the current guiding block offset vector is greater than the first threshold, the candidate reference block indicated by the current guiding block offset vector is not within the preset range, and the prediction mode of the candidate reference block indicated by the current guiding block offset vector is not one or more of the IBC mode or the IntraTMP mode, it is determined that the current guiding block offset vector is unavailable.

10. The method according to any one of claims 3 to 9, wherein, The first preset condition includes one or more of the following: The template cost value corresponding to the guiding block vector is less than or equal to the second threshold; wherein, the second threshold is obtained according to the template cost values corresponding to the block vectors already added in the first block vector candidate list and / or the second block vector candidate list; The reference block corresponding to the reconstructed guiding block vector; The reference block corresponding to the guiding block vector does not exceed the search range of Intra TMP; The reference block corresponding to the guiding block vector does not exceed the search range of the IBC mode.

11. The method according to any one of claims 3 to 10, wherein, The second preset condition includes one or more of the following: The next round is greater than or equal to the iteration round threshold; The number of guiding block vectors in the next round is less than or equal to the third threshold; The template cost value corresponding to at least one guiding block vector among the guiding block vectors in the next round is greater than or equal to the fourth threshold; The list length of the updated next second block vector candidate list corresponding to the next round is greater than or equal to the maximum list length threshold.

12. The method according to any one of claims 1 to 11, wherein The first block vector candidate list includes any one of the following: The first candidate list; wherein, the first candidate list is determined by performing intra-frame template matching on the preset search range corresponding to the current block; The second candidate list; wherein, the second candidate list is determined by merging the block vectors corresponding to one or more candidate blocks having similar motion to the current block; The third candidate list; wherein, the third candidate list is determined based on the first candidate list and the second candidate list.

13. The method according to claim 12, wherein, In the case where the first block vector candidate list is the first candidate list, the first candidate block vector includes: All candidate block vectors in the first candidate list; or, The M candidate block vectors with the minimum template cost in the first candidate list; wherein, M is a positive integer greater than or equal to 1.

14. The method according to claim 12, wherein, In the case where the first block vector candidate list is the second candidate list, the first candidate block vector includes: All candidate block vectors in the second candidate list; or, The N candidate block vectors with the minimum template cost in the second candidate list; wherein, N is a positive integer greater than or equal to 1.

15. The method according to claim 12, wherein In the case where the first block vector candidate list is the third candidate list, the first candidate block vector includes: All candidate block vectors in the first candidate list and all candidate block vectors in the second candidate list; or, The M candidate block vectors with the minimum template cost in the first candidate list and all candidate block vectors in the second candidate list; or, All candidate block vectors in the first candidate list and N candidate block vectors with the minimum template cost in the second candidate list; M candidate block vectors with the minimum template cost in the first candidate list and N candidate block vectors with the minimum template cost in the second candidate list; H candidate block vectors with the minimum template cost after merging all candidate block vectors in the first candidate list and all candidate block vectors in the second candidate list; where H is a positive integer greater than or equal to 1.

16. The method according to any one of claims 1 to 12, wherein, Determining the first block vector candidate list of the current block includes: Determining the first candidate list and using the first candidate list as the first block vector candidate list; Determining the first candidate list includes: Searching within a preset search range with a preset step size to obtain a first matching block vector; Determining the first block vector with the minimum template cost among the first matching block vectors; Determining the first candidate list according to the first block vector.

17. The method according to any one of claims 1 to 12, wherein, Determining the first block vector candidate list of the current block includes: Determining the second candidate list and using the second candidate list as the first block vector candidate list; Determining the second candidate list includes: Determining the second candidate list according to second block vectors; where the matching blocks corresponding to the second block vectors have similar motion to the current block.

18. The method according to claim 17, wherein, The second candidate list includes one or more of the following: Block vectors corresponding to one or more spatially adjacent candidate blocks; Block vectors corresponding to one or more spatially non - adjacent candidate blocks; Block vectors obtained by caching one or more IBC historical block vectors; Average block vectors corresponding to one or more block vectors already existing in the current second candidate list; One or more block vectors predefined based on the size of the current block; One or more relocated block vectors constructed based on the first candidate block vectors in the first block vector candidate list.

19. The method according to claim 17 or 18, wherein, Determining the second candidate list according to second block vectors includes: Parsing the bitstream to determine a first maximum list length; For the current second block vector in the second block vectors, adding the current second block vector to the current second candidate list to obtain an updated current second candidate list; In the case where the number of second block vectors in the updated current second candidate list is less than the first maximum list length, continue for the next second block vector, adding the next second block vector to the updated current second candidate list to obtain an updated next second candidate list until the number of second block vectors in the updated next second candidate list is equal to the first maximum list length, and using the updated last second candidate list as the second candidate list; or, In the case where the number of second block vectors in the updated current second candidate list is equal to the first maximum list length, using the updated current second candidate list as the second candidate list.

20. The method according to claim 19, wherein, Adding the current second block vector to the current second candidate list to obtain an updated current second candidate list includes: When the current second block vector satisfies the third preset condition, add the current second block vector to the current second candidate list to obtain an updated current second candidate list; or, When the current second block vector does not satisfy the third preset condition, skip the current second block vector and continue to execute the step of adding the next second block vector to the updated current second candidate list to obtain an updated next second candidate list.

21. The method according to claim 20, wherein, The third preset condition includes one or more of the following: The reference block corresponding to the current second block vector does not exceed the search range of the Intra TMP mode; The reference block corresponding to the current second block vector does not exceed the size of the image boundary of the current block; The reference block corresponding to the current second block vector does not exceed the size of the reconstructed area in the current frame; The reference block corresponding to the current second block vector does not exceed the size of the coding tree unit corresponding to the current block; The template cost value corresponding to the current second block vector is less than or equal to a preset threshold; wherein, the preset threshold is obtained according to the template cost values corresponding to the block vectors already added in the first block vector candidate list and / or the second block vector candidate list.

22. The method according to any one of claims 19 to 21, wherein, The method further includes: Performing a redundancy removal operation on the second block vectors already added in the current second candidate list.

23. The method according to claim 22, wherein The performing a redundancy removal operation on the second block vectors already added in the current second candidate list includes: For any second block vector already added in the current second candidate list, when the difference value in the horizontal direction between the current second block vector and the any second block vector already added is less than or equal to a fifth threshold, and the difference value in the vertical direction between the current second block vector and the any second block vector already added is less than or equal to the fifth threshold, execute the step of adding the current second block vector to the current second candidate list to obtain an updated current second candidate list; or, When the difference value in the horizontal direction between the current second block vector and the any second block vector already added is greater than the fifth threshold, or the difference value in the vertical direction between the current second block vector and the any second block vector already added is greater than the fifth threshold, skip the current second block vector and continue to execute the step of adding the next second block vector to the updated current second candidate list to obtain an updated next second candidate list.

24. The method according to claim 22, wherein The performing a redundancy removal operation on the second block vectors already added in the current second candidate list includes: When the first candidate list has been constructed, perform a redundancy removal operation on the second block vectors already added in the current second candidate list according to the first candidate list.

25. The method according to claim 24, wherein, The performing a redundancy removal operation on the second block vectors already added in the current second candidate list according to the first candidate list includes: For any added second block vector in the current second candidate list, when the difference value in the horizontal direction between the current second block vector and any added second block vector, and any added first block vector in the first candidate list is less than or equal to a fifth threshold, and the difference value in the vertical direction between the current second block vector and any added second block vector, and any added first block vector is less than or equal to the fifth threshold, perform the step of adding the current second block vector to the current second candidate list to obtain an updated current second candidate list; or, When the difference value in the horizontal direction between the current second block vector and any added second block vector, and any added first block vector in the first candidate list is greater than the fifth threshold, or the difference value in the vertical direction between the current second block vector and any added second block vector, and any added first block vector is greater than the fifth threshold, skip the current second block vector and continue to perform the step of adding the next second block vector to the updated current second candidate list to obtain an updated next second candidate list.

26. The method according to claim 23 or 25, wherein, The fifth threshold is related to the size of the current block and / or the vector precision of the current second block vector.

27. The method according to any one of claims 23, 25 or 26, wherein The method further includes: Adjusting a first reference value according to the size of the current block to obtain the fifth threshold; The adjusting the first reference value according to the size of the current block to obtain the fifth threshold includes: When the size of the current block is greater than or equal to a first preset value, increasing the first reference value to obtain the fifth threshold; or, When the size of the current block is less than the first preset value, decreasing the first reference value to obtain the fifth threshold.

28. The method according to any one of claims 23, 25 or 26, wherein The method further includes: Adjusting a second reference value according to the vector precision of the current second block vector to obtain the fifth threshold; The adjusting the second reference value according to the vector precision of the current second block vector to obtain the fifth threshold includes: When the vector precision of the current second block vector is greater than or equal to a second preset value, decreasing the second reference value to obtain the fifth threshold; or, When the vector precision of the current second block vector is less than the second preset value, increasing the second reference value to obtain the fifth threshold.

29. The method according to any one of claims 1 to 28, wherein The determining the first block vector candidate list of the current block includes: Determining the first candidate list and determining the second candidate list; Determining a third candidate list according to the first candidate list and the second candidate list, and using the third candidate list as the first block vector candidate list; The determining the third candidate list according to the first candidate list and the second candidate list includes: Performing a merging process on K first block vectors in the first candidate list and L second block vectors in the second candidate list to obtain the third candidate list; where K and L are positive integers greater than or equal to 1.

30. The method according to claim 29, wherein, Merging the K first block vectors in the first candidate list and the L second block vectors in the second candidate list to obtain the third candidate list includes: Determining P candidate block vectors with the minimum template cost among the K first block vectors and the L second block vectors; where P is a positive integer greater than or equal to 1 and less than or equal to the sum of K and L; Determining the third candidate list according to the P candidate block vectors.

31. The method according to claim 29, wherein Merging the K first block vectors in the first candidate list and the L second block vectors in the second candidate list to obtain the third candidate list includes: For the j-th candidate block vector among the K first block vectors and the L second block vectors, adding the j-th candidate block vector to the current third candidate list to obtain an updated current third candidate list; where j is a positive integer greater than or equal to 1 and less than or equal to the sum of K and L; When the number of candidate block vectors in the updated current third candidate list is less than the second maximum list length, continue to add the (j + 1)-th candidate block vector to the updated current third candidate list for the (j + 1)-th candidate block vector to obtain an updated next third candidate list; until the number of candidate block vectors in the updated next third candidate list is equal to the second maximum list length, taking the last updated third candidate list as the third candidate list; or, When the number of candidate block vectors in the updated current third candidate list is equal to the second maximum list length, taking the updated current third candidate list as the third candidate list.

32. The method according to claim 31, wherein, The method further includes: Performing a redundancy removal operation on the added candidate block vectors in the current third candidate list.

33. The method according to claim 32, wherein, The performing a redundancy removal operation on the added candidate block vectors in the current third candidate list includes For any one of the added first block vectors and any one of the added second block vectors in the current third candidate list, when the difference value in the horizontal direction between the j-th candidate block vector and any one of the second block vectors is less than or equal to a fifth threshold, and the difference value in the vertical direction between the j-th candidate block vector and any one of the second block vectors is less than or equal to the fifth threshold, and the difference value in the horizontal direction between the j-th candidate block vector and any one of the first block vectors is less than or equal to a sixth threshold, and the difference value in the vertical direction between the j-th candidate block vector and any one of the first block vectors is less than or equal to the sixth threshold, performing the step of adding the j-th candidate block vector to the current third candidate list to obtain an updated current third candidate list; where any one of the first block vectors comes from the first candidate list and any one of the second block vectors comes from the second candidate list; or, In a case where a difference value in a horizontal direction between the j-th candidate block vector and any one of the second block vectors is greater than the fifth threshold, or a difference value in a vertical direction between the j-th candidate block vector and any one of the second block vectors is greater than the fifth threshold, or a difference value in a horizontal direction between the j-th candidate block vector and any one of the first block vectors is greater than the sixth threshold, or a difference value in a vertical direction between the j-th candidate block vector and any one of the first block vectors is greater than the sixth threshold, skip the j-th candidate block vector, and continue to perform the step of adding the (j + 1)-th candidate block vector to the updated current third candidate list to obtain an updated next third candidate list.

34. The method according to claim 33, wherein The sixth threshold is related to the size of the current block and / or a block-level flag bit of a reference block indicated by the j-th candidate block vector.

35. The method according to claim 33 or 34, wherein, The method further includes: Adjusting a third reference value according to the size of the current block to obtain the sixth threshold; The adjusting a third reference value according to the size of the current block to obtain the sixth threshold includes: In a case where the size of the current block is greater than or equal to a third preset value, increasing the third reference value to obtain the sixth threshold; or In a case where the size of the current block is less than the third preset value, decreasing the third reference value to obtain the sixth threshold.

36. The method according to claim 33 or 34, wherein, The method further includes: Adjusting a fourth reference value according to a block-level flag bit of a reference block indicated by the j-th candidate block vector to obtain the sixth threshold; The adjusting a fourth reference value according to a block-level flag bit of a reference block indicated by the j-th candidate block vector to obtain the sixth threshold includes: In a case where the block-level flag bit indicates that the reference block corresponding to the j-th candidate block vector satisfies a preset prediction mode and / or preset block features, decreasing the fourth reference value to obtain the sixth threshold; or In a case where the block-level flag bit indicates that the reference block corresponding to the j-th candidate block vector does not satisfy a preset prediction mode and / or preset block features, increasing the fourth reference value to obtain the sixth threshold.

37. The method according to any one of claims 1 to 36, wherein Candidate block vectors in the first block vector candidate list and the second block vector candidate list are all in integer pixel precision; the method further includes: In a case where any one of the candidate block vectors in the first block vector candidate list and the second block vector candidate list is in sub-pixel precision, performing precision conversion processing on the any one of the candidate block vectors to make the any one of the candidate block vectors in integer pixel precision.

38. The method according to any one of claims 1 to 36, wherein, The determining a predicted value of the current block based on the second block vector candidate list includes: Parsing a bitstream to determine second syntax element information; Performing template matching on second candidate block vectors in the second block vector candidate list respectively to obtain a third block vector candidate list; Determining a predicted value of the current block according to a prediction mode based on intra-frame template matching adopted by the current block indicated by the second syntax element information and the third block vector candidate list.

39. The method according to claim 38, wherein, Performing template matching on the second candidate block vectors in the second block vector candidate list respectively to obtain a third block vector candidate list, including: For any one of the second candidate block vectors in the second candidate block vectors, determining a neighborhood region of the any one of the second candidate block vectors according to the index identification information of the any one of the second candidate block vectors; Searching in the neighborhood region of the any one of the second candidate block vectors with a preset step length to obtain a second matching block vector corresponding to the any one of the second candidate block vectors; Determining a third block vector with the minimum template cost among the second matching block vectors corresponding to the any one of the second candidate block vectors; Determining the third block vector candidate list according to the third block vector corresponding to the second candidate block vector.

40. The method according to any one of claims 1 to 39, wherein, Parsing the code stream to determine first syntax element information, including: If the value of the first syntax element information is a first value, determining that the current block adopts a prediction mode of intra-frame template matching; or If the value of the first syntax element information is a second value, determining that the current block does not adopt a prediction mode of intra-frame template matching.

41. The method according to any one of claims 1 to 39, wherein, The method further includes: Parsing the code stream to determine a prediction difference of the current block; Determining a reconstructed value of the current block according to a prediction value of the current block and the prediction difference of the current block.

42. An encoding method applied to an encoder, the method including: Determining a prediction mode adopted by a current block, and determining first syntax element information according to the prediction mode adopted by the current block; wherein, the first syntax element information is used to indicate whether the current block adopts a prediction mode of intra-frame template matching; When the prediction mode of the current block is a prediction mode of intra-frame template matching, determining a first block vector candidate list of the current block; wherein, the first block vector candidate list is determined according to a first candidate list constructed based on a template matching technique and / or a second candidate list constructed based on a merge candidate technique; Determining a second block vector candidate list based on the first block vector candidate list; wherein, the second block vector candidate list includes relocated block vectors constructed for first candidate block vectors in the first block vector candidate list; Determining a prediction value of the current block based on the second block vector candidate list.

43. The method according to claim 42, wherein The determining a second block vector candidate list based on the first block vector candidate list includes: Determining a first candidate block vector in the first block vector candidate list; wherein, the first candidate block vector is all or part of the candidate block vectors in the first block vector candidate list; Constructing relocated block vectors for the first candidate block vectors to obtain the second block vector candidate list.

44. The method according to claim 43, wherein, The constructing relocated block vectors for the first candidate block vectors to obtain the second block vector candidate list includes: Determining a guiding block vector of the current round that meets a first preset condition in the first candidate block vectors; Adding a relocated block vector corresponding to the guiding block vector of the current round to a current second block vector candidate list to obtain an updated current second block vector candidate list; For any current guiding block vector in the guiding block vectors of the current round, determine the relocation block vector corresponding to the any current guiding block vector according to the current reference block and / or the current block corresponding to the any current guiding block vector; Continue to determine the guiding block vector of the next round that satisfies the first preset condition in the relocation block vectors corresponding to the guiding block vectors of the current round, so as to obtain an updated candidate list of the next second block vector until the guiding block vector of the next round satisfies the second preset condition, and use the updated last candidate list of the second block vector as the candidate list of the second block vector.

45. The method according to claim 44, wherein, The determining the relocation block vector corresponding to the any current guiding block vector according to the current reference block and / or the current block corresponding to the any current guiding block vector includes: Perform an offset process on the any current guiding block vector according to the current reference block and / or the current block to obtain a guiding block offset vector corresponding to the any current guiding block vector; Based on the guiding block offset vector, determine the relocation block vector corresponding to the any current guiding block vector.

46. The method according to claim 45, wherein, The guiding block offset vector includes one or more of the following: The first guiding block offset vector; wherein, the first guiding block offset vector is used to indicate a first candidate reference block located at the middle position of the current reference block; The second guiding block offset vector; wherein, the second guiding block offset vector is used to indicate a second candidate reference block located at the upper left position of the current reference block; The third guiding block offset vector; wherein, the third guiding block offset vector is used to indicate a third candidate reference block located at the lower left position of the current reference block; The fourth guiding block offset vector; wherein, the fourth guiding block offset vector is used to indicate a fourth candidate reference block located at the upper right position of the current reference block; The fifth guiding block offset vector; wherein, the fifth guiding block offset vector is used to indicate a fifth candidate reference block located at the upper right position of the current reference block.

47. The method according to claim 45 or 46, wherein The determining the relocation block vector corresponding to the any current guiding block vector based on the guiding block offset vector includes: Determine a current guiding block offset vector in the guiding block offset vector; When the current guiding block offset vector is available, determine the relocation block vector corresponding to the current guiding block offset vector according to the block vector of the candidate reference block corresponding to the current guiding block offset vector; wherein, the relocation block vector corresponding to the current guiding block offset vector is one of the relocation block vectors corresponding to the any current guiding block vector; or, When the current guiding block offset vector is unavailable, skip the current guiding block offset vector and continue to execute the step of determining the next guiding block offset vector in the guiding block offset vector.

48. The method according to claim 47, wherein The determining the relocation block vector corresponding to the current guiding block offset vector according to the block vector of the candidate reference block corresponding to the current guiding block offset vector includes: In the case where the candidate reference block does not adopt the prediction mode of bi - directional intra - block copy (IBC), perform a vector addition operation on the block vector of the candidate reference block corresponding to the current guidance block offset vector and the current guidance block vector to obtain the relocated block vector corresponding to the current guidance block offset vector.

49. The method according to claim 47, wherein, Determining the relocated block vector corresponding to the current guidance block offset vector according to the block vector of the candidate reference block corresponding to the current guidance block offset vector includes: In the case where the candidate reference block adopts the prediction mode of bi - directional IBC, determine the first reference block vector and the second reference block vector corresponding to the candidate reference block; Perform a vector addition operation on the first reference block vector and the current guidance block vector to determine the first relocated block vector corresponding to the current guidance block offset vector; Perform a vector addition operation on the second reference block vector and the current guidance block vector to determine the second relocated block vector corresponding to the current guidance block offset vector.

50. The method according to any one of claims 47 to 49, wherein The method further includes: In the case where one or more of the following conditions are met: there exists the current guidance block offset vector, the candidate reference block indicated by the current guidance block offset vector has been reconstructed, the template cost value corresponding to the current guidance block offset vector is less than or equal to the first threshold, the candidate reference block indicated by the current guidance block offset vector is within the preset range, and the prediction mode of the candidate reference block indicated by the current guidance block offset vector is IBC mode or IntraTMP mode, determine that the current guidance block offset vector is available; or, In the case where one or more of the following conditions are met: there does not exist the current guidance block offset vector, the candidate reference block indicated by the current guidance block offset vector has not been reconstructed, the template cost value corresponding to the current guidance block offset vector is greater than the first threshold, the candidate reference block indicated by the current guidance block offset vector is not within the preset range, or the prediction mode of the candidate reference block indicated by the current guidance block offset vector is not IBC mode or IntraTMP mode, determine that the current guidance block offset vector is unavailable.

51. The method according to any one of claims 44 to 50, wherein, The first preset condition includes one or more of the following: The template cost value corresponding to the guidance block vector is less than or equal to the second threshold; wherein, the second threshold is obtained according to the template cost values corresponding to the block vectors already added in the first block vector candidate list and / or the second block vector candidate list; The reference block corresponding to the reconstructed guidance block vector; The reference block corresponding to the guidance block vector does not exceed the search range of Intra TMP; The reference block corresponding to the guidance block vector does not exceed the search range of IBC mode.

52. The method according to any one of claims 44 to 51, wherein, The second preset condition includes one or more of the following: The next round is greater than or equal to the iteration round threshold; The number of guidance block vectors in the next round is less than or equal to the third threshold; The template cost value corresponding to at least one of the guidance block vectors in the next round is greater than or equal to the fourth threshold; The list length of the updated next second block vector candidate list corresponding to the next round is greater than or equal to the maximum list length threshold.

53. The method according to any one of claims 1 to 52, wherein, The first block vector candidate list includes any one of the following: The first candidate list; wherein, the first candidate list is determined by performing intra-frame template matching on a preset search range corresponding to the current block; The second candidate list; wherein, the second candidate list is determined by merging block vectors corresponding to one or more candidate blocks having similar motion to the current block; The third candidate list; wherein, the third candidate list is determined based on the first candidate list and the second candidate list.

54. The method according to claim 53, wherein When the first block vector candidate list is the first candidate list, the first candidate block vector includes: All candidate block vectors in the first candidate list; or, M candidate block vectors with the minimum template cost in the first candidate list; where M is a positive integer greater than or equal to 1.

55. The method according to claim 53, wherein, When the first block vector candidate list is the second candidate list, the first candidate block vector includes: All candidate block vectors in the second candidate list; or, N candidate block vectors with the minimum template cost in the second candidate list; where N is a positive integer greater than or equal to 1.

56. The method according to claim 53, wherein, When the first block vector candidate list is the third candidate list, the first candidate block vector includes: All candidate block vectors in the first candidate list and all candidate block vectors in the second candidate list; or, M candidate block vectors with the minimum template cost in the first candidate list and all candidate block vectors in the second candidate list; or, All candidate block vectors in the first candidate list and N candidate block vectors with the minimum template cost in the second candidate list; M candidate block vectors with the minimum template cost in the first candidate list and N candidate block vectors with the minimum template cost in the second candidate list; H candidate block vectors with the minimum template cost after merging all candidate block vectors in the first candidate list and all candidate block vectors in the second candidate list; where H is a positive integer greater than or equal to 1.

57. The method according to any one of claims 42 to 53, wherein, Determining the first block vector candidate list of the current block includes: Determining the first candidate list and using the first candidate list as the first block vector candidate list; Determining the first candidate list includes: Searching within a preset search range with a preset step size to obtain a first matching block vector; Determining the first block vector with the minimum template cost among the first matching block vectors; Determining the first candidate list according to the first block vector.

58. The method according to any one of claims 42 to 53, wherein, Determining the first block vector candidate list of the current block includes: Determining the second candidate list and using the second candidate list as the first block vector candidate list; Determining the second candidate list includes: Determining the second candidate list according to second block vectors; where the matching blocks corresponding to the second block vectors have similar motion to the current block.

59. The method according to claim 58, wherein, The second candidate list includes one or more of the following: Block vectors corresponding to one or more spatial neighboring candidate blocks; Block vectors corresponding to one or more non-spatial neighboring candidate blocks; Block vectors obtained by caching one or more IBC historical block vectors; The average block vector corresponding to the block vectors already existing in one or more current second candidate lists; One or more block vectors predefined based on the size of the current block; One or more relocated block vectors constructed based on the first candidate block vectors in the first block vector candidate list.

60. The method according to claim 58 or 59, wherein, Determining the second candidate list according to the second block vector includes: For the current second block vector in the second block vector, adding the current second block vector to the current second candidate list to obtain an updated current second candidate list; When the number of second block vectors in the updated current second candidate list is less than the first maximum list length, continue for the next second block vector, and add the next second block vector to the updated current second candidate list to obtain an updated A second candidate list until the number of second block vectors in the updated next second candidate list is equal to the first maximum list length, and take the updated last second candidate list as the second candidate list; or, When the number of second block vectors in the updated current second candidate list is equal to the first maximum list length, take the updated current second candidate list as the second candidate list.

61. The method according to claim 60, wherein, The method further includes: Encoding the first maximum list length and writing the obtained encoded bits into the code stream.

62. The method according to claim 60, wherein Adding the current second block vector to the current second candidate list to obtain an updated current second candidate list includes: When the current second block vector meets the third preset condition, adding the current second block vector to the current second candidate list to obtain an updated current second candidate list; or, When the current second block vector does not meet the third preset condition, skip the current second block vector and continue to perform the step of adding the next second block vector to the updated current second candidate list to obtain an updated next second candidate list.

63. The method according to claim 62, wherein, The third preset condition includes one or more of the following: The reference block corresponding to the current second block vector does not exceed the search range of the Intra TMP mode; The reference block corresponding to the current second block vector does not exceed the size of the image boundary of the current block; The reference block corresponding to the current second block vector does not exceed the size of the reconstructed area in the current frame; The reference block corresponding to the current second block vector does not exceed the size of the coding tree unit corresponding to the current block; The template cost value corresponding to the current second block vector is less than or equal to a preset threshold; wherein, the preset threshold is obtained according to the template cost values corresponding to the block vectors already added in the first block vector candidate list and / or the second block vector candidate list.

64. The method according to any one of claims 60 to 63, wherein, The method further includes: Performing a redundancy removal operation on the second block vectors already added in the current second candidate list.

65. The method according to claim 64, wherein, Performing a redundancy removal operation on the second block vectors already added in the current second candidate list includes: For any added second block vector in the current second candidate list, when the difference value in the horizontal direction between the current second block vector and any added second block vector is less than or equal to a fifth threshold, and the difference value in the vertical direction between the current second block vector and any added second block vector is less than or equal to the fifth threshold, perform the step of adding the current second block vector to the current second candidate list to obtain an updated current second candidate list; or, When the difference value in the horizontal direction between the current second block vector and any added second block vector is greater than the fifth threshold, or the difference value in the vertical direction between the current second block vector and any added second block vector is greater than the fifth threshold, skip the current second block vector and continue to perform the step of adding the next second block vector to the updated current second candidate list to obtain an updated next second candidate list.

66. The method according to claim 64, wherein, The operation of removing redundancy from the added second block vectors in the current second candidate list includes: When a first candidate list has been constructed, perform the operation of removing redundancy from the added second block vectors in the current second candidate list according to the first candidate list.

67. The method according to claim 66, wherein, The operation of removing redundancy from the added second block vectors in the current second candidate list according to the first candidate list includes: For any added second block vector in the current second candidate list, when the difference value in the horizontal direction between the current second block vector and any added second block vector, and any added first block vector in the first candidate list is less than or equal to the fifth threshold, and the difference value in the vertical direction between the current second block vector and any added second block vector, and any added first block vector is less than or equal to the fifth threshold, perform the step of adding the current second block vector to the current second candidate list to obtain an updated current second candidate list; or, When the difference value in the horizontal direction between the current second block vector and any added second block vector, and any added first block vector in the first candidate list is greater than the fifth threshold, or the difference value in the vertical direction between the current second block vector and any added second block vector, and any added first block vector is greater than the fifth threshold, skip the current second block vector and continue to perform the step of adding the next second block vector to the updated current second candidate list to obtain an updated next second candidate list.

68. The method according to claim 65 or 67, wherein, The fifth threshold is related to the size of the current block and / or the vector precision of the current second block vector.

69. The method according to any one of claims 65, 67 or 68, wherein The method further includes: Adjust a first reference value according to the size of the current block to obtain the fifth threshold; The adjusting the first reference value according to the size of the current block to obtain the fifth threshold includes: When the size of the current block is greater than or equal to a first preset value, increase a first reference value to obtain the fifth threshold; or, When the size of the current block is less than the first preset value, decrease the first reference value to obtain the fifth threshold.

70. The method according to any one of claims 65, 67 or 68, wherein, The method further includes: Adjust a second reference value according to the vector precision of the current second block vector to obtain the fifth threshold; The adjusting a second reference value according to the vector precision of the current second block vector to obtain the fifth threshold includes: When the vector precision of the current second block vector is greater than or equal to a second preset value, decrease the second reference value to obtain the fifth threshold; or, When the vector precision of the current second block vector is less than the second preset value, increase the second reference value to obtain the fifth threshold.

71. The method according to any one of claims 42 to 70, wherein, The determining the first block vector candidate list of the current block includes: Determine the first candidate list and the second candidate list; Determine a third candidate list according to the first candidate list and the second candidate list, and use the third candidate list as the first block vector candidate list; The determining a third candidate list according to the first candidate list and the second candidate list includes: Merge K first block vectors in the first candidate list and L second block vectors in the second candidate list to obtain the third candidate list; where K and L are positive integers greater than or equal to 1.

72. The method according to claim 71, wherein, The merging K first block vectors in the first candidate list and L second block vectors in the second candidate list to obtain the third candidate list includes: Among the K first block vectors and the L second block vectors, determine P candidate block vectors with the minimum template cost; where P is a positive integer greater than or equal to 1 and less than or equal to the sum of K and L; Determine the third candidate list according to the P candidate block vectors.

73. The method according to claim 71, wherein, The merging K first block vectors in the first candidate list and L second block vectors in the second candidate list to obtain the third candidate list includes: For the j-th candidate block vector among the K first block vectors and the L second block vectors, add the j-th candidate block vector to the current third candidate list to obtain an updated current third candidate list; where j is a positive integer greater than or equal to 1 and less than or equal to the sum of K and L When the number of candidate block vectors in the updated current third candidate list is less than the second maximum list length, continue to add the (j + 1)-th candidate block vector to the updated current third candidate list for the (j + 1)-th candidate block vector to obtain an updated next third candidate list; until the number of candidate block vectors in the updated next third candidate list is equal to the second maximum list length, use the last updated third candidate list as the third candidate list; or, In the case where the number of candidate block vectors in the updated current third candidate list is equal to the second maximum list length, use the updated current third candidate list as the third candidate list.

74. The method according to claim 73, wherein, The method further includes: Performing a redundancy removal operation on the added candidate block vectors in the current third candidate list.

75. The method according to claim 74, wherein, The performing a redundancy removal operation on the added candidate block vectors in the current third candidate list includes For any added first block vector and any added second block vector in the current third candidate list, when the difference value in the horizontal direction between the j-th candidate block vector and any second block vector is less than or equal to a fifth threshold, and the difference value in the vertical direction between the j-th candidate block vector and any second block vector is less than or equal to the fifth threshold, and the difference value in the horizontal direction between the j-th candidate block vector and any first block vector is less than or equal to a sixth threshold, and the difference value in the vertical direction between the j-th candidate block vector and any first block vector is less than or equal to the sixth threshold, perform the step of adding the j-th candidate block vector to the current third candidate list to obtain an updated current third candidate list; where any first block vector comes from the first candidate list and any second block vector comes from the second candidate list; or, When the difference value in the horizontal direction between the j-th candidate block vector and any second block vector is greater than the fifth threshold, or the difference value in the vertical direction between the j-th candidate block vector and any second block vector is greater than the fifth threshold, or the difference value in the horizontal direction between the j-th candidate block vector and any first block vector is greater than the sixth threshold, or the difference value in the vertical direction between the j-th candidate block vector and any first block vector is greater than the sixth threshold, skip the j-th candidate block vector and continue to perform the step of adding the (j + 1)-th candidate block vector to the updated current third candidate list to obtain an updated next third candidate list.

76. The method according to claim 75, wherein, The sixth threshold is related to the size of the current block and / or the block-level flag bit of the reference block indicated by the j-th candidate block vector.

77. The method according to claim 75 or 76, wherein, The method further includes: Adjusting a third reference value according to the size of the current block to obtain the sixth threshold; The adjusting a third reference value according to the size of the current block to obtain the sixth threshold includes: When the size of the current block is greater than or equal to a third preset value, increasing the third reference value to obtain the sixth threshold; or, When the size of the current block is less than the third preset value, decreasing the third reference value to obtain the sixth threshold.

78. The method according to claim 75 or 76, wherein, The method further includes: Adjusting a fourth reference value according to the block-level flag bit of the reference block indicated by the j-th candidate block vector to obtain the sixth threshold; The adjusting a fourth reference value according to the block-level flag bit of the reference block indicated by the j-th candidate block vector to obtain the sixth threshold includes: When the block-level flag bit indicates that the reference block corresponding to the j-th candidate block vector satisfies a preset prediction mode and / or preset block characteristics, the fourth reference value is decreased to obtain the sixth threshold; or, When the block-level flag bit indicates that the reference block corresponding to the j-th candidate block vector does not satisfy a preset prediction mode and / or preset block characteristics, the fourth reference value is increased to obtain the sixth threshold.

79. The method according to any one of claims 42 to 78, wherein, The candidate block vectors in the first block vector candidate list and the second block vector candidate list are all at integer pixel precision; the method further includes: When any one of the candidate block vectors in the first block vector candidate list and the second block vector candidate list is at fractional pixel precision, precision conversion processing is performed on the any one candidate block vector to make the any one candidate block vector at integer pixel precision.

80. The method according to any one of claims 42 to 78, wherein, The determining of the prediction value of the current block based on the second block vector candidate list includes: Performing template matching on the second candidate block vectors in the second block vector candidate list respectively to obtain a third block vector candidate list; Determining the prediction value of the current block according to the prediction mode based on intra-frame template matching adopted by the current block and the third block vector candidate list.

81. The method according to claim 80, wherein, The performing of template matching on the second candidate block vectors in the second block vector candidate list respectively to obtain a third block vector candidate list includes: For any one of the second candidate block vectors, determining the neighborhood region of the any one second candidate block vector according to the index identification information of the any one second candidate block vector; Searching in the neighborhood region of the any one second candidate block vector with a preset step length to obtain the second matching block vector corresponding to the any one second candidate block vector; Determining the third block vector with the minimum template cost among the second matching block vectors corresponding to the any one second candidate block vector; Determining the third block vector candidate list according to the third block vector corresponding to the second candidate block vector.

82. The method according to any one of claims 42 to 81, wherein, The determining of the prediction mode adopted by the current block includes: Performing precoding on the current block with multiple candidate prediction modes to obtain the loss values corresponding to the multiple candidate prediction modes respectively; wherein, the multiple candidate prediction modes include the prediction mode based on intra-frame template matching; Calculating the rate-distortion cost for the loss values corresponding to the multiple candidate prediction modes respectively to obtain the rate-distortion cost values corresponding to the multiple candidate prediction modes respectively; Determining the prediction mode adopted by the current block according to the rate-distortion cost values corresponding to the multiple candidate prediction modes respectively.

83. The method according to claim 82, wherein The method further includes: Performing encoding processing on the first syntax element information and writing the obtained encoded bits into the bitstream.

84. The method according to claim 82, wherein, The determining of the prediction mode adopted by the current block according to the rate-distortion cost values corresponding to the multiple candidate prediction modes respectively includes: When the rate - distortion cost value corresponding to the prediction mode of intra - frame template matching is less than or equal to the rate - distortion cost values corresponding to the candidate prediction modes other than the prediction mode of intra - frame template matching among the multiple candidate prediction modes, it is determined that the current block adopts the prediction mode based on intra - frame template matching; When the rate - distortion cost value corresponding to the prediction mode of intra - frame template matching is greater than the rate - distortion cost value corresponding to any one of the candidate prediction modes other than the prediction mode of intra - frame template matching among the multiple candidate prediction modes, it is determined that the current block does not adopt the prediction mode based on intra - frame template matching.

85. The method according to any one of claims 42 to 84, wherein, Determining the first syntax identification information according to the prediction mode adopted by the current block includes: When it is determined that the current block adopts the prediction mode based on intra - frame template matching, setting the value of the first syntax element information to a first value; or, When it is determined that the current block does not adopt the prediction mode based on intra - frame template matching, setting the value of the first syntax element information to a second value.

86. The method according to any one of claims 83 to 84, wherein, The method further includes: When the prediction mode adopted by the current block is the prediction mode based on intra - frame template matching, determining the second syntax element information; wherein, the second syntax element information is used to indicate the prediction mode based on intra - frame template matching adopted by the current block; Performing encoding processing on the second syntax element information, and writing the obtained encoded bits into the bitstream.

87. The method according to any one of claims 42 to 86, wherein, The method further includes: Determining the prediction difference of the current block according to the predicted value of the current block and the original value of the current block; Determining the reconstructed value of the current block according to the predicted value of the current block and the prediction difference of the current block.

88. The method according to claim 87, wherein The method further includes: Performing encoding processing on the prediction difference, and writing the obtained encoded bits into the bitstream.

89. A bitstream, which is generated by performing bit encoding on information to be encoded; wherein, The information to be encoded includes at least one of the following: The first syntax element information, the second syntax element information, the first maximum list length, and the prediction difference; the first syntax element information is used to indicate whether the current block adopts the prediction mode of intra - frame template matching; the second syntax element information is used to indicate the prediction mode based on intra - frame template matching adopted by the current block.

90. A decoder, the decoder includes a decoding part and a first determination part, wherein: The decoding part is configured to parse the bitstream and determine the first syntax element information; The first determination part is configured to determine the first block vector candidate list of the current block when the first syntax element information indicates that the current block adopts the prediction mode of intra - frame template matching; wherein, the first block vector candidate list is determined according to the first candidate list constructed based on the template matching technology and / or the second candidate list constructed based on the merge candidate technology; Based on the first block vector candidate list, determining the second block vector candidate list; wherein, the second block vector candidate list includes the relocated block vectors constructed for the first candidate block vectors in the first block vector candidate list; Based on the second block vector candidate list, determining the predicted value of the current block.

91. An encoder, the encoder includes a second determination part, wherein: The second determination part is configured to determine a prediction mode adopted by a current block, and determine first syntax element information according to the prediction mode adopted by the current block; wherein, the first syntax element information is used to indicate whether the current block adopts a prediction mode of intra-frame template matching; When the prediction mode of the current block is the prediction mode of intra-frame template matching, determine a first block vector candidate list of the current block; wherein, the first block vector candidate list is determined according to a first candidate list constructed based on a template matching technique and / or a second candidate list constructed based on a merge candidate technique; Based on the first block vector candidate list, determine a second block vector candidate list; wherein, the second block vector candidate list includes relocated block vectors constructed for first candidate block vectors in the first block vector candidate list; Based on the second block vector candidate list, determine a predicted value of the current block.

92. A decoder, the decoder includes a first memory and a first processor, wherein: The first memory is configured to store a computer program capable of running on the first processor; The first processor is configured to execute the method according to any one of claims 1 to 41 when running the computer program.

93. An encoder, the encoder includes a second memory and a second processor, wherein: The second memory is configured to store a computer program capable of running on the second processor; The second processor is configured to execute the method according to any one of claims 42 to 88 when running the computer program.

94. A computer-readable storage medium, wherein, The computer-readable storage medium stores a computer program, and when the computer program is executed, it implements the method according to any one of claims 1 to 41, or implements the method according to any one of claims 42 to 88.