Encoding / decoding methods, bitstreams, encoders, decoders, and storage media
By combining multiple candidates and templates in intra-template matching prediction, the method enhances video encoding and decoding efficiency and accuracy, addressing discrepancies in existing technologies.
Patent Information
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
- Filing Date
- 2023-04-03
- Publication Date
- 2026-05-19
AI Technical Summary
Existing video encoding technologies face challenges in achieving high prediction accuracy and compression efficiency due to discrepancies in intra-template matching prediction methods.
The proposed solution involves determining a first template corresponding to the current block, constructing a list of candidate block vectors based on this template, and selecting a block vector to predict the current block, thereby enhancing encoding and decoding performance through multiple candidate and template combinations.
This approach improves compression efficiency and encoding/decoding performance by utilizing multiple candidates and templates in intra-template matching prediction, ensuring accurate prediction and reduced computational complexity.
Smart Images

Figure 2026515628000001_ABST
Abstract
Description
[Technical Field]
[0001] The embodiments of this application relate to the technical field of video encoding and decoding, and more particularly to encoding and decoding methods, bitstreams, encoders, decoders, and storage media. [Background technology]
[0002] Intra Template Matching Prediction (Intra TMP) is a technique that uses a template of coded blocks to search for a matching template with the minimum cost according to a predetermined cost function within a predefined search range in the current image, and then adopts the reconstruction block that best matches the matching template as the predicted block for the current coded block.
[0003] However, in actual encoding processes, there are significant discrepancies in the related technologies, resulting in low prediction accuracy and further degrading compression efficiency and performance. [Overview of the project] [Means for solving the problem]
[0004] The embodiments of this application provide an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium, which can improve compression efficiency and enhance encoding and decoding performance.
[0005] The technical solution of the embodiment of the present application can be realized as follows.
[0006] In the first aspect, embodiments of the present application provide a decoding method applicable to a decoder, the decoding method being: Determining a first template corresponding to the current block, wherein the first template is one or more candidate templates within the template set corresponding to the current block, Determining a list of candidate block vectors corresponding to the current block based on the first template, This includes determining a block vector corresponding to the current block based on a list of candidate block vectors corresponding to the current block, and determining a predicted value for the current block based on the block vector.
[0007] In a second aspect, an embodiment of the present application provides an encoding method applicable to an encoder, the encoding method being: Determining a first template corresponding to the current block, wherein the first template is one or more candidate templates within the template set corresponding to the current block, Determining a list of candidate block vectors corresponding to the current block based on the first template, This includes determining a block vector corresponding to the current block based on a list of candidate block vectors corresponding to the current block, and determining a predicted value for the current block based on the block vector.
[0008] In a third aspect, an embodiment of the present application provides a bitstream, which is generated by bit encoding based on information to be encoded, and the information to be encoded is It includes at least one of the following: template matching prediction identification information, first template instruction information, second template instruction information, third template instruction information, index identification information, and prediction difference value.
[0009] In a fourth aspect, an embodiment of the present application provides an encoder, the encoder including a first determination unit, The first decision unit is configured to determine a first template corresponding to the current block, the first template being one or more candidate templates within a template set corresponding to the current block, determine a list of candidate block vectors corresponding to the current block based on the first template, determine a block vector corresponding to the current block based on the list of candidate block vectors corresponding to the current block, and determine a predicted value for the current block based on the block vector.
[0010] In a fifth aspect, an embodiment of the present application provides an encoder, the encoder comprising a first memory and a first processor, The first memory is used to store computer programs that can be executed on the first processor. The first processor is used to perform the method according to the second embodiment when executing the computer program.
[0011] In a sixth aspect, an embodiment of the present application provides a decoder, the decoder including a second determination unit, The second decision unit is configured to determine a first template corresponding to the current block, the first template being one or more candidate templates within a template set corresponding to the current block, determine a list of candidate block vectors corresponding to the current block based on the first template, determine a block vector corresponding to the current block based on the list of candidate block vectors corresponding to the current block, and determine a predicted value for the current block based on the block vector.
[0012] In the seventh aspect, an embodiment of the present application provides a decoder, the encoder including a second memory and a second processor, The second memory is used to store computer programs that can be executed on the second processor. The second processor is used to perform the method according to the first embodiment when executing the computer program.
[0013] In the eighth aspect, an embodiment of the present application provides a computer-readable storage medium in which a computer program is stored, and when the computer program is executed, the method described in the first aspect or the method described in the second aspect is implemented.
[0014] Embodiments of the present application provide an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium, wherein the encoder / decoder determines a first template corresponding to the current block, where the first template is one or more candidate templates in a template set corresponding to the current block, determines a list of candidate block vectors corresponding to the current block based on the first template, determines a block vector corresponding to the current block based on the list of candidate block vectors corresponding to the current block, and determines a predicted value for the current block based on the block vector. As can be seen from the above, embodiments of the present application propose a prediction scheme that combines multiple candidates and multiple templates of IntraTMP, where it is possible to choose to determine a list of candidate block vectors that include at least one block vector of the current block, and at the same time, it is possible to choose to construct a list of candidate block vectors using a first template that includes at least one candidate template, and furthermore, a combination of multiple candidates and multiple selections at the template level of IntraTMP can be realized. In other words, the encoding and decoding method proposed in the embodiment of the present invention realizes multiple candidates for intraTMP by constructing a list of candidate block vectors corresponding to the current block, and on the other hand, provides multiple selections at the template level using a first template corresponding to the current block that includes one or more candidate templates, thereby improving compression efficiency and encoding and decoding performance. [Brief explanation of the drawing]
[0015] [Figure 1] This is a schematic diagram illustrating the basic flow of a video encoder / decoder. [Figure 2] This is a schematic diagram illustrating the positional relationship between the current block and the reference sample. [Figure 3] This is a schematic diagram illustrating the use of four reference rows / columns in the intra-prediction method. [Figure 4] This is a schematic diagram of the nine modes used for intra-prediction on a 4x4 block in H.264. [Figure 5] This is a schematic diagram of the 35 intra-prediction modes used in HEVC. [Figure 6] This is a schematic diagram of the 67 intra-modes used in VVC. [Figure 7] This is a schematic diagram of the wide-angle mode. [Figure 8] This is a schematic diagram of the 66 prediction modes used in AVS3. [Figure 9] This is a schematic diagram of the screen content. [Figure 10] This is a schematic diagram of the interpretation prediction. [Figure 11] This is a schematic diagram of intraTMP. [Figure 12] This is the first schematic diagram of the search. [Figure 13] This is the second schematic diagram of the search. [Figure 14] This is the first schematic diagram of the template type. [Figure 15] This is a schematic diagram of the encoder's configuration block. [Figure 16] This is a schematic diagram of the decoder's configuration block. [Figure 17] This is a schematic diagram of the network architecture of the coding and decoding system. [Figure 18] This is a schematic flowchart of the decoding method proposed in the embodiments of this application. [Figure 19] This is the second schematic diagram of the template type. [Figure 20] This is a schematic diagram of the candidate templates. [Figure 21] This is a schematic flowchart of the encoding method proposed in the embodiments of this application. [Figure 22] This is a schematic diagram of the encoder's structure. [Figure 23] This is a schematic diagram of the encoder's hardware structure. [Figure 24] This is a schematic diagram of the decoder's structure. [Figure 25] This is a schematic diagram of the decoder's hardware structure. [Figure 26] This is a schematic diagram of the coding and decoding system. [Modes for carrying out the invention]
[0016] To provide a more detailed understanding of the features and technical content of the embodiments of this application, the implementation of the embodiments will be described in detail below with reference to the drawings. The attached drawings are not intended to limit the embodiments of this application, but are for reference and illustrative purposes only.
[0017] Unless otherwise defined, all technical and scientific terms used herein have the same meanings as those generally understood by those skilled in the art. The terms used herein are not intended to limit this application, but merely to describe the embodiments thereof.
[0018] Regarding the “Several Embodiments” described below, a subset of all possible embodiments is described, but it is understandable that “Several Embodiments” may be the same subset or different subsets of all possible embodiments, and can be combined with each other as long as they do not contradict each other. Furthermore, it should be noted that the terms “First / Second / Third” used in the embodiments of this application merely distinguish similar objects and do not represent a particular order of objects, and it is understandable that “First / Second / Third” may be replaced with a particular order or sequence if permitted, so that the embodiments of this application described herein may be carried out in an order other than that illustrated or described herein.
[0019] Before describing the embodiments of this application in more detail, we will first explain the nouns and terms relating to the embodiments of this application, which shall be interpreted as follows.
[0020] Coding Block (CB) Block Matching (BM) Coding Unit (CU) Block Vector (BV) Sum of Absolute Difference (SAD) Sum of Absolute Transformed Difference (SATD) Mean Squared Error (MSE) Sum of Squared Differences (SSD) Mean Absolute Deviation (MAD) Mean Squared Deviation (MSD) Normalized Correlation Coefficient (NCC) H.266 / Versatile Video Coding (VVC) VVC Reference Software Test Platform (VTM: VVC Test Model) Intra Template Matching Prediction (Intra TMP) Beyond VVC's reference software test platform (ECM: Enhanced Compression Model)
[0021] In video images, it can generally be understood that the first, second, and third color components are used to represent an encoded block. Here, these three color components are the luminance component, the blue chromaticity component, and the red chromaticity component, respectively. Specifically, the luminance component is usually represented by the symbol Y, the blue chromaticity component by the symbol Cb or U, and the red chromaticity component by the symbol Cr or V. In this way, a video image can be represented in YCbCr format or in YUV format.
[0022] Video coding and decoding standards primarily use a block-based hybrid coding framework. Each image, subimage, or frame in a video is divided into square Largest Coding Units (LCUs) or Coding Tree Units (CTUs) of the same size (e.g., 128x128 or 64x64). Each Largest Coding Unit or Coding Tree Unit can be divided into rectangular Coding Units (CUs) based on rules. Coding Units can be further divided into Prediction Units (PUs) and / or Transform Units (TUs), etc. The hybrid coding framework includes modules such as prediction, transform, quantization, entropy coding, and in-loop filtering. The prediction module includes intra-prediction and inter-prediction. Inter-prediction includes motion estimation and motion compensation. Because there is a strong correlation between adjacent samples within a single frame of video, video coding and decoding techniques use intra-prediction methods to remove spatial redundancy between adjacent samples. Similarly, because there is a strong similarity between adjacent frames within video, video coding and decoding techniques use inter-prediction methods to remove temporal redundancy between adjacent frames, thereby improving coding and decoding efficiency.
[0023] The basic process of a video encoder / decoder is shown in Figure 1. On the encoding side, one frame of image 101 is divided into blocks, and an intra-prediction or inter-prediction is used to generate a predicted block for the current block. The predicted block is subtracted from the original block of the current block to obtain a residual block, and the residual block is transformed and quantized to obtain a quantization coefficient matrix. The quantization coefficient matrix is entropy encoded and output to a bitstream. On the decoding side (not shown), an intra-prediction or inter-prediction is used to generate a predicted block for the current block, and on the other hand, the bitstream is analyzed to obtain a quantization coefficient matrix. The quantization coefficient matrix is inversely quantized and inversely transformed to obtain a residual block, and the predicted block and residual block are added to obtain a reconstructed block. The reconstructed block constitutes a reconstructed image, and loop filtering is performed on the reconstructed image based on the image or block to obtain a decoded image. The encoding side requires similar operations to the decoding side to obtain a decoded image. On the encoding side, the obtained decoded image can be used as a reference frame for inter-prediction for subsequent frames. Mode or parameter information, such as block partitioning information, prediction, transformation, quantization, entropy coding, and loop filtering, determined by the encoding side, must be present in the output bitstream where necessary. The decoding side determines the same block partitioning information, prediction, transformation, quantization, entropy coding, and loop filtering mode or parameter information as the encoding side by analyzing and interpreting existing information, thereby ensuring that the decoded image obtained by the encoding side is the same as the decoded image obtained by the decoding side. The decoded image obtained by the encoding side is usually also called the reconstructed image. The current block can be partitioned into prediction units during prediction, and into transformation units during transformation, and the partitioning of the prediction units and transformation units may be different.
[0024] The above describes the basic process of a video encoder / decoder in a block-based hybrid coding framework. As technology advances, some modules or steps of the framework or process may be optimized, and the encoding and decoding methods provided in the embodiments of this application are suitable for the basic process of a video encoder / decoder in the block-based hybrid coding framework, but are not limited to this framework and process. As encoders and decoders evolve and new service scenarios emerge, it will be apparent to those skilled in the art that the methods provided in the embodiments of this application are equally suitable for similar technical problems.
[0025] The current block may be the current coding unit (CU) or the current prediction unit (PU), etc.
[0026] Understandably, there is a strong spatial correlation between adjacent parts or adjacent samples within an image, and intra-prediction is a method of prediction that utilizes the spatial correlation between encoded and decoded samples around the current block and samples within the current block. For example, as shown in Figure 2, the white 4x4 block is the current block, and the gray samples in the leftmost column and topmost row of the current block are the reference samples for the current block. Intra-prediction uses these reference samples to predict the current block. All of these reference samples may be obtainable, meaning they are all encoded and decoded, but some may not be obtainable. For example, if the current block is the leftmost part of the entire frame, the reference sample to the left of the current block may not be obtainable. Or, when encoding and decoding the current block, if the lower left of the current block has not yet been encoded and decoded, the reference sample to the lower left may also not be obtainable. If reference samples are not obtainable, the image can be filled using obtainable reference samples, some values, or some method, or no filling can be performed.
[0027] The intra-prediction method for multiple reference lines (MRL) improves coding efficiency because it can use more reference samples. Figure 3 shows an example using four reference rows / columns.
[0028] The intra-prediction mode has multiple prediction modes, and Figure 4 shows nine modes for intra-prediction on a 4x4 block in H.264. Here, Mode 0 copies the sample above the current block as the predicted value according to the vertical direction. Mode 1 copies the reference sample on the left as the predicted value according to the horizontal direction. Mode 2 (i.e., DC mode) uses the average of eight points A-D and I-L as the predicted value for all points. Modes 3-8 copy the reference sample to the corresponding position in the current block at a certain angle (therefore, Modes 3-8 are also called angle prediction modes). Since some positions in the current block do not correspond exactly to the reference sample, it may be necessary to use a weighted average of the reference sample or an interpolated subsample (subpixel) of the reference sample.
[0029] Other modes include Plane and Planar. With technological advancements and block expansion, the number of angle prediction modes is also increasing. As shown in Figure 5, the intra-prediction modes used in HEVC include Planar, DC, and 35 prediction modes, including 33 angle modes. As shown in Figure 6, the intra-modes used in VVC include Planar, DC, and 67 prediction modes, including 65 angle modes. Of course, in addition to the 67 modes mentioned above, VVC further provides wide-angle modes for rectangular blocks with large differences in length and width, for example, the modes shown by the dashed lines in Figure 7, i.e., two intervals, -14 to -1 and 67 to 80, which replace some conventional modes. As shown in Figure 8, AVS3 uses 66 prediction modes, including DC, Plane, Bilinear, PCM, and 62 angle modes.
[0030] A video is composed of multiple images. To display a video smoothly, a video contains tens or hundreds of frames per second, for example, 24 frames per second, 30 frames per second, 50 frames per second, 60 frames per second, or 120 frames per second. This results in very obvious temporal redundancy in the video. In other words, there is a lot of temporal correlation in the video. Interpretation uses this temporal correlation to improve compression efficiency. Interpretation always uses "motion" to utilize temporal correlation. One very simple "motion" model is that an object is at a certain position in the image corresponding to a certain time, and after a certain amount of time, moves parallel to a different position in the image corresponding to that time. This is a translation that is basically and commonly used in video encoding and decoding. Interpretation uses motion information to represent "motion". Basic motion information includes information from a reference frame (also called a reference picture) and information from a motion vector (MV). The encoder / decoder determines the reference image based on the information in the reference image, and determines the coordinates of the reference block based on the motion vector information and the coordinates of the current block. The reference block is determined using the coordinates of the reference block in the reference image. Using the determined reference block as the prediction block is the most basic prediction method in interpretation.
[0031] Not all motion in video is this simple; even motions that can be considered translations undergo subtle changes over time, including slight deformations, changes in brightness, and changes in noise. Multiple reference blocks can be used to predict the current block, thereby achieving better prediction effectiveness. For example, in bidirectional prediction, two reference blocks are used to predict the current block. For the two reference blocks, one forward reference block and one backward reference block can be used. It is also permitted for both reference blocks to be either forward or backward. "Forward" means that the time corresponding to the reference image is before the current frame, and "backward" means that the time corresponding to the reference image is after the current frame. Alternatively, "forward" means that the position of the reference image in the video is before the current frame, and "backward" means that the position of the reference image in the video is after the current frame. Alternatively, "forward" means that the picture order count (POC) of the reference image is smaller than the POC of the current frame, and "backward" means that the POC of the reference image is larger than the POC of the current frame. Future video coding and decoding standards may support prediction using multiple reference blocks. One simple way to generate a prediction block using two reference blocks is to average the pixel values at corresponding positions in the two reference blocks to obtain the prediction block. For better prediction effectiveness, a weighted average such as BCW (Bi-prediction with CU-level weight), used in VVC, can also be used. GPM (Geometric partitioning mode) in VVC can be understood as a special type of bidirectional prediction. In order to use bidirectional prediction, it is naturally necessary to find two reference blocks, and therefore information from two sets of reference images and motion vector information are required.
[0032] The motion in the video includes not only simple translation but also scaling, rotation, distortion, and various complex movements. VVC uses affine to simulate some of these simpler movements. The affine model in VVC uses two or three control points and, based on these control points, utilizes a linear model to derive the motion vector of each subblock within the current block. The reason we say motion vector rather than motion information here is that both point to the same reference image. Ordinary translational motion is about finding one "whole block" from the reference image, while affine can be understood as finding groups of non-adjacent "subblocks" from the reference image. All of the above falls under the category of one-way prediction, but affine can also achieve two-way prediction or prediction of more "reference blocks". The reference block here consists of subblocks. Specifically, one one-way motion information in the data structure of affine motion information can include information from one reference image and information from two or three motion vectors, or information from two or three groups of reference images and motion vectors, but the information from these reference images is the same.
[0033] Intra-block copy (IBC) can significantly improve the compression efficiency of screen content coding, and therefore, IBC is used for screen content coding from HEVC to VVC. Unlike camera-captured content, screen content is computer-generated, free from noise, contains text and computer graphics, and has clear boundaries. Screen content contains a large amount of overlapping content; as shown in Figure 9, the content in the two boxes in the first row is duplicated, and the content in the boxes in the third and fourth rows is duplicated.
[0034] As mentioned above, in inter-prediction, a reference block in the reference image is used as the predicted block for the current block, but the reference image is not the current image. In IBC, one block is found from the encoded and decoded portion (called the reconstructed portion) of the current image as the predicted block for the current block. IBC is sometimes called intra-picture block compensation or current picture referencing (CPR). In this embodiment, the name IBC is not limited. The above names are equivalent or interchangeable unless otherwise specified.
[0035] IBC uses a block vector (BV) to represent the positional difference between the current block and a reference block. The encoder determines the best matching block for the current block within the search range using a block matching method and encodes the BV. There are several methods for encoding the BV, but they will not be explained in detail here. IBC can be considered as one intra-prediction method, or as a separate prediction method independent of intra-prediction and inter-prediction.
[0036] Template matching (TM) is a method first used in inter-prediction, which utilizes the correlation between adjacent samples to use several regions around the current block as a template. When encoding or decoding the current block, its left and top sides are already encoded and decoded according to the encoding order. Of course, when implemented in a hardware decoder, it cannot be guaranteed that the left and top sides of the current block are already decoded at the start of decoding. Of course, we are talking about inter-blocks here, and in HEVC, for example, when an inter-encoded block generates a prediction process, it does not require the surrounding reconstructed samples, so the prediction process of inter-blocks can be run in parallel. However, intra-encoded blocks require the reconstructed samples on the left and top sides as reference samples. Theoretically, the left and top sides of the current block are obtained, that is, achievable with appropriate hardware design adjustments. Relatively, the right and bottom sides of the current block are not obtained according to the encoding order in video standards (such as VVC).
[0037] As shown in Figure 10, the rectangular areas to the left and above the current block 1001 are set as templates. The height of the left template portion is generally the same as the height of the current block 1001, and the width of the upper template portion is generally the same as the width of the current block 1001, but of course, they may be different. The optimal matching position of the template is found within the reference frame 1003 of the current frame 1002, thereby determining the motion information or motion vector of the current block 1001. This process can be roughly described as starting from one starting position within a given reference frame and searching within a certain range around it. Search rules such as the search range and search steps can be set in advance. Each time the system moves to a position, the degree of matching between the template corresponding to that position and the template around the current block is calculated. This so-called degree of matching can be measured by a distortion cost such as SAD (sum of absolute difference), SATD (sum of absolute transformed difference), or MSE (mean-square error). The smaller the value of SAD, SATD, or MSE, the higher the degree of matching. Here, the transformation used in SATD may be a Hadamard transformation. The cost is calculated using the prediction block of the template corresponding to the position and the reconstruction block of the template around the current block. In addition to searching for all pixel positions, sub-pixel positions can also be searched, and the motion information of the current block is determined based on the position with the highest degree of matching found. By utilizing the correlation between adjacent samples, motion information suitable for the template may also be suitable for the current block. Of course, the template matching method is not necessarily suitable for all blocks, so several methods can be used to determine whether the current block uses the template matching method described above, for example, by using a control switch in the current block to indicate whether the template matching method is used.Template matching technology is exemplified by DMVD (decoder side motion vector derivation). Both the encoder and decoder use templates to perform searches, thereby deriving motion information or finding better motion information based on the original motion information. While it is not necessary to transmit specific motion vectors or motion vector differences, both the encoder and decoder perform the same regular search, thereby ensuring consistency between encoding and decoding. Template matching methods can improve compression performance, but they also require "searching" within the decoder, which introduces a certain degree of complexity to the decoder.
[0038] Intra-template matching prediction (intraTMP) is also a prediction technique. As mentioned above, TM can reduce the overhead of encoding MV, and thus TM can reduce the overhead of encoding BV. As an example, there is no need to encode BV, and the matching block found by TM is directly used as the prediction block in intraTMP mode for the current block.
[0039] An example of intraTMP is shown in Figure 11. Using the inverted L-shaped region 111 in the upper left corner of the current block 110 as a template, a search is performed within the search range 112. The search range is the reconstructed region, and the region 112 shown includes the current CTU of R1, the upper left CTU of R2, the upper CTU of R3, and the left CTU of R4. This is just an example, and the search range will differ when actually applied. In the example shown in Figure 11, the optimal matching block 113 is found within R2.
[0040] As explained above, one of the key reasons why IBC can significantly improve the compression efficiency of screen content encoding is that it can find many overlapping blocks in screen content, and screen content usually has sharp boundaries, meaning that in terms of color (luminance and chromaticity), there are situations where sliced areas are the same color (luminance and chromaticity). Camera-captured content also has almost entirely overlapping blocks. Even considering the effects of noise, subtle changes in luminance, and perspective angles, it is undeniable that camera-captured content has overlapping textures.
[0041] intraTMP uses the best matching block found through template matching as the final determined predicted block. In other words, related techniques have a flag that determines whether the current block uses intraTMP when decoding the current block. If the current block uses intraTMP, the decoder uses the template matching method to find one best matching block and uses the value of the best matching block as the predicted value for the current block. Although templates have a strong correlation with the current block, it turns out that the template is not the current block, and the best matching block found by the template (actually the position of the current block corresponding to the template's best matching block) is not necessarily the best matching block for the current block. However, since the decoder does not have the current block during the search, it can only use the best matching block found by the template as the best matching block found by intraTMP.
[0042] To further improve prediction accuracy, you can choose to set N candidates in intraTMP, or set a candidate list of length N, intraTmpCandList[N]. During encoding, if the current block uses intraTMP, after encoding the flag, you need to encode an index to determine which of the N candidates the current block will select. Accordingly, the decoding syntax is as follows, where intra_tmp_flag is the flag of the intraTMP, and if intra_tmp_flag is true, you continue to parse intra_tmp_idx, which represents the index of the selected candidate.
[0043] intra_tmp_flag if(intra_tmp_flag) { intra_tmp_idx }
[0044] The decoder uses the block corresponding to intraTmpCandList[intra_tmp_idx] as the block selected by intraTMP. Alternatively, it uses the BV corresponding to intraTmpCandList[intra_tmp_idx] as the BV selected by intraTMP.
[0045] When constructing intraTmpCandList, intraTMP calculates the template cost under each BV search. The template cost is generally the cost of template matching for a block of the same size as the current block, determined by the current block's template and the current BV. This cost can be SAD, SATD, SSE, etc. IntraTMP can sort the searched blocks or BVs in ascending order according to these costs, and the first N sorted candidates are the N candidates in intraTmpCandList. Alternatively, it can keep only the first N candidates with the smallest cost and directly discard any sorted candidates beyond N, thereby saving computational complexity.
[0046] Typically, blocks corresponding to adjacent BVs are relatively close together, and especially when BVs support sub-pixel accuracies such as 1 / 2, 1 / 4, 1 / 8, and 1 / 16 precision, sorting solely according to the template cost without any control tends to concentrate multiple candidates within a small range. Therefore, some control is needed in intraTmpCandList to avoid excessive concentration of candidate BVs.
[0047] Furthermore, the search process does not involve sequentially searching for each possible BV. For example, the usual search order is from left to right and from top to bottom. Generally, all pixel BVs can be searched sequentially. If the currently searched BV is (x0, y0), the next is (x0+1, y0), assuming that the search range boundary has not been reached. However, a sparse search can be performed first. For example, in the case of all pixel BVs, if the currently searched BV is (x0, y0), the next is (x0+3, y0), assuming that the search range boundary has not been reached. In other words, it is also possible to perform one template matching for every certain number of pixels and one template matching for every certain step size. The step size here can be a preset value such as 2, 3, 4, or 8. Of course, the same process can also be performed vertically. First, find the K BVs with the minimum cost, where K may be equal to N, greater than N, or less than N. This process may also be implemented by constructing a list, i.e., constructing a candidate list of length K. Next, based on the K BVs with the minimum cost, we improve each BV within a small range. For example, if the search interval above is 3 pixels, the range to be improved here can be set to 3x3, and the improved BVs may be used to build a candidate list of length N, thereby obtaining N candidate BVs.
[0048] Figure 12 is a schematic diagram of the first search. Figure 13 is a schematic diagram of the second search. As shown in the figures, for example, if N is set to 3, in the first step, the first search is performed according to a predetermined step size, and the upper left corner of the searched block is shown as a dark dot in Figure 12. A certain number of sorted BVs, for example 3 BVs, are found, and the upper left corner of the corresponding block is shown as a dark dot in Figure 13. Here, the horizontal step size is 3, and the vertical step size is also 3.
[0049] In the second step, a second search is performed based on the three sorted BVs, this time with a 4x4 search range, and each BV within each 3x3 range participates in sorting intraTmpCandList, as shown by the dark dots in Figure 13. Of course, if the BV with the lowest cost is still the original BV, re-sorting is not necessary.
[0050] If sub-pixel precision is supported, further subdivision down to the sub-pixel BV can be performed. For example, based on the all-pixel BV selected in the second step, a search for half a pixel can be performed within a single pixel range in the upper, lower, left, or right directions.
[0051] It should be explained that the candidate list is constructed on both the encoding and decoding sides, thereby ensuring that the candidate list obtained on the encoding side matches the candidate list obtained on the decoding side.
[0052] In the process of binarizing intra_tmp_idx, considering that intraTmpCandList is sorted, statistically, the closer a candidate is to the front, the higher the probability of it being selected. Therefore, for the binarization and de-binarization of intra_tmp_idx, you can either set variable-length coding as shown in Table 1 below, or use truncated binary.
[0053] [Table 1]
[0054] Of course, if the probabilistic difference is small, fixed-length coding or truncated binary can be used.
[0055] When N is large, the probability of the first candidate is high, decreases towards the end, and the probabilities become closer to each other towards the end. Therefore, the first codeword is short, the last codeword is long, and several later candidates can use the same code length. For example, as shown in Table 2, in one example N is 15, indices 3-6 use codewords of the same length, indices 7-14 use codewords of the same length, and x in the table may be obtained by truncated binary.
[0056] [Table 2]
[0057] Figure 14 is a schematic diagram of the first template type. As shown in Figure 14, the template currently used in intraTmp within the ECM is an inverted L-shaped template that includes a left-side neighbor reconstruction sample, an upper-side neighbor reconstruction sample, and a left-upper-side neighbor reconstruction sample, while some other techniques using template matching also have templates that do not use the left-upper-side neighbor sample.
[0058] In addition to complete templates, it is also possible to use only a portion of a region as a template, as shown in Figure 14 with its upper and left-side templates. For the sake of explanation, complete templates (inverse L or T+L) are collectively referred to as TL templates, the upper template as the T template, and the left-side template as the L template. A variety of different templates can provide more choices. Template matching works by using a template to estimate the current block. Blocks with a high degree of template match are assumed to have a high degree of match in the current block as well. However, video content, especially images captured by a camera, is diverse. If we assume that the texture changes on both the left and right sides near the left edge of the current block, it may be more appropriate to use only the T template rather than the TL template. Similarly, if we assume that the texture changes on both the top and bottom sides near the top edge of the current block, it may be more appropriate to use only the L template rather than the TL template.
[0059] Of course, you can also add reconstruction samples to the templates, such as upper right and lower left reconstruction samples. For example, extend the T template by a certain distance to the right in addition to the part shown in the diagram, and extend the L template by a certain distance downwards in addition to the part shown in the diagram. Alternatively, you can add upper right templates, lower left templates, etc., in addition to the T and L templates.
[0060] As can be seen from the above, the intraTMP multiple candidate method uses a template to select a few promising candidates from a vast number of possible BVs, and the encoder selects one candidate to determine the reference block or predicted block of the current block. Due to the correlation between the current block and the template, the template can effectively filter out most of the irrational BVs, while the encoder can make a more accurate decision than the decoder because it has access to the original pixel values of the current block. In this way, better compression efficiency can be achieved through the cooperation of the encoder and decoder.
[0061] Since templates cannot represent the current block, intraTMP multiple candidates provide multiple choices that can improve compression efficiency, and templates of different shapes provide multiple choices at the template level. Therefore, combining intraTMP multiple candidates with multiple types of templates can provide better compression efficiency.
[0062] Embodiments of the present application provide an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium, wherein the encoder / decoder determines a first template corresponding to the current block, where the first template is one or more candidate templates in a template set corresponding to the current block, determines a list of candidate block vectors corresponding to the current block based on the first template, determines a block vector corresponding to the current block based on the list of candidate block vectors corresponding to the current block, and determines a predicted value for the current block based on the block vector. As can be seen from the above, embodiments of the present application propose a prediction scheme that combines multiple intraTMP candidates and multiple templates, where it is possible to choose to determine a list of candidate block vectors that include at least one block vector for the current block, and at the same time, it is possible to choose to construct a list of candidate block vectors using a first template that includes at least one candidate template, and furthermore, a combination of multiple intraTMP candidates and multiple selections at the template level can be realized. In other words, the encoding and decoding method proposed in the embodiment of the present invention realizes intraTMP multiple candidates by constructing a list of block vector candidates corresponding to the current block, and on the other hand, provides multiple selections at the template level using a first template corresponding to the current block that includes one or more candidate templates, thereby improving compression efficiency and encoding and decoding performance.
[0063] The embodiments of this application will be described in detail below with reference to the drawings.
[0064] Referring to Figure 15, a schematic block diagram of the encoder configuration according to an embodiment of the present invention is shown. As shown in Figure 15, the encoder (specifically, a "video encoder") 100 may include a transform and quantization unit 101, an intra-estimation unit 102, an intra-prediction unit 103, a motion compensation unit 104, a motion estimation unit 105, an inverse transform and inverse quantization unit 106, a filter control analysis unit 107, a filtering unit 108, an encoding unit 109, and a decoded image cache unit 110, etc. Here, the filtering unit 108 can implement deblocking filtering and sample adaptive offset (SAO) filtering, and the encoding unit 109 can implement header information encoding and context-based adaptive binary arithmetic coding (CABAC). For the input original video signal, a video coding block can be obtained by dividing it into a Coding Tree Unit (CTU). Subsequently, the video coding block is transformed by a transformation and quantization unit 101 using residual pixel information obtained after intra or interprediction, which includes converting the residual information from the pixel region to the transformation region, quantizing the resulting transformation coefficients, and further reducing the bitrate. The intraestimation unit 102 and intraprediction unit 103 are used to perform intraprediction on the video coding block; more precisely, the intraestimation unit 102 and intraprediction unit 103 are used to determine the intraprediction mode used to encode the video coding block. The motion compensation unit 104 and motion estimation unit 105 are used to perform interpredictive coding of the received video coding block for one or more blocks in one or more reference frames to provide time prediction information.Motion estimation performed by the motion estimation unit 105 is a process that generates motion vectors, which can estimate the motion of the video coding block. Subsequently, the motion compensation unit 104 performs motion compensation based on the motion vectors determined by the motion estimation unit 105. After determining the intra-prediction mode, the intra-prediction unit 103 is further used to provide the selected intra-prediction data to the coding unit 109, and the motion estimation unit 105 also transmits the calculated and determined motion vector data to the coding unit 109. The inverse transform and inverse quantization unit 106 is for the reconstruction of the video coding block, reconstructing the residual block in the pixel region. The reconstructed residual block is then processed by the filter control analysis unit 107 and the filtering unit 108 to remove block effect artifacts. The reconstructed residual block is then added to the predictability block in the frame of the decoding image cache unit 110 to generate the reconstructed video coding block. The encoding unit 109 is for encoding various encoding parameters and post-quantization conversion coefficients. In a CABAC-based encoding algorithm, the context content may be used to encode information indicating the determined intra-prediction mode based on adjacent encoding blocks and to output a bitstream of the video signal. The decoded image cache unit 110 is used to store reconstructed video encoding blocks for prediction reference. As video image encoding progresses, new reconstructed video encoding blocks are continuously generated, and all of these reconstructed video encoding blocks are stored in the decoded image cache unit 110.
[0065] Referring to Figure 16, a schematic block diagram of the decoder configuration according to an embodiment of the present invention is shown. As shown in Figure 16, the decoder (specifically, the "video decoder") 200 includes a decoding unit 201, an inverse transform and inverse quantization unit 202, an intra prediction unit 203, a motion compensation unit 204, a filtering unit 205, and a decoded image cache unit 206. Here, the decoding unit 201 can perform header information decoding and CABAC decoding, and the filtering unit 205 can perform deblocking filtering and SAO filtering. After the input video signal undergoes the encoding process shown in Figure 15, it outputs a bitstream of the video signal, which is input to the decoder 200. The bitstream first passes through the decoding unit 201 to obtain the decoded conversion coefficients. The inverse transform and inverse quantization unit 202 processes these conversion coefficients to generate residual blocks in the pixel region. The intra-prediction unit 203 may be used to generate prediction data for the current video decoding block based on the determined intra-prediction mode and data from previous decoding blocks from the current frame or picture. The motion compensation unit 204 determines prediction information for the video decoding block by analyzing the motion vector and other relevant syntax elements, and uses this prediction information to generate a predictability block for the video decoding block being decoded. The decoded video block is formed by adding the residual block from the inverse transform and inverse quantization unit 202 to the corresponding predictability block generated by the intra-prediction unit 203 or the motion compensation unit 204. The decoded video signal can be filtered by the filtering unit 205 to remove block effect artifacts and improve the video quality. The decoded video block is then stored in the decoded image cache unit 206, which stores reference images for subsequent intra-prediction or motion compensation and is also used to output the video signal, i.e., to obtain the restored original video signal.
[0066] Furthermore, embodiments of the present application further provide a network architecture for an encoding and decoding system including an encoder and a decoder. Figure 17 shows a schematic diagram of the network architecture of an encoding and decoding system according to embodiments of the present application. As shown in Figure 17, the network architecture includes one or more electronic devices 13-1N and a communication network 01, where the electronic devices 13-1N can perform video interaction via the communication network 01. The electronic devices may be various types of devices with video encoding and decoding capabilities in the implementation process, and may include, but are not specifically limited to, smartphones, tablet computers, personal computers, personal digital assistants, navigators, digital phones, video phones, televisions, sensing devices, servers, etc. Here, the decoder or encoder described in embodiments of the present application may be one of the aforementioned electronic devices.
[0067] It should be explained that the method of the embodiment of this application is mainly applied to the intra-prediction unit 103 shown in Figure 15 and the intra-prediction unit 203 shown in Figure 16. In other words, the embodiment of this application can be applied not only to encoders but also to decoders, and can be applied to both encoders and decoders simultaneously, but the embodiment of this application is not specifically limited.
[0068] Furthermore, when applied to the intra-prediction unit 103, "current block" specifically refers to the coding block on which intra-prediction is currently being performed, and when applied to the intra-prediction unit 203, "current block" specifically refers to the decoding block on which intra-prediction is currently being performed.
[0069] One embodiment of the present invention provides a decoding method applicable to a decoder. Figure 18 is a schematic flowchart of the decoding method proposed in the embodiment of the present invention. As shown in Figure 18, the method by which the decoder performs the decoding process may include the following steps.
[0070] In step 101, a first template is determined that corresponds to the current block, where the first template is one or more candidate templates within the template set that corresponds to the current block.
[0071] In the embodiments of this invention, first, a first template corresponding to the current block can be determined.
[0072] 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 include an intra-prediction method, more specifically a color component prediction method. Here, the video image may be divided into a plurality of decoding blocks, each decoding block may include a first color component, a second color component, and a third color component. In the embodiment of the present application, the current block refers to the decoding block in the video image where intra-prediction is currently being performed.
[0073] Here, if we need to predict the first color component, the component to be predicted is the first color component; if we need to predict the second color component, the component to be predicted is the second color component; and if we need to predict the third color component, the component to be predicted is the third color component. Also, if we predict the first color component for the current block and assume that the first color component is the luminance component, i.e., the component to be predicted is the luminance component, then the current block may also be called a luminance block. Alternatively, if we predict the second color component for the current block and assume that the second color component is the chromaticity component, i.e., the component to be predicted is the chromaticity component, then the current block may also be called a chromaticity block.
[0074] It should be explained that in the embodiments of the present invention, the first template corresponding to the current block may be any number of candidate templates in the template set corresponding to the current block, where the candidate templates corresponding to the current block include candidate templates of multiple different template types.
[0075] In embodiments of the present invention, it can be understood that a set of templates corresponding to the current block is first constructed based on different template types, and then any number of candidate templates in the set of templates can be selected as the first template corresponding to the current block.
[0076] Exemplary, in the embodiment of the present application, Figure 19 is a second schematic diagram of the template type. As shown in Figure 19, when the upper left reference sample, upper reference sample, and left reference sample are all available, the shape of the template is as shown in (a). When only the left reference sample is available, the shape of the template is as shown in (b). When only the upper reference sample is available, the shape of the template is as shown in (c). When only the left reference sample and upper left reference sample are available, the shape of the template is as shown in (d). When only the left reference sample and lower left reference sample are available, the shape of the template is as shown in (e). When only the upper reference sample and upper right reference sample are available, the shape of the template is as shown in (f).
[0077] Furthermore, in the embodiments of the present invention, when constructing a template set corresponding to the current block based on the template type, it is possible to first determine a template reference sample for the current block based on the template type and the template size corresponding to the template type, then determine candidate templates for the current block based on the template reference sample, and finally complete the construction of the template set.
[0078] Exemplary, in the embodiment of the present application, Figure 20 is a schematic diagram of a candidate template. As shown in Figure 20, corresponding to four different template types, the candidate template of the current block that is ultimately generated may also include four templates: Candidate Template 1 (TL template), Candidate Template 2 (TL template), Candidate Template 3 (T template), and Candidate Template 4 (L template).
[0079] Furthermore, in the embodiments of the present invention, the first template corresponding to the current block is determined based on candidate templates in the template set, where the first template may include any number of candidate templates.
[0080] It should be explained that in the embodiments of the present invention, the first candidate template in the template set may be a template that includes a left-side adjacent reconstruction sample and an upper-side adjacent reconstruction sample of the current block, such as a TL template; the second candidate template in the template set may be a template that includes an upper-side adjacent reconstruction sample of the current block, such as a T template; and the third candidate template in the template set may be a template that includes a left-side adjacent reconstruction sample of the current block, such as an L template.
[0081] For example, in some embodiments, the first template corresponding to the current block may be the first candidate template in the template set corresponding to the current block, such as candidate template 1.
[0082] For example, in some embodiments, the first template corresponding to the current block may be the first and second candidate templates in the template set corresponding to the current block, such as candidate template 1 and candidate template 3.
[0083] For example, in some embodiments, the first template corresponding to the current block may be the first, second, and third candidate templates within the template set corresponding to the current block, such as candidate template 1, candidate template 3, and candidate template 4.
[0084] Furthermore, in the embodiments of the present invention, the bitstream can be decoded to determine template matching prediction identifier information corresponding to the current block, and if the value of the template matching prediction identifier information is a first value, the process of determining the first template can be executed, that is, the process of determining the first template proposed in step 101 is executed.
[0085] In embodiments of the present application, it can be understood that template matching prediction identifiers can be used to determine whether the current block uses template matching prediction, i.e., the template matching prediction identifiers can indicate whether the current block is subject to prediction processing via intraTMP.
[0086] For example, in some embodiments, the bitstream can be decoded to determine a variable that functions as template matching predictive identifier information, thereby enabling the determination of template matching predictive identifier information based on the value of the variable.
[0087] It should be explained that in this application, the value of the template matching prediction identifier may be either a first or second value. Specifically, if the value of the template matching prediction identifier is different, the method for determining the predicted value of the current block will also be different. Specifically, when determining the predicted value of the current block based on the value of the template matching prediction identifier, it is possible to choose to use intraTMP or not use intraTMP.
[0088] Exemplary, in some embodiments, the template matching prediction identifier can be understood as a flag indicating whether to perform intraTMP. Here, if the value of the template matching prediction identifier is a first value, it can be chosen to use intraTMP to determine the prediction value of the current block. If the value of the template matching prediction identifier is a second value, it can be chosen not to use intraTMP to determine the prediction value of the current block.
[0089] For illustrative purposes, in some embodiments, the first value may be set to 1 and the second value to 0. Alternatively, the first value may be set to true and the second value to false. No limitations are imposed in this application.
[0090] Exemplary, in some embodiments, the flag intra_tmp_flag can be used to represent template matching predictive identification information, i.e., a flag where intra_tmp_flag is intraTMP is used.
[0091] For illustrative purposes, in some embodiments, a value of 1 for intra_tmp_flag can represent that it is chosen to use intraTMP to determine the predicted value of the current block, and a value of 0 for intra_tmp_flag can represent that it is not chosen to use intraTMP to determine the predicted value of the current block.
[0092] In embodiments of the present application, it can be understood that if the value of the template matching predictive identifier is a first value, that is, after determining the predicted value of the current block using intraTMP based on the value of the template matching predictive identifier, the process of determining the first template corresponding to the current block can be performed.
[0093] Furthermore, in the embodiments of the present invention, when determining the first template corresponding to the current block, the bitstream is decoded, the first template instruction information corresponding to the current block is determined, and if the value of the first template instruction information is a third value, it can be determined that the first template is the first candidate template.
[0094] It should be noted that in the embodiments of this application, the first candidate template may be one of the candidate templates in the template set corresponding to the current block. For example, the first candidate template may be a TL template in the template set.
[0095] In embodiments of the present application, the first template instruction information may be used to determine whether the current block uses a first candidate template, that is, it can be understood that the first template instruction information can indicate whether the current block uses a first candidate template to perform predictive processing of intraTMP.
[0096] For example, in some embodiments, the bitstream can be decoded to determine a variable that functions as first template instruction information, thereby enabling the determination of the first template instruction information by the value of the variable.
[0097] It should be explained that in this application, the value of the first template instruction information may be a third or fourth value. Specifically, when executing intraTMP based on the value of the first template instruction information, it is possible to choose to use the first candidate template, or to not use the first candidate template and instead use another template, such as another template in the template set other than the first candidate template.
[0098] For illustrative purposes, in some embodiments, the third value may be set to 0 and the fourth value to 1. Alternatively, the third value may be set to false and the fourth value to true. No limitations are imposed in this application.
[0099] Exemplary, in some embodiments, the flag intra_tmp_alternative_template_flag can be used to represent the first template indication information. For example, a value of intra_tmp_alternative_template_flag of 0 can indicate that the first candidate template is determined to be the first template corresponding to the current block, while a value of intra_tmp_alternative_template_flag of 1 can indicate that the first candidate template is not determined to be the first template corresponding to the current block, and that another template is still selected as the first template corresponding to the current block.
[0100] Correspondingly, in the embodiments of the present invention, after determining the first template instruction information corresponding to the current block, if the value of the first template instruction information is the fourth value, it can be determined that the first template is not the first candidate template, and it is necessary to further determine the second template instruction information corresponding to the current block.
[0101] Furthermore, in the embodiments of the present invention, when determining the first template corresponding to the current block, the bitstream is decoded and second template indication information corresponding to the current block is determined. If the value of the second template indication information is the fifth value, it can be determined that the first template is the second candidate template, and if the value of the second template indication information is the sixth value, it can be determined that the first template is the third candidate template.
[0102] It should be noted that in the embodiments of this application, the second candidate template and the third candidate template may each be a candidate template within the template set corresponding to the current block. For example, the second candidate template may be a T template within the template set, and the third candidate template may be an L template within the template set.
[0103] In embodiments of the present application, the second template instruction information may be used to determine whether the current block uses a second candidate template and / or a third candidate template, that is, it can be understood that the second template instruction information can indicate whether the current block uses a second candidate template and / or a third candidate template to perform predictive processing of intraTMP.
[0104] For example, in some embodiments, the bitstream can be decoded to determine a variable that functions as a second template instruction, thereby enabling the determination of the second template instruction by the value of the variable.
[0105] It should be explained that in this application, the value of the second template instruction information may be the fifth or sixth value. Specifically, when executing intraTMP based on the value of the second template instruction information, it is possible to choose to use the second candidate template, or to choose to use the third candidate template.
[0106] For example, in some embodiments, the fifth value may be set to 0 and the sixth value to 1. Alternatively, the fifth value may be set to false and the sixth value to true. No limitations are imposed in this application.
[0107] For example, in some embodiments, the flag intra_tmp_template_idx can be used to represent the second template instruction information. For instance, a value of 0 for intra_tmp_template_idx can indicate that the second candidate template is determined to be the first template corresponding to the current block, and a value of 1 for intra_tmp_template_idx can indicate that the third candidate template is determined to be the first template corresponding to the current block.
[0108] In other words, in embodiments of the present invention, it is possible to choose to indicate in the bitstream which candidate template in the template set corresponds to the first template that corresponds to the current block. For example, the first template may be indicated using first template indication information and second template indication information.
[0109] For illustrative purposes, in some examples, we have three candidate templates: a TL template, a T template, and an L template. If the first candidate template is the TL template, the second candidate template is the T template, the third candidate template is the L template, the flag intra_tmp_flag represents template matching prediction identification information, the flag intra_tmp_alternative_template_flag represents the first template indication information, and the flag intra_tmp_template_idx represents the second template indication information, then the information in the bitstream can be decoded as follows.
[0110] intra_tmp_flag if(intra_tmp_flag){ intra_tmp_alternative_template_flag if(intra_tmp_alternative_template_flag){ intra_tmp_template_idx } intra_tmp_idx }
[0111] Here, the template matching prediction identifier intra_tmp_flag indicates whether the current block uses intraTmp. If the current block uses intraTmp, the decoder parses intra_tmp_alternative_template_flag, which indicates whether the current block uses another template. A value of 0 for intra_tmp_alternative_template_flag indicates that the current block uses a TL template. If the value of intra_tmp_alternative_template_flag is 1, the decoder parses intra_tmp_template_idx, which indicates whether the current block uses a T template or an L template. For example, a value of 0 for intra_tmp_template_idx indicates that the current block uses a T template, and a value of 1 for intra_tmp_template_idx indicates that the current block uses an L template.
[0112] Furthermore, in the embodiments of the present invention, when determining the first template corresponding to the current block, the bitstream is decoded and third template indication information corresponding to the current block is determined. If the value of the third template indication information is value 7, it can be determined that the first template is the first candidate template. If the value of the third template indication information is value 8, it can be determined that the first template is the second candidate template. If the value of the third template indication information is value 9, it can be determined that the first template is the third candidate template.
[0113] It should be noted that in the embodiments of this application, the first candidate template, the second candidate template, and the third candidate template may each be a candidate template within the template set corresponding to the current block. For example, the first candidate template may be a TL template within the template set, the second candidate template may be a T template within the template set, and the third candidate template may be an L template within the template set.
[0114] In embodiments of the present application, the third template instruction information may be used to determine whether the current block uses the first candidate template and / or the second candidate template and / or the third candidate template, that is, it can be understood that the third template instruction information can indicate whether the current block uses the first candidate template and / or the second candidate template and / or the third candidate template to perform the intraTMP prediction processing.
[0115] For example, in some embodiments, the bitstream can be decoded to determine a variable that functions as third template instruction information, thereby enabling the determination of the third template instruction information by the value of the variable.
[0116] It should be explained that in this application, the value of the third template instruction information may be the seventh, eighth, or ninth value. Specifically, when executing intraTMP based on the value of the third template instruction information, it is possible to choose to use the first candidate template, the second candidate template, or the third candidate template.
[0117] For example, in some embodiments, the seventh value may be set to 0, the eighth value to 1, and the ninth value to 2, and no limitation is imposed in this application.
[0118] For example, in some embodiments, the flag intra_tmp_template_idx can be used to represent third template instruction information. For instance, a value of 0 for intra_tmp_template_idx can indicate that the first candidate template is determined to be the first template corresponding to the current block; a value of 1 for intra_tmp_template_idx can indicate that the second candidate template is determined to be the first template corresponding to the current block; and a value of 2 for intra_tmp_template_idx can indicate that the third candidate template is determined to be the first template corresponding to the current block.
[0119] In other words, in embodiments of the present invention, it is possible to choose to indicate in the bitstream which candidate template in the template set corresponds to the first template for the current block. For example, the first template may be indicated using third template indication information.
[0120] For example, in some embodiments, the first template instruction information intra_tmp_alternative_template_flag and the second template instruction information intra_tmp_template_idx may be merged into the same syntactic element intra_tmp_template_idx, i.e., merged into the third template instruction information.
[0121] For illustrative purposes, in some examples, with three candidate templates—TL template, T template, and L template—if the first candidate template is the TL template, the second candidate template is the T template, and the third candidate template is the L template, and the flag intra_tmp_template_idx represents the third template instruction information, then the information in the bitstream can be decoded as follows.
[0122] intra_tmp_flag if(intra_tmp_flag){ intra_tmp_template_idx } intra_tmp_idx } Here, the template matching prediction identifier Intra_tmp_flag indicates whether the current block uses intraTmp. If the current block uses intraTmp, the decoder parses intra_tmp_template_idx. The third template indication information intra_tmp_template_idx indicates whether the current block uses a TL template, a T template, or an L template. A value of intra_tmp_template_idx of 0 indicates that the current block uses a TL template. A value of intra_tmp_template_idx of 1 indicates that the current block uses a T template. A value of intra_tmp_template_idx of 2 indicates that the current block uses an L template.
[0123] Furthermore, in the embodiments of the present invention, when determining the first template corresponding to the current block, the bitstream is decoded, a candidate index corresponding to the current block is determined, and if the value of the candidate index is less than or equal to a preset threshold, it is determined that the first template is the first candidate template.
[0124] Correspondingly, in the embodiment of the present application, after decoding the bitstream and determining a candidate index corresponding to the current block, if the value of the candidate index is greater than a preset threshold, the bitstream is decoded and a third template instruction information corresponding to the current block is determined. If the value of the third template instruction information is the seventh value, it is determined that the first template is the first candidate template; if the value of the third template instruction information is the eighth value, it is determined that the first template is the second candidate template; and if the value of the third template instruction information is the ninth value, it is determined that the first template is the third candidate template.
[0125] It should be explained that in the embodiments of the present invention, a preset threshold can be used to determine whether to use the first candidate template directly. Here, if the value of the candidate index corresponding to the current block is greater than (or equal to) the preset threshold, the system may choose to continue using the third template indication information to determine the first template to be used; if the value of the candidate index corresponding to the current block is less than (or equal to) the preset threshold, the system may choose to directly determine the first candidate template as the first template corresponding to the current block.
[0126] In embodiments of the present invention, it can be understood that one may choose to first decode the bitstream to determine a candidate index corresponding to the current block, and then combine the candidate index with a pre-set threshold to determine whether to select the first candidate template in the template set as the first template. In this way, the first candidate template can be given a higher priority than the other candidate templates, i.e., it is decided whether to use the first candidate template first.
[0127] Understandably, TL templates cover more adjacent areas, and in most cases, textures are continuous from the left and top, so TL templates often have greater reference value than standalone T templates and standalone L templates. TL templates are frequently chosen, with standalone T templates and standalone L templates often used as supplements. Based on this distribution rule, TL templates can be given a higher priority than T templates and L templates.
[0128] In other words, in the embodiments of the present invention, it is possible to choose to indirectly determine whether to use a higher-priority TL template by utilizing the candidate index of the current block. At the same time, it is also possible to indicate in the bitstream which candidate template in the template set corresponds to the first template for the current block. For example, the first template can be indicated using third template indication information.
[0129] For illustrative purposes, in some examples, with three candidate templates—TL template, T template, and L template—if the first candidate template is the TL template, the second candidate template is the T template, and the third candidate template is the L template, and the flag intra_tmp_template_idx represents the third template instruction information, then the information in the bitstream can be decoded as follows.
[0130] intra_tmp_flag if(intra_tmp_flag){ intra_tmp_idx if(intra_tmp_idx>THR){ intra_tmp_template_idx } }
[0131] Here, the template matching prediction identifier Intra_tmp_flag indicates whether the current block uses intraTmp. If the current block uses intraTmp, the decoder first parses intra_tmp_idx and then intra_tmp_template_idx. Whether intra_tmp_template_idx is parsed depends on the value of intra_tmp_idx. If the value of intra_tmp_idx is less than or equal to the preset threshold THR, the TL template is used by default. Otherwise, i.e., if the value of intra_tmp_idx is greater than or equal to the preset threshold THR, intra_tmp_template_idx must be parsed to determine which template the current block should use. The third template indication information intra_tmp_template_idx indicates whether the current block uses a TL template, a T template, or an L template. If the value of intra_tmp_template_idx is 0, it means the current block uses a TL template. A value of 1 for `intra_tmp_template_idx` indicates that the current block uses a T template. A value of 2 for `intra_tmp_template_idx` indicates that the current block uses an L template.
[0132] As can be seen from the above, in the embodiment of the present invention, a candidate index and a pre-set threshold are combined to determine whether to use a TL template in the template set, and it is ensured that some candidates with small indices do not need to distinguish which template to use and will use the TL template by default. In this way, unnecessary overhead can be reduced because these candidates often choose the TL template. The indices of candidate T and L templates can also be thought of as starting from THR instead of 0, which corresponds to assigning longer binary symbol sequences to T and L templates.
[0133] It should be noted that in embodiments of the present invention, the bitstream may choose to indicate which candidate template or which candidate template in the template set corresponds to the first template corresponding to the current block. For example, the first template may be indicated using first template indication information and / or second template indication information and / or third template indication information. Of course, it is also possible to choose not to indicate which candidate template or which candidate template to use in the bitstream, and instead directly construct a list of block vector candidates corresponding to the current block based on multiple candidate templates in the template set.
[0134] Furthermore, in the embodiments of the present application, the first template corresponding to the current block may include multiple candidate templates within the template set. For example, the first template may include three candidate templates: a first candidate template such as a TL template, a second candidate template such as a T template, and a third candidate template such as an L template.
[0135] Correspondingly, in embodiments of the present invention, it is possible to choose to construct a list of block vector candidates using a plurality of possible candidate templates directly, where each block vector in the list may be obtained by template matching using one of TL templates, L templates, or T templates.
[0136] For example, in some embodiments, if the bitstream does not specify which candidate template or which candidate template to use, the decoding syntax elements may be as follows:
[0137] intra_tmp_flag If(intra_tmp_flag) { intra_tmp_idx } Here, intra_tmp_flag is the flag for intraTMP, and if intra_tmp_flag is true, intra_tmp_idx is parsed further, and intra_tmp_idx is used to indicate the candidate index.
[0138] In step 102, a list of candidate block vectors corresponding to the current block is determined based on the first template.
[0139] In the embodiments of the present invention, after determining a first template corresponding to the current block, a list of candidate block vectors corresponding to the current block can be further determined based on the first template.
[0140] It should be noted that in embodiments of the present invention, the list of candidate block vectors corresponding to the current block may include at least one block vector obtained by searching based on a first template corresponding to the current block.
[0141] Furthermore, in the embodiments of the present invention, it is possible to choose to determine a first template corresponding to the current block, and then determine search parameters corresponding to the first template based on that first template.
[0142] In embodiments of the present invention, the search parameters may be understood to include at least one of the search range, search order, and list length. Here, the search range is used to determine the extent of the search region in which the search is performed; the search order is used to determine the forward and backward order of the horizontal and vertical searches performed; and the list length is used to determine the length of the final generated list of candidate block vectors.
[0143] In other words, in the embodiments of the present invention, in the process of constructing a block vector candidate list based on a selected first template, when constructing a list based on a different template, the search method used, including the search range and search order, and the length of the list may be the same or different.
[0144] For example, in some embodiments, if the determined first template is the first candidate template, i.e., if it is decided to use the TL template, the list length of the block vector candidate list is set to 15, and if the determined first template is the second or third candidate template, i.e., if it is decided to use the T template or L template, the list length of the block vector candidate list is set to 8.
[0145] For example, in some embodiments, if the determined first template is the second candidate template, i.e., if it is decided to use the T template, the list length of the block vector candidate list is set to 8, and if the determined first template is the third candidate template, i.e., if it is decided to use the L template, the list length of the block vector candidate list is set to 4.
[0146] Furthermore, in the embodiments of this invention, after determining the search parameters corresponding to the first template, a further search can be performed based on the search parameters and the first template to determine a list of candidate block vectors corresponding to the current block.
[0147] In other words, in the embodiments of the present invention, a first reference template can be referenced in the process of determining a list of block vector candidates corresponding to the current block based on a first template. Specifically, the search parameters determined by the first template can be used in the process of performing the search.
[0148] Furthermore, in the embodiments of this application, a search can be performed based on search parameters corresponding to the current block and a first template, and a block vector candidate list can finally be determined. Specifically, a search is performed based on search parameters such as the search range, search order, and list length corresponding to the current block, and a block vector candidate list corresponding to the current block is finally determined.
[0149] Furthermore, in the embodiments of the present invention, when determining a list of candidate block vectors corresponding to the current block based on a first template, it is possible to first determine a pre-configured search area corresponding to the first template, and then perform a search within the pre-configured search area to determine a list of candidate block vectors corresponding to the current block.
[0150] It should be explained that in the embodiments of this application, the pre-defined search area is the reconstructed portion of the current image and is limited by the size of the search range. Here, the pre-defined search area is actually the set of all search points. Since the shape of this area often cannot be represented by a single rectangular area, in concrete implementation, it is also possible to perform searches in multiple rectangular areas and combine the search results from different areas to obtain the final optimal matching block and optimal block vector.
[0151] Furthermore, in the embodiments of the present invention, when performing a search within a preset search area and determining a list of block vector candidates corresponding to the current block, the search points within the preset search area can be traversed, and the matching cost between the matching template corresponding to the search point within the preset search area and the first template can be determined based on a preset matching criterion. Subsequently, the list of block vector candidates can be determined based on the matching cost.
[0152] It should be explained that in the embodiments of the present invention, the candidate list of block vectors corresponding to the current block includes one or more block vectors corresponding to the current block obtained by the search, and one or more candidate templates corresponding to one or more block vectors.
[0153] In other words, in the embodiments of the present invention, the number of block vectors determined by the search may be one or more. For example, if the length of the list of candidate block vectors is N, then N block vectors for the current block can be determined, where N is an integer greater than 0.
[0154] Correspondingly, in the embodiment of the present invention, when performing a search within a preset search area and determining a list of candidate block vectors corresponding to the current block, the search points within the preset search area can be scanned, and the matching cost between the matching template corresponding to the search point within the preset search area and the first template can be determined based on a preset matching criterion. Finally, based on the matching cost, N block vectors and N candidate templates corresponding to the N block vectors can be determined, and a corresponding list of candidate block vectors can be generated.
[0155] In other words, in the embodiments of the present invention, when searching for and determining N block vectors corresponding to N matching templates within a pre-set search area, that is, the process of searching for and determining block vectors BV corresponding to N matching templates within a search area (a pre-set search area) may include determining the value of the number N of candidate templates, determining the comparison criteria for the matching templates, and recording the N block vectors BV corresponding to the N matching templates (the selected N candidate templates).
[0156] It should be explained that in the embodiments of the present invention, the pre-set matching criteria include one of the cost functions for measuring the mode, such as the absolute error sum SAD, transformed absolute error sum SATD, squared error sum SSE, mean absolute deviation MAD, mean absolute error MAE, mean squared error MSE, or normalized correlation coefficient NCC.
[0157] Furthermore, in the embodiment of the present invention, when determining a list of candidate block vectors corresponding to the current block based on the matching cost, that is, determining N block vectors and N candidate templates corresponding to the N block vectors (the list length of the candidate block vector list is N), first, N minimum matching costs can be determined from among the matching costs between the matching template corresponding to the search point in the pre-set search area and the first template, and then N block vectors and N candidate templates corresponding to the N minimum matching costs can be determined.
[0158] It should be noted that in the embodiments of the present application, when performing a search, the search strategies that can be employed may include, but are not limited to, search methods based on different search step sizes, for example, a coarse search based on a first search step size and / or a fine search based on a second search step size, where the first search step size is larger than the second search step size.
[0159] Furthermore, in the embodiment of the present invention, first, the search points within a preset search area are scanned according to a first search step size to determine an initial block vector and an initial matching template corresponding to the initial block vector. Next, the first search area is determined based on the initial matching template, where the first search area is smaller than the preset search area. Finally, the search points within the first search area are scanned according to a second search step size to determine a block vector and a candidate template, and a corresponding block vector candidate list is determined. Here, the first search step size is larger than the second search step size.
[0160] As can be seen from the above, in the embodiments of this application, it is possible to choose not to sequentially search for each possible BV in the search process. For example, the normal search order is from left to right and from top to bottom. Generally, all pixel BVs can be searched sequentially. For example, if the BV currently being searched is (x0, y0), the next is (x0+1, y0), assuming that the boundary of the search range has not been reached. In this application, a sparse search can be performed first. For example, in the case of all pixel BVs, if the BV currently being searched is (x0, y0), the next is (x0+3, y0), assuming that the boundary of the search range has not been reached. In other words, it is also possible to perform one template matching for every certain number of pixels and one template matching for every certain step size. The step size here may be a preset value such as 2, 3, 4, or 8. Of course, the same process can also be performed in a vertical way. First, find the K BVs with the minimum cost, where K may be equal to N, or may be greater than or less than N. This process may be implemented by constructing a list. Next, based on the K BVs with the minimum cost, we improve each BV within a small range. For example, if the search interval above is 3 pixels, the range to be improved here can be set to 3x3, and the improved BVs may be used to construct a block vector candidate list of length N, in this way we can obtain N candidate BVs.
[0161] Exemplary, in some embodiments, for example, N can be set to 3, and a first search can be performed according to a predetermined step size to find a certain number of sorted BVs, for example, 3 BVs. Here, the horizontal step size is 3 and the vertical step size is also 3. Next, a second search is performed based on the 3 sorted BVs, this time with a search range of 3x3, and each BV within each 3x3 range participates in sorting the block vector candidate list intraTmpCandList.
[0162] It should be noted that, in the embodiments of this application, if sub-pixel accuracy is supported, further subdivision down to the sub-pixel BV can be performed. For example, based on the total pixel BV selected in the second step, a search for half a pixel can be performed within a single pixel range in the upper, lower, left, or right direction.
[0163] It should be explained that, in the embodiments of this application, if the bitstream does not specify which candidate template or which candidate template to use, the process of directly constructing a list of block vector candidates corresponding to the current block based on multiple candidate templates in the template set requires comparing the matching costs of different candidate templates. In this case, because the different candidate templates have different sizes or pixels, it is necessary to uniformly adjust the matching costs of different candidate templates when comparing them.
[0164] In embodiments of the present invention, it may be understood that in the process of adjusting the matching costs of different candidate templates, it may be chosen to adjust the corresponding initial cost using pixel parameters corresponding to the candidate templates, or it may be chosen to determine template coefficients corresponding to the candidate templates and then adjust the corresponding initial cost using said template coefficients.
[0165] Furthermore, in the embodiments of this application, in the process of constructing a block vector candidate list, the search points within a preset search area can be scanned, and the initial cost between the matching template corresponding to the search points within the preset search area and the first template can be determined based on a preset matching criterion. Next, the initial cost can be adjusted based on the pixel parameters corresponding to the candidate template, and the matching cost between the matching template corresponding to the search points within the preset search area and the first template can be determined. Finally, the block vector candidate list can be determined based on the matching cost.
[0166] In other words, in the embodiments of the present invention, when a single block vector candidate list is directly constructed using multiple candidate templates such as TL templates, L templates, and T templates, each block vector in the block vector candidate list may be obtained by template matching using either a TL template, an L template, or a T template. In this case, the basic principle for constructing the block vector candidate list is to sort the matching costs of different candidate templates.
[0167] In the embodiments of this application, it can be understood that directly comparing the matching costs of several different candidate templates would result in inaccurate results because the number of pixels in each candidate template differs. For example, directly comparing the SADs of different templates is unreasonable, given that the matching cost is SAD. For instance, for the same BV, the SAD of the TL template is equal to the sum of the SADs of the T template and the L template.
[0168] For example, in some embodiments, when comparing the matching costs of different candidate templates, it may be chosen to adjust the matching cost (initial cost) based on the pixel parameters of the different templates. Here, the pixel parameter may be the number of pixels corresponding to the candidate template. For example, when adjusting the matching cost (initial cost) using the pixel parameter, the absolute value of the average difference (adjusted matching cost) can be obtained by dividing the initial cost corresponding to the candidate template (e.g., SAD) by the number of pixels corresponding to that candidate template (pixel parameter). This division result can be called the average absolute difference (AAD), and that is, the finally determined matching cost may be the corresponding AAD.
[0169] In the embodiments of the present invention, it can be understood that by adjusting the initial cost based on the pixel parameters of different templates and obtaining the matching cost AAD corresponding to different candidate templates, the influencing factor of different pixel counts for different candidate templates can be removed, and the matching costs of further different candidate templates can be compared to finally generate a corresponding block vector candidate list.
[0170] Furthermore, in the embodiments of the present invention, if the first template includes multiple candidate templates within the template set, the template coefficients corresponding to each candidate template may be determined first.
[0171] It should be explained that when determining the template coefficients for each candidate template, one can choose to determine the template coefficients based on the size parameter corresponding to the candidate template, or based on the pixel parameter corresponding to the candidate template, or even set the template coefficients for different candidate templates according to pre-set values.
[0172] Understandably, in the embodiments of the present invention, different candidate templates correspond to different template coefficients, and by uniformly adjusting the matching costs of different templates using the template coefficients corresponding to different candidate templates, a more rational and accurate list of block vector candidates can be obtained when sorting the matching costs.
[0173] Furthermore, in the embodiments of this application, in the process of constructing a block vector candidate list, the search points within a pre-defined search area can be scanned, and the initial cost between the matching template corresponding to the search point within the pre-defined search area and the first template can be determined based on pre-defined matching criteria. Next, the initial cost can be adjusted based on template coefficients to determine the matching cost between the matching template corresponding to the search point within the pre-defined search area and the first template. Finally, the block vector candidate list can be determined based on the matching cost.
[0174] For example, in some embodiments, when comparing the matching costs of different candidate templates, it may be chosen to compare them based on the template coefficients of the different templates. For instance, the SAD of the different candidate templates can be multiplied by a single coefficient (template coefficient) to complete the adjustment for the initial costs of the different candidate templates, thereby allowing the different candidate templates to be compared by their adjusted matching costs.
[0175] It should be explained that, in the embodiments of this application, assuming that the TL template includes both a T template and an L template, the number of pixels in the TL template is always the maximum, so only the T template and the L template can be multiplied by one template coefficient, but it is not necessary to multiply the TL template by one, or the template coefficient of the TL template is set to 1.
[0176] For example, in some embodiments, the initial cost SAD of the TL template is SAD TL It states that the initial cost of the T template is SAD. T It states that the initial cost of the L template is SAD. L It is written as follows: The matching cost of the TL template for comparison with other templates is COST TL It states that the matching cost of the T template is COST T It states that the matching cost of the L template is COSTL is denoted as.
[0177] Using the corresponding template coefficients respectively, for example, the template coefficient of the TL template is 1, and the template coefficient of the T template is COEF T and the template coefficient of the TL template is COEF L in the case of, COST TL = SAD TL COST T = SAD T * COEF T COST L = SAD L * COEF L can be determined.
[0178] Here, COEF T and COEF L may be calculated according to the number of pixels of the candidate template. COEF T and COEF L for different block sizes can be calculated in advance.
[0179] Exemplarily, in some embodiments, when the TL template does not include the upper left corner part, that is, the TL template is equal to the sum of the T template and the L template, and the width of the current block is equal to the height, COEF T is equal to 2, and COEF L is equal to 2. However, it is still impossible to avoid that COEF T or COEF L is a decimal. For example, when the width is twice the height, COEF T is equal to 1.5, and COEF L is equal to 3.
[0180] After adjusting using the corresponding template coefficients respectively, COST TL = SAD TL * COEF TL COST T = SAD T * COEF TCOST L =SAD L *COEF L It is possible to make a decision.
[0181] Here, COST TL COST T and COST L COST may be calculated by the number of pixels in multiple templates. TL COST T and COST L This can be calculated in advance.
[0182] For example, in some embodiments, if the TL template does not include the upper left corner portion, i.e., the TL template is equal to the sum of the T template and the L template, and the width of the current block is equal to the height, then COEF TL is equal to 1, COEF T is equal to 2, COEF L COEF is equal to 2. For example, if width is twice height, then COEF TL is equal to 2, COEF T It is equal to 3, COEF L This is equal to 6. The method for calculating the template coefficients of a given template is to divide the least common multiple of the number of pixels in each template by the number of pixels in the given template.
[0183] It is understandable that, in the embodiments of this application, for the matching costs of the TL template, T template, and L template of the same BV, if the matching degree of the T template and the matching degree of the L template (such as the AAD mentioned above) are different, even if only slightly different, the COST calculated according to the pixel ratio will be affected. T or COST L One of them is COST TLIt should be smaller than that. In other words, if you adjust the template coefficients of multiple candidate templates (TL template, T template, L template, etc.) using pixel parameters or size parameters, and then directly compare the matching costs of the TL template, T template, and L template after the adjustment, the TL template will be at a disadvantage in most cases. That is, if you compare them directly according to the method described above, you will be comparing only the parts with a high degree of matching between different BVs. However, in reality, the TL template covers more adjacent areas, and in most cases the texture is continuous from the left and top, so it is illogical to use the T and L templates indiscriminately instead of the TL template.
[0184] It should be explained that in the embodiment of this application, the template coefficient corresponding to the candidate template can be set according to a predetermined value, and the adjustment range for adjusting the matching cost can be rationally controlled.
[0185] For example, in some embodiments, when the template coefficients corresponding to candidate templates are set according to predetermined values, the template coefficients for the T template and / or L template may be set to a value greater than the template coefficient for the TL template.
[0186] For example, in the embodiment of the present application, when the template coefficient corresponding to the candidate template is set according to a predetermined value, COST T or COST L COST TL It can be extended to allow comparison. This method of setting template coefficients not only eliminates the effect of the number of pixels, but also takes into account that TL templates are generally at a disadvantage compared to T templates and L templates, so adjustments are necessary. For example, COST T or COST L Multiply by a coefficient greater than 1.
[0187] It should be noted that, in embodiments of the present invention, if the first template includes multiple candidate templates in the template set, each block vector in the block vector candidate list may be obtained by template matching using either a TL template, an L template, or a T template. In this case, it is possible to choose to limit the number of block vectors corresponding to any given candidate template in the block vector candidate list.
[0188] Furthermore, in the embodiments of the present invention, an upper threshold value corresponding to each candidate template is determined, and the number of block vectors corresponding to the candidate template in the block vector candidate list is determined based on the upper threshold value. Here, the value of the upper threshold value may be less than or equal to the list length of the block vector candidate list.
[0189] In other words, in the embodiments of the present invention, several restrictions can be placed on the number of candidates (block vectors) selected based on the T template and the L template in the same block vector candidate list. For example, an upper limit can be set on the number of candidates (block vectors) selected by the T template and / or the L template, and after the number of candidates (block vectors) selected by the T template and / or the L template in the block vector candidate list reaches the upper limit, no further candidates (block vectors) selected by the T template and / or the L template can be added to the block vector candidate list.
[0190] Furthermore, in embodiments of the present invention, when a block vector candidate list is constructed using multiple candidate templates directly, that is, when the first template includes multiple candidate templates, for example, when the first template includes at least a first candidate template, a second candidate template, and a third candidate template, a second search region can be determined based on the first candidate template, and the search points within the second search region can be scanned according to the first search step size to determine the initial block vector. Subsequently, a third search region can be determined based on the initial block vector and the first template, and the search points within the third search region can be scanned according to the second search step size to determine the block vector candidate list. Here, the first search step size is larger than the second search step size.
[0191] Understandably, in the embodiments of the present invention, an initial search can be performed using a first candidate template within the first template, according to a first search step size, and then an initial block vector can be selected and determined. Next, using the initial block vector as a positioning point, the matching costs of the first template, which includes multiple candidate templates, can be compared and adjusted, and a further refined search can be performed according to a second search step size, finally completing the construction of a block vector candidate list.
[0192] Exemplary, in the embodiment of the present invention, assuming that the first candidate template is a TL template, during the first step of searching for multiple intraTmp candidates (a coarse search with intervals equal to the first search step size), a second search area is first determined based on the TL template. After scanning the search points within the second search area, a certain number of BVs, i.e., initial block vectors, can be selected based on the matching cost corresponding to the first candidate template. These BVs are used as positioning points for the second step of the search (i.e., an improved search performed according to the second search step size). Next, the matching status of some of these BVs with TL templates, T templates, and L templates is analyzed. COST corresponding to a certain BV T or COST LIf the discrimination is significant, or COST T or COST L If the value is greater than a preset value, you can choose to perform an improvement search using the template with the higher matching degree among the T template or L template, that is, continue the search using a candidate template other than the first candidate template within the first template. Conversely, the COST corresponding to a certain BV T or COST L If the differences are not significant, we will still use the TL template to perform the improvement search, that is, continue the search using the first candidate template.
[0193] Furthermore, in embodiments of the present invention, if the first template includes at least a first candidate template, a second candidate template, and a third candidate template, a search can be performed based on the first candidate template to determine a first list corresponding to the first candidate template, a search can be performed based on the second candidate template to determine a second list corresponding to the second candidate template, a search can be performed based on the third candidate template to determine a third list corresponding to the third candidate template, the first list can be adjusted based on the second and third lists to determine a block vector candidate list.
[0194] It should be noted that in the embodiments of this application, the list lengths of the second list and the third list may be the same or different, and this application is not specifically limited to such examples.
[0195] It should be explained that if no first template is specified in the bitstream, only one block vector candidate list is constructed, thus eliminating the need to use syntactic elements in the bitstream to indicate which template to select. However, since the template matching costs between different templates cannot be directly compared, certain rules must be established so that they can be placed in a single block vector candidate list. One direct method here is to sort the candidates from one of the candidate templates by the matching cost of that candidate template, and to place the candidates from other different candidate templates directly into their given positions in the list without sorting them by the matching cost of that candidate template.
[0196] For illustrative purposes, in some embodiments, we assume that the first candidate template is a TL template, the second candidate template is a T template, the third candidate template is an L template, and the list length of the block vector candidate list is N. First, we can construct a first list of length N using the TL templates, where, according to a pre-defined search method, we calculate the template matching cost for each BV found, sort them based on their template matching cost, and place those with smaller costs earlier, ultimately generating the first list. We can also specify M as the maximum number of T and L templates that can be placed in the final block vector candidate list. The number that can ultimately be placed may be less than M because a duplicate check operation is required when placing them in the list. Next, we continue the search based on the T and L templates, generating the corresponding second and third lists, respectively. Finally, we can sequentially place the block vectors and their corresponding candidate templates from the second and third lists into the first list, completing the adjustments to the first list and thereby obtaining the corresponding block vector candidate list.
[0197] Exemplarily, in some embodiments, for example, N is 15 and M is 2. That is, the length of the finally generated block vector candidate list is 15, and the maximum number of candidate T templates that can be included is 2, and the maximum number of candidate L templates that can be included is 2.
[0198] Exemplarily, in some embodiments, for example, N is 19 and M is 3. That is, the length of the finally generated block vector candidate list is 19, and the maximum number of candidate T templates that can be included is 3, and the maximum number of candidate L templates that can be included is 3.
[0199] Furthermore, in the embodiments of the present application, when the first template includes at least a first candidate template, a second candidate template, and a third candidate template, search is performed based on the first candidate template, the second candidate template, and the third candidate template, and a first list corresponding to the first candidate template, a second list corresponding to the second candidate template, and a third list corresponding to the third candidate template are determined respectively. Then, the first list is adjusted based on the second list and the third list, and a block vector candidate list is determined.
[0200] That is, in the embodiments of the present application, it is also possible to select to perform search based on the first candidate template, the second candidate template, and the third candidate template simultaneously, obtain the corresponding first list, second list, and third list, and then generate a corresponding block vector candidate list based on the first list, the second list, and the third list.
[0201] Exemplary, in some embodiments, one approach to the search process is that the T-template and L-template can share the search process for the TL-template, and the matching costs of the T-template and L-template can be calculated simultaneously when calculating the matching cost for the TL-template, thus not significantly increasing the complexity of the search. For example, in the same search process, lists are built for the TL-template, T-template, and L-template respectively, and after the search is complete, the three lists are merged into a final block vector candidate list.
[0202] For example, in some embodiments, the T template and L template may use a different search process than the TL template. Of course, some search processes may be shared and others may be separate, and this is not specifically limited in this application.
[0203] Furthermore, in the embodiments of the present invention, when adjusting the first list based on the second and third lists to determine the block vector candidate list, first, a first starting position corresponding to the second list and a second starting position corresponding to the third list are determined. Then, block vectors in the second list are added to the first list according to the first starting position, and at the same time, block vectors in the third list are added to the first list according to the second starting position to obtain the block vector candidate list.
[0204] It should be explained that in the embodiments of this application, the starting position for adding block vectors in the second list to the first list can be determined by the first starting position. The starting position for adding block vectors in the third list to the first list can also be determined by the second starting position. Here, the first starting position and the second starting position may be the same or different.
[0205] Furthermore, in the embodiments of the present invention, when adding block vectors from the second list to the first list according to the first starting position, block vectors from the second list that are not present in the first list can be added to the first starting position in the first list. When adding block vectors from the third list to the first list according to the second starting position, block vectors from the third list that are not present in the first list can be added to the second starting position in the first list.
[0206] For example, in some embodiments, the smallest index position in which the T template and L template can be placed can be designated as Pos, or the closest previous position is Pos, i.e., the first and second starting positions are Pos. Here, Pos can be calculated based on N and M, for example, Pos = N - 1 - M × 2. The closest previous positions in which the T template and L template can be placed can also be defined, respectively.
[0207] For illustrative purposes, in some embodiments, suppose the first candidate template is a TL template, the second candidate template is a T template, and the third candidate template is an L template, and the length of the block vector candidate list is N, i.e., the list length of the first list is X, and the list lengths of the second and third lists are N, and we can attempt to insert candidates for T and L templates into the first list of TL templates in order to generate the block vector candidate list. Here, a pre-configured search method can find X T template candidates and X L template candidates with an optimal template matching cost. The X T template candidates and X L template candidates can each be used to construct temporary lists of length X, i.e., the second and third lists. We then attempt to insert the T and L template candidates into the final block vector candidate list. First, a duplicate check operation can be performed, and if the same BV as a candidate to be inserted into the second or third list already exists in the first list, it is not inserted into the list. If the same BV as a candidate to be inserted in the second or third list does not exist in the first list, the candidate at the specified first or second starting position in the first list, and the candidates after the first or second starting position, are sequentially moved backward, and then the candidate to be inserted is placed at the specified starting position in the first list. Specifically, each time an item is inserted into the first list, the specified first or second starting position moves one position backward until all M or X candidates placed in the temporary lists have been checked.
[0208] It should be noted that, in the embodiments of the present application, regardless of whether the first list, the second list, and the third list are obtained separately by search or whether the first list, the second list, and the third list are obtained simultaneously by search, the search method used may include first performing a sparse search according to a first search step size, and then performing an improved search according to a second search step size.
[0209] For illustrative purposes, in some embodiments, for the sparse search in the first step, the search process does not sequentially search for each possible BV. For example, the usual search order is left to right and top to bottom. Generally, all pixel BVs can be searched sequentially. For example, if the currently searched BV is (x0, y0), the next is (x0+1, y0), assuming that the boundary of the search range has not been reached. However, a sparse search can be performed first. For example, for all pixel BVs, if the currently searched BV is (x0, y0), the next is (x0+3, y0), assuming that the boundary of the search range has not been reached. In other words, it is also possible to perform one template matching for every certain number of pixels and one template matching for every certain step size. The step size here may be a preset value such as 2, 3, 4, or 8. Of course, the same process can also be performed in a vertical way. First, find the K BVs with the minimum cost of the TL template, where K may be equal to N, greater than N, or less than N. This process may be implemented by constructing a list. Simultaneously, find the X' BVs with the minimum cost for the T template and the X' BVs with the minimum cost for the L template, where X' may be equal to M, greater than M, or less than M. This process may be implemented by constructing a list. In other words, each BV in this search process simultaneously sorts the template matching costs of the TL template, T template, and L template; that is, the three share a sparse search process.
[0210] Exemplary, in some embodiments, for the improvement search in the second step, improvements are made in small ranges based on each BV, based on the K BVs with the minimum cost of the TL template. For example, if the search interval is 3 pixels, the improved range may be set to 3x3, and the improved BVs may be used to construct a block vector candidate list of length N. Furthermore, improvements are made in small ranges based on each BV, based on the X' BVs with the minimum cost of the T template and L template. For example, if the search interval is 3 pixels, the improved range may be set to 3x3, and the improved BVs may be used to construct a temporary block vector candidate list of length X for the T template and a temporary block vector candidate list of length X for the L template. Then, the list of TL templates of length N, the list of T templates of length X, and the list of L templates of length X are combined into a final block vector candidate list according to the method described above.
[0211] For example, in some embodiments, N=15, K=2N, M=2, X=4, and X'=2X.
[0212] It should be noted that, in the embodiments of this application, if sub-pixel accuracy is supported, further subdivision down to the sub-pixel BV can be performed. For example, based on the total pixel BV selected in the second step, a search for half a pixel can be performed within a single pixel range in the upper, lower, left, or right direction.
[0213] In the embodiments of this application, it can be understood that sharing a sparse search process does not significantly increase the complexity of the search, and that in a wide range of sparse searches, the improved search scopes for the TL template, T template, and L template can be found. The improved search is more precise because it can be performed on different templates.
[0214] In step 103, the block vector corresponding to the current block is determined based on the list of candidate block vectors corresponding to the current block, and the predicted value of the current block is determined based on the block vector.
[0215] In the embodiments of the present invention, after determining a list of candidate block vectors corresponding to the current block based on a first template, the block vector corresponding to the current block can be further determined based on the list of candidate block vectors corresponding to the current block, and further, the predicted value of the current block can be determined based on the block vector.
[0216] It should be explained that in the embodiments of the present application, when the value of the template matching prediction identifier is a first value, that is, when it is decided to perform prediction processing on the current block using the prediction method of intraTmp based on the value of the template matching prediction identifier, the bitstream can be further decoded to determine the index identifier corresponding to the current block, and then a candidate index corresponding to the current block can be determined based on the index identifier.
[0217] In the embodiments of the present invention, the index of the block vector corresponding to the current block in the block vector candidate list can be determined by the index identification information corresponding to the current block, that is, the candidate index corresponding to the current block can be determined by the index identification information.
[0218] It should be explained that, in the embodiments of the present invention, if the list length of the block vector candidate list generated differs when different candidate templates are used, it is necessary to first parse the syntactic elements indicating the template, such as the first template identifier intra_tmp_alternative_template_flag and / or the second template identifier intra_tmp_template_idx, and then parse the candidate index intra_tmp_idx.
[0219] Furthermore, in the embodiments of the present application, no matter which candidate template is used as the first template of the current block, when the corresponding list length, binarization, inverse binarization method, context model, etc. are the same, the candidate index intra_tmp_idx is considered not to depend on other syntax elements indicating the template such as the first template indication information intra_tmp_alternative_template_flag and / or the second template indication information intra_tmp_template_idx. Therefore, either the syntax elements indicating the template such as intra_tmp_alternative_template_flag and / or intra_tmp_template_idx, or intra_tmp_idx can be parsed first.
[0220] Furthermore, in the embodiments of the present application, when different candidate templates are selected as the first template of the current block and at least one of the corresponding list length, binarization, inverse binarization method, context model, etc. may be different, the candidate index intra_tmp_idx is considered to depend on the syntax elements indicating the template such as the first template indication information intra_tmp_alternative_template_flag and / or the second template indication information intra_tmp_template_idx. Therefore, it is necessary to first parse the syntax elements indicating the template such as intra_tmp_alternative_template_flag and / or intra_tmp_template_idx, and then parse intra_tmp_idx.
[0221] Furthermore, in the embodiments of the present application, when the value of the first template indication information is the third value, the index identification information is determined based on the first context, and when the value of the first template indication information is the fourth value, the index identification information is determined based on the second context.
[0222] Understandably, in the embodiments of this application, after analyzing the first template instruction information intra_tmp_alternative_template_flag, the context used in the encoding and decoding process can be determined based on the first template instruction information; that is, the context model (CABAC context model) in the encoding and decoding process can be determined using the first template instruction information. Of course, the context model in the encoding and decoding process can also be determined using the second template instruction information, and this is not specifically limited in this application.
[0223] It should be explained that in the embodiments of this application, different context models (CABAC context models) can be set during binarization or debinarization encoding and decoding. That is, the probabilities of binary symbols based on the context coding for the two cases are multiplied and updated. In other words, the encoder / decoder can select a set of context models based on the values of syntactic elements indicating templates, such as the first template instruction information intra_tmp_alternative_template_flag and / or the second template instruction information intra_tmp_template_idx.
[0224] For illustrative purposes, in some embodiments, if the value of intra_tmp_alternative_template_flag is 0, one set / one context model contextModel0 is selected, and if the value of intra_tmp_alternative_template_flag is 1, one set / one context model contextModel1 is selected.
[0225] Furthermore, in the embodiments of the present application, in the process of determining a candidate index corresponding to the current block based on index identification information, if the value of the first template instruction information is a third value, the candidate index is determined based on the index identification information and the first inverse binarization strategy, and if the value of the first template instruction information is a fourth value, the candidate index is determined based on the index identification information and the second inverse binarization strategy.
[0226] In embodiments of the present application, after analyzing the first template instruction information intra_tmp_alternative_template_flag, the de-binarization strategy used in the candidate index determination process can be determined based on the first template instruction information; that is, it can be understood that the method of de-binarization is determined using the first template instruction information. Of course, the method of binarization (encoding side) or de-binarization (decoding side) in the encoding and decoding process can also be determined using the second template instruction information, and this is not specifically limited in the present application.
[0227] It should be noted that in embodiments of the present application, the methods for binarizing and de-binarizing candidate index intra_tmp_idx may differ based on different values of template instruction information. Different binarization and de-binarization methods can be set because, even if the list lengths of the block vector candidate lists generated when using different candidate templates are the same, they may follow different probability distribution rules.
[0228] Exemplary, in some embodiments, in one case (e.g., when using a TL template), the probability of selecting some earlier candidates with very small indices is clearly higher than that of other candidates with relatively large indices. The binarization and de-binarization methods assign short binary symbols to some earlier candidates with very small indices and long binary symbols to other candidates with relatively large indices.
[0229] Exemplary, in some embodiments, in other cases (e.g., when using a T-template or an L-template), the probability of selecting some previous candidates with very small indices is not much different from other candidates with relatively large indices, and the difference in the lengths of the binary symbols assigned to them by the binarization and de-binarization methods is not as large as in the previous case, or the same binary symbol lengths are used directly.
[0230] In other words, in the embodiments of the present invention, the encoder / decoder selects a set of binarization and debinarization methods based on the values of syntactic elements that indicate a template, such as intra_tmp_alternative_template_flag and / or intra_tmp_template_idx.
[0231] For example, in some embodiments, when the value of the first template instruction information intra_tmp_alternative_template_flag is 0, binarization and de-binarization method 1 is selected, as shown in Table 3.
[0232] [Table 3]
[0233] For example, in some embodiments, when the value of the first template instruction information intra_tmp_alternative_template_flag is 1, binarization and de-binarization method 2 is selected, as shown in Table 4.
[0234] [Table 4]
[0235] Here, the Symbols in Tables 3 and 4 above correspond to the candidate index intra_tmp_idx.
[0236] It should be explained that in the embodiments of this application, on the decoding side, the decoder uses an inverse binarization method. According to the correspondence table between Symbol and binary symbols, when a binary symbol is encoded using context mode, the context model is selected, the bitstream is read, and the value of Symbol is determined. On the encoding side, the encoder uses a binarization method. According to the correspondence table between Symbol and binary symbols, when a binary symbol is encoded using context mode, the context model is selected, and the content to be written to the bitstream is determined based on the value of Symbol. Here, Symbol corresponds to intra_tmp_idx.
[0237] Furthermore, in the embodiments of the present application, when performing binarization or de-binarization of intra_tmp_idx, whether using only TL templates or any combination of multiple candidates and multiple templates, if the list length N of the block vector candidate list is relatively large, the probability of the first candidate is high, the probability decreases towards the end, and the probabilities become closer to each other towards the end. Therefore, the first codeword is short, the last codeword is long, and several of the later candidates can use the same code length.
[0238] For illustrative purposes, in some embodiments, assuming that the list length N of the block vector candidate list is 15, indices 3-6 use codewords of the same length, indices 7-14 use codewords of the same length, and the specific binarization and inverse binarization are shown in Table 5.
[0239] [Table 5]
[0240] Here, x in the table may be obtained by truncated binary. Here, a binary symbol with BinIdx = 0 can use a context-model based encoding method. If the value of a binary symbol with BinIdx = 0 is 1 (corresponding to the case where intra_tmp_idx is 0, 1, or 2 above), a binary symbol with BinIdx = 1 can use a context-model based encoding method. The binary symbol represented by x above can use a bypass encoding method.
[0241] For illustrative purposes, in some embodiments, assuming a list length N of the block vector candidate list is 19, indices 3-18 use codewords of the same length, and the specific binarization and inverse binarization are decoys shown in Table 6.
[0242] [Table 6]
[0243] Here, x in the table may be obtained by truncated binary. Here, a binary symbol with BinIdx = 0 can use a context-model based encoding method. If the value of a binary symbol with BinIdx = 0 is 1 (corresponding to the case where intra_tmp_idx is 0, 1, or 2 above), a binary symbol with BinIdx = 1 can use a context-model based encoding method. The binary symbol represented by x above can use a bypass encoding method.
[0244] Correspondingly, in the embodiments of the present invention, the encoder converts the value of a syntax element (e.g., intra_tmp_idx in this case) to a corresponding binary symbol (bin), and then converts the binary symbol to a binary bit (bit) using an entropy coding engine. The decoder's entropy coding (decoding) engine converts the binary bit (bit) to a binary symbol, and then converts the binary symbol (bin) to the value of a syntax element.
[0245] It should be explained that, in the embodiments of this application, the context-based coding method and the bypass coding method are two modes of the entropy coding engine. During coding, the entropy coding engine converts binary symbols into binary bits in the bitstream. During decoding, the entropy coding engine converts binary bits in the bitstream into binary symbols. The context-based coding method can be understood as follows: The more frequently a binary symbol with a syntactic element (value 0 or 1) appears in the context, the more the entropy coding engine tends to use fewer binary bits corresponding to that binary symbol and more binary bits corresponding to other binary symbols. For example, if a binary symbol with a syntactic element (1) appears frequently, fewer binary bits will be used to encode 1 and more binary bits will be used to encode 0. The bypass coding method is equivalent to using an equal-probability model. Therefore, the bypass coding method has higher throughput than the context-based mode. The context-based coding method theoretically has higher compression efficiency.
[0246] For illustrative purposes, in some embodiments, assuming that the list length N of the block vector candidate list is 19, the specific binarization and inverse binarization are as shown in Table 7.
[0247] [Table 7]
[0248] Here, x, y, and z for the same row in the table may each be obtained using truncated binary. That is, the last two binary symbols from 3 to 6 are obtained using truncated binary, the last two binary symbols from 7 to 10 are obtained using truncated binary, and the last three binary symbols from 11 to 18 are obtained using truncated binary. Here, binary symbols with BinIdx = 0 can use a context-model-based encoding method.
[0249] Understandably, in the embodiments of this application, if the value of a binary symbol with BinIdx 0 is 1 (corresponding to the cases where intra_tmp_idx is 0, 1, or 2 above), then a context-model-based encoding method can be used for the binary symbol with BinIdx 1.
[0250] Understandably, in the embodiments of this application, when the value of a binary symbol with BinIdx is 0 (corresponding to the case where intra_tmp_idx is greater than 2 above), a binary symbol with BinIdx is 1 can use a context-model-based encoding method, using a different context model than when intra_tmp_idx is 0, 1, or 2.
[0251] Understandably, in the embodiments of this application, if the value of a binary symbol with BinIdx 0 is 0, and the value of a binary symbol with BinIdx 1 is 1 (corresponding to the case where intra_tmp_idx is 3 to 10 above), then a binary symbol with BinIdx 2 can use a context-model-based encoding method.
[0252] In the embodiments of this application, it can be understood that the binary symbols represented by x, y, and z above can be encoded using a bypass coding method.
[0253] It should be noted that in the embodiments of this application, the above values of 0 and 1 are merely examples. The values of 0 and 1 may be reversed, but the results may be equivalent. Reversing the order of the binary symbols obtained by truncated binary is also equivalent.
[0254] Furthermore, in the embodiments of the present invention, if a candidate index corresponding to the current block is determined, and then a block vector corresponding to the current block is determined based on a list of candidate block vectors corresponding to the current block, the block vector corresponding to the current block can be determined from the list of candidate block vectors based on the candidate index.
[0255] In other words, in the embodiment of the present invention, the block vector indicated by the candidate index corresponding to the current block in the block vector candidate list can be determined as the block vector corresponding to the current block.
[0256] Furthermore, in the embodiments of the present invention, a block vector corresponding to the current block can be determined based on a list of candidate block vectors corresponding to the current block, a predicted value for the current block can be determined based on the block vector, and then the reconstruction value for the current block can be determined based on the predicted value for the current block.
[0257] It should be explained that in the embodiments of the present invention, the bitstream can first be decoded to determine the predicted difference value (residual) corresponding to the current block, and then the reconstruction value of the current block can be further determined based on the predicted difference value and the predicted value.
[0258] As can be seen from the above, the intraTMP multiple candidates realized by constructing a list of block vector candidates corresponding to the current block using the decoding method proposed in steps 101-103 above can provide multiple choices, and the first template corresponding to the current block, which can contain one or more candidate templates, can provide multiple choices at the template level. The combination of these two can improve compression efficiency and obtain better compression performance.
[0259] In other words, the encoding and decoding methods proposed in the embodiments of the present invention can combine intraTMP multiple candidates and template-level multiple selections. In the process of combining the two, one implementation of the combination is to specify which template to use in the bitstream. The other implementation of the combination is to construct the same block vector candidate list using different templates without specifying which template to use in the bitstream.
[0260] Embodiments of the present application provide a decoding method in which the decoder determines a first template corresponding to the current block, where the first template is one or more candidate templates in a template set corresponding to the current block, determines a list of candidate block vectors corresponding to the current block based on the first template, determines a block vector corresponding to the current block based on the list of candidate block vectors corresponding to the current block, and determines a predicted value for the current block based on the block vector. As can be seen from the above, embodiments of the present application propose a prediction scheme that combines multiple intraTMP candidates and multiple templates, where it is possible to choose to determine a list of candidate block vectors that include at least one block vector of the current block, and at the same time, it is possible to choose to construct a list of candidate block vectors using a first template that includes at least one candidate template, and furthermore, a combination of multiple intraTMP candidates and multiple selections at the template level can be realized. In other words, the coding and decoding method proposed in embodiments of the present application realizes multiple intraTMP candidates by constructing a list of candidate block vectors corresponding to the current block, on the one hand, and provides multiple selections at the template level using a first template corresponding to the current block that includes one or more candidate templates, thereby improving compression efficiency and coding and decoding performance.
[0261] Embodiments of the present application provide an encoding method applicable to an encoder. Figure 21 is a schematic flowchart of the encoding method proposed in the embodiment of the present application. As shown in Figure 21, a method for performing an encoding process by an encoder may include the following steps:
[0262] In step 201, a first template corresponding to the current block is determined, where the first template is one or more candidate templates within the template set corresponding to the current block.
[0263] In the embodiments of this invention, first, a first template corresponding to the current block can be determined.
[0264] 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 include an intra-prediction method, more specifically a color component prediction method. Here, the video image may be divided into a plurality of encoding blocks, each encoding block may include a first color component, a second color component, and a third color component. In the embodiment of the present application, the current block refers to the encoding block in the video image where intra-prediction is currently being performed.
[0265] Here, if we need to predict the first color component, the component to be predicted is the first color component; if we need to predict the second color component, the component to be predicted is the second color component; and if we need to predict the third color component, the component to be predicted is the third color component. Also, if we predict the first color component for the current block and assume that the first color component is the luminance component, i.e., the component to be predicted is the luminance component, then the current block may also be called a luminance block. Alternatively, if we predict the second color component for the current block and assume that the second color component is the chromaticity component, i.e., the component to be predicted is the chromaticity component, then the current block may also be called a chromaticity block.
[0266] It should be explained that in the embodiments of the present invention, the first template corresponding to the current block may be any number of candidate templates in the template set corresponding to the current block, where the candidate templates corresponding to the current block include candidate templates of multiple different template types.
[0267] In embodiments of the present invention, it can be understood that a set of templates corresponding to the current block is first constructed based on different template types, and then any number of candidate templates in the set of templates can be selected as the first template corresponding to the current block.
[0268] Exemplary examples, in the embodiments of the present application, as shown in Figure 19, when the upper left reference sample, upper reference sample, and left reference sample are all available, the shape of the template is as shown in (a). When only the left reference sample is available, the shape of the template is as shown in (b). When only the upper reference sample is available, the shape of the template is as shown in (c). When only the left reference sample and upper left reference sample are available, the shape of the template is as shown in (d). When only the left reference sample and lower left reference sample are available, the shape of the template is as shown in (e). When only the upper reference sample and upper right reference sample are available, the shape of the template is as shown in (f).
[0269] Furthermore, in the embodiments of the present invention, when constructing a template set corresponding to the current block based on the template type, it is possible to first determine a template reference sample for the current block based on the template type and the template size corresponding to the template type, then determine candidate templates for the current block based on the template reference sample, and finally complete the construction of the template set.
[0270] Exemplary, in the embodiments of the present application, as shown in Figure 20, the candidate templates for the current block that are ultimately generated may also include four templates corresponding to four different template types: Candidate Template 1 (TL template), Candidate Template 2 (TL template), Candidate Template 3 (T template), and Candidate Template 4 (L template).
[0271] Furthermore, in the embodiments of the present invention, the first template corresponding to the current block is determined based on candidate templates in the template set, where the first template may include any number of candidate templates.
[0272] It should be explained that in the embodiments of the present invention, the first candidate template in the template set may be a template that includes a left-side adjacent reconstruction sample and an upper-side adjacent reconstruction sample of the current block, such as a TL template; the second candidate template in the template set may be a template that includes an upper-side adjacent reconstruction sample of the current block, such as a T template; and the third candidate template in the template set may be a template that includes a left-side adjacent reconstruction sample of the current block, such as an L template.
[0273] For example, in some embodiments, the first template corresponding to the current block may be the first candidate template in the template set corresponding to the current block, such as candidate template 1.
[0274] For example, in some embodiments, the first template corresponding to the current block may be the first and second candidate templates in the template set corresponding to the current block, such as candidate template 1 and candidate template 3.
[0275] For example, in some embodiments, the first template corresponding to the current block may be the first, second, and third candidate templates within the template set corresponding to the current block, such as candidate template 1, candidate template 3, and candidate template 4.
[0276] Furthermore, in the embodiments of the present invention, template matching prediction identification information corresponding to the current block can be determined, and if the value of the template matching prediction identification information is a first value, the process of determining the first template can be executed, that is, the process of determining the first template proposed in step 201 is executed.
[0277] In embodiments of the present application, it can be understood that template matching prediction identifiers can be used to determine whether the current block uses template matching prediction, i.e., the template matching prediction identifiers can indicate whether the current block is subject to prediction processing via intraTMP.
[0278] For example, in some embodiments, a variable that functions as template matching predictive identifier information can be determined, thereby enabling the determination of template matching predictive identifier information based on the value of said variable.
[0279] It should be explained that in this application, the value of the template matching prediction identifier may be either a first or second value. Specifically, if the value of the template matching prediction identifier is different, the method for determining the predicted value of the current block will also be different. Specifically, when determining the predicted value of the current block based on the value of the template matching prediction identifier, it is possible to choose to use intraTMP or not use intraTMP.
[0280] Exemplary, in some embodiments, the template matching prediction identifier can be understood as a flag indicating whether to perform intraTMP. Here, if the value of the template matching prediction identifier is a first value, it can be chosen to use intraTMP to determine the prediction value of the current block. If the value of the template matching prediction identifier is a second value, it can be chosen not to use intraTMP to determine the prediction value of the current block.
[0281] For illustrative purposes, in some embodiments, the first value may be set to 1 and the second value to 0. Alternatively, the first value may be set to true and the second value to false. No limitations are imposed in this application.
[0282] Exemplary, in some embodiments, the flag intra_tmp_flag can be used to represent template matching predictive identification information, i.e., a flag where intra_tmp_flag is intraTMP is used.
[0283] For illustrative purposes, in some embodiments, a value of 1 for intra_tmp_flag can represent that it is chosen to use intraTMP to determine the predicted value of the current block, and a value of 0 for intra_tmp_flag can represent that it is not chosen to use intraTMP to determine the predicted value of the current block.
[0284] In embodiments of the present application, it can be understood that if the value of the template matching predictive identifier is a first value, that is, after determining the predicted value of the current block using intraTMP based on the value of the template matching predictive identifier, the process of determining the first template corresponding to the current block can be performed.
[0285] Furthermore, in the embodiments of the present invention, when determining the first template corresponding to the current block, the first template instruction information corresponding to the current block is determined, and if the value of the first template instruction information is a third value, it can be determined that the first template is the first candidate template.
[0286] It should be noted that in the embodiments of this application, the first candidate template may be one of the candidate templates in the template set corresponding to the current block. For example, the first candidate template may be a TL template in the template set.
[0287] In embodiments of the present application, the first template instruction information may be used to determine whether the current block uses a first candidate template, that is, it can be understood that the first template instruction information can indicate whether the current block uses a first candidate template to perform predictive processing of intraTMP.
[0288] For example, in some embodiments, a variable that functions as first template instruction information can be determined, thereby enabling the determination of the first template instruction information by the value of the variable.
[0289] It should be explained that in this application, the value of the first template instruction information may be a third or fourth value. Specifically, when executing intraTMP based on the value of the first template instruction information, it is possible to choose to use the first candidate template, or to not use the first candidate template and instead use another template, such as another template in the template set other than the first candidate template.
[0290] For illustrative purposes, in some embodiments, the third value may be set to 0 and the fourth value to 1. Alternatively, the third value may be set to false and the fourth value to true. No limitations are imposed in this application.
[0291] Exemplary, in some embodiments, the flag intra_tmp_alternative_template_flag can be used to represent the first template indication information. For example, a value of intra_tmp_alternative_template_flag of 0 can indicate that the first candidate template is determined to be the first template corresponding to the current block, while a value of intra_tmp_alternative_template_flag of 1 can indicate that the first candidate template is not determined to be the first template corresponding to the current block, and that another template is still selected as the first template corresponding to the current block.
[0292] Correspondingly, in the embodiments of the present invention, after determining the first template instruction information corresponding to the current block, if the value of the first template instruction information is the fourth value, it can be determined that the first template is not the first candidate template, and it is necessary to further determine the second template instruction information corresponding to the current block.
[0293] Furthermore, in the embodiments of the present invention, when determining the first template corresponding to the current block, the second template indication information corresponding to the current block is determined. If the value of the second template indication information is the fifth value, it can be determined that the first template is the second candidate template, and if the value of the second template indication information is the sixth value, it can be determined that the first template is the third candidate template.
[0294] It should be noted that in the embodiments of this application, the second candidate template and the third candidate template may each be a candidate template within the template set corresponding to the current block. For example, the second candidate template may be a T template within the template set, and the third candidate template may be an L template within the template set.
[0295] In embodiments of the present application, the second template instruction information may be used to determine whether the current block uses a second candidate template and / or a third candidate template, that is, it can be understood that the second template instruction information can indicate whether the current block uses a second candidate template and / or a third candidate template to perform predictive processing of intraTMP.
[0296] For example, in some embodiments, a variable that functions as second template instruction information can be determined, thereby enabling the determination of the second template instruction information by the value of the variable.
[0297] It should be explained that in this application, the value of the second template instruction information may be the fifth or sixth value. Specifically, when executing intraTMP based on the value of the second template instruction information, it is possible to choose to use the second candidate template, or to choose to use the third candidate template.
[0298] For example, in some embodiments, the fifth value may be set to 0 and the sixth value to 1. Alternatively, the fifth value may be set to false and the sixth value to true. No limitations are imposed in this application.
[0299] For example, in some embodiments, the flag intra_tmp_template_idx can be used to represent the second template instruction information. For instance, a value of 0 for intra_tmp_template_idx can indicate that the second candidate template is determined to be the first template corresponding to the current block, and a value of 1 for intra_tmp_template_idx can indicate that the third candidate template is determined to be the first template corresponding to the current block.
[0300] In other words, in embodiments of the present invention, it is possible to choose to indicate in the bitstream which candidate template in the template set corresponds to the first template that corresponds to the current block. For example, the first template may be indicated using first template indication information and second template indication information.
[0301] For illustrative purposes, in some embodiments, there are three candidate templates: TL template, T template, and L template. The first candidate template is the TL template, the second candidate template is the T template, and the third candidate template is the L template. The template matching prediction identifier intra_tmp_flag indicates whether the current block uses intraTmp. If the current block uses intraTmp, intra_tmp_alternative_template_flag is determined. The first template indication information intra_tmp_alternative_template_flag indicates whether the current block uses another template. If the value of intra_tmp_alternative_template_flag is 0, it indicates that the current block uses the TL template. If the value of intra_tmp_alternative_template_flag is 1, intra_tmp_template_idx is determined, and the second template instruction information intra_tmp_template_idx indicates that the current block will use either a T template or an L template. For example, if the value of intra_tmp_template_idx is 0, it means that the current block will use a T template, and if the value of intra_tmp_template_idx is 1, it means that the current block will use an L template.
[0302] Furthermore, in the embodiments of the present invention, when determining the first template corresponding to the current block, the third template indication information corresponding to the current block is determined. If the value of the third template indication information is the seventh value, it can be determined that the first template is the first candidate template. If the value of the third template indication information is the eighth value, it can be determined that the first template is the second candidate template. If the value of the third template indication information is the ninth value, it can be determined that the first template is the third candidate template.
[0303] It should be noted that in the embodiments of this application, the first candidate template, the second candidate template, and the third candidate template may each be a candidate template within the template set corresponding to the current block. For example, the first candidate template may be a TL template within the template set, the second candidate template may be a T template within the template set, and the third candidate template may be an L template within the template set.
[0304] In embodiments of the present application, the third template instruction information may be used to determine whether the current block uses the first candidate template and / or the second candidate template and / or the third candidate template, that is, it can be understood that the third template instruction information can indicate whether the current block uses the first candidate template and / or the second candidate template and / or the third candidate template to perform the intraTMP prediction processing.
[0305] For example, in some embodiments, a variable that functions as third template instruction information can be determined, thereby enabling the determination of the third template instruction information by the value of the variable.
[0306] It should be explained that in this application, the value of the third template instruction information may be the seventh, eighth, or ninth value. Specifically, when executing intraTMP based on the value of the third template instruction information, it is possible to choose to use the first candidate template, the second candidate template, or the third candidate template.
[0307] For example, in some embodiments, the seventh value may be set to 0, the eighth value to 1, and the ninth value to 2, and no limitation is imposed in this application.
[0308] For example, in some embodiments, the flag intra_tmp_template_idx can be used to represent third template instruction information. For instance, a value of 0 for intra_tmp_template_idx can indicate that the first candidate template is determined to be the first template corresponding to the current block; a value of 1 for intra_tmp_template_idx can indicate that the second candidate template is determined to be the first template corresponding to the current block; and a value of 2 for intra_tmp_template_idx can indicate that the third candidate template is determined to be the first template corresponding to the current block.
[0309] In other words, in embodiments of the present invention, it is possible to choose to indicate in the bitstream which candidate template in the template set corresponds to the first template for the current block. For example, the first template may be indicated using third template indication information.
[0310] For example, in some embodiments, the first template instruction information intra_tmp_alternative_template_flag and the second template instruction information intra_tmp_template_idx may be merged into the same syntactic element intra_tmp_template_idx, i.e., merged into the third template instruction information.
[0311] For illustrative purposes, in some embodiments, three candidate templates—TL template, T template, and L template—are used as examples. The first candidate template is the TL template, the second candidate template is the T template, and the third candidate template is the L template. The template matching prediction identifier intra_tmp_flag indicates whether the current block uses intraTmp. If the current block uses intraTmp, intra_tmp_template_idx is determined. The third template indication information intra_tmp_template_idx indicates whether the current block uses a TL template, a T template, or an L template. A value of intra_tmp_template_idx of 0 indicates that the current block uses a TL template. A value of intra_tmp_template_idx of 1 indicates that the current block uses a T template. A value of intra_tmp_template_idx of 2 indicates that the current block uses an L template.
[0312] Furthermore, in the embodiments of the present invention, when determining the first template corresponding to the current block, a candidate index corresponding to the current block is determined, and if the value of the candidate index is less than or equal to a preset threshold, it is determined that the first template is the first candidate template.
[0313] Correspondingly, in the embodiment of the present invention, after determining a candidate index corresponding to the current block, if the value of the candidate index is greater than a preset threshold, the third template instruction information corresponding to the current block is determined. If the value of the third template instruction information is the seventh value, it is determined that the first template is the first candidate template; if the value of the third template instruction information is the eighth value, it is determined that the first template is the second candidate template; and if the value of the third template instruction information is the ninth value, it is determined that the first template is the third candidate template.
[0314] It should be explained that in the embodiments of the present invention, a preset threshold can be used to determine whether to use the first candidate template directly. Here, if the value of the candidate index corresponding to the current block is greater than (or equal to) the preset threshold, the system may choose to continue using the third template indication information to determine the first template to be used; if the value of the candidate index corresponding to the current block is less than (or equal to) the preset threshold, the system may choose to directly determine the first candidate template as the first template corresponding to the current block.
[0315] In embodiments of the present invention, it can be understood that one may choose to first determine a candidate index corresponding to the current block, and then combine the candidate index with a pre-set threshold to determine whether to select the first candidate template in the template set as the first template. In this way, the first candidate template can be given a higher priority than the other candidate templates, that is, the decision is made whether to use the first candidate template first.
[0316] Understandably, TL templates cover more adjacent areas, and in most cases, textures are continuous from the left and top, so TL templates often have greater reference value than standalone T templates and standalone L templates. TL templates are frequently chosen, with standalone T templates and standalone L templates often used as supplements. Based on this distributional principle, TL templates can be given a higher priority than T templates and L templates.
[0317] In other words, in the embodiments of the present invention, it is possible to choose to indirectly determine whether to use a higher-priority TL template by utilizing the candidate index of the current block. At the same time, it is also possible to indicate in the bitstream which candidate template in the template set corresponds to the first template for the current block. For example, the first template can be indicated using third template indication information.
[0318] For illustrative purposes, in some implementations, there are three candidate templates: TL template, T template, and L template. The first candidate template is the TL template, the second candidate template is the T template, and the third candidate template is the L template. The template matching prediction identifier Intra_tmp_flag indicates whether the current block uses intraTmp. If the current block uses intraTmp, intra_tmp_idx is determined, and then intra_tmp_template_idx is parsed. Here, whether intra_tmp_template_idx is parsed depends on the value of intra_tmp_idx. If the value of intra_tmp_idx is less than or equal to the preset threshold THR, the TL template is used by default. Otherwise, i.e., if the value of intra_tmp_idx is greater than or equal to the preset threshold THR, intra_tmp_template_idx needs to be parsed to determine which template the current block should use. The third template instruction information, intra_tmp_template_idx, indicates that the current block will use a TL template, a T template, or an L template. A value of intra_tmp_template_idx of 0 indicates that the current block will use a TL template. A value of intra_tmp_template_idx of 1 indicates that the current block will use a T template. A value of intra_tmp_template_idx of 2 indicates that the current block will use an L template.
[0319] As can be seen from the above, in the embodiment of the present invention, a candidate index and a pre-set threshold are combined to determine whether to use a TL template in the template set, and it is ensured that some candidates with small indices do not need to distinguish which template to use and will use the TL template by default. In this way, unnecessary overhead can be reduced because these candidates often choose the TL template. The indices of candidate T and L templates can also be thought of as starting from THR instead of 0, which corresponds to assigning longer binary symbol sequences to T and L templates.
[0320] It should be noted that in embodiments of the present invention, the bitstream may choose to indicate which candidate template or which candidate template in the template set corresponds to the first template corresponding to the current block. For example, the first template may be indicated using first template indication information and / or second template indication information and / or third template indication information. Of course, it is also possible to choose not to indicate which candidate template or which candidate template to use in the bitstream, and instead directly construct a list of block vector candidates corresponding to the current block based on multiple candidate templates in the template set.
[0321] Furthermore, in the embodiments of the present application, the first template corresponding to the current block may include multiple candidate templates within the template set. For example, the first template may include three candidate templates: a first candidate template such as a TL template, a second candidate template such as a T template, and a third candidate template such as an L template.
[0322] Correspondingly, in embodiments of the present invention, it is possible to choose to construct a list of block vector candidates using a plurality of possible candidate templates directly, where each block vector in the list may be obtained by template matching using one of TL templates, L templates, or T templates.
[0323] For example, in some implementations, if the bitstream does not specify which candidate template or which candidate template to use, intra_tmp_flag is the flag for intraTMP, and if intra_tmp_flag is true, intra_tmp_idx is still determined, and intra_tmp_idx is used to indicate the candidate index.
[0324] In step 202, a list of candidate block vectors corresponding to the current block is determined based on the first template.
[0325] In the embodiments of the present invention, after determining a first template corresponding to the current block, a list of candidate block vectors corresponding to the current block can be further determined based on the first template.
[0326] It should be noted that in embodiments of the present invention, the list of candidate block vectors corresponding to the current block may include at least one block vector obtained by searching based on a first template corresponding to the current block.
[0327] Furthermore, in the embodiments of the present invention, after determining a first template corresponding to the current block, it is possible to choose to determine search parameters corresponding to the first template based on the first template.
[0328] In embodiments of the present invention, the search parameters may be understood to include at least one of the search range, search order, and list length. Here, the search range is used to determine the extent of the search region in which the search is performed; the search order is used to determine the forward and backward order of the horizontal and vertical searches performed; and the list length is used to determine the length of the final generated list of candidate block vectors.
[0329] In other words, in the embodiments of the present invention, in the process of constructing a block vector candidate list based on a selected first template, when constructing a list based on a different template, the search method used, including the search range and search order, and the length of the list may be the same or different.
[0330] For example, in some embodiments, if the determined first template is the first candidate template, i.e., if it is decided to use the TL template, the list length of the block vector candidate list is set to 15, and if the determined first template is the second or third candidate template, i.e., if it is decided to use the T template or L template, the list length of the block vector candidate list is set to 8.
[0331] For example, in some embodiments, if the determined first template is the second candidate template, i.e., if it is decided to use the T template, the list length of the block vector candidate list is set to 8, and if the determined first template is the third candidate template, i.e., if it is decided to use the L template, the list length of the block vector candidate list is set to 4.
[0332] Furthermore, in the embodiments of this invention, after determining the search parameters corresponding to the first template, a further search can be performed based on the search parameters and the first template to determine a list of candidate block vectors corresponding to the current block.
[0333] In other words, in the embodiments of the present invention, a first reference template can be referenced in the process of determining a list of block vector candidates corresponding to the current block based on a first template. Specifically, the search parameters determined by the first template can be used in the process of performing the search.
[0334] Furthermore, in the embodiments of this application, a search can be performed based on search parameters corresponding to the current block and a first template, and a block vector candidate list can finally be determined. Specifically, a search is performed based on search parameters such as the search range, search order, and list length corresponding to the current block, and a block vector candidate list corresponding to the current block is finally determined.
[0335] Furthermore, in the embodiments of the present invention, when determining a list of candidate block vectors corresponding to the current block based on a first template, it is possible to first determine a pre-configured search area corresponding to the first template, and then perform a search within the pre-configured search area to determine a list of candidate block vectors corresponding to the current block.
[0336] It should be explained that in the embodiments of this application, the pre-defined search area is the reconstructed portion of the current image and is limited by the size of the search range. Here, the pre-defined search area is actually the set of all search points. Since the shape of this area often cannot be represented by a single rectangular area, in concrete implementation, it is also possible to perform searches in multiple rectangular areas and combine the search results from different areas to obtain the final optimal matching block and optimal block vector.
[0337] Furthermore, in the embodiments of the present invention, when performing a search within a preset search area and determining a list of block vector candidates corresponding to the current block, the search points within the preset search area can be scanned, and the matching cost between the matching template corresponding to the search point within the preset search area and the first template can be determined based on a preset matching criterion. Subsequently, the list of block vector candidates can be determined based on the matching cost.
[0338] It should be explained that in the embodiments of the present invention, the candidate list of block vectors corresponding to the current block includes one or more block vectors corresponding to the current block obtained by the search, and one or more candidate templates corresponding to one or more block vectors.
[0339] In other words, in the embodiments of the present invention, the number of block vectors determined by the search may be one or more. For example, if the length of the list of candidate block vectors is N, then N block vectors for the current block can be determined, where N is an integer greater than 0.
[0340] Correspondingly, in the embodiment of the present invention, when performing a search within a preset search area and determining a list of candidate block vectors corresponding to the current block, the search points within the preset search area can be scanned, and based on preset matching criteria, the matching cost between the matching template corresponding to the search point within the preset search area and the first template can be determined. Finally, based on the matching cost, N block vectors and N candidate templates corresponding to the N block vectors can be determined, and a corresponding list of candidate block vectors can be generated.
[0341] In other words, in the embodiments of the present invention, when searching for and determining N block vectors corresponding to N matching templates within a pre-set search area, that is, the process of searching for and determining block vectors BV corresponding to N matching templates within a search area (a pre-set search area) may include determining the value of the number N of candidate templates, determining the comparison criteria for the matching templates, and recording the N block vectors BV corresponding to the N matching templates (the selected N candidate templates).
[0342] It should be explained that in the embodiments of the present invention, the pre-set matching criteria include one of the cost functions for measuring the mode, such as the absolute error sum SAD, transformed absolute error sum SATD, squared error sum SSE, mean absolute deviation MAD, mean absolute error MAE, mean squared error MSE, or normalized correlation coefficient NCC.
[0343] Furthermore, in the embodiment of the present invention, when determining a list of candidate block vectors corresponding to the current block based on the matching cost, that is, determining N block vectors and N candidate templates corresponding to the N block vectors (the list length of the candidate block vector list is N), first, N minimum matching costs can be determined from among the matching costs between the matching template corresponding to the search point in the pre-set search area and the first template, and then N block vectors and N candidate templates corresponding to the N minimum matching costs can be determined.
[0344] It should be noted that in the embodiments of the present application, when performing a search, the search strategies that can be employed may include, but are not limited to, search methods based on different search step sizes, for example, a coarse search based on a first search step size and / or a fine search based on a second search step size, where the first search step size is larger than the second search step size.
[0345] Furthermore, in the embodiment of the present invention, first, the search points within a preset search area are scanned according to a first search step size to determine an initial block vector and an initial matching template corresponding to the initial block vector. Next, the first search area is determined based on the initial matching template, where the first search area is smaller than the preset search area. Finally, the search points within the first search area are scanned according to a second search step size to determine a block vector and a candidate template, and a corresponding block vector candidate list is determined. Here, the first search step size is larger than the second search step size.
[0346] As can be seen from the above, in the embodiments of this application, it is possible to choose not to sequentially search for each possible BV in the search process. For example, the normal search order is from left to right and from top to bottom. Generally, all pixel BVs can be searched sequentially. For example, if the BV currently being searched is (x0, y0), the next is (x0+1, y0), assuming that the boundary of the search range has not been reached. In this application, a sparse search can be performed first. For example, in the case of all pixel BVs, if the BV currently being searched is (x0, y0), the next is (x0+3, y0), assuming that the boundary of the search range has not been reached. In other words, it is also possible to perform one template matching for every certain number of pixels and one template matching for every certain step size. The step size here may be a preset value such as 2, 3, 4, or 8. Of course, the same process can also be performed in a vertical way. First, find the K BVs with the minimum cost, where K may be equal to N, or may be greater than or less than N. This process may be implemented by constructing a list. Next, based on the K BVs with the minimum cost, we improve each BV within a small range. For example, if the search interval above is 3 pixels, the range to be improved here can be set to 3x3, and the improved BVs may be used to construct a block vector candidate list of length N, in this way we can obtain N candidate BVs.
[0347] Exemplary, in some embodiments, for example, N can be set to 3, and a first search can be performed according to a predetermined step size to find a certain number of sorted BVs, for example, 3 BVs. Here, the horizontal step size is 3 and the vertical step size is also 3. Next, a second search is performed based on the 3 sorted BVs, this time with a search range of 3x3, and each BV within each 3x3 range participates in sorting the block vector candidate list intraTmpCandList.
[0348] It should be noted that, in the embodiments of this application, if sub-pixel accuracy is supported, further subdivision down to the sub-pixel BV can be performed. For example, based on the total pixel BV selected in the second step, a search for half a pixel can be performed within a single pixel range in the upper, lower, left, or right direction.
[0349] It should be explained that, in the embodiments of this application, if the bitstream does not specify which candidate template or which candidate template to use, the process of directly constructing a list of block vector candidates corresponding to the current block based on multiple candidate templates in the template set requires comparing the matching costs of different candidate templates. In this case, because the different candidate templates have different sizes or pixels, it is necessary to uniformly adjust the matching costs of different candidate templates when comparing them.
[0350] In embodiments of the present invention, it may be understood that in the process of adjusting the matching costs of different candidate templates, it may be chosen to adjust the corresponding initial cost using pixel parameters corresponding to the candidate templates, or it may be chosen to determine template coefficients corresponding to the candidate templates and then adjust the corresponding initial cost using said template coefficients.
[0351] Furthermore, in the embodiments of this application, in the process of constructing a block vector candidate list, the search points within a pre-defined search area can be scanned, and the initial cost between the matching template corresponding to the search point within the pre-defined search area and the first template can be determined based on pre-defined matching criteria. Next, the initial cost is adjusted based on the pixel parameters corresponding to the candidate template, and the matching cost between the matching template corresponding to the search point within the pre-defined search area and the first template can be determined. Finally, the block vector candidate list can be determined based on the matching cost.
[0352] In other words, in the embodiments of the present invention, when a single block vector candidate list is directly constructed using multiple candidate templates such as TL templates, L templates, and T templates, each block vector in the block vector candidate list may be obtained by template matching using either a TL template, an L template, or a T template. In this case, the basic principle for constructing the block vector candidate list is to sort the matching costs of different candidate templates.
[0353] In the embodiments of this application, it can be understood that directly comparing the matching costs of several different candidate templates would result in inaccurate results because the number of pixels in each candidate template differs. For example, directly comparing the SADs of different templates is unreasonable, given that the matching cost is SAD. For instance, for the same BV, the SAD of the TL template is equal to the sum of the SADs of the T template and the L template.
[0354] For example, in some embodiments, when comparing the matching costs of different candidate templates, it may be chosen to adjust the matching cost (initial cost) based on the pixel parameters of the different templates. Here, the pixel parameter may be the number of pixels corresponding to the candidate template. For example, when adjusting the matching cost (initial cost) using the pixel parameter, the absolute value of the average difference (adjusted matching cost) can be obtained by dividing the initial cost corresponding to the candidate template (e.g., SAD) by the number of pixels corresponding to that candidate template (pixel parameter). This division result can be called the average absolute difference (AAD), and that is, the finally determined matching cost may be the corresponding AAD.
[0355] In the embodiments of the present invention, it can be understood that by adjusting the initial cost based on the pixel parameters of different templates and obtaining the matching cost AAD corresponding to different candidate templates, the influencing factor of different pixel counts for different candidate templates can be removed, and the matching costs of further different candidate templates can be compared to finally generate a corresponding block vector candidate list.
[0356] Furthermore, in the embodiments of the present invention, if the first template includes multiple candidate templates within the template set, the template coefficients corresponding to each candidate template may be determined first.
[0357] It should be explained that when determining the template coefficients for each candidate template, one can choose to determine the template coefficients based on the size parameter corresponding to the candidate template, or based on the pixel parameter corresponding to the candidate template, or even set the template coefficients for different candidate templates according to pre-set values.
[0358] Understandably, in the embodiments of the present invention, different candidate templates correspond to different template coefficients, and by uniformly adjusting the matching costs of different templates using the template coefficients corresponding to different candidate templates, a more rational and accurate list of block vector candidates can be obtained when sorting the matching costs.
[0359] Furthermore, in the embodiments of this application, in the process of constructing a block vector candidate list, the search points within a pre-defined search area can be scanned, and the initial cost between the matching template corresponding to the search point within the pre-defined search area and the first template can be determined based on pre-defined matching criteria. Next, the initial cost can be adjusted based on template coefficients to determine the matching cost between the matching template corresponding to the search point within the pre-defined search area and the first template. Finally, the block vector candidate list can be determined based on the matching cost.
[0360] For example, in some embodiments, when comparing the matching costs of different candidate templates, it may be chosen to compare them based on the template coefficients of the different templates. For instance, the SAD of the different candidate templates can be multiplied by a single coefficient (template coefficient) to complete the adjustment for the initial costs of the different candidate templates, thereby allowing the different candidate templates to be compared by their adjusted matching costs.
[0361] It should be explained that, in the embodiments of this application, assuming that the TL template includes both a T template and an L template, the number of pixels in the TL template is always the maximum, so only the T template and the L template can be multiplied by one template coefficient, but it is not necessary to multiply the TL template by one, or the template coefficient of the TL template is set to 1.
[0362] For example, in some embodiments, the initial cost SAD of the TL template is SADTL It states that the initial cost of the T template is SAD. T It states that the initial cost of the L template is SAD. L It is written as follows: The matching cost of the TL template for comparison with other templates is COST TL It states that the matching cost of the T template is COST T It states that the matching cost of the L template is COST L It is written as follows.
[0363] Using the corresponding template coefficients, for example, if the template coefficient for the TL template is 1 and the template coefficient for the T template is COEF T Therefore, the template coefficient of the TL template is COEF L If that is the case, COST TL =SAD TL COST T =SAD T *COEF T COST L =SAD L *COEF L It is possible to make a decision.
[0364] Here, COEF T and COEF L This may be calculated by the number of pixels in the candidate template. COEF of different block sizes T and COEF L This can be calculated in advance.
[0365] For example, in some embodiments, if the TL template does not include the upper left corner portion, i.e., the TL template is equal to the sum of the T template and the L template, and the width of the current block is equal to the height, then COEF T is equal to 2, COEF L It is equal to 2. However, it is still COEF T or COEF L It is unavoidable that it will be a decimal. For example, if width is twice height, COEF Tis equal to 1.5, COEF L is equal to 3.
[0366] After adjusting using the corresponding template coefficient, COST TL =SAD TL *COEF TL , COST T =SAD T *COEF T , COST L =SAD L *COEF L can be determined.
[0367] Here, COST TL , COST T and COST L may be calculated according to the number of pixels of multiple templates. COST with different block sizes TL , COST T and COST L can be pre-calculated.
[0368] Exemplarily, in some embodiments, if the TL template does not include the upper left corner part, that is, the TL template is equal to the sum of the T template and the L template, and the width of the current block is equal to the height, COEF TL is equal to 1, COEF T is equal to 2, COEF L is equal to 2. For example, if the width is twice the height, COEF TL is equal to 2, COEF T is equal to 3, COEF L is equal to 6. The method for calculating the template coefficient of the specified template can be to divide the least common multiple of the number of pixels of each template by the number of pixels of the specified template.
[0369] It is understandable that, in the embodiments of this application, for the matching costs of the TL template, T template, and L template of the same BV, if the matching degree of the T template and the matching degree of the L template (such as the AAD mentioned above) are different, even if only slightly different, the COST calculated according to the pixel ratio will be affected. T or COST L One of them is COST TL It should be smaller than that. In other words, if you adjust the template coefficients of multiple candidate templates (TL template, T template, L template, etc.) using pixel parameters or size parameters, and then directly compare the matching costs of the TL template, T template, and L template after the adjustment, the TL template will be at a disadvantage in most cases. That is, if you compare them directly according to the method described above, you will be comparing only the parts with a high degree of matching between different BVs. However, in reality, the TL template covers more adjacent areas, and in most cases the texture is continuous from the left and top, so it is illogical to use the T and L templates indiscriminately instead of the TL template.
[0370] It should be explained that in the embodiment of this application, the template coefficient corresponding to the candidate template can be set according to a predetermined value, and the adjustment range for adjusting the matching cost can be rationally controlled.
[0371] For example, in some embodiments, when the template coefficients corresponding to candidate templates are set according to predetermined values, the template coefficients for the T template and / or L template may be set to a value greater than the template coefficient for the TL template.
[0372] For example, in the embodiment of the present application, when the template coefficient corresponding to the candidate template is set according to a predetermined value, COST T or COST L COSTTL It can be extended to allow comparison. This method of setting template coefficients not only eliminates the influence of the number of pixels, but also takes into account that TL templates are generally at a disadvantage compared to T templates and L templates, so adjustments are necessary. For example, COST T or COST L Multiply by a coefficient greater than 1.
[0373] It should be noted that, in embodiments of the present invention, if the first template includes multiple candidate templates in the template set, each block vector in the block vector candidate list may be obtained by template matching using either a TL template, an L template, or a T template. In this case, it is possible to choose to limit the number of block vectors corresponding to any given candidate template in the block vector candidate list.
[0374] Furthermore, in the embodiments of the present invention, an upper threshold value corresponding to each candidate template is determined, and the number of block vectors corresponding to the candidate template in the block vector candidate list is determined based on the upper threshold value. Here, the value of the upper threshold value may be less than or equal to the list length of the block vector candidate list.
[0375] In other words, in the embodiments of the present invention, several restrictions can be placed on the number of candidates (block vectors) selected based on the T template and the L template in the same block vector candidate list. For example, an upper limit can be set on the number of candidates (block vectors) selected by the T template and / or the L template, and after the number of candidates (block vectors) selected by the T template and / or the L template in the block vector candidate list reaches the upper limit, no further candidates (block vectors) selected by the T template and / or the L template can be added to the block vector candidate list.
[0376] Furthermore, in embodiments of the present invention, when a block vector candidate list is constructed using multiple candidate templates directly, that is, when the first template includes multiple candidate templates, for example, when the first template includes at least a first candidate template, a second candidate template, and a third candidate template, a second search region can be determined based on the first candidate template, and the search points within the second search region can be scanned according to the first search step size to determine the initial block vector. Subsequently, a third search region can be determined based on the initial block vector and the first template, and the search points within the third search region can be scanned according to the second search step size to determine the block vector candidate list. Here, the first search step size is larger than the second search step size.
[0377] Understandably, in the embodiments of this application, an initial search can be performed using a first candidate in the first template, according to a first search step size, and then an initial block vector can be selected and determined. Next, using the initial block vector as a positioning point, the matching costs of the first template, which includes multiple candidate templates, can be compared and adjusted, and a further refined search can be performed according to a second search step size, finally completing the construction of a block vector candidate list.
[0378] Exemplary, in the embodiment of the present invention, assuming that the first candidate template in the first template is a TL template, during the first step of searching for multiple intraTmp candidates (a coarse search with intervals equal to the first search step size), the second search area is first determined based on the TL template, and after scanning the search points within the second search area, a certain number of BVs, i.e., initial block vectors, can be selected based on the matching cost corresponding to the first candidate template. These BVs are used as positioning points for the second step of the search (i.e., an improved search performed according to the second search step size). Next, the matching status of some of these BVs with TL templates, T templates, and L templates is analyzed. COST corresponding to a certain BV T or COSTL If the discrimination is significant, or COST T or COST L If the value is greater than a preset value, you can choose to perform an improvement search using the template with the higher matching degree among the T template or L template, that is, continue the search using a candidate template other than the first candidate template within the first template. Conversely, the COST corresponding to a certain BV T or COST L If the differences are not significant, we will still use the TL template to perform the improvement search, that is, continue the search using the first candidate template.
[0379] Furthermore, in embodiments of the present invention, if the first template includes at least a first candidate template, a second candidate template, and a third candidate template, a search can be performed based on the first candidate template to determine a first list corresponding to the first candidate template, a search can be performed based on the second candidate template to determine a second list corresponding to the second candidate template, a search can be performed based on the third candidate template to determine a third list corresponding to the third candidate template, the first list can be adjusted based on the second and third lists to determine a block vector candidate list.
[0380] It should be noted that in the embodiments of this application, the list lengths of the second list and the third list may be the same or different, and this application is not specifically limited to such examples.
[0381] It should be explained that if no first template is specified in the bitstream, only one block vector candidate list is constructed, thus eliminating the need to use syntactic elements in the bitstream to indicate which template to select. However, since the template matching costs between different templates cannot be directly compared, certain rules must be established so that they can be placed in a single block vector candidate list. One direct method here is to sort the candidates from one of the candidate templates by the matching cost of that candidate template, and to place the candidates from other different candidate templates directly into their given positions in the list without sorting them by the matching cost of that candidate template.
[0382] For illustrative purposes, in some embodiments, we assume that the first candidate template is a TL template, the second candidate template is a T template, the third candidate template is an L template, and the list length of the block vector candidate list is N. First, we can construct a first list of length N using the TL templates, where, according to a pre-defined search method, we calculate the template matching cost for each BV found, sort them based on their template matching cost, and place those with smaller costs earlier, ultimately generating the first list. We can also specify M as the maximum number of T and L templates that can be placed in the final block vector candidate list. The number that can ultimately be placed may be less than M because a duplicate check operation is required when placing them in the list. Next, we continue the search based on the T and L templates, generating the corresponding second and third lists, respectively. Finally, we can sequentially place the block vectors and their corresponding candidate templates from the second and third lists into the first list, completing the adjustments to the first list and thereby obtaining the corresponding block vector candidate list.
[0383] For illustrative purposes, in some embodiments, in one example, N is 15 and M is 2, meaning the length of the final generated block vector candidate list is 15, and it can contain up to 2 candidates for the T template and up to 2 candidates for the L template.
[0384] For example, in some embodiments, in one example, N is 19 and M is 3, meaning the length of the final generated block vector candidate list is 19, and it can contain up to 3 candidates for the T template and up to 3 candidates for the L template.
[0385] Furthermore, in embodiments of the present invention, if the first template includes at least a first candidate template, a second candidate template, and a third candidate template, a search is performed based on the first candidate template, the second candidate template, and the third candidate template to determine a first list corresponding to the first candidate template, a second list corresponding to the second candidate template, and a third list corresponding to the third candidate template, respectively. The first list is then adjusted based on the second and third lists to determine a block vector candidate list.
[0386] In other words, in the embodiments of the present invention, it is also possible to simultaneously perform a search based on the first candidate template, the second candidate template, and the third candidate template to obtain the corresponding first list, the second list, and the third list, and then to generate the corresponding block vector candidate list based on the first list, the second list, and the third list.
[0387] Exemplary, in some embodiments, one approach to the search process is that the T-template and L-template can share the search process for the TL-template, and the matching costs of the T-template and L-template can be calculated simultaneously when calculating the matching cost for the TL-template, thus not significantly increasing the complexity of the search. For example, in the same search process, lists are built for the TL-template, T-template, and L-template respectively, and after the search is complete, the three lists are merged into a final block vector candidate list.
[0388] For example, in some embodiments, the T template and L template may use a different search process than the TL template. Of course, some search processes may be shared and others may be separate, and this is not specifically limited in this application.
[0389] Furthermore, in the embodiments of the present invention, when adjusting the first list based on the second and third lists to determine the block vector candidate list, first, a first starting position corresponding to the second list and a second starting position corresponding to the third list are determined. Then, block vectors in the second list are added to the first list according to the first starting position, and at the same time, block vectors in the third list are added to the first list according to the second starting position to obtain the block vector candidate list.
[0390] It should be explained that in the embodiments of this application, the starting position for adding block vectors in the second list to the first list can be determined by the first starting position. The starting position for adding block vectors in the third list to the first list can also be determined by the second starting position. Here, the first starting position and the second starting position may be the same or different.
[0391] Furthermore, in the embodiments of the present invention, when adding block vectors from the second list to the first list according to the first starting position, block vectors from the second list that are not present in the first list can be added to the first starting position in the first list. When adding block vectors from the third list to the first list according to the second starting position, block vectors from the third list that are not present in the first list can be added to the second starting position in the first list.
[0392] For example, in some embodiments, the smallest index position in which the T template and L template can be placed can be designated as Pos, or the closest previous position is Pos, i.e., the first and second starting positions are Pos. Here, Pos can be calculated based on N and M, for example, Pos = N - 1 - M × 2. The closest previous positions in which the T template and L template can be placed can also be defined, respectively.
[0393] For illustrative purposes, in some embodiments, suppose the first candidate template is a TL template, the second candidate template is a T template, and the third candidate template is an L template, and the length of the block vector candidate list is N, i.e., the list length of the first list is X, and the list lengths of the second and third lists are N, and we can attempt to insert candidates for T and L templates into the first list of TL templates in order to generate the block vector candidate list. Here, a pre-configured search method can find X T template candidates and X L template candidates with an optimal template matching cost. The X T template candidates and X L template candidates can each be used to construct temporary lists of length X, i.e., the second and third lists. We then attempt to insert the T and L template candidates into the final block vector candidate list. First, a duplicate check operation can be performed, and if the same BV as a candidate to be inserted into the second or third list already exists in the first list, it is not inserted into the list. If the same BV as a candidate to be inserted in the second or third list does not exist in the first list, the candidate at the specified first or second starting position in the first list, and the candidates after the first or second starting position, are sequentially moved backward, and then the candidate to be inserted is placed at the specified starting position in the first list. Specifically, each time an item is inserted into the first list, the specified first or second starting position moves one position backward until all M or X candidates placed in the temporary lists have been checked.
[0394] It should be noted that, in the embodiments of the present application, regardless of whether the first list, the second list, and the third list are obtained separately by search or whether the first list, the second list, and the third list are obtained simultaneously by search, the search method used may include first performing a sparse search according to a first search step size, and then performing an improved search according to a second search step size.
[0395] For illustrative purposes, in some embodiments, for the sparse search in the first step, the search process does not sequentially search for each possible BV. For example, the usual search order is left to right and top to bottom. Generally, all pixel BVs can be searched sequentially. For example, if the currently searched BV is (x0, y0), the next is (x0+1, y0), assuming that the boundary of the search range has not been reached. However, a sparse search can be performed first. For example, for all pixel BVs, if the currently searched BV is (x0, y0), the next is (x0+3, y0), assuming that the boundary of the search range has not been reached. In other words, it is also possible to perform one template matching for every certain number of pixels and one template matching for every certain step size. The step size here may be a preset value such as 2, 3, 4, or 8. Of course, the same process can also be performed in a vertical way. First, find the K BVs with the minimum cost of the TL template, where K may be equal to N, greater than N, or less than N. This process may be implemented by constructing a list. Simultaneously, find the X' BVs with the minimum cost for the T template and the X' BVs with the minimum cost for the L template, where X' may be equal to M, greater than M, or less than M. This process may be implemented by constructing a list. In other words, each BV in this search process simultaneously sorts the template matching costs of the TL template, T template, and L template; that is, the three share a sparse search process.
[0396] Exemplary, in some embodiments, for the improvement search in the second step, improvements are made in small ranges based on each BV, based on the K BVs with the minimum cost of the TL template. For example, if the search interval is 3 pixels, the improved range may be set to 3x3, and the improved BVs may be used to construct a block vector candidate list of length N. Furthermore, improvements are made in small ranges based on each BV, based on the X' BVs with the minimum cost of the T template and L template. For example, if the search interval is 3 pixels, the improved range may be set to 3x3, and the improved BVs may be used to construct a temporary block vector candidate list of length X for the T template and a temporary block vector candidate list of length X for the L template. Then, the list of TL templates of length N, the list of T templates of length X, and the list of L templates of length X are combined into a final block vector candidate list according to the method described above.
[0397] For example, in some embodiments, N=15, K=2N, M=2, X=4, and X'=2X.
[0398] It should be noted that, in the embodiments of this application, if sub-pixel accuracy is supported, further subdivision down to the sub-pixel BV can be performed. For example, based on the total pixel BV selected in the second step, a search for half a pixel can be performed within a single pixel range in the upper, lower, left, or right direction.
[0399] In the embodiments of this application, it can be understood that sharing a sparse search process does not significantly increase the complexity of the search, and that in a wide range of sparse searches, the improved search scopes for the TL template, T template, and L template can be found. The improved search is more precise because it can be performed on different templates.
[0400] In step 203, the block vector corresponding to the current block is determined based on the list of candidate block vectors corresponding to the current block, and the predicted value of the current block is determined based on the block vector.
[0401] In the embodiments of the present invention, after determining a list of candidate block vectors corresponding to the current block based on a first template, the block vector corresponding to the current block can be further determined based on the list of candidate block vectors corresponding to the current block, and further, the predicted value of the current block can be determined based on the block vector.
[0402] It should be explained that in the embodiments of the present application, when the value of the template matching prediction identifier is a first value, that is, when it is decided to perform prediction processing on the current block using the prediction method of intraTmp based on the value of the template matching prediction identifier, the index identifier corresponding to the current block can be further determined, and then a candidate index corresponding to the current block can be determined based on the index identifier.
[0403] In the embodiments of the present invention, the index of the block vector corresponding to the current block in the block vector candidate list can be determined by the index identification information corresponding to the current block, that is, the candidate index corresponding to the current block can be determined by the index identification information.
[0404] It should be explained that, in the embodiments of the present invention, if the list length of the block vector candidate list generated differs when different candidate templates are used, it is necessary to first parse the syntactic elements indicating the template, such as the first template identifier intra_tmp_alternative_template_flag and / or the second template identifier intra_tmp_template_idx, and then parse the candidate index intra_tmp_idx.
[0405] Furthermore, in the embodiments of the present invention, regardless of which candidate template is used as the first template of the current block, if the corresponding list length, binarization, de-binarization method, context model, etc., are the same, the candidate index intra_tmp_idx is considered independent of other syntactic elements indicating templates, such as the first template indicator information intra_tmp_alternative_template_flag and / or the second template indicator information intra_tmp_template_idx. Therefore, it is possible to parse either the syntactic elements indicating templates, such as intra_tmp_alternative_template_flag and / or intra_tmp_template_idx, or intra_tmp_idx first.
[0406] Furthermore, in embodiments of the present application, if a different candidate template is selected as the first template of the current block, and at least one of the corresponding list length, binarization, de-binarization method, context model, etc., is likely to be different, then the candidate index intra_tmp_idx is considered to depend on syntactic elements indicating the template, such as the first template indicator information intra_tmp_alternative_template_flag and / or the second template indicator information intra_tmp_template_idx. Therefore, it is necessary to first parse the syntactic elements indicating the template, such as intra_tmp_alternative_template_flag and / or intra_tmp_template_idx, and then parse intra_tmp_idx.
[0407] Furthermore, in the embodiments of the present application, if the value of the first template instruction information is the third value, the index identification information is determined based on the first context, and if the value of the first template instruction information is the fourth value, the index identification information is determined based on the second context.
[0408] Understandably, in the embodiments of this application, after analyzing the first template instruction information intra_tmp_alternative_template_flag, the context used in the encoding and decoding process can be determined based on the first template instruction information; that is, the context model (CABAC context model) in the encoding and decoding process can be determined using the first template instruction information. Of course, the context model in the encoding and decoding process can also be determined using the second template instruction information, and this is not specifically limited in this application.
[0409] It should be explained that in the embodiments of this application, different context models (CABAC context models) can be set during binarization or debinarization encoding and decoding. That is, the probabilities of binary symbols based on the context coding for the two cases are multiplied and updated. In other words, the encoder / decoder can select a set of context models based on the values of syntactic elements indicating templates, such as the first template instruction information intra_tmp_alternative_template_flag and / or the second template instruction information intra_tmp_template_idx.
[0410] For illustrative purposes, in some embodiments, if the value of intra_tmp_alternative_template_flag is 0, one set / one context model contextModel0 is selected, and if the value of intra_tmp_alternative_template_flag is 1, one set / one context model contextModel1 is selected.
[0411] Furthermore, in the embodiments of the present invention, in the process of determining a candidate index corresponding to the current block based on index identification information, if the value of the first template instruction information is a third value, the candidate index is determined based on the index identification information and the first binarization strategy, and if the value of the first template instruction information is a fourth value, the candidate index is determined based on the index identification information and the second binarization strategy.
[0412] In embodiments of the present application, after analyzing the first template instruction information intra_tmp_alternative_template_flag, the binarization strategy used in the candidate index determination process can be determined based on the first template instruction information; that is, the method of de-binarization can be determined using the first template instruction information. Of course, the method of binarization (encoding side) or de-binarization (decoding side) in the encoding and decoding process can also be determined using the second template instruction information, and this is not specifically limited in the present application.
[0413] It should be noted that in embodiments of the present application, the methods for binarizing and de-binarizing candidate index intra_tmp_idx may differ based on different values of template instruction information. Different binarization and de-binarization methods can be set because, even if the list lengths of the block vector candidate lists generated when using different candidate templates are the same, they may follow different probability distribution rules.
[0414] Exemplary, in some embodiments, in one case (e.g., when using a TL template), the probability of selecting some earlier candidates with very small indices is clearly higher than that of other candidates with relatively large indices. The binarization and de-binarization methods assign short binary symbols to some earlier candidates with very small indices and long binary symbols to other candidates with relatively large indices.
[0415] Exemplary, in some embodiments, in other cases (e.g., when using a T-template or an L-template), the probability of selecting some previous candidates with very small indices is not much different from other candidates with relatively large indices, and the difference in the lengths of the binary symbols assigned to them by the binarization and de-binarization methods is not as large as in the previous case, or the same binary symbol lengths are used directly.
[0416] In other words, in the embodiments of the present invention, the encoder / decoder selects a set of binarization and debinarization methods based on the values of syntactic elements that indicate a template, such as intra_tmp_alternative_template_flag and / or intra_tmp_template_idx.
[0417] For example, in some embodiments, when the value of the first template instruction information intra_tmp_alternative_template_flag is 0, binarization and de-binarization method 1 is selected, as shown in Table 3.
[0418] For example, in some embodiments, when the value of the first template instruction information intra_tmp_alternative_template_flag is 1, binarization and de-binarization method 2 is selected, as shown in Table 4.
[0419] Here, the Symbols in Tables 3 and 4 above correspond to the candidate index intra_tmp_idx.
[0420] It should be explained that in the embodiments of this application, on the decoding side, the decoder uses an inverse binarization method. According to the correspondence table between Symbol and binary symbols, when a binary symbol is encoded using context mode, the context model is selected, the bitstream is read, and the value of Symbol is determined. On the encoding side, the encoder uses a binarization method. According to the correspondence table between Symbol and binary symbols, when a binary symbol is encoded using context mode, the context model is selected, and the content to be written to the bitstream is determined based on the value of Symbol. Here, Symbol corresponds to intra_tmp_idx.
[0421] Furthermore, in the embodiments of the present application, when performing binarization or de-binarization of intra_tmp_idx, whether using only TL templates or any combination of multiple candidates and multiple templates, if the list length N of the block vector candidate list is relatively large, the probability of the first candidate is high, the probability decreases towards the end, and the probabilities become closer to each other towards the end. Therefore, the first codeword is short, the last codeword is long, and several of the later candidates can use the same code length.
[0422] For illustrative purposes, in some embodiments, assuming that the list length N of the block vector candidate list is 15, indices 3-6 use codewords of the same length, indices 7-14 use codewords of the same length, and the specific binarization and inverse binarization are shown in Table 5.
[0423] Here, x in the table may be obtained by truncated binary. Here, a binary symbol with BinIdx = 0 can use a context-model based encoding method. If the value of a binary symbol with BinIdx = 0 is 1 (corresponding to the case where intra_tmp_idx is 0, 1, or 2 above), a binary symbol with BinIdx = 1 can use a context-model based encoding method. The binary symbol represented by x above can use a bypass encoding method.
[0424] For illustrative purposes, in some embodiments, assuming a list length N of the block vector candidate list is 19, indices 3-18 use codewords of the same length, and the specific binarization and inverse binarization are decoys shown in Table 6.
[0425] Here, x in the table may be obtained by truncated binary. Here, a binary symbol with BinIdx = 0 can use a context-model based encoding method. If the value of a binary symbol with BinIdx = 0 is 1 (corresponding to the case where intra_tmp_idx is 0, 1, or 2 above), a binary symbol with BinIdx = 1 can use a context-model based encoding method. The binary symbol represented by x above can use a bypass encoding method.
[0426] Correspondingly, in the embodiments of the present invention, the encoder converts the value of a syntax element (e.g., intra_tmp_idx in this case) to a corresponding binary symbol (bin), and then converts the binary symbol to a binary bit (bit) using an entropy coding engine. The decoder's entropy coding (decoding) engine converts the binary bit (bit) to a binary symbol, and then converts the binary symbol (bin) to the value of a syntax element.
[0427] It should be explained that, in the embodiments of this application, the context-based coding method and the bypass coding method are two modes of the entropy coding engine. During coding, the entropy coding engine converts binary symbols into binary bits in the bitstream. During decoding, the entropy coding engine converts binary bits in the bitstream into binary symbols. The context-based coding method can be understood as follows: The more frequently a binary symbol with a syntactic element (value 0 or 1) appears in the context, the more the entropy coding engine tends to use fewer binary bits corresponding to that binary symbol and more binary bits corresponding to other binary symbols. For example, if a binary symbol with a syntactic element (1) appears frequently, fewer binary bits will be used to encode 1 and more binary bits will be used to encode 0. The bypass coding method is equivalent to using an equal-probability model. Therefore, the bypass coding method has higher throughput than the context-based mode. The context-based coding method theoretically has higher compression efficiency.
[0428] For illustrative purposes, in some embodiments, assuming that the list length N of the block vector candidate list is 19, the specific binarization and inverse binarization are as shown in Table 7.
[0429] Here, x, y, and z for the same row in the table may each be obtained using truncated binary. That is, the last two binary symbols from 3 to 6 are obtained using truncated binary, the last two binary symbols from 7 to 10 are obtained using truncated binary, and the last three binary symbols from 11 to 18 are obtained using truncated binary. Here, binary symbols with BinIdx = 0 can use a context-model-based encoding method.
[0430] Understandably, in the embodiments of this application, if the value of a binary symbol with BinIdx 0 is 1 (corresponding to the cases where intra_tmp_idx is 0, 1, or 2 above), then a context-model-based encoding method can be used for the binary symbol with BinIdx 1.
[0431] Understandably, in the embodiments of this application, when the value of a binary symbol with BinIdx is 0 (corresponding to the case where intra_tmp_idx is greater than 2 above), a binary symbol with BinIdx is 1 can use a context-model-based encoding method, using a different context model than when intra_tmp_idx is 0, 1, or 2.
[0432] Understandably, in the embodiments of this application, if the value of a binary symbol with BinIdx 0 is 0, and the value of a binary symbol with BinIdx 1 is 1 (corresponding to the case where intra_tmp_idx is 3 to 10 above), then a binary symbol with BinIdx 2 can use a context-model-based encoding method.
[0433] In the embodiments of this application, it can be understood that the binary symbols represented by x, y, and z above can be encoded using a bypass coding method.
[0434] It should be noted that in the embodiments of this application, the above values of 0 and 1 are merely examples. The values of 0 and 1 may be reversed, but the results may be equivalent. Reversing the order of the binary symbols obtained by truncated binary is also equivalent.
[0435] Furthermore, in the embodiments of the present invention, if a candidate index corresponding to the current block is determined, and then a block vector corresponding to the current block is determined based on a list of candidate block vectors corresponding to the current block, the block vector corresponding to the current block can be determined from the list of candidate block vectors based on the candidate index.
[0436] In other words, in the embodiment of the present invention, the block vector indicated by the candidate index corresponding to the current block in the block vector candidate list can be determined as the block vector corresponding to the current block.
[0437] Furthermore, in the embodiments of the present invention, a block vector corresponding to the current block can be determined based on a list of candidate block vectors corresponding to the current block, a predicted value for the current block can be determined based on the block vector, and then the reconstruction value for the current block can be determined based on the predicted value for the current block.
[0438] It should be explained that in the embodiments of this application, first, a predicted residual value corresponding to the current block can be determined, and then, based on the predicted residual value and the predicted value, the reconstruction value of the current block can be further determined.
[0439] In embodiments of the present invention, it can be understood that, based on the predicted value of the current block, the predicted residual value of the current block can be determined and then written to the bitstream. Thereafter, the decoder can determine the predicted residual value corresponding to the current block by decoding the bitstream, and then further determine the reconstructed value of the current block based on the predicted residual value and the predicted value.
[0440] As can be seen from the above, the intraTMP multiple candidates realized by constructing a list of block vector candidates corresponding to the current block using the encoding method proposed in steps 201-203 above can provide multiple choices, and the first template corresponding to the current block, which can contain one or more candidate templates, can provide multiple choices at the template level. The combination of these two can improve compression efficiency and obtain better compression performance.
[0441] In other words, the encoding and decoding method proposed in the embodiment of the present invention can combine intraTMP multiple candidates and template-level multiple selections. In the process of combining the two, one implementation of the combination is to specify which template to use in the bitstream. The other implementation of the combination is to not specify which template to use in the bitstream, but to construct the same block vector candidate list using different templates.
[0442] Embodiments of the present application provide an encoding method in which the encoder determines a first template corresponding to the current block, where the first template is one or more candidate templates in a template set corresponding to the current block, determines a list of candidate block vectors corresponding to the current block based on the first template, determines a block vector corresponding to the current block based on the list of candidate block vectors corresponding to the current block, and determines a predicted value for the current block based on the block vector. As can be seen from the above, embodiments of the present application propose a prediction scheme that combines multiple intraTMP candidates and multiple templates, where it is possible to choose to determine a list of candidate block vectors that include at least one block vector of the current block, and at the same time, it is possible to choose to construct a list of candidate block vectors using a first template that includes at least one candidate template, and furthermore, a combination of multiple intraTMP candidates and multiple selections at the template level can be realized. In other words, the encoding and decoding method proposed in embodiments of the present application realizes multiple intraTMP candidates on the one hand by constructing a list of candidate block vectors corresponding to the current block, and on the other hand provides multiple selections at the template level using a first template corresponding to the current block that includes one or more candidate templates, thereby improving compression efficiency and encoding and decoding performance.
[0443] Based on the above embodiments, another embodiment of the present invention proposes an encoding and decoding method applicable to encoders / decoders. This encoding and decoding method takes as an example three templates, a TL template, a T template, and an L template, as candidate templates in the template set. Typically, when performing template matching, the matching cost between the template of the searched reference block and the template of the current block is calculated. This cost is generally measured by SAD, SATD, SSE, etc. Taking SAD as an example, if the TL template is the sum of the T template and the L template, the SAD of the TL template corresponding to the same BV is equal to the sum of the SAD of the T template and the SAD of the L template. If the TL template includes the upper left region in addition to the T template and the L template, the SAD of the T template and the SAD of the L template corresponding to the same BV can still be calculated in the process of calculating the SAD of the TL template.
[0444] It should be explained that the encoding and decoding method proposed in the embodiment of this application is an intra-prediction method that combines intraTMP multiple candidates and template-level multiple selection. Here, one combination is to instruct the decoder which template to use in the bitstream. The other combination is not to instruct the decoder which template to use in the bitstream, but to construct the same block vector candidate list using different templates.
[0445] For illustrative purposes, in some embodiments, when instructing the decoder which template to use in the bitstream, one example of a decoding syntax is as follows:
[0446] intra_tmp_flag if(intra_tmp_flag){ intra_tmp_alternative_template_flag if(intra_tmp_alternative_template_flag){ intra_tmp_template_idx } intra_tmp_idx } `intra_tmp_flag` indicates whether the current block uses `intraTmp`. If the current block uses `intraTmp`, the decoder parses `intra_tmp_alternative_template_flag`, which indicates whether the current block uses another template. A value of `intra_tmp_alternative_template_flag` of `intra_tmp_alternative_template_flag` indicates that the current block uses a TL template. If the value of `intra_tmp_alternative_template_flag` is 1, the decoder parses `intra_tmp_template_idx`, which indicates whether the current block uses a T template or an L template. For example, a value of `intra_tmp_template_idx` of `intra_tmp_template_idx` of `0` indicates that the current block uses a T template, and a value of `intra_tmp_template_idx` of `1` indicates that the current block uses an L template.
[0447] Of course, intra_tmp_alternative_template_flag and intra_tmp_template_idx may be merged into the same syntactic element intra_tmp_template_idx. For example, a value of 0 for intra_tmp_template_idx indicates that the current block uses a TL template. A value of 1 for intra_tmp_template_idx indicates that the current block uses a T template. A value of 2 for intra_tmp_template_idx indicates that the current block uses an L template.
[0448] The decoder constructs a list of block vector candidates based on the selected template. When constructing lists based on different templates, the search method, including the search range and search order, and the list length may be the same or different. For example, the list length is 15 when using the TL template, and 8 (or 4) when using the T or L template.
[0449] Analysis method If the list lengths are different, it is necessary to first parse the syntax elements that indicate the template, such as intra_tmp_alternative_template_flag and intra_tmp_template_idx, and then parse intra_tmp_idx.
[0450] In an extreme case, when using a T-template or L-template, if the length of the block vector candidate list is 1, i.e., there is only one candidate, intra_tmp_idx will not be parsed when using a T-template or L-template.
[0451] Furthermore, the methods for binarizing and debinarizing intra_tmp_idx may also differ. Even if the list lengths are the same in the two cases, different binarization and debinarization methods can be set because they may follow different probability distribution rules. To give a clear example, in one case (e.g., when using the TL template), the probability of selecting some of the earlier candidates with very small indices is clearly higher than that of other candidates with relatively large indices. The binarization and debinarization methods assign short binary symbols to the earlier candidates with very small indices and long binary symbols to the other candidates with relatively large indices. In another case (e.g., when using the T or L template), the probability of selecting some of the earlier candidates with very small indices is not significantly different from that of other candidates with relatively large indices, and the difference in the lengths of the binary symbols assigned to them by the binarization and debinarization methods is not as large as in the previous case, or the same binary symbol lengths are directly used. In other words, the encoder / decoder selects a pair of binarization and debinarization methods based on the values of syntactic elements that indicate templates, such as intra_tmp_alternative_template_flag and / or intra_tmp_template_idx. For example, if the value of intra_tmp_alternative_template_flag is 0, binarization and debinarization method 1 is selected; if the value of intra_tmp_alternative_template_flag is 1, binarization and debinarization method 2 is selected.
[0452] For illustrative purposes, in some examples, binarization and inverse binarization method 1 is shown in Table 3. Binarization and inverse binarization method 2 is shown in Table 4.
[0453] Furthermore, even with the same binarization method, two different context models (CABAC context models) can be set for the encoding and decoding of binarization and de-binarization. In other words, the probabilities of the binary symbols based on the context coding for the two cases are multiplied and updated. That is, the encoder / decoder selects a set of context models based on the values of syntactic elements indicating templates, such as intra_tmp_alternative_template_flag and / or intra_tmp_template_idx. For example, if the value of intra_tmp_alternative_template_flag is 0, one set of context models contextModel0 is selected, and if the value of intra_tmp_alternative_template_flag is 1, one set of context models contextModel1 is selected.
[0454] If the list length, binarization and de-binarization methods, and context model are all the same, i.e., if intra_tmp_idx does not depend on syntactic elements indicating templates such as intra_tmp_alternative_template_flag and / or intra_tmp_template_idx, then either the syntactic elements indicating templates such as intra_tmp_alternative_template_flag and / or intra_tmp_template_idx, or intra_tmp_idx, can be parsed first. Otherwise, i.e., if intra_tmp_idx depends on syntactic elements indicating templates such as intra_tmp_alternative_template_flag and / or intra_tmp_template_idx, then the syntactic elements indicating templates such as intra_tmp_alternative_template_flag and / or intra_tmp_template_idx are parsed first, and then intra_tmp_idx is parsed.
[0455] The decoder uses an inverse binarization method. According to the correspondence table between Symbol and binary symbols, if a binary symbol is encoded using context mode, it selects a context model, reads the bitstream, and determines the value of Symbol. The encoder uses a binarization method. According to the correspondence table between Symbol and binary symbols, if a binary symbol is encoded using context mode, it selects a context model and determines what to write to the bitstream based on the value of Symbol. Symbol corresponds to intra_tmp_idx.
[0456] Because TL templates cover a larger area of adjacent textures, and textures are almost always continuous from the left and top, TL templates often have greater reference value than standalone T templates and standalone L templates. Encoders frequently select TL templates, with standalone T templates and standalone L templates being used more often as supplements. Based on this distribution rule, it is possible to assign a higher priority to TL templates than to T templates and L templates. One way to do this is as follows:
[0457] intra_tmp_flag if(intra_tmp_flag){ intra_tmp_idx if(intra_tmp_idx>THR){ intra_tmp_template_idx } } If the current block uses intraTmp, first `intra_tmp_idx` is parsed, and then `intra_tmp_template_idx` is parsed. Whether or not `intra_tmp_template_idx` is parsed depends on the value of `intra_tmp_idx`. If the value of `intra_tmp_idx` is less than or equal to the threshold THR, the TL template is used by default. Otherwise, i.e., if the value of `intra_tmp_idx` is greater than or equal to the threshold THR, `intra_tmp_template_idx` must be parsed to determine which template the current block should use. For example, if the value of `intra_tmp_template_idx` is 0, it means the current block will use the TL template. If the value of `intra_tmp_template_idx` is 1, it means the current block will use the T template. If the value of `intra_tmp_template_idx` is 2, it means the current block will use the L template.
[0458] The advantage of doing this is that candidates with small indices do not need to distinguish which template to use and will use the TL template by default, thus reducing unnecessary overhead as these candidates often choose the TL template. We can also think of the indices of T-template and L-template candidates as starting from THR instead of 0, which corresponds to allocating longer binary symbol sequences to T-template and L-template.
[0459] Furthermore, in the embodiments of this application, the binarization and debinarization method of intra_tmp_idx, i.e., the entropy coding and decoding method, can be used even when only the TL template is used, and can also be used when the above-mentioned multiple candidates and multiple templates are combined.
[0460] Exemplary, in some embodiments, when N is large, the probability of the first candidate is high, the probability decreases towards the end, and the probabilities become closer to each other towards the end, so the first codeword is short, the last codeword is long, and several later candidates can use the same code length. For example, as shown in Table 5, when N is 15, indices 3-6 use codewords of the same length, indices 7-14 use codewords of the same length, and x in the table may be obtained by truncated binary. Here, binary symbols with BinIdx 0 can use context-model based encoding methods. When the value of a binary symbol with BinIdx 0 is 1 (corresponding to the case where intra_tmp_idx is 0, 1, or 2 above), binary symbols with BinIdx 1 can use context-model based encoding methods. Binary symbols represented by x above can use bypass encoding methods.
[0461] The encoder converts the value of a syntax element (e.g., intra_tmp_idx in this case) into a corresponding binary symbol (bin), and then uses an entropy coding engine to convert the binary symbol into a binary bit (bit). The decoder's entropy coding (decoding) engine converts the binary bit (bit) into a binary symbol, and then converts the binary symbol (bin) back into the value of the syntax element.
[0462] Context-based coding and bypass coding are two modes of the entropy coding engine. During coding, the entropy coding engine converts binary symbols into binary bits in the bitstream. During decoding, the entropy coding engine converts binary bits in the bitstream into binary symbols. Context-based coding can be understood as follows: The more frequently a binary symbol with a particular syntactic element (value 0 or 1) appears in the context, the more the entropy coding engine tends to use fewer binary bits corresponding to that symbol and more binary bits corresponding to other binary symbols. For example, if a binary symbol with a particular syntactic element (1) appears frequently, fewer binary bits are needed to encode 1 and more binary bits are needed to encode 0. Bypass coding is equivalent to using an equally probable model. Therefore, bypass coding has higher throughput than the context-based mode. Context-based coding theoretically has higher compression efficiency.
[0463] For example, in some embodiments, N is 19, as shown in Table 6, and x, y, and z in the same row in the table above may be obtained by truncated binary. That is, the last two binary symbols of 3-6 are obtained by truncated binary, the last two binary symbols of 7-10 are obtained by truncated binary, and the last three binary symbols of 11-18 are obtained by truncated binary.
[0464] Here, binary symbols with BinIdx = 0 can use context-model-based encoding methods.
[0465] If the value of a binary symbol with BinIdx 0 is 1 (corresponding to the cases where intra_tmp_idx is 0, 1, or 2 above), then the binary symbol with BinIdx 1 can use a context-model-based encoding method.
[0466] When the value of a binary symbol with BinIdx = 0 is 0 (corresponding to the case where intra_tmp_idx is greater than 2 above), a binary symbol with BinIdx = 1 can use a context-model-based encoding method, using a different context model than when intra_tmp_idx is 0, 1, or 2.
[0467] If a binary symbol with BinIdx = 0 has a value of 0, and a binary symbol with BinIdx = 1 has a value of 1 (corresponding to the case where intra_tmp_idx is between 3 and 10 above), then a binary symbol with BinIdx = 2 can use a context-model-based encoding method.
[0468] The binary symbols represented by x, y, and z above can be coded using a bypass method.
[0469] The values of 0 and 1 above are just examples. The values of 0 and 1 may be reversed, but the result may be equivalent. Reversing the order of the binary symbols obtained by truncated binary is also equivalent.
[0470] For illustrative purposes, in some embodiments where the bitstream does not instruct the decoder which template to use, and different templates are used to construct the same block vector candidate list, one example of decoding syntax is as follows, which is the same as the syntax for using multiple candidates individually.
[0471] intra_tmp_flag if(intra_tmp_flag) { intra_tmp_idx }
[0472] The decoder constructs a single block vector candidate list using TL, L, and T templates, and each block vector in the list can potentially be obtained by template matching using either the TL, L, or T template. The key point of this scheme is how the block vector candidate list is constructed.
[0473] The advantage of this combination method is that it does not require explicit instruction on which template to use, and it has lower overhead than combination method 1. Compared to combination method 1, it is more flexible, and if the block vector candidate list is constructed properly, a template will be sorted to the top when it finds a BV with a higher degree of matching. One fundamental principle for constructing a list is to sort by template matching cost. We need to compare the matching costs of multiple different templates, but the number of pixels in different templates differs. Taking SAD as an example, directly comparing the SADs of different templates is impractical. For the same BV, the SAD of a TL template is equal to the sum of the SADs of the T template and the L template. One method is to compare based on the number of pixels in different templates. As a simple example, we can obtain the average absolute difference by dividing the SAD by the number of pixels in the template, which we can call AAD (average absolute difference). Comparison is possible in this way, but it introduces division. Division should be avoided because the cost of implementing it in hardware is very high. One method is to multiply the SADs of different templates by a single coefficient so that they can be compared between different templates. Assuming that a TL template contains both a T template and an L template, the number of pixels in the TL template is always the largest, so we can multiply only the T template and the L template by a single template coefficient, but not the TL template.
[0474] TL template SADTL It is written that the SAD of the T template is SAD T It is written that the SAD of the L template is SAD L It is written as follows: The matching cost of the TL template for comparison with other templates is COST TL It states that the matching cost of the T template is COST T It states that the matching cost of the L template is COST L It is written as follows.
[0475] One method is as follows:
[0476] COST TL =SAD TL COST T =SAD T *COEF T COST L =SAD L *COEF L Here, COEF T and COEF L COEF may be calculated based on the number of pixels in several templates. T and COEF L This can be calculated in advance. To give a simple example, if the TL template does not include the upper left corner, that is, if the TL template is equal to the sum of the T template and the L template, and the width of the current block is equal to the height, then COEF T is equal to 2, COEF L It is equal to 2. However, it is still COEF T or COEF L It is unavoidable that it will be a decimal. For example, if width is twice height, COEF T This is equal to 1.5, COEF L It is equal to 3.
[0477] One method is as follows:
[0478] COST TL=SAD TL *COEF TL COST T =SAD T *COEF T COST L =SAD L *COEF L Here, COST TL COST T and COST L COST may be calculated by the number of pixels in several templates. TL COST T and COST L This can be calculated in advance. To give a simple example, if the TL template does not include the upper left corner, that is, if the TL template is equal to the sum of the T template and the L template, and the width of the current block is equal to the height, then COEF TL is equal to 1, COEF T is equal to 2, COEF L COEF is equal to 2. For example, if width is twice height, then COEF TL is equal to 2, COEF T It is equal to 3, COEF L This is equal to 6. The coefficients of a given template can be calculated by dividing the least common multiple of the number of pixels in each template by the number of pixels in the given template.
[0479] Using the method described above, the matching costs of different templates can be compared and sorted together after adjustment.
[0480] Let's consider the matching costs of the TL template, T template, and L template for the same BV. If the matching degree of the T template and the matching degree of the L template (such as the AAD mentioned above) are different, even a slight difference will affect the COST calculated according to the pixel ratio. T or COST L One of them is COSTTL It should be smaller than that. In other words, if we directly compare the matching costs of TL templates, T templates, and L templates according to the method described above, TL templates are at a disadvantage in most cases. That is, directly comparing them according to the method described above means comparing only the parts with a high degree of matching between different BVs. However, in reality, TL templates cover more adjacent areas, and in most cases textures are continuous from the left and top, so it is illogical to use T and L templates indiscriminately instead of TL templates.
[0481] One strategy is COST T or COST L COST TL This involves artificially expanding the template so that it can be compared to the previous one. This differs from the previous operation, which only mechanically removed the effect of the number of pixels, and here, adjustments are necessary because TL templates are generally at a disadvantage compared to T and L templates. For example, COST T or COST L Multiply by a coefficient greater than 1.
[0482] Another strategy is as follows: In the first step of searching for multiple intraTmp candidates (a coarse search with a fixed step size interval), a certain number of BVs are first selected based on the matching cost of the TL template, and these BVs are used as positioning points for the second step of the search (improved search). The matching status of the TL template, T template, and L template of some of these BVs is then analyzed. The COST corresponding to a certain BV T or COST L If the discrimination is significant, or COST T or COST L If the value is greater than a preset value, an improvement search can be performed using the template with the higher matching degree among the T template or L template. Conversely, the COST corresponding to a certain BV T or COST LIf the differences are not significant, we will still use TL templates to explore improvements.
[0483] On the other hand, several restrictions can be placed on the number of candidates selected based on the T template and L template within the same list. For example, an upper limit can be set on the number of candidates selected by the T template and / or L template, and once the number of candidates selected by the T template and / or L template in the list reaches this upper limit, no further candidates selected by the T template and / or L template can be added to the list.
[0484] It should be explained that in the embodiments of this application, when only one list is constructed, it is not necessary to use syntactic elements in the bitstream to indicate which template to select. However, since the template matching costs between different templates cannot be directly compared, it is necessary to establish certain rules so that they can be placed in a single list. One direct method is to sort candidates from the same template by their template matching cost, and to place candidates from different candidate templates directly into their given positions without sorting them by their template matching cost.
[0485] For illustrative purposes, in some embodiments, assuming the length of the final block vector candidate list is N, a list of length N is first constructed using a TL template, the construction method being the same as the IntraTmp multiple candidate list construction method described above. The template matching cost is calculated for each BV found according to a pre-configured search method, and the BVs are sorted based on their template matching costs, with those with smaller costs placed earlier.
[0486] The maximum number of T and L templates that can be included in the final block vector candidate list is specified as M. However, since a duplicate check operation is required when adding to the list, the final number that can be included may be less than M. In one example, N is 15 and M is 2, meaning the final list length is 15, and a maximum of 2 T template candidates and a maximum of 2 L template candidates can be included. In another example, N is 19 and M is 3, meaning the final list length is 19, and a maximum of 3 T template candidates and a maximum of 3 L template candidates can be included.
[0487] Specify the minimum index position (Pos) where the T-template and L-template can be placed, or the closest position before them. For example, Pos is calculated based on N and M, for example, Pos = N - 1 - M × 2. It is also possible to define the closest position before each of the T-template and L-template that can be placed in the list, but this will not be explained in detail here.
[0488] Based on the list of block vector candidates for the TL template, we attempt to populate the T template and L template candidates.
[0489] The process attempts to add candidate T-templates and L-templates to a block vector candidate list. A pre-configured search method can find X T-template candidates and X L-template candidates with optimal template matching costs, and these X T-template candidates and X L-template candidates can each be used to construct a temporary list of length X. The process then attempts to add these T-templates and L-template candidates to the final block vector candidate list. First, a duplicate check operation can be performed. If the same BV as the candidate to be added already exists in the list, it is not added. If the same BV as the candidate to be added does not exist in the list, the specified position and subsequent candidates in the original list are sequentially moved backward and added to the specified position in the list. Each time a candidate is added, the specified position moves backward by one place until all candidates in the M or X temporary lists have been checked.
[0490] One approach to the search process is that T-templates and L-templates can share the search process for TL-templates, and the matching costs for T-templates and L-templates can be calculated simultaneously when calculating the matching cost for TL-templates, thus not significantly increasing the complexity of the search. For example, in the same search process, lists are built for TL-templates, T-templates, and L-templates respectively, and after the search is complete, the three lists are merged into a final list of candidate block vectors.
[0491] T templates and L templates can also use different search processes than TL templates. Of course, some search processes may be shared, while others may be isolated.
[0492] In the first step of sparse search, the search process does not sequentially search for each possible BV. For example, the usual search order is left to right and top to bottom. Generally, all pixel BVs can be searched sequentially. If the currently searched BV is (x0, y0), the next is (x0+1, y0), assuming that the boundary of the search range has not been reached. However, a sparse search can be performed first. For example, in the case of all pixel BVs, if the currently searched BV is (x0, y0), the next is (x0+3, y0), assuming that the boundary of the search range has not been reached. In other words, it is also possible to perform one template matching for every certain number of pixels and one template matching for every certain step size. The step size here may be a preset value such as 2, 3, 4, or 8. Of course, the same process can also be performed in the vertical method. First, find the K BVs with the minimum TL template cost, where K may be equal to N, greater than or less than N. This process may be implemented by constructing a list. Simultaneously, find the X' BVs with the minimum cost for the T template and the X' BVs with the minimum cost for the L template, where X' may be equal to M, greater than M, or less than M. This process may be implemented by constructing a list. In other words, each BV in this search process simultaneously sorts the template matching costs of the TL template, T template, and L template; that is, the three share a sparse search process.
[0493] In the second step of the improvement search, improvements are made within a small range based on each BV, using the K BVs with the minimum cost of the TL template. For example, if the search interval is 3 pixels, the improved range may be set to 3x3, and the improved BVs may be used to construct a block vector candidate list of length N. Furthermore, improvements are made within a small range based on each BV, using the X' BVs with the minimum cost of the T template and L template. For example, if the search interval is 3 pixels, the improved range may be set to 3x3, and the improved BVs may be used to construct a temporary block vector candidate list of length X for the T template and a temporary block vector candidate list of length X for the L template. Then, the list of TL templates of length N, the list of T templates of length X, and the list of L templates of length X are combined into a final block vector candidate list according to the method described above.
[0494] In one example, N=15, K=2N, M=2, X=4, and X'=2X.
[0495] If sub-pixel precision is supported, further subdivision down to the sub-pixel BV can be performed. For example, based on the all-pixel BV selected in the second step, a search for half a pixel can be performed within a single pixel range in the upper, lower, left, or right directions.
[0496] By sharing the sparse search process, the complexity of the search is not significantly increased, and the scope of improvement for each of the TL, T, and L templates can be found in a wide-ranging sparse search. Improvement searches are more precise because they can be performed on different templates.
[0497] As can be seen from the above, in the encoding and decoding method proposed in the embodiment of the present invention, the intraTMP multiple candidates, which are realized by constructing a list of block vector candidates corresponding to the current block, can provide multiple selections, and the first template corresponding to the current block, which can contain one or more candidate templates, can provide multiple selections at the template level, and the combination of these two can improve compression efficiency and obtain better compression performance.
[0498] In other words, the encoding and decoding method proposed in the embodiment of the present invention can combine intraTMP multiple candidates and template-level multiple selections. In the process of combining the two, one implementation of the combination is to specify which template to use in the bitstream. The other implementation of the combination is to not specify which template to use in the bitstream, but to construct the same block vector candidate list using different templates.
[0499] Embodiments of the present application provide an encoding / decoding method in which an encoder / decoder determines a first template corresponding to the current block, where the first template is one or more candidate templates in a template set corresponding to the current block; determines a list of candidate block vectors corresponding to the current block based on the first template; determines a block vector corresponding to the current block based on the list of candidate block vectors corresponding to the current block; and determines a predicted value for the current block based on the block vector. As can be seen from the above, embodiments of the present application propose a prediction scheme that combines intraTMP multiple candidates and multiple templates, where it is possible to choose to determine a list of candidate block vectors containing at least one block vector for the current block; simultaneously, it is possible to choose to construct a list of candidate block vectors using a first template containing at least one candidate template; and further, a combination of intraTMP multiple candidates and multiple selections at the template level can be realized. In other words, the encoding and decoding method proposed in the embodiment of the present invention realizes intraTMP multiple candidates by constructing a list of block vector candidates corresponding to the current block, and on the other hand, provides multiple selections at the template level using a first template corresponding to the current block that includes one or more candidate templates, thereby improving compression efficiency and encoding and decoding performance.
[0500] In yet another embodiment of the present application, referring to Figure 22, a schematic structural diagram of an encoder according to an embodiment of the present application is shown. As shown in Figure 22, the encoder 180 may include a first determination unit 1801.
[0501] The first decision unit 1801 is configured to determine a first template corresponding to the current block, where the first template is one or more candidate templates in a template set corresponding to the current block, to determine a candidate list of block vectors corresponding to the current block based on the first template, to determine a block vector corresponding to the current block based on the candidate list of block vectors corresponding to the current block, and to determine a predicted value for the current block based on the block vector.
[0502] It is understandable that in the embodiments of this application, a "unit" may be a part of a circuit, a part of a processor, a part of a program or software, and may be a module or non-modular. Furthermore, each component in this embodiment may be integrated into a single processing unit, individual units may exist physically independently, or two or more units may be integrated into a single unit. The integrated unit may be implemented in hardware form or in the form of a software function module.
[0503] The integrated unit may be implemented in the form of a software function module and, if not sold or used as an independent product, may be stored on a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment may be essentially or partially contribute to the prior art, or all or part of the technical solution may be embodied in the form of a software product, which is stored on a storage medium and includes several instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) or processor to perform all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes various media capable of storing program code, such as U disks, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0504] Accordingly, embodiments of the present application provide a computer-readable storage medium applicable to an encoder 180, the computer-readable storage medium storing a computer program, and when the computer program is executed by a first processor, the method described in any one of the embodiments described above is realized.
[0505] Referring to Figure 23, based on the configuration of the encoder 180 and the computer-readable storage medium, a schematic diagram of the specific hardware structure of the encoder 180 according to an embodiment of the present application is shown. As shown in Figure 23, the encoder 180 may include a first communication interface 1901, a first memory 1902, and a first processor 1903, each component being coupled together via a first bus system 1904. It can be understood that the first bus system 1904 is used to realize connection communication between these components. In addition to the data bus, the first bus system 1904 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity in the explanation, various buses are labeled as the first bus system 1904. Here, The first communication interface 1901 is used to send and receive signals during the process of sending and receiving information with other external network elements. The first memory 1902 is used to store computer programs that can be executed on the first processor 1903. The first processor 1903 is used to perform the following when executing the computer program: determine a first template corresponding to the current block, wherein the first template is one or more candidate templates in a template set corresponding to the current block; determine a candidate list of block vectors corresponding to the current block based on the first template; determine a block vector corresponding to the current block based on the candidate list of block vectors corresponding to the current block; and determine a predicted value for the current block based on the block vector.
[0506] It can be understood that the first memory 1902 in the embodiments of the present application may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Here, the non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory may be random access memory (RAM) that functions as an external cache. By illustrative and non-restrictive description, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct Rambus random access memory (DRRAM). The first memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0507] The first processor 1903 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method may be completed by instructions in the form of hardware integrated logic circuits or software within the first processor 1903. The first processor 1903 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component. Each method, step, and logic block diagram disclosed in the embodiments of this application can be implemented or executed. The general-purpose processor may be a microprocessor, or the processor may be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of this application may be implemented and completed by a hardware decoding processor, or directly implemented and completed by a combination of hardware and software modules in the decoding processor. The software module may reside in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, or registers. The storage medium is located in the first memory 1902, and the first processor 1903 reads the information in the first memory 1902 and, in combination with its hardware, completes the steps of the method described above.
[0508] Understandably, these embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. If implemented in hardware, the processing unit may be one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described herein, or a combination thereof. If implemented in software, the technology described herein can be implemented by modules (e.g., processes, functions, etc.) that perform the functions described herein. The software code may be stored in memory and executed by a processor. The memory may be implemented internally or externally to the processor.
[0509] As an option, in another embodiment, the first processor 1903 is further configured to perform the method described in any one of the above embodiments when executing the computer program.
[0510] In yet another embodiment of the present application, referring to Figure 24, a schematic structural diagram of a decoder according to an embodiment of the present application is shown. As shown in Figure 24, the decoder 200 may include a second determination unit 2001.
[0511] The second decision unit 2001 is configured to determine a first template corresponding to the current block, where the first template is one or more candidate templates in a template set corresponding to the current block, to determine a candidate list of block vectors corresponding to the current block based on the first template, to determine a block vector corresponding to the current block based on the candidate list of block vectors corresponding to the current block, and to determine a predicted value for the current block based on the block vector.
[0512] It is understandable that in the embodiments of this application, a "unit" may be a part of a circuit, a part of a processor, a part of a program or software, and may be a module or non-modular. Furthermore, each component in this embodiment may be integrated into a single processing unit, individual units may exist physically independently, or two or more units may be integrated into a single unit. The integrated unit may be implemented in hardware form or in the form of a software function module.
[0513] The integrated unit may be implemented in the form of a software function module and, if not sold or used as an independent product, may be stored on a single computer-readable storage medium. Based on this understanding, this embodiment provides a computer-readable storage medium applicable to a decoder 200, the computer-readable storage medium storing a computer program, and when the computer program is executed by a second processor, the method described in any one of the above embodiments is implemented.
[0514] Referring to Figure 25, based on the configuration of the decoder 200 and the computer-readable storage medium, a schematic diagram of the specific hardware structure of the decoder 200 according to an embodiment of the present application is shown. As shown in Figure 25, the decoder 200 may include a second communication interface 2201, a second memory 2202, and a second processor 2203, each component being coupled together via a second bus system 2204. It can be understood that the second bus system 2204 is used to realize connection communication between these components. In addition to the data bus, the second bus system 2204 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity in the explanation, various buses are labeled as the second bus system 2204. Here, The second communication interface 2201 is used to send and receive signals during the process of sending and receiving information with other external network elements. The second memory 2202 is used to store computer programs that can be executed on the second processor 2203. The second processor 2203 is used to perform the following when executing the computer program: determine a first template corresponding to the current block, wherein the first template is one or more candidate templates in a template set corresponding to the current block; determine a candidate list of block vectors corresponding to the current block based on the first template; determine a block vector corresponding to the current block based on the candidate list of block vectors corresponding to the current block; and determine a predicted value for the current block based on the block vector.
[0515] As an option, in another embodiment, the second processor 2203 is further configured to perform the method described in any one of the above embodiments when executing the computer program.
[0516] It is understandable that the hardware functions of the second memory 2202 and the first memory 1902 are the same, and the hardware functions of the second processor 2203 and the first processor 1903 are also the same, and will not be described in detail here.
[0517] This embodiment provides an encoder / decoder which determines a first template corresponding to the current block, where the first template is one or more candidate templates in a template set corresponding to the current block, determines a list of candidate block vectors corresponding to the current block based on the first template, determines a block vector corresponding to the current block based on the list of candidate block vectors corresponding to the current block, and determines a predicted value for the current block based on the block vector. As can be seen from the above, the embodiment of this application proposes a prediction scheme that combines multiple intraTMP candidates and multiple templates, where it is possible to choose to determine a list of candidate block vectors that include at least one block vector of the current block, and at the same time, it is possible to choose to construct a list of candidate block vectors using a first template that includes at least one candidate template, and furthermore, it is possible to realize a combination of multiple intraTMP candidates and multiple selections at the template level. In other words, the encoding and decoding method proposed in the embodiment of this application realizes multiple intraTMP candidates by constructing a list of candidate block vectors corresponding to the current block, on the one hand, and provides multiple selections at the template level using a first template corresponding to the current block that includes one or more candidate templates, thereby improving compression efficiency and encoding and decoding performance.
[0518] In yet another embodiment of the present application, with reference to Figure 26, a schematic structural diagram of an encoding and decoding system according to an embodiment of the present application is shown. As shown in Figure 26, the encoding and decoding system 230 may include an encoder 2301 and a decoder 2302.
[0519] In the embodiments of the present application, encoder 2301 may be an encoder described in any of the embodiments described above. Decoder 2302 may be an encoder described in any of the embodiments described above.
[0520] Furthermore, embodiments of the present application further provide a bitstream, which is generated by bit encoding based on information to be encoded, wherein the information to be encoded includes at least one of template matching prediction identification information, first template instruction information, second template instruction information, third template instruction information, index identification information, and prediction difference value.
[0521] This specification should be made clear that the terms “includes,” “equipped with,” or any variation thereof are intended to cover non-exclusive inclusion, thereby including not only those elements but also other elements not explicitly listed, or elements specific to such process, method, article, or apparatus. Unless otherwise specified, an element limited by the phrase “includes one…” does not preclude the existence of other identical elements in a process, method, article, or apparatus that includes that element.
[0522] The serial numbers of the embodiments described above are for illustrative purposes only and do not indicate any superiority or inferiority among the embodiments.
[0523] The methods disclosed in some of the method embodiments provided in this application can be arbitrarily combined, provided they do not conflict, to obtain new method embodiments.
[0524] The features disclosed in some of the product embodiments provided in this application can be arbitrarily combined, provided they do not contradict each other, to obtain new product embodiments.
[0525] The features disclosed in some of the method or apparatus embodiments provided in this application can be arbitrarily combined, provided they do not conflict, to obtain new method or apparatus embodiments.
[0526] The above descriptions are merely specific embodiments of the present application, and the scope of protection of this application is not limited thereto. Any modification or substitution that any person skilled in the art could easily conceive within the technical scope disclosed herein should be included within the scope of protection of this application. Accordingly, the scope of protection of this application should be subject to the scope of protection of the claims. [Industrial applicability]
[0527] Embodiments of the present application provide an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium, wherein the encoder / decoder determines a first template corresponding to the current block, where the first template is one or more candidate templates in a template set corresponding to the current block, determines a list of candidate block vectors corresponding to the current block based on the first template, determines a block vector corresponding to the current block based on the list of candidate block vectors corresponding to the current block, and determines a predicted value for the current block based on the block vector. As can be seen from the above, embodiments of the present application propose a prediction scheme that combines multiple candidates and multiple templates of IntraTMP, where it is possible to choose to determine a list of candidate block vectors that include at least one block vector of the current block, and at the same time, it is possible to choose to construct a list of candidate block vectors using a first template that includes at least one candidate template, and furthermore, a combination of multiple candidates and multiple selections at the template level of IntraTMP can be realized. In other words, the encoding and decoding method proposed in the embodiment of the present invention realizes multiple candidates for intraTMP by constructing a list of candidate block vectors corresponding to the current block, and on the other hand, provides multiple selections at the template level using a first template corresponding to the current block that includes one or more candidate templates, thereby improving compression efficiency and encoding and decoding performance.
Claims
1. A decoding method applicable to a decoder, Determining a first template corresponding to the current block, wherein the first template is one or more candidate templates within the template set corresponding to the current block, Determining a list of candidate block vectors corresponding to the current block based on the first template, A decoding method comprising: determining a block vector corresponding to the current block based on a list of candidate block vectors corresponding to the current block; and determining a predicted value of the current block based on the block vector.
2. The decoding method further, Decode the bitstream and determine the template matching predictive identification information corresponding to the current block, If the value of the template matching prediction identification information is a first value, the process of determining the first template is performed, including: The decoding method according to claim 1.
3. Determining the first template corresponding to the current block is: Decode the bitstream and determine the first template instruction information corresponding to the current block, If the value of the first template instruction information is a third value, the first template is determined to be a first candidate template, and this includes: The decoding method according to claim 2.
4. Determining the first template corresponding to the current block is: If the value of the first template instruction information is the fourth value, the bitstream is decoded and the second template instruction information corresponding to the current block is determined. If the value of the second template instruction information is the fifth value, it is determined that the first template is the second candidate template, If the value of the second template instruction information is the sixth value, the first template is determined to be the third candidate template, and this includes: The decoding method according to claim 3.
5. Determining the first template corresponding to the current block is: Decrypting the bitstream and determining the third template instruction information corresponding to the current block, If the value of the third template instruction information is the seventh value, it is determined that the first template is the first candidate template, If the value of the third template instruction information is the eighth value, it is determined that the first template is the second candidate template, If the value of the third template instruction information is the ninth value, the first template is determined to be the third candidate template, and this includes: The decoding method according to claim 2.
6. Determining the first template corresponding to the current block is: Decode the bitstream and determine the candidate index corresponding to the current block, The process includes determining that the first template is the first candidate template if the value of the candidate index is less than or equal to a preset threshold, The decoding method according to claim 2.
7. The decoding method further, If the value of the candidate index is greater than the preset threshold, the bitstream is decoded and the third template instruction information corresponding to the current block is determined. If the value of the third template instruction information is the seventh value, it is determined that the first template is the first candidate template, If the value of the third template instruction information is the eighth value, it is determined that the first template is the second candidate template, If the value of the third template instruction information is the ninth value, the first template is determined to be the third candidate template, and this includes: The decoding method according to claim 6.
8. The first candidate template is a template that includes a left-side adjacent reconstruction sample and an upper-side adjacent reconstruction sample of the current block, The second candidate template is a template that includes an upper adjacent reconstruction sample of the current block, The third candidate template is a template that includes a left-side adjacent reconstruction sample of the current block. The decoding method according to any one of claims 4, 5, or 7.
9. The decoding method further, The process includes determining search parameters corresponding to the first template based on the first template, wherein the search parameters include at least one of the search range, search order, and list length. The decoding method according to claim 4.
10. Determining a list of candidate block vectors corresponding to the current block based on the first template is: The process includes performing a search based on the search parameters and the first template, and determining the list of candidate block vectors. The decoding method according to claim 9.
11. Determining a list of candidate block vectors corresponding to the current block based on the first template is: Determining a pre-configured search area corresponding to the first template, The process involves scanning for search points within the pre-defined search area and determining the matching cost between the matching template corresponding to the search point within the pre-defined search area and the first template based on pre-defined matching criteria. The process includes determining the list of candidate block vectors based on the matching cost, The decoding method according to claim 2 or 9.
12. Determining the block vector candidate list based on the matching cost is: The process involves determining N minimum matching costs from among the matching costs between the matching template corresponding to a search point in the pre-defined search area and the first template, where N is the list length of the block vector candidate list and N is an integer greater than 0. The process includes determining the block vector candidate list based on the N block vectors corresponding to the N minimum matching costs and the N candidate templates, The decoding method according to claim 11.
13. The aforementioned pre-set matching criteria include one of the following: Sum of Absolute Errors (SAD), Sum of Transformed Absolute Errors (SATD), Sum of Squared Errors (SSE), Mean Absolute Deviation (MAD), Mean Absolute Error (MAE), Mean Squared Error (MSE), or Normalized Correlation Coefficient (NCC). The decoding method according to claim 11.
14. The decoding method further, The process involves scanning the search points within the pre-defined search area according to the first search step size, determining an initial block vector, and determining an initial matching template corresponding to the initial block vector. The first search area is determined based on the initial matching template, wherein the first search area is smaller than the pre-set search area. The process involves scanning the search points within the first search region according to a second search step size to determine the block vector candidate list, wherein the first search step size is greater than the second search step size. The decoding method according to claim 11.
15. The decoding method further, If the first template includes multiple candidate templates in the template set, the process includes determining the template coefficient corresponding to each candidate template. The decoding method according to claim 14.
16. Determining the template coefficients corresponding to each of the aforementioned candidate templates is: This includes determining the template coefficient based on the size parameter corresponding to the candidate template, The decoding method according to claim 15.
17. Determining the template coefficients corresponding to each of the aforementioned candidate templates is: This includes determining the template coefficients based on the pixel parameters corresponding to the candidate template, The decoding method according to claim 15.
18. The template coefficients corresponding to the candidate templates are set according to pre-set values. The decoding method according to claim 15.
19. The decoding method further, The process involves scanning for search points within the pre-defined search area and determining the initial cost between the matching template corresponding to the search point within the pre-defined search area and the first template based on pre-defined matching criteria. The initial cost is adjusted based on the template coefficient, and the matching cost between the matching template corresponding to the search point in the preset search area and the first template is determined. The process includes determining the list of candidate block vectors based on the matching cost, The decoding method according to any one of claims 16 to 18.
20. The decoding method further, The process involves scanning for search points within the pre-defined search area and determining the initial cost between the matching template corresponding to the search point within the pre-defined search area and the first template based on pre-defined matching criteria. The initial cost is adjusted based on the pixel parameters corresponding to the candidate template, and the matching cost between the matching template corresponding to the search point in the preset search area and the first template is determined. The process includes determining the list of candidate block vectors based on the matching cost, The decoding method according to claim 15.
21. The decoding method further, This includes determining an upper threshold corresponding to each candidate template, and determining the number of block vectors in the block vector candidate list that correspond to the candidate template based on the upper threshold. The decoding method according to claim 15.
22. If the first template includes at least the first candidate template, the second candidate template, and the third candidate template, the decoding method further: Based on the first candidate template, a second search region is determined, the search points within the second search region are scanned according to the first search step size, and an initial block vector is determined. The process includes determining a third search region based on the initial block vector and the first template, scanning the search points within the third search region according to the second search step size, and determining the block vector candidate list, wherein the first search step size is larger than the second search step size. The decoding method according to claim 8.
23. If the first template includes at least the first candidate template, the second candidate template, and the third candidate template, the decoding method further: The process involves performing a search based on the first candidate template and determining the first list corresponding to the first candidate template, The search is performed based on the second candidate template, and a second list corresponding to the second candidate template is determined. The search is performed based on the aforementioned third candidate template, and the third list corresponding to the aforementioned third candidate template is determined. This includes adjusting the first list based on the second and third lists and determining the block vector candidate list, The decoding method according to claim 8.
24. If the first template includes at least the first candidate template, the second candidate template, and the third candidate template, the decoding method further: A search is performed based on the first candidate template, the second candidate template, and the third candidate template, and a first list corresponding to the first candidate template, a second list corresponding to the second candidate template, and a third list corresponding to the third candidate template are determined, This includes adjusting the first list based on the second and third lists and determining the block vector candidate list, The decoding method according to claim 8.
25. Adjusting the first list based on the second and third lists and determining the block vector candidate list is: To determine a first starting position corresponding to the second list and a second starting position corresponding to the third list, This includes adding block vectors from the second list to the first list according to the first starting position, and simultaneously adding block vectors from the third list to the first list according to the second starting position, and obtaining the block vector candidate list. The decoding method according to claim 23 or 24.
26. The decoding method further, Adding a block vector in the second list that is not present in the first list to the first starting position in the first list, This includes adding a block vector in the third list that is not present in the first list to the second starting position in the first list, The decoding method according to claim 25.
27. The decoding method further, If the value of the template matching prediction identification information is the first value, the bitstream is decoded and the index identification information corresponding to the current block is determined. This includes determining a candidate index corresponding to the current block based on the index identification information, The decoding method according to claim 3.
28. Determining the block vector corresponding to the current block based on the candidate list of block vectors corresponding to the current block means that The process includes determining a block vector corresponding to the current block from the block vector candidate list based on the candidate index, The decoding method according to claim 27.
29. The decoding method further, If the value of the first template instruction information is a third value, the index identification information is determined based on the first context, If the value of the first template instruction information is a fourth value, the index identification information is determined based on the second context, including The decoding method according to claim 27.
30. Determining a candidate index corresponding to the current block based on the aforementioned index identification information means that If the value of the first template instruction information is a third value, the candidate index is determined based on the index identification information and the first inverse binarization strategy, If the value of the first template instruction information is a fourth value, the candidate index is determined based on the index identification information and the second inverse binarization strategy, The decoding method according to claim 27.
31. The decoding method further, Decode the bitstream and determine the predicted difference value corresponding to the current block, This includes determining the reconstruction value of the current block based on the predicted difference value and the predicted value, The decoding method according to claim 1.
32. The decoding method further, This includes constructing the template set corresponding to the current block based on different template types, The decoding method according to claim 1.
33. An encoding method applied to an encoder, Determining a first template corresponding to the current block, wherein the first template is one or more candidate templates within the template set corresponding to the current block, Determining a list of candidate block vectors corresponding to the current block based on the first template, An encoding method comprising: determining a block vector corresponding to the current block based on a list of block vector candidates corresponding to the current block; and determining a predicted value for the current block based on the block vector.
34. The aforementioned encoding method further, Determining template matching predictive identification information corresponding to the current block, If the value of the template matching prediction identification information is a first value, the process of determining the first template is performed, including: The encoding method according to claim 33.
35. Determining the first template corresponding to the current block is: To determine the first template instruction information corresponding to the current block, If the value of the first template instruction information is a third value, the first template is determined to be a first candidate template, and this includes: The encoding method according to claim 34.
36. Determining the first template corresponding to the current block is: If the value of the first template instruction information is the fourth value, the second template instruction information corresponding to the current block is determined, If the value of the second template instruction information is the fifth value, it is determined that the first template is the second candidate template, If the value of the second template instruction information is the sixth value, the first template is determined to be the third candidate template, and this includes: The encoding method according to claim 35.
37. Determining the first template corresponding to the current block is: To determine the third template instruction information corresponding to the current block, If the value of the third template instruction information is the seventh value, it is determined that the first template is the first candidate template, If the value of the third template instruction information is the eighth value, it is determined that the first template is the second candidate template, If the value of the third template instruction information is the ninth value, the first template is determined to be the third candidate template, and this includes: The encoding method according to claim 34.
38. Determining the first template corresponding to the current block is: Determining a candidate index corresponding to the current block, The process includes determining that the first template is the first candidate template if the value of the candidate index is less than or equal to a preset threshold, The encoding method according to claim 34.
39. The aforementioned encoding method further, If the value of the candidate index is greater than the preset threshold, the third template instruction information corresponding to the current block is determined. If the value of the third template instruction information is the seventh value, it is determined that the first template is the first candidate template, If the value of the third template instruction information is the eighth value, it is determined that the first template is the second candidate template, If the value of the third template instruction information is the ninth value, the first template is determined to be the third candidate template, and this includes: The encoding method according to claim 38.
40. The first candidate template is a template that includes a left-side adjacent reconstruction sample and an upper-side adjacent reconstruction sample of the current block, The second candidate template is a template that includes an upper adjacent reconstruction sample of the current block, The third candidate template is a template that includes a left-side adjacent reconstruction sample of the current block. The encoding method according to any one of claims 36, 37, or 39.
41. The aforementioned encoding method further, The process includes determining search parameters corresponding to the first template based on the first template, wherein the search parameters include at least one of the search range, search order, and list length. The encoding method according to claim 36.
42. Determining a list of candidate block vectors corresponding to the current block based on the first template is: The process includes performing a search based on the search parameters and the first template, and determining the list of candidate block vectors. The encoding method according to claim 41.
43. Determining a list of candidate block vectors corresponding to the current block based on the first template is: Determining a pre-configured search area corresponding to the first template, The process involves scanning for search points within the pre-defined search area and determining the matching cost between the matching template corresponding to the search point within the pre-defined search area and the first template based on pre-defined matching criteria. The process includes determining the list of candidate block vectors based on the matching cost, The encoding method according to claim 34 or 41.
44. Determining the block vector candidate list based on the matching cost is: The process involves determining N minimum matching costs from among the matching costs between the matching template corresponding to a search point in the pre-defined search area and the first template, where N is the list length of the block vector candidate list and N is an integer greater than 0. The process includes determining the block vector candidate list based on the N block vectors corresponding to the N minimum matching costs and the N candidate templates, The encoding method according to claim 43.
45. The aforementioned pre-set matching criteria include one of the following: Sum of Absolute Errors (SAD), Sum of Transformed Absolute Errors (SATD), Sum of Squared Errors (SSE), Mean Absolute Deviation (MAD), Mean Absolute Error (MAE), Mean Squared Error (MSE), or Normalized Correlation Coefficient (NCC). The encoding method according to claim 43.
46. The aforementioned encoding method further, The process involves scanning the search points within the pre-defined search area according to the first search step size, determining an initial block vector, and determining an initial matching template corresponding to the initial block vector. The first search area is determined based on the initial matching template, wherein the first search area is smaller than the pre-set search area. The process involves scanning the search points within the first search region according to a second search step size to determine the block vector candidate list, wherein the first search step size is greater than the second search step size. The encoding method according to claim 43.
47. The aforementioned encoding method further, If the first template includes multiple candidate templates in the template set, the process includes determining the template coefficient corresponding to each candidate template. The encoding method according to claim 46.
48. Determining the template coefficients corresponding to each of the aforementioned candidate templates is: This includes determining the template coefficient based on the size parameter corresponding to the candidate template, The encoding method according to claim 47.
49. Determining the template coefficients corresponding to each of the aforementioned candidate templates is: This includes determining the template coefficients based on the pixel parameters corresponding to the candidate template, The encoding method according to claim 47.
50. The template coefficients corresponding to the candidate templates are set according to pre-set values. The encoding method according to claim 47.
51. The aforementioned encoding method further, The process involves scanning for search points within the pre-defined search area and determining the initial cost between the matching template corresponding to the search point within the pre-defined search area and the first template based on pre-defined matching criteria. The initial cost is adjusted based on the template coefficient, and the matching cost between the matching template corresponding to the search point in the preset search area and the first template is determined. The process includes determining the list of candidate block vectors based on the matching cost, The encoding method according to any one of claims 48 to 50.
52. The aforementioned encoding method further, The process involves scanning for search points within the pre-defined search area and determining the initial cost between the matching template corresponding to the search point within the pre-defined search area and the first template based on pre-defined matching criteria. The initial cost is adjusted based on the pixel parameters corresponding to the candidate template, and the matching cost between the matching template corresponding to the search point in the preset search area and the first template is determined. The process includes determining the list of candidate block vectors based on the matching cost, The encoding method according to claim 47.
53. The aforementioned encoding method further, This includes determining an upper threshold corresponding to each candidate template, and determining the number of block vectors in the block vector candidate list that correspond to the candidate template based on the upper threshold. The encoding method according to claim 47.
54. If the first template includes at least the first candidate template, the second candidate template, and the third candidate template, the encoding method further: Based on the first candidate template, a second search region is determined, the search points within the second search region are scanned according to the first search step size, and an initial block vector is determined. The process includes determining a third search region based on the initial block vector and the first template, scanning the search points within the third search region according to the second search step size, and determining the block vector candidate list, wherein the first search step size is larger than the second search step size. The encoding method according to claim 40.
55. If the first template includes at least the first candidate template, the second candidate template, and the third candidate template, the encoding method further: The process involves performing a search based on the first candidate template and determining the first list corresponding to the first candidate template, The search is performed based on the second candidate template, and a second list corresponding to the second candidate template is determined. The search is performed based on the aforementioned third candidate template, and the third list corresponding to the aforementioned third candidate template is determined. This includes adjusting the first list based on the second and third lists and determining the block vector candidate list, The encoding method according to claim 40.
56. If the first template includes at least the first candidate template, the second candidate template, and the third candidate template, the encoding method further: A search is performed based on the first candidate template, the second candidate template, and the third candidate template, and a first list corresponding to the first candidate template, a second list corresponding to the second candidate template, and a third list corresponding to the third candidate template are determined, This includes adjusting the first list based on the second and third lists and determining the block vector candidate list, The encoding method according to claim 40.
57. Adjusting the first list based on the second and third lists and determining the block vector candidate list is: To determine a first starting position corresponding to the second list and a second starting position corresponding to the third list, This includes adding block vectors from the second list to the first list according to the first starting position, and simultaneously adding block vectors from the third list to the first list according to the second starting position, and obtaining the block vector candidate list. The encoding method according to claim 55 or 56.
58. The aforementioned encoding method further, Adding a block vector in the second list that is not present in the first list to the first starting position in the first list, This includes adding a block vector in the third list that is not present in the first list to the second starting position in the first list, The encoding method according to claim 57.
59. The aforementioned encoding method further, If the value of the template matching prediction identification information is the first value, the index identification information corresponding to the current block is determined, This includes determining a candidate index corresponding to the current block based on the index identification information, The encoding method according to claim 35.
60. Determining the block vector corresponding to the current block based on the candidate list of block vectors corresponding to the current block means that The process includes determining a block vector corresponding to the current block from the block vector candidate list based on the candidate index, The encoding method according to claim 59.
61. The aforementioned encoding method further, If the value of the first template instruction information is a third value, the index identification information is determined based on the first context, If the value of the first template instruction information is a fourth value, the index identification information is determined based on the second context, including The encoding method according to claim 59.
62. Determining a candidate index corresponding to the current block based on the aforementioned index identification information means that If the value of the first template instruction information is a third value, the candidate index is determined based on the index identification information and the first binarization strategy, If the value of the first template instruction information is a fourth value, the candidate index is determined based on the index identification information and the second binarization strategy, The encoding method according to claim 59.
63. The aforementioned encoding method further, Determining the predicted difference value corresponding to the current block, This includes determining the reconstruction value of the current block based on the predicted difference value and the predicted value, The encoding method according to claim 33.
64. The aforementioned encoding method further, This includes constructing the template set corresponding to the current block based on different template types, The encoding method according to claim 33.
65. A bitstream, wherein the bitstream is generated by bit encoding based on the information to be encoded, and the information to be encoded is A bitstream containing at least one of the following: template matching prediction identification information, first template instruction information, second template instruction information, third template instruction information, index identification information, and prediction difference value.
66. An encoder, including a first determination unit, An encoder configured such that the first decision unit determines a first template corresponding to the current block, the first template being one or more candidate templates in a template set corresponding to the current block, determines a list of candidate block vectors corresponding to the current block based on the first template, determines a block vector corresponding to the current block based on the list of candidate block vectors corresponding to the current block, and determines a predicted value for the current block based on the block vector.
67. An encoder comprising a first memory and a first processor, The first memory is used to store computer programs that can be executed on the first processor. The first processor is an encoder used to perform the method according to any one of claims 33 to 64 when executing the computer program.
68. A decoder, including a second decision unit, The decoder is configured to determine a first template corresponding to the current block, the first template being one or more candidate templates in a template set corresponding to the current block, determine a candidate list of block vectors corresponding to the current block based on the first template, determine a block vector corresponding to the current block based on the candidate list of block vectors corresponding to the current block, and determine a predicted value for the current block based on the block vector.
69. A decoder comprising a second memory and a second processor, The second memory is used to store computer programs that can be executed on the second processor. The second processor is a decoder used to perform the method according to any one of claims 1 to 32 when executing the computer program.
70. A computer-readable storage medium storing a computer program that, when executed, implements the method described in any one of claims 1 to 32, or the method described in any one of claims 33 to 64.