Decoding method, encoding method, decoding device, and encoding device

The composite fusion prediction technology in digital video encoding and decoding enhances decoding performance by combining IntraTMP with another intra prediction block, addressing prediction errors in complex scenes and improving coding efficiency.

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

Patent Information

Application Number
JP2025539741
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-01-03
Publication Date
2026-01-06

AI Technical Summary

Technical Problem

Existing digital video compression technologies face challenges in improving encoding and decoding performance, particularly in scenes with complex pixel changes and noise, such as natural content sequences, where IntraTMP mode may reduce decoding performance due to prediction errors.

Method used

A decoding and encoding method that utilizes a composite fusion prediction technology based on intra template matching prediction (IntraTMP), combining a matching block obtained through IntraTMP with another intra prediction block, and applying weighted fusion to enhance prediction accuracy.

Benefits of technology

Improves decoding performance by correcting prediction errors, achieving better coding efficiency with minimal increase in complexity, as demonstrated by reduced bit distortion and minimal time increments in encoding and decoding processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2026500444000001_ABST
    Figure 2026500444000001_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a decoding method, an encoding method, a decoding device, and an encoding device, which include: determining a residual block of a current block in a current sequence based on a bitstream, determining a first predicted block of the current block based on an intra template matching prediction mode (IntraTMP mode), determining a second predicted block of the current block based on a first prediction mode, where the first prediction mode and the IntraTMP mode are different, determining a target predicted block of the current block based on the first predicted block and the second predicted block, and obtaining a reconstructed block of the current block based on the residual block of the current block and the target predicted block.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The embodiments of the present application relate to the field of encoding and decoding, and more particularly to a decoding method, an encoding method, a decoding device, and an encoding device. [Background technology]

[0002] Digital video compression technology is primarily a technology for compressing large amounts of digital video data for transmission, storage, etc. With the rapid increase in Internet video and people's increasing demand for higher video resolution, although existing digital video compression standards can achieve video decompression technology, there is currently a need to develop better digital video decompression technology to improve compression efficiency. Summary of the Invention [Problem to be solved by the invention]

[0003] The embodiments of the present application provide a decoding method, an encoding method, a decoding device and an encoding device, which can improve the encoding and decoding performance. [Means for solving the problem]

[0004] According to a first aspect, an embodiment of the present application provides a decoding method.

[0005] The decoding method is determining a residual block of a current block in a current sequence based on the bitstream; determining a first prediction block of the current block based on an intra template matching prediction mode (IntraTMP mode); determining a second prediction block for the current block based on a first prediction mode, the first prediction mode and the IntraTMP mode being different; determining a target predicted block for the current block based on the first predicted block and the second predicted block; and obtaining a reconstructed block of the current block based on the residual block of the current block and the target predicted block.

[0006] According to a second aspect, an embodiment of the present application provides an encoding method.

[0007] The encoding method comprises: determining a first prediction block of a current block in a current sequence based on an intra-template matching prediction mode (IntraTMP mode); determining a second prediction block for the current block based on a first prediction mode, the first prediction mode and the IntraTMP mode being different; determining a target predicted block for the current block based on the first predicted block and the second predicted block; Obtaining a residual block of the current block according to the target predicted block and the original block of the current block; encoding a residual block of the current block.

[0008] According to a third aspect, an embodiment of the present application provides a decoding device.

[0009] The decoding device a residual unit configured to determine a residual block of a current block in a current sequence based on the bitstream; a first prediction unit configured to determine a first prediction block for the current block based on an intra template matching prediction mode (IntraTMP mode); a second prediction unit configured to determine a second prediction block of the current block based on a first prediction mode, the first prediction mode and the IntraTMP mode being different; a determining unit configured to determine a target predicted block of the current block based on the first predicted block and the second predicted block; a reconstruction unit configured to obtain a reconstructed block of the current block based on a residual block of the current block and the target predicted block.

[0010] According to a fourth aspect, an embodiment of the present application provides an encoding device.

[0011] The encoding device a first prediction unit configured to determine a first prediction block of a current block in a current sequence based on an intra template matching prediction mode (IntraTMP mode); a second prediction unit configured to determine a second prediction block of the current block based on a first prediction mode, the first prediction mode and the IntraTMP mode being different; a determining unit configured to determine a target predicted block of the current block based on the first predicted block and the second predicted block; a residual unit configured to obtain a residual block of the current block based on the target predicted block and an original block of the current block; a coding unit configured to code a residual block of the current block.

[0012] According to a fifth aspect, an embodiment of the present application provides a decoding device.

[0013] The decoding device a processor used to implement computer instructions; a computer-readable storage medium having computer instructions stored thereon, the computer instructions being loaded by a processor and used to perform the decoding method of the first aspect above or each implementation thereof.

[0014] In one embodiment, the processor(s) are one or more, and the memory(s) are one or more.

[0015] In one embodiment, the computer-readable storage medium may be integral with the processor, or the computer-readable storage medium may be separate from the processor.

[0016] According to a sixth aspect, an embodiment of the present application provides an encoding device.

[0017] The encoding device a processor used to implement computer instructions; a computer-readable storage medium having computer instructions stored thereon, the computer instructions being loaded by a processor and used to perform the encoding method of the second aspect above or each embodiment thereof.

[0018] In one embodiment, the processor(s) are one or more, and the memory(s) are one or more.

[0019] In one embodiment, the computer-readable storage medium may be integral with the processor, or the computer-readable storage medium may be separate from the processor.

[0020] According to a seventh aspect, an embodiment of the present application provides a computer-readable storage medium.

[0021] The computer-readable storage medium stores computer instructions that, when read and executed by a processor of a computer device, cause the computer device to perform the decoding method according to the first aspect or the encoding method according to the second aspect.

[0022] According to an eighth aspect, embodiments of the present application provide a computer program product or a computer program.

[0023] The computer program product or computer program includes computer instructions stored in a computer-readable storage medium, and a processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions to cause the computer device to perform the decoding method according to the first aspect or the encoding method according to the second aspect.

[0024] According to a ninth aspect, an embodiment of the present application provides a bitstream, the bitstream being a bitstream in the method according to the first aspect above, or a bitstream generated by the method according to the second aspect above. [Effects of the Invention]

[0025] Based on the above technical solution, the decoding device determines a first predicted block based on the IntraTMP mode, determines a second predicted block based on the first prediction mode, and further determines a target predicted block of the current block based on the first predicted block and the second predicted block. That is, the decoding device can determine the target predicted block based on the IntraTMP mode and the first prediction mode. Compared with an aspect in which the best matching block obtained based on the IntraTMP mode is directly used as the target predicted block, this is equivalent to correcting the first predicted block based on the second predicted block, which can improve the accuracy of the target predicted block and ultimately improve decoding performance. [Brief explanation of the drawings]

[0026] [Figure 1] FIG. 1 is a block diagram of an encoding framework according to an embodiment of the present application. [Figure 2] FIG. 1 is a block diagram of a decoding framework according to an embodiment of the present application. [Figure 3] 1 is a schematic diagram of an IntraTMP technique according to an embodiment of the present application. [Figure 4] FIG. 10 is a diagram illustrating an example of template error values ​​between a current block and a matching block according to an embodiment of the present application. [Figure 5] FIG. 1 illustrates an example of an IntraTMP adaptation technique for camera-captured content according to an embodiment of the present application. [Figure 6] 1 is a schematic diagram of a method for dividing a current block into regions according to an embodiment of the present application; [Figure 7] 1 is a flowchart of a decoding method according to an embodiment of the present application; [Figure 8] FIG. 10 is a diagram illustrating an example of a template of a current block according to an embodiment of the present application. [Figure 9] 1 is a flowchart of an encoding method according to an embodiment of the present application; [Figure 10] FIG. 1 is a block diagram of a decoding device according to an embodiment of the present application; [Figure 11] 1 is a block diagram of an encoding device according to an embodiment of the present application; [Figure 12] 1 is a block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION OF THE INVENTION

[0027] Hereinafter, the technical solutions in the embodiments of the present application will be described with reference to the drawings.

[0028] The means according to the embodiments of the present application may be applied to the digital video coding technology field, including, but not limited to, image coding / decoding, video coding / decoding, hardware video coding / decoding, dedicated circuit video coding / decoding, and real-time video coding / decoding. The means according to the embodiments of the present application may be applied to the Audio Video Coding Standard (AVS), the second generation AVS standard (AVS2), or the third generation AVS standard (AVS3). For example, the means according to the embodiments of the present application may be applied to the H.264 / Audio Video Coding (AVC) standard, the H.265 / High Efficiency Video Coding (HEVC) standard, and the H.266 / Versatile Video Coding (VVC) standard. The means according to the embodiments of the present application may be used to perform lossy compression on images or lossless compression on images. It should be noted that the lossless compression may be visually lossless compression or mathematically lossless compression.

[0029] All video coding and decoding standards use a block-based hybrid coding framework. Specifically, each image in a video is divided into square largest coding units (LCUs) or coding tree units (CTUs) of the same size (e.g., 128x128, 64x64, etc.). Each LCU or CTU can be divided into rectangular coding units (CUs) according to a set of rules. The coding units can be divided into prediction units (PUs), transform units (TUs), etc. The hybrid coding framework includes modules such as prediction, transform, quantization, entropy coding, and in-loop filter. The prediction module includes intra-prediction and inter-prediction. Inter-prediction includes motion estimation and motion compensation. Because there is a high correlation between adjacent pixels in a single video image, video coding and decoding technology uses intra-prediction to eliminate spatial redundancy between adjacent pixels. Intra-prediction predicts pixel information within the current segmented block by referencing only information from the same image. Because there is a high similarity between adjacent images in a video, video coding and decoding technology uses inter-prediction to eliminate temporal redundancy between adjacent images and improve coding efficiency. Inter-prediction references image information from different frames and can search for motion vector information that best matches the current segmented block through motion estimation. Transformation converts the predicted image block into the frequency domain to redistribute energy, and quantization removes information that is not sensitive to the human eye, eliminating visual redundancy. Entropy coding can eliminate temporal redundancy based on the current context model and probability information from the binary coded bitstream.

[0030] In a digital video encoding process, an encoding device can first read a monochrome image or a color image from an original video sequence and then perform encoding on the monochrome image or the color image. Here, the monochrome image may include pixels of a luma component, and the color image may include pixels of a chroma component. Optionally, the color image may also include pixels of a luma component. The color format of the original video sequence may be a luma-chroma (YCbCr, YUV) format or a red-green-blue (RGB) format, etc. Specifically, after reading a monochrome image or a color image, the encoding device divides it into blocks, performs intra-prediction or inter-prediction on the current block to generate a prediction block for the current block, subtracts the prediction block from the original block of the current block to obtain a residual block, transforms and quantizes the residual block to obtain a quantization coefficient matrix, and entropy encodes the quantization coefficient matrix to output a bitstream. In a digital video decoding process, a decoding end performs intra-prediction or inter-prediction on the current block to generate a prediction block for the current block. The decoding end also decodes the bitstream to obtain a quantized coefficient matrix, inverse quantizes and inverse transforms the quantized coefficient matrix to obtain a residual block, and adds the predicted block and the residual block to obtain a reconstructed block. The reconstructed block may be used to construct a reconstructed image, and the decoding end performs in-loop filtering on the reconstructed image based on the image or block to obtain a decoded image.

[0031] The current block may be a current coding unit (CU) or a current prediction unit (PU), etc.

[0032] The encoding end must also obtain a decoded image through operations similar to those of the decoding end. The decoded image can be used as a reference image for inter-prediction of a subsequent image. Block division information, mode information or parameter information for prediction, transform, quantization, entropy coding, in-loop filtering, etc. determined by the encoding end should be written to the bitstream as necessary.

[0033] The decoding end determines the same block division information, mode information or parameter information for prediction, transform, quantization, entropy coding, in-loop filtering, etc. as the encoding end through analysis based on analysis and existing information, ensuring that the decoded image obtained at the encoding end is the same as the decoded image obtained at the decoding end. The decoded image obtained at the encoding end is also commonly referred to as a reconstructed image. During prediction, the current block may be divided into prediction units, and during transformation, the current block may be divided into transform units, where the division between the prediction units and the transform units may be the same or different. Of course, the above is merely the basic flow of a video encoding / decoding device in a block-based hybrid coding framework. As technology develops, some modules or steps of the framework may be optimized. This application applies to the basic flow of a video encoding / decoding device in the block-based hybrid coding framework.

[0034] For ease of understanding, a brief description of the coding framework of the present application will be provided.

[0035] FIG. 1 is a block diagram of an encoding framework 100 according to one embodiment of the present application.

[0036] 1, the encoding framework 100 may include an intra prediction unit 180, an inter prediction unit 170, a residual unit 110, a transform quantization unit 120, an entropy coding unit 130, an inverse transform and inverse quantization unit 140, and an in-loop filtering unit 150. Optionally, the encoding framework 100 may further include a decoded image buffer unit 160. The encoding framework 100 is also referred to as a hybrid framework coding mode.

[0037] The intra prediction unit 180 or the inter prediction unit 170 can predict the current image block and output a prediction block. The residual unit 110 can calculate a residual block, which is a difference value between the prediction block and the current image block, based on the prediction block and the current image block. The transform quantization unit 120 performs operations such as transform and quantization on the residual block to remove information that is not sensitive to the human eye and eliminate visual redundancy. Optionally, the residual block before being transformed and quantized by the transform quantization unit 120 may be referred to as a time-domain residual block, and the time-domain residual block after being transformed and quantized by the transform and quantization unit 120 may be referred to as a frequency residual block or a frequency-domain residual block. After receiving the transform quantization coefficients output by the transform quantization unit 120, the entropy coding unit 130 can output a bitstream based on the transform quantization coefficients. For example, the entropy coding unit 130 can eliminate textual redundancy based on a target context model and probability information of the binary bitstream. For example, the entropy coding unit 130 may be used for context-based self-adaptive binary arithmetic entropy coding (CABAC). The entropy coding unit 130 may also be referred to as a header information coding unit. Optionally, in this application, the image block to be coded may also be referred to as an original image block or a target image block. The prediction block may also be referred to as a predicted image block or an image prediction block, or as a prediction signal or prediction information. The reconstruction block may also be referred to as a reconstructed image block or an image reconstruction block, or as a reconstruction signal or reconstruction information. Furthermore, at the coding end, the image block to be coded may also be referred to as a coding block or a coded image block, and at the decoding end, the image block to be coded may also be referred to as a decoded block or a decoded image block. The image block to be coded may be a CTU or a CU.

[0038] The encoding framework 100 calculates a residual between a prediction block and an image block to be encoded to obtain a residual block, and transmits the residual block to a decoding end after processes such as transform and quantization. Accordingly, the decoding end receives a bitstream, decodes the bitstream, and then obtains a residual block through steps such as inverse transform and inverse quantization, and convolves the predicted prediction block at the decoding end with the residual block to obtain a reconstructed block.

[0039] The inverse transform and inverse quantization unit 140, the in-loop filtering unit 150, and the decoded image buffer unit 160 in the encoding framework 100 may be used to form a single decoding device. That is, the intra prediction unit 180 or the inter prediction unit 170 can predict the current image block based on an existing reconstructed block, thereby aligning the understanding of reference images between the encoding end and the decoding end. In other words, the encoding device can replicate the processing loop of the decoding device to generate the same prediction as the decoding end. Specifically, the quantized transform coefficients are inverse transformed and inverse quantized by the inverse transform and inverse quantization unit 140 to replicate the approximate residual block at the decoding end. After adding the predicted block to the approximate residual block, the in-loop filtering unit 150 smoothly filters out effects such as block processing and quantization block effects. The image block output from the in-loop filtering unit 150 may be stored in the decoded image buffer unit 160 for use in predicting subsequent images.

[0040] It should be noted that FIG. 1 is merely an example of the present application and should not be understood as a limitation to the present application.

[0041] For example, the in-loop filtering unit 150 in the encoding framework 100 may include a deblocking filter (DBF) and sample adaptive offset (SAO) filtering. The role of the DBF is to provide a deblocking effect, and the role of the SAO is to provide a deringing effect. In another embodiment of the present application, the encoding framework 100 may employ an in-loop filtering algorithm based on a neural network to improve video compression efficiency. In other words, the encoding framework 100 may be a deep learning neural network-based video encoding hybrid framework. In one embodiment, the deblocking filter and sample adaptive offset filtering may be used to calculate pixel filtering results using a convolutional neural network model. The in-loop filtering unit 150 may have the same or different network configurations for the luma and chroma components. Considering that the luma component contains more visual information, chroma component filtering may also be performed based on the luma component to improve the reconstruction quality of the chroma component.

