Codec method, bitstream, encoder, decoder and storage medium
By filtering and refining the correlation between templates in video codec technologies, the method addresses low prediction accuracy issues, enhancing codec performance and efficiency.
Patent Information
- Application Number
- JP2025542129
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-01-20
- Publication Date
- 2026-01-29
AI Technical Summary
Existing video codec technologies suffer from low prediction accuracy due to incomplete consideration in template matching, leading to deviations in reconstructed pixel usage for prediction blocks.
Implement a method that determines a first template for a current block, identifies a matching template and a reference block, applies model parameters to filter the reference block, and uses the filtered reference block for prediction, thereby improving prediction accuracy and codec efficiency.
The method enhances prediction accuracy and codec performance by refining the correlation between templates, reducing bitrate, and improving overall codec efficiency.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
[Technical Field]
[0001] The present application relates to the field of video codec technology, and in particular to codec methods, bitstreams, encoders, decoders and storage media. [Background technology]
[0002] The template matching (TM) prediction technology searches for a matching template with the smallest cost within a predefined search range according to a predetermined cost function using a template of a coding block, and determines the optimal matching reconstruction block corresponding to the matching template as the prediction block of the current coding block.
[0003] However, in the actual encoding process, related technologies usually directly use the reconstructed pixels of the best matching reconstructed block as the predicted pixels of the current coding block, but due to incomplete consideration, there will be a relatively large deviation in some scenarios, resulting in low prediction accuracy. Summary of the Invention
[0004] The present application provides a codec method, a bitstream, an encoder, a decoder and a storage medium that can improve the accuracy of frame prediction and thus improve the codec performance.
[0005] The technical solution of the present application can be realized as follows:
[0006] In a first aspect, embodiments of the present application provide a decoding method applied to a decoder, the method comprising: determining a first template for the current block and determining a matching template and a reference block; determining model parameters based on the first template and the matching template; performing a filtering process on the reference block based on the model parameters to determine a filtered reference block; determining a prediction of the current block based on the filtered reference block; and determining a reconstructed value for the current block based on the predicted value for the current block.
[0007] In a second aspect, embodiments of the present application provide an encoding method applied to an encoder, the method comprising: determining a first template for the current block and determining a matching template and a reference block; determining model parameters based on the first template and the matching template; performing a filtering process on the reference block based on the model parameters to determine a filtered reference block; determining a prediction of the current block based on the filtered reference block; and determining a prediction residual value for the current block based on the prediction value for the current block.
[0008] In a third aspect, an embodiment of the present application provides a bitstream generated by bit encoding based on encoding target information, the encoding target information being: The syntax element identification information includes at least one of a prediction residual value of a current block, the number of coefficients of a target filter, the shape of the target filter, a value of a first syntax element identification information, a value of a second syntax element identification information, and a value of a third syntax element identification information, wherein the first syntax element identification information is used to indicate whether intra template matching is applied to the current block, the second syntax element identification information is used to indicate whether a filter model is applied to the current block, and the third syntax element identification information is used to indicate a reference block of the current block.
[0009] In a fourth aspect, an embodiment of the present application provides an encoder comprising a first determining unit, a first filtering unit, and a first predicting unit; the first determining unit is configured to determine a first template of the current block, determine a matching template and a reference block, and further configured to determine model parameters based on the first template and the matching template; the first filtering unit is configured to perform a filtering operation on the reference block based on the model parameters to determine a filtered reference block; The first prediction unit is configured to determine a prediction value of the current block based on the filtered reference block; The first determining unit is further configured to determine, based on the predicted value of the current block, a prediction residual value of the current block.
[0010] In a fifth aspect, embodiments of the present application provide an encoder comprising a first memory and a first processor; the first memory is adapted to store a computer program executable on the first processor; The first processor, when executing the computer program, is used to carry out the method according to the second aspect.
[0011] In a sixth aspect, an embodiment of the present application provides a decoder comprising a second determining unit, a second filtering unit, and a second predicting unit; the second determining unit is configured to determine a first template of the current block, determine a matching template and a reference block, and further configured to determine model parameters according to the first template and the matching template; the second filtering unit is configured to perform a filtering operation on the reference block based on the model parameters to determine a filtered reference block; The second prediction unit is configured to determine a prediction value of the current block based on the filtered reference block; The second determining unit is further arranged to determine a reconstructed value of the current block based on the predicted value of the current block.
[0012] In a seventh aspect, embodiments of the present application provide a decoder comprising a second memory and a second processor; the second memory is used to store a computer program executable on the second processor; The second processor, when executing the computer program, is used to carry out the method according to the first aspect.
[0013] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, the computer program being configured to, when executed, implement the method according to the first aspect or to implement the method according to the second aspect.
[0014] The embodiments of the present application provide a codec method, a bitstream, an encoder, a decoder, and a storage medium, in which both the encoding side and the decoding side determine a first template for a current block, determine a matching template and a reference block, determine model parameters based on the first template and the matching template, perform a filtering process on the reference block based on the model parameters, determine a filtered reference block, and determine a predicted value of the current block based on the filtered reference block. This allows the encoding side to determine a prediction residual value of the current block based on the predicted value of the current block, and the decoding side to determine a reconstructed value of the current block based on the predicted value of the current block. That is, the model parameters are determined based on the first template and the matching template, and the model parameters fully reflect the correlation between the matching template and the first template of the current block. This correlation is applied to the reference block, and the reconstructed pixels are filtered and corrected. The filtered reconstructed pixels are then used as the predicted pixels of the current block, thereby improving prediction accuracy, saving bitrate, improving codec efficiency, and ultimately improving codec performance. [Brief explanation of the drawings]
[0015] [Figure 1A] FIG. 1 is a schematic diagram of the prediction process of the Inter TM technology. [Figure 1B] FIG. 1 is a schematic diagram of the prediction process of the Intra TM technology. [Figure 1C] FIG. 1 is a schematic diagram of the prediction process of another Intra TM technique. [Figure 2] FIG. 1 is a schematic diagram of a prediction process based on TM technology. [Figure 3] 1 is a schematic diagram of a template type of TM technology. [Figure 4A] FIG. 1 is a schematic block diagram of an encoder according to an embodiment of the present application; [Figure 4B] FIG. 2 is a schematic diagram of a decoder configuration block diagram according to an embodiment of the present application; [Figure 5] 1 is a schematic diagram of a network architecture of a codec system according to an embodiment of the present application; [Figure 6] 1 is a schematic diagram of a flowchart of a decoding method according to an embodiment of the present application; [Figure 7] 1A-1C are schematic diagrams of different sub-region divisions of a search region according to an embodiment of the present application; [Figure 8A] FIG. 1 is a schematic diagram of a prediction process based on TM-FLM technology according to an embodiment of the present application. [Figure 8B] 2 is a schematic diagram of the location of the source of spatial domain adjacent coding units according to an embodiment of the present application; [Figure 9] 1 is a schematic diagram of a search process based on TM technology according to an embodiment of the present application; [Figure 10] 1 is a schematic diagram of parameter definitions of a current block and its template according to an embodiment of the present application; [Figure 11] FIG. 1 is a schematic diagram of a template search area according to an embodiment of the present application; [Figure 12] FIG. 1 is a schematic diagram of a process for determining a specific search area according to an embodiment of the present application. [Figure 13] FIG. 2 is a schematic diagram of a flow chart of a search process according to an embodiment of the present application; [Figure 14] 1 is a schematic diagram of a filter geometry according to an embodiment of the present application; [Figure 15] FIG. 1 is a schematic diagram of a process for calculating filter coefficients according to an embodiment of the present application; [Figure 16A] FIG. 1 is a schematic diagram of a boundary fill region according to an embodiment of the present application. [Figure 16B] FIG. 10 is a schematic diagram of another boundary fill region according to an embodiment of the present application. [Figure 17] 10 is a schematic diagram of a boundary fill region of another template type according to another embodiment of the present application. FIG. [Figure 18A] FIG. 2 is a schematic diagram of a configuration of filter coefficients according to an embodiment of the present application; [Figure 18B] FIG. 2 is a schematic diagram of a prediction pixel configuration according to an embodiment of the present application; [Figure 19A]1 is a schematic diagram 1 of a process for determining a specific search area according to an embodiment of the present application. [Figure 19B] 2 is a schematic diagram 2 of the process of determining a specific search area according to an embodiment of the present application. [Figure 19C] 3 is a schematic diagram 3 of a process for determining a specific search area according to an embodiment of the present application. [Figure 19D] 4 is a schematic diagram 4 of a process for determining a specific search area according to an embodiment of the present application. [Figure 19E] 5 is a schematic diagram 5 of a process for determining a specific search area according to an embodiment of the present application. [Figure 19F] 6 is a schematic diagram 6 of a process for determining a specific search area according to an embodiment of the present application. [Figure 19G] 7 is a schematic diagram 7 of a process for determining a specific search area according to an embodiment of the present application. [Figure 19H] 8 is a schematic diagram of a process for determining a specific search area according to an embodiment of the present application. [Figure 20] 1 is a schematic diagram of a process of an encoding method according to an embodiment of the present application; [Figure 21] 1 is a schematic diagram illustrating the configuration of each part of an encoder according to an embodiment of the present application. [Figure 22] FIG. 2 is a schematic diagram of a specific hardware structure of an encoder according to an embodiment of the present application; [Figure 23] 2 is a schematic diagram of the configuration of each part of a decoder according to an embodiment of the present application; FIG. [Figure 24] 2 is a schematic diagram of a specific hardware structure of a decoder according to an embodiment of the present application; [Figure 25] 1 is a schematic diagram illustrating the configuration of each part of a codec system according to an embodiment of the present application. DETAILED DESCRIPTION OF THE INVENTION
[0016] In order to provide a more detailed understanding of the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application will be described in detail below with reference to the accompanying drawings, which are for reference purposes only and are not intended to limit the embodiments of the present application.
[0017] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to be limiting of this application.
[0018] In the following description, "some embodiments" describe a subset of all possible embodiments; however, it is understood that "some embodiments" may refer to the same subset of all possible embodiments, different subsets, or combinations of embodiments without inconsistency. It should also be noted that the terms "first, second, third" and "third" used in the present application are used only to distinguish between similar objects and do not represent a particular order of objects. It is understood that "first, second, third" can be interchanged, where permitted, to replace any particular order or sequence, and that the present application described herein can be implemented in an order other than that illustrated or described herein.
[0019] Before describing the embodiments of the present application in more detail, the nouns and terms used in the embodiments of the present application will be explained. The nouns and terms used in the embodiments of the present application are interpreted as follows. Coding Block (CB); Block Matching (BM); Coding Unit (CU); Block Vector (BV); Motion Vector (MV); Sum of Absolute Difference (SAD); Sum of Absolute Transformed Difference (SATD); Mean Square Error (MSE); Sum of Squared Differences (SSD); Mean Absolute Deviation (MAD); Mean Square Differences (MSD); Normalized Correlation Coefficient (NCC); H.266 / Versatile Video Coding (VVC); VVC Reference Software Test Platform (VVC Test Model, VTM); Template Matching (TM); Intra Template Matching Prediction (Intra TMP): Intra block copy (IBC); Beyond VVC's reference software testing platform (Enhanced Compression Model, ECM).
[0020] It can be understood that in a video image, a first color component, a second color component, and a third color component are generally used to characterize a coding block, where these three color components are a luma component, a blue chrominance component, and a red chrominance component, respectively, and specifically, the luma component is usually represented by the symbol Y, the blue chrominance component is usually represented by the symbol Cb or U, and the red chrominance component is usually represented by the symbol Cr or V. Thus, the video image may be represented in either a YCbCr format or a YUV format.
[0021] Template matching (TM) prediction technology is a motion vector (MV) or block vector (BV) refinement technology, in which both the encoder and decoder search for a matching template (T_BEST) with the smallest cost within a predefined range around the initial MV / BV via a coding block template (T) according to a predetermined cost function, where the offset of the best matching template relative to the current coding block template is the best motion vector (MV_BEST) in inter and the best block vector (BV_BEST) in intra. The reconstructed block (Ref Block) pointed to by the best motion vector / block vector is then set as the predicted block of the current coding block (Cur Block). That is, the reference block pointed to by the MV and the current coding block are in different frames, while the reference block pointed to by the BV and the current coding block are in the same frame.
[0022] Although MV belongs to the inter-prediction coding technology and IBC belongs to the intra-prediction coding technology, the details of these TM-based vector refinement techniques are very similar.
[0023] Intra TMP is a special intra prediction mode in which both the encoder and decoder search for a matching template (T_BEST) with the smallest cost within a predefined search range in the current image via a coding block template (T) according to a predetermined cost function. The offset of the best matching template relative to the current coding block template is the best block vector (BEST Block Vector, BV_BEST). The reconstructed block (Ref Block) corresponding to the matching template is then used as the predicted block for the current coding block (Cur Block). The coding block template is typically selected and used in a neighboring reconstruction area of the current coding block. Intra TMP is very similar to IBC, but differs in that the initial BV of Intra TMP can be considered 0, and BV acquisition based on TM is the only source of the BV.
[0024] Illustratively, taking the adjacent reconstruction area of the current block (current block) as an example, when the reference block and the current coding block are in different frames, the positions of the reference block and the matching block are as shown in Figure 1A, the dark-colored area in the reference image indicates the reconstruction area, the dashed frame is the search area, the grid-colored block in the current image is the current block, the adjacent area of the current block is the first template (T), and the reference block is determined within the search area of the reference image based on MV, and the adjacent area of the reference block is the second template (i.e., called the "reference template" or "matching template", T_BEST), at this time, the reference block can be block-copied and used as the predicted block of the current block. The TM-based MV refinement search range is part or all of the reconstruction area in the reference image.
[0025] When the reference block and the current coding block are in the same frame, as shown in Figures 1B and 1C, the dark-shaded area represents the reconstruction area, the grid-shaded block is the current block, and the neighboring area of the current block is the first template (T), the shaded block is the reference block, and the neighboring area of the reference block is the second template (i.e., called the "reference template" or "matching template", T_BEST), where the offset of the second template relative to the first template is the best block vector (BV_BEST). In this case, the reference block can be copied and used as the prediction block for the current block. As shown in Figure 1B, the TM-based BV refinement search range in IBC includes search areas within multiple left and upper coded reconstructed CTBs. As shown in Figure 1C, the TM-based BV search range in IntraTMP includes the reconstruction areas to the left and upper of the current block within a fixed-size search window.
[0026] In the embodiments of the present application, the predetermined cost function may be sum of absolute differences SAD, sum of absolute transformed differences SATD, mean squared error MSE, sum of squared differences SSD, mean absolute deviation MAD, mean squared deviation MSD, normalized cross correlation NCC, etc., and is not specifically limited here.
[0027] JPEG2024152385000001.jpg23164
[0028] The prediction process in the template matching technique will be described in detail below.
[0029] The input of the TM is the position of the current block (xTbCmp, yTbCmp), the width nTbW of the current block, the height nTbH of the current block, the reconstructed pixel position of the reference area, and the sampling point information.
[0030] The output of the TM is the predictions of the current block, predSamples[x][y], where x=0..nTbW-1, y=0..nTbH-1.
[0031]
[0032] The specific prediction process of the TM vector search technology can be divided into five steps: determining the initial MV / BV, determining the type of the current template, obtaining the reconstruction pixels of the current template, refining the MV / BV within a predefined search range around the initial vector, and generating a predicted value. Through these processes, the predicted value of the current block can be obtained. Note that TM can be used to predict the luminance component or the luma component, and is not specifically limited here.
[0033] A schematic diagram of the prediction process based on TM technology is shown in Figure 2. As shown in Figure 2, the process includes the following steps:
[0034] S201: The initial MV / BV is determined.
[0035] In addition, in MV technology, the initial MV may be an MV of InterMerge or InterAMVP, in IBC technology, the initial BV may be a BV in the candidate list of IBC Merge or IBC AMVP, and in IntraTMP technology, the initial BV may be considered to be 0 or non-existent.
[0036] S202: Determine the current template type.
[0037] It should be noted that the TM technique uses neighboring reconstructed pixels of the current block as templates to search for matching templates within a predefined search area, where the neighboring reconstructed pixels may be upper reference pixels, upper left reference pixels, upper right reference pixels, left reference pixels, and lower left reference pixels of the current block, etc. Therefore, the template type can be classified and the corresponding template type can be determined according to the availability of neighboring reconstructed pixels.
[0038] The template type may be represented by refTemplateType, and Fig. 3 shows a schematic diagram of the template types in TM technology. As shown in Fig. 3, the block filled with the grid is the current block, and the adjacent area of the current block is the template T, and six types of template types are shown here.
[0039] Illustratively, these six template types are: When the upper left reference pixel, the upper reference pixel, and the left reference pixel are all available, the value of refTemplateType is 1, and the template shape is as shown in Figure 3(a). If only the left reference pixel is available, the value of refTemplateType is 2, and the template shape is as shown in Figure 3(b). When only the upper reference pixels are available, the value of refTemplateType is 3, and the template shape is as shown in Figure 3(c). When only the left and upper left reference pixels are available, the value of refTemplateType is 4, and the template shape is as shown in Figure 3(d). If only the left and bottom-left reference pixels are available, the value of refTemplateType is 5, and the template shape is as shown in FIG. 3(e); and When only the upper reference pixels and the upper right reference pixels are available, the value of refTemplateType is 6, and the template shape is as shown in FIG. 3(f).
[0040] S203: The current template pixel is obtained.
[0041] The template for the TM technique may be composed of reconstructed pixels from one or more of the following regions: the upper right, upper right, left, lower left, and upper left of the current block. The template size may be preset, transmitted in the bitstream, or adaptively selected based on information such as the block size. For example, when acquiring a left template, the template width (templateW_size) may be set to 4, and when acquiring an upper template, the template height (templateH_size) may be set to 4.
[0042] It is possible to determine which portion of reconstructed pixels to acquire based on the value of refTemplateType. For example, if the value of refTemplateType is 1, reconstructed pixels on the left, upper left, and upper sides of the current block are acquired, or if the value of refTemplateType is 2, only reconstructed pixels on the four columns on the left side of the current block are acquired, or if the value of refTemplateType is 3, only reconstructed pixels on the four rows on the top side of the current block are acquired.
[0043] S204: The MV / BV is refined within a predefined search range around the initial MV / BV to determine the optimal MV / BV.
[0044] The TM MV / BV refinement process is mainly divided into an initialization process, determining the template search area, and searching for and determining the optimal vector within the search area. When searching for the optimal matching template within the search area, a search strategy of first performing a coarse search and then a fine search can be adopted, or only a fine search can be performed, or only a coarse search can be performed. This is not specifically limited.
[0045] In the present embodiment, the coarse search here may specifically be determining an optimal coarse matching template in the search area with a first predetermined step size (e.g., 2), or determining an optimal coarse matching template in the search area using a downsampled template (e.g., a downsampling factor of 2).
[0046] In the embodiment of the present application, the fine search here may specifically be determining an optimal fine matching template in the search area with a second predetermined step size (e.g., 1), or determining an optimal fine matching template in the vicinity of the optimal coarse matching template after performing a coarse search.
[0047] In an embodiment of the present application, a coarse search may be performed first, followed by a fine search, specifically, determining an optimal coarse matching template in the search area using a first predetermined step size (e.g., 2), and then determining an optimal fine matching template in the vicinity of the optimal coarse matching template using a second predetermined step size (e.g., 1).
[0048] In this way, after completing the above operations, the optimal vector parameters MV_BEST / BV_BEST(pX_BEST, pY_BEST) can be obtained, where pX_BEST and pY_BEST are respectively the horizontal offset and vertical offset of the optimal matching template relative to the current block template, and are also the horizontal offset and vertical offset of the optimal matching reconstruction block relative to the current block.
[0049] S205: A predicted value is generated.
[0050] Here, we can achieve this using a simple translation copy. The specific operations are as follows: For x=0...nTbW-1 and y=0...nTbH-1, predSamples[x][y]=recSamples[x+pX_BEST][y+pY_BEST] (2) where recSamples represents the reconstructed pixels of the current frame.
[0051] In brief, in the related art, the TM technology searches for a matching template with the smallest cost within a predefined search range in the current image according to a predetermined cost function using the template of the current block, and selects the optimal matching reconstruction block (Ref Block) corresponding to the matching template as the prediction block of the current block (Cur Block). Here, the template of the current block is usually selected and used in the reconstruction area adjacent to the current block.
[0052] However, in the actual encoding process, in the related art, directly using the reconstructed pixels of the optimal matching reconstructed block as the predicted pixels of the current block is sometimes not the optimal solution. For example, when there is a linear illumination change between the optimal matching reconstructed block and the current block, if the reconstructed pixels of the optimal matching reconstructed block are directly used as the predicted pixels of the current block, there will be a relatively large deviation, the prediction accuracy will be low, and the optimal prediction effect will not be achieved.
[0053] Based on this, an embodiment of the present application provides an encoding method, which determines a first template for a current block, determines a matching template and a reference block, determines model parameters based on the first template and the matching template, performs a filtering process on the reference block based on the model parameters, determines a filtered reference block, determines a predicted value of the current block based on the filtered reference block, and determines a predicted residual value of the current block based on the predicted value of the current block.
[0054] An embodiment of the present application further provides a decoding method, including: determining a first template for a current block; determining a matching template and a reference block; determining model parameters based on the first template and the matching template; performing a filtering process on the reference block based on the model parameters; determining a filtered reference block; determining a predicted value of the current block based on the filtered reference block; and determining a reconstructed value of the current block based on the predicted value of the current block.
[0055] In this way, both on the encoding side and the decoding side, the first template and the matching template are used to determine model parameters, which fully reflect the correlation between the matching template and the first template of the current block. This correlation is applied to the reference block, and its reconstructed pixels are filtered and refined. Then, the filtered reconstructed pixels are used as the predicted pixels of the current block. This can effectively correct the predicted value of the template matching technology, improve prediction accuracy, save bitrate, and improve codec efficiency, thereby improving codec performance.
[0056] Hereinafter, each embodiment of the present invention will be described in detail with reference to the drawings.
[0057] 4A shows a schematic block diagram of an encoder according to an embodiment of the present application. As shown in FIG. 4A, an 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, a coding unit 109, and a decoded picture cache unit 110, etc., where the filtering unit 108 can realize deblocking filtering and sample adaptive offset (SAO) filtering, and the coding unit 109 can realize header information coding and context-based adaptive binary arithmetic coding (CABAC). For an input original video signal, a video coding block can be obtained by partitioning a coding tree unit (CTU), and then the residual pixel information obtained after intra or inter prediction is used to transform this video coding block by a transform and quantization unit 101, converting the residual information from the pixel domain to the transform domain, and quantizing the obtained transform coefficients to further reduce the bit rate; the intra estimation unit 102 and the intra prediction unit 103 are used to perform intra prediction on this video coding block, specifically, the intra estimation unit 102 and the intra prediction unit 103 are used to determine the intra prediction mode to be used to encode this video coding block; the motion compensation unit 104 and the motion estimation unit 105 are used to perform inter prediction encoding of the received video coding block relative to one or more blocks in one or more reference frames to provide temporal prediction information;The motion estimation performed by the motion estimation unit 105 is a process of generating a motion vector, which can estimate the motion of the video coding block. Then, the motion compensation unit 104 performs motion compensation based on the motion vector determined by the motion estimation unit 105; after the intra prediction mode is determined, the intra prediction unit 103 is further used to provide the selected intra prediction data to the encoding unit 109, and the motion estimation unit 105 also sends the calculated and determined motion vector data to the encoding unit 109; and the inverse transform and inverse quantization unit 106 is used to reconstruct the video coding block, reconstructing a residual block in the pixel domain, and the reconstructed residual block is sent to the filter control analysis unit 107 and The filtering unit 108 removes block effect artifacts, and the reconstructed residual block is then added to one predictive block in the frame in the decoded picture cache unit 110 to generate a reconstructed video coding block. The encoding unit 109 is used to encode various coding parameters and quantized transform coefficients. In a CABAC-based encoding algorithm, the context content can be used to encode information indicating the determined intra-prediction mode based on neighboring coding blocks and output the bitstream of the video signal. The decoded picture cache unit 110 is used to store the reconstructed video coding block for prediction reference. As the video image encoding progresses, new reconstructed video coding blocks are continuously generated, and all of these reconstructed video coding blocks are stored in the decoded picture cache unit 110.
[0058] 4B shows a schematic block diagram of a decoder according to an embodiment of the present application. As shown in FIG. 4B, a decoder (specifically, a "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 picture cache unit 206, etc., where the decoding unit 201 can realize header information decoding and CABAC decoding, and the filtering unit 205 can realize deblocking filtering and SAO filtering. After the input video signal undergoes the encoding process of FIG. 4A, the decoder 200 outputs a bitstream of the video signal. The bitstream is input to the decoder 200, which first passes through the decoding unit 201 and is used to obtain decoded transform coefficients; the transform coefficients are processed by the inverse transform and inverse quantization unit 202 to generate residual blocks in the pixel domain; the intra prediction unit 203 can be used to generate prediction data for the current video decoded block based on the determined intra prediction mode and data from the previous decoded block of the current frame or picture; the motion compensation unit 204 determines prediction information for the video decoded block by analyzing the motion vector and other related syntax elements, and uses the prediction information a predictive block of the video decoding block being decoded using the inverse transform and inverse quantization unit 202; a decoded video block is formed by adding the residual block from the inverse transform and inverse quantization unit 202 and the corresponding predictive block generated by the intra prediction unit 203 or the motion compensation unit 204; the decoded video signal can be filtered by the filtering unit 205 to remove block effect artifacts and improve video quality; the decoded video block is then stored in the decoded picture 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.
[0059] Furthermore, an embodiment of the present application further provides a network architecture of a codec system including an encoder and a decoder. FIG. 5 shows a schematic diagram of the network architecture of the codec system according to an embodiment of the present application. As shown in FIG. 5, the network architecture includes one or more electronic devices 13-1N and a communication network 01, through which the electronic devices 13-1N can perform video interaction. In the implementation process, the electronic devices may be devices with various types of video codec functions. For example, the electronic devices may include smartphones, tablet computers, personal computers, personal digital assistants, navigators, digital telephones, video telephones, televisions, sensing devices, servers, etc., but are not limited thereto. Furthermore, the decoder or encoder according to the embodiment of the present application may be the above-mentioned electronic devices.
[0060] Note that the method of the embodiment of the present application is mainly applied to the intra prediction unit 103 portion and the inter prediction portion shown in Fig. 4A, and the intra prediction unit 203 portion and the motion compensation unit 204 shown in Fig. 4B. That is, the embodiment of the present application may be applied to an encoder, a decoder, or both an encoder and a decoder simultaneously, but the embodiment of the present application is not specifically limited.
[0061] When applied to the encoding side, the "current block" specifically refers to the coding block currently being intra-predicted, and when applied to the decoding side, the "current block" specifically refers to the decoding block currently being intra-predicted.
[0062] In one embodiment of the present application, a schematic flowchart of a decoding method according to an embodiment of the present application is shown, as shown in Figure 6. As shown in Figure 6, the method may include the following steps:
[0063] S601: Determine the first template of the current block, and determine the matching template and the reference block.
[0064] It should be noted that the decoding method of the present embodiment is applied to a decoder. This decoding method can be referred to as a linear filtering model-based template matching (TM-FLM) prediction method. In some embodiments, this decoding method specifically refers to an intra prediction method, more specifically, an intra prediction method based on an intra template matching technique (Intra TMP-FLM) based on a linear filtering model, or an intra prediction method based on an intra block copy (IBC-FLM) based on a linear filtering model. Here, a video image may be divided into multiple decoding blocks, and the current block in the present embodiment refers to a decoding block currently being subjected to intra prediction in the video image, and the reference block is a reconstructed block in the current frame. It should be noted that the decoding method of the present embodiment may be used for both luma component prediction and chrominance component prediction, and is not specifically limited herein.
[0065] In some embodiments, the decoding method may be an inter-prediction method, more specifically, a template matching inter-prediction method based on a linear filtering model, where a video image may be divided into decoding blocks, and the current block in the embodiments of the present application refers to a decoding block in the video image currently waiting to perform inter-prediction, and the reference block is a reconstructed block in a reference frame.
[0066] Note that in embodiments of the present application, it is necessary to first determine a first template for the current block, so that a matching template can be determined based on the first template. In some embodiments, determining the first template for the current block may include determining a template type for the current block and determining the first template for the current block based on the template type of the current block. In some embodiments, determining the first template for the current block may include decoding a bitstream to determine the first template for the current block.
[0067] Here, the template type may be represented by refTemplateType. In some embodiments, determining the template type of the current block may include determining the template type of the current block based on reference pixels of the current block, decoding the bitstream and determining the template type of the current block, or determining the template type of the current block based on the size of the current block.
[0068] Here, the reference pixels of the current block include at least one of the left adjacent reference pixels of the current block, the upper adjacent reference pixels of the current block, the upper left adjacent reference pixels of the current block, the lower left adjacent reference pixels of the current block, and the upper right adjacent reference pixels of the current block.
[0069] That is, in the embodiment of the present application, the reference pixels of the current block are determined based on the neighboring reconstructed regions of the current block, where the neighboring reconstructed regions of the current block include at least one of a left neighboring region, an upper neighboring region, an upper-left neighboring region, a lower-left neighboring region, and an upper-right neighboring region. For example, the left neighboring reference pixels of the current block may be determined by at least one column of reconstructed pixels in the left neighboring region, the upper neighboring reference pixels of the current block may be determined by at least one column of reconstructed pixels in the upper neighboring region, and the lower-left neighboring reference pixels of the current block may be determined by at least one column of reconstructed pixels in the lower-left neighboring region, but are not specifically limited thereto.
[0070] Furthermore, the template type of the current block can be determined by classifying the template type according to whether neighboring reference pixels are available. In some embodiments, the step of determining the template type of the current block includes: determining that the template type of the current block is a first value if the left neighboring reference pixel of the current block, the upper neighboring reference pixel of the current block, and the upper left neighboring reference pixel of the current block are all available; determining that the template type of the current block is a second value if the left-neighboring reference pixel of the current block is available; If the upper neighboring reference pixels of the current block are available, determining that the template type of the current block is a third value; determining that the template type of the current block is a fourth value if the left adjacent reference pixel of the current block and the upper left adjacent reference pixel of the current block are both available; determining that the template type of the current block is a fifth value if the left neighboring reference pixel of the current block and the lower-left neighboring reference pixel of the current block are both available; If both the upper neighboring reference pixels of the current block and the upper right neighboring reference pixels of the current block are available, determining that the template type of the current block is a sixth value.
[0071] In an embodiment of the present application, the first, second, third, fourth, fifth, and sixth values may be different from one another. For example, the first value may be set to 1, the second value to 2, the third value to 3, the fourth value to 4, the fifth value to 5, and the sixth value to 6. For details of these six template types, see (a), (b), (c), (d), (e), and (f) in FIG. 3.
[0072] In some embodiments, determining a first template for the current block based on the template type of the current block may include obtaining template pixels for the current block based on the template type of the current block and a corresponding template size, and determining the template pixels of the current block as the first template for the current block.
[0073] In the embodiment of the present application, the template size may be preset, may be determined according to the size of the current block, or may even be related to the template type of the current block, and is not specifically limited here.
[0074] For example, if the template type indicates that only the left template is to be acquired, the template width templateW_size can be set to 4, and if the template type indicates that only the top template is to be acquired, the template height templateH_size can be set to 4.
[0075] Also, the value of the template type can determine which portion of the reconstructed pixels the first template will acquire. For example, if the value of refTemplateType is 1, the left, upper left, and upper reconstructed pixels of the current block are acquired; if the value of refTemplateType is 2, only the reconstructed pixels in the four columns on the left side of the current block are acquired; and if the value of refTemplateType is 3, only the reconstructed pixels in the four rows on the top side of the current block are acquired.
[0076] For the matching template and reference block, in one possible embodiment, the step of determining the matching template and reference block may include decoding the bitstream and determining vector parameters, determining the reference block based on the vector parameters, and determining the matching template based on the first template and the reference block.
[0077] That is, a reference block for the current block can be determined based on vector parameters (e.g., MV or BV) obtained by decoding the bitstream, and a matching template can be determined from the reference block based on the first template for the current block.
[0078] Regarding the matching template and the reference block, in another possible embodiment, the step of determining the matching template and the reference block may include performing template matching within a search area based on a first template to determine a matching template, and determining a reference block based on the matching template. In one possible embodiment, the step of determining the matching template may include decoding a bitstream to determine the matching template. In one possible embodiment, the step of determining the reference block may include decoding a bitstream to determine a reference template.
[0079] In some embodiments, performing template matching within the search area based on the first template and determining the matching template may include performing a search within the search area based on the first template, determining target vector parameters, and determining the matching template based on the target vector parameters.
[0080] In another possible embodiment, the step of determining the matching template may include a step of performing template matching within a search area based on a first template to determine the matching template, and a step of determining initial vector parameters of the current block, a step of determining a search area based on the initial vector parameters, a step of performing a search within the search area based on template matching to determine target vector parameters, and a step of determining a matching template based on the target vector parameters and the first template.
[0081] The vector parameter may be a motion vector including a horizontal component and a vertical component. In the MV technique, the initial MV may be an InterMerge or InterAMVP MV. In the IBC technique, the initial BV may be a BV in the candidate list of IBC Merge or IBC AMVP. In the IntraTMP technique, the initial BV may be regarded as 0 or non-existent.
[0082] In one possible embodiment, determining initial vector parameters of the current block includes determining a vector parameter candidate list for constructing the current block based on a prediction mode parameter of the current block, and determining initial vector parameters based on the vector parameter candidate list. The prediction mode parameter is used to indicate parameters related to the current block prediction mode. In one possible embodiment, determining initial vector parameters based on the vector parameter candidate list includes obtaining a vector parameter at a predetermined position (e.g., a first vector parameter) from the vector parameter candidate list as an initial vector parameter, or obtaining a vector parameter at a predetermined position from the vector parameter candidate list, decoding the bitstream to determine a vector parameter prediction residual value, and determining initial vector parameters based on the vector parameter at the predetermined position and the vector parameter prediction residual value.
[0083] In one possible embodiment, the step of determining a vector parameter candidate list for constructing the current block based on the prediction mode parameters of the current block includes a step of determining a merge vector parameter candidate list for constructing the current block based on the prediction mode parameters of the current block, or a step of determining an AMVP vector parameter candidate list for constructing the current block based on the prediction mode parameters of the current block.
[0084] In one possible embodiment, the initial vector parameter of the current block is determined as a predetermined vector parameter based on the prediction mode parameter of the current block. In some embodiments, the Intra TMP initial block vector is 0. In yet another embodiment, the Intra TMP initial block vector parameter is a vector parameter obtained by performing a coarse search on the search area, and the target vector parameter is a vector parameter obtained by performing a fine search on the search area.
[0085] In one possible embodiment, determining a search area based on the initial vector parameters includes determining a search area based on the initial vector parameters and a predetermined search range. Illustratively, determining a reference block based on the initial vector parameters and the current block, and determining a search area based on the reference block and the predetermined search range, where the search area includes reconstructed pixels.
[0086] The search range may be set in advance, may be transmitted in the bitstream, or may be adaptively selected based on information such as block size.
[0087] In one possible embodiment, the method for determining the search range includes at least one of: setting a predetermined horizontal component search range as the horizontal component search range of the predetermined search range; setting a predetermined vertical component search range as the vertical component search range of the predetermined search range; decoding the bitstream to determine the horizontal component search range and / or the vertical component search range of the predetermined search range; and determining the horizontal component search range and / or the vertical component search range of the predetermined search range according to the size of the current block.
[0088] In one possible embodiment, the step of determining the search area based on the initial vector parameters includes the steps of determining the current block as an inter prediction mode based on the prediction mode parameters and determining the search area in the reference image based on the initial vector parameters, and determining the current block as an intra prediction mode based on the prediction mode parameters and determining the search area in the current image based on the initial vector parameters.
[0089] In one possible embodiment, the intra prediction mode is determined based on the prediction mode parameters of the current block, and the search area includes at least one of a partial area of the reconstructed coding tree block of the current image, the entire area of the reconstructed coding tree block of the current image, the entire reconstructed area of the current coding tree block in which the current block is located, and a partial area of the reconstructed coding tree block in which the current block is located.
[0090] In one possible embodiment, the step of searching within the search area based on template matching and determining the target vector parameters includes the steps of searching and determining a reference template within the search area, calculating a matching cost value between the reference template and the first template, and determining the vector parameters of the reference template corresponding to the minimum matching cost value as the target vector parameters. Illustratively, the step of searching and determining a reference template available within the search area.
[0091] In one possible embodiment, the conditions for determining the availability of the reference template include at least one of: a first sampling point in the template does not extend beyond the image boundary in which it is located; a second sampling point in the reference block corresponding to the template does not extend beyond the image boundary in which it is located; a first sampling point in the template does not extend beyond the search area; a second sampling point in the reference block corresponding to the template does not extend beyond the search area; all first sampling points in the template are reconstructed; and all second sampling points in the reference block corresponding to the template are reconstructed.
[0092] In one possible embodiment, the availability determination condition for the reference template includes at least one of: a first sampling point in the template and the current block are in the same sub-image; a second sampling point in the reference block corresponding to the template and the current block are in the same sub-image; and the second sampling point in the reference block corresponding to the template is not in the current block. Illustratively, a sub-pixel may include multiple coding tree units. Illustratively, a sub-image may be a Tile.
[0093] In one possible embodiment, the first sampling points are each sampling point in the template or predetermined first identified sampling points, including a sampling point at at least one corner position in the template.
[0094] In one possible embodiment, the second sampling points are each sampling point in a reference block corresponding to the template, or are predetermined second identification sampling points. The second identification sampling points include sampling points at at least one corner position in the reference block corresponding to the template. Specifically, whether a sampling point is within the predetermined image can be determined by whether the coordinates of the sampling point are within the valid coordinate range of the predetermined image area.
[0095] The sampling points may be sampling points in the template or in the reconstruction block corresponding to the template, or sampling points at specific positions set in advance. In some embodiments, the distinguished sampling points in the template refer to one or more sampling points located at corner positions of the template region. For example, if there is only an upper template, the distinguished sampling points may be the sampling points in the upper left and lower right corners of the upper template region, or only the sampling point in the lower right corner. Here, the distinguished sampling points in the reconstruction block corresponding to the template refer to one or more sampling points located at corner positions of the reconstruction block region. For example, the distinguished sampling points may be the sampling points in the upper left and lower right corners of the reconstruction block region, or only the sampling point in the lower right corner of the reconstruction block region.
[0096] That is, a search can be performed within a search area based on the first template, and a matching template with the lowest cost can be searched for according to a predetermined cost function. Here, by traversing all search points within the search area, one or more candidate vector parameters can be obtained, and the one or more candidate vector parameters can indicate one or more candidate matching templates, which are then compared with the first template of the current block through cost calculation to obtain the search point with the lowest cost, whose corresponding candidate vector parameters are optimal vector parameters (i.e., target vector parameters, BV_BEST), and whose corresponding candidate matching template is the optimal matching template (i.e., the matching template, T_BEST, in this embodiment). A reference block can be determined based on the optimal matching template. In this embodiment, the target vector parameters can be understood as optimal vector parameters or matching vector parameters. Exemplarily, the vector parameters of an inter prediction mode can be MV, and the vector parameters of an intra prediction mode can be BV.
[0097] In the embodiments of the present application, the predetermined cost function may be sum of absolute differences SAD, sum of absolute transformed differences SATD, mean squared error MSE, sum of squared differences SSD, mean absolute deviation MAD, mean squared deviation MSD, normalized cross correlation NCC, etc., and is not specifically limited here.
[0098] It can be understood that the search process within the search area may be a coarse search, a fine search, or a coarse search first and a fine search later, as follows:
[0099] In one possible embodiment, the step of performing a search within the search area based on template matching and determining the target vector parameters includes performing a first search within the search area and determining the target vector parameters, or performing a second search within the search area and determining the target vector parameters, wherein a search step size corresponding to the first search is larger than a search step size corresponding to the second search.
[0100] In another possible embodiment, the step of performing a search within a search area based on template matching and determining target vector parameters includes the steps of performing a first search within the search area, determining first vector parameters, and determining an initial matching template based on the first vector parameters; and determining a first search area based on the initial matching template, performing a second search within the first search area, and determining target vector parameters, wherein a search step size corresponding to the first search is larger than a search step size corresponding to the second search, and the first search area is smaller than the search area.
[0101] In the present embodiment, the search step size corresponding to the first search is larger than the search step size corresponding to the second search. For example, the search step size corresponding to the first search is 2, and the search step size corresponding to the second search is 1. Alternatively, the downsampling factor corresponding to the first search is larger than the downsampling factor corresponding to the second search. For example, the downsampling factor corresponding to the first search is 4, and the downsampling factor corresponding to the second search is 2. In other words, the first search is a coarse search, and the second search is a fine search. It is sufficient that the first search reflects coarser features than the second search, and there are no specific limitations here.
[0102] Note that when a first search is performed first and then a second search is performed, not only is the search step size corresponding to the first search larger than the search step size corresponding to the second search, but the first search area is smaller than the search area. Here, the first search area is a search area near the initial matching template. For example, the optimal coarse matching template can be determined within the search area using a step size of 2, and then the optimal fine matching template (i.e., the final matching template) can be determined near the optimal coarse matching template using a step size of 1.
[0103] In yet another possible embodiment, the search area includes at least one sub-search area, and the step of searching within the search area based on template matching and determining target vector parameters includes the steps of: searching within each of the at least one sub-search area and determining optimal vector parameters and corresponding matching cost values for each sub-search area; determining optimal vector parameters corresponding to the minimum matching cost value based on the optimal vector parameters and corresponding matching cost values for each sub-search area; and setting the optimal vector parameters corresponding to the minimum matching cost value as the target vector parameters.
[0104] In one possible embodiment, the step of searching within the search area based on template matching and determining the target vector parameters includes the steps of: searching within the search area based on template matching and determining first vector parameters; decoding the bitstream to determine vector parameter prediction residual values; and determining the target vector parameters based on the first vector parameters and the vector parameter prediction residual values.
[0105] In one possible embodiment, the step of performing a search within a search area based on template matching and determining target vector parameters includes the steps of: performing a first search within at least one sub-search area and determining optimal vector parameters for each sub-search area and a corresponding second search area; performing area judgment based on the optimal vector parameters for each sub-search area and the corresponding second search area and determining at least two target sub-search areas for the second search; performing a second search within the at least two target sub-search areas and determining optimal vector parameters corresponding to the at least two target sub-search areas; and determining the optimal vector parameters corresponding to the at least two target sub-search areas as target vector parameters.
[0106] It should be noted that in some embodiments, the search area of the BV may be the reconstructed part of the CTB where the current block is located, or may be another reconstructed CTB area. The search area here is actually a collection of all search points. Because the shape of this area often cannot be represented by a single rectangular area, in specific implementation, multiple rectangular areas may be searched, and the search results of different areas may be combined to obtain the final optimal reference block and optimal block vector.
[0107] In some embodiments, for the search process of the IBC technology, the availability of the search points within the search area can be directly determined, and then the matching cost can be determined, and the vector parameters of the reference template corresponding to the minimum matching cost value can be determined as the target vector parameters.
[0108] In some embodiments, the search process of the MV also searches for valid search points within the search area, without determining whether the valid search points within the search area are reconstructed or not, because all pixels in the reference image have already been reconstructed.
[0109] FIG. 7 shows a schematic diagram of different sub-region divisions of a search area according to an embodiment of the present invention. As shown in FIG. 7, eight different sub-region division methods are shown. Here, the black background block is the current block. The five division methods (a), (b), (c), (d), and (f) all divide the search area into four sub-search areas, while the three division methods (e), (g), and (h) all divide the search area into three sub-search areas, where each different fill pattern represents one sub-search area. In FIG. 7, (a), (b), (c), and (d) consider all available search ranges, while (e), (f), (g), and (h) do not search the area directly above or directly to the left.
[0110] Taking (f) of FIG. 7 as an example, the search area is divided into four sub-search areas, each of which is represented by regionId, where the value of regionId can be 0, 1, 2, or 3. Using the search point (iPosHor, iPoxVer) in each sub-search area, i.e., each block vector BV (composed of horizontal and vertical components (pX, pY), where pX = iPosHor-xTbCmp and pY = iPosVer-yTbCmp, where pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs), a reference block matching one current block in the reconstructed area can be found. The neighboring reconstructed pixels of the reference block are the matching template. The matching cost between the first template of the current block and the matching template can then be calculated, denoted as pDiff.
[0111] In this way, all search points in all search ranges (regionId=0, 1, 2, 3) are traversed, and the search point with the smallest matching cost pDiff is obtained by comparison. The corresponding matching cost is denoted as pDiff_BEST, and the corresponding block vector is denoted as the optimal block vector BV_BEST(pX_BEST, pY_BEST), i.e., the target block vector in this embodiment. The corresponding optimal matching template T_BEST is the final required matching template.
[0112] In one possible embodiment, determining the reference block comprises determining the reference block based on the target vector parameters, illustratively determining the reference block based on the current block and the target vector parameters.
[0113] In another possible embodiment, the method further comprises the step of decoding the bitstream and determining a value of a first syntax element identification information, the first syntax element identification information being used to indicate whether template matching is applied to the current block or not.
[0114] In yet another possible embodiment, the method further includes the steps of decoding the bitstream and determining a value of a third syntax element identification information, and determining a reference block for the current block based on the value of the third syntax element identification information.
[0115] In yet another possible embodiment, the method further includes the steps of: decoding the bitstream and determining a value of a third syntax element identification information, wherein the first syntax element identification information is used to indicate that template matching is applied to the current block; and determining a reference block for the current block based on the value of the third syntax element identification information.
[0116] The encoding side transmits a Flag to indicate which filtered reference block is to be the final predicted block. tmpFlag indicates whether template matching is applied to the current coding block, and filterIdx indicates which reference block within the current search range is to be subjected to a filtering model. If tmpFlag is 1, the encoding side compares the distortion, for example, SAD, MSE, SATD, or SSE, between the reference block to which the filter coefficients within the search range are applied and the current source block, to select the optimal reference block, and transmits the corresponding index to the decoding side.
[0117] In yet another possible embodiment, the method further includes the steps of: traversing a search area to search for multiple reference templates; determining model parameters based on the first template and the reference templates; performing a filtering process on the reference templates based on the model parameters to obtain a filtered reference template; calculating a matching cost value between the filtered reference template and the first template; and determining a reference block of the reference template corresponding to the minimum matching cost value as a reference block of the current block. The reference block of the reference template can be understood as a reconstruction block of the reference template.
[0118] In addition, filter coefficients are calculated for templates within the search range and filtered, and the cost with the current template is calculated to determine which template to use; that is, filter coefficients are calculated for some or all of the search target templates within the search range, and then the filter coefficients are applied to these search target templates to calculate the cost with the current template, and the filtered optimal matching template is selected based on the cost. The reference block corresponding to the optimal matching template is filtered to obtain the final predicted value.
[0119] S602: Determine model parameters based on the first template and the matching template.
[0120] In some embodiments, the model parameters may include coefficients of a target filter. In some embodiments, the method may further include determining coefficients of the target filter based on pixel reference values in the first template and pixel reference values in the matching template.
[0121] In some embodiments, the coefficients of the target filter may be determined by solving an optimization problem. Correspondingly, in some embodiments, the method may further include: the coefficients of the target filter are coefficients used by the target filter when a first error between an output value of a pixel reference value in the matching template processed by the target filter and a pixel reference value in the first template satisfies a first condition.
[0122] With regard to the first error satisfying the first condition, it should be understood that in one possible embodiment, the first condition is that the first error is minimal, or in another possible embodiment, the first condition is that the first error is within a first predetermined threshold range, or in yet another possible embodiment, the first condition is that the amount of change in the first error is within a second predetermined threshold range.
[0123] It should be further understood that the first predetermined threshold range and the second predetermined threshold range are both criteria preset on the decoding side for determining whether the first error satisfies the first condition. In addition, the first error here may be a mean square error MSE, a residual sum of squares SSE, a sum of absolute differences SAD, a sum of absolute differences after Hadamard transform SATD, a mean absolute error MAE, etc., and is not specifically limited thereto in the embodiments of the present application.
[0124] In some embodiments, determining coefficients of the target filter based on pixel reference values in the first template and pixel reference values in the matching template comprises: determining autocorrelation parameters based on pixel reference values in the matching template; determining cross-correlation parameters based on pixel reference values in the first template and pixel reference values in the matching template; and determining coefficients of the target filter based on the autocorrelation and cross-correlation parameters.
[0125] It should be noted that in the present embodiment, the pixel reference values include at least one of pixel reconstruction values, pixel gradient values, and pixel position information.
[0126] JPEG2024152385000002.jpg76167
[0127] JPEG2024152385000003.jpg112168
[0128] JPEG2024152385000004.jpg49168
[0129] JPEG2024152385000005.jpg25159
[0130] JPEG2024152385000006.jpg143168
[0131] JPEG2024152385000007.jpg32168
[0132] In the embodiment of the present application, for the target filter, it is necessary to determine the number of coefficients of the target filter, the shape of the target filter, etc. Here, the number of coefficients of the target filter and the shape of the target filter may both be preset fixed values, or may be directly determined by decoding the bitstream.
[0133] In some embodiments, for the shape of the target filter, the method may further comprise the step of decoding the bitstream and determining the shape of the target filter.
[0134] In some embodiments, for the number of coefficients of the target filter, the method may further include: the number of coefficients of the target filter is equal to a first predetermined value.
[0135] In some embodiments, for the number of coefficients of the target filter, the method may further comprise the step of decoding the bitstream and determining the number of coefficients of the target filter.
[0136] The number of coefficients of the target filter may be represented by nTap. For example, the value of nTap may be 4, 5, 6, 7, 8, 9, etc., but is not limited to this.
[0137] The number of coefficients of the target filter may also be referred to as the number of taps of the target filter, where the number of coefficients of the target filter may be a predetermined constant value, may be determined by decoding the bitstream, or may be determined based on the syntax element identification information of the current block.
[0138] In some embodiments, regarding the shape of the target filter, the method may further include the target filter being a one-dimensional or two-dimensional filter of a predetermined shape.
[0139] In some embodiments, for the shape of the target filter, the method may further comprise the step of decoding the bitstream and determining the shape of the target filter.
[0140] In some embodiments, for a shape of the target filter, the method may further comprise decoding the bitstream and determining values of filter shape parameters, the filter shape parameters indicating the shape of the target filter.
[0141] The filter shape parameter may be represented by FilterIdx, which is used to indicate the shape of the target filter. For example, the shape of the target filter may be a diamond, a rectangle, a cross, a bar, or even a one-dimensional filter or a two-dimensional filter, but is not limited to this.
[0142] Illustratively, if the value of FilterIdx is equal to 0, the shape of the target filter is determined to be a diamond, if the value of FilterIdx is equal to 1, the shape of the target filter is determined to be a cross, and if the value of FilterIdx is equal to 2, the shape of the target filter is determined to be a rectangle.
[0143] It should be noted that the shape of the target filter may be a predetermined shape, may be determined by decoding the bitstream, or may even be determined based on the syntax element identification information of the current block.
[0144] S603: A filtering process is performed on the reference block based on the model parameters, and a filtered reference block is determined.
[0145] S604: Determine a prediction value for the current block based on the filtered reference block.
[0146] In addition, in the embodiment of the present application, after the model parameters are determined, a predicted value of the current block can be determined based on the model parameters and the reference block, specifically, a filtering process is performed on the reference block based on the model parameters, and then a predicted value of the current block is determined based on the filtered reference block.
[0147] In some embodiments, the step of performing a filtering process on the reference block based on the model parameters and determining a filtered reference block may include the steps of performing a filtering process on the reference block based on the model parameters and determining a first output value of the target filter, and determining the filtered reference block based on the first output value of the target filter.
[0148] In the embodiment of the present application, a first output value of the target filter can be calculated based on the pixel reconstruction value of the reference block and the coefficient of the target filter in the model parameters, and then a filtered reference block can be determined based on the first output value of the target filter, where the target filter can be a linear filtering model or a nonlinear filtering model, and is not specifically limited.
[0149] In one possible embodiment, the step of performing a filtering process on the reference block based on the model parameters and determining a filtered reference block may include the steps of: calculating products of pixel reconstruction values of the reference block and corresponding coefficients of a target filter; setting a first output value of the target filter equal to the sum of n products, where n represents the number of coefficients of the target filter and is a positive integer; and determining a filtered reference block based on the first output value of the target filter.
[0150] In one possible embodiment, the step of calculating the product of the pixel reconstruction value of the reference block and the corresponding coefficient of the target filter may further include a step of calculating the product of the pixel reference value of the second boundary filling region corresponding to the reference block and the corresponding coefficient of the target filter, and / or a step of calculating the product of the pixel reference value of the reference template corresponding to the reference block and the corresponding coefficient of the target filter. To fill the boundary pixels, taking into account that the filter may use reconstruction pixels other than the reference template and the reference block, the boundary pixels need to be filled, and the area that needs to be filled in the boundary varies depending on the filter shape. The filled boundary pixels may be applied to determining model parameters and / or predicting the current block.
[0151] JPEG2024152385000008.jpg37168
[0152] In another possible embodiment, the step of filtering the reference block based on the model parameters and determining a first output value of the target filter comprises: determining a first value in a first mapping relationship of pixel reconstruction values of the reference block; calculating the product of the first value and the corresponding coefficient of the target filter; The method may include setting a first output value of the target filter equal to a sum of n products, where n represents the number of coefficients of the target filter and n is a positive integer.
[0153] JPEG2024152385000009.jpg31168
[0154] JPEG2024152385000010.jpg30168
[0155] In addition, in the embodiment of the present application, the step of determining a filtered reference block based on the first output value of the target filter can directly set the first output value of the target filter as the filtered reference block, or can perform first filtering on the first output value of the target filter to obtain the filtered reference block, where the first filtering may be low-pass filtering, up / down sampling filtering, etc., and is not specifically limited here.
[0156] It should be noted that in the embodiment of the present application, after determining the first output value of the target filter, a first offset value (represented by bias) can be added to the first output value to determine the filtered reference block.
[0157] In some embodiments, determining the filtered reference block based on the first output value of the target filter may include determining a first offset value, and performing an addition operation based on the first output value and the first offset value to determine the filtered reference block.
[0158] In one possible embodiment, determining the first offset value may include setting the first offset value equal to a second predetermined value.
[0159] In another possible embodiment, the step of determining the first offset value may include a step of determining the n+1-th coefficient of the target filter, where the number of coefficients of the target filter is n, and a step of determining the first offset value based on the n+1-th coefficient and the second offset value.
[0160] In an embodiment of the present application, for the second offset value, the method may further include a step of setting the second offset value equal to a third predetermined value, or a step of setting the second offset value equal to a value in a second mapping relationship of the pixel reconstruction value of the reference block.
[0161] JPEG2024152385000011.jpg55168
[0162] JPEG2024152385000012.jpg90168
[0163] Furthermore, in some embodiments, the step of determining a predicted value of the current block based on the filtered reference block may include performing a first process on the filtered reference block to obtain a predicted value of the current block.
[0164] In an embodiment of the present application, for the first process, the first process may be to set the predicted value of the current block equal to the filtered reference block, or the first process may be a clip operation that limits the filtered reference block to a predetermined numerical range, or the first process may be other operations, which are not specifically limited here.
[0165] JPEG2024152385000013.jpg84168
[0166] JPEG2024152385000014.jpg23168
[0167] Furthermore, the number of filter models may be expanded to establish multiple filter models in addition to establishing only one filter model. determining sets of model parameters based on the first template and the matching template; constructing a plurality of filter models based on the plurality of sets of model parameters, and performing filtering processes on the reference blocks based on the plurality of filter models respectively to determine a plurality of filtered reference blocks; determining a prediction value for the current block based on the plurality of filtered reference blocks.
[0168] In some embodiments, the step of determining the plurality of sets of model parameters based on the first template and the matching template may include: classifying the reconstructed pixels in the first template and the matching template according to a predetermined scheme, respectively, to obtain a plurality of sets of sub-templates and a plurality of sets of sub-matching templates; and determining the plurality of sets of model parameters based on the plurality of sets of sub-templates and the plurality of sets of sub-matching templates.
[0169] In the embodiment of the present application, the predetermined method may be, but is not limited to, the magnitude of the reconstructed pixel value, the position information of the reconstructed pixel, the shape of the filter, etc. After classification according to the predetermined method, each set of sub-templates and the corresponding sub-matching template can calculate a set of model parameters, and each set of model parameters can determine a filter model, thereby constructing multiple filter models.
[0170] In one possible embodiment, the method may further include the steps of: decoding the bitstream and determining a target model index value; determining a corresponding target filter from among a plurality of filter models based on the target model index value; and performing a filtering process on the reference block based on the target filter to determine a predicted value of the current block.
[0171] In another possible embodiment, the reference block may be filtered based on a plurality of filter models to determine a plurality of filtered reference blocks. In some embodiments, determining a prediction value for the current block based on the plurality of filtered reference blocks may include performing a weighting calculation on the plurality of filtered reference blocks to determine a prediction value for the current block.
[0172] It should be noted that if the weighting factors of each filtered reference block are equal and are each equal to the reciprocal of the number of reference blocks, the weighting calculation here can also be regarded as an average calculation, in other words, an average calculation is performed on multiple filtered reference blocks to determine the predicted value of the current block.
[0173] For example, the input information for calculating filter coefficients is classified, and a filtering model is established for each type of input information. For example, when using reconstruction information to establish a filter model, one possible embodiment is to classify according to the average value of the reconstruction information, and establish one filter model for reconstruction information greater than the average value, and establish one filter model for reconstruction information less than the average value. Another possible embodiment is to classify according to the position of the reconstruction information, for example, to establish one filter model using available reconstruction information on the left and upper sides, and establish a second filter model using available reconstruction information on the left and upper left sides. The encoding side determines which model to use. One possible determination method is for the encoding side to determine which model to use using a rate-distortion optimization method and transmit corresponding decoding parameters to the decoding side, so that the decoding side can clearly select which filter model. Another possible embodiment is to classify by filter shape, where multiple filters of different shapes can be used, and a filter model is established for each filter shape, and the encoding side determines which filter shape to use. One possible determination method is that the encoding side determines which filter to use through rate-distortion optimization, and transmits corresponding decoding parameters to the decoding side, so that it is clear which filter model the decoding side should select.
[0174] S605: Determine a reconstructed value of the current block based on the predicted value of the current block.
[0175] In addition, in the embodiments of the present application, it is also possible to restore the reconstructed value of the current block after determining the predicted value of the current block, and in some embodiments, the step of determining the reconstructed value of the current block based on the predicted value of the current block may include decoding the bitstream and determining a prediction residual value of the current block, and determining the reconstructed value of the current block based on the predicted value of the current block and the prediction residual value of the current block.
[0176] In one specific embodiment, the step of determining a reconstruction value of the current block based on the prediction value of the current block and the prediction residual value of the current block may include the step of adding the prediction value of the current block and the prediction residual value of the current block to determine the reconstruction value of the current block.
[0177] Note that in embodiments of the present application, whether the current block applies intra-template matching or is used in a filter model may be determined by different syntax element identification information. In some embodiments, the method may further include decoding the bitstream and determining a value of a first syntax element identification information, where the first syntax element identification information is used to indicate whether template matching is applied to the current block. Note that in some embodiments, whether template matching is applied can be understood as whether a search within a search area is performed based on template matching to determine optimal vector parameters, i.e., the first syntax element identification information is used to indicate whether the current block performs a search within a search area based on template matching to determine optimal vector parameters.
[0178] In one specific embodiment, the method further includes the steps of decoding the bitstream and determining a value of a second syntax element identification information; performing a filtering operation on the reference block based on the model parameters, determining a filtered reference block, and determining a predicted value of the current block based on the filtered reference block, when the second syntax element identification information is used to indicate that a filter model is applied to the current block.
[0179] Furthermore, in some embodiments, the method may further include a step of using reconstructed pixel values in the reference block as predicted values of the current block when the second syntax element identification information is used to indicate that a filter model is not applied to the current block.
[0180] In one specific embodiment, the method further includes a step of decoding the bitstream and determining a value of the second syntax element identification information, wherein the first syntax element identification information is used to indicate whether template matching is applied to the current block.
[0181] In an embodiment of the present application, for a first syntax element identification information, if the value of the first syntax element identification information is a first value, it is determined that the first syntax element identification information is used to indicate that intra template matching is applied to the current block, or if the value of the first syntax element identification information is a second value, it is determined that the first syntax element identification information is used to indicate that intra template matching is not applied to the current block.
[0182] In an embodiment of the present application, for a second syntax element identification information, if the value of the second syntax element identification information is a first value, it is determined that the second syntax element identification information is used to indicate that a filter model is applied to the current block, or if the value of the second syntax element identification information is a second value, it is determined that the second syntax element identification information is used to indicate that a filter model is not applied to the current block.
[0183] In the embodiment of the present application, unlike the first value and the second value, the first value and the second value may be in a parameter format or a numerical format. Specifically, the first syntax element identification information and the second syntax element identification information may be parameters written in a profile or may be flag values, and are not specifically limited here.
[0184] Illustratively, for the first value and the second value, the first value may be set to 1 and the second value may be set to 0, or the first value may further be set to true and the second value may further be set to false, but this is not specifically limited thereto.
[0185] In the embodiment of the present application, whether the current block uses the filtered reference block as the final predicted value is determined based on certain conditions, but is not limited to the following three methods. Method 1: determining whether to filter the matching template by comparing the distortion of the matching template and the current block template, such as SAD or MSE or SATD or SSE, with a threshold T_Distortion1; Method 2, which satisfies the requirement of using a filter model in Method 1, and determines whether to filter the reference block according to the distortion between the filtered matching template and the template of the current block, such as SAD, MSE, SATD, or SSE, and a threshold T_Distortion2; and Method 3 may be a method in which the encoding side transmits a Flag to indicate whether to apply a filter model. tmpFlag indicates whether to apply intra template matching to the current block, and filterFlag indicates whether to apply a filter model to the current block. If tmpFlag is 1, the encoding side determines whether to filter the reference block by comparing the distortion between the reference block before and after filtering and the current block, for example, SAD, MSE, SATD, or SSE. If the distortion after filtering is smaller than the distortion before filtering, filterFlag is 1, and the current block uses the filtered reference block as its predicted block; otherwise, filterFlag is 0, and the current block uses the unfiltered reference block as its predicted block, and the encoding side transmits filterFlag to the decoding side.
[0186] In addition to calculating filter coefficients for the optimal matching template after the search is completed and applying the filter coefficients to the optimal matching reference block, it is also possible to apply filter coefficients to all or part of the reference blocks within the search area, and determine which filtered reference block will be the final predicted block based on specific conditions, for example, there are several methods as follows:
[0187] Method 1: Filter coefficients are calculated for templates within the search range and filtered, and the cost with the current template is calculated to determine which template to use; that is, filter coefficients are calculated for some or all of the target templates within the search range, and then the filter coefficients are applied to the target templates to calculate the cost with the current template. The best filtered matching template is selected based on the cost, and the reference block corresponding to the best matching template is filtered to obtain the final prediction value.
[0188] Method 2: The encoding side transmits a Flag to indicate which filtered reference block is to be the final predicted block. tmpFlag indicates whether template matching is applied to the current coding block, and filterIdx indicates which reference block within the current search range the filtering model is to be applied to. If tmpFlag is 1, the encoding side compares the distortion, for example, SAD, MSE, SATD, or SSE, between the reference block to which the filter coefficients within the search range are applied and the current original block, to select the optimal reference block, and transmits the corresponding index to the decoding side.
[0189] This embodiment provides a decoding method, which includes determining a first template for a current block, determining a matching template and a reference block, determining model parameters based on the first template and the matching template, performing a filtering process on the reference block based on the model parameters, determining a filtered reference block, determining a predicted value of the current block based on the filtered reference block, and determining a reconstructed value of the current block based on the predicted value of the current block. In this way, the model parameters are determined based on the first template and the matching template, and the model parameters fully reflect the correlation between the matching template and the first template for the current block. This correlation is applied to the reference block, and the reconstructed pixels thereof are filtered and corrected, and then the filtered reconstructed pixels are used as the predicted pixels of the current block, thereby improving prediction accuracy, saving bit rate, and improving codec efficiency, thereby improving codec performance.
[0190] In another embodiment of the present application, based on the decoding method of the above embodiment, in the prediction process of the template matching technology, it is proposed to correct the best matching reconstructed block (i.e., the reference block) and use the corrected reconstructed pixels as the predicted pixels of the current block. Specifically, a linear filtering model is established using the matching template and pixels of the current block template, and this linear filtering model is applied to the reference block, and the filtered pixels are used as the final predicted pixels. The technical solution of the embodiment of the present application can be called a linear filtering model-based template matching (TM-FLM) prediction method used for intra prediction and inter prediction. It may be an intra prediction method based on a linear filtering model of intra template matching technology (Intra TMP-FLM) or an intra prediction method based on a linear filtering model of intra block copy (IBC-FLM), or a template matching technology based on a linear filtering model.
[0191] The prediction process of the TM-FLM technique is described in detail below.
[0192] The inputs of TM-FLM are the position of the current block (xTbCmp, yTbCmp), the width nTbW of the current block, the height nTbH of the current block, and the reconstructed pixel position and sampling point information of the reference area.
[0193] The output of the TM-FLM is the predictions of the current block, predSamples[x][y], where x=0..nTbW-1, y=0..nTbH-1.
[0194] Specifically, the prediction process of the TM-FLM technique can be divided into six steps, as shown in Figure 3: determining the initial MV / BV, determining the type of the current template, obtaining the reconstructed pixels of the current template, refining the MV / BV within a predefined search range around the initial vector, establishing a linear filtering model, and generating a predicted value. Through these steps, the predicted value of the current prediction block can be obtained. TM can be used to predict the luma component or the chrominance component, and is not specifically limited here.
[0195] As shown in Figure 8A, a schematic diagram of the prediction process based on TM-FLM technology according to an embodiment of the present application is shown. As shown in Figure 8A, the process includes the following steps:
[0196] S801: Determine the initial MV / BV.
[0197] The initial MV may be an MV of InterMerge or InterAMVP, the initial BV may be a BV in the candidate list of IBC Merge or IBC AMVP, and in the IntraTMP technique, the initial BV may be considered to be 0 or non-existent.
[0198] The decoding side may determine whether to build a Merge candidate list or an AMVP candidate list depending on the prediction mode indicated by the prediction mode parameter.
[0199] The candidate list for MV inter-merge and inter-AMVP is determined by methods such as spatial domain adjacent coding units (as shown in Figure 8B) and temporal domain adjacent coding units. For each MV in the candidate list, a refined search can be performed using the template matching method.
[0200] The candidate list for IBC intra-merge and intra-AMVP of BVs is constructed by methods such as spatial domain neighboring coding units (as shown in Figure 8B), history information, etc. For each BV in the candidate list, a refined search can be performed using the template matching method.
[0201] In this embodiment, the first MV / BV in the merge candidate list is taken as an example of the initial MV / BV, and the horizontal initial MV mvXInit ( / BV bvXInit) and vertical initial MV mvYInit ( / BV bvYInit) are initialized with the first MV / BV in the merge candidate list.
[0202] S802: The current template type is determined.
[0203] It should be noted that the TM-FLM technique uses neighboring reconstructed pixels of the current block as templates to search for matching templates within a predefined search area, where the neighboring reconstructed pixels may be upper reference pixels, upper left reference pixels, upper right reference pixels, left reference pixels, and lower left reference pixels of the current block, etc. Therefore, the template type can be classified and the corresponding template type can be determined according to the availability of neighboring reconstructed pixels.
[0204] The template type can be represented by refTemplateType. As shown in Figure 3, the block filled with the grid is the current block, and the adjacent area of the current block is template T. Here, six types of template types are shown.
[0205] Illustratively, these six template types are: When the upper left reference pixel, the upper reference pixel, and the left reference pixel are all available, the value of refTemplateType is 1, and the template shape is as shown in Figure 3(a). If only the left reference pixel is available, the value of refTemplateType is 2, and the template shape is as shown in Figure 3(b). When only the upper reference pixels are available, the value of refTemplateType is 3, and the template shape is as shown in Figure 3(c). When only the left and upper left reference pixels are available, the value of refTemplateType is 4, and the template shape is as shown in Figure 3(d). If only the left and bottom-left reference pixels are available, the value of refTemplateType is 5, and the template shape is as shown in FIG. 3(e); and When only the upper reference pixels and the upper right reference pixels are available, the value of refTemplateType is 6, and the template shape is as shown in FIG. 3(f).
[0206] S803: The current template pixel is obtained.
[0207] The template for the TM-FLM technique may be composed of reconstructed pixels from one or more of the following regions: the upper, upper right, left, lower left, and upper left of the current block. The size of the template may be preset. For example, when acquiring a left template, the template width (templateW_size) may be set to 4, and when acquiring an upper template, the template height (templateH_size) may be set to 4.
[0208] It is possible to determine which portion of reconstructed pixels to acquire based on the value of refTemplateType. For example, if the value of refTemplateType is 1, reconstructed pixels on the left, upper left, and upper sides of the current block are acquired, or if the value of refTemplateType is 2, only reconstructed pixels on the four columns on the left side of the current block are acquired, or if the value of refTemplateType is 3, only reconstructed pixels on the four rows on the top side of the current block are acquired.
[0209] S804: The MV / BV is refined within a predefined search range around the initial MV / BV to determine a target MV / BV.
[0210] The search process of TM-FLM technology is mainly divided into the initialization process, determination of the template search area, and search and determination of the optimal block vector within the search area. The template search area is within the current image for intra prediction and within the reference image for inter prediction.
[0211] When searching for the optimal matching template within a search area, a search strategy of first performing a rough search and then a fine search may be adopted, or only a fine search may be performed, or only a rough search may be performed, and there are no specific limitations here.
[0212] In the present embodiment, the coarse search here may specifically be determining an optimal coarse matching template in the search area with a first predetermined step size (e.g., 2), or determining an optimal coarse matching template in the search area using a downsampled template (e.g., a downsampling factor of 2).
[0213] In the embodiment of the present application, the fine search here may specifically be determining an optimal fine matching template in the search area with a second predetermined step size (e.g., 1), or determining an optimal fine matching template in the vicinity of the optimal coarse matching template after performing a coarse search.
[0214] As shown in Figure 9, a schematic diagram of a search process based on TM technology according to an embodiment of the present application is shown. As shown in Figure 9, the process includes the following steps:
[0215] S901: Initialize parameters.
[0216] Note that uiPatchWidth is initialized to nTbW+templateW_size, and uiPatchHeight is initialized to nTbH+templateH_size. Here, templateW_size and templateH_size may be fixed constants or may be dynamically adjusted according to the size of the current block. Furthermore, templateW_size and templateH_size may be equal or unequal. For example, if templateW_size=4 and templateH_size=4, or if the width of the current block is greater than 8, set templateW_size=4; if the width of the current block is equal to or less than 8, set templateW_size=2; if the height of the current block is greater than 8, set templateH_size=4; and if the height of the current block is equal to or less than 8, set templateH_size=2.
[0217] 10 shows a schematic diagram of parameter definitions of a current block and its template according to an embodiment of the present application. As shown in FIG. 10, the specific meanings of the parameters are as follows: nTbW and nTbH represent the size of the current block, templateW_size and templateH_size represent the size of the template, and uiPatchWidth and uiPatchHeight represent the size of the block including the current block and its template.
[0218] Furthermore, the cost threshold between the initialization templates is represented by diffThreshold. For example, if the cost function is SAD, the threshold is diffThreshold=((1<<bitDepth)> >2) × (uiPatchHeight × uiPatchWidth - nTbH × nTbW). If the bit depth of the image is 10, diffThreshold indicates that the maximum distortion of each pixel point in the template region is 256.
[0219] Furthermore, the position of the coding tree block CTB where the current block CB is located is initialized to ctbRsX, ctbRsY.
[0220] Furthermore, the position offsets within the current CTB of the current block CB are initialized to offsetLCBY=yTbCmp-ctbRsY, offsetLCBX=xTbCmp-ctbRsX.
[0221] Furthermore, it is initialized to iTemplateSizeH=templateH_size and iTemplateSizeW=templateW_size.
[0222] Furthermore, the precision of the vector parameters is initialized. For example, iMvShift, which is the precision of the motion vector MV / block vector BV, is initialized. An initialization iBvShift can also be defined, where iBvShift is the precision of the block vector BV. For example, the precision of the vector parameters may be integer pixel precision, in which case the precision of the vector parameters is 0, or the precision of the vector parameters may be sub-pixel precision. For example, a precision of 1 for the vector parameters indicates half-pixel precision, and a precision of 2 for the vector parameters indicates quarter-pixel precision, but this is not specifically limited here.
[0223] Furthermore, a predetermined search range of the template is initialized, which may be set to a fixed size, determined by the value of a syntax element in the bitstream, or dynamically adjusted depending on the coding block size, e.g., searchRangeWidth=TMP_SEARCH_RANGE_MULT_FACTOR×nTbW, searchRangeHeight=TMP_SEARCH_RANGE_MULT_FACTOR×nTbH, where the value of TMP_SEARCH_RANGE_MULT_FACTOR may be a predetermined value, e.g., set to 5.
[0224] S902: A search area of the template is determined.
[0225] The search area of the TM is the adjacent area of the reference block pointed to by the initial MV / BV, and the adjacent area is limited by the size of the search range.
[0226] In the inter-correlation technique, the reference block indicated by the MV and the current coding block are in different images. At this time, the reference pixel is fully reconstructed, and the search area can be any position within the reference pixel, with the specific search area being determined by the initial MV. As shown in FIG. 1A, the left area is the reconstructed reference image, the dashed box is the search area, and the grid area on the right area is the current block. During the search process, it is necessary to determine the availability of the reference block. Since the reference image is a reconstructed image, if the search range does not exceed the image boundary, all reference blocks within the search range are available. If the search range exceeds the image boundary, it indicates that the reference block within the search range beyond the image boundary is unavailable. In some embodiments, if a reference block is available, the template corresponding to the reference block is also available; if a reference block is unavailable, the template corresponding to the reference block is also unavailable.
[0227] In IBC-related technologies, the reference block and the current coding block indicated by the BV are in the same image, and the search area may be the reconstructed part of the CTB where the current coding block is located, or it may be another reconstructed CTB area. The specific search area is determined by the initial BV. During the search process, it is necessary to determine whether the pixels within the search area are reconstructed. As shown in FIG. 1B, the background area filled with a dark color is the reconstructed area of the current image, the dashed frame is the search area, and the grid area is the current block. During the search process, it is necessary to determine the availability of the reference block. In some embodiments, for each reference block within the search area, it is first determined whether the pixel in the upper left corner of the reference block is reconstructed. If it is unavailable, it indicates that the reconstructed block is unavailable. If not, it is further determined whether the pixel in the lower right corner of the reference block is reconstructed. If it is unavailable, it indicates that the reconstructed block is unavailable. If the pixel in the lower right corner is also reconstructed, it indicates that the reconstructed block is available.
[0228] The search area for IntraTMP technology is the reconstructed portion of the current image and is limited by the size of the search range. As shown in Figure 11, the background area filled in with dark color is the reconstructed area of the current image, the background block filled in with black is the current block, and the dashed frame is the search range window. The reference block and the current coding block indicated by the BV are located at the same pixel. If the initial BV is 0, the search area is a single search window centered on the current block. The reconstructed sampling points within the search area can include the current CTB and multiple CTBs to the left, upper left, and above, as well as all or part of the CTB. Therefore, the search area for IntraTMP technology is equal to or less than the overlap between the reconstructed area represented by the dark background and the area identified by the dashed frame.
[0229] It is clear from this that the search area of the current block template can be the reconstructed part of the CTB where the current block is located, or can be another reconstructed CTB area. The search area here is actually the set of all search points. Because the shape of this area often cannot be represented by a single rectangular area, in specific implementation, multiple rectangular areas can be searched, and the search results of different areas can be combined to obtain the final best matching block and best block vector.
[0230] For example, taking the above-mentioned Figure 7 as an example, eight different sub-area division methods are shown here, where the black background block is the current block, and the five division methods (a), (b), (c), (d), and (f) all divide the search area into four sub-search areas, and the three division methods (e), (g), and (h) all divide the search area into three sub-search areas, where each different fill pattern represents one sub-search area.
[0231] In Figure 7, (a), (b), (c), and (d) consider all available search ranges, while (e), (f), (g), and (h) do not search the areas directly above and directly to the left.
[0232] For example, assuming that different sub-search areas are represented by regionId, and considering that the template pixels of the current block need to be obtained in the image reconstruction area and the reconstruction block pixels corresponding to the template also need to be obtained in the reconstruction area, it is necessary to further determine searchable positions within the sub-search areas represented by different regionIds based on the position of the current block (xTbCmp, yTbCmp), the size of the current block (nTbW, nTbH), the size of the current image (picWidth, picHeight), the size of the CTB in which the current block is located (CtbSizeW, CtbSizeH), the specified search range of the template (searchRangeWidth, searchRangeHeight), and the position offset of the current block within the current CTB (offsetLCBY, offsetLCBX), thereby determining the block vector BV. Specifically, iVerMin and iVerMax indicate the absolute coordinate positions that can be searched at least vertically and at most vertically, respectively, and iHorMin and iHorMax indicate the absolute coordinate positions that can be searched at least horizontally and at most horizontally. The values of iVerMin, iVerMax, iHorMin, and iHorMax are different for search regions represented by different regionIds.
[0233] Taking the above-mentioned FIG. 7(f) as an example, the search area is divided into four sub-search areas, and the embodiment is as follows: If regionId is equal to 0, iVerMin, iVerMax, iHorMin, iHorMax are iHorMax0= min( (xTbCmp + searchRangeWidth) << iBvShift, ((picWidth - nTbW) << iBvShift) ); iHorMin0= max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ); iVerMax0= (yTbCmp - nTbH - offsetLCBY) << iBvShift; iVerMin0= max( ((iTemplateSizeH) << iBvShift), ((yTbCmp - searchRangeHeight) << iBvShift) ) It can be calculated as follows:
[0234] If regionId is equal to 1, then iVerMin, iVerMax, iHorMin, and iHorMax are iHorMin1= max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ); iHorMax1= (xTbCmp - offsetLCBX - nTbW) << iBvShift; iVerMin1= (yTbCmp + 1) << iBvShift; iVerMax1= min(picHeight - nTbH, (yTbCmp - offsetLCBY + CtbSizeH - nTbH) << iBvShift ) It can be calculated as follows:
[0235] If regionId is equal to 2, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMax2= (xTbCmp - offsetLCBX - nTbW) << iBvShift; iHorMin2= max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ); iVerMin2= max( (iTemplateSizeH) << iBvShift, (yTbCmp - nTbH - offsetLCBY) << iBvShift ); iVerMax2= (yTbCmp) << iBvShift It can be calculated as follows:
[0236] If regionId is equal to 3, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMin3= max( (iTemplateSizeW) << iBvShift, (xTbCmp - offsetLCBX - nTbW + 1) << iBvShift ); iHorMax3= (xTbCmp - nTbW) << iBvShift; iVerMin3= max( ((iTemplateSizeH) << iBvShift), (yTbCmp - offsetLCBY - nTbH + 1) << iBvShift ); iVerMax3= (yTbCmp - nTbH) << iBvShift It can be calculated as follows:
[0237] In practical application, iHorMin regionId , iHorMax regionId , iVerMin regionId , iVerMax regionId represent the left, right, top and bottom edges of different sub-search areas, respectively.
[0238] To intuitively explain the different sub-search areas corresponding to different regionIds, a schematic diagram of the process of determining a specific search area according to an embodiment of the present application is shown in Figure 12. As shown in Figure 12, R1, R2, R3, and R4 represent four different sub-search areas. Note that Figure 12 represents the pixel range in which the pixel in the upper left corner of the block can be aligned.
[0239] S903: The optimum motion vector parameters are searched for and determined within the search area.
[0240] As an example of determining the optimal MV, mvXMins and mvXMaxs respectively represent the minimum and maximum offsets of the horizontal direction of the motion vector, and mvYMins and mvYMaxs respectively represent the minimum and maximum offsets of the vertical direction of the motion vector.
[0241] mvXMins, mvXMaxs, mvYMins, mvYMaxs are calculated by the initial MV / BV and the search ranges searchRangeWidth and searchRangeHeight. mvXMins = (mvXInit - searchRangeWidth)< <iMvShift; mvXMaxs = (mvXInit + searchRangeWidth)< <iMvShift; mvYMins = (mvYInit - searchRangeHeight)< <iMvShift; mvYMaxs = (mvYInit + searchRangeHeight)< <iMvShift is obtained by determining mvXMins, mvXMaxs, mvYMins, mvYMaxs determine the range of horizontal and vertical offsets of the search points relative to the current block, ie the range of the motion vector.
[0242] Using the search points (iPosHor, iPoxVer) in each search area, i.e., each motion vector MV (composed of horizontal and vertical components (pX, pY), where pX = iPosHor-xTbCmp and pY = iPosVer-yTbCmp, pX is between mvXMins and mvXMaxs, and pY is between mvYMins and mvYMaxs), a matching reconstruction block for the current block can be found in the reconstruction area. The neighboring reconstruction pixels of the matching reconstruction block are the matching template (i.e., the second template mentioned above). The matching cost between the neighboring template of the current block and the neighboring template of the reconstructed block (i.e., the reference block) can then be calculated, denoted as pDiff.
[0243] Furthermore, all search points within all search ranges are traversed and compared to obtain the search point with the smallest matching cost value pDiff, and its corresponding matching cost value is denoted as pDiff_BEST, its corresponding vector parameters are denoted as optimal vector parameters, and MV_BEST or BV_BEST specifically includes (pX_BEST, pY_BEST), and its corresponding matching template is the optimal matching template T_BEST.
[0244] All search points within the search range are traversed, their availability is determined, and the search point with the smallest matching cost pDiff is obtained by comparison, and its corresponding matching cost is denoted as pDiff_BEST, its corresponding motion vector MV is denoted as the optimal vector parameter MV_BEST(pX_BEST, pY_BEST), and its corresponding matching template is the optimal matching template T_BEST.
[0245] It should be noted that determining the availability of a search point can be understood as determining the availability of a reference block and a template.
[0246] In some embodiments, determining availability includes: Each sampling point in the template does not exceed the valid coordinate range limited by the image sampling point boundaries; Each sampling point in the reconstruction block corresponding to the template does not exceed a valid coordinate range limited by the image sampling point boundary; Each sampling point in the template and each sampling point in the corresponding reconstruction block do not exceed the specified range of the search window; Whether each sampling point in the template is in the same sub-image (e.g., Tile) as the current coding region; Whether each sampling point in the reconstruction block corresponding to the template is in the same sub-image (e.g., Tile) as the current coding region (also called the current block); All sampling points in the template must be reconstructed. Each sampling point in the reconstruction block corresponding to the template is not in the current coding region, and the restriction conditions for intra prediction do not apply to inter prediction; and All sampling points in the reconstruction block corresponding to the template have been reconstructed. After completing the above operations, the optimal vector parameters (pX_BEST, pY_BEST) can be obtained, where pX_BEST and pY_BEST are respectively the horizontal offset and vertical offset of the optimal matching template relative to the current coding block template in the current image or reference image, and are also the horizontal offset and vertical offset of the optimal matching reconstruction block relative to the current coding block.
[0247] In addition, "each sampling point within the template" in the one or more usability judgment conditions is replaced with "identified sampling points within the template", and "each sampling point within the reconstruction block corresponding to the template" in the one or more usability judgment conditions is replaced with "identified sampling points within the reconstruction block corresponding to the template".
[0248] Note that the identification sampling points may be sampling points at specific predetermined positions in the template or the reconstruction block corresponding to the template. In some embodiments, the identification sampling points in the template refer to one or more sampling points located at corner positions of the template region. For example, if there is only an upper template, the identification sampling points may be the sampling points at the upper left corner and the lower right corner of the upper template region, or only the sampling point at the lower right corner. Here, the identification sampling points in the reconstruction block corresponding to the template refer to one or more sampling points located at corner positions of the reconstruction block region. For example, the identification sampling points may be the sampling points at the upper left corner and the lower right corner of the reconstruction block region, or only the sampling point at the lower right corner of the reconstruction block region.
[0249] For example, when determining an optimal BV using the Intra-TMP technique, bvXMins and bvXMaxs represent the minimum and maximum offsets of the block vector in the horizontal direction, respectively, and bvYMins and bvYMaxs represent the minimum and maximum offsets of the block vector in the vertical direction, respectively.
[0250] bvXMins regionId , bvXMaxs regionId , bvYMins regionId , bvYMaxs regionId is the iVerMin determined in step S902 regionId , iVerMax regionId , iHorMin regionId , iHorMax regionId By bvXMins regionId = iHorMin regionId - xTbCmp; bvXMaxs regionId = iHorMax regionId - xTbCmp; bvYMins regionId = iVerMin regionId - yTbCmp; bvYMaxs regionId= iVerMax regionId - yTbCmp It is calculated as follows:
[0251] In the formula, bvXMins regionId , bvXMaxs regionId , bvYMins regionId and bvYMaxs regionId determines the range of horizontal and vertical offsets of the search point relative to the current block, ie, the range of the block vector BV.
[0252] Note that, using the search points (iPosHor, iPoxVer) in each search area, i.e., each block vector BV (composed of horizontal and vertical components (pX, pY), where pX = iPosHor-xTbCmp and pY = iPosVer-yTbCmp, pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs), a matching reconstruction block for one current block can be found in the reconstruction area, and the neighboring reconstruction pixel of the matching reconstruction block is the matching template (i.e., the second template mentioned above). This allows us to calculate the matching cost value between the neighboring template of the current block and the neighboring template of the matching reconstruction block, denoted as pDiff.
[0253] Furthermore, all search points within all search ranges (regionId=0, 1, 2, 3) are traversed and compared to obtain the search point with the smallest matching cost value pDiff, whose corresponding matching cost value is denoted as pDiff_BEST, whose corresponding block vector BV is denoted as the optimal block vector BV_BEST(pX_BEST, pY_BEST), and whose corresponding matching template is the optimal matching template T_BEST.
[0254] In one possible embodiment, if the search strategy is to perform only a coarse search, the specific implementation is as follows: Within each region, pX is bvXMins regionIdand bvXMaxs regionId While pY is bvYMins regionId and bvYMaxs regionId Within the search range between, a coarse search is performed with a step size greater than 1, for example, a step size of 2, and the optimal matching cost value obtained by template matching is recorded as pDiff_BEST, and the corresponding block vector BV is recorded as the optimal block vector BV_BEST(pX_BEST, pY_BEST).
[0255] In another possible embodiment, if the search strategy is to perform only a fine search, the specific implementation is as follows: Within each region, pX is bvXMins regionId and bvXMaxs regionId While pY is bvYMins regionId and bvYMaxs regionId Within the search range between these, a fine search is performed, for example with a step size of 1, and the optimal matching cost value obtained by template matching is recorded as pDiff_BEST, and the corresponding block vector BV is recorded as the optimal block vector BV_BEST(pX_BEST, pY_BEST).
[0256] In another possible embodiment, if the search strategy is to perform a coarse search first and then a fine search, as shown in FIG. 13, the specific process is as follows:
[0257] S1301: The optimal coarse matching template is determined within the search area with a step size of 2.
[0258] S1302: Determine the optimal fine matching template in the vicinity of the optimal coarse matching template with a step size of 1.
[0259] Regarding step S1301, in the rough search stage, Within each region, pX is bvXMins regionId and bvXMaxs regionIdWhile pY is bvYMins regionId and bvYMaxs regionId A coarse search is performed within the search range between pX1_BEST and pY1_BEST with a step size greater than 1. For example, a coarse search is performed with a step size of 2, and the best matching cost obtained by template matching is recorded as pDiff1_BEST, its corresponding block vector BV is recorded as the best block vector BV1_BEST(pX1_BEST, pY1_BEST), and the search region in which the best matching search point is located is bestRegionId.
[0260] Regarding step S1302, in the detailed search stage, Further search is performed near the optimal block vector BV1_BEST obtained by the coarse search. Specifically, first, a refinement search range TmpRefineRange is determined. The refinement search range may be a fixed size or may be related to the current block size, e.g., min(nTbW, nTbH) / 2. Then, the position of the optimal matching reconstruction block obtained by the coarse search is calculated as the reference position of the fine search area as follows: BestPosX=xTbCmp+pX1_BEST, BestPosY=yTbCmp+pY1_BEST.
[0261] Based on the value of bestRegionId, first calculate iVerMin calculated in step S902. bestRegionId , iVerMax bestRegionId , iHorMin bestRegionId , iHorMax bestRegionId Then, based on the best matching block position obtained in the coarse search, a new search range iVerMin refine , iVerMax refine , iHorMin refine , iHorMax refine The acquisition method is as follows: iHorMin refine = max(iHorMin bestRegionId , BestPosX - TmpRefineRange); iHorMax refine= min(iHorMax bestRegionId , BestPosX + TmpRefineRange); iVerMin refine = max(iVerMin bestRegionId , BestPosY - TmpRefineRange); iVerMax refine = min(iVerMax bestRegionId , BestPosY + TmpRefineRange) Then the adjusted block vectors BVbvXMins, bvXMaxs, bvYMins, bvYMaxs are added to iVerMin refine , iVerMax refine , iHorMin refine , iHorMax refine By bvXMins = iHorMin refine - xTbCmp; bvXMaxs = iHorMax refine - xTbCmp; bvYMins = iVerMin refine - yTbCmp; bvYMaxs = iVerMax refine - yTbCmp It is calculated as In this way, a fine search is performed by finding pX as bvXMins refine and bvXMaxs refine between bvYMins and pYMins refine and bvYMaxs refine For example, a search is performed with a step size of 1, and the optimal matching cost obtained by template matching is recorded as pDiff_BEST, and the corresponding block vector BV is recorded as the optimal block vector BV_BEST(pX_BEST, pY_BEST).
[0262] After completing the above operations, the optimal block vector BV_BEST(pX_BEST, pY_BEST) can be obtained, where pX_BEST and pY_BEST are the horizontal and vertical offsets of the optimal matching template relative to the current block template, and are also the horizontal and vertical offsets of the optimal matching reconstruction block relative to the current block.
[0263] S805: Establish a linear filtering model.
[0264] The optimal matching template obtained in step S804 and the current block template are used to establish a linear filtering model, which mainly includes two processes: determining a reconstruction region for calculating filter coefficients, and calculating filter coefficients.
[0265] The number of filter taps is defined as nTap. nTap may be a constant or a variable, and the number of filter taps can be dynamically adjusted, for example, depending on the size of the current block size. In the embodiment of the present application, filters of various shapes can be selected. For example, six types of fixed-shape filters shown in FIG. 14 can be selected. Here, the number of filter taps nTap in FIG. 14(a) is 5, and the filter coefficients are C0, C1, C2, C3, and C4, respectively. The number of filter taps nTap in FIG. 14(b) is 3, and the filter coefficients are C0, C1, and C2, respectively. The number of filter taps nTap in FIG. 14(c) is 3, and the filter coefficients are C0, C1, and C2, respectively. The number of filter taps nTap in FIG. 14(d) is 3, and the filter coefficients are C0, C1, and C2, respectively. The number of filter taps nTap in FIG. 14(e) is 3, and the filter coefficients are C0, C1, and C2, respectively. The number of filter taps nTap in (f) of Figure 14 is 9, and the filter coefficients are C0, C1, C2, C3, C4, C5, C6, C7, and C8, respectively. The filter shapes and coefficients in Figure 14 are merely illustrative and do not limit the embodiments of the present application.
[0266] A schematic diagram of the process of calculating filter coefficients according to an embodiment of the present application is shown in Figure 15. As shown in Figure 15, the process includes the following steps:
[0267] S1501: A reconstruction region for calculating filter coefficients is determined.
[0268] In the embodiment of the present application, available reconstructed pixels are determined in accordance with the template type refTemplateType. For example, when the template type refTemplateType is 1, this indicates that the adjacent left reconstructed pixel, upper left reconstructed pixel, and upper reconstructed pixel are all available, as shown in FIG. 10 described above. In this case, the number of available reconstructed pixels on the left side is templateW_size×nTbH, the number of available reconstructed pixels on the upper side is templateH_size×nTbW, and the number of available reconstructed pixels on the upper left side is templateW_size×templateH_size.
[0269] In the present embodiment, after determining the number of available reconstruction pixels, a reconstruction region for calculating filter coefficients is determined based on the available reconstruction pixels. This region may be referred to as R. R typically includes all available reconstruction pixels in the template. For example, when refTemplateType is 1, R may include all reconstruction pixels on the left, upper left, and upper sides.
[0270] S1502: Calculate filter coefficients based on the reconstruction region.
[0271] JPEG2024152385000015.jpg127168
[0272] JPEG2024152385000016.jpg50168
[0273] JPEG2024152385000017.jpg62168
[0274] JPEG2024152385000018.jpg33168
[0275] JPEG2024152385000019.jpg38168
[0276] In some embodiments, it is necessary to further fill boundary pixels, because the filter may use reconstructed pixels other than the reference template and the reference block, and the area that needs to be filled in the boundary is different according to different filter shapes. The method mainly includes two processes: determining the boundary filling area of the reference template corresponding to the reference block, and performing boundary pixel filling on the boundary filling area.
[0277] In some embodiments, the boundary filling region comprises at least one of an edge-adjacent region of the matching template, a point-adjacent region of the matching template, an edge-adjacent region of the reference block, and a point-adjacent region of the reference block.
[0278] In some embodiments, performing boundary pixel filling on the boundary filling region comprises performing boundary pixel filling on a first boundary filling region corresponding to the matching template using neighboring pixel reconstruction values in the matching template, and / or performing boundary pixel filling on a second boundary filling region corresponding to the reference template using neighboring pixel reconstruction values in the reference block.
[0279] In some embodiments, a sampling point at a first location within the boundary fill region is determined to be unavailable, and boundary pixel filling is performed for the first location within the boundary fill region.
[0280] In some embodiments, the criteria for determining whether a sampling point is available include at least one of: the sampling point at the first location is reconstructed; the first location is located within a search area; the first location is located within an image in which the reference block is located; and the first location is located within a sub-image in which the reference block is located.
[0281] In some embodiments, performing boundary pixel filling on the boundary filling region includes performing boundary pixel filling on the boundary filling region using a predetermined pixel value, where the predetermined pixel value is 0 or a pixel value determined by a decision on the encoding side.
[0282] In some embodiments, the boundary filling region is determined according to the shape of the filter. Figure 16A is a schematic diagram of a boundary filling region that fills the entire outer boundary region of a reference block and its reference template, including edge-adjacent regions and point-adjacent regions. Figure 16B is a schematic diagram of a boundary filling region that fills the outer boundary region of an edge-adjacent reference block and its reference template.
[0283] The width of the outer boundary region is a predetermined width. For example, the width of the outer boundary region may be any number from 1 to N in units of pixels or sub-pixels.
[0284] Figure 17 is a schematic diagram of the boundary fill regions for other template types; when the value of refTemplateType is 4, the boundary fill regions are as shown in Figure 17(a)(d); when the value of refTemplateType is 5, the boundary fill regions are as shown in Figure 17(b)(e); and when the value of refTemplateType is 6, the boundary fill regions are as shown in Figure 17(c)(f).
[0285] There are also various methods of filling.
[0286] One filling method is to determine whether the sampling points in the outer boundary filling region are available, and if so, to directly use the reconstructed pixels; if not, to copy the reconstructed pixels of the adjacent reference template or reference block to fill the corresponding positions.
[0287] Another filling method is to determine whether the search sampling point is within the search range, and if it is within the search range, use the reconstructed pixels directly; if it is beyond the search range, copy the reconstructed pixels of the adjacent reference template or reference block depending on the direction beyond the search range to fill the corresponding position.
[0288] Yet another filling method is to fill the boundary fill region by directly copying the reconstructed pixels of the neighboring reference template or reference block.
[0289] Alternatively, it is possible to not perform filling and, when a boundary position is reached, to abandon the participation of the corresponding data in the calculation. The determination of the availability of a sampling point within the outer boundary filling region includes, but is not limited to, one or more of the following conditions: the sampling point at this position is a reconstructed one; this position does not exceed the MV / BV search range; this position does not exceed the image boundary; and this position does not exceed the Tile boundary.
[0290] S806: A predicted value is generated.
[0291] JPEG2024152385000020.jpg69168
[0292] The specific calculation process for the predicted value is as follows.
[0293] JPEG2024152385000021.jpg60168
[0294] JPEG2024152385000022.jpg59168
[0295] JPEG2024152385000023.jpg15166
[0296] JPEG2024152385000024.jpg46166
[0297] It can be understood that in the embodiment of the present application, a linear filtering model is established between the optimal matching template obtained by searching near the initial vector parameters and the current block template, and the filter coefficients are calculated by minimizing the MSE between the predicted template (predicted template = filter coefficients × matching template) and the current block template, and filtering correction is performed on the optimal matching block, and the filtered reconstructed pixel is used as the final predicted pixel.
[0298] In some embodiments, the input information used to calculate the filter coefficients in the above-described embodiments may be expanded, where the input information for calculating the filter coefficients may be the available reconstructed pixels of the matching template, or the gradient of each pixel in the matching template, including but not limited to horizontal gradient, vertical gradient, etc., may be calculated and the calculated gradient may be used as the input information for calculating the filter coefficients, or the position information of each pixel may be used as the input information for calculating the filter, where the position information may be the absolute position information of each pixel in the entire image or the relative position information of each pixel with respect to a reference sample.
[0299] JPEG2024152385000025.jpg65168
[0300] JPEG2024152385000026.jpg80168
[0301] In some embodiments, the number of filtering models in the above-described embodiments may be expanded. Among them, only one linear filtering model may be established, or multiple linear filtering models may be established. Here, the input information for calculating the filter coefficients is classified, and a filter model is established for each type of input information. For example, when using the reconstructed information to establish a filter model, one possible embodiment is to classify the reconstructed information according to its average value, and establish one model for reconstructed information greater than the average value, and another model for reconstructed information less than the average value.
[0302] Another possible embodiment is to classify according to the position of the reconstruction information, for example, one model can be established using available reconstruction information on the left and upper side, and a second model can be established using available reconstruction information on the left and upper left side, and the encoding side decides which model to use. One possible decision method is for the encoding side to decide which model to use by rate-distortion optimization and transmit corresponding decoding parameters (e.g., flag) to the decoding side.
[0303] Another possible embodiment is to classify by filter shape, and multiple filters of different shapes can be used, and a filter model is established for each filter shape. The encoding side determines which filter shape to use, and one possible determination method is that the encoding side determines which filter to use by rate-distortion optimization, and transmits corresponding decoding parameters (such as flags) to the decoding side.
[0304] JPEG2024152385000027.jpg71168
[0305] In some embodiments, the part of calculating the predicted value in the above embodiment may be extended to determine whether the current block uses the filtered reference block as the final predicted value based on a specific condition. For example, the following methods may be used: Method 1: determining whether to filter the matching template by comparing the distortion of the matching template and the current block template, such as SAD or MSE or SATD or SSE, with a threshold T_Distortion1; Method 2, which satisfies the requirement of using a filter model in Method 1, and determines whether to filter the reference block according to the distortion between the filtered matching template and the current block template, such as SAD, MSE, SATD, or SSE, and a threshold T_Distortion2; and In Method 3, the encoding side transmits a Flag to indicate whether to apply a filter model. tmpFlag indicates whether to apply intra-template matching to the current coding block, and filterFlag indicates whether to apply a filter model to the current block. If tmpFlag is 1, the encoding side determines whether to filter the reference block by comparing the distortion between the reference block and the source block before and after filtering, such as SAD, MSE, SATD, or SSE. If the distortion after filtering is smaller than the distortion before filtering, filterFlag is 1, and the current block uses the filtered reference block as its predicted block; otherwise, filterFlag is 0, and the current block uses the unfiltered reference block as its predicted block, and the encoding side transmits filterFlag to the decoding side.
[0306] In some embodiments, the implementation is similar to that of FIG. 7(a), where the search area is divided into four sub-search areas: If regionId is equal to 0, iVerMin, iVerMax, iHorMin, iHorMax are iHorMax = min( (xTbCmp + searchRangeWidth) << iBvShift, ((picWidth - nTbW) << iBvShift) ); iHorMin = max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ); iVerMax = (yTbCmp - nTbH - offsetLCBY) << iBvShift; iVerMin = max( ((iTemplateSizeH) << iBvShift), ((yTbCmp - searchRangeHeight) << iBvShift) ) It can be calculated as follows:
[0307] If regionId is equal to 1, then iVerMin, iVerMax, iHorMin, and iHorMax are iHorMin = max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ); iHorMax = (xTbCmp - offsetLCBX - nTbW) << iBvShift; iVerMin = (yTbCmp + 1) << iBvShift; iVerMax = min(picHeight - nTbH, (yTbCmp - offsetLCBY + CtbSizeH - nTbH) << iBvShift ), It can be calculated as follows:
[0308] If regionId is equal to 2, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMax = (xTbCmp - nTbW) << iBvShift; iHorMin = max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ); iVerMin = max( (iTemplateSizeH) << iBvShift, (yTbCmp - nTbH) << iBvShift ); iVerMax = (yTbCmp) << iBvShift, It can be calculated as follows:
[0309] If regionId is equal to 3, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMin = max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ); iHorMax = (xTbCmp) << iBvShift; iVerMin = max( ((iTemplateSizeH) << iBvShift), (yTbCmp - offsetLCBY - nTbH + 1) << iBvShift ); iVerMax = (yTbCmp - nTbH) << iBvShift, It can be calculated as follows:
[0310] In practical applications, iHorMin, iHorMax, iVerMin, iVerMax here represent the left edge, right edge, top edge, and bottom edge of different search regions, respectively.
[0311] To intuitively explain the different sub-search areas corresponding to different regionIds, a schematic diagram of the process of determining a specific search area according to an embodiment of the present application is shown in Figure 19A. As shown in Figure 19A, R1, R2, R3, and R4 represent four different sub-search areas. Note that Figure 19A represents the pixel range in which the pixel in the upper left corner of the block can be aligned.
[0312] In some embodiments, the search area within the template image provided here may be different from the search area within the template image determined by existing TM techniques. Here, a different implementation is implemented for the above-mentioned Figure 7(b), dividing it into a total of four sub-search areas: If regionId is equal to 0, iVerMin, iVerMax, iHorMin, iHorMax are iHorMax = min( (xTbCmp + searchRangeWidth) << iBvShift, ((picWidth - nTbW) << iBvShift) ); iHorMin = max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ); iVerMax = (yTbCmp - nTbH - offsetLCBY) << iBvShift; iVerMin = max( ((iTemplateSizeH) << iBvShift), ((yTbCmp - searchRangeHeight) << iBvShift) ), It can be calculated as follows:
[0313] If regionId is equal to 1, then iVerMin, iVerMax, iHorMin, and iHorMax are iHorMin = max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ); iHorMax = (xTbCmp - offsetLCBX - nTbW) << iBvShift; iVerMin = (yTbCmp + 1) << iBvShift; iVerMax = min(picHeight - nTbH, (yTbCmp - offsetLCBY + CtbSizeH - nTbH) << iBvShift ), It can be calculated as follows:
[0314] If regionId is equal to 2, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMax = (xTbCmp - nTbW) << iBvShift; iHorMin = max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ); iVerMin = max( (iTemplateSizeH) << iBvShift, (yTbCmp - nTbH - offsetLCBY) << iBvShift ); iVerMax = (yTbCmp) << iBvShift, It can be calculated as follows:
[0315] If regionId is equal to 3, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMin = max( (iTemplateSizeW) << iBvShift, (xTbCmp - nTbW + 1) << iBvShift ); iHorMax = (xTbCmp) << iBvShift; iVerMin = max( ((iTemplateSizeH) << iBvShift), (yTbCmp - offsetLCBY - nTbH + 1) << iBvShift ); iVerMax = (yTbCmp - nTbH) << iBvShift, It can be calculated as follows:
[0316] In practical applications, iHorMin, iHorMax, iVerMin, iVerMax here represent the left edge, right edge, top edge, bottom edge of different search regions, respectively.
[0317] To intuitively explain the different sub-search areas corresponding to different regionIds, a schematic diagram of the process of determining a specific search area according to an embodiment of the present application is shown in Figure 19B. As shown in Figure 19B, R1, R2, R3, and R4 represent four different sub-search areas. Note that Figure 19B represents the pixel range in which the pixel in the upper left corner of the block can be aligned.
[0318] In some embodiments, the coarse search process can be consistent with the above-described embodiment, while the fine search process can be performed in a manner at the boundaries of each region, that is, the present invention extends the technical solution to perform a fine search across the boundaries between each search region. In the present embodiment, the method includes: performing a first search within each of at least one sub-search area to determine a respective optimal block vector for each sub-search area and a corresponding second search area; performing region determination based on the respective best block vectors of each sub-search region and the corresponding second search region to determine at least two target sub-search regions involved in the second search; performing a second search within the at least two target sub-search regions to determine optimal block vectors corresponding to the at least two target sub-search regions; and determining the optimal block vectors corresponding to the at least two target sub-search regions as target block vectors.
[0319] For example, taking FIG. 7(a) as an example, another implementation is provided here, which is specifically implemented by dividing the search area into a total of four sub-search areas: If regionId is equal to 0, iVerMin, iVerMax, iHorMin, iHorMax are iHorMax0= min( (xTbCmp + searchRangeWidth) << iBvShift, ((picWidth - nTbW) << iBvShift) ); iHorMin0= max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ); iVerMax0= (yTbCmp - nTbH - offsetLCBY) << iBvShift; iVerMin0= max( ((iTemplateSizeH) << iBvShift), ((yTbCmp - searchRangeHeight) << iBvShift) ), It can be calculated as follows:
[0320] If regionId is equal to 1, then iVerMin, iVerMax, iHorMin, and iHorMax are iHorMin1= max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ); iHorMax1= (xTbCmp - offsetLCBX - nTbW) << iBvShift; iVerMin1= (yTbCmp + 1) << iBvShift; iVerMax1= min(picHeight - nTbH, (yTbCmp - offsetLCBY + CtbSizeH - nTbH) << iBvShift ), It can be calculated as follows:
[0321] If regionId is equal to 2, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMax2= (xTbCmp - nTbW) << iBvShift; iHorMin2= max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ); iVerMin2= max( (iTemplateSizeH) << iBvShift, (yTbCmp - nTbH) << iBvShift ); iVerMax2= (yTbCmp) << iBvShift, It can be calculated as follows:
[0322] If regionId is equal to 3, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMin3= max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ); iHorMax3= (xTbCmp) << iBvShift; iVerMin3= max( ((iTemplateSizeH) << iBvShift), (yTbCmp - offsetLCBY - nTbH + 1) << iBvShift ); iVerMax3= (yTbCmp - nTbH) << iBvShift, It can be calculated as follows:
[0323] In practical applications, iHorMin, iHorMax, iVerMin, iVerMax here represent the left edge, right edge, top edge, bottom edge of different search regions, respectively.
[0324] To intuitively explain the different sub-search areas corresponding to different regionIds, Figure 19C shows a schematic diagram of another specific search area determination process according to an embodiment of the present application. As shown in Figure 19C, R1, R2, R3, and R4 represent four different sub-search areas, and further fine-grained searches are performed across the boundaries between each sub-search area. Note that Figure 19C represents the pixel range in which the pixel in the upper left corner of the block can be aligned.
[0325] In some embodiments, based on the consideration of the total reconstructed search area and the reconstructed search area, taking FIG. 7(a) as an example, the search area is divided into six sub-search areas, and the embodiments are as follows: If regionId is equal to 0, iVerMin, iVerMax, iHorMin, iHorMax are iHorMax0= min( (xTbCmp + searchRangeWidth) << iBvShift, ((picWidth - nTbW) << iBvShift) ); iHorMin0= max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ); iVerMax0= (yTbCmp - nTbH - offsetLCBY) << iBvShift; iVerMin0= max( ((iTemplateSizeH) << iBvShift), ((yTbCmp - searchRangeHeight) << iBvShift) ), It can be calculated as follows:
[0326] If regionId is equal to 1, then iVerMin, iVerMax, iHorMin, and iHorMax are iHorMin1= max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ); iHorMax1= (xTbCmp - offsetLCBX - nTbW) << iBvShift; iVerMin1= (yTbCmp + 1) << iBvShift; iVerMax1= min( (picHeight - nTbH)< <iBvShift, (yTbCmp - offsetLCBY + CtbSizeH - nTbH) << iBvShift )、 It can be calculated as follows:
[0327] If regionId is equal to 2, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMax2= (xTbCmp - offsetLCBX - nTbW) << iBvShift; iHorMin2= max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ); iVerMin2= max( (iTemplateSizeH) << iBvShift, (yTbCmp - nTbH - offsetLCBY) << iBvShift ); iVerMax2= (yTbCmp) << iBvShift, It can be calculated as follows:
[0328] If regionId is equal to 3, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMin3= max( (iTemplateSizeW) << iBvShift, (xTbCmp - offsetLCBX - nTbW + 1) << iBvShift ); iHorMax3= (xTbCmp - nTbW) << iBvShift; iVerMin3= max( ((iTemplateSizeH) << iBvShift), (yTbCmp - offsetLCBY - nTbH + 1) << iBvShift ); iVerMax3= (yTbCmp - nTbH) << iBvShift, It can be calculated as follows:
[0329] If regionId is equal to 4, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMin = (xTbCmp - offsetLCBX - nTbW) << iBvShift; iHorMax =(xTbCmp - nTbW) << iBvShift; iVerMin = (yTbCmp + 1) << iBvShift; iVerMax = min((picHeight - nTbH)< <iBvShift, (yTbCmp - offsetLCBY + CtbSizeH - nTbH) << iBvShift )、 It can be calculated as follows:
[0330] If regionId is equal to 5, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMin = (xTbCmp) << iBvShift; iHorMax = min((xTbCmp+ CtbSizeW-nTbW)< <iBvShift, min( (xTbCmp + searchRangeWidth) << iBvShift, ((picWidth - nTbW) << iBvShift))); iVerMin = max( ((iTemplateSizeH) << iBvShift), (yTbCmp - offsetLCBY - nTbH + 1) << iBvShift ); iVerMax = (yTbCmp - nTbH) << iBvShift, It can be calculated as follows:
[0331] In practical application, iHorMin regionId , iHorMax regionId , iVerMin regionId , iVerMax regionId represent the left, right, top and bottom edges of different sub-search areas, respectively.
[0332] To intuitively explain the different sub-search areas corresponding to different regionIds, Figure 19D shows a schematic diagram 4 of the search area determination process. As shown in Figure 19D, R1, R2, R3, R4, R5, and R6 represent six different sub-search areas, where R1, R2, R3, and R4 are the full reconstruction search area, and R5 and R6 are the search areas pending reconstruction. Note that Figure 19D represents the pixel range in which the pixel in the upper left corner of the block can be aligned.
[0333] That is, in some embodiments, the search area is divided into two types: one is to determine that all sampling points within the area have been reconstructed (called a full reconstruction search area), for example, including the four areas R1, R2, R3, and R4 in FIG. 19D; and the other is to not determine whether all sampling points within the area have been reconstructed (called a reconstruction pending search area), for example, including the two areas R5 and R6 in FIG. 19D.
[0334]
[0335]
[0336] In some embodiments, based on the consideration of the total reconstructed search area and the reconstructed search area, taking FIG. 7(b) as an example, the search area is divided into six sub-search areas, and the embodiments are as follows: If regionId is equal to 0, iVerMin, iVerMax, iHorMin, iHorMax are iHorMax = min( (xTbCmp + searchRangeWidth) << iBvShift, ((picWidth - nTbW) << iBvShift) ) iHorMin = max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ) iVerMax = (yTbCmp - nTbH - offsetLCBY) << iBvShift iVerMin = max( ((iTemplateSizeH) << iBvShift), ((yTbCmp - searchRangeHeight) << iBvShift) ), It can be calculated as follows:
[0337] If regionId is equal to 1, then iVerMin, iVerMax, iHorMin, and iHorMax are iHorMin = max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ) iHorMax = (xTbCmp - offsetLCBX - nTbW) << iBvShift; iVerMin = (yTbCmp + 1) << iBvShift; iVerMax = min(picHeight - nTbH, (yTbCmp - offsetLCBY + CtbSizeH - nTbH) << iBvShift ), It can be calculated as follows:
[0338] If regionId is equal to 2, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMax = (xTbCmp - nTbW) << iBvShift; iHorMin = max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ); iVerMin = max( (iTemplateSizeH) << iBvShift, (yTbCmp - nTbH - offsetLCBY) << iBvShift ); iVerMax = (yTbCmp) << iBvShift, It can be calculated as follows:
[0339] If regionId is equal to 3, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMin = max( (iTemplateSizeW) << iBvShift, (xTbCmp - nTbW + 1) << iBvShift ); iHorMax = (xTbCmp) << iBvShift; iVerMin = max( ((iTemplateSizeH) << iBvShift), (yTbCmp - offsetLCBY - nTbH + 1) << iBvShift ); iVerMax = (yTbCmp - nTbH) << iBvShift, It can be calculated as follows:
[0340] If regionId is equal to 4, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMin = (xTbCmp - offsetLCBX - nTbW) << iBvShift; iHorMax =(xTbCmp - nTbW) << iBvShift; iVerMin = (yTbCmp + 1) << iBvShift; iVerMax = min(picHeight - nTbH, (yTbCmp - offsetLCBY + CtbSizeH - nTbH) << iBvShift ), It can be calculated as follows:
[0341] If regionId is equal to 5, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMin = (xTbCmp) << iBvShift; iHorMax = min((xTbCmp+ CtbSizeW-nTbW)< <iBvShift, min( (xTbCmp + searchRangeWidth) << iBvShift, ((picWidth - nTbW) << iBvShift))); iVerMin = max( ((iTemplateSizeH) << iBvShift), (yTbCmp - offsetLCBY - nTbH + 1) << iBvShift ); iVerMax = (yTbCmp - nTbH) << iBvShift, It can be calculated as follows:
[0342] In practical application, iHorMinregionId, iHorMaxregionId, iVerMinregionId, iVerMaxregionId here represent the left edge, right edge, top edge, and bottom edge of different sub-search regions, respectively.
[0343] To intuitively explain the different sub-search areas corresponding to different regionIds, Figure 19E shows a schematic diagram 5 of the search area determination process. As shown in Figure 19E, R1, R2, R3, R4, R5, and R6 represent six different sub-search areas, where R1, R2, R3, and R4 are the full reconstruction search area, and R5 and R6 are the search areas pending reconstruction. Note that Figure 19E represents the pixel range in which the pixel in the upper left corner of the block can be aligned.
[0344] That is, in some embodiments, the search area is divided into two types: one is to determine that all sampling points within the area have been reconstructed (called a full reconstruction search area), for example, including the four areas R1, R2, R3, and R4 in FIG. 19E; and the other is to not determine whether all sampling points within the area have been reconstructed (called a reconstruction pending search area), for example, including the two areas R5 and R6 in FIG. 19E.
[0345] In some embodiments, based on consideration of the total reconstruction search area and the search area to be reconstructed, the search area is divided into six sub-search areas, taking FIG. 7C as an example. To intuitively explain the different sub-search areas corresponding to different regionIds, FIG. 19F is a schematic diagram 6 of the search area determination process. As shown in FIG. 19F, R1, R2, R3, R4, R5, and R6 represent the six different sub-search areas, where R1, R2, R3, and R4 are the total reconstruction search area, and R5 and R6 are search areas pending reconstruction. Note that in FIG. 19F, the pixel in the upper left corner of the block is represented as the alignable pixel range.
[0346] That is, in some embodiments, the search area is divided into two types: one is to determine that all sampling points within the area have been reconstructed (called a full reconstruction search area), for example, including the four areas R1, R2, R3, and R4 in FIG. 19F; and the other is to not determine whether all sampling points within the area have been reconstructed (called a reconstruction pending search area), for example, including the two areas R5 and R6 in FIG. 19F.
[0347] In some embodiments, the search area is divided into six sub-search areas based on the consideration of the total reconstruction search area and the search area to be reconstructed, as shown in FIG. 7(d) as an example. To intuitively explain the different sub-search areas corresponding to different regionIds, FIG. 19G is a schematic diagram 7 of the search area determination process. As shown in FIG. 19G, R1, R2, R3, R4, R5, and R6 represent the six different sub-search areas, where R1, R2, R3, and R4 represent the total reconstruction search area, and R5 and R6 represent the search area pending reconstruction. Note that in FIG. 19G, the pixel in the upper left corner of the block is represented as the alignable pixel range.
[0348] That is, in some embodiments, the search area is divided into two types: one is to determine that all sampling points within the area have been reconstructed (called a full reconstruction search area), for example, including the four areas R1, R2, R3, and R4 in FIG. 19F; and the other is to not determine whether all sampling points within the area have been reconstructed (called a reconstruction pending search area), for example, including the two areas R5 and R6 in FIG. 19G.
[0349] Furthermore, in the embodiments of the present application, in order to realize fewer search areas to reduce the amount of code, the number of search areas can be reduced by selectively merging some of the full reconfiguration search areas and some of the reconfiguration pending search areas to form new reconfiguration pending search areas.
[0350] In some embodiments, based on the consideration of the total reconfigured search area and the search area to be reconfigured, taking FIG. 7(a) as an example, the search area is divided into seven sub-search areas, and the embodiments are as follows: If regionId is equal to 0, iVerMin, iVerMax, iHorMin, iHorMax are iHorMax = min( (xTbCmp + searchRangeWidth) << iBvShift, ((picWidth - nTbW) << iBvShift) ) iHorMin = max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ) iVerMax = (yTbCmp - nTbH - offsetLCBY) << iBvShift iVerMin = max( ((iTemplateSizeH) << iBvShift), ((yTbCmp - searchRangeHeight) << iBvShift) ), It can be calculated as follows:
[0351] If regionId is equal to 1, then iVerMin, iVerMax, iHorMin, and iHorMax are iHorMin = max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ) iHorMax = (xTbCmp - offsetLCBX - nTbW) << iBvShift; iVerMin = (yTbCmp + 1) << iBvShift; iVerMax = min(picHeight - nTbH, (yTbCmp - offsetLCBY + CtbSizeH - nTbH) << iBvShift ), It can be calculated as follows:
[0352] If regionId is equal to 2, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMax = (xTbCmp - nTbW) << iBvShift; iHorMin = max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ); iVerMin = max( (iTemplateSizeH) << iBvShift, (yTbCmp - nTbH) << iBvShift ); iVerMax = (yTbCmp) << iBvShift, It can be calculated as follows:
[0353] If regionId is equal to 3, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMin = max( (iTemplateSizeW) << iBvShift, (xTbCmp - searchRangeWidth) << iBvShift ); iHorMax = (xTbCmp) << iBvShift; iVerMin = max( ((iTemplateSizeH) << iBvShift), (yTbCmp - offsetLCBY - nTbH + 1) << iBvShift ); iVerMax = (yTbCmp - nTbH) << iBvShift, It can be calculated as follows:
[0354] If regionId is equal to 4, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMin = (xTbCmp - offsetLCBX - nTbW) << iBvShift; iHorMax =(xTbCmp - nTbW) << iBvShift; iVerMin = (yTbCmp + 1) << iBvShift; iVerMax = min(picHeight - nTbH, (yTbCmp - offsetLCBY + CtbSizeH - nTbH) << iBvShift ), It can be calculated as follows:
[0355] If regionId is equal to 5, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMin = (xTbCmp) << iBvShift; iHorMax = min((xTbCmp+ CtbSizeW-nTbW)< <iBvShift, min( (xTbCmp + searchRangeWidth) << iBvShift, ((picWidth - nTbW) << iBvShift))); iVerMin = max( ((iTemplateSizeH) << iBvShift), (yTbCmp - offsetLCBY - nTbH + 1) << iBvShift ); iVerMax = (yTbCmp - nTbH) << iBvShift, It can be calculated as follows:
[0356] If regionId is equal to 6, then iVerMin, iVerMax, iHorMin, iHorMax are iHorMax = (xTbCmp) << iBvShift; iHorMin = (xTbCmp - nTbW) << iBvShift; iVerMin = max( (iTemplateSizeH) << iBvShift, (yTbCmp - nTbH) << iBvShift ); iVerMax = (yTbCmp) << iBvShift, It can be calculated as follows:
[0357] In practical application, iHorMin regionId , iHorMax regionId , iVerMin regionId , iVerMax regionId represent the left, right, top and bottom edges of the different sub-search areas, respectively.
[0358] To intuitively explain the different sub-search areas corresponding to different regionIds, Figure 19H shows a schematic diagram 8 of the search area determination process. As shown in Figure 19H, R1, R2, R3, R4, R5, R6, and R7 represent seven different sub-search areas, where R1, R2, R3, R4, and R7 are the full reconstruction search area, and R5 and R6 are the search areas pending reconstruction. Note that Figure 19H represents the pixel range in which the pixel in the upper left corner of the block can be aligned.
[0359] Note that in the embodiment of the present invention, when the search region R7, i.e., regionId is equal to 6, the search point at the bottom right corner of R7 is skipped during the search process because the point overlaps with the top left corner of the current block.
[0360] For example, in the present application, when determining the predicted value of the current block, for R1 to R6 that do not have an overlapping area with the current block, a simple translation copy can be used. The specific operation is as follows: For x=0...nTbW-1 and y=0...nTbH-1, predSamples[x][y]=recSamples[x+pX_BEST][y+pY_BEST] where recSamples represents the reconstructed pixels of the current frame.
[0361] For example, in one embodiment of the present application, when determining the predicted value of the current block, it can be realized by using repeat copy filling for R7, which has an overlapping area with the current block. The BV of this area satisfies the requirements of pX_BEST=-nTbW+1...0 and pY_BEST=-nTbH+1...0, and pX_BEST and pY_BEST are not 0 at the same time. The specific operation is as follows: For x=0...-pX_BEST-1, y=0...-pY_BEST-1, predSamples[x][y]=recSamples[x+pX_BEST][y+pY_BEST] where recSamples represents the reconstructed pixels of the current frame; For x=pX_BEST-1…nTbW-1 and y=pY_BEST-1…nTbH-1, predSamples[x][y]=predSamples[x+pX_BEST][y+pY_BEST].
[0362] The fine search stage searches the neighborhood of each block vector obtained in the coarse search: Furthermore, the best block vector BV1_BEST obtained by the rough search k Specifically, first, a refinement search range TmpRefineRange is determined. The refinement search range may be fixed or related to the size of the current block, e.g., min(nTbW, nTbH) / 2. Then, the position of the best matching reconstruction block obtained by the coarse search is calculated as the reference position of the fine search area as follows: BestPosX k =xTbCmp+pX1_BEST k , BestPosY k =yTbCmp+pY1_BEST k .
[0363] Furthermore, the refined search performed according to each BestPosXk can span multiple domains: Determine the value of bestRegionId involved in the operation: Check regionId=0, 1, 2, 3 in order: BestPosY k -TmpRefineRange>=iVerMin regionId , and BestPosY k -TmpRefineRange<=iVerMax regionId , or BestPosY k +TmpRefineRange>=iVerMin regionId , and BestPosY k +TmpRefineRange<=iVerMax regionId , or BestPosY k-TmpRefineRange<=iVerMin regionId , and BestPosY k +TmpRefineRange>=iVerMax regionId in the case of, This regionId is used in conjunction with the corresponding bestSearchFlag regionId Set to 1.
[0364] Here, bestSearchFlag regionId For each search region where the value of is 1, we sequentially set bestRegionId as the regionId of that region and perform a fine search as follows, specifically: First, based on the value of bestRegionId, first calculate the iVerMin calculated above. bestRegionId , iVerMax bestRegionId , iHorMin bestRegionId , iHorMax bestRegionId Then, based on the best matching block position obtained in the coarse search, a new search range iVerMin refine , iVerMax refine , iHorMin refin e, iHorMax refine The acquisition method is as follows: iHorMin refine =max(iHorMin bestRegionId ,BestPosX-TmpRefineRange), iHorMax refine =min(iHorMax bestRegionId ,BestPosX+TmpRefineRange), iVerMin refine =max(iVerMin bestRegionId ,BestPosY-TmpRefineRange), iVerMax refine =min(iVerMax bestRegionId ,BestPosY+TmpRefineRange) Then the adjusted block vectors BVbvXMins, bvXMaxs, bvYMins, bvYMaxs are added to iVerMin refine , iVerMax refine , iHorMin refine , iHorMax refine By bvXMins=iHorMin refine -xTbCmp; bvXMaxs=iHorMax refine -xTbCmp; bvYMins=iVerMin refine -yTbCmp; bvYMaxs=iVerMax refine -yTbCmp, calculated as In this way, a fine search is performed by finding pX as bvXMins refine and bvXMaxs refine between bvYMins and pYMins refine and bvYMaxs refine For example, a search is performed with a step size of 1, and the optimal matching cost obtained by template matching is recorded as pDiff_BEST. The corresponding block vector BV is recorded as the optimal block vector BV_BEST(pX_BEST, pY_BEST), and the optimal block vector for the multiple regions involved in the search is obtained.
[0365] After completing the above operations, we can obtain the component block vector BV_BEST(pX_BEST, pY_BEST), where pX_BEST and pY_BEST are the horizontal and vertical offsets of the best matching template relative to the current block template, and also the horizontal and vertical offsets of the best matching block relative to the current block.
[0366] As can be seen from the above, the embodiments of the present application propose an intra template matching technology based on a linear filtering model (Intra TMP-FLM), which establishes a linear filtering model using a matching template and template information of a current block, fully utilizes the correlation between the matching template and the current coding block template, performs filtering correction on the reconstructed pixels of the optimal matching block (i.e., reference block), and uses the filtered reconstructed pixels as predicted pixels, thereby improving prediction accuracy to a certain extent and effectively solving the problem of linear variation between the optimal matching block and the current block.
[0367] In the embodiments of the present application, the specific implementation of the above-mentioned embodiments is described in detail through the above-mentioned embodiments, and it can be seen that the technical solution of the above-mentioned embodiments can effectively modify the predicted value of template matching technology, thereby improving prediction accuracy. Specifically, a linear filtering model is established between the optimal matching template obtained by searching for initial vector parameters and the template of the current block, and the filter coefficient is calculated by minimizing the MSE between the predicted template (prediction template = filter coefficient × matching template) and the template of the current coding block, and this filter coefficient fully reflects the correlation between the matching template and the template of the current block, and this correlation is applied to the optimal matching block, and its reconstructed pixels are filtered and corrected, and finally the filtered reconstructed pixels are used as predicted pixels, thereby improving prediction accuracy.
[0368] In another embodiment of the present application, a schematic diagram of a flowchart of an encoding method according to an embodiment of the present application is shown, as shown in Figure 20. As shown in Figure 20, the method may include the following steps:
[0369] S2001: The first template of the current block is determined, and a matching template and a reference block are determined.
[0370] It should be noted that the encoding method of the present embodiment is applied to an encoder. This encoding method may also be referred to as a linear filtering model-based template matching (TM-FLM) prediction method. In some embodiments, this encoding method specifically refers to an intra prediction method, more specifically, an intra prediction method based on an intra template matching technique (Intra TMP-FLM) based on a linear filtering model, or an intra prediction method based on an intra block copy (IBC-FLM) based on a linear filtering model. Here, a video image may be divided into multiple coding blocks, and the current block in the present embodiment refers to a coding block currently being subjected to intra prediction in the video image, and the reference block is a reconstructed block in the current frame. It should be noted that the encoding method of the present embodiment may be used for both luma component prediction and chrominance component prediction, and is not specifically limited herein.
[0371] In some embodiments, the first template for the current block may be determined first. In some embodiments, determining the first template for the current block may include determining a template type for the current block and determining the first template for the current block based on the template type of the current block.
[0372] Here, the template type may be represented by refTemplateType. In some embodiments, determining the template type of the current block may include determining the template type of the current block based on reference pixels of the current block, or determining the template type of the current block based on a size of the current block.
[0373] Here, the reference pixels of the current block include at least one of the left adjacent reference pixels of the current block, the upper adjacent reference pixels of the current block, the upper left adjacent reference pixels of the current block, the lower left adjacent reference pixels of the current block, and the upper right adjacent reference pixels of the current block.
[0374] Furthermore, the template type of the current block can be determined by classifying the template type according to whether neighboring reference pixels are available. In some embodiments, the step of determining the template type of the current block includes: determining that the template type of the current block is a first value if the left neighboring reference pixel of the current block, the upper neighboring reference pixel of the current block, and the upper left neighboring reference pixel of the current block are all available; determining that the template type of the current block is a second value if the left-neighboring reference pixel of the current block is available; If the upper neighboring reference pixels of the current block are available, determining that the template type of the current block is a third value; determining that the template type of the current block is a fourth value if the left adjacent reference pixel of the current block and the upper left adjacent reference pixel of the current block are both available; determining that the template type of the current block is a fifth value if the left neighboring reference pixel of the current block and the lower-left neighboring reference pixel of the current block are both available; If both the upper neighboring reference pixels of the current block and the upper right neighboring reference pixels of the current block are available, determining that the template type of the current block is a sixth value.
[0375] In an embodiment of the present application, the first, second, third, fourth, fifth, and sixth values may be different from one another. For example, the first value may be set to 1, the second value to 2, the third value to 3, the fourth value to 4, the fifth value to 5, and the sixth value to 6. For details of these six template types, see (a), (b), (c), (d), (e), and (f) in FIG. 3.
[0376] In some embodiments, the step of determining a first template for the current block based on a template type of the current block may include: obtaining template pixels for the current block based on the template type of the current block and a corresponding template size; and determining the template pixels of the current block as the first template for the current block.
[0377] In the embodiment of the present application, the template size may be preset, may be determined according to the size of the current block, or may be related to the template type of the current block, and is not specifically limited herein. For example, if the template type indicates that only the left template is to be acquired, the template width (templateW_size) may be set to 4, and if the template type indicates that only the top template is to be acquired, the template height (templateH_size) may be set to 4.
[0378] In the present embodiment, the value of the template type can determine which portion of the reconstructed pixels the first template will acquire. For example, if the value of refTemplateType is 1, the left, upper left, and upper reconstructed pixels of the current block will be acquired; if the value of refTemplateType is 2, only the reconstructed pixels in the left four columns of the current block will be acquired; and if the value of refTemplateType is 3, only the reconstructed pixels in the upper four rows of the current block will be acquired.
[0379] For the matching template and reference block, in one possible embodiment, the step of determining the matching template and reference block may include determining vector parameters and corresponding reference blocks, and determining the matching template based on the first template and the reference block.
[0380] Correspondingly, in some embodiments, the method may further include encoding vector parameters and signaling the obtained coded bits into a bitstream, that is, the encoding side can determine the vector parameters (e.g., BV) and then signal them into a bitstream, and then the decoding side can directly determine the vector parameters by decoding the bitstream, and further determine a reference block for the current block, and then determine a matching template from the reference block based on the first template for the current block.
[0381] Regarding the matching template and the reference block, in another possible embodiment, the step of determining the matching template and the reference block may include performing template matching within the search area based on the first template to determine the matching template, and determining the reference block based on the matching template.
[0382] In some embodiments, performing template matching within the search area based on the first template and determining the matching template may include performing a search within the search area based on the first template, determining target vector parameters, and determining the matching template based on the target vector parameters.
[0383] In another possible embodiment, the step of determining a matching template may include a step of performing template matching within a search area based on a first template to determine a matching template, and the step of performing template matching within the search area based on the first template to determine a matching template includes a step of determining initial vector parameters of the current block, a step of determining a search area based on the initial vector parameters, a step of performing a search within the search area based on template matching to determine target vector parameters, and a step of determining a matching template based on the target vector parameters and the first template.
[0384] In one possible embodiment, determining initial vector parameters of the current block includes determining a vector parameter candidate list for constructing the current block based on a prediction mode parameter of the current block, and determining initial vector parameters based on the vector parameter candidate list. The prediction mode parameter is used to indicate related parameters of the current block prediction mode. In one possible embodiment, determining initial vector parameters based on the vector parameter candidate list includes obtaining a vector parameter at a predetermined position (e.g., a first vector parameter) from the vector parameter candidate list as the initial vector parameter.
[0385] In one possible embodiment, the step of determining a vector parameter candidate list for constructing the current block based on the prediction mode parameters of the current block includes a step of determining a merge vector parameter candidate list for constructing the current block based on the prediction mode parameters of the current block, or a step of determining an AMVP vector parameter candidate list for constructing the current block based on the prediction mode parameters of the current block.
[0386] In one possible embodiment, the initial vector parameter of the current block is determined as a predetermined vector parameter based on the prediction mode parameter of the current block. In some embodiments, the Intra TMP initial block vector is 0. In yet another embodiment, the Intra TMP initial block vector parameter is a vector parameter obtained by performing a coarse search on the search area, and the target vector parameter is a vector parameter obtained by performing a fine search on the search area.
[0387] In one possible embodiment, determining a search area based on the initial vector parameters includes determining a search area based on the initial vector parameters and a predetermined search range. Illustratively, determining a reference block based on the initial vector parameters and the current block, and determining a search area based on the reference block and the predetermined search range, where the search area includes reconstructed pixels.
[0388] The search range may be set in advance, may be transmitted in the bitstream, or may be adaptively selected based on information such as block size.
[0389] In one possible embodiment, the method for determining the predetermined search range includes at least one of: setting the predetermined horizontal component search range as the horizontal component search range of the predetermined search range; setting the predetermined vertical component search range as the vertical component search range of the predetermined search range; and determining the horizontal component search range and / or the vertical component search range of the predetermined search range according to the size of the current block.
[0390] In one possible embodiment, the step of determining the search area based on the initial vector parameters includes the steps of determining the current block as an inter prediction mode based on the prediction mode parameters and determining the search area in the reference image based on the initial vector parameters, and determining the current block as an intra prediction mode based on the prediction mode parameters and determining the search area in the current image in which the current block is located based on the initial vector parameters.
[0391] In one possible embodiment, the intra prediction mode is determined based on the prediction mode parameters of the current block, and the search area includes at least one of a partial area of the reconstructed coding tree block of the current image, the entire area of the reconstructed coding tree block of the current image, the entire reconstructed area of the current coding tree block, and a partial area of the reconstructed coding tree block in which the current block is located.
[0392] In one possible embodiment, the step of searching within the search area based on template matching and determining the target vector parameters includes the steps of searching and determining a reference template within the search area, calculating a matching cost value between the reference template and the first template, and determining the vector parameters of the reference template corresponding to the minimum matching cost value as the target vector parameters. Illustratively, the step of searching and determining a reference template available within the search area.
[0393] In one possible embodiment, the conditions for determining the availability of the reference template include at least one of: a first sampling point in the template does not extend beyond the image boundary in which it is located; a second sampling point in the reference block corresponding to the template does not extend beyond the image boundary in which it is located; a first sampling point in the template does not extend beyond the search area; a second sampling point in the reference block corresponding to the template does not extend beyond the search area; all first sampling points in the template are reconstructed; and all second sampling points in the reference block corresponding to the template are reconstructed.
[0394] In one possible embodiment, the availability determination condition for the reference template includes at least one of: a first sampling point in the template and the current block are in the same sub-image; a second sampling point in the reference block corresponding to the template and the current block are in the same sub-image; and the second sampling point in the reference block corresponding to the template is not in the current block. Illustratively, a sub-pixel may include multiple coding tree units. Illustratively, a sub-image may be a Tile.
[0395] In one possible embodiment, the first sampling points are each sampling point in the template or predetermined first identified sampling points, including a sampling point at at least one corner position in the template.
[0396] In one possible embodiment, the second sampling points are each sampling point in a reference block corresponding to the template, or are predetermined second identification sampling points. The second identification sampling points include sampling points at at least one corner position in the reference block corresponding to the template. Specifically, whether a sampling point is within the predetermined image can be determined by whether the coordinates of the sampling point are within the valid coordinate range of the predetermined image area.
[0397] The sampling points may be sampling points in the template or in the reconstruction block corresponding to the template, or sampling points at specific positions set in advance. In some embodiments, the distinguished sampling points in the template refer to one or more sampling points located at corner positions of the template region. For example, if there is only an upper template, the distinguished sampling points may be the sampling points in the upper left and lower right corners of the upper template region, or only the sampling point in the lower right corner. Here, the distinguished sampling points in the reconstruction block corresponding to the template refer to one or more sampling points located at corner positions of the reconstruction block region. For example, the distinguished sampling points may be the sampling points in the upper left and lower right corners of the reconstruction block region, or only the sampling point in the lower right corner of the reconstruction block region.
[0398] That is, a search can be performed within a search area based on the first template, and a matching template with the lowest cost can be searched for according to a predetermined cost function. Here, by traversing all search points within the search area, one or more candidate vector parameters can be obtained, and the one or more candidate vector parameters can indicate one or more candidate matching templates, which are then compared with the first template of the current block through cost calculation to obtain the search point with the lowest cost, whose corresponding candidate vector parameters are optimal vector parameters (i.e., target vector parameters, BV_BEST), and whose corresponding candidate matching template is the optimal matching template (i.e., the matching template, T_BEST, in this embodiment). A reference block can be determined based on the optimal matching template. In this embodiment, the target vector parameters can be understood as optimal vector parameters or matching vector parameters. Exemplarily, the vector parameters of an inter prediction mode can be MV, and the vector parameters of an intra prediction mode can be BV.
[0399] In the embodiments of the present application, the predetermined cost function may be sum of absolute differences SAD, sum of absolute transformed differences SATD, mean squared error MSE, sum of squared differences SSD, mean absolute deviation MAD, mean squared deviation MSD, normalized cross correlation NCC, etc., and is not specifically limited here.
[0400] The search process within the search area may be a coarse search, a fine search, or a coarse search first and then a fine search, as follows:
[0401] In one possible embodiment, the step of performing a search within the search area based on template matching and determining the target vector parameters includes performing a first search within the search area and determining the target vector parameters, or performing a second search within the search area and determining the target vector parameters, wherein a search step size corresponding to the first search is larger than a search step size corresponding to the second search.
[0402] In another possible embodiment, the step of performing a search within a search area based on template matching and determining target vector parameters includes the steps of performing a first search within the search area, determining first vector parameters, and determining an initial matching template based on the first vector parameters; and determining a first search area based on the initial matching template, performing a second search within the first search area, and determining target vector parameters, wherein a search step size corresponding to the first search is larger than a search step size corresponding to the second search, and the first search area is smaller than the search area.
[0403] In the present embodiment, the search step size corresponding to the first search is larger than the search step size corresponding to the second search. For example, the search step size corresponding to the first search is 2, and the search step size corresponding to the second search is 1. Alternatively, the downsampling factor corresponding to the first search is larger than the downsampling factor corresponding to the second search. For example, the downsampling factor corresponding to the first search is 4, and the downsampling factor corresponding to the second search is 2. In other words, the first search is a coarse search, and the second search is a fine search. It is sufficient that the first search reflects coarser features than the second search, and there are no specific limitations here.
[0404] Note that when a first search is performed first and then a second search is performed, not only is the search step size corresponding to the first search larger than the search step size corresponding to the second search, but the first search area is smaller than the search area. Here, the first search area is a search area near the initial matching template. For example, the optimal coarse matching template can be determined within the search area using a step size of 2, and then the optimal fine matching template (i.e., the final matching template) can be determined near the optimal coarse matching template using a step size of 1.
[0405] In yet another possible embodiment, the search area includes at least one sub-search area, and the step of searching within the search area based on template matching and determining target vector parameters includes the steps of: searching within each of the at least one sub-search area and determining optimal vector parameters and corresponding matching cost values for each sub-search area; determining optimal vector parameters corresponding to the minimum matching cost value based on the optimal vector parameters and corresponding matching cost values for each sub-search area; and setting the optimal vector parameters corresponding to the minimum matching cost value as the target vector parameters.
[0406] In one possible embodiment, the step of performing a search within a search area based on template matching and determining target vector parameters includes the steps of: performing a first search within at least one sub-search area and determining optimal vector parameters for each sub-search area and a corresponding second search area; performing area judgment based on the optimal vector parameters for each sub-search area and the corresponding second search area and determining at least two target sub-search areas for the second search; performing a second search within the at least two target sub-search areas and determining optimal vector parameters corresponding to the at least two target sub-search areas; and determining the optimal vector parameters corresponding to the at least two target sub-search areas as target vector parameters.
[0407] It should be noted that in the embodiment of the present application, for intra prediction technology, the search area of the current block template may be the reconstructed part of the CTB where the current block is located, or may be another reconstructed CTB area.The search area here is actually a collection of all search points.Because the shape of this area often cannot be represented by a single rectangular area, in specific implementation, multiple rectangular areas can be searched, and the search results of different areas can be combined to obtain the final optimal reference block and optimal block vector.
[0408] In this embodiment, taking FIG. 7(f) as an example, the search area is divided into four sub-search areas, each of which is represented by regionId, where regionId can be 0, 1, 2, or 3. Using the search point (iPosHor, iPoxVer) in each sub-search area, i.e., each block vector BV (composed of horizontal and vertical components (pX, pY), where pX = iPosHor-xTbCmp and pY = iPosVer-yTbCmp, where pX is between bvXMins and bvXMaxs, and pY is between bvYMins and bvYMaxs), a reference block matching one current block can be found in the reconstructed area, and the neighboring reconstructed pixels of the reference block are the matching template. The matching cost between the first template of the current block and the matching template can then be calculated, denoted as pDiff.
[0409] In this way, all search points within all search ranges (regionId=0, 1, 2, 3) are traversed, and the search point with the smallest matching cost pDiff is obtained by comparison. Its corresponding matching cost is denoted as pDiff_BEST, its corresponding block vector is denoted as the optimal block vector BV_BEST(pX_BEST, pY_BEST), i.e., the target block vector in this embodiment, and its corresponding optimal matching template T_BEST is the final required matching template.
[0410] In one possible embodiment, determining the reference block comprises determining the reference block based on the target vector parameters, illustratively determining the reference block based on the current block and the target vector parameters.
[0411] In another possible embodiment, the method further comprises the steps of determining a value of a first syntax element identification, the first syntax element identification being used to indicate whether template matching is applied to the current block or not, and encoding the value of the first syntax element identification and signaling the resulting coded bits in the bitstream.
[0412] In yet another possible embodiment, the method further comprises the steps of determining a value of a third syntax element identification, the third syntax element identification being used to indicate a reference block for the current block, and encoding the value of the third syntax element identification and signaling the resulting coded bits in the bitstream.
[0413] In yet another possible embodiment, the method further includes a step of determining a value of a third syntax element identification information, where the first syntax element identification information is used to indicate that template matching is applied to the current block (or to determine that template matching is applied to the current block), and a step of determining a reference block for the current block based on the value of the third syntax element identification information.
[0414] The encoding side transmits a Flag to indicate which filtered reference block is to be the final predicted block. tmpFlag indicates whether template matching is applied to the current coding block, and filterIdx indicates which reference block within the current search range is to be subjected to a filtering model. If tmpFlag is 1, the encoding side compares the distortion, for example, SAD, MSE, SATD, or SSE, between the reference block to which the filter coefficients within the search range are applied and the current source block, to select the optimal reference block, and transmits the corresponding index to the decoding side.
[0415] In yet another possible embodiment, the step of determining the value of the third syntax element identification information includes the steps of: traversing a search area to search for multiple reference blocks when it is determined that template matching is applied to the current block; performing a filtering process on the reference blocks based on model parameters; determining a filtered reference block; calculating distortion parameters of the filtered reference block and the current original block; determining a reference block corresponding to the minimum distortion parameters; and determining the value of the third syntax element identification information based on the reference block corresponding to the minimum distortion parameters.
[0416] In addition, filter coefficients are calculated for templates within the search range and filtered, and the cost with the current template is calculated to determine which template to use; that is, filter coefficients are calculated for some or all of the search target templates within the search range, and then the filter coefficients are applied to these search target templates to calculate the cost with the current template, and the filtered optimal matching template is selected based on the cost. The reference block corresponding to the optimal matching template is filtered to obtain the final predicted value.
[0417] In yet another possible embodiment, the step of determining the reference block further includes the steps of: traversing the search area to search for multiple reference templates; determining model parameters based on the first template and the reference template; performing a filtering process on the reference template based on the model parameters to obtain a filtered reference template; calculating a matching cost value between the filtered reference template and the first template; and determining the reference block of the reference template corresponding to the smallest matching cost value as the reference block of the current block.
[0418] S2002: Model parameters are determined based on the first template and the matching template.
[0419] In some embodiments, the model parameters may include coefficients of a target filter. In some embodiments, the method may further include determining coefficients of the target filter based on pixel reference values in the first template and pixel reference values in the matching template.
[0420] In some embodiments, the coefficients of the target filter may be determined by solving an optimization problem. Correspondingly, in some embodiments, the method may further include: the coefficients of the target filter are coefficients used by the target filter when a first error between an output value of a pixel reference value in the matching template processed by the target filter and a pixel reference value in the first template satisfies a first condition.
[0421] With regard to the first error satisfying the first condition, it should be understood that in one possible embodiment, the first condition is that the first error is minimal, or in another possible embodiment, the first condition is that the first error is within a first predetermined threshold range, or in yet another possible embodiment, the first condition is that the amount of change in the first error is within a second predetermined threshold range.
[0422] It should be further understood that the first predetermined threshold range and the second predetermined threshold range are both criteria preset on the decoding side for determining whether the first error satisfies the first condition. In addition, the first error here may be a mean square error MSE, a residual sum of squares SSE, a sum of absolute differences SAD, a sum of absolute differences after Hadamard transform SATD, a mean absolute error MAE, etc., and is not specifically limited thereto in the embodiments of the present application.
[0423] In some embodiments, determining coefficients of the target filter based on pixel reference values in the first template and pixel reference values in the matching template comprises: determining autocorrelation parameters based on pixel reference values in the matching template; determining cross-correlation parameters based on pixel reference values in the first template and pixel reference values in the matching template; and determining coefficients of the target filter based on the autocorrelation and cross-correlation parameters.
[0424] It should be noted that in the present embodiment, the pixel reference values include at least one of pixel reconstruction values, pixel gradient values, and pixel position information.
[0425] JPEG2024152385000028.jpg77168
[0426] In one specific embodiment, a reconstruction region R for calculating filter coefficients is first determined, and then a set of filter coefficients can be derived by minimizing the MSE between the reconstructed pixels in the region R and the reconstructed pixels of the first template, as shown in the above-mentioned equations (3) and (4).
[0427] Furthermore, the process of deriving and obtaining the filter coefficients by minimizing the MSE is specifically as follows.
[0428] JPEG2024152385000029.jpg17168
[0429] Next, equation (7) is obtained by rearranging equations (5) and (6).
[0430] Again, after determining the reconstruction region R, the equation (7) is expanded into a matrix format as shown in the above-mentioned equations (8) to (10).
[0431] JPEG2024152385000030.jpg33168
[0432] In addition, in the embodiment of the present application, for the target filter, it is necessary to determine the number of coefficients of the target filter, the shape of the target filter, etc. Here, the number of coefficients of the target filter and the shape of the target filter may both be preset fixed values or may be associated with the size of the current block.
[0433] In some embodiments, for the number of coefficients of the target filter, the method may further include: the number of coefficients of the target filter is equal to a first predetermined value.
[0434] In some embodiments, for the number of coefficients of the target filter, the method may further comprise the steps of determining the number of coefficients of the target filter, encoding the number of coefficients of the target filter and signaling the resulting coded bits in a bitstream.
[0435] The number of coefficients of the target filter may be represented by nTap. For example, the value of nTap may be 4, 5, 6, 7, 8, 9, etc., but is not limited to this.
[0436] The number of coefficients of the target filter may also be referred to as the number of taps of the target filter. Here, the number of coefficients of the target filter may be a predetermined constant value or may be determined according to the size of the current block, and is not specifically limited here.
[0437] In some embodiments, regarding the shape of the target filter, the method may further include the target filter being a one-dimensional or two-dimensional filter of a predetermined shape.
[0438] In some embodiments, for a target filter shape, the method may further comprise determining the target filter shape, encoding the target filter shape and signaling the resulting coded bits in a bitstream.
[0439] In some embodiments, the method may further comprise determining values of filter shape parameters, the filter shape parameters indicating a shape of the target filter, and further comprising encoding the values of the filter shape parameters and signaling the resulting coded bits in a bitstream.
[0440] The filter shape parameter may be represented by FilterIdx, which is used to indicate the shape of the target filter. For example, the shape of the target filter may be a diamond, a rectangle, a cross, a bar, or even a one-dimensional filter or a two-dimensional filter, but is not limited to this.
[0441] Illustratively, if the value of FilterIdx is equal to 0, the shape of the target filter is determined to be a diamond, if the value of FilterIdx is equal to 1, the shape of the target filter is determined to be a cross, and if the value of FilterIdx is equal to 2, the shape of the target filter is determined to be a rectangle.
[0442] The shape of the target filter may be a predetermined shape, may be determined by the value of a filter shape parameter, or may be determined according to the size of the current block, and is not specifically limited here.
[0443] S2003: A filtering process is performed on the reference block based on the model parameters, and a filtered reference block is determined.
[0444] S2004: Determine a predicted value of the current block based on the filtered reference block.
[0445] In addition, in the embodiment of the present application, after the model parameters are determined, a predicted value of the current block can be determined based on the model parameters and the reference block, specifically, a filtering process is performed on the reference block based on the model parameters, and then a predicted value of the current block is determined based on the filtered reference block.
[0446] In some embodiments, the step of performing a filtering process on the reference block based on the model parameters and determining a filtered reference block may include the steps of performing a filtering process on the reference block based on the model parameters and determining a first output value of the target filter, and determining the filtered reference block based on the first output value of the target filter.
[0447] In the embodiment of the present application, a first output value of the target filter can be calculated based on the pixel reconstruction value of the reference block and the coefficient of the target filter in the model parameters, and then a filtered reference block can be determined based on the first output value of the target filter, where the target filter can be a linear filtering model or a nonlinear filtering model, and is not specifically limited.
[0448] In one possible embodiment, the step of performing a filtering process on the reference block based on the model parameters and determining a filtered reference block may include the steps of: calculating products of pixel reconstruction values of the reference block and corresponding coefficients of a target filter; setting a first output value of the target filter equal to the sum of n products, where n represents the number of coefficients of the target filter and is a positive integer; and determining a filtered reference block based on the first output value of the target filter.
[0449] In one possible embodiment, the step of calculating the products of the pixel reconstruction values of the reference block and the corresponding coefficients of the target filter can include calculating the products of pixel reference values of a second boundary filling region corresponding to the reference block and the corresponding coefficients of the target filter, and / or calculating the products of pixel reference values of a reference template corresponding to the reference block and the corresponding coefficients of the target filter. To fill the boundary pixels, taking into account that the filter may use reconstruction pixels other than the reference template and the reference block, the boundary pixels need to be filled, and the areas that need to be filled in the boundary vary depending on the filter shape. The filled boundary pixels can be applied to determining model parameters and / or predicting the current block.
[0450] The target filter in the embodiment of the present application is a linear filtering model, and the first output value of the target filter can be obtained by calculation using the above-mentioned equation (11).
[0451] In another possible embodiment, the step of filtering the reference block based on the model parameters and determining a first output value of the target filter comprises: determining a first value in a first mapping relationship of pixel reconstruction values of the reference block; calculating the product of the first value and the corresponding coefficient of the target filter; The method may include setting a first output value of the target filter equal to a sum of n products, where n represents the number of coefficients of the target filter and n is a positive integer.
[0452] In addition, the target filter in the embodiment of the present application is a nonlinear filtering model. For example, when minimizing the MSE of the filter coefficients, it can be calculated using the above-mentioned equations (12) and (13).
[0453] In addition, in the embodiment of the present application, the step of determining a filtered reference block based on the first output value of the target filter can directly set the first output value of the target filter as the filtered reference block, or can perform first filtering on the first output value of the target filter to obtain the filtered reference block, where the first filtering may be low-pass filtering, up / down sampling filtering, etc., and is not specifically limited here.
[0454] It should be noted that in the embodiment of the present application, after determining the first output value of the target filter, a first offset value (represented by bias) can be added to the first output value to determine the filtered reference block.
[0455] In some embodiments, determining the filtered reference block based on the first output value of the target filter may include determining a first offset value, and performing an addition operation based on the first output value and the first offset value to determine the filtered reference block.
[0456] In one possible embodiment, determining the first offset value may include setting the first offset value equal to a second predetermined value.
[0457] In another possible embodiment, the step of determining the first offset value may include a step of determining the n+1-th coefficient of the target filter, where the number of coefficients of the target filter is n, and a step of determining the first offset value based on the n+1-th coefficient and the second offset value.
[0458] In an embodiment of the present application, for the second offset value, the method may further include setting the second offset value equal to a third predetermined value, or setting the second offset value equal to a value in a second mapping relationship of the pixel reconstruction value of the reference block.
[0459] JPEG2024152385000031.jpg56168
[0460] Furthermore, in some embodiments, the step of determining a predicted value of the current block based on the filtered reference block may include performing a first process on the filtered reference block to obtain a predicted value of the current block.
[0461] In an embodiment of the present application, for the first process, the first process may be to set the predicted value of the current block equal to the filtered reference block, or the first process may be a clip operation that limits the filtered reference block to a predetermined numerical range, or the first process may be other operations, which are not specifically limited here.
[0462] JPEG2024152385000032.jpg84168
[0463] JPEG2024152385000033.jpg15168
[0464] Furthermore, the number of filter models may be expanded to establish multiple filter models in addition to establishing only one filter model. determining sets of model parameters based on the first template and the matching template; constructing a plurality of filter models based on the plurality of sets of model parameters, and performing filtering processes on the reference blocks based on the plurality of filter models respectively to determine a plurality of filtered reference blocks; determining a prediction value for the current block based on the plurality of filtered reference blocks.
[0465] In some embodiments, the step of determining the plurality of sets of model parameters based on the first template and the matching template may include: classifying the reconstructed pixels in the first template and the matching template according to a predetermined scheme, respectively, to obtain a plurality of sets of sub-templates and a plurality of sets of sub-matching templates; and determining the plurality of sets of model parameters based on the plurality of sets of sub-templates and the plurality of sets of sub-matching templates.
[0466] In the embodiment of the present application, the predetermined method may be, but is not limited to, the magnitude of the reconstructed pixel value, the position information of the reconstructed pixel, the shape of the filter, etc. After classification according to the predetermined method, each set of sub-templates and the corresponding sub-matching template can calculate a set of model parameters, and each set of model parameters can determine a filter model, thereby constructing multiple filter models.
[0467] In one possible embodiment, the method may further include determining a target filter from a plurality of filter models, and performing a filtering process on the reference block based on the target filter to determine a predicted value of the current block.
[0468] Furthermore, in some embodiments, the method may further include determining a target model index value, the target model index value being used to indicate an index number among a plurality of filter models of the target filter, and encoding the target model index value and signaling the resulting encoded bits in a bitstream.
[0469] Furthermore, in some embodiments, the step of determining the target filter from the plurality of filter models may include: determining original values of the current block; performing rate-distortion cost calculations based on the original values of the current block and a plurality of initial predicted values of the current block, respectively, to determine rate-distortion cost values for each of the plurality of initial predicted values; determining a minimum rate-distortion cost value from the rate-distortion cost values for each of the plurality of initial predicted values; and selecting the filter model corresponding to the minimum rate-distortion cost value as the target filter.
[0470] In another possible embodiment, the reference block may be filtered based on a plurality of filter models to determine a plurality of filtered reference blocks. In some embodiments, determining a prediction value for the current block based on the plurality of filtered reference blocks may include performing a weighting calculation on the plurality of filtered reference blocks to determine a prediction value for the current block.
[0471] It should be noted that if the weighting factors of each filtered reference block are equal and are each equal to the reciprocal of the number of reference blocks, the weighting calculation here can also be regarded as an averaging calculation, in other words, an averaging calculation is performed on multiple filtered reference blocks to determine the predicted value of the current block.
[0472] For example, the input information for calculating filter coefficients is classified, and a filtering model is established for each type of input information. For example, when using reconstruction information to establish a filter model, one possible embodiment is to classify according to the average value of the reconstruction information, and establish one filter model for reconstruction information greater than the average value, and establish one filter model for reconstruction information less than the average value. Another possible embodiment is to classify according to the position of the reconstruction information, for example, to establish one filter model using available reconstruction information on the left and upper sides, and establish a second filter model using available reconstruction information on the left and upper left sides. The encoding side determines which model to use. One possible determination method is for the encoding side to determine which model to use using a rate-distortion optimization method and transmit corresponding decoding parameters to the decoding side, so that the decoding side can determine which filter model to select. Another possible embodiment is to classify by filter shape, and multiple filters of different shapes can be used, and a filter model is established for each filter shape, and the encoding side determines which filter shape to use. One possible determination method is for the encoding side to determine which filter to use using a rate-distortion optimization method and transmit the corresponding decoding parameters to the decoding side, after which the decoding side can clearly select which filter model. Another feasible solution is to calculate the cost according to the filtered template and the current template to determine which filter to use.
[0473] For solutions that extend multiple models and multiple filter shapes, the decoding side can sort each solution by template prediction distortion and select the solution with the smallest template prediction distortion as the final selected solution.
[0474] Alternatively, the encoding and decoding sides can all sort the solutions by template prediction distortion and transmit index information in this ordered list in the bitstream to specify the prediction solution to be finally used.
[0475] In some embodiments, it is necessary to further fill boundary pixels, because the filter may use reconstructed pixels other than the reference template and the reference block, and the area that needs to be filled in the boundary is different according to different filter shapes. The method mainly includes two processes: determining the boundary filling area of the reference template corresponding to the reference block, and performing boundary pixel filling on the boundary filling area.
[0476] In some embodiments, the boundary filling region comprises at least one of an edge-adjacent region of the matching template, a point-adjacent region of the matching template, an edge-adjacent region of the reference block, and a point-adjacent region of the reference block.
[0477] In some embodiments, performing boundary pixel filling on the boundary filling region comprises performing boundary pixel filling on a first boundary filling region corresponding to the matching template using neighboring pixel reconstruction values in the matching template, and / or performing boundary pixel filling on a second boundary filling region corresponding to the reference template using neighboring pixel reconstruction values in the reference block.
[0478] In some embodiments, a sampling point at a first location within the boundary fill region is determined to be unavailable, and boundary pixel filling is performed for the first location within the boundary fill region.
[0479] In some embodiments, the criteria for determining whether a sampling point is available include at least one of: the sampling point at the first location is reconstructed; the first location is located within a search area; the first location is located within an image in which the reference block is located; and the first location is located within a sub-image in which the reference block is located.
[0480] In some embodiments, performing boundary pixel filling on the boundary filling region includes performing boundary pixel filling on the boundary filling region using a predetermined pixel value, where the predetermined pixel value is 0 or a pixel value determined by a decision on the encoding side.
[0481] In some embodiments, the boundary fill region is determined according to the shape of the filter, as shown in Figures 16A, 16B, and 17.
[0482] The width of the outer boundary region is a predetermined width. For example, the width of the outer boundary region may be any number from 1 to N in units of pixels or sub-pixels.
[0483] There are also various methods of filling.
[0484] One filling method is to determine whether the sampling points in the outer boundary filling region are available, and if so, to directly use the reconstructed pixels; if not, to copy the reconstructed pixels of the adjacent reference template or reference block to fill the corresponding positions.
[0485] Yet another filling method is to fill the boundary fill region by directly copying the reconstructed pixels of the neighboring reference template or reference block.
[0486] Alternatively, it is possible to not perform filling and, when a boundary position is reached, to abandon the participation of the corresponding data in the calculation. The determination of the availability of a sampling point within the outer boundary filling region includes, but is not limited to, one or more of the following conditions: the sampling point at this position is a reconstructed one; this position does not exceed the MV / BV search range; this position does not exceed the image boundary; and this position does not exceed the Tile boundary.
[0487] S2005: Determine a prediction residual value of the current block based on the prediction value of the current block.
[0488] In addition, in embodiments of the present application, it is also possible to calculate the prediction residual value of the current block after determining the predicted value of the current block, and in some embodiments, the step of determining the prediction residual value of the current block based on the predicted value of the current block may include determining an original value of the current block, and determining the prediction residual value of the current block based on the original value of the current block and the predicted value of the current block.
[0489] In one specific embodiment, the step of determining a prediction residual value of the current block based on the original value of the current block and the predicted value of the current block may include the step of subtracting the original value of the current block and the predicted value of the current block to determine a reconstructed value of the current block.
[0490] It should be noted that in the present embodiment, whether the current block applies intra-template matching or is used in the filter model may be determined by different syntax element identification information. In some embodiments, the method may further include determining a value of a first syntax element identification information, where the first syntax element identification information is used to indicate whether the current block applies intra-template matching or is used in the filter model, and encoding the value of the first syntax element identification information and signaling the resulting coded bits in a bitstream.
[0491] In an embodiment of the present application, the step of determining the value of the first syntax element identification information may include determining the value of the first syntax element identification information as a first value if intra-template matching is applied to the current block, or determining the value of the first syntax element identification information as a second value if intra-template matching is not applied to the current block.
[0492] In some embodiments, the method may further include determining a value of a second syntax element identification, the second syntax element identification being used to indicate whether a filter model is applied to the current block, and encoding the value of the second syntax element identification and signaling the resulting coded bits in the bitstream.
[0493] In some embodiments, if the first syntax element identification information is used to indicate that intra-template matching is applied to the current block, the method may further include the steps of determining a value of a second syntax element identification information, where the second syntax element identification information is used to indicate whether a filter model is applied to the current block, and encoding the value of the second syntax element identification information and signaling the resulting coded bits into the bitstream.
[0494] In an embodiment of the present application, the step of determining the value of the second syntax element identification information may include determining the value of the second syntax element identification information as a first value if a filter model is applied to the current block, or determining the value of the second syntax element identification information as a second value if a filter model is not applied to the current block.
[0495] Further, in some embodiments, the method further comprises: performing a filtering process on the reference block based on the model parameters, determining a filtered reference block, and determining a predicted value of the current block based on the filtered reference block when the filter model is applied to the current block; If no filter model is applied to the current block, the method may further include using reconstructed pixel values in the reference block as predicted values for the current block.
[0496] In the embodiment of the present application, unlike the first value and the second value, the first value and the second value may be in a parameter format or a numerical format. Specifically, the first syntax element identification information and the second syntax element identification information may be parameters written in a profile or flag values, and are not specifically limited here. Exemplarily, with respect to the first value and the second value, the first value may be set to 1 and the second value may be set to 0, or the first value may further be set to true and the second value may further be set to false, but are not specifically limited here.
[0497] In the embodiment of the present application, whether the current block uses the filtered reference block as the final predicted value is determined based on certain conditions, but is not limited to the following three methods. Method 1: determining whether to filter the matching template by comparing the distortion of the matching template and the current block template, such as SAD or MSE or SATD or SSE, with a threshold T_Distortion1; Method 2, which satisfies the requirement of using a filter model in Method 1, and determines whether to filter the reference block according to the distortion between the filtered matching template and the template of the current block, such as SAD, MSE, SATD, or SSE, and a threshold T_Distortion2; and Method 3 may be a method in which the encoding side transmits a Flag to indicate whether to apply a filter model. tmpFlag indicates whether to apply intra template matching to the current block, and filterFlag indicates whether to apply a filter model to the current block. If tmpFlag is 1, the encoding side determines whether to filter the reference block by comparing the distortion between the reference block before and after filtering and the current block, for example, SAD, MSE, SATD, or SSE. If the distortion after filtering is smaller than the distortion before filtering, filterFlag is 1, and the current block uses the filtered reference block as its predicted block; otherwise, filterFlag is 0, and the current block uses the unfiltered reference block as its predicted block, and the encoding side transmits filterFlag to the decoding side.
[0498] In addition to calculating filter coefficients for the optimal matching template after the search is completed and applying the filter coefficients to the optimal matching reference block, it is also possible to apply filter coefficients to all or part of the reference blocks within the search area, and determine which filtered reference block will be the final predicted block based on specific conditions, for example, there are several methods as follows:
[0499] Method 1: Filter coefficients are calculated for templates within the search range and filtered, and the cost with the current template is calculated to determine which template to use; that is, filter coefficients are calculated for some or all of the target templates within the search range, and then the filter coefficients are applied to the target templates to calculate the cost with the current template. The best filtered matching template is selected based on the cost, and the reference block corresponding to the best matching template is filtered to obtain the final prediction value.
[0500] Method 2: The encoding side transmits a Flag to indicate which filtered reference block is to be the final predicted block. tmpFlag indicates whether template matching is applied to the current coding block, and filterIdx indicates which reference block within the current search range the filtering model is to be applied to. If tmpFlag is 1, the encoding side compares the distortion, for example, SAD, MSE, SATD, or SSE, between the reference block to which the filter coefficients within the search range are applied and the current original block, to select the optimal reference block, and transmits the corresponding index to the decoding side.
[0501] Furthermore, an embodiment of the present application further provides a bitstream generated by bit encoding based on encoding target information, where the encoding target information includes at least one of a prediction residual value of a current block, a number of coefficients of a target filter, a shape of the target filter, a value of a first syntax element identification information, a value of a second syntax element identification information, and a value of a third syntax element identification information.
[0502] In an embodiment of the present application, the first syntax element identification information is used to indicate whether intra-template matching is applied to the current block, and the second syntax element identification information is used to indicate whether a filter model is applied to the current block.
[0503] This embodiment provides an encoding method, which determines a first template for a current block, determines a matching template and a reference block, determines model parameters based on the first template and the matching template, performs a filtering process on the reference block based on the model parameters, determines a filtered reference block, determines a predicted value of the current block based on the filtered reference block, and determines a prediction residual value of the current block based on the predicted value of the current block. In this way, the model parameters are determined based on the first template and the matching template, and the model parameters fully reflect the correlation between the matching template and the first template of the current block, and this correlation is applied to the reference block to filter and correct its reconstructed pixels, and then the filtered reconstructed pixels are used as the predicted pixels of the current block, thereby improving prediction accuracy, saving bit rate, and improving codec efficiency, thereby improving codec performance.
[0504] In another embodiment of the present application, based on the same inventive concept as the above-mentioned embodiment, as shown in Figure 21, there is provided a schematic diagram of the configuration of each part of an encoder according to the embodiment of the present application. As shown in Figure 21, the encoder 210 may include a first determination unit 2101, a first filtering unit 2102 and a first prediction unit 2103, among which: the first determining unit 2101 is configured to determine a first template of a current block, determine a matching template and a reference block, and further configured to determine model parameters according to the first template and the matching template; the first filtering unit 2102 is configured to perform a filtering operation on the reference block according to the model parameters, and determine a filtered reference block; the first prediction unit 2103 is arranged to determine a prediction value of the current block based on the filtered reference block; The first determining unit 2101 is further configured to determine, based on the predicted value of the current block, a prediction residual value of the current block.
[0505] In the embodiments of the present application, it can be understood that a "unit" may be a part of a circuit, a part of a processor, a part of a program or software, etc., and may of course be a module or a non-modular form. Furthermore, each component in the embodiments may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The integrated unit may be realized in the form of hardware or in the form of a software functional module.
[0506] The integrated unit may be realized in the form of a software functional module and stored in a computer-readable storage medium if it is not sold or used as an independent product. Based on this understanding, the technical solution of this embodiment may essentially, or a part that contributes to the prior art, or all or a part of the technical solution may be embodied in the form of a software product, and the computer software product is stored in a storage medium containing several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) or a processor to execute all or a part of the steps of the method of this embodiment. The storage medium includes various media capable of storing program code, such as a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0507] Therefore, an embodiment of the present application provides a computer-readable storage medium applied to the encoder 210, the computer-readable storage medium storing a computer program, which, when executed by the first processor, implements the encoding method of any of the above-mentioned embodiments.
[0508] Based on the configuration of the encoder 210 and the computer-readable storage medium, FIG. 22 is a schematic diagram of a specific hardware structure of the encoder 210 according to an embodiment of the present application. As shown in FIG. 22, the encoder 210 may include a first communication interface 2201, a first memory 2202, and a first processor 2203, and each component is coupled to each other via a first bus system 2204. It can be understood that the first bus system 2204 is used to realize connection communication between these components. In addition to a data bus, the first bus system 2204 further includes a power bus, a control bus, and a status signal bus. However, for clarity, in FIG. 22, various buses are referred to as the first bus system 2204. Among them, the first communication interface 2201 is used to receive and send signals during the process of sending and receiving information to and from other external network elements; The first memory 2202 is used to store a computer program that can be executed on the first processor 2103, The first processor 2203, when executing the computer program, is used to perform any of the encoding methods according to the embodiments of the present application.
[0509] It may be understood that first memory 2202 in the present embodiment may be volatile memory, nonvolatile memory, or both volatile and nonvolatile memory. Nonvolatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may be random access memory (RAM) functioning as an external cache. Many forms of RAM are available, including, by way of example and not limitation, static random access memory (Static RAM, SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (Synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (Enhanced SDRAM, ESDRAM), synchronous link dynamic random access memory (Synchlink DRAM, SLDRAM), and direct Rambus random access memory (DRRAM). The first memory 2202 in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0510] Alternatively, the first processor 2203 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method may be executed by a hardware integrated logic circuit or software instructions in the first processor 2203. The first processor 2203 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, a discrete gate or transistor logic device, or a discrete hardware component. Each method, step, and logic block diagram disclosed in the embodiments of the present application may be realized or executed. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application may be directly embodied to be executed by a hardware decoder processor or using a combination of hardware and software modules in the decoder processor. The software module may be arranged in a storage medium that is mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable read-only memory, a register, etc. This storage medium is arranged in the first memory 2202, and the first processor 2203 reads the information in the first memory 2202 and performs the steps of the above-mentioned method in combination with its hardware.
[0511] It will be understood that the embodiments described herein may be implemented by hardware, software, firmware, middleware, microcode, or a combination thereof. In a hardware implementation, the processing unit may be implemented in one or more application-specific integrated circuits (ASICs), digital signal processing devices (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. In a software implementation, the techniques described herein may be realized by modules (e.g., processes, functions, etc.) that perform the functions described herein. The software code may be stored in memory and executed by the processor. The memory may be implemented within the processor or external to the processor.
[0512] Optionally, as another embodiment, the first processor 2203 is arranged to, when executing said computer program, perform the encoding method according to any of the previous embodiments.
[0513] This embodiment provides an encoder, which determines model parameters based on a first template and a matching template, and the model parameters fully reflect the correlation between the matching template and the first template of the current block. This correlation can be applied to the reference block to effectively correct the prediction value of the template matching technology, thereby improving prediction accuracy, saving bitrate, and improving codec efficiency, and ultimately improving codec performance.
[0514] In another embodiment of the present application, based on the same inventive concept as the above-mentioned embodiment, as shown in Figure 23, a schematic diagram of the configuration of each part of a decoder 230 according to the embodiment of the present application. As shown in Figure 23, the decoder 230 may include a second determination unit 2301, a second filtering unit 2302 and a second prediction unit 2303, among which: the second determining unit 2301 is configured to determine a first template of the current block, determine a matching template and a reference block, and further configured to determine model parameters according to the first template and the matching template; the second filtering unit 2302 is configured to perform a filtering operation on the reference block according to the model parameters to determine a filtered reference block; the second prediction unit 2303 is arranged to determine a prediction value of the current block based on the filtered reference block; The second determining unit 2301 is further arranged to determine a reconstructed value of the current block based on the predicted value of the current block.
[0515] In this embodiment, it can be understood that a "unit" may be a part of a circuit, a part of a processor, a part of a program or software, etc., and may of course be a module or a non-modular form. Furthermore, each component in this embodiment may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The integrated unit may be realized in the form of hardware or in the form of a software functional module.
[0516] The integrated unit may be realized in the form of a software functional module and stored in a computer-readable storage medium when not sold or used as an independent product. Based on this understanding, this embodiment provides a computer-readable storage medium applied to the decoder 230, in which a computer program is stored, and when the computer program is executed by the second processor, the decoding method according to any of the above-mentioned embodiments is realized.
[0517] Based on the configuration of the decoder 230 and a computer-readable storage medium, as shown in FIG. 24, there is shown a schematic diagram of a specific hardware structure of the decoder 230 according to an embodiment of the present application. As shown in FIG. 24, the decoder 230 may include a second communication interface 2401, a second memory 2402, and a second processor 2403, and each component is coupled to each other via a second bus system 2404. It can be understood that the second bus system 2404 is used to realize the connection communication between these components. In addition to a data bus, the second bus system 2404 further includes a power bus, a control bus, and a status signal bus. However, for clarity, in FIG. 24, various buses are referred to as the second bus system 2404. Among them, The second communication interface 2401 is used to receive and transmit signals during the process of transmitting and receiving information to and from other external network elements; The second memory 2402 is used to store a computer program that can be executed on the second processor 2403, The second processor 2403, when executing the computer program, is used to perform any of the decoding methods according to the embodiments of the present application.
[0518] Optionally, as another embodiment, the second processor 2403 is arranged to, when executing said computer program, perform a decoding method according to any of the previous embodiments.
[0519] It can be understood that the hardware functions of the second memory 2402 and the first memory 2202 are similar, and that the hardware functions of the second processor 2403 and the first processor 2203 are similar, and therefore a description thereof will be omitted here.
[0520] This embodiment provides a decoder, which determines model parameters based on a first template and a matching template, and the model parameters fully reflect the correlation between the matching template and the first template of the current block. This correlation can be applied to the reference block to effectively correct the prediction value of the template matching technology, thereby improving prediction accuracy, saving bitrate, and improving codec efficiency, and ultimately improving codec performance.
[0521] In yet another embodiment of the present application, a schematic diagram of the configuration of each part of a codec system according to an embodiment of the present application is shown in Fig. 25. As shown in Fig. 25, a codec system 250 may include an encoder 2501 and a decoder 2502.
[0522] In an embodiment of the present application, the encoder 2501 may be an encoder described in any of the above-mentioned embodiments, and the decoder 2502 may be a decoder described in any of the above-mentioned embodiments.
[0523] It should be noted that, as used herein, terms such as "comprises," "includes," and other variations thereof are intended to include an exclusive inclusion, such that a process, method, article, or apparatus that includes a set of elements includes not only those elements but also other elements not expressly listed or that are inherent in such process, method, article, or apparatus. Unless further limited, an element defined by the expression "comprises" does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes that element.
[0524] The numbers of the above-mentioned embodiments of the present application are merely for the purpose of explanation and do not indicate the superiority or inferiority of the embodiments.
[0525] The methods disclosed in the several method embodiments provided by this application may be consistently combined in any combination to obtain new method embodiments.
[0526] The methods disclosed in any of the product and method embodiments provided herein may be consistently combined in any manner to yield new product embodiments.
[0527] The features disclosed in any method or apparatus embodiment provided by this application may be consistently combined in any combination to produce new method or apparatus embodiments.
[0528] The above content is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto, and any modifications or replacements that can be easily conceived by anyone skilled in the art within the technical scope disclosed in the present application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be subject to the scope of protection of the claims. [Industrial Applicability]
[0529] In an embodiment of the present application, both the encoding side and the decoding side determine a first template for a current block, determine a matching template and a reference block, determine model parameters based on the first template and the matching template, perform a filtering process on the reference block based on the model parameters, determine a filtered reference block, and determine a predicted value of the current block based on the filtered reference block. This allows the encoding side to determine a prediction residual value of the current block based on the predicted value of the current block, and the decoding side to determine a reconstructed value of the current block based on the predicted value of the current block. That is, the model parameters are determined based on the first template and the matching template, and the model parameters fully reflect the relationship between the matching template and the first template of the current block. This relationship is applied to the reference block, and the reconstructed pixels are filtered and corrected. The filtered reconstructed pixels are then used as the predicted pixels of the current block, thereby improving prediction accuracy, saving bit rate, improving codec efficiency, and ultimately improving codec performance. In Section 1, a decoding method is provided that is applied to a decoder, the method comprising: determining a first template for the current block and determining a matching template and a reference block; determining model parameters based on the first template and the matching template; performing a filtering process on the reference block based on the model parameters to determine a filtered reference block; determining a prediction value for the current block based on the filtered reference block; determining a reconstructed value of the current block based on the predicted value of the current block. In the second section, the step of determining the first template of the current block based on the first section is as follows: determining a template type for the current block; and determining a first template for the current block based on a template type of the current block. In clause 3, determining a template type of the current block based on clause 2, determining a template type of the current block based on reference pixels of the current block, wherein the reference pixels of the current block include at least one of left neighboring reference pixels of the current block, upper neighboring reference pixels of the current block, upper left neighboring reference pixels of the current block, lower left neighboring reference pixels of the current block, and upper right neighboring reference pixels of the current block; Alternatively, decoding the bitstream and determining the template type of the current block; Alternatively, the method includes determining the template type of the current block based on the size of the current block. In clause 4, determining a template type of the current block based on clause 3 includes: determining that the template type of the current block is a first value if the left neighboring reference pixel of the current block, the upper neighboring reference pixel of the current block, and the upper left neighboring reference pixel of the current block are all available; determining that the template type of the current block is a second value if the left-neighboring reference pixel of the current block is available; If the upper neighboring reference pixels of the current block are available, determining that the template type of the current block is a third value; determining that the template type of the current block is a fourth value if the left adjacent reference pixel of the current block and the upper left adjacent reference pixel of the current block are both available; determining that the template type of the current block is a fifth value if the left neighboring reference pixel of the current block and the lower-left neighboring reference pixel of the current block are both available; If both the upper neighboring reference pixels of the current block and the upper right neighboring reference pixels of the current block are available, determining that the template type of the current block is a sixth value. In Section 5, the step of determining a matching template based on Section 1 is determining the initial vector parameters of the current block; determining a search area based on the initial vector parameters; performing a search within the search area based on template matching to determine target vector parameters; determining the matching template based on the target vector parameters and the first template. In Section 6, based on Section 5, the step of determining the initial vector parameters of the current block is: determining a vector parameter candidate list for constructing the current block based on a prediction mode parameter of the current block; and determining the initial vector parameters based on the vector parameter candidate list. In Section 7, the step of determining a vector parameter candidate list for constructing the current block based on the prediction mode parameter of the current block based on Section 6 includes: determining a list of candidate merge vector parameters for constructing the current block based on the prediction mode parameters of the current block; or The method includes determining a candidate list of AMVP vector parameters for constructing the current block based on the prediction mode parameters of the current block. In Section 8, based on Section 5, the step of determining the initial vector parameters of the current block is: The method includes determining the initial vector parameters of the current block as predetermined vector parameters based on a prediction mode parameter of the current block. In the ninth term, based on the eighth term, the predetermined vector parameter is zero. In paragraph 10, the step of determining a search region based on the initial vector parameters based on paragraph 5 is The method includes determining the search area based on the initial vector parameters and a predetermined search range. In paragraph 11, the method for determining the search range based on paragraph 10 is A predetermined horizontal component search range is set as a horizontal component search range of the predetermined search range; A predetermined vertical component search range is set as a vertical component search range of the predetermined search range; decoding a bitstream and determining a horizontal component search range and / or a vertical component search range of the predetermined search range; and determining a horizontal component search range and / or a vertical component search range of the predetermined search range according to a size of the current block. In paragraph 12, the step of determining a search region based on the initial vector parameters based on paragraph 5 includes: determining the current block as an inter prediction mode based on a prediction mode parameter of the current block, and determining the search area in a reference image based on the initial vector parameter; determining the search area in the current image based on the initial vector parameters; and In clause 13, based on clause 5, the intra prediction mode is determined based on the prediction mode parameters of the current block, and the search area includes at least one of a partial area of the reconstructed coding tree block of the current image, the entire area of the reconstructed coding tree block of the current image, the entire reconstructed area of the current coding tree block, and a partial area of the reconstructed coding tree block in which the current block is located. In paragraph 14, based on paragraph 5, the step of searching within the search area based on template matching and determining target vector parameters includes: searching for and determining a reference template within the search area, and calculating a matching cost value between the reference template and the first template; determining the vector parameters of the reference template corresponding to the minimum matching cost value as the target vector parameters. In paragraph 15, based on paragraph 14, the step of searching and determining a reference template within the search area includes: Searching and determining available reference templates within the search area. In paragraph 16, based on paragraph 15, the availability determination condition of the reference template is: the first sampling point in the template does not extend beyond the image boundary in which it is located; the second sampling point in the reference block corresponding to the template does not extend beyond the image boundary in which it is located; The first sampling point in the template does not extend beyond the search area. the second sampling point in the reference block corresponding to the template does not exceed the search area; The first sampling points in the template are all reconstructed, and The second sampling points in the reference block corresponding to the template are all reconstructed. In paragraph 17, based on paragraph 15 or 16, the availability determination condition of the reference template is: The first sampling point in the template and the current block are in the same sub-image; The second sampling point in the reference block corresponding to the template and the current block are in the same sub-image; and The second sampling point in the reference block corresponding to the template is not in the current block. In paragraph 18, based on paragraph 16, the first sampling points are each sampling point in a template, or are predetermined first identification sampling points. In paragraph 19, based on paragraph 18, the first identification sampling points include sampling points at at least one corner position in the template. In clause 20, based on clause 16, the second sampling points are sampling points in a reference block corresponding to a template, or are predetermined second identification sampling points. In clause 21, based on clause 20, the second identification sampling points include sampling points at at least one corner position in the reference block corresponding to the template. In paragraph 22, based on paragraph 5, the step of searching within the search area based on template matching and determining target vector parameters includes: performing a first search within the search area to determine the target vector parameters; or conducting a second search within the search area to determine the target vector parameters; The search step size corresponding to the first search is greater than the search step size corresponding to the second search. In paragraph 23, based on paragraph 5, the step of searching within the search area based on template matching and determining target vector parameters includes: performing a first search within the search area to determine first vector parameters; and determining an initial matching template based on the first vector parameters; determining a first search area based on the initial matching template, and performing a second search within the first search area to determine the target vector parameters; A search step size corresponding to the first search is larger than a search step size corresponding to the second search, and the first search area is smaller than the search area. In paragraph 24, based on paragraph 5, the search area includes at least one sub-search area, and the step of searching within the search area based on template matching and determining target vector parameters includes: performing a search within each of the at least one sub-search area and determining optimal vector parameters and corresponding matching cost values for each sub-search area; determining an optimal vector parameter corresponding to a minimum matching cost value based on the optimal vector parameter of each of the sub-search regions and the corresponding matching cost value; and determining the optimal vector parameters corresponding to the minimum matching cost value as the target vector parameters. In paragraph 25, based on paragraph 24, the step of searching within the search area based on template matching and determining target vector parameters includes: performing a first search within each of the at least one sub-search area to determine optimal vector parameters for each sub-search area and a corresponding second search area; performing area determination based on the respective optimal vector parameters of each sub-search area and the corresponding second search area to determine at least two target sub-search areas involved in the second search; performing a second search within the at least two target sub-search areas to determine optimal vector parameters corresponding to the at least two target sub-search areas; and determining the optimal vector parameters corresponding to the at least two target sub-search regions as the target vector parameters. In paragraph 26, the step of determining the reference block based on paragraph 5 includes: Determining the reference block based on the target vector parameters. In paragraph 27, based on paragraph 1, the method comprises: The method further includes the step of decoding the bitstream and determining a value of a first syntax element identification information, the first syntax element identification information being used to indicate whether template matching is applied to the current block. In clause 28, the step of determining the reference block based on clause 1 includes: decoding the bitstream to determine a value of a third syntax element identification; and determining a reference block for the current block based on the value of the third syntax element identification information. In paragraph 29, based on paragraph 1, the method further comprises: traversing a search area to retrieve a plurality of reference templates and determining model parameters based on the first template and the reference templates; performing a filtering process on the reference template based on the model parameters to obtain a filtered reference template; calculating a matching cost value between the filtered reference template and the first template; and determining the reference block of the reference template corresponding to the minimum matching cost value as the reference block of the current block. In the 30th term, based on the 1st term, the model parameters include the coefficients of the target filter. In paragraph 31, the step of determining model parameters based on the first template and the matching template based on paragraph 30 includes: calculating the product of pixel reconstruction values of the reference block and corresponding coefficients of the target filter; setting a first output value of the target filter equal to a sum of n of the products, where n represents the number of coefficients of the target filter and is a positive integer; determining the filtered reference block based on a first output value of the target filter. In paragraph 32, the step of determining model parameters based on the first template and the matching template based on paragraph 31 includes: calculating the product of pixel reference values of a second boundary filling region corresponding to the reference block and corresponding coefficients of the target filter; And / or, the method further includes a step of calculating a product of a pixel reference value of a reference template corresponding to the reference block and a corresponding coefficient of the target filter. In paragraph 33, based on paragraph 1, the method comprises: determining a boundary fill region of a reference template corresponding to the reference block; and performing boundary pixel filling on the boundary fill region. In clause 34, based on clause 33, the boundary filling region includes at least one of an edge-adjacent region of the matching template, a point-adjacent region of the matching template, an edge-adjacent region of the reference block, and a point-adjacent region of the reference block. In paragraph 35, the step of performing boundary pixel filling on the boundary filling region based on paragraph 33 includes: performing boundary pixel filling on a first boundary filling region corresponding to the matching template using neighboring pixel reconstruction values within the matching template; and performing boundary pixel filling on a second boundary filling region corresponding to the reference template using neighboring pixel reconstruction values within the reference block. In paragraph 36, based on paragraph 33, the step of performing boundary pixel filling on the boundary filling region includes: Performing boundary pixel filling on the boundary fill region using predetermined pixel values. In paragraph 37, based on paragraph 33, the method comprises: Determining that a sampling point at a first location within the boundary fill region is unavailable and performing boundary pixel filling for the first location within the boundary fill region. In paragraph 38, the criteria for determining whether a sampling point is available based on paragraph 37 are as follows: The sampling point at the first position is a reconstructed one. the first location is located within the search area; the first location is located within the image in which the reference block is located; and The first location includes at least one of being located within the sub-image in which the reference block is located. In paragraph 39, the method according to paragraph 1, paragraph 27 or paragraph 28 comprises: decoding the bitstream to determine a value of a second syntax element identification; and performing a filtering process on the reference block based on the model parameters, determining a filtered reference block, and determining a predicted value of the current block based on the filtered reference block when the second syntax element identification information is used to indicate that a filter model is applied to the current block. In paragraph 40, based on paragraph 39, the method comprises: If the second syntax element identification information is used to indicate that a filter model is not applied to the current block, the method further includes a step of setting a reconstructed pixel value in the reference block as a predicted value of the current block. In paragraph 41, an encoding method is provided to be applied to an encoder, the method comprising: determining a first template for the current block and determining a matching template and a reference block; determining model parameters based on the first template and the matching template; performing a filtering process on the reference block based on the model parameters to determine a filtered reference block; determining a prediction value for the current block based on the filtered reference block; and determining a prediction residual value for the current block based on the prediction value for the current block. In clause 42, the step of determining a first template for a current block based on clause 41 includes: determining a template type for the current block; and determining a first template for the current block based on a template type of the current block. In clause 43, the step of determining a template type of the current block based on clause 42 includes: determining a template type of the current block based on reference pixels of the current block, wherein the reference pixels of the current block include at least one of left neighboring reference pixels of the current block, upper neighboring reference pixels of the current block, upper left neighboring reference pixels of the current block, lower left neighboring reference pixels of the current block, and upper right neighboring reference pixels of the current block; Alternatively, decoding the bitstream and determining the template type of the current block; Alternatively, the method includes determining the template type of the current block based on the size of the current block. In clause 44, the step of determining a template type of the current block based on clause 43 includes: determining that the template type of the current block is a first value if the left neighboring reference pixel of the current block, the upper neighboring reference pixel of the current block, and the upper left neighboring reference pixel of the current block are all available; determining that the template type of the current block is a second value if the left-neighboring reference pixel of the current block is available; If the upper neighboring reference pixels of the current block are available, determining that the template type of the current block is a third value; determining that the template type of the current block is a fourth value if the left adjacent reference pixel of the current block and the upper left adjacent reference pixel of the current block are both available; determining that the template type of the current block is a fifth value if the left neighboring reference pixel of the current block and the lower-left neighboring reference pixel of the current block are both available; If both the upper neighboring reference pixels of the current block and the upper right neighboring reference pixels of the current block are available, determining that the template type of the current block is a sixth value. Paragraph 45 provides that, based on paragraph 41, the step of determining a matching template comprises: determining the initial vector parameters of the current block; determining a search area based on the initial vector parameters; performing a search within the search area based on template matching to determine target vector parameters; determining the matching template based on the target vector parameters and the first template. In clause 46, the step of determining the initial vector parameters of the current block based on clause 45 includes: determining a vector parameter candidate list for constructing the current block based on a prediction mode parameter of the current block; and determining the initial vector parameters based on the vector parameter candidate list. In clause 47, the step of determining a vector parameter candidate list for constructing the current block based on a prediction mode parameter of the current block based on clause 46 includes: determining a list of candidate merge vector parameters for constructing the current block based on the prediction mode parameters of the current block; or The method includes determining a candidate list of AMVP vector parameters for constructing the current block based on the prediction mode parameters of the current block. In clause 48, the step of determining the initial vector parameters of the current block based on clause 45 includes: The method includes determining the initial vector parameters of the current block as predetermined vector parameters based on a prediction mode parameter of the current block. In item 49, based on item 48, the predetermined vector parameter is zero. In paragraph 50, the step of determining a search region based on the initial vector parameters based on paragraph 45 includes: The method includes determining the search area based on the initial vector parameters and a predetermined search range. In paragraph 51, based on paragraph 50, the method for determining the predetermined search range is as follows: A predetermined horizontal component search range is set as a horizontal component search range of the predetermined search range; A predetermined vertical component search range is set as a vertical component search range of the predetermined search range; decoding a bitstream and determining a horizontal component search range and / or a vertical component search range of the predetermined search range; and determining a horizontal component search range and / or a vertical component search range of the predetermined search range according to a size of the current block. In paragraph 52, the step of determining a search region based on the initial vector parameters based on paragraph 45 includes: determining the current block as an inter prediction mode based on a prediction mode parameter of the current block, and determining the search area in a reference image based on the initial vector parameter; determining the search area in the current image based on the initial vector parameters; and In clause 53, based on clause 45, the intra prediction mode is determined based on the prediction mode parameters of the current block, and the search area includes at least one of a partial area of the reconstructed coding tree block of the current image, the entire area of the reconstructed coding tree block of the current image, the entire reconstructed area of the current coding tree block, and a partial area of the reconstructed coding tree block in which the current block is located. In paragraph 54, based on paragraph 45, the step of searching within the search area based on the template matching and determining target vector parameters includes: searching for and determining a reference template within the search area, and calculating a matching cost value between the reference template and the first template; determining the vector parameters of the reference template corresponding to the minimum matching cost value as the target vector parameters. In paragraph 55, based on paragraph 54, the step of searching and determining a reference template within the search area includes: Searching and determining available reference templates within the search area. In paragraph 56, based on paragraph 55, the availability determination condition of the reference template is: the first sampling point in the template does not extend beyond the image boundary in which it is located; the second sampling point in the reference block corresponding to the template does not extend beyond the image boundary in which it is located; The first sampling point in the template does not extend beyond the search area. the second sampling point in the reference block corresponding to the template does not exceed the search area; The first sampling points in the template are all reconstructed, and The second sampling points in the reference block corresponding to the template are all reconstructed. In paragraph 57, the availability condition of the reference template based on paragraph 55 or 56 is: The first sampling point in the template and the current block are in the same sub-image; The second sampling point in the reference block corresponding to the template and the current block are in the same sub-image; and The second sampling point in the reference block corresponding to the template is not in the current block. In clause 58, based on clause 56, the first sampling points are each sampling point in a template, or are predetermined first identified sampling points. In clause 59, based on clause 58, the first identification sampling points include sampling points at at least one corner position in the template. In clause 60, based on clause 56, the second sampling points are sampling points in a reference block corresponding to a template, or are predetermined second identification sampling points. In clause 61, based on clause 60, the second identification sampling points include sampling points at at least one corner position in a reference block corresponding to the template. In paragraph 62, based on paragraph 45, the step of searching within the search area based on template matching and determining target vector parameters includes: performing a first search within the search area to determine the target vector parameters; or conducting a second search within the search area to determine the target vector parameters; The search step size corresponding to the first search is greater than the search step size corresponding to the second search. In paragraph 63, based on paragraph 45, the step of searching within the search area based on the template matching and determining target vector parameters includes: performing a first search within the search area to determine first vector parameters; and determining an initial matching template based on the first vector parameters; determining a first search area based on the initial matching template, and performing a second search within the first search area to determine the target vector parameters; A search step size corresponding to the first search is larger than a search step size corresponding to the second search, and the first search area is smaller than the search area. In paragraph 64, based on paragraph 45, the search area includes at least one sub-search area, and the step of searching within the search area based on template matching and determining target vector parameters includes: performing a search within each of the at least one sub-search area and determining optimal vector parameters and corresponding matching cost values for each sub-search area; determining an optimal vector parameter corresponding to a minimum matching cost value based on the optimal vector parameter of each of the sub-search regions and the corresponding matching cost value; and determining the optimal vector parameters corresponding to the minimum matching cost value as the target vector parameters. In paragraph 65, based on paragraph 64, the step of searching within the search area based on template matching and determining target vector parameters includes: performing a first search within each of the at least one sub-search area to determine optimal vector parameters for each sub-search area and a corresponding second search area; performing area determination based on the respective optimal vector parameters of each sub-search area and the corresponding second search area to determine at least two target sub-search areas involved in the second search; performing a second search within the at least two target sub-search areas to determine optimal vector parameters corresponding to the at least two target sub-search areas; and determining the optimal vector parameters corresponding to the at least two target sub-search regions as the target vector parameters. In clause 66, the step of determining the reference block based on clause 45 includes: Determining the reference block based on the target vector parameters. Paragraph 67 provides that, based on paragraph 41, the method comprises: determining a value of a first syntax element identification, the first syntax element identification being used to indicate whether template matching is applied to the current block; and encoding the value of the first syntax element identification information and signaling the resulting coded bits in a bitstream. Clause 68 includes a step of determining a value of a third syntax element identifier based on clause 41, the third syntax element identifier being used to indicate a reference block of the current block; and encoding the value of the third syntax element identification information and signaling the resulting coded bits in a bitstream. In paragraph 69, the step of determining the reference block based on paragraph 41 or 68 includes: if it is determined that template matching is applied to the current block, traversing a search area to search for a plurality of reference blocks, and performing a filtering process on the reference blocks according to the model parameters to determine a filtered reference block; calculating distortion parameters of the filtered reference block and the current source block; determining a reference block corresponding to the minimum distortion parameter. In paragraph 70, the step of determining the reference block based on paragraph 41 or 68 includes: traversing a search area to retrieve a plurality of reference templates and determining model parameters based on the first template and the reference templates; performing a filtering process on the reference template based on the model parameters to obtain a filtered reference template; calculating a matching cost value between the filtered reference template and the first template; and determining the reference block of the reference template corresponding to the minimum matching cost value as the reference block of the current block. In item 71, based on item 41, the model parameters include coefficients of a target filter. In paragraph 72, the step of determining model parameters based on the first template and the matching template based on paragraph 71 includes: calculating the product of pixel reconstruction values of the reference block and corresponding coefficients of the target filter; setting a first output value of the target filter equal to a sum of n of the products, where n represents the number of coefficients of the target filter and is a positive integer; and determining the filtered reference block based on a first output value of the target filter. In paragraph 73, the step of determining model parameters based on the first template and the matching template based on paragraph 72 includes: calculating the product of pixel reference values of a second boundary filling region corresponding to the reference block and corresponding coefficients of the target filter; And / or, the method further includes a step of calculating a product of a pixel reference value of a reference template corresponding to the reference block and a corresponding coefficient of the target filter. Paragraph 74 provides that, based on paragraph 41, the method comprises: determining a boundary fill region of a reference template corresponding to the reference block; and performing boundary pixel filling on the boundary fill region. In clause 75, based on clause 74, the boundary filling region includes at least one of an edge-adjacent region of the matching template, a point-adjacent region of the matching template, an edge-adjacent region of the reference block, and a point-adjacent region of the reference block. In paragraph 76, the step of performing boundary pixel filling on the boundary filling region based on paragraph 74 includes: performing boundary pixel filling on a first boundary filling region corresponding to the matching template using neighboring pixel reconstruction values within the matching template; and performing boundary pixel filling on a second boundary filling region corresponding to the reference template using neighboring pixel reconstruction values within the reference block. In paragraph 77, the step of performing boundary pixel filling on the boundary filling region based on paragraph 74 includes: Performing boundary pixel filling on the boundary fill region using predetermined pixel values. In paragraph 78, based on paragraph 74, the method comprises: Determining that a sampling point at a first location within the boundary fill region is unavailable and performing boundary pixel filling for the first location within the boundary fill region. In paragraph 79, the criteria for determining whether a sampling point is available based on paragraph 78 are as follows: The sampling point at the first position is a reconstructed one. the first location is located within the search area; the first location is located within the image in which the reference block is located; and The first location includes at least one of being located within the sub-image in which the reference block is located. In paragraph 80, the method according to any one of paragraphs 41, 67 or 68 comprises: determining a value of a second syntax element identification, the second syntax element identification being used to indicate whether a filter model is to be applied to the current block; and encoding the value of the second syntax element identification information and signaling the resulting coded bits in a bitstream. In paragraph 81, based on paragraph 80, the method comprises: If a filter model is not applied to the current block, the method further includes the step of using reconstructed pixel values in the reference block as predicted values for the current block. In clause 82, a bitstream is provided, the bitstream being generated by bit coding based on information to be coded, the information to be coded being The syntax element identification information includes at least one of a prediction residual value of a current block, the number of coefficients of a target filter, the shape of the target filter, a value of a first syntax element identification information, a value of a second syntax element identification information, and a value of a third syntax element identification information, wherein the first syntax element identification information is used to indicate whether intra template matching is applied to the current block, the second syntax element identification information is used to indicate whether a filter model is applied to the current block, and the third syntax element identification information is used to indicate a reference block of the current block. In clause 83, an encoder is provided, the encoder comprising: a first determining unit, a first filtering unit, and a first predicting unit; the first determining unit is configured to determine a first template of a current block, determine a matching template and a reference block, and determine model parameters based on the first template and the matching template; the first filtering unit is configured to perform a filtering operation on the reference block based on the model parameters to determine a filtered reference block; the first prediction unit is configured to determine a prediction value of the current block based on the filtered reference block; The first determining unit is further configured to determine, based on the predicted value of the current block, a prediction residual value of the current block. In clause 84, an encoder is provided, the encoder comprising a first memory and a first processor; the first memory is used to store a computer program executable on the first processor; The first processor is used to execute the method according to any one of paragraphs 41 to 81 when executing the computer program. In clause 85, a decoder is provided, the decoder comprising a second decision unit, a second filtering unit, and a second prediction unit; the second determining unit is configured to determine a first template of a current block, determine a matching template and a reference block, and determine model parameters based on the first template and the matching template; the second filtering unit is configured to perform a filtering operation on the reference block based on the model parameters to determine a filtered reference block; the second prediction unit is configured to determine a prediction value of the current block based on the filtered reference block; The second determining unit is further configured to determine a reconstructed value of the current block based on the predicted value of the current block. In clause 86, a decoder is provided, the decoder comprising a second memory and a second processor; the second memory is used to store a computer program executable on the second processor; The second processor is used to execute the method according to any one of paragraphs 1 to 40 when executing the computer program. In clause 87, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program, and when the computer program is executed, the method according to any one of clauses 1 to 40 or the method according to any one of clauses 41 to 81 is realized.
Claims
1. A decoding method applied to a decoder, comprising: determining a first template for the current block and determining a matching template and a reference block; determining model parameters based on the first template and the matching template; performing a filtering process on the reference block based on the model parameters to determine a filtered reference block; determining a prediction value for the current block based on the filtered reference block; determining a reconstructed value of the current block based on the predicted value of the current block.
2. The step of determining a first template for the current block comprises: determining a template type for the current block; and determining a first template for the current block based on a template type of the current block.
3. The step of determining a template type of the current block comprises: determining a template type of the current block based on reference pixels of the current block, wherein the reference pixels of the current block include at least one of left neighboring reference pixels of the current block, upper neighboring reference pixels of the current block, upper left neighboring reference pixels of the current block, lower left neighboring reference pixels of the current block, and upper right neighboring reference pixels of the current block; Alternatively, decoding the bitstream and determining the template type of the current block; Alternatively, the method of claim 2 further comprises determining the template type of the current block based on a size of the current block.
4. The step of determining a template type of the current block comprises: determining that the template type of the current block is a first value if the left neighboring reference pixel of the current block, the upper neighboring reference pixel of the current block, and the upper left neighboring reference pixel of the current block are all available; determining that the template type of the current block is a second value if the left-neighboring reference pixel of the current block is available; If the upper neighboring reference pixels of the current block are available, determining that the template type of the current block is a third value; determining that the template type of the current block is a fourth value if both the left neighboring reference pixel of the current block and the upper left neighboring reference pixel of the current block are available; determining that the template type of the current block is a fifth value if both the left neighboring reference pixel of the current block and the lower-left neighboring reference pixel of the current block are available; and determining that the template type of the current block is a sixth value if both the upper neighboring reference pixels of the current block and the upper right neighboring reference pixels of the current block are available.
5. The step of determining a matching template includes: determining a vector parameter candidate list for constructing the current block based on a prediction mode parameter of the current block; determining a target vector parameter based on the vector parameter candidate list; and determining the matching template based on the target vector parameters and the first template.
6. The step of determining a vector parameter candidate list for constructing the current block based on the prediction mode parameter of the current block includes: determining a merge vector parameter candidate list for constructing the current block based on the prediction mode parameters of the current block; or 6. The method of claim 5, comprising determining an AMVP vector parameter candidate list for constructing a current block based on a prediction mode parameter of the current block.
7. The method of claim 1 , wherein the model parameters include coefficients of a target filter.
8. The step of filtering the reference block based on the model parameters and determining a filtered reference block includes: calculating the product of pixel reconstruction values of the reference block and corresponding coefficients of the target filter; setting a first output value of the target filter equal to a sum of n of the products, where n represents the number of coefficients of the target filter and n is a positive integer; and determining the filtered reference block based on a first output value of the target filter.
9. The method comprises: determining a boundary fill region of a reference template corresponding to the reference block; The method of claim 1 further comprising: performing boundary pixel filling on the boundary fill region.
10. The method of claim 9 , wherein the boundary filling regions include at least one of edge-adjacent regions of the matching template, point-adjacent regions of the matching template, edge-adjacent regions of the reference block, and point-adjacent regions of the reference block.
11. The step of performing boundary pixel filling on the boundary filling region includes: performing boundary pixel filling on a first boundary filling region corresponding to the matching template using neighboring pixel reconstruction values within the matching template; and performing boundary pixel filling on a second boundary filling region corresponding to the reference template using neighboring pixel reconstruction values within the reference block.
12. The method comprises:
10. The method of claim 9, further comprising determining that a sampling point at a first location within the boundary fill region is unavailable and performing boundary pixel filling for the first location within the boundary fill region.
13. The criteria for determining whether the sampling point is available are: The sampling point at the first position is a reconstructed one; the first location is located within the search area; the first location is located within the image in which the reference block is located; and The method of claim 12 , wherein the first location comprises at least one of being located within a sub-image in which the reference block is located.
14. A coding method applied to an encoder, comprising: determining a first template for the current block and determining a matching template and a reference block; determining model parameters based on the first template and the matching template; performing a filtering process on the reference block based on the model parameters to determine a filtered reference block; determining a prediction value for the current block based on the filtered reference block; determining a prediction residual value for the current block based on the prediction value of the current block.
15. The step of determining a first template for the current block comprises: determining a template type for the current block; and determining a first template for the current block based on a template type of the current block.
16. The step of determining a template type of the current block comprises: determining a template type of the current block based on reference pixels of the current block, wherein the reference pixels of the current block include at least one of left neighboring reference pixels of the current block, upper neighboring reference pixels of the current block, upper left neighboring reference pixels of the current block, lower left neighboring reference pixels of the current block, and upper right neighboring reference pixels of the current block; Alternatively, the method of claim 15 further comprises determining the template type of the current block based on a size of the current block.
17. The step of determining a template type of the current block comprises: determining that the template type of the current block is a first value if the left neighboring reference pixel of the current block, the upper neighboring reference pixel of the current block, and the upper left neighboring reference pixel of the current block are all available; determining that the template type of the current block is a second value if the left-neighboring reference pixel of the current block is available; If the upper neighboring reference pixels of the current block are available, determining that the template type of the current block is a third value; determining that the template type of the current block is a fourth value if both the left neighboring reference pixel of the current block and the upper left neighboring reference pixel of the current block are available; determining that the template type of the current block is a fifth value if both the left neighboring reference pixel of the current block and the lower-left neighboring reference pixel of the current block are available; and determining that the template type of the current block is a sixth value if both the upper neighboring reference pixels of the current block and the upper right neighboring reference pixels of the current block are available.
18. The step of determining a matching template includes: determining a vector parameter candidate list for constructing the current block based on a prediction mode parameter of the current block; determining a target vector parameter based on the vector parameter candidate list; and determining the matching template based on the target vector parameters and the first template.
19. The step of determining a vector parameter candidate list for constructing the current block based on the prediction mode parameter of the current block includes: determining a merge vector parameter candidate list for constructing the current block based on the prediction mode parameters of the current block; or 20. The method of claim 18, comprising determining an AMVP vector parameter candidate list for constructing a current block based on a prediction mode parameter of the current block.
20. A computer-readable storage medium having a computer program and a bitstream stored therein, the computer program being executed by a processor, determining a first template for the current block and determining a matching template and a reference block; determining model parameters based on the first template and the matching template; performing a filtering process on the reference block based on the model parameters to determine a filtered reference block; determining a prediction value for the current block based on the filtered reference block; and determining a prediction residual value of the current block based on the prediction value of the current block, thereby generating the bitstream.