[0042] Below, the contents relating to intra prediction and inter prediction will be explained.

[0043] <Inter prediction> Inter-prediction refers to image information of different frames and uses motion estimation to search for motion vector information that best matches the image block to be coded, thereby eliminating temporal redundancy. The frames used for inter-prediction may be P frames and / or B frames, where P frames refer to forward predicted frames and B frames refer to bidirectionally predicted frames.

[0044] <Intra prediction> Intra prediction is used to predict pixel information in a current image block by referring only to information in the same image, eliminating spatial redundancy. The frame used for intra prediction may be an I-frame. For example, based on a left-to-right, top-to-bottom coding order, the current image block can be predicted by referring to the upper-left image block, the upper image block, and the left image block as reference information, and the current image block also serves as reference information for the next image block, thereby predicting the entire image. If the input digital video is in a color format such as YUV4:2:0 format, each image frame of the digital video consists of four Y components and two UV components for each of four pixel points, and the coding framework can encode the Y component (i.e., luma block) and the UV component (i.e., chroma block) respectively. Similarly, the decoding end can perform corresponding decoding according to the format.

[0045] In the intra prediction process, the intra prediction predicts the image block to be coded according to an angular prediction mode and a non-angular prediction mode to obtain a predicted block, and selects an optimal prediction mode for the image block to be coded according to rate-distortion information calculated based on the predicted block and the image block to be coded, and transmits the selected prediction mode to the decoding end in a bitstream. The decoding end can analyze the prediction mode, predict a predicted block for the target decoding block, and convolve the time-domain residual block obtained in the bitstream transmission to obtain a reconstructed block.

[0046] With the development of conventional digital video coding / decoding standards, non-angular prediction modes have remained relatively stable, including average mode and planar mode. Meanwhile, angular prediction modes have increased with the development of digital video coding / decoding standards. Taking the H series of international digital video coding standards as an example, the H.264 / AVC standard has only eight angular prediction modes and one non-angular prediction mode, while the H.265 / HEVC standard has been expanded to 33 angular prediction modes and two non-angular prediction modes. In H.266 / VVC, the intra-prediction mode has been further expanded to include a total of 67 traditional prediction modes and a non-traditional prediction mode, matrix weighted intra-frame prediction (MIP) mode, for luminance blocks. The 67 traditional prediction modes include planar mode, direct current (DC) mode, and 65 angular prediction modes. Here, the planar mode is typically used to process blocks with some texture gradation, the DC mode, as the name suggests, is typically used to process some flat areas, and the angular prediction mode is typically used to process blocks with relatively prominent angular texture.

[0047] In this application, the current block used for intra prediction may be a square block or a rectangular block.

[0048] Furthermore, since all intra-prediction blocks are square, the probability of using each angular prediction mode is equal. If the length and width of the current block are not equal, for horizontal blocks (where the width is greater than the height), the probability of using the upper reference pixel is greater than the probability of using the left reference pixel, and for vertical blocks (where the height is greater than the width), the probability of using the upper reference pixel is less than the probability of using the left reference pixel. When predicting a rectangular block, the traditional angular prediction mode is converted to a wide-angle prediction mode. When predicting a rectangular block using the wide-angle prediction mode, the prediction angle range of the current block is greater than the prediction angle range when predicting a rectangular block using the traditional angular prediction mode. Optionally, when using the wide-angle prediction mode, a signal can still be transmitted using the index of the traditional angular prediction mode, and the decoding end can reconvert the traditional angular prediction mode to the wide-angle prediction mode after receiving the signal, thereby maintaining the same total number of intra-prediction modes and the encoding method of the intra-prediction modes.

[0049] The intra prediction mode to be performed may also be determined or selected based on the size of the current block. For example, a wide-angle prediction mode may be determined or selected based on the size of the current block to perform intra prediction on the current block. For example, if the current block is a rectangular block (having different width and height sizes), intra prediction may be performed on the current block using the wide-angle prediction mode. Here, the aspect ratio of the current block is used to determine the angular prediction mode to be replaced with the wide-angle prediction mode and the angular prediction mode after the replacement. For example, when predicting the current block, any intra prediction mode having an angle equal to or smaller than the diagonal of the current block (from the lower left corner to the upper right corner of the current block) may be selected as the replaced angular prediction mode.

[0050] FIG. 2 is a block diagram of a decoding framework 200 according to one embodiment of the present application.

[0051] 2, the decoding framework 200 may include an entropy decoding unit 210, an inverse transform and inverse quantization unit 220, a residual unit 230, an intra prediction unit 240, an inter prediction unit 250, an in-loop filtering unit 260, and a decoded image buffer unit 270. Here, the entropy decoding unit 210 receives and analyzes a bitstream, obtains a prediction block and a frequency-domain residual block, and performs steps such as inverse transform and inverse quantization on the frequency-domain residual block via the inverse transform and inverse quantization unit 220 to obtain a time-domain residual block. The residual unit 230 convolves the prediction block predicted by the intra prediction unit 240 or the inter prediction unit 250 with the time-domain residual block inverse transformed and inverse quantized by the inverse transform and inverse quantization unit 220 to obtain a reconstructed block.

[0052] It should be noted that the decoding method and encoding method according to the embodiments of the present application affect the intra prediction part in the video coding hybrid framework, specifically, are applied to the IntraTMP part of intra prediction. The decoding method according to the embodiments of the present application affects the intra prediction part at the decoding end, and the encoding method according to the embodiments of the present application affects the intra prediction part at the encoding end.

[0053] In order to facilitate understanding of the technical solution of the present application, the following related content will be described.

[0054] (1) Intra Template Matching Prediction (IntraTMP) mode The IntraTMP mode is a special luma block intra prediction coding tool, which is mainly applied to screen content coding.

[0055] FIG. 3 is a schematic diagram of the IntraTMP mode according to an embodiment of the present application.

[0056] As shown in Figure 3, the IntraTMP mode is mainly realized by the following process.

[0057] The encoding device (or decoding device) selects the reconstructed pixels in the L-shaped area adjacent to the current coding block as a template, searches for the most similar template in the reconstructed area of ​​the specified current frame, and selects the reconstructed block corresponding to the most similar template as a matching block and uses it as a prediction block for the current coding block. For example, R1-R4 shown in the figure is a search area available in the IntraTMP mode. For example, R1-R4 can be searched for matching blocks point by point in raster scan order.

[0058] FIG. 4 is a diagram illustrating an example of template error values ​​between a current block and a matching block according to an embodiment of the present application.

[0059] As shown in Figure 4, the template for the current block includes the pixel in column L to the left of the current block, the pixel in column M above, and the pixel in row M and column L at the top left corner, where M and L are both positive integers, e.g., 4. The matching block for the current block may be represented by a block vector pointing from the current block to the matching block. The similarity between the template for the current block and the template for the matching block is represented by the magnitude of the template error value, with the smaller the template error value, the higher the similarity. For example, the template error value can be calculated using the sum of absolute difference (SAD), where the smaller the SAD, the more similar the templates are.

[0060] The encoding device indicates whether the current encoding block uses IntraTMP mode through a flag bit cu_tmp_flag. If IntraTMP mode is used, the encoding device performs a similar template matching process at the decoding end to obtain a similar predicted block at the decoding end. In IntraTMP mode, there is no need to encode block vector information in the bitstream.

[0061] (2) IntraTMP adaptation for camera-captured content FIG. 5 is a diagram illustrating an example of an IntraTMP adaptation technique for camera-captured content according to an embodiment of the present application.

[0062] As shown in FIG. 5(a), the IntraTMP adaptation technology for camera-capture content proposes template matching based on the existing IntraTMP mode with a step size of S (i.e., every S (S>1) points in the horizontal and vertical directions). For example, instead of searching for matching blocks point by point in a raster scan in a search area, the search area is searched for every S points in the horizontal and vertical directions. For example, if the block vector currently being template-matched is (X0, Y0), the next block vector being template-matched in the horizontal direction is (X0+S, Y0), and the ordinate of the next block vector being template-matched in the vertical direction is Y0+S. After template matching is completed, the best matching block is refined within a predetermined range (i.e., template matching is performed with a smaller step size S') as shown in FIG. 5(b). For example, in the method of template matching with a smaller step size, the matching block vector is refined to optimize the matching result. This technology effectively reduces the complexity of the IntraTMP mode while maintaining good coding efficiency.

[0063] (3) Template-Based Intra Mode Derivation (TIMD) Technology The TIMD technique uses reconstructed pixels in an L-shaped area adjacent to the current coding block as a template. Specifically, the encoding end calculates pixel prediction methods for the template region in different intra prediction modes by scanning a Most Probable Mode (MPM) list, and obtains template error values ​​between predicted pixels and reconstructed pixels in different intra prediction modes. For example, the template error value can be represented by the sum of absolute transformed differences (SATD). This allows the encoding end to select an optimal intra prediction mode based on the template error value. At the decoding end, the intra prediction mode is obtained using the same derivation method, thereby reducing the number of coded bits for mode information.

[0064] (4) Combined Inter and Intra Prediction (CIIP) mode The CIIP mode combines intra prediction and inter prediction to obtain a predicted block for the current coding block through weighted addition of the intra prediction block and the inter prediction block. The CIIP mode in the Enhanced Compression Model (ECM) combines template-based prediction technology and further improves prediction accuracy by designing different regions and different weight values. Specifically, the intra prediction block pred_intra is obtained using the TIMD mode, and the inter prediction block pred_inter is obtained using the template-based merge mode. The encoding end determines the weight values ​​wIntra and wInter based on the derived intra prediction mode and the position of the pixel to be predicted. The final predicted block Pred is calculated using the following formula:

[0065] Pred=(wIntra×pred_intra+wInter×pred_inter+4)>>3 Here, Pred represents the predicted block of the current block, pred_intra represents the intra predicted block, wIntra represents the weight value of the intra predicted block, wInter represents the inter predicted block, and pred_inter represents the weight value of the inter predicted block.

[0066] wIntra and wInter may be determined based on the intra prediction mode intra_dir derived by TIMD. ECM has 65 types of intra angle prediction modes (2≦intra_dir≦66). If 2≦intra_dir<34, the current coding block is divided into four equal parts vertically, and if 34≦intra_dir≦66, the current coding block is divided into four equal parts horizontally. For example, the weight values ​​wIntra and wInter for each region can be determined by referring to Table 1.

[0067] [Table 1]

[0068] As shown in Table 1, different region indices correspond to different wIntra and wInter, i.e., when region identifier is 0, wIntra is 6 and wInter is 2, when region identifier is 1, wIntra is 5 and wInter is 3, when region identifier is 2, wIntra is 3 and wInter is 5, and when region identifier is 3, wIntra is 2 and wInter is 6.

[0069] FIG. 6 is a schematic diagram of a method for dividing a current block into regions according to an embodiment of the present application.

[0070] As shown in Figure 6(a), if the current coding block is divided vertically into four equal parts, the region indices from left to right are 0, 1, 2, and 3. As shown in Figure 6(b), if the current coding block is divided horizontally into four equal parts, the region indices from top to bottom are 0, 1, 2, and 3.

[0071] Note that when intra_dir is equal to 0 or 1, wIntra and wInter can be determined in other manners. For example, when intra_dir is equal to 0 or 1, the sub-region is not divided, and wIntra and wInter are selected from (3,1), (2,2), and (1,3) according to the coding types (intra or inter) of the two coding blocks located on the left and top. For example, if the coding types of these two coding blocks are both intra-coding, the coding end determines (wIntra, wInter) as (3,1); if the coding type of one of these two coding blocks is intra-coding and the coding type of the other coding block is inter-coding, the coding end determines (wIntra, wInter) as (2,2); and if the coding types of these two coding blocks are both inter-coding, the coding end determines (wIntra, wInter) as (3,1).

[0072] As can be seen from the above description of the IntraTMP mode, the IntraTMP mode selects the best matching block based on a template as a predicted block. However, due to noise generated during lossy compression and limited correlation between the template and the corresponding block, this method may result in a certain prediction error, making it impossible to obtain an accurate predicted block, thereby reducing the decoding performance of the decoding device. Furthermore, the IntraTMP mode performs prediction using a block compensation method. In scenes with many overlapping pixel blocks, such as screen content sequences, the decoding performance of the decoding device can be guaranteed even if the decoding device selects the best matching block based on a template based on the IntraTMP mode as a predicted block. However, in scenes with a large noise signal and more complex pixel changes, such as natural content sequences, if the decoding device still selects the best matching block based on a template based on the IntraTMP mode as a predicted block, the IntraTMP mode may reduce the decoding performance of the decoding device if the difference between the current block and the best matching block selected based on the template based on the IntraTMP mode is large. In light of this, the embodiments of the present application provide a decoding method, an encoding method, a decoding device, and an encoding device to improve encoding and decoding performance. This method provides a composite fusion prediction technology based on intra template matching prediction (Intra TMP), which obtains one matching block based on intra template matching and fuses another intra prediction block to obtain a prediction block of a currently coded block. Specifically, a decoding device obtains a matching block of a currently coded block as prediction block 1 through intra template matching, obtains prediction block 2 of the currently coded block through an intra prediction mode other than Intra TMP, determines weights for prediction blocks 1 and 2, and performs weighted fusion on these prediction blocks according to the weights to obtain a final prediction block, thereby realizing Intra TMP composite fusion prediction.

[0073] 7 is a flowchart of a decoding method 300 according to an embodiment of the present application. The decoding method 300 can be performed by a decoding device or a decoding framework. For example, the decoding method 300 is applied to the decoding framework shown in FIG. 2. For ease of explanation, the decoding method 300 will be exemplarily described below using a decoding device as an example.

[0074] As shown in FIG. 7, the decoding method 300 may include the following steps.

[0075] In S310, a residual block of a current block in a current sequence is determined based on the bitstream.

[0076] Illustratively, a decoding device determines the residual block of the current block by decoding the bitstream, and the bitstream decoded by the decoding device is the bitstream of the current sequence.

[0077] In S320, a first predicted block of the current block is determined based on an intra template matching prediction (IntraTMP) mode.

[0078] In S330, a second prediction block of the current block is determined based on a first prediction mode, where the first prediction mode and the IntraTMP mode are different.

[0079] Exemplarily, the first prediction mode is an intra prediction mode.

[0080] Exemplarily, the first prediction mode is an inter prediction mode.

[0081] Exemplarily, the first prediction mode is an angular prediction mode.

[0082] Exemplarily, the first prediction mode is a non-angular prediction mode.

[0083] In S340, a target predicted block of the current block is determined based on the first predicted block and the second predicted block.

[0084] For example, the decoding apparatus may combine the first prediction block and the second prediction block to obtain the target prediction block.

[0085] At S350, a reconstructed block of the current block is obtained based on the residual block of the current block and the target predicted block.

[0086] In this embodiment, the decoding device determines a first predicted block based on the IntraTMP mode, determines a second predicted block based on the first prediction mode, and determines a target predicted block of the current block based on the first predicted block and the second predicted block. That is, the decoding device can determine the target predicted block based on the IntraTMP mode and the first prediction mode. Compared with a means that uses the best matching block obtained based on the IntraTMP mode as the target predicted block, this is equivalent to correcting the first predicted block based on the second predicted block, which can improve the accuracy of the target predicted block and ultimately improve decoding performance.

[0087] Below, with reference to Table 2, we will explain the results of testing the test sequence required by JVET under all intra conditions for the technical solution of the present application in ECM6.0, which integrates IntraTMP adaptation technology for camera-captured content. End-to-end bit distortion (end-to-end BD-rate) is an index for evaluating algorithm or encoding performance, and indicates the change in bit rate and PSNR of the encoding algorithm of the present application compared to the original encoding algorithm, with an overall negative value indicating better performance. Y, U, and V represent the components of the current block.

[0088] [Table 2]

[0089] As shown in Table 2, the test results show that the solution according to the present application improves performance for all sequence categories, with the average change in BD-rate for Y, U, and V components being -0.04%, -0.04%, and -0.10%, respectively, demonstrating that the present technology improves coding performance with low complexity. Furthermore, the decoding method according to this embodiment increases the decoding time by only 2%, and the encoding method corresponding to the decoding method increases the encoding time by only 2%.

[0090] In some embodiments, S320 includes: determining a first identifier based on the bitstream; If the first identifier indicates that fusion prediction is to be performed in the IntraTMP mode, determining the first prediction block based on the IntraTMP mode.

[0091] For example, the decoding device decodes the bitstream to obtain the first identifier, and if the first identifier indicates that blended prediction is to be performed in the IntraTMP mode, the decoding device predicts the first prediction block based on the IntraTMP mode; otherwise, the decoding device obtains the target prediction block using another prediction mode.

[0092] Exemplarily, the first identifier may be a sequence level identifier, an image level (ie, frame level) identifier, a slice level identifier, or an image block level identifier.

[0093] Exemplarily, the first identifier indicates that fusion prediction is to be performed in the IntraTMP mode when the value is 0, and indicates that fusion prediction is not to be performed in the IntraTMP mode when the value is 1. Alternatively, the first identifier indicates that fusion prediction is to be performed in the IntraTMP mode when the value is 1, and indicates that fusion prediction is not to be performed in the IntraTMP mode when the value is 0. Of course, other numerical values ​​may be used for indication, and this embodiment is not limited thereto.

[0094] Of course, the first identifier may also implement the corresponding indicating function in other ways, and the present application is not limited thereto.

[0095] For example, the first identifier indicates that fusion prediction is to be performed in the IntraTMP mode when the value is "true", and indicates that fusion prediction is not to be performed in the IntraTMP mode when the value is "false".

[0096] For example, if the first identifier indicates that fusion prediction is not performed in the IntraTMP mode, the decoding device may determine the prediction mode of the current block by continuing to decode the bitstream. In other words, if the first identifier indicates that fusion prediction is not performed in the IntraTMP mode, the decoding device does not need to predict the first prediction block based on the IntraTMP mode, and does not need to determine the target prediction block based on the first prediction block and the second prediction block.

[0097] In some embodiments, the decoding device determines a second identifier based on the bitstream, and if the second identifier indicates that prediction is to be performed in the IntraTMP mode, determines the first identifier based on the bitstream.

[0098] For example, the decoding device decodes the bitstream to obtain the second identifier, and if the second identifier indicates prediction in the IntraTMP mode, the decoding device decodes the bitstream to obtain the first identifier, otherwise, the decoding device obtains the target prediction block in another prediction mode.

[0099] Exemplarily, the second identifier may be a sequence level identifier, an image level (ie, frame level) identifier, a slice level identifier, or an image block level identifier.

[0100] For example, the second identifier indicates that prediction is to be performed in the IntraTMP mode when the value is 0, and indicates that prediction is not to be performed in the IntraTMP mode when the value is 1. Alternatively, the second identifier indicates that prediction is to be performed in the IntraTMP mode when the value is 1, and indicates that prediction is not to be performed in the IntraTMP mode when the value is 0. Of course, other numerical values ​​may be used for indication, and this embodiment is not limited thereto.

[0101] Of course, the second identifier may also realize the corresponding indicating function in other ways, and the present application is not limited thereto.

[0102] For example, the second identifier indicates that prediction is to be made in the IntraTMP mode if the value is "true", and the second identifier indicates that prediction is not to be made in the IntraTMP mode if the value is "false".

[0103] For example, if the second identifier indicates that prediction is not performed using the IntraTMP mode, the decoding device may determine the prediction mode of the current block by continuing to decode the bitstream. In other words, if the second identifier indicates that blended prediction is not performed using the IntraTMP mode, the decoding device does not need to predict the first prediction block based on the IntraTMP mode, and does not need to determine the target prediction block based on the first prediction block and the second prediction block.

[0104] For example, if the second identifier indicates that prediction is to be performed in the IntraTMP mode and the first identifier indicates that fusion prediction is not to be performed in the IntraTMP mode, the decoding device predicts one best matching block based on the IntraTMP mode and determines the target prediction block based on the best matching block. For example, the decoding device may determine the best matching block as the target prediction block.

[0105] For example, when a decoding device reads a bitstream, the syntax elements for performing fusion prediction using the IntraTMP can be realized as shown in Table 3.

[0106] [Table 3]

[0107] The explanation of each element in Table 3 is as follows:

[0108] <coding_unit> A syntax element related to a coding block.

[0109] <pred_mode_plt_flag> This is a block flag bit that indicates whether the current coding block is coded in PLT mode.

[0110] <intra_bdpcm_luma_flag> This is a block flag bit that indicates whether the luminance component of the current coding block is coded in BDPCM mode.

[0111] <sps_tmp_enabled_flag> An SPS flag bit that indicates whether the video sequence can be predicted in IntraTMP mode. If it is equal to 1, the current video sequence can be predicted in IntraTMP mode; if it is equal to 0, the current video sequence cannot be predicted in IntraTMP mode. The value of the SPS flag bit may be set by the user.

[0112] <maxtmpsize> This is an SPS parameter that indicates the size limit of a block that can be predicted by IntraTMP mode. If the width or height of a block is larger than MaxTmpSize, it cannot be predicted by IntraTMP mode. The SPS parameter may be set by the user.

[0113] <intra_tmp_flag> (i.e. the second identifier above) This is a block flag bit that indicates whether the current block performs prediction in IntraTMP mode. If the value of intra_tmp_flag is equal to 1, the current block performs prediction in IntraTMP mode, and the decoder must decode the flag bit intra_tmp_ciip_flag. If the value of intra_tmp_flag is equal to 0, the current block does not perform prediction in IntraTMP mode, and the decoder must decode the flag bit intra_tmp_ciip_flag.

[0114] <intra_tmp_ciip_flag> (i.e. the first identifier above) This is a block flag bit that indicates whether the current coding block performs fusion prediction using IntraTMP. If the value of intra_tmp_ciip_flag is equal to 1, the current block performs fusion prediction using IntraTMP. If the value of intra_tmp_ciip_flag is equal to 0, the current block performs prediction using the existing IntraTMP.

[0115] In some embodiments, the decoding device comprises: Determine the target context index, The first identifier may be determined based on the bitstream using the target context index.

[0116] Illustratively, the target context index is used to uniquely identify a context or context model, so that after determining the target context index, the decoding device can decode the bitstream using the context or context model indicated by the target context index to obtain the first identifier.

[0117] Of course, in other alternative embodiments, the decoding device may determine the context index used for the second identifier in a manner that may be the same as or different from the manner in which the context index used for the first identifier is determined, and the present application is not specifically limited in this regard.

[0118] In some embodiments, the decoding device determines the target context index based on decoding information of neighboring decoding blocks of the current block, and / or the decoding device determines the target context index based on the size of the current block.

[0119] For example, the decoding information of the adjacent decoding block may include, but is not limited to, information such as a prediction mode used for the adjacent decoding block, a context index used when decoding the block level identifier of the adjacent decoding block, a template for the adjacent decoding block, a position of the adjacent decoding block, and a decoding value of the adjacent decoding block.

[0120] Exemplarily, the size of the current block includes, but is not limited to, information such as the height of the current block, the width of the current block, and the number of pixels in the current block.

[0121] Exemplarily, the decoding device decodes the first identifier using a target context index CtxIdxInc, where the target context index CtxIdxInc can be determined based on information such as decoding information of adjacent decoding blocks, the size of the current block, etc. For example, there are Q possible values ​​for the target context index determined by the decoding device based on the decoding information of the adjacent decoding blocks, where Q is, for example, a value equal to or less than 3.

[0122] In some embodiments, the coordinates of the current block are (x, y), and the neighboring decoded blocks include a first decoded block with coordinates (x-1, y) and a second decoded block with coordinates (x, y-1). The decoding information of the first decoded block includes a prediction mode used for a predicted block of the first decoded block, and the decoding information of the second decoded block includes a prediction mode used for a predicted block of the second decoded block. In this case, the decoding device can determine the target context index in the following manner: If the prediction mode used for the predicted block of the first decoded block is a mode in which fusion prediction is performed based on the IntraTMP mode, the first numerical value is set to A; otherwise, the first numerical value is set to B, where A and B are both integers. If the prediction mode used for the predicted block of the second decoded block is a prediction mode in which fusion prediction is performed based on the IntraTMP mode, the second numerical value is set to C; otherwise, the second numerical value is set to D, where C and D are both integers. The sum of the first numerical value and the second numerical value is determined as the target context index.

[0123] where, illustratively, A = 1, B = 0, C = 1, and D = 0. That is, when the coordinates of the current block are (x, y), if a decoded block cuLeft exists at the coordinate (x-1, y) and the intra_tmp_ciip_flag of cuLeft is 1, then CtxIdxInc is 1, otherwise CtxIdxInc is 0. After that, if a decoded block cuAbove exists at the coordinate (x, y-1) and the intra_tmp_ciip_flag of cuAbove is 1, then 1 is added to CtxIdxInc, otherwise 0 is added to CtxIdxInc.

[0124] Of course, in other alternative embodiments, A, B, C, and D may be other values, and the present application is not specifically limited thereto.

[0125] In some embodiments, S320 includes: performing template matching on the current block based on the IntraTMP mode to obtain a best matching block; determining the first predicted block based on the best matching block.

[0126] For example, the decoding device may determine, as the matching block of the current block, a reconstructed block whose template matches the template of the current block at different positions within the search area of ​​the current block through intra-template matching. For example, the decoding device may determine, as the matching block of the current block, a reconstructed block whose template is the same as the template of the current block at different positions within the search area of ​​the current block. After completing the template matching process, the decoding device sorts all matching blocks of the current block in order of smallest template error value, and determines the first matching block as the best matching block.

[0127] In some embodiments, the decoding device determines the best matching block as the first predicted block.

[0128] For example, after completing the template matching process, the decoding apparatus sorts all matching blocks of the current block in ascending order of template error value, and determines the earliest matching block as the first predicted block.

[0129] In some embodiments, the decoding device refines the best matching block to obtain the first predicted block.

[0130] For example, when refining the best matching block, the decoding device may use intra-template matching to determine, at different positions within the refinement range of the best matching block, a reconstructed block whose template matches the template of the current block and whose template error value is the smallest, as the matching block obtained by refining the best matching block. For example, the decoding device may use, at different positions within the refinement range of the best matching block, a reconstructed block whose template is the same as the template of the current block and whose template error value is the smallest, as the matching block obtained by refining the best matching block.

[0131] In some embodiments, the decoding device may refine the best matching block to obtain the first predicted block in the following manner.

[0132] A refinement range for the best matching block is determined. Intra-template matching is performed within the refinement range based on at least one matching step width to obtain matching blocks that match within the refinement range, and each of the at least one matching step width is smaller than the matching step width used for the best matching block. Of the matching blocks that match within the refinement range, the matching block with the smallest template error value is determined as the best matching block obtained by refining the best matching block. The best matching block obtained by refining the best matching block is determined as the first predicted block.

[0133] For example, if the at least one matching step width is a single matching step width, the decoding device determines the matching block with the smallest template error value among the matching blocks that match within the refinement range as the matching block obtained by refining the optimal matching block, and determines the matching block obtained by refining the optimal matching block as the first predicted block.

[0134] For example, if the at least one matching step width is a plurality of matching step widths, the plurality of matching step widths are different from one another. The decoding device determines the i-th matching step width from the plurality of matching step widths by scanning all of the plurality of matching step widths in descending order of size, and determines, based on the i-th matching step width, the matching block having the smallest template error value among the matching blocks matching within the refinement range as the matching block refined based on the i-th matching step width. Next, based on the (i+1)-th matching step width, the matching block refined based on the i-th matching step width is refined again. Finally, based on the last matching step width, the decoding device refines the matching block refined based on the penultimate matching step width again, and then determines the matching block refined based on the last matching step width as the first prediction block. In addition, when the decoding device further refines the matching block that was refined based on the i-th matching step width based on the i+1-th matching step width, the refinement range may be the refinement range of the optimal matching block, or may be the refinement range of the matching block that was refined based on the i-th matching step width, and this application does not specifically limit this.

[0135] In some embodiments, determining a refinement range for the best matching block comprises: Determining the refinement range based on the size of the current block and the best matching block.

[0136] For example, the decoding device may set the block vector of the best matching block as the center of the refinement range, and determine the size of the refinement range based on the size of the current block and the matching step width of the best matching block.

[0137] In some embodiments, the decoder determines the refinement range to be (S / F)×H, centered on the block vector from the current block to the best matching block, where / represents the division operator, × represents the multiplication operator, S represents the matching step width used for the best matching block, H represents the height of the current block, and F is a positive integer.

[0138] For example, the decoding device determines the refinement range as a rectangle with a side length of (S / E)×H and centered on a block vector from the current block to the best matching block, or as a circle with a radius of (S / E)×H and centered on a block vector from the current block to the best matching block.

[0139] Of course, in other alternative embodiments, the refinement range may be other shapes or sizes, and the present application is not specifically limited thereto.

[0140] In some embodiments, the decoder determines the refinement range based on a predefined numerical value.

[0141] Illustratively, the predefined value may include the size of the refinement range.

[0142] For example, the decoding device determines the refinement range as a rectangle whose center is a block vector from the current block toward the best matching block and whose side lengths are the predefined numerical value, or as a circle whose center is a block vector from the current block toward the best matching block and whose radius is the predefined numerical value.

[0143] Of course, in other alternative embodiments, the refinement range may be other shapes or sizes, and the present application is not specifically limited thereto.

[0144] Exemplarily, the predefined value may be a default value. For example, the predefined value may be realized by storing a corresponding code or table in an apparatus (e.g., including a decoding device), or by other methods capable of indicating related information, and the present application does not limit the specific implementation form. For example, "predefined" may refer to being defined by a protocol. Note that in the embodiments of the present application, the "protocol" may refer to a standard protocol in the encoding / decoding field, and may include, for example, related protocols in the image encoding / decoding field, the video encoding / decoding field, the hardware video encoding / decoding field, the dedicated circuit video encoding / decoding field, and the real-time video encoding / decoding field, as well as related protocols applied to future encoding / decoding systems, and the present application does not limit the same.

[0145] In some embodiments, S320 includes: performing template matching on the current block based on the IntraTMP mode to obtain a plurality of matching blocks; and performing weighting processing on the plurality of matching blocks to obtain the first predicted block.

[0146] For example, the decoding device may use intra-template matching to determine, as the matching block of the current block, a reconstructed block whose template matches the template of the current block at different positions within the search area of ​​the current block. For example, the decoding device may determine, as the matching block of the current block, a reconstructed block whose template is the same as the template of the current block at different positions within the search area of ​​the current block. After completing the template matching process, the decoding device sorts all matching blocks of the current block in descending order of template error value, selects multiple matching blocks from front to back according to the sorting order, and performs a weighting process on them to obtain the first predicted block.

[0147] For example, the weight values ​​of the plurality of matching blocks may be equal, partially equal, or different from each other.

[0148] For example, if the weight values ​​of the plurality of matching blocks are equal, the first prediction block is the average value of the plurality of matching blocks.

[0149] Illustratively, the decoding device determines a weight value for each matching block based on the template error value of the respective matching block, the number of the plurality of matching blocks, and the sum of the weights of the plurality of matching blocks.

[0150] Illustratively, the weight value of each matching block is negatively correlated with the template error value of each matching block.

[0151] Illustratively, the weight value of each matching block has a negative correlation with the number of matching blocks in the plurality of matching blocks.

[0152] Illustratively, the weight value of each matching block is positively correlated with the sum of the weights of the multiple matching blocks.

[0153] Of course, in other alternative embodiments, the decoding device may determine the weight value of each matching block based solely on the template error value or other information of the corresponding matching block, and the present application is not specifically limited thereto.

[0154] Illustratively, the decoding device selects a first candidate set from a plurality of candidate sets based on the number of the plurality of matching blocks, the first candidate set including a weight value equal to the number of the plurality of matching blocks, and then determines a weight value for each of the plurality of matching blocks based on the first candidate set.

[0155] Illustratively, different candidate sets of the plurality of candidate sets include different numbers of weight values.

[0156] In some embodiments, the template error value of each matching block is negatively correlated with the weight value of each matching block.

[0157] For example, the weight value of each matching block may be any predefined fixed value. A different weight value is assigned to each matching block based on the number of matching blocks, the template error value of each matching block, etc. For example, assuming the weight values ​​are {¾, ¼}, {½, ¼, ¼}, if there are two matching blocks pred1 and pred2 and the corresponding template error values ​​are SAD1≦SAD2, the weight value of pred1 is set to W1=¾ and the weight value of pred2 is set to W2=¼. If there are three matching blocks pred1, pred2, and pred3 and the corresponding template error values ​​are SAD1≦SAD2≦SAD3, the weight values ​​of pred1, pred2, and pred3 are set to W1=½, W2=¼, and ¼.

[0158] In some embodiments, S340 includes: determining a weight value of the first predicted block and a weight value of the second predicted block; and performing weighting processing on the first prediction block and the second prediction block based on the weight value of the first prediction block and the weight value of the second prediction block to obtain the target prediction block.

[0159] For example, the decoding device may determine a weight value of the first prediction block and a weight value of the second prediction block, multiply the weight value of the first prediction block by the first prediction block to obtain a first intermediate block, and multiply the second prediction block by the second prediction block to obtain a second intermediate block. Then, the decoding device may add the first intermediate block and the second intermediate block to obtain a fused block. The decoding device may then determine the target prediction block based on the fused block. For example, the decoding device may determine the fused block as the target prediction block directly, or may process the fused block to obtain the target prediction block.

[0160] In some embodiments, the decoding device determines the weight value of the first prediction block and the weight value of the second prediction block based on at least one of the coding information of adjacent coding blocks, the size of the current block, the template size of the current block, the type of the first prediction mode, and the position of each region of the current block.

[0161] For example, the decoding device may determine a weight value of the first prediction block (or a weight value of the second prediction block) based on at least one of the decoding information of neighboring decoding blocks, the size of the current block, the template size of the current block, the type of the first prediction mode, and the location of each region of the current block, and then determine a weight value of the second prediction block (or a weight value of the first prediction block) based on a predefined weight sum value and the weight value of the first prediction block (or the weight value of the second prediction block). For example, the decoding device may determine a weight value corresponding to at least one of the decoding information of neighboring decoding blocks, the size of the current block, the template size of the current block, the type of the first prediction mode, and the location of each region of the current block as the weight value of the first prediction block (or the weight value of the second prediction block). Here, the weight value of the second predicted block (or the weight value of the first predicted block) is the difference value between the total weight value and the weight value of the first predicted block (or the weight value of the second predicted block).

[0162] Of course, the weight values ​​of the first predicted block and the second predicted block may be determined by other methods, and the present application does not specifically limit this. For example, the weight values ​​of the first predicted block and the second predicted block may be determined by decoding a bitstream. Furthermore, for example, the weight value of the first predicted block may be determined based on the template error value of the first predicted block, and then the weight value of the second predicted block may be determined based on a predefined weight sum value and the weight value of the first predicted block. For example, the weight value of the first predicted block has a negative correlation with the template error value of the single matching block, and the weight value of the second predicted block is the difference between the weight sum value and the weight value of the first predicted block.

[0163] In some embodiments, the weight value of the first prediction block and the weight value of the second prediction block are both predefined weight values.

[0164] For example, the ratio of the weight value of the first prediction block to the weight value of the second prediction block and the sum of the weight value of the first prediction block to the weight value of the second prediction block are both predefined values.

[0165] Exemplarily, the predefined weight values ​​may be default weight values. For example, the predefined weight values ​​may be realized by storing corresponding codes or tables in an apparatus (e.g., including a decoding device), or other methods capable of indicating related information, and the present application does not limit the specific implementation form. For example, "predefined" may refer to being defined by a protocol. Note that in the embodiments of the present application, the "protocol" may refer to a standard protocol in the encoding / decoding field, and may include, for example, related protocols in the image encoding / decoding field, the video encoding / decoding field, the hardware video encoding / decoding field, the dedicated circuit video encoding / decoding field, and the real-time video encoding / decoding field, as well as related protocols applied to future encoding / decoding systems, and the present application does not limit the same.

[0166] In some embodiments, the decoding device performs weighting processing on the first prediction block and the second prediction block to obtain a value, and adds C offset Adding C Shift Shift right by C to get the target prediction block. offset is C Shift The value is determined based on C Shift is a value determined based on the sum of the weight value of the first predicted block and the weight value of the second predicted block.

[0167] For example, the decoding device may determine the target prediction block using the following formula:

[0168] Pred=(w1×pred1+w2×pred2+C offset )>>C Shift Here, Pred represents the target prediction block, pred1 represents the first prediction block, w1 represents the weight value of the first prediction block, pred2 represents the second prediction block, and w2 represents the weight value of the second prediction block.

[0169] In some embodiments, C offset and C Shift is C offset =<<(C Shift -1),

number

[0170] where:

number

[0171] For example, C offset and C Shift is C offset =1<<(C Shift -1), C Shift =log2(w1+w2).

[0172] In some embodiments, S340 includes: Dividing the current block into a plurality of regions; determining, for a first region of the plurality of regions, a weight value of the first prediction block in the first region and a weight value of the second prediction block in the first region; performing weighting processing on the first prediction block and the second prediction block in the first region based on a weight value of the first prediction block in the first region and a weight value of the second prediction block in the first region, to obtain a prediction value of the first region; Here, the target prediction block includes prediction values ​​for each of the multiple regions.

[0173] For example, as shown in Figure 6(a), if the current coding block is divided vertically into four equal parts, the region indices from left to right are 0, 1, 2, and 3. As shown in Figure 6(b), if the current coding block is divided horizontally into four equal parts, the region indices from top to bottom are 0, 1, 2, and 3.

[0174] In some embodiments, the decoding device divides the first region into the plurality of regions based on an index of the first prediction mode.

[0175] For example, the decoding device determines a division method for the current block based on an index of the first prediction mode, and then divides the first region into the plurality of regions based on the division method for the current block.

[0176] In some embodiments, if the index of the first prediction mode is located in a first index range, the current block is vertically divided into the multiple regions.

[0177] For example, if the first prediction mode is an angular prediction mode and the index of the first prediction mode is located in a first index range, the current block is vertically divided into the plurality of regions.

[0178] For example, as shown in FIG. 6(a), when the decoding device divides the current coding block vertically into four equal parts, the region indices are 0, 1, 2, and 3, respectively, from left to right. For example, when the first prediction mode is an angular prediction mode, the first index range is [34, 66]. In other words, when 34≦intra_dir≦66, the decoding device can divide the current block into four equal parts, that is, the region indices are 0, 1, 2, and 3, respectively, from left to right. Here, intra_dir represents the index of the first prediction mode.

[0179] In some embodiments, if the index of the first prediction mode is located in a second index range, the current block is horizontally divided into the multiple regions.

[0180] Illustratively, the first index range and the second index range are different.

[0181] For example, as shown in FIG. 6(b), when the current coding block is divided horizontally into four equal parts, the region indices are 0, 1, 2, and 3 from top to bottom. For example, when the first prediction mode is an angular prediction mode, the second index range is [2, 34]. In other words, when 2≦intra_dir<34, the decoding device can divide the current block vertically into four equal parts, that is, the region indices are 0, 1, 2, and 3 from left to right. Here, intra_dir represents the index of the first prediction mode.

[0182] In some embodiments, the weight value corresponding to the index of the first region includes a weight value of the first predictive block in the first region and a weight value of the second predictive block in the first region.

[0183] For example, the decoding device determines one weight value corresponding to the index of the first region as the weight value in the first region of the first predictive block, and determines another weight value corresponding to the index of the first region as the weight value in the first region of the second predictive block.

[0184] For example, the decoding device may determine the weight value of the first prediction block in the first region and the weight value of the second prediction block in the first region based on the index of the first region according to Table 4.

[0185] [Table 4]

[0186] As shown in Table 4, w1 represents the weight value of the first prediction block, and w2 represents the weight value of the second prediction block. If the index of the first region is 0 and the corresponding index value is (6,2), it can be determined that the weight value of the first prediction block in the first region is 2, and the weight value of the second prediction block in the first region is 6. If the index of the first region is 1 and the corresponding index value is (5,3), it can be determined that the weight value of the first prediction block in the first region is 3, and the weight value of the second prediction block in the first region is 5. If the index of the first region is 2 and the corresponding index value is (3,5), it can be determined that the weight value of the first prediction block in the first region is 5, and the weight value of the second prediction block in the first region is 3. If the index of the first region is 3 and the corresponding index value is (6,2), it can be determined that the weight value of the first prediction block in the first region is 6, and the weight value of the second prediction block in the first region is 2.

[0187] Of course, Table 4 is merely an example of the present application and should not be construed as limiting the present application. For example, in other alternative embodiments, the values ​​in Table 4 may be replaced with other values.

[0188] In some embodiments, the weight value of the first prediction block in the first region and the weight value of the second prediction block in the first region are both predefined weight values.

[0189] For example, if the first prediction mode is not an angular prediction mode, the weight value of the first prediction block in the first region and the weight value of the second prediction block in the first region are both predefined weight values.

[0190] For example, when the first prediction mode is a planar mode or a DC mode, the weight value of the first prediction block in the first region and the weight value of the second prediction block in the first region are both predefined weight values.

[0191] For example, if the weight value of the first region of the first predictive block and the weight value of the first region of the second predictive block are both predefined weight values, (w2, w1) is (1, 3) or other values, where w1 represents the weight value of the first predictive block and w2 represents the weight value of the second predictive block.

[0192] In some embodiments, the decoding device may determine a weight value in the first region of the first prediction block and a weight value in the first region of the second prediction block based on at least one of the coding information of adjacent coding blocks, the size of the current block, the template size of the current block, the type of the first prediction mode, and the position of each region of the current block.

[0193] Exemplarily, the decoding device may determine a weight value in the first region of the first prediction block (or a weight value in the first region of the second prediction block) based on at least one of decoding information of neighboring decoding blocks, a size of the current block, a template size of the current block, a type of the first prediction mode, and a position of each region of the current block, and then determine a weight value in the first region of the second prediction block (or a weight value in the first region of the first prediction block) based on a predefined weight sum value and the weight value in the first region of the first prediction block (or a weight value in the first region of the second prediction block). For example, the decoding device may determine a weight value corresponding to at least one of decoding information of neighboring decoding blocks, a size of the current block, a template size of the current block, a type of the first prediction mode, and a position of each region of the current block as the weight value in the first region of the first prediction block (or a weight value in the first region of the second prediction block). Here, the weight value of the second predicted block in the first region (or the weight value of the first predicted block in the first region) is the difference value between the total weight value and the weight value of the first predicted block in the first region (or the weight value of the second predicted block in the first region).

[0194] Of course, the weight values ​​of the first predicted block in the first region and the weight values ​​of the second predicted block in the first region may be determined by other methods, and the present application does not specifically limit this. For example, the weight values ​​of the first predicted block in the first region and the weight values ​​of the second predicted block in the first region may be determined by decoding a bitstream. Furthermore, for example, the weight values ​​of the first predicted block in the first region may be determined based on the template error value of the first predicted block, and then the weight values ​​of the second predicted block in the first region may be determined based on a predefined weight sum and the weight values ​​of the first predicted block in the first region. For example, the weight values ​​of the first region of the first predicted block have a negative correlation with the template error value of the single matching block, and the weight values ​​of the second predicted block in the first region are the difference between the weight sum and the weight values ​​of the first predicted block in the first region.

[0195] In some embodiments, the decoding device performs weighting processing on the first prediction block and the second prediction block in the first region, and adds C offset Adding C Shift Shift right by C to obtain the predicted value of the first region. offset is C Shift The value is determined based on C Shift is a numerical value determined based on the sum of the weight value of the first predicted block in the first region and the weight value of the second predicted block in the first region.

[0196] For example, the decoding device may determine the target prediction block using the following formula:

[0197] Pred=(w1×pred1+w2×pred2+C offset )>>C Shift Here, Pred represents the predicted value of the first region, pred1 represents the region of the first predicted block corresponding to the first region, w1 represents the weight value of the first predicted block in the first region, pred2 represents the region of the second predicted block corresponding to the first region, and w2 represents the weight value of the second predicted block in the first region.

[0198] In some embodiments, C offset and C Shift is C offset =<<(C Shift -1),

number

[0199] where:

number

[0200] For example, C offset and C Shift is C offset =1<<(C Shift -1), C Shift =log2(w1+w2).

[0201] In some embodiments, the template for the current block includes at least one of the left reconstructed pixel, the bottom left reconstructed pixel, the top left reconstructed pixel, the top reconstructed pixel, and the top right reconstructed pixel.

[0202] Illustratively, the left reconstructed pixels, the bottom-left reconstructed pixels, or the top-left reconstructed pixels include one or more columns of reconstructed pixels.

[0203] Illustratively, the upper left reconstructed pixels, the upper reconstructed pixels, or the upper right reconstructed pixels include one or more rows of reconstructed pixels.

[0204] FIG. 8 is an example of a template of a current block according to an embodiment of the present application.

[0205] As shown in Figure 8(a), the template for the current block includes a left reconstructed pixel, a lower-left reconstructed pixel, an upper-left reconstructed pixel, an upper reconstructed pixel, and an upper-right reconstructed pixel. As shown in Figure 8(b), the template for the current block includes a left reconstructed pixel, an upper-left reconstructed pixel, an upper reconstructed pixel, and an upper-right reconstructed pixel. As shown in Figure 8(c), the template for the current block includes a left reconstructed pixel, a lower-left reconstructed pixel, an upper-left reconstructed pixel, and an upper reconstructed pixel. As shown in Figure 8(d), the template for the current block includes an upper-left reconstructed pixel, an upper reconstructed pixel, and an upper-right reconstructed pixel. As shown in Figure 8(e), the template for the current block includes a left reconstructed pixel, a lower-left reconstructed pixel, and an upper-left reconstructed pixel.

[0206] In some embodiments, S320 includes: determining a limiting condition for using the IntraTMP mode; If the constraint condition is met, determining the first prediction block based on the IntraTMP mode.

[0207] In some embodiments, the constraint is obtained by at least one of the following: the size of the current block, the decoding information of neighboring decoding blocks, a sequence level flag bit, a frame level flag bit, a macroblock level flag bit, the type of slice in which the current block is located, or the frame type of the image frame in which the current block is located.

[0208] For example, if the restriction conditions for using the IntraTMP mode are met, the decoding device decodes the first identifier.

[0209] Illustratively, if the restriction conditions for using the IntraTMP mode are met, the decoding device decodes the above-mentioned first identifier, and if the first identifier indicates to use the IntraTMP mode, the decoding device determines the first prediction block of the current block based on the IntraTMP mode.

[0210] For example, the restriction conditions include at least one of the following: the size of the current block is greater than (or less than) a predefined size; the decoding information of the neighboring decoding block is predefined decoding information; the value of a sequence-level flag bit is a predefined numerical value; the value of a frame-level flag bit is a predefined numerical value; the value of a macroblock-level flag bit is a predefined numerical value; the type of the slice in which the current block is located is a predefined type; and the frame type of the image frame in which the current block is located is a predefined type. Here, the predefined information (e.g., the predefined size, the predefined decoding information, the predefined numerical value, the predefined type) may be realized by a method of storing a corresponding code or a table in a device (e.g., including a decoding device), or by other methods capable of indicating related information, and the present application does not limit the specific implementation form. For example, "predefined" may refer to being defined in a protocol. In the embodiments of the present application, the "protocol" may refer to a standard protocol in the encoding / decoding field, and may include, for example, related protocols in the image encoding / decoding field, the video encoding / decoding field, the hardware video encoding / decoding field, the dedicated circuit video encoding / decoding field, and the real-time video encoding / decoding field, as well as related protocols applied to future encoding / decoding systems, and the present application is not limited thereto.

[0211] For example, the constraint may include that the frame type of the image frame in which the current block is located is a predefined type. In this case, the predefined type may be an I-frame, i.e., the constraint may include that the frame type of the image frame in which the current block is located is an I-frame. In other words, only if the image frame in which the current block is located is an I-frame used for intra prediction, can the decoding device determine the first prediction block of the current block based on the IntraTMP mode.

[0212] In some embodiments, the first prediction mode is a template-based intra-mode derived TIMD prediction mode.

[0213] Of course, in other alternative embodiments, the first prediction mode may be a predefined prediction mode, a prediction mode determined by decoding a bitstream, or a prediction mode determined by other methods, and the present application is not specifically limited in this regard.

[0214] Preferred embodiments of the present invention will now be described.

[0215] Example 1 [Step 1] The decoder decodes the input bitstream, and the decoding process is performed in CTU order. The obtained block division flags are decoded to divide the CTUs into different decoding blocks for decoding. If the flag bit sps_tmp_enabled_flag is equal to 1 in the SPS and the current coding block size satisfies the SPS's limit on the IntraTMP coding block size, MaxTmpSize, the decoder decodes intra_tmp_flag. If intra_tmp_flag is equal to 1, it indicates that the current coding block is coded in IntraTMP mode, and the decoder decodes intra_tmp_ciip_flag. If intra_tmp_flag is equal to 0, it indicates that the current coding block is not coded in IntraTMP mode, and there is no need to decode intra_tmp_ciip_flag. The process of decoding the relevant syntax elements is shown in Table 3.

[0216] [Step 2] The syntax element intra_tmp_ciip_flag is decoded using X context models, and an index CtxIdxInc corresponding to a different context model is determined based on the coding information of adjacent coding blocks, the current coding block size, etc. For example, X is equal to 3, and the current coding block coordinates are (x, y). If a coding block cuLeft exists at the coordinates (x-1, y) and the intra_tmp_ciip_flag of cuLeft is 1, CtxIdxInc is 1; otherwise, CtxIdxInc is 0. Furthermore, if a coding block cuAbove exists at the coordinates (x, y-1) and the intra_tmp_ciip_flag of cuAbove is 1, 1 is added to CtxIdxInc; otherwise, 0 is added to CtxIdxInc.

[0217] [Step 3] When intra_tmp_ciip_flag is equal to 1, it indicates that the current coding block uses IntraTMP composite fusion prediction based on intra prediction.When intra_tmp_ciip_flag is equal to 0, it indicates that the current coding block is predicted by the existing IntraTMP.

[0218] [Step 4] If the intra_tmp_flag of the current coding block is equal to 1 and the intra_tmp_ciip_flag is equal to 1, the current coding block is coded in the IntraTMP mode, and the prediction block of the current coding block is obtained by IntraTMP composite fusion prediction.

[0219] [Step 5] Intra-template matching is performed within the search area to obtain the best matching block, which is designated as predicted block 1 (i.e., the first predicted block) in the weighted fusion process. For example, the template error value (represented by the SAD between templates) for different block vectors (BV) within the current coding block search area is calculated with a step width of S (i.e., every S points in the horizontal and vertical directions), and the block vector BV0 with the smallest template error value is obtained. For example, if the block vector currently being matched is (X0, Y0), the block vector to be matched next is (X0+S, Y0), and the ordinate of the block vector to be matched in the next row is Y0+4. If the step width S is greater than 1 pixel, BV0 is refined. Specifically, if the best matching block vector BV0 is (X0, Y0), the refinement distance L = (S / 2) × H is determined, where S is the template matching step width and H is the height of the current coding block. The refinement range is defined as follows: the upper left corner is (X i -L,Y i -L) and the bottom right corner is (X i +L,Y i +L). Template matching is performed within the rectangular region with a step size of S' (S' = S / 2), and the block vector BV0' with the smallest template error value is obtained as the best-matching block vector. If S' is greater than 1 pixel, this trimming and refinement process can be repeated until S' is equal to 1 pixel. The matching block pred_tmp pointed to by the final best-matching block vector is set as predicted block 1 in the weighted fusion process.

[0220] [Step 6] The prediction block 2 (i.e., the second prediction block) in the weighted fusion process is obtained using an intra prediction mode other than IntraTMP. For example, the intra coding mode intra_dir of the current coding block is obtained using the template-based intra mode derivation (TIMD) technique. Prediction is performed based on the intra_dir prediction, and the intra prediction block pred_intra is obtained as prediction block 2.

[0221] [Step 7] Weight values ​​are determined for prediction block 1 and prediction block 2. For example, the current coding block is divided based on the intra coding mode intra_dir derived from TIMD in step 6, and different weight values ​​are set for the IntraTMP prediction block and the intra prediction block in different regions. For example, ECM has 65 types of intra angle prediction modes (2≦intra_dir≦66). If 2≦intra_dir<34, the current coding block is divided into four equal parts vertically. If 34≦intra_dir≦66, the current coding block is divided into four equal parts horizontally. The weight value wTMP (i.e., w1 above) of prediction block 1 and the weight value wIntra (i.e., w2 above) of prediction block 2 in each region can be determined based on Table 4.

[0222] In particular, if intra_dir=0 or 1, then (wIntra, wTMP)=(1, 3).

[0223] [Step 8] The prediction block 1 and the prediction block 2 are weighted and fused. For example, based on the obtained intra template matching block pred_tmp, intra prediction block pred_intra, and weight values ​​wTmp and wIntra, the final prediction block Pred satisfies the following formula:

[0224] Pred=(wTmp×pred_tmp+wIntra×pred_intra+offset)>>shift Here, offset=1<<(shift-1), Shift=log2(wTmp+wIntra).

[0225] [Step 9] The coefficient signal of the current coding block is decoded, and a residual block of the current coding block is obtained by inverse quantization and inverse transformation. The residual block is added to the prediction block Pred to obtain a reconstructed block of the current coding block, thereby completing the decoding of the current coding block.

[0226] Although the preferred embodiments of the present disclosure have been described in detail above with reference to the drawings, the present application is not limited to the specific details of the above embodiments. Various simple modifications to the technical solutions of the present application are possible within the scope of the technical concept of the present application, and all such simple modifications fall within the scope of protection of the present application. For example, the specific configurations described in the above specific embodiments may be combined in any appropriate manner as long as they are not contradictory. For the sake of brevity, the present application does not separately describe various possible combinations. Furthermore, for example, the various different embodiments of the present application may be combined in any manner as long as they are not contrary to the concept of the present application, and should be considered as the content disclosed in the present application. Furthermore, in the various method examples of the present application, the magnitude of the numbers of the above processes does not indicate the order of execution. The execution order of each process should be determined by its function and internal logic, and does not constitute any limitation on the implementation process of the examples of the present application.

[0227] The above has described in detail the decoding method according to the embodiment of the present application from the perspective of a decoding device. Below, we will explain the encoding method according to the embodiment of the present application from the perspective of an encoding device with reference to Figure 12.

[0228] 9 is a flowchart of an encoding method according to an embodiment of the present application. The encoding method 400 can be implemented by an encoding device, for example, applied to the encoding framework shown in FIG. 1. For convenience of explanation, the encoding method 400 will be exemplarily described below using an encoding device as an example.

[0229] As shown in FIG. 9, the encoding method 400 includes: Step S410: determining a first predicted block of a current block in a current sequence based on an intra-template matching prediction mode IntraTMP; determining a second prediction block for the current block based on a first prediction mode S420, where the first prediction mode and the IntraTMP mode are different; determining a target predicted block of the current block based on the first predicted block and the second predicted block in step S430; Step S440: obtaining a residual block of the current block according to the target predicted block and the original block of the current block; and step S450 of encoding the residual block of the current block.

[0230] In some embodiments, the method 400 may include encoding the first identifier.

[0231] Here, the first identifier indicates that fusion prediction is to be performed in the IntraTMP mode.

[0232] In some embodiments, the method 400 may include encoding the second identifier.

[0233] Here, the second identifier indicates that prediction is to be performed in the IntraTMP mode.

[0234] In some embodiments, the step of encoding the second identifier comprises: determining a target context index; and encoding the first identifier using the target context index.

[0235] In some embodiments, determining the target context index comprises: determining the target context index based on decoding information of neighboring decoding blocks of the current block; and / or Determining the target context index based on the size of the current block.

[0236] In some embodiments, the coordinates of the current block are (x, y), the adjacent decoded blocks include a first decoded block with coordinates (x-1, y) and a second decoded block with coordinates (x, y-1), the decoded information of the first decoded block includes a prediction mode used for a predicted block of the first decoded block, and the decoded information of the second decoded block includes a prediction mode used for a predicted block of the second decoded block; Here, the step of determining the target context index based on decoding information of an adjacent decoding block of the current block includes: If a prediction mode used for a prediction block of the first decoded block is a mode that performs fusion prediction based on the IntraTMP mode, setting a first numerical value to A, otherwise setting the first numerical value to B (A and B are both integers); If the prediction mode used for the prediction block of the second decoded block is a prediction mode that performs fusion prediction based on the IntraTMP mode, setting the second value to C, otherwise setting the second value to D (C and D are both integers); determining the sum of the first numerical value and the second numerical value as the target context index.

[0237] In some embodiments, step S410 includes: performing template matching on the current block based on the IntraTMP mode to obtain a best matching block; and determining the first predicted block based on the best matching block.

[0238] In some embodiments, determining the first predicted block based on the best matching block comprises: determining the best matching block as the first predicted block; or and refining the best matching block to obtain the first predicted block.

[0239] In some embodiments, refining the best matching block to obtain the first predicted block comprises: determining a refinement range for the best matching block; performing intra-template matching within the refinement range based on at least one matching step width to obtain a matching block that matches within the refinement range, wherein each of the at least one matching step widths is smaller than the matching step width used for the best matching block; determining, among the matching blocks that match within the refinement range, the matching block with the smallest template error value as the best matching block obtained by refining the best matching block; and determining the best matching block obtained by refining the best matching block as the first predicted block.

[0240] In some embodiments, determining a refinement range for the best matching block comprises: Determining the refinement range based on the size of the current block and the best matching block.

[0241] In some embodiments, determining the refinement range based on the size of the current block and the best matching block comprises: determining (S / F)×H as the refinement range, with a block vector from the current block to the best matching block as the center, where / represents the division operator, × represents the multiplication operator, S represents the matching step width used for the best matching block, H represents the height of the current block, and F is a positive integer.

[0242] In some embodiments, determining a refinement range for the best matching block comprises: The step of determining the refinement range based on a predefined numerical value is included.

[0243] In some embodiments, step S410 includes: performing template matching on the current block based on the IntraTMP mode to obtain a plurality of matching blocks; and performing weighting processing on the plurality of matching blocks to obtain the first predicted block.

[0244] In some embodiments, S430 includes: determining a weight value of the first predicted block and a weight value of the second predicted block; and performing weighting processing on the first prediction block and the second prediction block based on the weight value of the first prediction block and the weight value of the second prediction block to obtain the target prediction block.

[0245] In some embodiments, determining a weight value for the first prediction block and a weight value for the second prediction block comprises: The method includes determining a weight value of the first prediction block and a weight value of the second prediction block based on at least one of the coding information of the adjacent coding block, the size of the current block, the template size of the current block, the type of the first prediction mode, and the position of each region of the current block.

[0246] In some embodiments, the weight value of the first prediction block and the weight value of the second prediction block are both predefined weight values.

[0247] In some embodiments, performing weighted processing on the first prediction block and the second prediction block based on a weight value of the first prediction block and a weight value of the second prediction block to obtain the target prediction block includes: The value obtained by performing weighting processing on the first predicted block and the second predicted block is added to C offset Adding C Shift to obtain the target prediction block; where C offset is C Shift The value is determined based on C Shift is a value determined based on the sum of the weight value of the first predicted block and the weight value of the second predicted block.

[0248] In some embodiments, C offset and C Shift is C offset =<<(C Shift -1),

number

[0249] where:

number

[0250] In some embodiments, S430 includes: Dividing the current block into a plurality of regions; determining, for a first region of the plurality of regions, a weight value of the first prediction block in the first region and a weight value of the second prediction block in the first region; performing weighting processing on the first prediction block and the second prediction block in the first region based on a weight value of the first prediction block in the first region and a weight value of the second prediction block in the first region, to obtain a prediction value of the first region; Here, the target prediction block includes prediction values ​​for each of the multiple regions.

[0251] In some embodiments, the step of dividing the current block into a plurality of regions comprises: The method includes dividing the first region into the plurality of regions based on an index of the first prediction mode.

[0252] In some embodiments, dividing the first region into the plurality of regions based on an index of the first prediction mode comprises: If the index of the first prediction mode is located in a first index range, vertically divide the current block into the plurality of regions; If the index of the first prediction mode is located in a second index range, horizontally divide the current block into the plurality of regions; The first index range and the second index range are different.

[0253] In some embodiments, the weight value corresponding to the index of the first region includes a weight value of the first predictive block in the first region and a weight value of the second predictive block in the first region.

[0254] In some embodiments, the weight value of the first prediction block in the first region and the weight value of the second prediction block in the first region are both predefined weight values.

[0255] In some embodiments, determining a weight value of the first prediction block in the first region and a weight value of the second prediction block in the first region comprises: The method includes determining a weight value for the first region of the first prediction block and a weight value for the first region of the second prediction block based on at least one of the coding information of the adjacent coding block, the size of the current block, the template size of the current block, the type of the first prediction mode, and the position of each region of the current block.

[0256] In some embodiments, the step of performing weighting processing on the first prediction block and the second prediction block in the first region based on a weight value of the first prediction block in the first region and a weight value of the second prediction block in the first region to obtain a prediction value of the first region includes: A value obtained by performing weighting processing on the first predicted block and the second predicted block in the first region is added to C offset Adding C Shift to obtain a predicted value of the first region; where C offset is C Shift The value is determined based on C Shift is a numerical value determined based on the sum of the weight value of the first predicted block in the first region and the weight value of the second predicted block in the first region.

[0257] In some embodiments, C offset and C Shift is C offset =<<(C Shift -1),

number

[0258] where:

number

[0259] In some embodiments, the template for the current block includes at least one of the left reconstructed pixel, the bottom left reconstructed pixel, the top left reconstructed pixel, the top reconstructed pixel, and the top right reconstructed pixel.

[0260] In some embodiments, step S410 includes: determining a limiting condition for using the IntraTMP mode; If the constraint condition is met, determining the first prediction block based on the IntraTMP mode.

[0261] In some embodiments, the constraint is obtained by at least one of the size of the current block, the decoding information of the neighboring decoding blocks, the sequence level flag bits, the frame level flag bits, the macroblock level flag bits, the type of slice in which the current block is located, and the frame type of the image frame in which the current block is located.

[0262] In some embodiments, the first prediction mode is a template-based intra-mode derived TIMD prediction mode.

[0263] It should be noted that since the decoding method 300 is the inverse process or operation of the encoding method 400, the steps in the encoding method 400 may refer to the corresponding steps in the decoding method 300, and for the sake of brevity, the description thereof will be omitted here.

[0264] Preferred embodiments of the present invention will now be described.

[0265] <Example 2> [Step 1] The encoding device divides the input video signal into CTUs (Coding Tree Units), and then divides the CTUs into CUs (Coding Units, also called coding blocks) of different sizes using a binary tree, ternary tree, or quad tree, and encodes them. For the current coding block, the encoding device selects an available coding mode based on the mode flag bit in the SPS and attempts to encode it. If the IntraTMP mode flag bit sps_tmp_enabled_flag in the SPS is equal to 1 and the size of the current coding block satisfies the restriction on the IntraTMP coding block size in the SPS, the current coding block can be coded in IntraTMP mode.

[0266] [Step 2] When the current coding block is coded in the IntraTMP mode, the current coding block is predicted and coded using the IntraTMP combined fusion prediction based on the existing IntraTMP prediction.

[0267] [Step 3] Intra-template matching is performed within the search area to obtain the best matching block, which is designated as predicted block 1 (i.e., the first predicted block) in the weighted fusion process. For example, the template error value (represented by the SAD between templates) for different block vectors (BV) within the current coding block search area is calculated with a step width of S (i.e., every S points in the horizontal and vertical directions), and the block vector BV0 with the smallest template error value is obtained. For example, if the block vector currently being matched is (X0, Y0), the block vector to be matched next is (X0+S, Y0), and the ordinate of the block vector to be matched in the next row is Y0+4. If the step width S is greater than 1 pixel, BV0 is refined. Specifically, if the best matching block vector BV0 is (X0, Y0), the refinement distance L = (S / 2) × H is determined, where S is the template matching step width and H is the height of the current coding block. The refinement range is defined as follows: the upper left corner is (X i -L,Y i -L) and the bottom right corner is (X i +L,Y i +L). Template matching is performed within this rectangular area with a step size of S' (S' = S / 2), and the block vector BV0' with the smallest template error value is obtained as the best matching block vector. If S' is greater than 1 pixel, this trimming and refinement process can be repeated until S' is equal to 1 pixel. The matching block pred_tmp pointed to by the final best matching block vector is set as predicted block 1 in the weighted fusion process.

[0268] [Step 4] The prediction block 2 (i.e., the second prediction block) in the weighted fusion process is obtained using an intra prediction mode other than IntraTMP. For example, the intra coding mode intra_dir of the current coding block is obtained using the template-based intra mode derivation (TIMD) technique. Prediction is performed based on the intra_dir prediction, and the intra prediction block pred_intra is obtained as prediction block 2.

[0269] [Step 5] Weight values ​​are determined for prediction block 1 and prediction block 2. For example, the current coding block is divided based on the intra coding mode intra_dir derived from TIMD in step 3, and different weight values ​​are set for the IntraTMP prediction block and the intra prediction block in different regions. For example, ECM has 65 types of intra angle prediction modes (2≦intra_dir≦66). If 2≦intra_dir<34, the current coding block is divided into four equal parts vertically. If 34≦intra_dir≦66, the current coding block is divided into four equal parts horizontally. The weight value wTMP (i.e., w1 above) of prediction block 1 and the weight value wIntra (i.e., w2 above) of prediction block 2 in each region can be determined based on Table 4.

[0270] In particular, if intra_dir=0 or 1, then (wIntra, wTMP)=(1, 3).

[0271] [Step 6] The prediction block 1 and the prediction block 2 are weighted and fused. For example, based on the obtained intra template matching block pred_tmp, intra prediction block pred_intra, and weight values ​​wTmp and wIntra, the final prediction block Pred satisfies the following formula:

[0272] Pred=(wTmp×pred_tmp+wIntra×pred_intra+offset)>>shift Here, offset=1<<(shift-1), Shift=log2(wTmp+wIntra).

[0273] [Step 7] A residual is generated from the final prediction block Pred and the current coding block, and the residual is further compressed through steps such as transform, quantization, and entropy coding before being written into a bitstream to complete the coding for the current coding block. After transform and quantization, the residual is inversely quantized and inversely transformed to obtain a reconstructed residual block. The prediction block Pred is added to the reconstructed residual block to obtain a reconstructed block for the current coding block.

[0274] [Step 8] The flag bit intra_tmp_ciip_flag written to the bitstream indicates whether composite fusion prediction is performed for the current coding block. For example, if the current coding block is coded in IntraTMP mode, the flag bit intra_tmp_flag is equal to 1, and in this case, the flag bit intra_tmp_ciip_flag is written.

[0275] [Step 9] The syntax element intra_tmp_ciip_flag is decoded using X context models, and an index CtxIdxInc corresponding to a different context model is determined based on the coding information of adjacent coding blocks, the current coding block size, etc. For example, X is equal to 3, and the current coding block coordinates are (x, y). If a coding block cuLeft exists at the coordinates (x-1, y) and cu_tmp_intra_flag of cuLeft is 1, CtxIdxInc is 1; otherwise, CtxIdxInc is 0. Furthermore, if a coding block cuAbove exists at the coordinates (x, y-1) and cu_tmp_intra_flag of cuAbove is 1, 1 is added to CtxIdxInc; otherwise, 0 is added to CtxIdxInc.

[0276] [Step 10] Steps 8 and 9 encode flag bit information such as intra_tmp_flag and intra_tmp_ciip_flag related to IntraTMP combined fusion prediction, and step 7 encodes residual information for IntraTMP combined fusion prediction. The above encoding process determines the number of bits required to complete the encoding of the current coding block in IntraTMP combined fusion prediction, and calculates a rate-distortion cost based on the degree of distortion between the reconstructed block of the current coding block and the current coding block. Rate-distortion optimization (RDO) is used to select the optimal coding mode for the current coding block and complete the encoding of the current coding block.

[0277] For the description of each flag bit according to Example 1 and Example 2, please refer to the description in Table 3, and for the sake of brevity, the description will be omitted here. Note that Example 1 and Example 2 are merely examples of the present application and should not be understood as limitations on the present application. For example, in other alternative embodiments, an extended aspect of Example 1 can be obtained by extending based on Example 1 and Example 2. For example, at least the following alternative aspects can be included.

[0278] <Alternative 1> In this embodiment, obtaining the prediction block 1 by intra template matching can be combined with other IntraTMP-based modes, i.e., instead of obtaining one matching block as the prediction block 1 by template matching, obtaining one prediction block as the prediction block 1 by another template matching-based process.

[0279] For example, this technique can be combined with IntraTMP prediction, which fuses multiple matching blocks. In this case, steps 3 and 5 of the template matching process in the embodiment are modified as follows: Intra template matching allows template error values ​​between reconstructed blocks and the current coding block at different positions to be obtained, and these reconstructed blocks are indicated by block vectors pointing from the current coding block to the reconstructed block. A candidate block vector list is constructed and used to record block vectors with smaller template error values ​​in the template matching process. One or more block vectors are selected from the candidate block vector list based on conditions such as block vector interval and template error value, and the reconstructed blocks they point to are set as matching blocks for the current coding block. A weight value is determined for each matching block. These matching blocks are weighted-fused based on their weight values ​​to obtain the final predicted block. This predicted block is set as predicted block 1.

[0280] When other modes based on IntraTMP are used, combinations of other modes with this aspect may be realized by multiple flag bits, as shown in Table 5, for example.

[0281] [Table 5] The explanation of each element in Table 5 is as follows:

[0282] <intra_tmp_fusion_flag> A coding block flag bit that indicates whether the current coding block uses IntraTMP prediction, which fuses multiple matching blocks. If it is set to 1, the current coding block is predicted using multiple matching blocks. If it is set to 0, the current coding block is predicted using IntraTMP with a single matching block.

[0283] The encoding / decoding device first selects the prediction method for IntraTMP based on intra_tmp_fusion_flag, and then selects whether to use this aspect to perform weighted fusion of the prediction block of IntraTMP and the prediction block in the intra prediction mode based on intra_tmp_ciip_flag.

[0284] <Alternative 2> The template error value can be expressed in different calculations, for example, SATD, MSE, MAD.

[0285] <Alternative 3> In an embodiment, the refinement region may be any other shape region obtained based on information such as predefined values, the size of the current coding block, the current block vector, and the refinement step width, and is independent of the trimming range.

[0286] <Alternative 4> In some embodiments, the refinement step can be omitted.

[0287] <Alternative 5> The weight values ​​of prediction block 1 and prediction block 2 may be other predefined fixed values, or the weight values ​​may be determined based on the template error value, the current coding block size, neighboring known coding information, etc. Positions in different current blocks may have different weight values.

[0288] <Alternative 6> The syntax element intra_tmp_ciip_flag may not be written, and IntraTMP composite fusion prediction may be used instead of the existing IntraTMP prediction.

[0289] <Alternative 7> Restrictions for using IntraTMP composite fusion prediction may be added. The restrictions can be obtained from information such as the current coding block size, neighbor coding information, sequence level flag bits, frame level flag bits, and macroblock level flag bits. The syntax element intra_tmp_ciip_flag is coded only when the restrictions are met. Alternatively, when the restrictions are met, IntraTMP composite fusion prediction is used instead of the existing IntraTMP mode.

[0290] <Alternative 8> The syntax element intra_tmp_ciip_flag may be coded using other number of context models, and the context model index to be used may be determined based on the current coding block size, neighboring coding information, etc., or the syntax element intra_tmp_ciip_flag may be coded using a bypass coding method.

[0291] <Alternative 9> If only a partial template on the left or upper side is available for the current coding block, this partial template can be used to perform the template-related operation steps in each embodiment.

[0292] <Alternative 10> The template is the L, M rows (columns) of neighboring reconstructed pixels to the left and above the current block, where L, M can be any integer value.

[0293] <Alternative 11> The template may include the reconstructed pixels at the top right and bottom left of the current block. For example, the template may have five cases as shown in FIG.

[0294] <Alternative 12> In an embodiment, the step size S of the search process and the step size S' of the refinement process may be any integer value, where S' is smaller than S. The refinement process may be performed multiple times, with each step S' being smaller than the previous step S. The refinement region for each step may be a region of other size or shape relative to step S or S'.

[0295] An embodiment of the method according to the present application has been described in detail above. Hereinafter, an embodiment of the apparatus according to the present application will be described in detail with reference to FIGS.

[0296] FIG. 10 is a block diagram of a decoding device 500 according to an embodiment of the present application.

[0297] As shown in FIG. 10, the decoding device 500 a residual unit 510 configured to determine a residual block of a current block in a current sequence based on the bitstream; a first prediction unit 520 configured to determine a first prediction block of the current block based on an intra template matching prediction mode (IntraTMP); a second prediction unit 530 configured to determine a second prediction block of the current block based on a first prediction mode, the first prediction mode and the IntraTMP mode being different; a determining unit 540 configured to determine a target predicted block of the current block based on the first predicted block and the second predicted block; and a reconstruction unit 550 configured to obtain a reconstructed block of the current block based on the residual block of the current block and the target predicted block.

[0298] In some embodiments, the first prediction unit 520 determining a first identifier based on the bitstream; When the first identifier indicates that fusion prediction is to be performed in the IntraTMP mode, the first prediction block is determined based on the IntraTMP mode.

[0299] In some embodiments, the first prediction unit 520 determining a second identifier based on the bitstream; If the second identifier indicates that prediction is to be performed in IntraTMP mode, the first identifier is determined based on the bitstream.

[0300] In some embodiments, the first prediction unit 520 Determine the target context index, The device is configured to determine the first identifier based on the bitstream using the target context index.

[0301] In some embodiments, the first prediction unit 520 Determining the target context index based on decoding information of neighboring decoding blocks of the current block; and / or The target context index is configured to be determined based on the size of the current block.

[0302] In some embodiments, the coordinates of the current block are (x, y), the adjacent decoded blocks include a first decoded block with coordinates (x-1, y) and a second decoded block with coordinates (x, y-1), the decoded information of the first decoded block includes a prediction mode used for a predicted block of the first decoded block, and the decoded information of the second decoded block includes a prediction mode used for a predicted block of the second decoded block; Here, the first prediction unit 520 is If a prediction mode used for a prediction block of the first decoded block is a mode that performs fusion prediction based on the IntraTMP mode, a first numerical value is set to A; otherwise, the first numerical value is set to B (A and B are both integers); If a prediction mode used for the prediction block of the second decoded block is a prediction mode that performs fusion prediction based on the IntraTMP mode, the second value is set to C; otherwise, the second value is set to D (C and D are both integers); The sum of the first numerical value and the second numerical value is configured to be determined as the target context index.

[0303] In some embodiments, the first prediction unit 520 Perform template matching on the current block based on the IntraTMP mode to obtain the best matching block; The first prediction block is determined based on the best matching block.

[0304] In some embodiments, the first prediction unit 520 determining the best matching block as the first predicted block, or The best matching block is configured to be refined to obtain the first predicted block.

[0305] In some embodiments, the first prediction unit 520 determining a refinement range for the best matching block; Perform intra-template matching within the refinement range based on at least one matching step width, and obtain a matching block that matches within the refinement range; Among the matching blocks that match within the refinement range, the matching block with the smallest template error value is determined as the matching block obtained by refining the optimal matching block; a best matching block obtained by refining the best matching block is determined as the first predicted block; Here, each of the at least one matching step widths is smaller than the matching step width used in the optimal matching block.

[0306] In some embodiments, the first prediction unit 520 The refinement range is determined based on the size of the current block and the best matching block.

[0307] In some embodiments, the first prediction unit 520 The refinement range is determined to be (S / F)×H, with the block vector from the current block to the optimal matching block as the center, where / represents the division operator, × represents the multiplication operator, S represents the matching step width used for the best matching block, H represents the height of the current block, and F is a positive integer.

[0308] In some embodiments, the first prediction unit 520 The refinement range is determined based on a predefined numerical value.

[0309] In some embodiments, the first prediction unit 520 Perform template matching on the current block based on the IntraTMP mode to obtain multiple matching blocks; The weighting unit is configured to perform a weighting process on the plurality of matching blocks to obtain the first predicted block.

[0310] In some embodiments, the determining unit 530: determining a weight value of the first predicted block and a weight value of the second predicted block; The weighting unit is configured to perform a weighting process on the first prediction block and the second prediction block based on the weight value of the first prediction block and the weight value of the second prediction block to obtain the target prediction block.

[0311] In some embodiments, the determining unit 530: The weighting factor determining unit is configured to determine a weighting factor for the first prediction block and a weighting factor for the second prediction block based on at least one of the coding information of the adjacent coding block, the size of the current block, the template size of the current block, the type of the first prediction mode, and the position of each region of the current block.

[0312] In some embodiments, the weight value of the first prediction block and the weight value of the second prediction block are both predefined weight values.

[0313] In some embodiments, the determining unit 530: The value obtained by performing weighting processing on the first predicted block and the second predicted block is added to C offset Adding C Shift to obtain the target prediction block; where C offset is C Shift The value is determined based on C Shift is a value determined based on the sum of the weight value of the first predicted block and the weight value of the second predicted block.

[0314] In some embodiments, C offset and C Shift is C offset =<<(C Shift -1),

number

[0315] where:

number

[0316] In some embodiments, the determining unit 530: Divide the current block into multiple regions, For a first region among the plurality of regions, determine a weight value of the first prediction block in the first region and a weight value of the second prediction block in the first region; is configured to perform weighting processing on the first prediction block and the second prediction block in the first region based on a weight value of the first prediction block in the first region and a weight value of the second prediction block in the first region, to obtain a prediction value of the first region; Here, the target prediction block includes prediction values ​​for each of the multiple regions.

[0317] In some embodiments, the determining unit 530: The first region is divided into the plurality of regions based on an index of the first prediction mode.

[0318] In some embodiments, the determining unit 530: If the index of the first prediction mode is located in a first index range, vertically divide the current block into the plurality of regions; When the index of the first prediction mode is located in a second index range, the current block is horizontally divided into the plurality of regions; The first index range and the second index range are different.

[0319] In some embodiments, the weight value corresponding to the index of the first region includes a weight value of the first predictive block in the first region and a weight value of the second predictive block in the first region.

[0320] In some embodiments, the weight value of the first prediction block in the first region and the weight value of the second prediction block in the first region are both predefined weight values.

[0321] In some embodiments, the determining unit 530: The weighting factor determining unit is configured to determine a weighting factor for the first region of the first prediction block and a weighting factor for the second prediction block in the first region based on at least one of the coding information of the adjacent coding block, the size of the current block, the template size of the current block, the type of the first prediction mode, and the position of each region of the current block.

[0322] In some embodiments, the determining unit 530: A value obtained by performing weighting processing on the first predicted block and the second predicted block in the first region is added to C offset Adding C Shift to right-shift the first region to obtain a predicted value of the first region; where C offset is C Shift The value is determined based on C Shift is a numerical value determined based on the sum of the weight value of the first predicted block in the first region and the weight value of the second predicted block in the first region.

[0323] In some embodiments, C offset and C Shift is C offset =<<(C Shift -1),

number

[0324] where:

number

[0325] In some embodiments, the template for the current block includes at least one of the left reconstructed pixel, the bottom left reconstructed pixel, the top left reconstructed pixel, the top reconstructed pixel, and the top right reconstructed pixel.

[0326] In some embodiments, the first prediction unit 520 Determine the restrictions for using the IntraTMP mode; If the constraint condition is met, the first prediction block is determined based on the IntraTMP mode.

[0327] In some embodiments, the constraint is obtained by at least one of the following: the size of the current block, the decoding information of neighboring decoding blocks, a sequence level flag bit, a frame level flag bit, a macroblock level flag bit, the type of slice in which the current block is located, or the frame type of the image frame in which the current block is located.

[0328] In some embodiments, the first prediction mode is a template-based intra-mode derived TIMD prediction mode.

[0329] FIG. 11 is a block diagram of an encoding device 600 according to an embodiment of the present application.

[0330] As shown in FIG. 11, the encoding device 600 a first prediction unit 610 configured to determine a first prediction block of a current block in a current sequence based on an intra template matching prediction mode IntraTMP; a second prediction unit 620 configured to determine a second prediction block of the current block based on a first prediction mode, where the first prediction mode and the IntraTMP mode are different; a determining unit 630 configured to determine a target predicted block of the current block based on the first predicted block and the second predicted block; a residual unit 640 configured to obtain a residual block for the current block based on the target prediction block and the original block for the current block; and an encoding unit 650 configured to encode the residual block of the current block.

[0331] In some embodiments, the encoding unit 650: configured to encode the first identifier; Here, the first identifier indicates that fusion prediction is to be performed in the IntraTMP mode.

[0332] In some embodiments, the encoding unit 650: configured to encode the second identifier; Here, the second identifier indicates that prediction is to be performed in the IntraTMP mode.

[0333] In some embodiments, the encoding unit 650: Determine the target context index, The target context index is configured to be used to encode the first identifier.

[0334] In some embodiments, the encoding unit 650: Determining the target context index based on decoding information of neighboring decoding blocks of the current block; and / or The target context index is configured to be determined based on the size of the current block.

[0335] In some embodiments, the coordinates of the current block are (x, y), the adjacent decoded blocks include a first decoded block with coordinates (x-1, y) and a second decoded block with coordinates (x, y-1), the decoded information of the first decoded block includes a prediction mode used for a predicted block of the first decoded block, and the decoded information of the second decoded block includes a prediction mode used for a predicted block of the second decoded block; Here, the encoding unit 650: If a prediction mode used for a prediction block of the first decoded block is a mode that performs fusion prediction based on the IntraTMP mode, a first numerical value is set to A; otherwise, the first numerical value is set to B (A and B are both integers); If a prediction mode used for the prediction block of the second decoded block is a prediction mode that performs fusion prediction based on the IntraTMP mode, the second value is set to C; otherwise, the second value is set to D (C and D are both integers); The sum of the first numerical value and the second numerical value is configured to be determined as the target context index.

[0336] In some embodiments, the first prediction unit 610 Perform template matching on the current block based on the IntraTMP mode to obtain the best matching block; The first prediction block is determined based on the best matching block.

[0337] In some embodiments, the first prediction unit 610 determining the best matching block as the first predicted block, or The best matching block is configured to be refined to obtain the first predicted block.

[0338] In some embodiments, the first prediction unit 610 determining a refinement range for the best matching block; Perform intra-template matching within the refinement range based on at least one matching step width, and obtain a matching block that matches within the refinement range; Among the matching blocks that match within the refinement range, the matching block with the smallest template error value is determined as the optimal matching block obtained by refining the optimal matching block; a best matching block obtained by refining the best matching block is determined as the first predicted block; Each of the at least one matching step widths is smaller than the matching step width used for the best matching block.

[0339] In some embodiments, the first prediction unit 610 The refinement range is determined based on the size of the current block and the best matching block.

[0340] In some embodiments, the first prediction unit 610 determining (S / F)×H as the refinement range, with a block vector pointing from the current block to the best matching block as the center; where / represents the division operator, × represents the multiplication operator, S represents the matching step width used for the best matching block, H represents the height of the current block, and F is a positive integer.

[0341] In some embodiments, the first prediction unit 610 The refinement range is determined based on a predefined numerical value.

[0342] In some embodiments, the first prediction unit 610 Perform template matching on the current block based on the IntraTMP mode to obtain multiple matching blocks; The weighting unit is configured to perform a weighting process on the plurality of matching blocks to obtain the first predicted block.

[0343] In some embodiments, the determining unit 630: determining a weight value of the first predicted block and a weight value of the second predicted block; The weighting unit is configured to perform a weighting process on the first prediction block and the second prediction block based on the weight value of the first prediction block and the weight value of the second prediction block to obtain the target prediction block.

[0344] In some embodiments, the determining unit 630: The weighting factor determining unit is configured to determine a weighting factor for the first prediction block and a weighting factor for the second prediction block based on at least one of the coding information of the adjacent coding block, the size of the current block, the template size of the current block, the type of the first prediction mode, and the position of each region of the current block.

[0345] In some embodiments, the weight value of the first prediction block and the weight value of the second prediction block are both predefined weight values.

[0346] In some embodiments, the determining unit 630: The value obtained by performing weighting processing on the first predicted block and the second predicted block is added to C offset Adding C Shift to obtain the target prediction block; where C offset is C Shift The value is determined based on C Shift is a value determined based on the sum of the weight value of the first predicted block and the weight value of the second predicted block.

[0347] In some embodiments, C offset and C Shift is C offset =<<(C Shift -1),

number

[0348] where:

number

[0349] In some embodiments, the determining unit 630: Divide the current block into multiple regions, For a first region among the plurality of regions, determine a weight value of the first prediction block in the first region and a weight value of the second prediction block in the first region; is configured to perform weighting processing on the first prediction block and the second prediction block in the first region based on a weight value of the first prediction block in the first region and a weight value of the second prediction block in the first region, to obtain a prediction value of the first region; Here, the target prediction block includes prediction values ​​for each of the multiple regions.

[0350] In some embodiments, the determining unit 630: The first region is divided into the plurality of regions based on an index of the first prediction mode.

[0351] In some embodiments, the determining unit 630: If the index of the first prediction mode is located in a first index range, vertically divide the current block into the plurality of regions; When the index of the first prediction mode is located in a second index range, the current block is horizontally divided into the plurality of regions; The first index range and the second index range are different.

[0352] In some embodiments, the weight value corresponding to the index of the first region includes a weight value of the first predictive block in the first region and a weight value of the second predictive block in the first region.

[0353] In some embodiments, the weight value of the first prediction block in the first region and the weight value of the second prediction block in the first region are both predefined weight values.

[0354] In some embodiments, the determining unit 630: The weighting factor determining unit is configured to determine a weighting factor for the first region of the first prediction block and a weighting factor for the second prediction block in the first region based on at least one of the coding information of the adjacent coding block, the size of the current block, the template size of the current block, the type of the first prediction mode, and the position of each region of the current block.

[0355] In some embodiments, the determining unit 630: A value obtained by performing weighting processing on the first predicted block and the second predicted block in the first region is added to C offset Adding C Shift Shift right by , and obtain the predicted value of the first region. where C offset is C Shift The value is determined based on C Shift is a numerical value determined based on the sum of the weight value of the first predicted block in the first region and the weight value of the second predicted block in the first region.

[0356] In some embodiments, C offset and C Shift is C offset =<<(C Shift -1),

number

[0357] where:

number

[0358] In some embodiments, the template for the current block includes at least one of the left reconstructed pixel, the bottom left reconstructed pixel, the top left reconstructed pixel, the top reconstructed pixel, and the top right reconstructed pixel.

[0359] In some embodiments, the first prediction unit 610 Determine the restrictions for using the IntraTMP mode; If the constraint condition is met, the first prediction block is determined based on the IntraTMP mode.

[0360] In some embodiments, the constraint is obtained by at least one of the following: the size of the current block, the decoding information of neighboring decoding blocks, a sequence level flag bit, a frame level flag bit, a macroblock level flag bit, the type of slice in which the current block is located, or the frame type of the image frame in which the current block is located.

[0361] In some embodiments, the first prediction mode is a template-based intra-mode derived TIMD prediction mode.

[0362] It should be noted that the device embodiments may correspond to the method embodiments, and corresponding descriptions may refer to the method embodiments. For brevity, the description is omitted here. Specifically, the decoding device 500 shown in FIG. 10 may correspond to a corresponding entity that performs the method 300 of the embodiment of the present application, and the above and other operations and / or functions of each unit in the decoding device 500 are used to realize the corresponding process of each method, such as the method 300. Similarly, the encoding device 600 shown in FIG. 11 may correspond to a corresponding entity in the method 400 of the embodiment of the present application, that is, the above and other operations and / or functions of each unit in the encoding device 600 are used to realize the corresponding process of each method, such as the method 400.

[0363] Note that each unit in the decoding device 500 or the encoding device 600 according to the embodiments of the present application may be configured individually or all may be integrated into one or more other units, or one (or some) of the units may be further divided into multiple functionally smaller units, and in this case, the same operation can be achieved without affecting the realization of the technical effect of the embodiments of the present application. Although the above units are divided based on logical functions, in actual applications, the function of one unit may be realized by multiple units, or the functions of multiple units may be realized by one unit. In other embodiments of the present application, the decoding device 500 or the encoding device 600 may include other units, and in actual applications, these functions may be realized cooperatively by other units or by multiple units working together. According to another embodiment of the present application, a decoding device 500 or an encoding device 600 according to an embodiment of the present application can be constructed by executing a computer program (including program code) capable of executing each step of a corresponding method on a general-purpose computing device of a general-purpose computer including processing elements and memory elements such as a central processing unit (CPU), a random access memory (RAM), a read-only memory (ROM), etc., thereby realizing the encoding method or decoding method according to an embodiment of the present application. The computer program can be recorded in, for example, a computer-readable storage medium, installed in an electronic device via the computer-readable storage medium, and executed therein to realize the corresponding method according to an embodiment of the present application.

[0364] In other words, the above units may be implemented in the form of hardware, software instructions, or a combination of software and hardware. Specifically, each step of the method embodiments in the present application can be completed by a hardware integrated logic circuit and / or software instructions in a processor. The method steps disclosed in the present application may be executed by a hardware decoding processor or may be executed by a combination of hardware and software in a decoding processor. Optionally, the software may be located in a storage medium well-established 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 memory, or a register. The storage medium is located in the memory, and the processor reads information in the memory and cooperates with the hardware to complete the steps of the method embodiments.

[0365] FIG. 12 is a structural schematic diagram of an electronic device 700 according to an embodiment of the present application.

[0366] 12 , the electronic device 700 includes at least a processor 710 and a computer-readable storage medium 720. Here, the processor 710 and the computer-readable storage medium 720 may be connected via a bus or in another manner. The computer-readable storage medium 720 is configured to store a computer program 721, which includes computer instructions, and the processor 710 is configured to execute the computer instructions stored in the computer-readable storage medium 720. The processor 710 is a computational and control core of the electronic device 700 and is configured to realize one or more computer instructions, specifically, to load and execute one or more computer instructions.

[0367] By way of example, the processor 710 may be referred to as a Central Processing Unit (CPU), and may include, but is not limited to, 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 component gate or transistor logic device, a discrete hardware component, or the like.

[0368] By way of example, computer-readable storage medium 720 may be high-speed RAM memory or non-volatile memory, such as at least one magnetic disk memory. Alternatively, computer-readable storage medium 720 may be at least one computer-readable storage medium remote from processor 710. Specifically, computer-readable storage medium 720 includes, but is not limited to, volatile memory and / or non-volatile memory. Here, non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may be random access memory (RAM) used as a high-speed external cache. By way of example, various RAMs may be used, such as, but not limited to, 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 (Double Data Rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (Enhanced SDRAM, ESDRAM), synchronous link dynamic random access memory (Synch Link DRAM, SLDRAM), and direct memory bus random access memory (Direct Rambus RAM, DR RAM).

[0369] In one implementation, the electronic device 700 may be an encoding device or encoding framework according to an embodiment of the present application. The computer-readable storage medium 720 stores first computer instructions. The first computer instructions stored in the computer-readable storage medium 720 are loaded and executed by the processor 710 to implement corresponding steps in the encoding method according to an embodiment of the present application. In other words, the first computer instructions in the computer-readable storage medium 720 are loaded by the processor 710 to execute corresponding steps, and the description thereof will be omitted here for brevity.

[0370] In one implementation, the electronic device 700 may be a decoding device or a decoding framework according to an embodiment of the present application. The computer-readable storage medium 720 stores second computer instructions. The second computer instructions stored in the computer-readable storage medium 720 are loaded and executed by the processor 710 to implement corresponding steps in the decoding method according to an embodiment of the present application. In other words, the second computer instructions in the computer-readable storage medium 720 are loaded by the processor 710 to execute corresponding steps, and the description thereof will be omitted here for brevity.

[0371] According to another aspect of the present application, an embodiment of the present application further provides an encoding / decoding system including the encoding device and the decoding device described above.

[0372] According to another aspect of the present application, an embodiment of the present application further provides a computer-readable storage medium (Memory). The computer-readable storage medium is a storage device in the electronic device 700 and is used to store programs and data. For example, it is a computer-readable storage medium 720. Note that the computer-readable storage medium 720 here may include a built-in storage medium in the electronic device 700, or may also include an expansion storage medium supported by the electronic device 700. The computer-readable storage medium provides a storage space, and the storage space stores an operating system of the electronic device 700. The storage space also stores one or more computer instructions that are loaded and executed by the processor 710. These computer instructions may be one or more computer programs 721 (including program code).

[0373] According to another aspect of the present application, there is provided a computer program product or a computer program, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium, such as a computer program 721. In this case, the data processing device 700 may be a computer, and the processor 710 reads the computer instructions from the computer-readable storage medium 720, and the processor 710 executes the computer instructions to cause the computer to perform the encoding or decoding method provided in each of the alternative aspects above.

[0374] That is, when implemented in software, all or part of the software may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed by a computer, the processes of the embodiments of the present application are executed or the functions of the embodiments of the present application are realized, in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (e.g., infrared, radio, microwave, etc.).

[0375] Those skilled in the art can recognize that each exemplary unit and process step described in the embodiments disclosed herein can be realized by electronic hardware or by the cooperation of computer software and electronic hardware. Whether these functions are performed by hardware or software depends on the specific application and design constraints of the technical means. Those skilled in the art can realize the described functions using different methods for each specific application, but such realization should not be considered beyond the scope of this application.

[0376] Finally, the above content is merely a specific embodiment of the present application, and the scope of protection of the present application is not limited thereto. Those skilled in the art can easily think of modifications or substitutions within the technical scope disclosed in the present application, all of which should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be in accordance with the scope of protection of the claims.< / maxtmpsize>

Claims

1. 1. A decoding method comprising: determining a residual block of a current block in a current sequence based on the bitstream; determining a first prediction block of the current block based on an intra template matching prediction mode (IntraTMP mode); determining a second prediction block of the current block based on a first prediction mode, wherein the first prediction mode and the IntraTMP mode are different; determining a target predicted block for the current block based on the first predicted block and the second predicted block; obtaining a reconstructed block of the current block based on a residual block of the current block and the target predicted block; A decoding method comprising:

2. The step of determining a first prediction block of the current block based on an intra template matching prediction mode (IntraTMP mode) includes: determining a first identifier based on the bitstream; If the first identifier indicates that fusion prediction is to be performed in the IntraTMP mode, determining the first prediction block based on the IntraTMP mode.

2. The decoding method according to claim 1 .

3. The step of determining a first identifier based on the bitstream comprises: determining a second identifier based on the bitstream; If the second identifier indicates that prediction is to be performed in the IntraTMP mode, determining the first identifier based on the bitstream.

3. The decoding method according to claim 2.

4. The step of determining a first identifier based on the bitstream comprises: determining a target context index; and determining the first identifier based on the bitstream using the target context index.

3. The decoding method according to claim 2.

5. The step of determining a target context index comprises: determining the target context index based on decoding information of neighboring decoding blocks of the current block; and / or determining the target context index based on a size of the current block; 5. The decoding method according to claim 4.

6. The coordinates of the current block are (x, y), the adjacent decoded blocks include a first decoded block having coordinates (x-1, y) and a second decoded block having coordinates (x, y-1), the decoded information of the first decoded block includes a prediction mode used for a predicted block of the first decoded block, and the decoded information of the second decoded block includes a prediction mode used for a predicted block of the second decoded block; Here, the step of determining the target context index based on decoding information of an adjacent decoding block of the current block includes: If a prediction mode used for a prediction block of the first decoded block is a mode that performs fusion prediction based on the IntraTMP mode, setting a first value to A, and otherwise setting the first value to B, where A and B are both integers; If a prediction mode used for a prediction block of the second decoded block is a prediction mode that performs fusion prediction based on the IntraTMP mode, setting a second value to C, otherwise setting the second value to D, where C and D are both integers; determining the sum of the first and second numerical values ​​as the target context index; 6. The decoding method according to claim 5.

7. The step of determining the first prediction block based on an intra template matching prediction mode (IntraTMP mode) includes: performing template matching on the current block based on the IntraTMP mode to obtain a best matching block; determining the first predicted block based on the best matching block; 7. The decoding method according to claim 1, wherein the decoding method is a decoding method for decoding a digital signal.

8. The step of determining the first prediction block based on the best matching block comprises: determining the best matching block as the first predicted block; or refining the best matching block to obtain the first predicted block; 8. The decoding method according to claim 7.

9. The step of refining the best matching block to obtain the first predicted block includes: determining a refinement range for the best matching block; performing intra-template matching within the refinement range based on at least one matching step width to obtain a matching block that matches within the refinement range, wherein each of the at least one matching step widths is smaller than the matching step width used for the best matching block; determining a matching block having a minimum template error value among the matching blocks within the refinement range as an optimal matching block obtained by refining the optimal matching block; determining an optimal matching block obtained by refining the optimal matching block as the first predicted block; 9. The decoding method according to claim 8.

10. The step of determining a refinement range of the best matching block comprises: determining the refinement range based on the size of the current block and the best matching block; 10. The decoding method according to claim 9.

11. determining the refinement range based on the size of the current block and the best matching block; determining (S / F)×H as the refinement range, with a block vector from the current block to the best matching block as the center; where / represents the division operator, × represents the multiplication operator, S represents the matching step width used for the best matching block, H represents the height of the current block, and F is a positive integer.

11. The decoding method according to claim 10.

12. The step of determining a refinement range of the best matching block comprises: determining the refinement range based on a predefined numerical value; 10. The decoding method according to claim 9.

13. The step of determining the first prediction block based on an intra template matching prediction mode (IntraTMP mode) includes: performing template matching on the current block based on the IntraTMP mode to obtain a plurality of matching blocks; performing weighted processing on the plurality of matching blocks to obtain the first predicted block; 7. The decoding method according to claim 1, wherein the decoding method is a decoding method for decoding a digital signal.

14. The step of determining a target predicted block of the current block based on the first predicted block and the second predicted block includes: determining a weight value of the first predicted block and a weight value of the second predicted block; performing weighting processing on the first prediction block and the second prediction block according to a weight value of the first prediction block and a weight value of the second prediction block to obtain the target prediction block; The decoding method according to any one of claims 1 to 13.

15. The step of determining a weight value of the first prediction block and a weight value of the second prediction block includes: determining a weight value of the first prediction block and a weight value of the second prediction block based on at least one of coding information of an adjacent coding block, a size of the current block, a template size of the current block, a type of the first prediction mode, and a position of each region of the current block; 15. The decoding method according to claim 14.

16. the weight value of the first prediction block and the weight value of the second prediction block are both predefined weight values; 15. The decoding method according to claim 14.

17. The step of performing weighting processing on the first prediction block and the second prediction block based on the weight value of the first prediction block and the weight value of the second prediction block to obtain the target prediction block includes: The numerical values ​​obtained by performing weighting processing on the first predicted block and the second predicted block are added to C offset Adding C Shift to obtain the target prediction block; Here, C offset is C Shift is a value determined based on C Shift is a value determined based on the sum of the weight value of the first predicted block and the weight value of the second predicted block, 15. The decoding method according to claim 14.

18. C offset =<<(C Shift -1)、 [Equation 1] and where: [Equation 2] represents the rounding operator, << represents the left shift operator, and W sum represents the sum of the weight value of the first prediction block and the weight value of the second prediction block, 18. The decoding method according to claim 17.

19. The step of determining a target predicted block of the current block based on the first predicted block and the second predicted block includes: Dividing the current block into a plurality of regions; determining a weight value of the first predicted block in the first region and a weight value of the second predicted block in the first region for a first region of the plurality of regions; performing weighting processing on the first prediction block and the second prediction block in the first region based on a weight value of the first prediction block in the first region and a weight value of the second prediction block in the first region to obtain a prediction value of the first region; wherein the target predicted block includes a predicted value for each of the plurality of regions. The decoding method according to any one of claims 1 to 13.

20. The step of dividing the current block into a plurality of regions includes: dividing the first region into the plurality of regions based on an index of the first prediction mode; 20. The decoding method of claim 19.

21. The step of dividing the first region into the plurality of regions based on an index of the first prediction mode includes: When the index of the first prediction mode is located in a first index range, vertically dividing the current block into the plurality of regions; If the index of the first prediction mode is located in a second index range, horizontally divide the current block into the plurality of regions; the first index range and the second index range are different; 21. The decoding method of claim 20.

22. the weight values ​​corresponding to the index of the first region include a weight value in the first region of the first prediction block and a weight value in the first region of the second prediction block; 20. The decoding method of claim 19.

23. a weight value of the first prediction block in the first region and a weight value of the second prediction block in the first region are both predefined weight values; 20. The decoding method of claim 19.

24. The step of determining weight values ​​in the first region of the first prediction block and weight values ​​in the first region of the second prediction block includes: determining a weight value in the first region of the first prediction block and a weight value in the first region of the second prediction block based on at least one of coding information of an adjacent coding block, a size of the current block, a template size of the current block, a type of the first prediction mode, and a position of each region of the current block; 20. The decoding method of claim 19.

25. the step of performing weighting processing on the first prediction block and the second prediction block in the first region based on the weight value of the first prediction block in the first region and the weight value of the second prediction block in the first region to obtain a prediction value of the first region, A value obtained by performing weighting processing on the first predicted block and the second predicted block in the first region is added to C offset Adding C Shift to obtain a predicted value of the first region; Here, C offset is C Shift is a value determined based on C Shift is a numerical value determined based on the sum of the weight value of the first predicted block in the first region and the weight value of the second predicted block in the first region, 20. The decoding method of claim 19.

26. C offset =<<(C Shift -1)、 [Equation 3] and where: [Equation 4] represents the rounding operator, << represents the left shift operator, and W sum represents the sum of the weight value of the first prediction block in the first region and the weight value of the second prediction block in the first region, 26. The decoding method of claim 25.

27. the template for the current block includes at least one of left reconstructed pixels, lower left reconstructed pixels, upper left reconstructed pixels, upper reconstructed pixels, and upper right reconstructed pixels; The decoding method according to any one of claims 1 to 26.

28. The step of determining a first prediction block of the current block based on an intra template matching prediction mode (IntraTMP mode) includes: determining a limiting condition for using the IntraTMP mode; If the constraint condition is satisfied, determining the first prediction block based on the IntraTMP mode. The decoding method according to any one of claims 1 to 27.

29. the restriction condition is obtained by at least one of a size of the current block, decoding information of neighboring decoding blocks, a sequence level flag bit, a frame level flag bit, a macroblock level flag bit, a type of slice in which the current block is located, and a frame type of an image frame in which the current block is located; 29. The method of claim 28.

30. the first prediction mode is a template-based intra-mode derivation (TIMD) prediction mode; A decoding method according to any one of claims 1 to 28.

31. 1. An encoding method comprising: determining a first prediction block of a current block in a current sequence based on an intra-template matching prediction mode (IntraTMP mode); determining a second prediction block of the current block based on a first prediction mode, wherein the first prediction mode and the IntraTMP mode are different; determining a target predicted block for the current block based on the first predicted block and the second predicted block; obtaining a residual block of the current block based on the target predicted block and an original block of the current block; encoding a residual block of the current block; 10. A coding method comprising:

32. The encoding method further includes encoding a first identifier; Here, the first identifier indicates that fusion prediction is to be performed in the IntraTMP mode.

32. The encoding method of claim 31.

33. The encoding method further includes encoding a second identifier; wherein the second identifier indicates that the prediction is to be performed in the IntraTMP mode.

33. The encoding method of claim 32.

34. The step of encoding the second identifier includes: determining a target context index; encoding the first identifier with the target context index; 33. The encoding method of claim 32.

35. The step of determining a target context index comprises: determining the target context index based on decoding information of neighboring decoding blocks of the current block; and / or determining the target context index based on a size of the current block; 35. The encoding method of claim 34.

36. The coordinates of the current block are (x, y), the adjacent decoded blocks include a first decoded block having coordinates (x-1, y) and a second decoded block having coordinates (x, y-1), the decoded information of the first decoded block includes a prediction mode used for a predicted block of the first decoded block, and the decoded information of the second decoded block includes a prediction mode used for a predicted block of the second decoded block; Here, the step of determining the target context index based on decoding information of an adjacent decoding block of the current block includes: If a prediction mode used for a prediction block of the first decoded block is a mode that performs fusion prediction based on the IntraTMP mode, setting a first value to A, and otherwise setting the first value to B, where A and B are both integers; If a prediction mode used for a prediction block of the second decoded block is a prediction mode that performs fusion prediction based on the IntraTMP mode, setting a second value to C, otherwise setting the second value to D, where C and D are both integers; determining the sum of the first and second numerical values ​​as the target context index; 36. The encoding method of claim 35.

37. The step of determining a first prediction block of a current block in a current sequence based on an intra template matching prediction mode (IntraTMP mode) includes: performing template matching on the current block based on the IntraTMP mode to obtain a best matching block; determining the first predicted block based on the best matching block; The encoding method according to any one of claims 31 to 36.

38. The step of determining the first prediction block based on the best matching block comprises: determining the best matching block as the first predicted block; or refining the best matching block to obtain the first predicted block; 38. The encoding method of claim 37.

39. The step of refining the best matching block to obtain the first predicted block includes: determining a refinement range for the best matching block; performing intra-template matching within the refinement range based on at least one matching step width to obtain a matching block that matches within the refinement range, wherein each of the at least one matching step widths is smaller than the matching step width used for the best matching block; determining a matching block having a minimum template error value among the matching blocks within the refinement range as an optimal matching block obtained by refining the optimal matching block; determining an optimal matching block obtained by refining the optimal matching block as the first predicted block; 39. The encoding method of claim 38.

40. The step of determining a refinement range of the best matching block comprises: determining the refinement range based on the size of the current block and the best matching block; 40. The encoding method of claim 39.

41. determining the refinement range based on the size of the current block and the best matching block; determining (S / F)×H as the refinement range with a block vector from the current block toward the best matching block as a center, where / represents the division operator, × represents the multiplication operator, S represents the matching step width used for the best matching block, H represents the height of the current block, and F is a positive integer.

41. The encoding method of claim 40.

42. The step of determining a refinement range of the best matching block comprises: determining the refinement range based on a predefined numerical value; 40. The encoding method of claim 39.

43. The step of determining a first prediction block of a current block in a current sequence based on an intra template matching prediction mode (IntraTMP mode) includes: performing template matching on the current block based on the IntraTMP mode to obtain a plurality of matching blocks; performing weighted processing on the plurality of matching blocks to obtain the first predicted block; The encoding method according to any one of claims 31 to 36.

44. The step of determining a target predicted block of the current block based on the first predicted block and the second predicted block includes: determining a weight value of the first predicted block and a weight value of the second predicted block; performing weighting processing on the first prediction block and the second prediction block according to a weight value of the first prediction block and a weight value of the second prediction block to obtain the target prediction block; The encoding method according to any one of claims 31 to 43.

45. The step of determining a weight value of the first prediction block and a weight value of the second prediction block includes: determining a weight value of the first prediction block and a weight value of the second prediction block based on at least one of coding information of an adjacent coding block, a size of the current block, a template size of the current block, a type of the first prediction mode, and a position of each region of the current block; 45. The encoding method of claim 44.

46. the weight value of the first prediction block and the weight value of the second prediction block are both predefined weight values; 45. The encoding method of claim 44.

47. The step of performing weighting processing on the first prediction block and the second prediction block based on the weight value of the first prediction block and the weight value of the second prediction block to obtain the target prediction block includes: The numerical values ​​obtained by performing weighting processing on the first predicted block and the second predicted block are added to C offset Adding C Shift to obtain the target prediction block; Here, C offset is C Shift is a value determined based on C Shift is a value determined based on the sum of the weight value of the first predicted block and the weight value of the second predicted block, 45. The encoding method of claim 44.

48. C offset =<<(C Shift -1)、 [Equation 5] and where: [Equation 6] represents the rounding operator, << represents the left shift operator, and W sum represents the sum of the weight value of the first prediction block and the weight value of the second prediction block, 48. The encoding method of claim 47.

49. The step of determining a target predicted block of the current block based on the first predicted block and the second predicted block includes: Dividing the current block into a plurality of regions; determining a weight value of the first predicted block in the first region and a weight value of the second predicted block in the first region for a first region of the plurality of regions; performing weighting processing on the first prediction block and the second prediction block in the first region based on a weight value of the first prediction block in the first region and a weight value of the second prediction block in the first region to obtain a prediction value of the first region; wherein the target predicted block includes a predicted value for each of the plurality of regions. The encoding method according to any one of claims 31 to 43.

50. The step of dividing the current block into a plurality of regions includes: dividing the first region into the plurality of regions based on an index of the first prediction mode; 50. The encoding method of claim 49.

51. The step of dividing the first region into the plurality of regions based on an index of the first prediction mode includes: When the index of the first prediction mode is located in a first index range, vertically dividing the current block into the plurality of regions; If the index of the first prediction mode is located in a second index range, horizontally divide the current block into the plurality of regions; the first index range and the second index range are different; 51. The encoding method of claim 50.

52. the weight values ​​corresponding to the index of the first region include a weight value in the first region of the first prediction block and a weight value in the first region of the second prediction block; 50. The encoding method of claim 49.

53. a weight value of the first prediction block in the first region and a weight value of the second prediction block in the first region are both predefined weight values; 50. The encoding method of claim 49.

54. The step of determining weight values ​​in the first region of the first prediction block and weight values ​​in the first region of the second prediction block includes: determining a weight value in the first region of the first prediction block and a weight value in the first region of the second prediction block based on at least one of coding information of an adjacent coding block, a size of the current block, a template size of the current block, a type of the first prediction mode, and a position of each region of the current block; 50. The encoding method of claim 49.

55. the step of performing weighting processing on the first prediction block and the second prediction block in the first region based on the weight value of the first prediction block in the first region and the weight value of the second prediction block in the first region to obtain a prediction value of the first region, A value obtained by performing weighting processing on the first predicted block and the second predicted block in the first region is added to C offset Adding C Shift to obtain a predicted value of the first region; Here, C offset is C Shift is a value determined based on C Shift is a numerical value determined based on the sum of the weight value of the first predicted block in the first region and the weight value of the second predicted block in the first region, 50. The encoding method of claim 49.

56. C offset =<<(C Shift -1)、 [Equation 7] and where: [Equation 8] represents the rounding operator, << represents the left shift operator, and W sum represents the sum of the weight value of the first prediction block in the first region and the weight value of the second prediction block in the first region, 56. The encoding method of claim 55.

57. the template for the current block includes at least one of left reconstructed pixels, lower left reconstructed pixels, upper left reconstructed pixels, upper reconstructed pixels, and upper right reconstructed pixels; Encoding method according to any one of claims 31 to 56.

58. The step of determining a first prediction block of a current block in a current sequence based on an intra template matching prediction mode (IntraTMP mode) includes: determining a limiting condition for using the IntraTMP mode; If the constraint condition is satisfied, determining the first prediction block based on the IntraTMP mode. Encoding method according to any one of claims 31 to 57.

59. the restriction condition is obtained by at least one of a size of the current block, decoding information of neighboring decoding blocks, a sequence level flag bit, a frame level flag bit, a macroblock level flag bit, a type of slice in which the current block is located, and a frame type of an image frame in which the current block is located; 59. The encoding method of claim 58.

60. the first prediction mode is a template-based intra-mode derivation (TIMD) prediction mode; Encoding method according to any one of claims 31 to 58.

61. A decoding device, comprising: a residual unit configured to determine a residual block of a current block in a current sequence based on the bitstream; a first prediction unit configured to determine a first prediction block of the current block based on an intra template matching prediction mode (IntraTMP mode); a second prediction unit configured to determine a second prediction block of the current block based on a first prediction mode, wherein the first prediction mode and the IntraTMP mode are different; a determining unit configured to determine a target predicted block of the current block based on the first predicted block and the second predicted block; a reconstruction unit configured to obtain a reconstructed block of the current block based on a residual block of the current block and the target predicted block; A decoding device characterized by:

62. 1. An encoding device, comprising: a first prediction unit configured to determine a first prediction block of a current block in a current sequence based on an intra-template matching prediction mode (IntraTMP mode); a second prediction unit configured to determine a second prediction block of the current block based on a first prediction mode, wherein the first prediction mode and the IntraTMP mode are different; a determining unit configured to determine a target predicted block of the current block based on the first predicted block and the second predicted block; a residual unit configured to obtain a residual block of the current block based on the target prediction block and an original block of the current block; a coding unit configured to code a residual block of the current block; 1. An encoding device comprising:

63. An electronic device, a processor configured to execute a computer program; a computer-readable storage medium on which a computer program is stored; The computer program, when executed by the processor, realizes the decoding method according to any one of claims 1 to 30 or the encoding method according to any one of claims 31 to 60. An electronic device characterized by:

64. configured to store a computer program; The computer program causes a computer to execute the decoding method according to any one of claims 1 to 30 or the encoding method according to any one of claims 31 to 60. A computer-readable storage medium comprising:

65. Contains computer programs / instructions, The computer program / instructions, when executed by a computer, implement the decoding method according to any one of claims 1 to 30 or the encoding method according to any one of claims 31 to 60.

1. A computer program product comprising:

66. Generated by the decoding method according to any one of claims 1 to 30 or the encoding method according to any one of claims 31 to 60, A bitstream characterized in that