Decoding method, encoding method, decoder and encoder
The decoding method improves video compression efficiency by predicting matching blocks using IntraTMP mode and combining them with other modes, addressing prediction errors and enhancing performance in noisy or complex scenarios.
Patent Information
- Application Number
- JP2025539738
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-01-03
- Publication Date
- 2025-12-25
AI Technical Summary
Existing digital video compression standards face challenges in improving compression efficiency, particularly in decoding performance due to limitations in intra-template matching prediction (IntraTMP) modes, which can lead to prediction errors and reduced decoding performance, especially in scenarios with noise or complex changes.
A decoding method that predicts matching blocks using IntraTMP mode, allowing for the selection of a single or multiple matching blocks to determine a target predicted block, and combines these with other prediction modes to enhance prediction flexibility and accuracy.
Improves encoding and decoding performance by enhancing prediction flexibility and accuracy, reducing prediction errors, and maintaining low computational complexity, with minimal increases in decoding and encoding times.
Smart Images

Figure 2025542548000001_ABST
Abstract
Description
[Technical Field]
[0001] TECHNICAL FIELD Embodiments of the present invention relate to the field of encoding and decoding, and more particularly to a decoding method, an encoding method, a decoder and an encoder. [Background technology]
[0002] Digital video compression technology is primarily used to compress massive amounts of digital video data to facilitate transmission, storage, etc. With the rapid growth of Internet video and people's increasing demand for video resolution, although existing digital video compression standards can achieve video decompression technology, there is still a need for better digital video decompression technology to improve compression efficiency. Summary of the Invention [Problem to be solved by the invention]
[0003] SUMMARY OF THE INVENTION Embodiments of the present invention provide a decoding method, an encoding method, a decoder and an encoder that can improve decoding performance. [Means for solving the problem]
[0004] According to a first aspect, an embodiment of the present invention provides a decoding method, the method comprising: determining a residual block of a current block in a current sequence based on the bitstream; predicting at least one matching block of the current block based on an intra-template matching prediction (IntraTMP) mode; determining a target prediction block of the current block based on the at least one matching block; and obtaining a reconstructed block of the current block based on the residual block of the current block and the target predicted block.
[0005] According to a second aspect, an embodiment of the present invention provides an encoding method, the method comprising: predicting at least one matching block of a current block in a current sequence based on an intra-template matching prediction (IntraTMP) mode; determining a target prediction block for the current block based on the at least one matching block; Obtaining a residual block of the current block based on the target predicted block and the original block of the current block; and encoding a residual block of the current block.
[0006] According to a third aspect, embodiments of the present invention provide a decoder, the decoder comprising: a residual unit configured to determine a residual block of a current block in a current sequence based on the bitstream; a prediction unit configured to predict at least one matching block of the current block based on an intra-template matching prediction (IntraTMP) mode; a determining unit configured to determine a target prediction block of the current block based on the at least one matching block; and 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.
[0007] According to a fourth aspect, embodiments of the present invention provide an encoder, the encoder comprising: a prediction unit configured to predict at least one matching block of a current block in a current sequence based on an intra-template matching prediction (IntraTMP) mode; a determining unit configured to determine a target prediction block of the current block based on the at least one matching 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; and a coding unit configured to code a residual block of the current block.
[0008] In a fifth aspect, embodiments of the present invention provide a decoder, the decoder comprising: a processor adapted to implement computer instructions; and a computer-readable storage medium having computer instructions stored thereon, the computer instructions being configured to be loaded and executed by a processor to implement the decoding method of the first aspect or each embodiment thereof.
[0009] In one embodiment, the processor(s) are one or more and the memory(s) are one or more.
[0010] In one embodiment, the computer readable storage medium may be integral to the processor or the computer readable storage medium may be separate from the processor.
[0011] According to a sixth aspect, embodiments of the present invention provide an encoder, comprising: a processor adapted to implement computer instructions; and a computer-readable storage medium having stored thereon computer instructions configured to be loaded and executed by a processor to perform the encoding method of the second aspect or each embodiment thereof.
[0012] In one embodiment, the processor(s) are one or more and the memory(s) are one or more.
[0013] In one embodiment, the computer readable storage medium may be integral to the processor or the computer readable storage medium may be separate from the processor.
[0014] According to a seventh aspect, an embodiment of the present invention provides a computer-readable storage medium having stored thereon computer instructions which, when read and executed by a processor of a computing device, cause the computing device to perform the decoding method according to the first aspect above or the encoding method according to the second aspect above.
[0015] According to an eighth aspect, an embodiment of the present invention provides a computer program product or a computer program, the computer program product or the computer program comprising computer instructions stored on a computer-readable storage medium, the computer instructions being read by a processor of a computing device from the computer-readable storage medium and executed by the processor to cause the computing device to perform the decoding method according to the first aspect above or the encoding method according to the second aspect above.
[0016] According to a ninth aspect, an embodiment of the present invention provides a bitstream, the bitstream being a bitstream for 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]
[0017] Based on the above technical solutions, the decoder predicts at least one matching block of the current block based on the IntraTMP mode, and further determines a target predicted block of the current block based on the at least one matching block. That is, the decoder can determine the target predicted block based on a single matching block selected by the IntraTMP mode, or can determine the target predicted block based on multiple matching blocks selected by the IntraTMP mode. This not only improves the prediction flexibility of the current block, but also helps the decoder select an appropriate number of matching blocks for determining the target predicted block, thereby improving encoding and decoding performance. [Brief explanation of the drawings]
[0018] [Figure 1] FIG. 1 is a schematic block diagram of an encoding framework according to an embodiment of the present invention; [Figure 2] FIG. 1 is a schematic block diagram of a decoding framework according to an embodiment of the present invention; [Figure 3] 1 is a schematic diagram of an IntraTMP technique according to an embodiment of the present invention; [Figure 4] 10 is an example of template error values between a current block and a matching block according to an embodiment of the present invention. [Figure 5] 1 is an example of an IntraTMP adaptation technique for camera-captured content, according to an embodiment of the present invention. [Figure 6] 2 is a schematic diagram of a method for dividing a current block into regions according to an embodiment of the present invention; [Figure 7] 3 is a flowchart of a decoding method according to an embodiment of the present invention. [Figure 8] 1 is an example of a pruning refinement process according to an embodiment of the present invention. [Figure 9] 10 is another example of a pruning refinement process according to an embodiment of the present invention. [Figure 10] 10 is an example of determining a target prediction block based on multiple matching blocks according to an embodiment of the present invention; [Figure 11] 10 is an example of a template of a current block according to an embodiment of the present invention. [Figure 12] 2 is a flowchart of an encoding method according to an embodiment of the present invention. [Figure 13] FIG. 2 is a schematic block diagram of a decoder according to an embodiment of the present invention; [Figure 14] FIG. 1 is a schematic block diagram of an encoder according to an embodiment of the present invention. [Figure 15] 1 is a schematic block diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0019] Hereinafter, technical means in the embodiments of the present invention will be described with reference to the drawings.
[0020] The means provided by the embodiments of the present invention are applicable to the digital video coding technology field (e.g., including, but not limited to, image coding and decoding, video coding and decoding, hardware video coding and decoding, dedicated circuit video coding and decoding, and real-time video coding and decoding). Furthermore, the means provided by the embodiments of the present invention can be incorporated into the Audio Video Coding Standard (AVS), the second generation AVS standard (AVS2), or the third generation AVS standard (AVS3). For example, the means provided by the embodiments of the present invention include, but are not limited 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. Furthermore, the means provided by the embodiments of the present invention can be used to perform lossless or lossless compression on images. Here, the lossy compression may be visually lossless compression or mathematically lossless compression.
[0021] All video encoding 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. A coding unit may be further divided into prediction units (PUs), transform units (TUs), etc. The hybrid coding framework includes modules such as prediction, transform, quantization, entropy coding, and loop filter. The prediction module includes intra-prediction and inter-prediction. Inter-prediction involves motion estimation and motion compensation. The neighboring regions within a single image of a video are coded using a hybrid coding framework. sample Because of the strong correlation between adjacent sample Intra prediction removes spatial redundancy between the current block and the current image. sampleBecause there is a strong similarity between adjacent images in a video, video encoding and decoding technology uses inter-prediction methods to remove temporal redundancy between adjacent images, thereby improving coding efficiency. Inter-prediction can refer to image information from different frames and uses motion estimation to find the motion vector information that best matches the current segmented block. Through transformation, the predicted image block is converted to the frequency domain and the energy is redistributed. Combined with quantization, this is used to remove information that is difficult for the human eye to perceive and remove visual redundancy. Entropy coding can remove character redundancy based on the current context model and probability information of the binary bitstream.
[0022] In the digital video encoding process, the encoder first reads one black and white or color image from the original video sequence, and then performs encoding on the black and white or color image. Here, the black and white image is the luma component. sample The color image contains the chrominance components sample Optionally, the color image may further include a luma component sampleThe color format of the original video sequence may be a luma-chroma (YCbCr, YUV) format or a red-green-blue (RGB) format, etc. Specifically, an encoder reads a monochrome or color image, divides it into blocks, performs intra- or inter-prediction on the current block to generate a predicted block for the current block, subtracts the predicted block from the original block of the current block to obtain a residual block, transforms and quantizes the residual block to obtain a quantized coefficient matrix, and performs entropy coding on the quantized coefficient matrix to output a bitstream. In a digital video decoding process, a decoding end generates a predicted block for the current block using intra- or inter-prediction on the current block. Furthermore, the decoding end decodes the bitstream to obtain a quantized coefficient matrix, performs inverse quantization and inverse transform on 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 can be used to construct a reconstructed image, and the decoding end performs loop filtering on the reconstructed image on an image-by-image or block-by-block basis to obtain a decoded image.
[0023] The current block may be a current coding unit (CU) or a current prediction unit (PU), for example.
[0024] The encoding end must also perform the same operations as the decoding end to obtain a decoded image. The decoded image can be used as a reference image for subsequent image inter-prediction. Mode or parameter information such as block division information, prediction, transform, quantization, entropy coding, and loop filter determined by the encoding end is written into the bitstream as needed.
[0025] The decoding end determines the same block division information, mode information or parameter information such as prediction, transform, quantization, entropy coding, loop filter, etc. as the encoding end through analysis based on analysis and existing information, thereby ensuring that the decoded image obtained by the encoding end is the same as the decoded image obtained by the decoding end. The decoded image obtained by the encoding end is also commonly called a reconstructed image. During prediction, the current block can be divided into prediction units, and during transformation, the current block can be divided into transform units, and the division between the prediction units and the transform units may be the same or different. Of course, the above is only the basic process of a video encoding and decoding device in a block-based hybrid coding framework, and as technology develops, some modules of the framework or some steps of the process may be optimized. However, the present invention is applicable to the basic process of a video encoding and decoding device in the block-based hybrid coding framework.
[0026] To facilitate understanding, we first briefly describe the coding framework of the present invention.
[0027] FIG. 1 is a schematic block diagram of an encoding framework 100 according to an embodiment of the present invention.
[0028] 1, the encoding framework 100 may include an intra prediction unit 180, an inter prediction unit 170, a residual unit 110, a transform and quantization unit 120, an entropy coding unit 130, an inverse transform and inverse quantization unit 140, and a loop filter unit 150. Optionally, the encoding framework 100 may further include a decoded image buffer unit 160. The encoding framework 100 may also be referred to as a hybrid framework coding mode.
[0029] Here, the intra prediction unit 180 or the inter prediction unit 170 can predict a current image block and output a prediction block. The residual unit 110 can calculate a residual block, i.e., the difference between the prediction block and the current image block, based on the prediction block and the current image block. The transform and quantization unit 120 performs operations such as transform and quantization on the residual block to remove information that is difficult for the human eye to perceive, thereby removing visual redundancy. Alternatively, the residual block before being transformed and quantized by the transform and quantization unit 120 can 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 can be referred to as a frequency-domain residual block or a frequency-domain residual block. The entropy coding unit 130 can receive the transformed and quantized coefficients output from the transform and quantization unit 120 and output a bitstream based on the transformed and quantized coefficients. For example, the entropy coding unit 130 can remove character redundancy based on a target context model and probability information of the binary bitstream. For example, the entropy coding unit 130 may be applied to context-based adaptive binary arithmetic entropy coding (CABAC). The entropy coding unit 130 may also be called a header information coding unit. Optionally, in the present invention, the image block to be coded may also be called an original image block or a target image block, the prediction block may also be called a predicted image block or an image prediction block, and may further be called a prediction signal or prediction information. The reconstruction block may also be called a reconstructed image block or an image reconstruction block, and may further be called a reconstruction signal or reconstruction information. Furthermore, at the coding end, the image block to be coded may also be called a coding block or a coded image block, and at the decoding end, the image block to be coded may also be called a decoded block or a decoded image block. The image block to be coded may be a CTU or a CU.
[0030] The coding framework 100 calculates a residual for the predicted block and the image block to be coded to obtain a residual block, and transmits the residual block to a decoding end after processes such as transform and quantization. Correspondingly, the decoding end receives a bitstream, decodes the bitstream, and then obtains a residual block through steps such as inverse transform and inverse quantization. The decoding end then convolves the residual block with the predicted block obtained by prediction to obtain a reconstructed block.
[0031] The inverse transform and inverse quantization unit 140, loop filter unit 150, and decoded image buffer unit 160 in the encoding framework 100 can be used to form a decoder. That is, the intra prediction unit 180 or inter prediction unit 170 can predict the image block to be coded based on an existing reconstructed block, thereby ensuring that the coding end and the decoding end have the same understanding of the reference image. In other words, the encoder can replicate the decoder's processing loop and generate the same prediction as the decoding end. Specifically, the quantized transform coefficients are inversely transformed and inversely quantized by the inverse transform and inverse quantization unit 140 to replicate an approximate residual block at the decoding end. The approximate residual block is added to the prediction block and then passed through the loop filter unit 150 for smoothing to remove block effects, such as those caused by block-based processing and quantization. The image block output from the loop filter unit 150 is stored in the decoded image cache unit 160 and can be used to predict subsequent images.
[0032] It should be noted that FIG. 1 is merely an example of the present invention and should not be understood as limiting the present invention.
[0033] For example, the loop filter unit 150 in the coding framework 100 may include a deblocking filter (DBF) and a sample adaptive offset (SAO) filter. The role of the DBF is to remove block effects, and the role of the SAO is to remove ringing effects. In another embodiment of the present invention, the coding framework 100 may use a neural network-based loop filter algorithm, thereby improving video compression efficiency. In other words, the coding framework 100 may be a deep learning-based neural network video coding hybrid framework. In one embodiment, a convolutional neural network-based model is used based on the deblocking filter and the sample adaptive offset filter. sample The filtered results can be calculated. The network structures of the loop filter unit 150 for the luma component and the chroma component can be the same or different. Considering that the luma component contains more visual information, the luma component can also be used to guide the filtering of the chroma component, thereby improving the reconstruction quality of the chroma component.
[0034] Intra prediction and inter prediction will be described below.
[0035] Inter-prediction can refer to image information from different frames, and uses motion estimation to find the motion vector information that best matches the image block to be coded, thereby eliminating temporal redundancy. The frames used in inter-prediction can be P-frames and / or B-frames, where P-frames refer to forward-predicted frames and B-frames refer to bidirectionally predicted frames.
[0036] Intra prediction refers only to information from the same image, and sampleIntra prediction is used to predict information and remove spatial redundancy. The frame used in intra prediction may be an I frame. For example, according to the encoding order from left to right and top to bottom, the image block to be encoded 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 image block to be encoded is further used as reference information for the next image block, and in this way, the entire image can be predicted. When the input digital video is in a color format such as YUV4:2:0 format, four blocks of each image frame of the digital video are used as reference information for the next image block. sample is composed of four Y components and two UV components, and the coding framework can encode the Y component (i.e., luma block) and the UV component (i.e., chroma block) separately. Similarly, the decoding end can perform corresponding decoding depending on the format.
[0037] Regarding the intra prediction process, the intra prediction can predict the image block to be coded using an angular prediction mode and a non-angular prediction mode to obtain a predicted block, and select an optimal prediction mode for the image block to be coded based on rate-distortion information calculated based on the predicted block and the image block to be coded, and transmit the selected prediction mode to the decoding end via a bitstream. The decoding end can analyze the prediction mode and obtain a predicted block of the target decoding block through prediction, and then convolve the time-domain residual block transmitted via the bitstream to obtain a reconstructed block.
[0038] Throughout the evolution of digital video encoding and decoding standards, non-angular prediction modes have remained relatively stable, consisting of average and planar modes. However, the number of angular prediction modes has continuously increased with the evolution of digital video encoding and decoding standards. Taking the H series of international digital video coding standards as an example, the H.264 / AVC standard only has eight angular prediction modes and one non-angular prediction mode. H.265 / HEVC expands this to 33 angular prediction modes and two non-angular prediction modes. H.266 / VVC further expands intra-prediction modes, providing a total of 67 traditional prediction modes for luma blocks, as well as a non-traditional prediction mode called matrix-weighted intra-frame prediction (MIP). These 67 traditional prediction modes include planar mode, direct current (DC) mode, and 65 angular prediction modes. Here, planar mode is typically used to process blocks where gradients exist in the texture, DC mode, as the name suggests, is typically used to process flat areas, and angular prediction mode is typically used to process blocks where the angular texture is relatively clear.
[0039] In the present invention, the current block used for intra prediction may be a square block or a rectangular block.
[0040] Furthermore, since all intra-prediction blocks are square, the probability of using each angular prediction mode is equal. If the width and height of the current block are not equal, for horizontal class blocks (width > height), the upper reference sample The probability of using the left reference sample The probability of using the vertical class block (height > width) is higher than the probability of using the upper reference. sample The probability of using the left reference sampleThe probability of using the wide angle prediction mode is lower than the probability of using the traditional angle prediction mode. When predicting a rectangular block, the traditional angle prediction mode is converted to a wide angle prediction mode, and when predicting a rectangular block using the wide angle prediction mode, the prediction angle range of the current block is larger than the prediction angle range when predicting a rectangular block using the traditional angle prediction mode. Alternatively, when using the wide angle prediction mode, a signal can still be transmitted using the index of the traditional angle prediction mode, and the decoding end can correspondingly convert the traditional angle prediction mode back to the wide angle prediction mode after receiving the signal. This allows the total number of intra prediction modes and the encoding method of the intra prediction mode to remain unchanged.
[0041] Furthermore, the intra prediction mode to be performed may 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 dimensions), intra prediction on the current block may be performed using the wide-angle prediction mode. Here, the aspect ratio of the current block may be used to determine the angular prediction mode to be substituted for the wide-angle prediction mode and the substituted angular prediction mode. For example, when predicting the current block, any intra prediction mode having an angle that does not exceed the diagonal of the current block (from the bottom left to the top right of the current block) may be selected as the substituted angular prediction mode.
[0042] FIG. 2 is a schematic block diagram of a decoding framework 200 according to an embodiment of the present invention.
[0043] 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, a loop filter unit 260, and a decoded image cache unit 270. The entropy decoding unit 210 receives and analyzes a bitstream to obtain a prediction block and a frequency-domain residual block, and the frequency-domain residual block may be subjected to inverse transform and inverse quantization by the inverse transform and inverse quantization unit 220 to obtain a time-domain residual block. The residual unit 230 may convolve the prediction block obtained by prediction by the intra prediction unit 240 or the inter prediction unit 250 with the time-domain residual block that has been inverse transformed and inverse quantized by the inverse transform and inverse quantization unit 220 to obtain a reconstructed block.
[0044] It should be noted that the decoding method and encoding method according to the embodiment of the present invention affect the intra prediction part in the video coding hybrid framework, and are specifically applied to the IntraTMP part of intra prediction. The decoding method according to the embodiment of the present invention affects the intra prediction part at the decoding end, and the encoding method according to the embodiment of the present invention affects the intra prediction part at the encoding end.
[0045] In order to facilitate understanding of the technical solution of the present invention, the following related content will be described.
[0046] (1) Intra Template Matching Prediction (IntraTMP) mode.
[0047] figure 3 is a schematic diagram of the IntraTMP mode according to an embodiment of the present invention.
[0048] As shown in Figure 3, the IntraTMP mode is mainly realized by the following process.
[0049] The encoder (or decoder) reconstructs the L-shaped part adjacent to the currently coded block. sample is selected as a template, the most similar template is searched for in the reconstruction region of the given current frame, and the reconstruction block corresponding to the most similar template is used as the matching block, and the predicted block of the current coding block is calculated. To determine For example, R1 to R4 in the figure are available search areas in the IntraTMP mode. For example, matching blocks can be searched for sequentially in R1 to R4 in raster scan order. In some embodiments, the matching block is also referred to as the reference block.
[0050] FIG. 4 shows an example of template error values between a current block and a matching block according to an embodiment of the present invention.
[0051] As shown in Figure 4, the template for the current block is the L columns to the left of the current block. sample , upper M columns sample , and the top left M row L column sample where M and L are both positive integers, for example, 4. A matching block of a current block can be represented by a block vector pointing from the current block to the matching block, and the similarity between the template of the current block and the template of the matching block is represented by the magnitude of the template error value, with a smaller template error value indicating a higher similarity. For example, the template error value can be calculated using the sum of absolute differences (SAD), with a smaller SAD indicating a higher template similarity.
[0052] The encoder indicates whether the current coding block uses IntraTMP mode by using a flag bit cu_tmp_flag. If it does, it performs the same template matching process at the decoding end to obtain the same prediction block at the decoding end. For IntraTMP mode, there is no need to additionally code block vector information in the bitstream.
[0053] (2) IntraTMP adaptation for camera-captured content technology.
[0054] FIG. 5 is an example of an IntraTMP adaptation technique for camera-captured content according to an embodiment of the present invention.
[0055] As shown in FIG. 5(a), the IntraTMP adaptation technique for camera-captured content proposes template matching based on the original IntraTMP mode with a step size of S (i.e., S points in both the horizontal and vertical directions, where S>1). For example, instead of searching for a matching block point by point in a raster scan in the search area, the search area is searched for S points in both the horizontal and vertical directions. For example, if the block vector for the current template matching is (X0, Y0), the block vector for the next template matching in the horizontal direction is (X0-S, Y0), and the ordinate of the block vector for the next template matching in the vertical direction is Y0-S. After template matching is completed, the best matching block within a predetermined range is refined (i.e., template matching is performed with a smaller step size S') as shown in FIG. 5(b). For example, the matching block vector is refined using a template matching method with a smaller step size to optimize the matching result. This technique can effectively reduce the complexity of the IntraTMP mode while maintaining good coding efficiency.
[0056] (3) Template-Based Intra Mode Derivation (TIMD) technology.
[0057] TIMD technology reconstructs the L-shaped part adjacent to the current coding block. sampleAs a template, the encoding end traverses the Most Probable Mode (MPM) list to predict the template region using different intra-prediction modes. sample By calculating the predictions for different intra prediction modes, sample and reconstruction sample The template error value can be obtained by using the same derivation method. For example, the template error value can be expressed as 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. The decoding end obtains the intra prediction mode using the same derivation method, thereby reducing the number of coded bits for the mode information.
[0058] (4) Combined Inter and Intra Prediction (CIIP) mode.
[0059] The CIIP mode combines intra prediction and inter prediction, and obtains the predicted block of the currently coded block using a weighted combination of the intra prediction block and the inter prediction block. The CIIP mode in the Enhanced Compression Model (ECM) reference software test platform is combined with template-based prediction technology, and the design of the same time, different regions, and different weight values further improves the prediction accuracy. Specifically, the intra prediction block pred_intra is obtained by the TIMD mode, and the inter prediction block pred_inter is obtained by the template-based merge mode. The coding end determines the derived intra prediction mode and the prediction target. sample The weight values wIntra and wInter are determined based on the position of the final predicted block Pred. Pred = (wIntra * pred_intra + wInter * pred_inter + 4) >> 3 It is calculated as follows:
[0060] 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.
[0061] wIntra and wInter can be determined based on the intra prediction mode intra_dir obtained by TIMD derivation. 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.
[0062] [Table 1]
[0063] 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, when region identifier is 3, wIntra is 2 and wInter is 6.
[0064] FIG. 6 is a schematic diagram of a method for dividing a current block into regions according to an embodiment of the present invention.
[0065] As shown in (a) of Figure 6, when the current coding block is vertically divided into four equal parts, the region indices from left to right are 0, 1, 2, and 3. As shown in (b) of Figure 6, when the current coding block is horizontally divided into four equal parts, the region indices from top to bottom are 0, 1, 2, and 3.
[0066] Note that when intra_dir is 0 or 1, wIntra and wInter can be determined in other ways. For example, when intra_dir is 0 or 1, the sub-region is not divided, and wIntra and wInter can be selected from (3,1), (2,2), or (1,3) based on the coding types (intra or inter) of the two coding blocks 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) to be (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) to be (2,2); and if the coding types of these two coding blocks are both inter-coding, the coding end determines (wIntra, wInter) to be (3,1).
[0067] (5) Intra Block Copy (IBC) technology.
[0068] IBC technology is based on block matching. sample Similar to inter prediction, prediction is achieved using a block vector that points from the current block to a reference block. However, the difference is that the reference block for inter prediction is obtained from an already coded reconstructed frame, whereas the reference block for IBC is obtained from the reconstructed part of the current frame. Since block vector information needs to be transmitted via the bitstream, IBC-AMVP mode and IBC-Merge mode exist, similar to inter prediction.
[0069] In the IBC-AMVP mode, a predicted block vector is obtained through a constructed candidate block vector list, and a reference block of the current block and a corresponding final block vector are obtained through processes such as hash search and full search. The final block vector is coded based on the predicted block vector, improving coding efficiency.
[0070] The IBC-Merge mode performs prediction through a constructed candidate block vector list, selects the best block vector in the list as the final block vector through an encoding process such as SATD or RDO, and selects the reconstructed block it points to as the reference block to complete the prediction. By encoding the index of the block vector in the list rather than the block vector itself, encoding efficiency is improved.
[0071] The candidate block vector list can be composed of coding information such as block vectors of adjacent coding blocks, past block vectors, and average block vectors.
[0072] Since both the IBC technology and the IntraTMP mode are prediction technologies based on block vectors, the improved technical means for the IntraTMP mode according to the present invention can also be applied to the IBC technology to some extent, and the corresponding extension schemes also fall within the scope of protection of the present invention, but the present invention is not specifically limited thereto.
[0073] As can be seen from the above description of IntraTMP mode, IntraTMP mode selects the best matching block through a template as the predicted block. However, due to the noise generated during the lossy compression process and the limited correlation between the template and the corresponding block, this method may cause some prediction errors and may not be able to obtain an accurate predicted block, which may result in reduced decoding performance. Furthermore, since IntraTMP mode uses a block compensation method for prediction, it is difficult to predict repetitive sequences such as screen content sequences. sample In a scenario where there are many blocks, the decoder can guarantee the decoding performance even if the decoder selects the best matching block as the prediction block through the template based on the IntraTMP mode. However, in a scenario where there are many noise signals, such as natural content sequences, sample In a scenario where the changes are more complex, if the decoder still selects the best matching block through a template based on the IntraTMP mode as a predicted block, and the difference between the current block and the best matching block selected through the template based on the IntraTMP mode is relatively large, the IntraTMP mode may degrade the decoding performance of the decoder. In view of this, embodiments of the present invention provide a decoding method, an encoding method, a decoder, and an encoder, which can improve encoding and decoding performance.
[0074] FIG. 7 is a flowchart of a decoding method 300 according to an embodiment of the present invention.
[0075] It should be noted that the decoding method 300 can be implemented by a decoder or a decoding framework, for example, it can be applied to the decoding framework shown in Fig. 2. For convenience of explanation, the decoding method 300 will be exemplarily described below using a decoder as an example.
[0076] As shown in FIG. 7, the decoding method 300 may include:
[0077] In S310, the decoder determines a residual block of the current block in the current sequence based on the bitstream.
[0078] Illustratively, a decoder determines the residual block of the current block by decoding the bitstream, and the bitstream that the decoder decodes is the bitstream of the current sequence.
[0079] At S320, the decoder predicts at least one matching block of the current block based on an intra template matching prediction (IntraTMP) mode.
[0080] Illustratively, the at least one matching block may be a single matching block.
[0081] Illustratively, the at least one matching block may be a plurality of matching blocks.
[0082] At S330, the decoder determines a target prediction block for the current block based on the at least one matching block.
[0083] Illustratively, if the at least one matching block is a single matching block, the decoder may determine the single matching block as the target prediction block.
[0084] Illustratively, if the at least one matching block is a plurality of matching blocks, the decoder may fuse the plurality of matching blocks to obtain the target prediction block.
[0085] Of course, in other alternative embodiments, the decoder may combine the at least one matching block with a prediction block obtained by another prediction mode to obtain the target prediction block, but the embodiments of the present invention are not specifically limited thereto. For example, the other prediction mode may be an intra prediction mode or an inter prediction mode.
[0086] At S340, the decoder obtains a reconstructed block of the current block based on the residual block of the current block and the target predicted block.
[0087] Illustratively, the decoder may determine the sum of the residual block of the current block and the target predicted block as the reconstructed block of the current block.
[0088] In this embodiment, the decoder predicts at least one matching block of the current block based on the IntraTMP mode, and further determines a target predicted block of the current block based on the at least one matching block. That is, the decoder may determine the target predicted block based on a single matching block selected by the IntraTMP mode, or may determine the target predicted block based on multiple matching blocks selected by the IntraTMP mode. This not only improves the prediction flexibility of the current block, but also benefits the decoder in selecting an appropriate number of matching blocks to determine the target predicted block, thereby improving encoding and decoding performance.
[0089] Below, with reference to Table 2, we will explain the results obtained when the means according to the present invention was tested on the test sequence required by JVET under all intra conditions in ECM6.0, which integrates IntraTMP adaptation technology for camera-captured content. Here, end-to-end attribute rate distortion (end-to-end BD-rate) is an index representing algorithm performance or encoding performance, and represents the change in bit rate and PSNR of the encoding algorithm according to the present invention compared to the original encoding algorithm, with an overall negative value indicating improved performance. Y, U, and V represent the components of the current block.
[0090] [Table 2]
[0091] As shown in Table 2, the test results show that the method according to the present invention improves performance for all sequence categories, with the average change in BD-rate for the Y, U, and V components being -0.14%, -0.13%, and -0.16%, respectively. This indicates that the present technology improves coding performance with relatively low complexity. Furthermore, the decoding method according to this embodiment increases the decoding time by only 3%, and the corresponding encoding method increases the coding time by only 1%.
[0092] In some embodiments, S320 may include the decoder determining a first identifier based on the bitstream, and if the first identifier indicates that fusion prediction is to be performed using the IntraTMP mode, the decoder predicting the at least one matching block based on the IntraTMP mode.
[0093] For example, the decoder decodes the bitstream to obtain the first identifier, and if the first identifier indicates that fusion prediction is to be performed using the IntraTMP mode, the decoder predicts the at least one matching block based on the IntraTMP mode. Otherwise, the decoder obtains the target prediction block using another prediction mode.
[0094] Exemplarily, if at least one matching block is a single matching block, the first identifier indicates that fusion prediction is performed using the IntraTMP mode and another prediction mode. That is, the first identifier indicates that fusion prediction is performed using the single matching block obtained based on the IntraTMP mode and a prediction block obtained based on another prediction mode. In other words, the target prediction block is a prediction block obtained by fusing the single matching block obtained based on the IntraTMP mode and a prediction block obtained based on another prediction mode.
[0095] For example, if the at least one matching block is a plurality of matching blocks, the first identifier indicates that fusion prediction is performed using the plurality of matching blocks obtained based on the IntraTMP mode, that is, the target prediction block is a prediction block obtained by fusing the plurality of matching blocks obtained based on the IntraTMP mode.
[0096] Exemplarily, when the at least one matching block is a plurality of matching blocks, the first identifier indicates that fusion prediction is performed using the IntraTMP mode and another prediction mode. That is, the first identifier indicates that fusion prediction is performed using the plurality of matching blocks obtained based on the IntraTMP mode and a prediction block obtained based on another prediction mode. In other words, the target prediction block is a prediction block obtained by fusing the plurality of matching blocks obtained based on the IntraTMP mode and a prediction block obtained based on another prediction mode.
[0097] In addition, the other prediction modes used to perform fusion prediction with the IntraTMP mode may be any prediction mode, for example, an intra prediction mode or an inter prediction mode, or for example, an angular prediction mode or a non-angular prediction mode.
[0098] Illustratively, the first identifier may be a sequence-level identifier, an image-level (i.e., frame-level) identifier, a slice-level identifier, or even an image block-level identifier.
[0099] Exemplarily, the first identifier indicates that fusion prediction is to be performed using the IntraTMP mode when the value is 0, and indicates that fusion prediction is not to be performed using the IntraTMP mode when the value is 1. Alternatively, the first identifier indicates that fusion prediction is to be performed using the IntraTMP mode when the value is 1, and indicates that fusion prediction is not to be performed using 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.
[0100] Of course, the first identifier can also achieve the corresponding indicating function in other ways, and the present invention is not limited thereto.
[0101] For example, if the first identifier has a value of "true", it indicates that fusion prediction is to be performed using the IntraTMP mode, and if the value is "false", it indicates that fusion prediction is not to be performed using the IntraTMP mode.
[0102] For example, if the first identifier indicates that fusion prediction is not performed using the IntraTMP mode, the decoder can determine the prediction mode of the current block by subsequently decoding the bitstream. In other words, if the first identifier indicates that fusion prediction is not performed using the IntraTMP mode, the decoder does not need to predict the at least one matching block based on the IntraTMP mode, and does not need to determine the target prediction block based on the at least one matching block.
[0103] In some embodiments, the decoder determines a second identifier based on the bitstream, and if the second identifier indicates that prediction is to be made using the IntraTMP mode, determines the first identifier based on the bitstream.
[0104] For example, the decoder decodes the bitstream to obtain the second identifier, and if the second identifier indicates that prediction is to be performed using the IntraTMP mode, the decoder decodes the bitstream to obtain the first identifier. Otherwise, the decoder obtains the target prediction block using another prediction mode.
[0105] Illustratively, the second identifier may be a sequence-level identifier, an image-level (i.e., frame-level) identifier, a slice-level identifier, or even an image-block-level identifier.
[0106] Exemplarily, the second identifier indicates that prediction is to be performed using the IntraTMP mode when the value is 0, and indicates that prediction is not to be performed using the IntraTMP mode when the value is 1. Alternatively, the second identifier indicates that prediction is to be performed using the IntraTMP mode when the value is 1, and indicates that prediction is not to be performed using 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.
[0107] Of course, the second identifier can also achieve the corresponding indicating function in other ways, and the present invention is not limited thereto.
[0108] For example, the second identifier indicates that predictions are to be made using the IntraTMP mode if the value is "true," and indicates that predictions are not to be made using the IntraTMP mode if the value is "false."
[0109] For example, if the second identifier indicates that prediction is not performed using the IntraTMP mode, the decoder can determine the prediction mode of the current block by subsequently decoding the bitstream. In other words, if the second identifier indicates that fusion prediction is not performed using the IntraTMP mode, the decoder does not need to predict the at least one matching block based on the IntraTMP mode, and does not need to determine the target prediction block based on the at least one matching block.
[0110] For example, if the second identifier indicates that prediction is performed using the IntraTMP mode and the first identifier indicates that fusion prediction is not performed using the IntraTMP mode, the decoder predicts one best matching block based on the IntraTMP mode, and then determines the target prediction block based on the best matching block. For example, the decoder can directly determine the best matching block as the target prediction block.
[0111] For example, when a decoder reads a bitstream, the syntax elements for performing fusion prediction using the IntraTMP can be implemented as shown in Table 3.
[0112] [Table 3]
[0113] Here, the explanation of each element in Table 3 is as follows:
[0114] coding_unit: The syntax element associated with the coding block.
[0115] sps_tmp_enabled_flag: An SPS flag bit that indicates whether the video sequence can perform prediction using IntraTMP mode. If it is equal to 1, the current video sequence can perform prediction using IntraTMP mode. If it is equal to 0, the current video sequence cannot perform prediction using IntraTMP mode. The value of the SPS flag bit can be set by the user.
[0116] MaxTmpSize: An SPS parameter that indicates the size limit of a block that can be predicted in IntraTMP mode. If a block's width or height is larger than MaxTmpSize, it cannot be predicted using IntraTMP mode. The SPS parameter can be set by the user.
[0117] intra_tmp_flag (i.e., the second identifier described above): a block flag bit that indicates whether the current block uses IntraTMP mode for prediction. If the value of intra_tmp_flag is equal to 1, it is considered that the current block uses IntraTMP mode for prediction, i.e., the decoder needs to decode the flag bit intra_tmp_fusion_flag. If the value of intra_tmp_flag is equal to 0, it is considered that the current block does not use IntraTMP mode for prediction, i.e., the decoder does not need to decode the flag bit intra_tmp_fusion_flag.
[0118] intra_tmp_fusion_flag (i.e., the first identifier described above): A block flag bit that indicates whether the current block uses IntraTMP for fusion prediction. If the value of intra_tmp_fusion_flag is equal to 1, the current block is considered to use IntraTMP for fusion prediction, and if the value of intra_tmp_fusion_flag is equal to 0, the current block is considered to use IntraTMP for prediction of a single matching block.
[0119] For example, the decoder decodes the input bitstream, and the decoding process is performed according to the CTU order, and divides the CTUs into different blocks according to the block division flags obtained by decoding and decodes them. If the flag bit sps_tmp_enabled_flag in the SPS is equal to 1 and the size of the current block satisfies the limit MaxTmpSize on the IntraTMP coding block size in the SPS, the decoder can determine intra_tmp_flag by decoding the bitstream. If intra_tmp_flag is equal to 1, it is considered that the current block performs prediction using the IntraTMP mode, in which case the decoder can determine intra_tmp_fusion_flag by further decoding the bitstream. If intra_tmp_flag is equal to 0, it is considered that the current block does not perform prediction using the IntraTMP mode, in which case the decoder does not need to determine intra_tmp_fusion_flag by decoding the bitstream.
[0120] In some embodiments, the decoder may determine the first identifier by the following method, which includes determining a target context index, and determining the first identifier based on the bitstream using the target context index.
[0121] Illustratively, the target context index is used to uniquely identify a context or context model, so that after a decoder determines the target context index, it can decode the bitstream using the context or context model indicated by the target context index to obtain the first identifier.
[0122] Of course, in other alternative embodiments, the decoder may also determine the context index used by the second identifier in a manner that may be the same as or different from the manner for determining the context index used by the first identifier, and the present invention is not specifically limited in this regard.
[0123] In some embodiments, the decoder determines the target context index based on decoded information of neighboring decoded blocks of the current block, and / or the decoder determines the target context index based on the size of the current block.
[0124] For example, the decoding information of the adjacent decoding block may include, but is not limited to, information such as the prediction mode used by the adjacent decoding block, a context index used when decoding the block level identifier of the adjacent decoding block, a template of the adjacent decoding block, the position of the adjacent decoding block, and the decoding value of the adjacent decoding block.
[0125] For example, the size of the current block may be a height of the current block, a width of the current block, a width of the current block, a height ... sample This includes, but is not limited to, information such as the number of
[0126] Exemplarily, the decoder decodes the first identifier using a target context index CtxIdxInc, where the target context index CtxIdxInc may be determined based on information such as decoding information of adjacent decoding blocks, the size of the current block, etc. For example, the target context index determined by the decoder based on the decoding information of the adjacent decoding blocks has Q possible values, where Q is, for example, 3 or another numerical value.
[0127] In some embodiments, the coordinates of the current block are (x, y), and the adjacent decoding blocks include a first decoding block with coordinates (x-1, y) and a second decoding block with coordinates (x, y-1). The decoding information of the first decoding block is Ku The decoding information of the second decoded block includes the prediction mode to be used. Ku At this time, the decoder can determine the target context index by the following method, which includes: Ku If the prediction mode to be used is a mode in which fusion prediction is performed based on the IntraTMP mode, A is substituted into the first numerical value, otherwise, B is substituted into the first numerical value, where A and B are both integers; Ku If the prediction mode to be used is a prediction mode that performs fusion prediction based on the IntraTMP mode, assigning C to the second numerical value, and otherwise assigning D to the second numerical value, where C and D are both integers, and determining the sum of the first numerical value and the second numerical value as the target context index.
[0128] Here, for example, A=1, B=0, C=1, and D=0. That is, assume that 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_fusion_flag of cuLeft is 1, CtxIdxInc is 1, otherwise it is 0. Then, if a decoded block cuAbove exists at the coordinate (x, y-1) and the intra_tmp_fusion_flag of cuAbove is 1, 1 is added to CtxIdxInc, otherwise it is 0.
[0129] Of course, in other alternative embodiments, A, B, C, and D may be other values, and the present invention is not specifically limited in this regard.
[0130] In some embodiments, when predicting at least one matching block of the current block based on the IntraTMP mode, the decoder first performs template matching on the current block based on the IntraTMP mode to obtain X candidate matching blocks, and then determines the at least one matching block based on the X candidate matching blocks.
[0131] Illustratively, the value of X is equal to or greater than the number of the at least one matching block.
[0132] Exemplarily, the X candidate matching blocks are matching blocks obtained by the decoder performing template matching on the current block based on the IntraTMP mode, and the at least one matching block is a matching block used by the decoder for fusion, where the at least one matching block may be a candidate matching block selected by the decoder from among the X candidate matching blocks.
[0133] In some embodiments, the decoder first performs intra-template matching within the search area of the current block according to the IntraTMP mode to obtain all candidate matching blocks for the current block, and then determines the X candidate matching blocks as the X matching blocks sorted in ascending order of template error value.
[0134] For example, the decoder may select, as candidate matching blocks for the current block, reconstructed blocks whose templates match the template of the current block at different positions within the search area of the current block through intra-template matching. For example, the decoder may select, as candidate matching blocks for the current block, reconstructed blocks whose templates are 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 decoder sorts all candidate matching blocks for the current block in ascending order of template error value, and determines the candidate matching blocks located in the front X positions as the X candidate matching blocks.
[0135] Of course, in another alternative embodiment, after completing the template matching process, the decoder can also sort all the candidate matching blocks of the current block in descending order of template error value, in which case the decoder can determine the last X candidate matching blocks as the X candidate matching blocks.
[0136] In some embodiments, the decoder builds a candidate matching block list based on the IntraTMP mode, which is used to store the X candidate matching blocks with the smallest template error values that matched during intra-template matching within the search area of the current block.
[0137] For example, the decoder can select reconstructed blocks at different positions within the search area of the current block, whose templates match the template of the current block, as candidate matching blocks for the current block through intra-template matching. For example, the decoder can select reconstructed blocks at different positions within the search area of the current block, whose templates are the same as the template of the current block, as candidate matching blocks for the current block. In the template matching process, the decoder maintains a candidate matching block list and updates the candidate matching blocks stored in the candidate matching block list using the template error value of the current matching block to ensure that the candidate matching blocks stored in the candidate matching block list are the X candidate matching blocks with the smallest template error values. For example, if the number of candidate matching blocks in the candidate matching block list is less than X, the current candidate matching block is added to the candidate matching block list. If the number of candidate matching blocks in the candidate matching block list is equal to X, the decoder determines whether to update the candidate matching block list based on the template error value of the current candidate matching block. For example, if the template error value of the current candidate matching block is smaller than the maximum template error value of the candidate matching blocks in the candidate matching block list, the current candidate matching block is used to replace the candidate matching block corresponding to the maximum template error value. If the template error value of the current candidate matching block is equal to or greater than the maximum template error value of the candidate matching blocks in the candidate matching block list, the candidate matching block list is not changed. This ensures that the candidate matching blocks stored in the candidate matching block list are the X matching blocks with the smallest template error values.
[0138] Illustratively, the candidate matching block list may also be referred to as a candidate block vector list.
[0139] For example, a decoder can select reconstructed blocks that match the template of a current block at different positions within the search area of the current block through intra-template matching as candidate matching blocks for the current block. The candidate matching blocks for the current block can be represented by block vectors that point from the current block to the candidate matching blocks. That is, the decoder builds a candidate block vector list to record block vectors with smaller template error values in the template matching process, thereby obtaining X candidate matching blocks. Specifically, the decoder calculates the template error values (represented by the SAD between templates) of different block vectors within the search area of the current block with a step size of S (i.e., for every S points in the horizontal and vertical directions). For example, if the block vector currently being matched is (x0, y0), the block vector to be next matched in the horizontal direction is (x0-S, y0), and the ordinate of the block vector to be next matched in the vertical direction is y0-S. A candidate block vector list of size X is built, where X can be determined by the number N of available matching blocks available for merging. For example, X is equal to 3*N. The candidate block vector list always stores the 3*N block vectors with the smallest template error value in the template matching process. The block vectors in the candidate block vector list are sorted according to the magnitude of their template error values. In addition, the candidate block vector list is also used to store the template error value corresponding to each block vector in the candidate block vector list.
[0140] In some embodiments, the decoder divides the search area of the current block into Y sub-regions, and performs intra-template matching within each of the Y sub-regions based on the IntraTMP mode to obtain a candidate matching block within each of the Y sub-regions, where the X candidate matching blocks include the candidate matching blocks within each of the sub-regions.
[0141] Exemplarily, the Y sub-regions may be R1 to R4 shown in Figure 3, or may be regions different from R1 to R4. For example, the Y sub-regions may be more or less than four regions.
[0142] In some embodiments, X=Y, or X is a multiple of Y.
[0143] For example, X=Y indicates that the X candidate matching blocks include the best candidate matching block in each sub-region. For example, the best candidate matching block in the current sub-region is the candidate matching block with the smallest template error value among all candidate matching blocks in the current sub-region.
[0144] For example, X being a multiple of Y indicates that the X candidate matching blocks include multiple candidate matching blocks in each sub-region, such as multiple candidate matching blocks in the current sub-region that have the smallest template error value among all candidate matching blocks in the current sub-region.
[0145] In some embodiments, when determining the at least one matching block based on the X candidate matching blocks, the decoder may first determine N available matching blocks based on the X candidate matching blocks, where X≧N, and then determine the at least one matching block based on the N available matching blocks.
[0146] For example, the N available matching blocks refer to matching blocks that the decoder can use to perform fusion, and the at least one matching block refers to a matching block that the decoder uses to perform fusion. The at least one matching block may be an available matching block selected by the decoder from among the N available matching blocks. The N available matching blocks may be candidate matching blocks selected by the decoder from among the X candidate matching blocks.
[0147] In some embodiments, X is a multiple of N.
[0148] Illustratively, X may be three or some other multiple of N.
[0149] Of course, in other alternative embodiments, X may not be a multiple of N, and it is sufficient that X is equal to or greater than N, and the present invention is not specifically limited in this regard.
[0150] In some embodiments, the decoder prunes the X candidate matching blocks to obtain the N available matching blocks based on the spacing between the X candidate matching blocks.
[0151] For example, when the decoder prunes the X candidate matching blocks based on the spacing between the X candidate matching blocks, it discards, among the X candidate matching blocks, candidate matching blocks that are too close to the current candidate matching block by traversing the X candidate matching blocks, thereby realizing pruning of the X candidate matching blocks.
[0152] In some embodiments, the decoder may prune the X candidate matching blocks to obtain the N available matching blocks based on the spacing between the X candidate matching blocks by the following method: determining a current candidate matching block to be used for pruning among the X candidate matching blocks according to the ascending order of template error values; determining a pruning range for the current candidate matching block; and Within the pruning range, other candidate matching blocks except the current candidate matching block are removed to obtain candidate matching blocks remaining after pruning the current candidate matching block, until the number of pruning of the X candidate matching blocks reaches N, and the N candidate matching blocks preceding the remaining candidate matching block are determined as the N available matching blocks, or until the number of candidate matching blocks remaining after pruning the current candidate matching block is N or less, and the N candidate matching blocks preceding the remaining candidate matching block are determined as the N available matching blocks.
[0153] For example, the decoder can determine the current candidate matching block to be used for pruning the candidate matching blocks by traversing the X candidate matching blocks in ascending order of template error value of each candidate matching block among the X candidate matching blocks, and then discarding candidate matching blocks whose distance from the current candidate matching block is equal to or smaller than the pruning range to obtain the N available matching blocks.
[0154] For example, when the decoder traverses the X candidate matching blocks in ascending order of template error value and determines the i-th candidate matching block as the current candidate matching block used for pruning the candidate matching blocks, it determines a pruning range for the i-th candidate matching block. Then, it removes other candidate matching blocks within the pruning range of the i-th candidate matching block, except for the current candidate matching block, to obtain the candidate matching block remaining after pruning the i-th candidate matching block. If the pruning count is less than N and the number of candidate matching blocks remaining after pruning the i-th candidate matching block is greater than N, it determines the i+1-th candidate matching block as the current candidate matching block used for pruning, and continues pruning the remaining candidate matching blocks. If the pruning count is equal to N, it determines the N candidate matching blocks before the remaining candidate matching block as the N available matching blocks. If the number of candidate matching blocks remaining after pruning the i-th candidate matching blocks is less than or equal to N, the first N candidate matching blocks among the candidate matching blocks remaining after pruning the i-1-th candidate matching blocks are determined as the N available matching blocks.
[0155] In some embodiments, the decoder may determine the pruning range based on the size of the current block and the current candidate matching block.
[0156] For example, the decoder may determine the size of the pruning range based on the size of the current block and the matching step width of the current candidate matching block, with the block vector of the current candidate matching block as the center of the pruning range.
[0157] In some embodiments, the decoder determines the pruning range as (S / E)*H, centered on a block vector pointing from the current block to the current candidate matching block, where / is the division operator, * is the multiplication operator, S is the matching step width adopted by the X candidate matching blocks, H is the height of the current block, and E is a positive integer.
[0158] For example, the decoder may determine the pruning range as a rectangle with a side length of (S / E)*H and centered on a block vector pointing from the current block to the current candidate matching block, or as a circle with a radius of (S / E)*H and centered on a block vector pointing from the current block to the current candidate matching block.
[0159] Of course, in other alternative embodiments, the pruning range may have other shapes or sizes, and the present invention is not specifically limited in this regard.
[0160] In some embodiments, the decoder may determine the pruning range based on a predefined numerical value.
[0161] Illustratively, the predefined value may include the size of the pruning range.
[0162] For example, the decoder may determine the pruning range as a rectangle whose side length is the predetermined value and whose center is a block vector pointing from the current block to the current candidate matching block, or as a circle whose radius is the predetermined value and whose center is a block vector pointing from the current block to the current candidate matching block.
[0163] Of course, in other alternative embodiments, the pruning range may have other shapes or sizes, and the present invention is not specifically limited in this regard.
[0164] Exemplarily, the predefined value may be a default value. For example, the predefined value may be implemented by pre-storing a usable method for indicating the corresponding code, table, or other related information in a device (e.g., including a decoder), and the present invention is not limited to a specific implementation method. For example, "pre-defined" may refer to a protocol. In addition, in embodiments of the present invention, "protocol" may refer to a standard protocol in the coding / decoding field, and may include, for example, protocols in the image coding / decoding field, video coding / decoding field, hardware video coding / decoding field, dedicated circuit video coding / decoding field, and real-time video coding / decoding field, as well as related protocols applied to future coding / decoding systems, and the present invention is not limited thereto.
[0165] In some embodiments, the decoder may refine the X candidate matching blocks to obtain the N available matching blocks.
[0166] For example, when refining the X candidate matching blocks, the decoder refines the candidate matching blocks among the X candidate matching blocks by traversing the X candidate matching blocks using a step width smaller than the matching step width adopted by the X candidate matching blocks, thereby determining the refined N candidate matching blocks as the N available matching blocks.
[0167] In some embodiments, the decoder refines the X candidate matching blocks to obtain the N available matching blocks by the following method: determining a refinement range for a current candidate reference block among the X candidate reference blocks; performing intra-template matching within the refinement range based on at least one matching step width to determine a reference block within the refinement range; and determining the N available reference blocks based on reference blocks within the refinement range. For example, in one specific embodiment, refining the X candidate matching blocks to obtain the N available matching blocks may include: determining a refinement range for a current candidate matching block among the X candidate matching blocks; performing intra-template matching within the refinement range based on at least one matching step width to obtain matching blocks that match within the refinement range, wherein each step width of the at least one matching step width is smaller than the matching step widths adopted by the X candidate matching blocks; determining a matching block with a minimum template error value among the matching blocks within the refinement range as a candidate matching block obtained by refining the current candidate matching block; and determining a candidate matching block obtained by refining the current candidate matching block as an available matching block among the N available matching blocks.
[0168] For example, when refining the X candidate matching blocks, the decoder may traverse the X candidate matching blocks, using a step width smaller than the matching step width adopted by the X candidate matching blocks, to perform intra-template matching within the refinement range of a current candidate matching block among the X candidate matching blocks, thereby obtaining a candidate matching block with a smaller template error value, which may be the candidate matching block obtained by refining the current candidate matching block.
[0169] For example, when the decoder traverses the X candidate matching blocks in ascending order of template error value and determines the i-th candidate matching block as the current candidate matching block, it determines the refinement range of the i-th candidate matching block. Then, it performs intra-template matching within the refinement range of the i-th candidate matching block using a step size smaller than the matching step size adopted by the X candidate matching blocks to obtain a candidate matching block with a smaller template error value. This candidate matching block is then determined as the candidate matching block obtained by refining the i-th candidate matching block and as an available matching block among the N available matching blocks. If the determined number of available matching blocks is less than N, it continues refining the current candidate matching block by determining the i+1-th candidate matching block as the current candidate matching block. If the determined number of available matching blocks is equal to N, it stops the refinement process for the X candidate matching blocks.
[0170] In some embodiments, the decoder determines the refinement range based on the size of the current block and the current candidate matching block.
[0171] For example, the decoder may determine the size of the refinement range based on the size of the current block and the matching step width of the current candidate matching block, with the block vector of the current candidate matching block as the center of the refinement range.
[0172] In some embodiments, the decoder determines the refinement range as (S / F)*H, centered on a block vector pointing from the current block to the current candidate matching block, where / is the division operator, * is the multiplication operator, S is the matching step size adopted by the X candidate matching blocks, H is the height of the current block, and F is a positive integer.
[0173] For example, the decoder may determine the refinement range as a rectangle with a side length of (S / E)*H and centered on a block vector pointing from the current block to the current candidate matching block, or as a circle with a radius of (S / E)*H and centered on a block vector pointing from the current block to the current candidate matching block.
[0174] Of course, in other alternative embodiments, the refinement range may have other shapes or sizes, and the present invention is not specifically limited thereto. Furthermore, the pruning range and the refinement range of the current candidate matching block may be the same or different, and the present invention is not specifically limited thereto.
[0175] In some embodiments, the decoder determines the refinement range based on a predefined numerical value.
[0176] Illustratively, the predefined value may include the size of the pruning range.
[0177] For example, the decoder may determine the refinement range as a rectangle whose side length is the predefined value and whose center is a block vector pointing from the current block to the current candidate matching block, or as a circle whose radius is the predefined value and whose center is a block vector pointing from the current block to the current candidate matching block.
[0178] Of course, in other alternative embodiments, the refinement range may be of other shapes or sizes, and the present invention is not specifically limited in this regard.
[0179] Exemplarily, the predefined value may be a default value. For example, the predefined value may be implemented by pre-storing a corresponding code, table, or other usable means for indicating related information in a device (e.g., including a decoder), and the present invention does not limit the specific implementation method. For example, "predefined" may refer to a protocol. In addition, in embodiments of the present invention, the "protocol" may refer to a standard protocol in the coding / decoding field, and may include, for example, related protocols applied to the image coding / decoding field, the video coding / decoding field, the hardware video coding / decoding field, the dedicated circuit video coding / decoding field, the real-time video coding / decoding field, and future coding / decoding systems, and the present invention is not limited thereto.
[0180] In some embodiments, if there is no overlap between the refinement ranges of different candidate matching blocks among the X candidate matching blocks, and the jth matching block matched within the refinement range of the current candidate matching block is the matching block with the smallest template error value among the previous j matching blocks within the refinement range of the current candidate matching block, the jth matching block can be directly determined as the candidate matching block obtained by refining the current candidate matching block.
[0181] For example, the absence of overlap between the refinement ranges of different candidate matching blocks among the X candidate matching blocks may include that the width and height of the refinement range of the current candidate matching block are both less than the matching step width S used by the X candidate matching blocks.
[0182] In other words, if the width and height of the refinement range of the current candidate matching block are both less than the matching step width S used by the X candidate matching blocks, it can be indicated that there is no overlap between the refinement ranges of different candidate matching blocks among the X candidate matching blocks. In this case, if the jth matching block matched within the refinement range of the current candidate matching block is the matching block with the smallest template error value among the previous j matching blocks within the refinement range of the current candidate matching block, the decoder can directly determine the jth matching block as the candidate matching block obtained by refining the current candidate matching block.
[0183] In some embodiments, when the current candidate matching block is the ith matching block among the X candidate matching blocks, and the jth matching block matched within the refinement range is the matching block with the smallest template error value among the jth matching blocks within the refinement range, if the candidate matching blocks obtained by refining the (i-1)th candidate matching blocks among the X candidate matching blocks do not include the jth matching block, the jth matching block is determined to be the candidate matching block obtained by refining the current candidate matching block.
[0184] In this embodiment, when the candidate matching blocks obtained by refining the (i-1)th candidate matching blocks among the X candidate matching blocks do not include the jth matching block, the jth matching block is determined as the candidate matching block obtained by refining the current candidate matching block, thereby avoiding obtaining the same matching block through different refinement processes.
[0185] In some embodiments, if there is an overlap between the refinement ranges of different candidate matching blocks among the X candidate matching blocks, and the jth matching block matched within the refinement range of the current candidate matching block is the matching block with the smallest template error value among the jth matching blocks within the refinement range of the current candidate matching block, when the candidate matching blocks obtained by refining the i-1th candidate matching blocks among the X candidate matching blocks do not include the jth matching block, the decoder can determine the jth matching block as the candidate matching block obtained by refining the current candidate matching block.
[0186] For example, the existence of overlap between the refinement ranges of different candidate matching blocks among the X candidate matching blocks may include the width or height of the refinement range of the current candidate matching block being greater than the matching step width S used by the X candidate matching blocks.
[0187] In other words, if the width or height of the refinement range of the current candidate matching block is greater than the matching step width S used by the X candidate matching blocks, it can be considered that there is an overlap between the refinement ranges of different candidate matching blocks among the X candidate matching blocks. In this case, if the jth matching block matched within the refinement range of the current candidate matching block is the matching block with the smallest template error value among the jth matching blocks within the refinement range of the current candidate matching block, and the candidate matching blocks obtained by the decoder refining the i-1th candidate matching blocks among the X candidate matching blocks do not include the jth matching block, the decoder can determine the jth matching block as the candidate matching block obtained by refining the current candidate matching block.
[0188] For example, the candidate matching block list is refined N times to obtain N available block vectors. Specifically, during the i-th refinement, the block vector BV of the i-th candidate matching block in the candidate matching block list is obtained. i Get (BV i is (x i ,y i )), identify its refinement range as a rectangle with side lengths LD=(S / 2)*H, where S is the matching step width of the X candidate matching blocks, and H is the height of the current block. In other words, the refinement range of the i-th candidate matching block begins at (x i -L D ,y i -L D ), and the bottom right is (x i +L D ,y i +L D When refining the i-th candidate matching block, template matching is performed within the refinement range with a step size of S' (S'=S / 2), and the block vector BV' with the smallest template error value is obtained. This is called the block vector BV of the i-th candidate matching block. i can be used as the block vector obtained by refining the i-th candidate matching block. i In the process of refining, each time a matching block with a smaller template error value (the minimum value of the template error values of the matching blocks already determined in the i-th refinement) is obtained, it is necessary to determine whether it is equal to the block vector of the already obtained available matching block. If an equal block vector exists, the block vector of the currently matched matching block is discarded (i.e., the block vector is skipped and the refined matching block is not updated). For example, if the block vectors BV1' to BV1' are obtained by the refinement process up to the i-1th refinement, i-1' is obtained, and when the i-th refinement is performed, the block vector BV i If the template error value of ' is smaller than the minimum value (the minimum value of the template error values of the matching blocks already determined in the i-th refinement), then BV i 'BV1' or BV i-1 ' block vectors. If an equal block vector exists, BV i ' and continue the template matching process at the next position. If neither is equal, BV i ' is set as a new optimal block vector, and the corresponding template error value is set as a new minimum value to update the i-th refinement result.
[0189] <Example 1> A candidate matching block among the X candidate matching blocks is refined M times to obtain N available matching blocks, where X≧M≧N, i.e., one best matching block obtained in each refinement may be used as a matching block among the N available matching blocks, i.e., the decoder can try to update the available matching block list of size N using the best matching block obtained in each refinement.
[0190] Specifically, an available matching block list of size N is maintained, and the matching blocks stored in the available matching block list are updated using the template error values of the matching blocks waiting to be added, ensuring that the matching blocks stored in the available matching block list are the N matching blocks with the smallest template error values. During the i-th refinement, the block vector BV of the i-th candidate matching block in the candidate matching block list is i Get BV i is (x i ,y i), and identify the refinement range as a rectangle with side lengths LD=(S / 2)*H, where S is the matching step width of the X candidate matching blocks, and H is the height of the current block. In other words, the refinement range of the i-th candidate matching block begins at the top left and ends at (x i -L D ,y i -L D ), and the bottom right is (x i +L D ,y i +L D ) is a rectangular area. When refining the i-th candidate matching block, template matching is performed within the refinement range with a step size of S' (S' = S / 2), and the block vector BV with the smallest template error value is selected. i ', and use this as the block vector BV i can be used as the block vector obtained by refining the i-th candidate matching block. i In the process of refining BV, each time a matching block with a smaller template error value (the minimum template error value of the matching blocks already determined in the i-th refinement) is obtained, it is necessary to determine whether it is equal to the block vector in the available matching block list. If an equal block vector exists, the block vector of the currently matched matching block is discarded (i.e., the block vector is skipped and the refined matching block is not updated), and the template matching process continues at the next position. If they are not equal, BV i Update the i-th refinement result by taking BV' as the new best block vector and the corresponding template error value as the new minimum value. After completing the i-th refinement, obtain a new best block vector BV' and the corresponding template error value, and try to add BV' to the available matching block list.
[0191] <Example 2> A candidate matching block among the X candidate matching blocks is refined M times to obtain N usable matching blocks, where X≧M≧N, i.e., a matching block obtained by one template matching in each refinement may be used as a matching block among the N usable matching blocks, i.e., the decoder can try to update the usable matching block list of size N using a matching block obtained by one template matching in each refinement.
[0192] Specifically, an available matching block list of size N is maintained, and the matching blocks stored in the available matching block list are updated using the template error values of the matching blocks waiting to be added, ensuring that the matching blocks stored in the available matching block list are the N matching blocks with the smallest template error values. During the i-th refinement, the block vector BV of the i-th candidate matching block in the candidate matching block list is i Get BV i is (x i ,y i ), and identify the refinement range as a rectangle with side lengths LD=(S / 2)*H, where S is the matching step width of the X candidate matching blocks, and H is the height of the current block. In other words, the refinement range of the i-th candidate matching block begins at the top left and ends at (x i -L D ,y i -L D ), and the bottom right is (x i +L D ,y i +L D) is a rectangular area. When refining the i-th candidate matching block, template matching is performed within the refinement range with a step size of S' (S' = S / 2). Each time template matching is performed, an attempt is made to add the current matching block to the available matching block list. Before each addition, it is necessary to determine whether the block vector is the same as that in the available matching block list. If an equal block vector exists, the block vector of the currently matched matching block is discarded (i.e., the block vector is skipped and the refined matching block is not updated), and the template matching process continues at the next position. If they are not equal, an attempt is made to add the current matching block to the available matching block list.
[0193] The difference between the two methods is as follows: In the first embodiment, after the first refinement is completed, only one matching block (the best matching block in the refinement process) is stored in the list; in the second embodiment, after the first refinement is completed, if the number of matches in the refinement process is greater than N, N matching blocks can be stored in the list.
[0194] In some embodiments, the decoder prunes and refines the X candidate matching blocks to obtain the N usable matching blocks.
[0195] Illustratively, the decoder performs N pruning and N refinement on the X candidate matching blocks to obtain the N usable matching blocks.
[0196] In some embodiments, the decoder prunes the X candidate matching blocks and then refines the pruned candidate matching blocks.
[0197] Illustratively, the decoder performs N pruning operations on the X candidate matching blocks, and then performs N refinements on the pruned candidate matching blocks.
[0198] In some embodiments, the decoder refines the X candidate matching blocks and then performs pruning on the refined candidate matching blocks.
[0199] Illustratively, the decoder refines the X candidate matching blocks and then performs pruning on the refined candidate matching blocks.
[0200] In some embodiments, the decoder refines the X candidate matching blocks once based on a current candidate matching block among the X candidate matching blocks, then refines the current candidate matching block, and continues this process until the decoder has pruned and refined the X candidate matching blocks N times to obtain the N usable matching blocks.
[0201] For example, the decoder performs one pruning on the X candidate matching blocks based on a current candidate matching block among the X candidate matching blocks, and then refines the current candidate matching block.
[0202] That is, when the decoder prunes and refines the X candidate matching blocks, it can perform the refinement process after performing the pruning process, or it can perform the pruning process after completing the refinement process, or it can even perform pruning and refinement alternately, and the present invention is not specifically limited thereto.
[0203] For example, N available block vectors are obtained from the candidate block vector list. The candidate matching blocks pointed to by these block vectors are used as candidate matching blocks for the current block in the subsequent weighted fusion process. For example, N available matching blocks are obtained by pruning and refining the candidate block vector list N times. The pruning step is used to avoid excessive duplication caused by the refinement step, and the refinement step is used to obtain more accurate matching blocks. Specifically, when the ith pruning and refinement is performed, the ith block vector BV in the list is i Get BV i is (x i ,y i ), and identify the refinement range as a rectangle with side lengths LD=(S / 2)*H, where S is the matching step width of the X candidate matching blocks, and H is the height of the current block. In other words, the refinement range of the i-th candidate matching block begins at the top left and ends at (x i -L D ,y i -L D ), and the bottom right is (x i +L D ,y i +L D ) is a rectangular region. Block vector j(x j ,y j )but,
number
[0204] FIG. 8 is an example of a pruning refinement process according to an embodiment of the present invention.
[0205] As shown in FIG. 8, the X candidate matching blocks are arranged in ascending order of template error value. When X=6, the block vectors of the X candidate matching blocks are BV1, BV2, BV3, BV4, BV5, and BV6, respectively. For example, when N=2, the decoder can perform two pruning operations on the six candidate matching blocks, and then refine the pruned candidate matching blocks two times.
[0206] When the decoder performs two rounds of pruning on the six candidate matching blocks, it can determine the current candidate matching block used to prune the candidate matching blocks by traversing the six candidate matching blocks in ascending order of template error value of each candidate matching block among the six candidate matching blocks. Then, it can obtain pruned candidate matching blocks by discarding candidate matching blocks whose distance from the current candidate matching block is equal to or less than the pruning range. Specifically, the decoder first prunes the six candidate matching blocks based on the first candidate matching block and discards BV2, so that the block vectors of the first pruned candidate matching blocks include BV1, BV3, BV4, BV5, and BV6. Then, it prunes the block vectors of the first pruned candidate matching blocks based on the second candidate matching block and discards BV5, so that the block vectors of the first pruned candidate matching blocks include BV1, BV3, BV4, and BV6.
[0207] When the decoder refines the pruned candidate matching blocks, it traverses the pruned candidate matching blocks and refines the candidate matching blocks in the pruned candidate matching blocks using a step size smaller than the matching step size of the X candidate matching blocks, thereby determining the two refined candidate matching blocks as the two usable matching blocks. Specifically, the decoder first performs template matching within the refinement range of BV1 with a step size of S' (S'=S / 2) to obtain the block vector BV1' with the smallest template error value, which can be used as the block vector obtained by refining BV1. Therefore, the candidate matching blocks after the first refinement include BV1', BV3, BV4, and BV6. Then, template matching is performed within the refinement range of BV3 with a step size of S' (S'=S / 2) to obtain a block vector BV3' with the smallest template error value, which can be used as the block vector obtained by refining BV3. Therefore, the candidate matching blocks after the second refinement include BV1', BV3', BV4, and BV6. Based on this, BV1' and BV3' can be used as the at least one matching block. Note that when S' is 1, sample If it is greater, the first refinement and the second refinement may involve multiple refinement processes until S' equals one.
[0208] FIG. 9 is another example of a pruning refinement process according to an embodiment of the present invention.
[0209] As shown in FIG. 9, the X candidate matching blocks are arranged in ascending order of template error value. When X=6, the block vectors of the X candidate matching blocks are assumed to be BV1, BV2, BV3, BV4, BV5, and BV6, respectively. Taking N=2 as an example, the decoder can perform one pruning on the 6 candidate matching blocks, then one refinement on the pruned candidate matching blocks, and then one pruning on the refined candidate matching blocks, and another refinement on the pruned candidate matching blocks.
[0210] Specifically, the decoder first performs a first pruning on the six candidate matching blocks based on the first candidate matching block, discarding BV2 and BV6, so that the block vectors of the candidate matching blocks after the first pruning include BV1, BV3, BV4, and BV5. Then, the decoder performs template matching within the refinement range of BV1 with a step size of S' (S'=S / 2) to obtain the block vector BV1' with the smallest template error value, which can be used as the block vector obtained by refining BV1, so that the candidate matching blocks after the first refinement include BV1', BV3, BV4, and BV5. Next, based on block vector BV3, which is the second candidate matching block among BV1', BV3, BV4, and BV5, the decoder prunes BV1', BV3, BV4, and BV5, discarding BV5. Therefore, the block vectors of the candidate matching blocks after the second pruning include BV1', BV3, and BV4. After that, the decoder performs template matching within the refinement range of BV3 with a step size S' (S'=S / 2) to obtain block vector BV3' with the smallest template error value, which can be used as the block vector obtained by refining BV3. Therefore, the candidate matching block after the first refinement includes BV1', BV3', and BV4. Based on this, BV1' and BV3' can be determined as the at least one matching block. Note that if S' is one sample If it is larger, the first refinement and the second refinement may involve multiple refinement processes until S' becomes one.
[0211] In some embodiments, the decoder may determine the at least one matching block based on the N available matching blocks according to the following method: determining a fusion condition used by the N available matching blocks; and determining an available matching block among the N available matching blocks that satisfies the fusion condition as the at least one matching block.
[0212] Illustratively, the merging condition is used to select the at least one matching block for merging from among the N available matching blocks.
[0213] In some embodiments, the decoder may include a size of the template for the current block, a size of the template for the current block, sample and a minimum template error value of the N available matching blocks.
[0214] Of course, in other alternative embodiments, the decoder may determine the fusion condition in other ways, for example, the fusion condition may be a predefined condition.
[0215] Exemplarily, the predefined condition may be a default condition. For example, the predefined condition may be realized by pre-storing a corresponding code, table, or other usable means for indicating related information in a device (e.g., including a decoder), and the present invention is not limited to a specific implementation method. For example, "predefined" may refer to a protocol. Note that in the embodiments of the present invention, "protocol" may refer to a standard protocol in the coding / decoding field, and may include, for example, protocols in the image coding / decoding field, video coding / decoding field, hardware video coding / decoding field, dedicated circuit video coding / decoding field, and real-time video coding / decoding field, as well as related protocols applied to future coding / decoding systems, and the present invention is not limited thereto.
[0216] In some embodiments, the merging condition includes a first threshold value, which is determined based on the size of the template of the current block and the bit width, and based on this, the decoder can determine, as the at least one matching block, an available matching block among the N available matching blocks whose template error value is less than or equal to the first threshold value.
[0217] Illustratively, the first threshold is positively correlated with the size of the template of the current block.
[0218] Illustratively, the first threshold is positively correlated with the bit width.
[0219] In some embodiments, the first threshold is determined by the following formula: T1=n1<<(b depth -n2)*n template is determined in accordance with
[0220] where << is the left shift operator, - is the subtraction operator, * is the multiplication operator, T1 is the first threshold, b depth is the bit width, n template is in the template of the current block sample Both n1 and n2 are positive integers.
[0221] Illustratively, n2 is equal to 2 or some other number.
[0222] Illustratively, n1 is equal to 1 or some other number.
[0223] In some embodiments, the merging condition includes a second threshold value determined based on the minimum template error value, such that the decoder can determine, as the at least one matching block, an available matching block among the N available matching blocks whose template error value is less than or equal to the second threshold value.
[0224] Exemplarily, the second threshold value has a positive correlation with the minimum template error value.
[0225] In some embodiments, the second threshold value is expressed by the following formula T2 = min SAD << n3 and is determined according to this.
[0226] Here, << is the left shift operator, T2 is the second threshold value, min SAD is the minimum template error value, and n3 is a positive integer.
[0227] Exemplarily, n3 is equal to 1 or other numerical values.
[0228] Of course, in other alternative embodiments, the fusion condition can also include the first threshold value and the second threshold value at the same time. That is, the decoder can determine, as the at least one matching block, a usable matching block among the N usable matching blocks whose template error value is less than or equal to the first threshold value and less than or equal to the second threshold value. For example, taking the case where the template error value of the i-th usable matching block among the N usable matching blocks is SAD i as an example, when the template error value SAD i of the i-th usable matching block is SAD i ≦ T1 && SAD i < T2, the i-th usable matching block is determined as a matching block in the at least one matching block.
[0229] In some embodiments, the decoder can also determine the at least one matching block based on the N usable matching blocks according to the following method. The method includes determining the at least one matching block based on the indication.
[0230] For example, the indication information may include N bits, where the N bits correspond one-to-one to the N available matching blocks, and each bit among the N bits indicates whether the corresponding available matching block is used as a matching block in the at least one matching block. For example, a value of 0 for each bit among the N bits indicates that the corresponding available matching block is used as a matching block in the at least one matching block, and a value of 1 for each bit among the N bits indicates that the corresponding available matching block is not used as a matching block in the at least one matching block. Alternatively, a value of 1 for each bit among the N bits indicates that the corresponding available matching block is used as a matching block in the at least one matching block, and a value of 0 for each bit among the N bits indicates that the corresponding available matching block is not used as a matching block in the at least one matching block.
[0231] Of course, in other alternative embodiments, the indication information may implement the corresponding indication function in other ways, and the present invention is not limited thereto.
[0232] In some embodiments, S330 comprises: If the at least one matching block is a plurality of matching blocks, the method may include performing a weighting process on the plurality of matching blocks to obtain a target prediction block of the current block.
[0233] Illustratively, the weight values of the multiple matching blocks may be equal, partially equal, or different from each other.
[0234] Exemplarily, if the weight values of the plurality of matching blocks are equal, the target prediction block is the average value of the plurality of matching blocks.
[0235] FIG. 10 is an example of determining a target prediction block based on multiple matching blocks according to an embodiment of the present invention.
[0236] 8, if the at least one matching block includes matching block 1, matching block 2, and matching block 3, the decoder can obtain the target prediction block by weighting matching block 1, matching block 2, and matching block 3 based on the weight value W1 of matching block 1, the weight value W2 of matching block 2, and the weight value W3 of matching block 3. Here, matching block 1, matching block 2, and matching block 3 are candidate matching blocks obtained by the decoder performing intra template matching within the search area of the current block (located within the reconstruction area of the current block), and they may be candidate matching blocks obtained by pruning and / or refining the candidate matching blocks obtained based on intra template matching, or may be matching blocks selected from the candidate matching blocks after pruning and / or refinement using the above-mentioned fusion condition.
[0237] In some embodiments, the decoder may weight the plurality of matching blocks according to the following method: determining a weight value for each matching block of the plurality of matching blocks; and performing a weighting process on the plurality of matching blocks based on a weight value of each matching block to obtain the target prediction block.
[0238] For example, the decoder determines a weight value for each matching block in the plurality of matching blocks, and then multiplies and adds the matching blocks together to obtain the target predicted block. Alternatively, the decoder determines a weight value for each matching block in the plurality of matching blocks, and then multiplies and adds the matching blocks together to obtain the target predicted block. Then, the decoder processes the resulting fused block to obtain the target predicted block.
[0239] In some embodiments, the decoder determines a weight value for each matching block based on the template error value of the matching block, the number of the plurality of matching blocks, and the sum of the weights of the plurality of matching blocks.
[0240] Illustratively, the weight value of each matching block is negatively correlated with the template error value of each matching block.
[0241] Illustratively, the weight value of each matching block is negatively correlated with the number of the plurality of matching blocks.
[0242] Illustratively, the weight value of each matching block is positively correlated with the sum of the weights of the multiple matching blocks.
[0243] Of course, in other alternative embodiments, the decoder may determine the weight value of each matching block based solely on the template error value or other information of the matching block, and the present invention is not specifically limited in this regard.
[0244] In some embodiments, the decoder determines the weight value for each matching block according to the following method: determining a third numerical value corresponding to each matching block based on the template error value of each matching block; adding the third numerical values corresponding to each matching block to obtain a fourth numerical value; and determining a weight value for each matching block based on the fourth numerical value and the template error value of each matching block.
[0245] Illustratively, the third value corresponding to each matching block is greater than zero.
[0246] Illustratively, the third numerical value corresponding to each matching block can be understood as an updated value of the template error value of the corresponding matching block.
[0247] In some embodiments, if the template error value of the i-th matching block among the plurality of matching blocks is 0, a predetermined value greater than 0 is determined as the third numerical value corresponding to the i-th matching block. do not have If so, determine the template error value of the i-th matching block as the third numerical value corresponding to the i-th matching block.
[0248] For example, if the template error value of the i-th matching block among the plurality of matching blocks is 0, 1 is determined as the third numerical value corresponding to the i-th matching block.
[0249] In some embodiments, the decoder determines a weight value for the i-th matching block in the plurality of matching blocks according to the following method: The method includes subtracting a third numerical value corresponding to the i-th matching block from the fourth numerical value to obtain a fifth numerical value; multiplying the fourth numerical value by n-1 to obtain a sixth numerical value, where n represents the number of the plurality of matching blocks; and determining a weight value of the i-th matching block based on the fifth numerical value and the sixth numerical value.
[0250] Illustratively, the weight value of the i-th matching block is positively correlated with the fifth numerical value.
[0251] Illustratively, the weight value of the i-th matching block is negatively correlated with the sixth numerical value.
[0252] In some embodiments, if the i-th matching block is not the last matching block in the plurality of matching blocks, the ratio of the fifth numerical value to the sixth numerical value is determined as the weight value of the i-th matching block. If the i-th matching block is the last matching block, the weight value of the last matching block is obtained by subtracting the weight values of the previous n-1 matching blocks in the plurality of matching blocks from the preset total weight.
[0253] Illustratively, the preset weight sum may be any integer, for example, a power of two (e.g., 2, 4, 8, 16, 64, etc.).
[0254] In some embodiments, the decoder determines the ratio of the fifth numerical value to the sixth numerical value as the weight value of the i-th matching block, where the sum of the weight values of the multiple matching blocks is equal to a predetermined total weight.
[0255] Illustratively, the preset weight sum may be any integer, for example, a power of two (e.g., 2, 4, 8, 16, 64, etc.).
[0256] In some embodiments, the ratio of the fifth number and the sixth number is a number obtained using bitwise, addition, and subtraction operations.
[0257] Illustratively, the bit operations include at least one of a right shift operation, a left shift operation, a logical AND operation, a logical OR operation, and a conditional operation. Of course, other operations may also be included, and the present invention is not limited thereto.
[0258] In some embodiments, the ratio of the fifth number to the sixth number is determined by the following formula: W i =(D5*V*W sum +D Add )>>D Shift is a number determined by
[0259] where * is the multiplication operator, + is the addition operator, >> is the right shift operator, D5 is the fifth number, W sum represents the weight sum, V is a value determined by table lookup based on the seventh value, and D Shift is a right shift amount calculated based on the seventh numerical value, and the seventh numerical value is a numerical value determined based on the sixth numerical value, and D Add is D Shift It is a number determined based on the
[0260] In some embodiments, V and D Shift The following method,
number
[0261] where:
number
[0262] For example, table[]={0,7,6,5,5,4,4,3,3,2,2,1,1,1,1,0}.
[0263] Of course, the numbers in the above formula can be adjusted according to actual needs, and the present invention is not specifically limited thereto.
[0264] In some embodiments, D Add = 1 << (D Shift - 1), or D Add = 1 << D Shift Here, << is the left shift operator, and - is the subtraction operator.
[0265] Of course, the 1 in the above formula can be replaced with other numerical values, and the present invention is not limited thereto.
[0266] Hereinafter, taking the preset total weight being 64 as an example, when the decoder obtains n (1 < n <= N) matching blocks, and the corresponding template error values are SAD1 to SADn respectively, the weight value W i of the matching block i (1 ≦ i ≦ n) can be determined according to the following example.
[0267] <Example 1>
Number
[0268] W i can be realized by operations such as table reference, bit operation, addition, subtraction, multiplication, etc. For example, when the accuracy of the weight value is 1 / 64,
Number
[0269] Here, table[] = {0,7,6,5,5,4,4,3,3,2,2,1,1,1,1,0}.
[0270] <Example 2>
Number
[0271] W i The calculation of can be realized by table lookup, bit operation, addition, subtraction, multiplication, etc. For example, if the precision of the weight value is 1 / 64,
number
[0272] Here, table[]={0,7,6,5,5,4,4,3,3,2,2,1,1,1,1,0}.
[0273] <Example 3>
number
[0274] W i The calculation can be realized by table lookup, bit operation, addition, subtraction, multiplication, etc. For example, if the precision of the weight value is 1 / 64,
number
[0275] Here, table[]={0,7,6,5,5,4,4,3,3,2,2,1,1,1,1,0}.
[0276] Furthermore, the following steps:
number
number
[0277] Of course, the numbers in the formulas included in the above Examples 1 to 3 can be adjusted according to actual needs, and the present invention is not specifically limited thereto.
[0278] In some embodiments, the decoder selects a first candidate set from among a plurality of candidate sets based on the number of matching blocks, the first candidate set including weight values equal to the number of matching blocks, and then determines a weight value for each matching block based on the first candidate set.
[0279] Illustratively, different candidate sets in the plurality of candidate sets include different numbers of weight values.
[0280] In some embodiments, the template error value of each matching block and the weight value of each matching block are negatively correlated.
[0281] For example, the weight value of each matching block may be any predefined fixed value, or a different weight value may be assigned to each matching block based on the number of matching blocks, the template error value of each matching block, etc. For example, the weight values are set to {¾, ¼}, {½, ¼, ¼}. 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 W3=¼, respectively.
[0282] In some embodiments, the decoder may perform a weighting process on the plurality of matching blocks according to the weight value of each matching block to obtain the target prediction block according to the following method: multiplying each matching block by the weight value of each matching block and then adding the weight value to obtain an eighth number; and adding C offset to get the ninth number, and add C to the right of the ninth number. Shiftand shifting the C to obtain the target prediction block. offset is C Shift is a value determined based on C Shift is a numerical value determined based on the sum of the weight values of the plurality of matching blocks.
[0283] Illustratively, the decoder may be implemented using the following equation:
number
[0284] where Pred represents the target predicted block, and Pred i represents the i-th matching block, and W i represents the weight value of the i-th matching block, n represents the number of the matching blocks, and 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 values of the plurality of matching blocks.
[0285] In some embodiments, C offset =1<<(C Shift -1),
number
number
[0286] In some embodiments, the decoder performs a weighting process on the plurality of matching blocks to obtain a target prediction block for the current block according to the following method: The method includes: dividing the current block into a plurality of regions; determining, for a first region among the plurality of regions, a weight value of each matching block among the plurality of matching blocks in the first region; and performing a weighting process on the plurality of matching blocks in the first region based on the weight value of each matching block in the first region to obtain a predicted value of the target predicted block in the first region, where the target predicted block includes a predicted value of each region among the plurality of regions.
[0287] For example, the weight values of the i-th matching block in the plurality of matching blocks in different regions in the plurality of regions may be the same or different.
[0288] For example, if the current block is divided into region 1 and region 2, a weight value for each matching block in region 1 among the plurality of matching blocks is determined for region 1. A weighting process is performed on the plurality of matching blocks in region 1 based on the weight value for each matching block in region 1 to obtain a predicted value for the target predicted block in region 1. Similarly, a weight value for each matching block in region 2 among the plurality of matching blocks is determined for region 2. A weighting process is performed on the plurality of matching blocks in region 2 based on the weight value for each matching block in region 2 to obtain a predicted value for the target predicted block in region 2. Here, the target predicted block includes a predicted value for region 1 and a predicted value for region 2.
[0289] In addition, the method for determining the weight value of each matching block in the first region among the plurality of matching blocks can refer to the method for determining the weight value of each matching block when the current block is not divided, or can refer to a method similar to CIIP to determine the weight value of each matching block in the first region based on the distribution of the plurality of regions, and will not be described in further detail here to avoid redundancy.
[0290] In some embodiments, the decoder divides the current block into multiple regions along the horizontal or vertical direction.
[0291] For example, the decoder divides the current block into four regions along the horizontal or vertical direction. For example, as shown in (a) of Figure 6, when the current block is divided vertically into four equal parts, the region indices are 0, 1, 2, and 3 from left to right. As shown in (b) of Figure 6, when the current block is divided horizontally into four equal parts, the region indices are 0, 1, 2, and 3 from top to bottom.
[0292] In some embodiments, S330 comprises: If the at least one matching block is a single matching block, the decoder may include predicting the current block using a first intra prediction mode to obtain a first predicted block, and performing a weighting process on the single matching block and the first predicted block to obtain the target predicted block.
[0293] Illustratively, if the at least one matching block is a single matching block, the decoder uses the following formula: Pred = (7 * Pred1+ Pred2+ 4) >> 3 The target predicted block can be determined according to: where Pred represents the target predicted block, Pred1 represents the single matching block, and Pred2 represents the first predicted block.
[0294] Of course, the values in the above formulas can be replaced with other values according to actual needs, and the present invention is not specifically limited thereto.
[0295] Illustratively, the first intra prediction mode is any prediction mode different from the IntraTMP mode.
[0296] Exemplarily, the first intra-prediction mode may be a predefined prediction mode. The predefined prediction mode may be a default prediction mode. For example, the predefined prediction mode may be implemented by pre-storing a usable scheme for indicating a corresponding code, table, or other related information in a device (e.g., including a decoder), and the present invention is not limited to a specific implementation method. For example, "predefined" may refer to a protocol. Note that in the embodiments of the present invention, "protocol" may refer to a standard protocol in the coding / decoding field, and may include, for example, protocols applicable to image coding / decoding, video coding / decoding, hardware video coding / decoding, dedicated circuit video coding / decoding, and real-time video coding / decoding, as well as future coding / decoding systems, and the present invention is not limited thereto.
[0297] Illustratively, a decoder may determine the first intra-prediction mode by decoding a bitstream.
[0298] In some embodiments, the weight value of the single matching block and the weight value of the first prediction block are both predefined weight values.
[0299] Illustratively, the ratio between the weight value of the single matching block and the weight value of the first predicted block, and the sum of the weight value of the single matching block and the weight value of the first predicted block are both predefined values.
[0300] Exemplarily, the predefined weight values may be default weight values, and the predefined prediction modes may be default prediction modes. For example, the predefined weight values may be implemented by pre-storing a usable method for indicating corresponding codes, tables, or other related information in a device (e.g., including a decoder), and the present invention is not limited to a specific implementation method. For example, "predefined" may refer to a protocol. It should be understood that in the embodiments of the present invention, "protocol" may refer to a standard protocol in the coding and decoding field, and may include, for example, protocols applied to the image coding and decoding field, the video coding and decoding field, the hardware video coding and decoding field, the dedicated circuit video coding and decoding field, and the real-time video coding and decoding field, as well as future coding and decoding systems, and the present invention is not limited thereto.
[0301] In some embodiments, the method 300 includes: The method may further include determining a weight value of the single matching block and a weight value of the first predicted block based on at least one of the decoding information of adjacent decoding blocks, the size of the current block, the template size of the current block, the type of the first intra prediction mode, and the position of each region of the current block.
[0302] Exemplarily, the decoder may determine a weight value of the single matching block based on at least one of the decoding information of neighboring decoded blocks, the size of the current block, the template size of the current block, the type of the first intra-prediction mode, and the location of each region of the current block, and then determine a weight value of the first predicted block based on a predefined weight sum and the weight value of the single matching block. For example, the decoder may determine a weight value corresponding to at least one of the decoding information of neighboring decoded blocks, the size of the current block, the template size of the current block, the type of the first intra-prediction mode, and the location of each region of the current block as the weight value of the single matching block, where the weight value of the first predicted block is the difference between the weight sum and the weight value of the single matching block.
[0303] Of course, the weight value of the single matching block and the weight value of the first predicted block can be determined by other methods, and the present invention is not specifically limited thereto. For example, the weight value of the single matching block and the weight value of the first predicted block can be determined by decoding a bitstream. Alternatively, the weight value of the single matching block can be determined based on the template error value of the single matching block, and then the weight value of the first predicted block can be determined based on a predefined weight sum and the weight value of the single matching block. For example, the weight value of the single matching block is negatively correlated with the template error value of the single matching block, and the weight value of the first predicted block is the difference between the weight sum and the weight value of the single matching block.
[0304] In some embodiments, S330 comprises: If the at least one matching block is a plurality of matching blocks, the decoder predicts the current block using a second intra-prediction mode to obtain a second predicted block; and The method may include performing a weighting process on the plurality of matching blocks and the second predicted block to obtain the target predicted block.
[0305] Illustratively, the first intra prediction mode is any prediction mode different from the IntraTMP mode.
[0306] Exemplarily, the second intra-prediction mode may be a predefined prediction mode. The predefined prediction mode may be a default prediction mode. For example, the predefined prediction mode may be implemented by pre-storing a usable scheme for indicating a corresponding code, table, or other related information in a device (e.g., including a decoder), and the present invention is not limited to the specific implementation method. For example, "predefined" may refer to a protocol. It should also be understood that in the embodiments of the present invention, "protocol" may refer to a standard protocol in the coding / decoding field, and may include, for example, the image coding / decoding field, the video coding / decoding field, the hardware video coding / decoding field, the dedicated circuit video coding / decoding field, and the real-time video coding / decoding field, as well as related protocols applied to future coding / decoding systems, and the present invention is not limited thereto.
[0307] Illustratively, a decoder may determine the second intra-prediction mode by decoding a bitstream.
[0308] In some embodiments, the weight value of the second predictive block is a predefined weight value.
[0309] For example, the ratio between the sum of the weight values of the plurality of matching blocks and the weight value of the second prediction block, and the sum of the weight values of the plurality of matching blocks and the sum of the weight values of the second prediction block are all predefined values.
[0310] Exemplarily, the predefined weight values may be default weight values, and the predefined prediction modes may be default prediction modes. For example, the predefined weight values may be implemented by pre-storing a usable method for indicating corresponding codes, tables, or other related information in a device (e.g., including a decoder), and the present invention is not limited to a specific implementation method. For example, "predefined" may refer to a protocol. It should be understood that in the embodiments of the present invention, "protocol" may refer to a standard protocol in the coding and decoding field, and may include, for example, protocols applied to the image coding and decoding field, the video coding and decoding field, the hardware video coding and decoding field, the dedicated circuit video coding and decoding field, and the real-time video coding and decoding field, as well as future coding and decoding systems, and the present invention is not limited thereto.
[0311] In some embodiments, the method 300 includes: The method may further include determining a weight value of the second prediction block based on at least one of the decoding information of adjacent decoding blocks, the size of the current block, the template size of the current block, the type of the second intra prediction mode, the weight sum of the multiple matching blocks, and the position of each region of the current block.
[0312] Exemplarily, the decoder may determine the sum of the weight values of the plurality of matching blocks 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 intra-prediction mode, and the location of each region of the current block, and then determine the weight value of the second prediction block based on a predefined weight sum and the sum of the weight values of the plurality of matching blocks. For example, the decoder 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 intra-prediction mode, and the location of each region of the current block as the sum of the weight values of the plurality of matching blocks, where the weight value of the second prediction block is the difference between the weight sum and the sum of the weight values of the plurality of matching blocks.
[0313] Of course, the sum of the weight values of the plurality of matching blocks and the weight value of the second predicted block can be determined by other methods, and the present invention is not specifically limited thereto. For example, the sum of the weight values of the single matching block and the weight value of the second predicted block can be determined by decoding a bitstream. Alternatively, the sum of the weight values of the plurality of matching blocks can be determined based on the average value of the template error values of the plurality of matching blocks, and then the weight value of the second predicted block can be determined based on the sum of the predefined weight sum and the weight values of the plurality of matching blocks. For example, the weight values of the plurality of matching blocks are negatively correlated with the average value of the template error values of the plurality of matching blocks, and the weight value of the second predicted block is the difference between the weight sum and the sum of the weight values of the plurality of matching blocks.
[0314] When determining the sum of the weight values of the plurality of matching blocks, the decoder can determine the weight value of each matching block among the plurality of matching blocks according to the above-described manner in which the decoder only performs fusion on the plurality of matching blocks, and then determine the weight value of the second predictive block based on the ratio between the weight value of the plurality of matching blocks and the weight value of the second predictive block and a predefined weight sum. Alternatively, the decoder can determine the weight value of each matching block among the plurality of matching blocks according to the above-described manner in which the decoder only performs fusion on the plurality of matching blocks, where the weight value of the second predictive block is a predefined numerical value.
[0315] In some embodiments, the template for the current block is: Current block left side reconstruction sample , lower left reconstruction sample , upper left reconstruction sample , upper reconstruction sample , upper right side reconstruction sample It includes at least one of the following:
[0316] Illustratively, the left reconstruction sample , the lower left side reconstruction sample , or the upper left reconstruction sample Reconstruction of one or more columns sample Includes:
[0317] Exemplarily, the upper left reconstruction sample , the upper reconstruction sample , or the upper right reconstruction sample Reconstruct one or more lines sample Includes:
[0318] FIG. 11 is an example of a template of a current block according to an embodiment of the present invention.
[0319] As shown in FIG. 11(a), the template of the current block is Current block left side reconstruction sample , lower left reconstruction sample , upper left reconstruction sample, upper reconstruction sample , upper right side reconstruction sample As shown in (b) of FIG. 11, the template of the current block includes: Current block left side reconstruction sample , upper left reconstruction sample , upper reconstruction sample , upper right side reconstruction sample As shown in FIG. 11(c), the template of the current block is Current block left side reconstruction sample , lower left reconstruction sample , upper left reconstruction sample , upper reconstruction sample As shown in (d) of FIG. 11, the template of the current block is Current block Upper left reconstruction sample , upper reconstruction sample , upper right side reconstruction sample As shown in (e) of FIG. 11, the template of the current block is Current block left side reconstruction sample , lower left reconstruction sample , upper left reconstruction sample Includes:
[0320] In some embodiments, S320 comprises: determining the limiting conditions for using the IntraTMP mode; and If the constraint condition is met, predicting the at least one matching block based on the IntraTMP mode.
[0321] 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 decoded blocks, a sequence level flag bit, a frame level flag bit, a macroblock level flag bit, the type of slice to which the current block belongs, or the frame type of the image frame to which the current block belongs.
[0322] Illustratively, if the restrictive conditions for using the IntraTMP mode are met, the decoder decodes the first identifier mentioned above.
[0323] Illustratively, if the restriction conditions for using the IntraTMP mode are met, the decoder decodes the first identifier mentioned above, and if the first identifier indicates that the IntraTMP mode should be used, the decoder determines at least one matching block of the current block based on the IntraTMP mode.
[0324] For example, the constraints may include at least one of the following: the size of the current block is greater than (or equal to or smaller 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 to which the current block belongs is a predefined type; and the frame type of the image frame to which the current block belongs 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 implemented by pre-storing a corresponding code, table, or other method for indicating related information in a device (e.g., including a decoder), and the present invention is not limited to a specific implementation method. For example, the term "predefined" may refer to a method defined in a protocol. Furthermore, in the embodiments of the present invention, the term "protocol" may refer to a standard protocol in the encoding / decoding field, and may include, for example, 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 invention is not limited thereto.
[0325] For example, assume that the constraint condition includes that the frame type of the image frame to which the current block belongs is a predefined type. In this case, the predefined type may be an I-frame. That is, the constraint condition includes that the frame type of the image frame to which the current block belongs is an I-frame. In other words, only if the image frame to which the current block belongs is an I-frame used for intra prediction, can the decoder determine at least one matching block of the current block based on the IntraTMP mode.
[0326] Preferred embodiments of the present invention will be described below.
[0327] Example 1 In step 1, The decoder decodes the input bitstream, and the decoding process follows the CTU order. It divides the CTUs into different coding blocks based on the block division flags obtained by decoding and decodes them. If the flag bit sps_tmp_enabled_flag in the SPS is equal to 1 and the size of the current coding block satisfies the limit MaxTmpSize on the IntraTMP coding block size in the SPS, it decodes intra_tmp_flag. If intra_tmp_flag is equal to 1, it is considered that the current coding block is coded using the IntraTMP mode, and it decodes intra_tmp_fusion_flag. If intra_tmp_flag is equal to 0, it is considered that the current coding block is not coded using the IntraTMP mode, and it is not necessary to decode intra_tmp_fusion_flag. The decoding process of the related syntax elements is shown in Table 1.
[0328] In step 2, The syntax element intra_tmp_fusion_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 size of the current coding block, etc. For example, if X is equal to 3 and the coordinates of the current coding block are (x, y), and if a coding block cuLeft is present at coordinates (x-1, y) and the intra_tmp_fusion_flag of cuLeft is 1, then CtxIdxInc is 1, otherwise it is 0. After that, if a coding block cuAbove is present at coordinates (x, y-1) and the intra_tmp_fusion_flag of cuAbove is 1, then 1 is added to CtxIdxInc, and 0 is added otherwise.
[0329] In step 3, If intra_tmp_fusion_flag is equal to 1, it is assumed that the currently coded block uses IntraTMP combined fusion prediction. If intra_tmp_fusion_flag is equal to 0, it is assumed that the currently coded block uses IntraTMP prediction of a single matching block.
[0330] In step 4, If decoding finds that the intra_tmp_flag of the currently coded block is equal to 1 and the intra_tmp_fusion_flag is equal to 1, then the currently coded block is coded using IntraTMP mode, and IntraTMP combined fusion prediction is used to obtain the predicted block of the currently coded block.
[0331] In step 5, A candidate block vector list is obtained by performing intra-template matching within the search area of the currently coded block. For example, the template error values (represented by the SAD between templates) corresponding to different block vectors within the search area of the currently coded block are calculated with a step size of S (i.e., every S points horizontally and vertically). For example, if the currently matched block vector is (X0, Y0), the next block vector to be matched is (X0-S, Y0), and the ordinate of the block vector in the next row to be matched is Y0-4. A candidate block vector list of size X is constructed, where X can be determined by the number N of matching blocks to be merged, e.g., X is equal to 3*N. This list always stores the 3*N block vectors with the smallest template error values during the template matching process. The block vectors in the list are sorted by the size of their template error values. Furthermore, the template error values corresponding to each block vector in the list are stored and used in subsequent steps.
[0332] In step 6, N available block vectors are obtained from the candidate block vector list. The matching blocks pointed to by these block vectors are used as matching blocks for the current coding block in the subsequent weighted fusion process. For example, N available block vectors are obtained by pruning and refining the candidate block vector list N times. The pruning step is used to avoid excessive duplication caused by the refinement step, and the refinement step is used to obtain more accurate matching blocks. Specifically, when the ith pruning and refinement is performed, the ith block vector BV in the list is used as the matching block for the current coding block. i Get BV i is (X i ,Y i ) and check the pruning and refinement distance L=(S / 2)*H, where S is the template matching step width and H is the height of the current coding block. The pruning and refinement range is (X i -L,Yi -L), the bottom right is (X i +L,Y i +L). The block vector j(X j ,Y j )but,
number
[0333] In step 7, Determine whether the matching blocks corresponding to the obtained N available block vectors are used in the weighted fusion process. For example, set the thresholds threshold1 and threshold2 as follows: threshold1 = (1 << (bitDepth - 2) * num_template threshold2 = minSAD << 1 Set it as follows.
[0334] where num_template is the template sample Number, bitDepth is sample The bit width, minSAD, is the minimum template error value among the N block vectors.
[0335] Template error value SAD of block vector i i but,
number
[0336] In step 8, Based on the template error value of the matching block, calculate the weight value of each block. For example, if n (1 < n <= N) matching blocks are obtained, and the corresponding template error values are SAD1 to SAD n respectively, the weight value W i of the matching block i (1 ≤ i ≤ n) is
Equation
[0337] W i can be calculated by operations such as table reference, bit operation, addition, subtraction, and multiplication. For example, when the accuracy of the weight value is 1 / 64,
Equation
[0338] Here, table[] = {0, 7, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 1, 1, 0}.
[0339] Specifically, when only one matching block is obtained in step 6, no weight calculation is performed.
[0340] [[ID=4l]] In step 9, Based on the matching blocks obtained in step 8 and the weight values of each block, these matching blocks are weighted and fused to obtain the final IntraTMP combined fusion prediction block. For example, if n (1 < n <= N) matching blocks are obtained in steps 16 to 19, and the corresponding weights are W1 to W n respectively, the final prediction block Pred is
Equation
[0341] where offset = 1<<(shift-1),
number
[0342] In particular, if only one matching block Pred1 is obtained in step 6, it can be weighted and fused with the predicted block Pred_planar obtained by the planar mode to obtain the final predicted block Pred, i.e. Pred = (7 * Pred1+ Pred_planar + 4) >> 3 get.
[0343] In step 10, The coefficient signal of the current coding block is decoded, and a residual block of the current coding block is obtained through inverse quantization and inverse transformation. The predicted block Pred is added to the residual block to obtain a reconstructed block of the current coding block, thereby completing the decoding of the current coding block.
[0344] Although the preferred embodiments of the present invention have been described in detail with reference to the drawings, the present invention is not limited to the specific details of the above embodiments. Various simple modifications can be made to the technical solutions of the present invention within the technical spirit of the present invention, and all such simple modifications fall within the scope of protection of the present invention. For example, the specific technical configurations described in the above specific embodiments can be combined in any appropriate manner as long as they are not contradictory. To avoid unnecessary repetition, the present invention does not separately describe various possible combinations. Furthermore, for example, various different embodiments of the present invention can be combined in any manner, and as long as they do not contradict the spirit of the present invention, they should also be considered as part of the disclosure of the present invention. Furthermore, in various method embodiments of the present invention, 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 inherent logic, and does not constitute any limitation on the implementation process of the embodiments of the present invention.
[0345] While the decoding method according to an embodiment of the present invention has been described in detail above from the decoder's perspective, the encoding method according to an embodiment of the present invention will now be described from the encoder's perspective with reference to FIG.
[0346] 12 is a flowchart of an encoding method 400 according to an embodiment of the present invention. The encoding method 400 can be implemented by an encoder, for example, and can be applied to the encoding framework shown in FIG. 1. For convenience of explanation, the encoding method 400 will be exemplarily described below using an encoder as an example.
[0347] As shown in FIG. 12, the encoding method 400 may include:
[0348] In S410, at least one matching block of a current block in a current sequence is predicted based on an intra-template matching prediction (IntraTMP) mode.
[0349] At S420, a target predicted block of the current block is determined based on the at least one matching block.
[0350] In S430, a residual block of the current block is obtained based on the target predicted block and the original block of the current block.
[0351] In S440, the residual block of the current block is coded.
[0352] In some embodiments, the method 400 includes: The method may further include encoding the first identifier.
[0353] Here, the first identifier indicates that fusion prediction is to be performed using the IntraTMP mode.
[0354] In some embodiments, the method 400 includes: encoding the second identifier.
[0355] Here, the second identifier indicates that the prediction is to be made using the IntraTMP mode.
[0356] In some embodiments, encoding the second identifier comprises: determining a target context index; encoding the first identifier using the target context index.
[0357] In some embodiments, determining the target context index comprises: Determining the target context index based on coding information of neighboring coding blocks of the current block; and / or determining the target context index based on a size of the current block.
[0358] In some embodiments, the coordinates of the current block are (x, y), and the neighboring coding blocks include a first coding block with coordinates (x-1, y) and a second coding block with coordinates (x, y-1), where the coding information of the first coding block includes a prediction mode used by a prediction block of the first coding block, and the coding information of the second coding block includes a prediction mode used by a prediction block of the second coding block.
[0359] wherein determining the target context index based on coding information of adjacent coding blocks of the current block includes: If a prediction mode used by a prediction block of the first coding block is a mode in which fusion prediction is performed based on the IntraTMP mode, assign A to the first numerical value; otherwise, assign B to the first numerical value, where A and B are both integers; If the prediction mode used by the prediction block of the second coding block is a prediction mode that performs fusion prediction based on the IntraTMP mode, assign C to the second numerical value; otherwise, assign D to the second numerical value, where C and D are both integers; and determining the sum of the first numerical value and the second numerical value as the target context index.
[0360] In some embodiments, S410 comprises: performing template matching on the current block based on the IntraTMP mode to obtain X candidate matching blocks; and determining the at least one matching block based on the X candidate matching blocks.
[0361] In some embodiments, performing template matching on the current block based on the IntraTMP mode to obtain X candidate matching blocks comprises: According to the IntraTMP mode, performing intra-template matching within a search area of the current block to obtain all candidate matching blocks of the current block; and determining the X candidate matching blocks as the matching blocks arranged in the order of smallest template error value to be the X candidate matching blocks.
[0362] In some embodiments, performing template matching on the current block based on the IntraTMP mode to obtain X candidate matching blocks comprises: The method includes constructing a candidate matching block list based on the IntraTMP mode, the candidate matching block list being used to store X matching blocks with the smallest template error values that are matched when performing intra-template matching within the search area of the current block.
[0363] In some embodiments, performing template matching on the current block based on the IntraTMP mode to obtain X candidate matching blocks comprises: Dividing the search area of the current block into Y sub-areas; and performing intra-template matching within each of the Y sub-regions based on the IntraTMP mode to obtain candidate matching blocks within each of the Y sub-regions; Here, the X candidate matching blocks include candidate matching blocks in each of the sub-regions.
[0364] In some embodiments, X=Y or X is a multiple of Y.
[0365] In some embodiments, determining the at least one matching block based on the X candidate matching blocks comprises: determining N available matching blocks based on the X candidate matching blocks, where X≧N; and determining the at least one matching block based on the N available matching blocks.
[0366] In some embodiments, X is a multiple of N.
[0367] In some embodiments, determining the N available matching blocks based on the X candidate matching blocks comprises: pruning the X candidate matching blocks based on spacings between the X candidate matching blocks to obtain the N available matching blocks.
[0368] In some embodiments, pruning the X candidate matching blocks to obtain the N available matching blocks based on spacings between the X candidate matching blocks includes: determining a current candidate matching block to be used for pruning among the X candidate matching blocks according to the ascending order of template error values; determining a pruning range for the current candidate matching block; and The method includes removing other candidate matching blocks within the pruning range except for the current candidate matching block to obtain candidate matching blocks remaining after pruning the current candidate matching block, until the number of pruning of the X candidate matching blocks reaches N, and determining the N candidate matching blocks before the remaining candidate matching block as the N available matching blocks, or until the number of candidate matching blocks remaining after pruning the current candidate matching block is N or less, and determining the N candidate matching blocks before among the candidate matching blocks remaining after the previous pruning as the N available matching blocks.
[0369] In some embodiments, determining a pruning range for the current candidate matching block comprises: determining the pruning range based on a size of the current block and the current candidate matching block.
[0370] In some embodiments, determining the pruning range based on the size of the current block and the current candidate matching block comprises: determining (S / E)*H as the pruning range centered on a block vector pointing from the current block to the current candidate matching block; where / is a division operator, * is a multiplication operator, S is the matching step width adopted by the X candidate matching blocks, H is the height of the current block, and E is a positive integer.
[0371] In some embodiments, determining a pruning range for the current candidate matching block comprises: Determining the pruning range based on a predefined numerical value.
[0372] In some embodiments, determining the N available matching blocks based on the X candidate matching blocks comprises: Refining the X candidate matching blocks to obtain the N available matching blocks.
[0373] In some embodiments, refining the X candidate matching blocks to obtain the N available matching blocks comprises: determining a refinement range for a current candidate matching block among the X candidate matching blocks; performing intra-template matching within the refinement range based on at least one matching step width to obtain matching blocks matched within the refinement range, wherein each matching step width among the at least one matching step width is smaller than the matching step widths adopted by the X candidate matching blocks; determining a matching block having a minimum template error value among the matching blocks matched within the refinement range as a candidate matching block obtained by refining the current candidate matching block; and determining a candidate matching block obtained by refining the current candidate matching block as an available matching block among the N available matching blocks.
[0374] In some embodiments, determining a refinement range for a current candidate matching block among the X candidate matching blocks comprises: determining the refinement range based on a size of the current block and the current candidate matching block.
[0375] In some embodiments, determining the refinement range based on the size of the current block and the current candidate matching block comprises: determining (S / F)*H as the refinement range centered on a block vector pointing from the current block to the current candidate matching block; where / is a division operator, * is a multiplication operator, S is the matching step width adopted by the X candidate matching blocks, H is the height of the current block, and F is a positive integer.
[0376] In some embodiments, determining a refinement range for a current candidate matching block among the X candidate matching blocks comprises: Determining the refinement range based on a predefined numerical value.
[0377] In some embodiments, determining a candidate matching block obtained by refining the current candidate matching block as an available matching block among the N available matching blocks comprises: When the current candidate matching block is the ith matching block among the X candidate matching blocks, and the jth matching block matched within the refinement range is the matching block with the smallest template error value among the previous j matching blocks within the refinement range, if the candidate matching blocks obtained by refining the previous i-1 candidate matching blocks among the X candidate matching blocks do not include the jth matching block, determining the jth matching block as the candidate matching block obtained by refining the current candidate matching block.
[0378] In some embodiments, determining the N available matching blocks based on the X candidate matching blocks comprises: Pruning and refining the X candidate matching blocks to obtain the N usable matching blocks.
[0379] In some embodiments, pruning and refining the X candidate matching blocks to obtain the N available matching blocks comprises: After pruning the X candidate matching blocks, refining the pruned candidate matching blocks; or After refining the X candidate matching blocks, pruning the refined candidate matching blocks; or pruning the X candidate matching blocks once based on a current candidate matching block among the X candidate matching blocks, and then refining the current candidate matching block.
[0380] In some embodiments, determining the at least one matching block based on the N available matching blocks comprises: determining a fusion condition used by the N available matching blocks; and determining an available matching block among the N available matching blocks that satisfies the fusion condition as the at least one matching block.
[0381] In some embodiments, determining the fusion conditions to be used by the N available matching blocks comprises: The size of the template of the current block, sample and a minimum template error value of the N available matching blocks.
[0382] In some embodiments, the merging condition includes a first threshold, which is determined based on the size of the template of the current block and the bit width.
[0383] Here, determining an available matching block that satisfies the fusion condition among the N available matching blocks as the at least one matching block includes the following steps: determining, as the at least one matching block, an available matching block among the N available matching blocks whose template error value is less than or equal to the first threshold value.
[0384] In some embodiments, the first threshold is determined by the following formula: T1=n1<<(b depth -n2)*n template is determined in accordance with
[0385] where << is the left shift operator, - is the subtraction operator, * is the multiplication operator, T1 represents the first threshold value, and b depth represents the bit width, and n template is in the template of the current block sample where n1 and n2 are both positive integers.
[0386] In some embodiments, the fusion condition includes a second threshold, the second threshold being a threshold determined based on the minimum template error value.
[0387] Here, determining an available matching block among the N available matching blocks that satisfies the fusion condition as the at least one matching block includes determining an available matching block among the N available matching blocks whose template error value is less than or equal to the second threshold as the at least one matching block.
[0388] In some embodiments, the second threshold is determined by the following formula: T2=min SAD < <n3 is determined in accordance with
[0389] where << is the left shift operator, T2 is the second threshold, and min SAD represents the minimum template error value, and n3 is a positive integer.
[0390] In some embodiments, the method 400 includes: determining indication information, the indication information being used to indicate the at least one matching block among the N available matching blocks; and encoding the instruction information.
[0391] In some embodiments, S420 comprises: If the at least one matching block is a plurality of matching blocks, the method may include performing a weighting process on the plurality of matching blocks to obtain a target prediction block of the current block.
[0392] In some embodiments, performing a weighting process on the plurality of matching blocks to obtain the target predicted block comprises: determining a weight value for each matching block in the plurality of matching blocks; and performing a weighting process on the plurality of matching blocks based on a weight value of each matching block to obtain the target prediction block.
[0393] In some embodiments, determining a weight value for each matching block in the plurality of matching blocks comprises: determining a weight value for each matching block based on a template error value for each matching block, the number of the plurality of matching blocks, and a sum of weights for the plurality of matching blocks.
[0394] In some embodiments, determining a weight value for each matching block based on a template error value for each matching block, a number of the plurality of matching blocks, and a sum of weights of the plurality of matching blocks comprises: determining a third numerical value corresponding to each matching block based on the template error value of each matching block; adding the third numerical values corresponding to each matching block to obtain a fourth numerical value; and determining a weight value for each matching block based on the fourth numerical value and a template error value for each matching block.
[0395] In some embodiments, determining a third numerical value corresponding to each matching block based on the template error value of each matching block includes: If the template error value of the i-th matching block among the plurality of matching blocks is 0, determining a predetermined value greater than 0 as a third numerical value corresponding to the i-th matching block; and The template error value of the i-th matching block is 0. do not have if so, determining the template error value of the i-th matching block as a third numerical value corresponding to the i-th matching block.
[0396] In some embodiments, determining a weight value for each matching block based on the fourth numerical value and the template error value for each matching block includes determining a weight value for an i-th matching block in the plurality of matching blocks according to the following method: subtracting the third number corresponding to the i-th matching block from the fourth number to obtain a fifth number; multiplying n-1 by the fourth number to obtain a sixth number, where n represents the number of matching blocks in the plurality of matching blocks; and determining a weight value for the i-th matching block based on the fifth numerical value and the sixth numerical value.
[0397] In some embodiments, determining the weight values of the i-th matching blocks based on the fifth numerical value and the sixth numerical value includes: If the i-th matching block is not the last matching block among the plurality of matching blocks, determining a ratio of the fifth numerical value to the sixth numerical value as a weight value of the i-th matching block; and If the i-th matching block is the last matching block, subtracting the weight values of the previous n-1 matching blocks in the plurality of matching blocks from the preset sum of weights to obtain the weight value of the last matching block.
[0398] In some embodiments, determining the weight values of the i-th matching blocks based on the fifth numerical value and the sixth numerical value includes: determining a ratio of the fifth numerical value to the sixth numerical value as a weight value of the i-th matching block.
[0399] Here, the sum of the weight values of the plurality of matching blocks is equal to a preset total weight.
[0400] In some embodiments, the ratio of the fifth number and the sixth number is a number obtained using bitwise, addition, and subtraction operations.
[0401] In some embodiments, the ratio of the fifth number to the sixth number is determined by the following formula: W i =(D5*V*W sum +D Add )>>D Shift is a number determined by
[0402] where * is the multiplication operator, + is the addition operator, >> is the right shift operator, D5 represents the fifth number, and W sum represents the weight sum, V is a value determined by table lookup based on the seventh value, and D Shift is a right shift amount calculated based on the seventh numerical value, and the seventh numerical value is a numerical value determined based on the sixth numerical value, and D Add is D Shift It is a number determined based on the
[0403] In some embodiments, V and D Shift can be performed in the following manner:
number
[0404] where:
number
[0405] In some embodiments, D Add =1<<(D Shift -1), or D Add =1< <D Shift where << is the left shift operator and - is the subtraction operator.
[0406] In some embodiments, determining a weight value for each matching block in the plurality of matching blocks comprises: selecting, based on the number of the plurality of matching blocks, from a plurality of candidate sets, a first candidate set including a number of weight values equal to the number of the plurality of matching blocks, wherein each candidate set in the plurality of candidate sets includes at least one candidate weight value; and determining a weight value for each of the matching blocks based on the first candidate set.
[0407] In some embodiments, the template error value of each matching block and the weight value of each matching block are negatively correlated.
[0408] In some embodiments, performing a weighting process on the plurality of matching blocks based on a weight value of each matching block to obtain the target prediction block includes: multiplying each matching block with its weight value and then adding the weighted values to obtain an eighth number; The eighth number is C offset to obtain a ninth number; and The 9th number is C to the right Shift and shifting the target predicted block to obtain the target predicted block.
[0409] where 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 values of the plurality of matching blocks.
[0410] In some embodiments, C offset =1<<(C Shift -1),
number
number
[0411] In some embodiments, performing a weighting process on the plurality of matching blocks to obtain a target prediction block for the current block comprises: Dividing the current block into a plurality of regions; determining, for a first region in the plurality of regions, a weight value in the first region of each matching block in the plurality of matching blocks; and and performing a weighting process on the plurality of matching blocks in the first region based on the weight value of each matching block in the first region to obtain a predicted value of the target predicted block in the first region.
[0412] Here, the target predicted block includes a predicted value for each region in the plurality of regions.
[0413] In some embodiments, dividing the current block into regions comprises: Dividing the current block into a plurality of regions along a horizontal or vertical direction.
[0414] In some embodiments, S420 comprises: If the at least one matching block is a single matching block, predicting the current block using a first intra prediction mode to obtain a first predicted block; and performing a weighting process on the single matching block and the first predicted block to obtain the target predicted block.
[0415] In some embodiments, the weight value of the single matching block and the weight value of the first prediction block are both predefined weight values.
[0416] In some embodiments, the method 400 includes: The method may further include determining a weight value of the single matching block and a weight value of the first predictive 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 intra prediction mode, and the position of each region of the current block.
[0417] In some embodiments, S420 comprises: If the at least one matching block is a plurality of matching blocks, predicting the current block using a second intra prediction mode to obtain a second predicted block; and The method may include performing a weighting process on the plurality of matching blocks and the second predicted block to obtain the target predicted block.
[0418] In some embodiments, the weight value of the second predictive block is a predefined weight value.
[0419] In some embodiments, the method 400 includes: The method may further include determining a 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 second intra prediction mode, the sum of weights of the multiple matching blocks, and the position of each region of the current block.
[0420] In some embodiments, the template for the current block is Current block left side reconstruction sample , lower left reconstruction sample , upper left reconstruction, sample Upper reconstruction sample , upper right side reconstruction sample It includes at least one of the following:
[0421] In some embodiments, S410 comprises: determining the limiting conditions under which the IntraTMP mode is used; and If the constraint condition is met, predicting the at least one matching block based on the IntraTMP mode.
[0422] In some embodiments, the constraint is obtained by at least one of the following: the size of the current block, the coding information of neighboring coding blocks, a sequence level flag bit, a frame level flag bit, a macroblock level flag bit, the type of slice to which the current block belongs, or the frame type of the image frame to which the current block belongs.
[0423] 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 can refer to the corresponding steps in the decoding method 300, and for the sake of brevity, will not be further detailed here.
[0424] Preferred embodiments of the present invention will be described below.
[0425] <Example 2> In step 1, The encoder divides the input video signal into coding tree units (CTUs), and then divides the CTUs into coding units (CUs, or coding blocks) of different sizes using a binary tree, ternary tree, or quad tree for encoding. For the current coding block, it selects an available coding mode based on the mode flag bit in the sequence parameter set (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 using the IntraTMP mode.
[0426] In step 2, If the current coding block is coded using the IntraTMP mode, the current coding block may use the IntraTMP prediction method of a single matching block, or the IntraTMP combined fusion prediction method. The specific process of prediction and coding using the IntraTMP combined fusion prediction method is as follows:
[0427] In step 3, A candidate block vector list is obtained by performing intra-template matching within a search area based on the currently coded block. For example, template error values (represented by the SAD between templates) corresponding to different block vectors within the search area of the currently coded block are calculated with a step size of S (i.e., every S points horizontally and vertically). For example, if the currently matched block vector is (X0, Y0), the next block vector to be matched is (X0-S, Y0), and the ordinate of the block vector in the next row to be matched is Y0-4. A candidate block vector list of size X is constructed, where X can be determined by the number N of matching blocks to be merged, e.g., X is equal to 3*N. This list always stores the 3*N block vectors with the smallest template error values during the template matching process. The block vectors in the list are sorted by the size of their template error values. Furthermore, the template error values corresponding to each block vector in the list are stored and used in subsequent steps.
[0428] In step 4, N usable block vectors are obtained from the candidate block vector list. The matching blocks pointed to by these block vectors are used as matching blocks for the current coding block in the subsequent weighted fusion process. For example, N usable block vectors are obtained by pruning and refining the candidate block vector list N times. The pruning step is used to avoid excessive duplication caused by the refinement step, and the refinement step is used to obtain more accurate matching blocks. Specifically, when the ith pruning and refinement is performed, the ith block vector BV in the list is i Get BV i is (X i ,Y i) and check the pruning and refinement distance L=(S / 2)*H, where S is the template matching step width and H is the height of the current coding block. The pruning and refinement range is (X i -L,Y i -L), the bottom right is (X i +L,Y i +L). The block vector j(X j ,Y j ) is under the following conditions,
number
[0429] In step 5, Determine whether the matching blocks corresponding to the obtained N available block vectors are used in the weighted fusion process. For example, set the thresholds threshold1 and threshold2 as follows: threshold1 = (1 << (bitDepth - 2) * num_template threshold2 = minSAD << 1 Set it as follows.
[0430] where num_template is the template sample Number, bitDepth is sample The bit width, minSAD, is the minimum template error value among the N block vectors.
[0431] If the template error value SAD of the block vector i i satisfies the following conditions [Number] then the matching block i corresponding to the block vector i is used for subsequent weighted fusion.
[0432] In step 6, calculate the weight value of each block based on the template error value of the matching block. For example, if n (1 < n <= N) matching blocks are obtained, and the corresponding template error values are SAD1 to SAD n respectively, then the weight value W i of the matching block i (1 ≤ i ≤ n) is [Number] as follows.
[0433] W i can be calculated by operations such as table lookup, bit operations, addition, subtraction, and multiplication. For example, if the accuracy of the weight value is 1 / 64, [Number] There is. Here, table[] = {0, 7, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 1, 1, 0}.
[0434] Specifically, if only one matching block is obtained in step 6, no weight calculation is performed.
[0435] In step 7, based on the matching blocks obtained in step 6 and the weight values of each block, these matching blocks are weighted and fused to obtain the final IntraTMP combined fusion prediction block. For example, if n (1 < n <= N) matching blocks are obtained in steps 2 to 6, and the corresponding weights are W1 to W n respectively, then the final prediction block Pred is
number
number
[0436] In particular, if only one matching block Pred1 is obtained in step 6, it can be weighted and fused with the prediction block Pred_planar obtained by the planar mode to obtain the final prediction block Pred, i.e., Pred = (7 * Pred1+ Pred_planar + 4) >> 3 get.
[0437] In step 8, A residual is generated from the final prediction block Pred and the current coding block. The residual is further compressed through steps such as transform, quantization, and entropy coding, and then written into a bitstream to complete the coding of the current coding block. The transformed and quantized residual is then inversely quantized and inversely transformed to obtain a reconstructed residual block. The reconstructed residual block and the prediction block Pred are added to obtain a reconstructed block for the current coding block.
[0438] In step 9, A flag bit intra_tmp_fusion_flag written to the bitstream indicates whether the currently coded block performs combined fusion prediction. For example, if the currently coded block is coded using the IntraTMP mode, the flag bit intra_tmp_flag is equal to 1, and in this case, the intra_tmp_fusion_flag is written.
[0439] In step 10, The syntax element intra_tmp_fusion_flag is coded 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 size of the current coding block, etc. For example, X is equal to 3, and the coordinates of the current coding block are (x, y). If a coding block cuLeft is present at the coordinates (x-1, y) and the intra_tmp_fusion_flag of cuLeft is 1, CtxIdxInc is 1; otherwise, it is 0. Then, if a coding block cuAbove is present at the coordinates (x, y-1) and the intra_tmp_fusion_flag of cuAbove is 1, 1 is added to CtxIdxInc; otherwise, 0 is added.
[0440] In step 11, Flag information related to IntraTMP combined fusion prediction, such as intra_tmp_flag and intra_tmp_fusion_flag, is coded according to steps 9 and 10, and residual information in IntraTMP combined fusion prediction is coded according to step 8. Through the above coding process, the number of bits required to complete coding of the current coding block in IntraTMP combined fusion prediction is determined, and the rate-distortion cost is calculated in combination with the distortion degree between the reconstructed block of the current coding block and the current coding block. The optimal coding mode for the current coding block is selected through rate-distortion optimization (RDO), and coding of the current coding block is completed.
[0441] For the description of each flag bit related to the first and second embodiments, please refer to the description in Table 3. To avoid repetition, further details will not be provided here. Furthermore, the first and second embodiments are merely examples of the present invention and should not be understood as limitations on the present invention. For example, other alternative embodiments can be extended based on the first and second embodiments to obtain an extended scheme of the first embodiment. For example, this includes at least the following alternative schemes:
[0442] Alternative 1 The size of the candidate block vector list may also be other integer values.
[0443] Alternative plan 2 Different calculation methods can be used to represent the template error value, for example, SATD, MSE, MAD.
[0444] Alternative 3 The number of pruning and refinement times may be other integer values and is independent of the size of the candidate block vector list.
[0445] Alternative 4 The pruning range may be a predefined value, or may be another shape range obtained based on information such as the size of the current coding block, the current block vector, and so on.
[0446] Alternative 5 The pruning process for the candidate block vector list can be skipped.
[0447] Alternative 6 The refinement region may be a region of other shapes obtained based on information such as a predefined value, the size of the currently coded block, the current block vector, and the refinement step width, and is not related to the pruning range.
[0448] Alternative 7 The refinement process for the candidate block vector list can be skipped, for example, the i-th block vector in the block vector list is directly used as the available block vector, and the matching block it points to is the matching block of the current coding block.
[0449] Alternative 8 The thresholds threshold1 and threshold2 are predefined values, the size of the current coding block, sample It may also be other values obtained based on information such as the bit width and the template error value of the candidate block vector.
[0450] Alternative 9 A single threshold can be used to determine whether a matching block is available. For example, the template error value SAD of block vector i i is under the following conditions:
number
[0451] Alternative 10 The weight value of each matching block may be any predefined fixed value, or a different weight value may be assigned to each matching block based on the number of matching blocks, template error value, etc. For example, if the weight values are set to {3 / 4, 1 / 4} and {1 / 2, 1 / 4, 1 / 4}, and there are two matching blocks pred1 and pred2, and the corresponding template error values are SAD1≦SAD2, then the weight value of pred1 is set to W1=3 / 4 and the weight value of pred2 is set to W2=1 / 4. If there are three matching blocks pred1, pred2, and pred3, and the corresponding template error values are SAD1≦SAD2≦SAD3, then the weight values of pred1, pred2, and pred3 are set to W1=1 / 2, W2=1 / 4, and W3=1 / 4, respectively.
[0452] Alternative 11 The weight value W of each matching block is sample may be related to the position in the current block.
[0453] Alternative 12 If only one matching block is obtained, it may be weighted and fused with a predicted block obtained by another intra prediction mode other than the planar mode, or weighted fusion may not be performed.
[0454] Alternative 13 If multiple matching blocks are obtained in the template matching process, some of the matching blocks can be selected and weighted and merged to obtain a final predicted block. For example, if three matching blocks pred1, pred2, and pred3 are obtained through steps 1 to 3 of the embodiment, the combination methods include pred1+pred2 (representing weighted fusion using pred1 and pred2), pred1+pred3, pred2+pred3, and pred1+pred2+pred3. The specific combination method can be determined by encoding an index signal, selecting the combination method with the smallest template error value, etc.
[0455] Alternative 14 It is also possible not to code or decode the flag bit intra_tmp_fusion_flag. For coding blocks coded in IntraTMP mode, IntraTMP combined fusion prediction is always used.
[0456] Alternative 15 Restrictions on the use of IntraTMP combined fusion prediction can be added. The restrictions can be obtained based on information such as the size of the currently coded block, neighbor coding information, sequence-level flag bits, frame-level flag bits, macroblock-level flag bits, slice type, and frame type. IntraTMP combined fusion prediction is used and the syntax element intra_tmp_fusion_flag is coded only when the restrictions are met. Otherwise, IntraTMP combined fusion prediction is not used and there is no need to code the syntax element intra_tmp_fusion_flag.
[0457] Alternative 16 The syntax element intra_tmp_fusion_flag can be coded using other number of context models, and the context model index to be used can be determined based on the size of the currently coded block, neighboring coding information, etc. Alternatively, the syntax element intra_tmp_fusion_flag can be coded using a bypass coding scheme.
[0458] Alternative 17 In the weighted fusion process, a prediction block obtained by a prediction mode other than the IntraTMP mode can be introduced, and the weight value of the prediction block can be a predefined value, a template of the current coding block, or sample This can be determined based on the position in the current coding block, adjacent coding information, etc.
[0459] Alternative 18 First, the block vectors in the candidate block vector list can be refined, then the candidate block vector list can be pruned based on the interval of the block vectors, etc. Finally, a predetermined amount of available block vectors can be selected from the candidate block vector list to obtain the corresponding matching blocks.
[0460] Alternative 19 If only a partial template on the left or upper side of the current coding block is available, the partial template can be used to perform the template-related operation steps in each embodiment.
[0461] Alternatives 20 The template is the adjacent reconstruction of the left and upper L and M rows (columns) of the current block. sample where L and M may be any integer values.
[0462] Alternative 21 The template is currently reconstructed in the top right and bottom left of the block. sampleFor example, the template may have five situations as shown in FIG.
[0463] Alternative 22 The step size s of the search process and the step size s' of the refinement process can be any integer value, where s' is smaller than s. The refinement process can be performed multiple times, and each step size s' is smaller than the previous step size s. Each refinement region can be obtained based on the step size.
[0464] Alternative 23 The process of obtaining multiple block vectors or matching blocks through template matching can also be achieved in ways other than constructing a list of candidate block vectors. For example, the search area can be divided into different sub-areas, and template matching can be performed in each sub-area to obtain one matching block with the smallest template error value. Finally, multiple matching blocks can be obtained through multiple sub-areas.
[0465] Alternative 24 The offset used for weighted merging of matching blocks may be equal to 0 or any other number.
[0466] Alternative 25 The flag bit intra_tmp_fusion_flag does not need to be coded or decoded, and prediction is performed on the currently coded block template region, and based on the method of comparing the template error value, it is possible to select whether to use IntraTMP combined fusion prediction or IntraTMP prediction of a single matching block.
[0467] Alternative 26 In the embodiment, steps 6 and 19, the calculation process of Wi is as follows:
number
[0468] or
number
[0469] Then, the following steps:
number
number
[0470] Alternative 27 Obtaining N available block vectors based on the candidate block vector list can be achieved by the following method.
[0471] The candidate block vector list is refined N times to obtain N usable block vectors. Specifically, during the ith refinement, the ith block vector BVi in the list is obtained, BVi is equal to (Xi, Yi), and the refinement distance L = (S / 2) * H is confirmed. Here, S is the template matching step size, and H is the height of the currently coded block. The refinement range is a rectangular area with the upper left being (Xi-L, Yi-L) and the lower right being (Xi+L, Yi+L). Template matching is performed within the rectangular area with a step size S' (S' = S / 2) to obtain the block vector i' with the smallest template error value, which is designated as the ith usable block vector. Here, each time a block vector with a smaller error value (smaller than the minimum value of the current refinement process) is obtained, it must be determined whether it is equal to the previously obtained usable block vector. If an equal block vector exists, the currently matching block vector is discarded (i.e., the block vector is skipped, and the newly refined minimum value is not updated). For example, if block vectors BV1 to BVi-1 have been obtained in the previous (i-1) refinement processes, when the i-th refinement is performed, if the template error value corresponding to a block vector BVi is smaller than the minimum value (referring to the minimum value of the refinement process), it is necessary to determine whether BVi is equal to BV1 or BVi-1 in order. If an equal BV exists, BVi is skipped and the template matching process continues at the next position. If none of them are equal, BVi is set as the new optimal block vector and the corresponding template error value is set as the new minimum value.
[0472] Alternative 28 After completing the IntraTMP combined fusion prediction, the block vector corresponding to the best matching block obtained in the prediction process is saved as the known coding information of the current block and can be further used in the coding process of other blocks. For example, N available matching blocks are obtained for weighted fusion, and the corresponding BV1 to BV2 are used. nLet n be (n≧1). These BVs are saved (may be sorted based on the template error value) and can be used in the subsequent coding process. For example, a coding block in IBC mode needs to build a candidate block vector list during coding, and the block vectors in the list can be obtained from block vector information (if any) of adjacent coded blocks. At this time, if an IntraTMP coding block exists in the adjacent block, BV1 can be added to the candidate block vector list as the block vector of the IntraTMP block, or i (1≦i≦n) block vectors BV1 to BV i can be added to the candidate block vector list in order, where i can be a predefined value or determined based on the remaining size of the current candidate block vector list.
[0473] Alternative 29 In alternative method 28, whether to store multiple block vectors can be selected based on whether the IntraTMP coding block uses the proposed fusion prediction. For example, if the current coding block uses the IntraTMP mode but does not use the proposed combined fusion prediction, the block vector obtained by the default IntraTMP prediction mode is stored. If the IntraTMP mode is used and the proposed fusion prediction method is used, block vectors corresponding to x matching blocks used for weighted fusion are stored. x may be an integer value not exceeding the maximum number of matching blocks available for fusion.
[0474] Alternatives 30 In alternative 28, multiple block vectors can always be stored, regardless of whether the IntraTMP coded block uses the proposed combined fusion prediction or not.
[0475] Having described above in detail the method embodiment of the present invention, the apparatus embodiment of the present invention will now be described in detail with reference to FIGS.
[0476] FIG. 13 is a schematic block diagram of a decoder 500 according to an embodiment of the present invention.
[0477] As shown in FIG. 13, the decoder 500 a residual unit 510 configured to determine a residual block of a current block in a current sequence based on the bitstream; a prediction unit 520 configured to predict at least one matching block of the current block based on an intra-template matching prediction (IntraTMP) mode; a determining unit 530 configured to determine a target prediction block of the current block based on the at least one matching block; and a reconstruction unit 540 configured to obtain a reconstructed block of the current block based on the residual block of the current block and the target predicted block.
[0478] In some embodiments, the prediction unit 520 specifically: determining a first identifier based on the bitstream; and If the first identifier indicates that fusion prediction is to be performed using an IntraTMP mode, predicting the at least one matching block based on the IntraTMP mode.
[0479] In some embodiments, the prediction unit 520 specifically: determining a second identifier based on the bitstream; and If the second identifier indicates that prediction is to be performed using IntraTMP mode, determining the first identifier based on the bitstream.
[0480] In some embodiments, the prediction unit 520 specifically: determining a target context index; and and determining the first identifier based on the bitstream using the target context index.
[0481] In some embodiments, the prediction unit 520 specifically: 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.
[0482] In some embodiments, the coordinates of the current block are (x, y), and 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 is Ku The decoding information of the second decoded block includes the prediction mode to be used. Ku Contains the prediction mode to use.
[0483] Here, the prediction unit 520 specifically: The first decoding block Ku If the prediction mode to be used is a mode in which fusion prediction is performed based on the IntraTMP mode, assign A to the first numerical value, and otherwise assign B to the first numerical value, where A and B are both integers; The second decoding block Ku If the prediction mode to be used is a prediction mode that performs fusion prediction based on the IntraTMP mode, assign C to the second numerical value; otherwise, assign D to the second numerical value, where C and D are both integers; and determining the sum of the first numerical value and the second numerical value as the target context index.
[0484] In some embodiments, the prediction unit 520 specifically: performing template matching on the current block based on the IntraTMP mode to obtain X candidate matching blocks; and determining the at least one matching block based on the X candidate matching blocks.
[0485] In some embodiments, the prediction unit 520 specifically: According to the IntraTMP mode, performing intra-template matching within a search area of the current block to obtain all candidate matching blocks of the current block; and and determining the matching blocks arranged in the first X positions in ascending order of template error value as the X candidate matching blocks.
[0486] In some embodiments, the prediction unit 520 specifically: Based on the IntraTMP mode, a candidate matching block list is constructed, which is used to store X matching blocks with the smallest template error value that are matched when performing intra-template matching within the search area of the current block.
[0487] In some embodiments, the prediction unit 520 specifically: Dividing the search area of the current block into Y sub-areas; and The method is configured to perform intra-template matching within each sub-region of the Y sub-regions based on the IntraTMP mode to obtain a candidate matching block within each sub-region.
[0488] Here, the X candidate matching blocks include candidate matching blocks in each of the sub-regions.
[0489] In some embodiments, X=Y, or X is a multiple of Y.
[0490] In some embodiments, the prediction unit 520 specifically: determining N available matching blocks based on the X candidate matching blocks (X≧N); and determining the at least one matching block based on the N available matching blocks.
[0491] In some embodiments, X is a multiple of N.
[0492] In some embodiments, the prediction unit 520 specifically: The method is configured to prune the X candidate matching blocks based on the spacing between the X candidate matching blocks to obtain the N available matching blocks.
[0493] In some embodiments, the prediction unit 520 specifically: determining a current candidate matching block to be used for pruning among the X candidate matching blocks according to the ascending order of template error values; determining a pruning range for the current candidate matching block; and The method is configured to remove other candidate matching blocks within the pruning range except for the current candidate matching block to obtain candidate matching blocks remaining after pruning the current candidate matching block, until the number of pruning of the X candidate matching blocks reaches N, and determine the N candidate matching blocks before the remaining candidate matching block as the N available matching blocks, or until the number of candidate matching blocks remaining after pruning the current candidate matching block is N or less, and determine the N candidate matching blocks before among the candidate matching blocks remaining after the previous pruning as the N available matching blocks.
[0494] In some embodiments, the prediction unit 520 specifically: The pruning range is configured to be determined based on the size of the current block and the current candidate matching block.
[0495] In some embodiments, the prediction unit 520 specifically: The pruning range is determined to be (S / E)*H, centered on a block vector pointing from the current block to the current candidate matching block.
[0496] where / is a division operator, * is a multiplication operator, S is the matching step width adopted by the X candidate matching blocks, H is the height of the current block, and E is a positive integer.
[0497] In some embodiments, the prediction unit 520 specifically: The pruning range is determined based on a predefined numerical value.
[0498] In some embodiments, the prediction unit 520 specifically: The X candidate matching blocks are refined to obtain the N available matching blocks.
[0499] In some embodiments, the prediction unit 520 specifically: determining a refinement range for a current candidate matching block among the X candidate matching blocks; performing intra-template matching within the refinement range based on at least one matching step width to obtain matching blocks that match within the refinement range, wherein each matching step width among the at least one matching step width is smaller than the matching step widths adopted by the X candidate matching blocks; determining a matching block having a minimum template error value among the matching blocks matched within the refinement range as a candidate matching block obtained by refining the current candidate matching block; and determining a candidate matching block obtained by refining the current candidate matching block as an available matching block among the N available matching blocks.
[0500] In some embodiments, the prediction unit 520 specifically: The refinement range is determined based on the size of the current block and the current candidate matching block.
[0501] In some embodiments, the prediction unit 520 specifically: The refinement range is determined to be (S / F)*H, centered on a block vector pointing from the current block to the current candidate matching block.
[0502] where / is a division operator, * is a multiplication operator, S is the matching step width adopted by the X candidate matching blocks, H is the height of the current block, and F is a positive integer.
[0503] In some embodiments, the prediction unit 520 specifically: The refinement range is determined based on a predefined numerical value.
[0504] In some embodiments, the prediction unit 520 specifically: When the current candidate matching block is the ith matching block among the X candidate matching blocks, and the jth matching block matched within the refinement range is the matching block with the smallest template error value among the previous j matching blocks within the refinement range, if the candidate matching blocks obtained by refining the previous i-1 candidate matching blocks among the X candidate matching blocks do not include the jth matching block, the jth matching block is determined to be the candidate matching block obtained by refining the current candidate matching block.
[0505] In some embodiments, the prediction unit 520 specifically: The X candidate matching blocks are pruned and refined to obtain the N available matching blocks.
[0506] In some embodiments, the prediction unit 520 specifically: After pruning the X candidate matching blocks, refining the pruned candidate matching blocks; or After refining the X candidate matching blocks, pruning the refined candidate matching blocks; or pruning the X candidate matching blocks once based on a current candidate matching block among the X candidate matching blocks, and then refining the current candidate matching block.
[0507] In some embodiments, the prediction unit 520 specifically: determining a fusion condition used by the N available matching blocks; and determining an available matching block that satisfies the fusion condition among the N available matching blocks as the at least one matching block.
[0508] In some embodiments, the prediction unit 520 specifically: The size of the template of the current block, sample and a minimum template error value of the N available matching blocks.
[0509] In some embodiments, the merging condition includes a first threshold, which is determined based on the size of the template of the current block and the bit width.
[0510] Here, the prediction unit 520 specifically: The method is configured to determine, as the at least one matching block, an available matching block among the N available matching blocks whose template error value is less than or equal to the first threshold value.
[0511] In some embodiments, the first threshold is determined by the following formula: T1=n1<<(b depth -n2)*n template where << is a left shift operator, - is a subtraction operator, * is a multiplication operator, T1 is the first threshold value, and b depth represents the bit width, and n template is in the template of the current block sample Both n1 and n2 are positive integers.
[0512] In some embodiments, the fusion condition includes a second threshold, and the second threshold is determined based on the minimum template error value. Here, the prediction unit 520 specifically: The method is configured to determine, as the at least one matching block, an available matching block among the N available matching blocks whose template error value is less than or equal to the second threshold value.
[0513] In some embodiments, the second threshold is determined by the following formula: T2=min SAD < <n3 where << is the left shift operator, T2 is the second threshold, and min SAD represents the minimum template error value, and n3 is a positive integer.
[0514] In some embodiments, the prediction unit 520 specifically: determining, based on the bitstream, indication information, the indication information being used to indicate the at least one matching block among the N available matching blocks; and determining the at least one matching block based on the indication information.
[0515] In some embodiments, the determining unit 530 may specifically: If the at least one matching block is a plurality of matching blocks, a weighting process is performed on the plurality of matching blocks to obtain a target prediction block of the current block.
[0516] In some embodiments, the determining unit 530 may specifically: determining a weight value for each matching block in the plurality of matching blocks; and and performing a weighting process on the plurality of matching blocks based on the weight value of each matching block to obtain the target prediction block.
[0517] In some embodiments, the determining unit 530 may specifically: The weight value for each matching block is determined based on the template error value of each matching block, the number of the plurality of matching blocks, and the sum of the weights of the plurality of matching blocks.
[0518] In some embodiments, the determining unit 530 may specifically: determining a third numerical value corresponding to each matching block based on the template error value of each matching block; adding the third numerical values corresponding to each matching block to obtain a fourth numerical value; and determining a weight value for each matching block based on the fourth numerical value and the template error value for each matching block.
[0519] In some embodiments, the determining unit 530 may specifically: If the template error value of the i-th matching block among the plurality of matching blocks is 0, determining a predetermined value greater than 0 as a third numerical value corresponding to the i-th matching block; and The template error value of the i-th matching block is 0. do not have if so, determining the template error value of the i-th matching block as a third numerical value corresponding to the i-th matching block.
[0520] In some embodiments, the determining unit 530 may specifically: The method is configured to determine a weight value of an i-th matching block in the plurality of matching blocks according to the following method: subtracting the third numerical value corresponding to the i-th matching block from the fourth numerical value to obtain a fifth numerical value; multiplying n-1 by the fourth number to obtain a sixth number, where n represents the number of matching blocks in the plurality of matching blocks; and determining a weight value for the i-th matching block based on the fifth numerical value and the sixth numerical value.
[0521] In some embodiments, the determining unit 530 may specifically: If the i-th matching block is not the last matching block among the plurality of matching blocks, determining a ratio of the fifth numerical value to the sixth numerical value as a weight value of the i-th matching block; and If the i-th matching block is the last matching block, the weight value of the last matching block is obtained by subtracting the weight values of the previous n-1 matching blocks in the plurality of matching blocks from the preset sum of weights.
[0522] In some embodiments, the determining unit 530 may specifically: The ratio of the fifth numerical value to the sixth numerical value is configured to be determined as the weight value of the i-th matching block.
[0523] Here, the sum of the weight values of the plurality of matching blocks is equal to a preset total weight.
[0524] In some embodiments, the ratio of the fifth number and the sixth number is a number obtained using bitwise, addition, and subtraction operations.
[0525] In some embodiments, the ratio of the fifth number to the sixth number is determined by the following formula: W i =(D5*V*W sum +D Add )>>D Shift where * is the multiplication operator, + is the addition operator, >> is the right shift operator, D5 represents the fifth number, and W sum represents the weighted sum, V represents a value determined by table lookup based on the seventh value, and D Shift represents a right shift amount calculated based on the seventh numerical value, and the seventh numerical value represents a numerical value determined based on the sixth numerical value, and D Add is D Shift It is a number determined based on the
[0526] In some embodiments, V and D ShiftThe following method,
number
number
[0527] In some embodiments, D Add =1<<(D Shift -1), or D Add =1< <D Shift where << is the left shift operator and - is the subtraction operator.
[0528] In some embodiments, the determining unit 530 may specifically: selecting, based on the number of the plurality of matching blocks, from a plurality of candidate sets, a first candidate set including a number of weight values equal to the number of the plurality of matching blocks, wherein each candidate set in the plurality of candidate sets includes at least one candidate weight value; and determining a weight value for each of the matching blocks based on the first candidate set.
[0529] In some embodiments, the template error value of each matching block and the weight value of each matching block are negatively correlated.
[0530] In some embodiments, the determining unit 530 may specifically: multiplying each matching block with its weight value and then adding the weighted values to obtain an eighth number; The eighth number is C offset to obtain a ninth number; and The 9th number is C to the right Shift and shifting the target prediction block to obtain the target prediction block.
[0531] where Cof fset is C Shift is a value determined based on C Shift is a numerical value determined based on the sum of the weight values of the plurality of matching blocks.
[0532] In some embodiments, C offset =1<<(C Shift -1),
number
number
[0533] In some embodiments, the determining unit 530 may specifically: Dividing the current block into a plurality of regions; determining, for a first region in the plurality of regions, a weight value in the first region for each matching block in the plurality of matching blocks; and and performing a weighting process on the plurality of matching blocks in the first region based on the weight value of each matching block in the first region to obtain a predicted value of the target predicted block in the first region.
[0534] Here, the target predicted block includes a predicted value for each region in the plurality of regions.
[0535] In some embodiments, the determining unit 530 may specifically: The current block is divided into a plurality of regions along the horizontal or vertical direction.
[0536] In some embodiments, the determining unit 530 may specifically: If the at least one matching block is a single matching block, predicting the current block using a first intra prediction mode to obtain a first predicted block; and and performing a weighting process on the single matching block and the first predicted block to obtain the target predicted block.
[0537] In some embodiments, the weight value of the single matching block and the weight value of the first prediction block are both predefined weight values.
[0538] In some embodiments, the determining unit 530 further comprises: The weight value of the single matching block and the weight value of the first predicted block are determined based on at least one of the decoding information of adjacent decoding blocks, the size of the current block, the template size of the current block, the type of the first intra prediction mode, and the position of each region of the current block.
[0539] In some embodiments, the determining unit 530 may specifically: If the at least one matching block is a plurality of matching blocks, predicting the current block using a second intra prediction mode to obtain a second predicted block; and and performing a weighting process on the plurality of matching blocks and the second predicted block to obtain the target predicted block.
[0540] In some embodiments, the weight value of the second predictive block is a predefined weight value.
[0541] In some embodiments, the determining unit 530 further comprises: The weight value of the second prediction block is determined based on at least one of the decoding information of adjacent decoding blocks, the size of the current block, the template size of the current block, the type of the second intra prediction mode, the sum of the weights of the multiple matching blocks, and the position of each region of the current block.
[0542] In some embodiments, the template for the current block is: Current block left side reconstruction sample , lower left reconstruction sample , upper left reconstruction sample , upper reconstruction sample , upper right side reconstruction sample It includes at least one of the following:
[0543] In some embodiments, the prediction unit 520 specifically: determining the limiting conditions under which the IntraTMP mode is used; and If the constraint condition is met, predicting the at least one matching block based on the IntraTMP mode.
[0544] 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 decoded blocks, a sequence level flag bit, a frame level flag bit, a macroblock level flag bit, the type of slice to which the current block belongs, or the frame type of the image frame to which the current block belongs.
[0545] FIG. 14 is a schematic block diagram of an encoder 600 according to an embodiment of the present invention.
[0546] As shown in FIG. 14, the encoder 600 a prediction unit 610 configured to predict at least one matching block of a current block in a current sequence based on an intra-template matching prediction (IntraTMP) mode; a determining unit 620 configured to determine a target prediction block of the current block based on the at least one matching block; a residual unit 630 configured to obtain a residual block for the current block based on the target predicted block and the original block for the current block; and and an encoding unit 640 configured to encode a residual block of the current block.
[0547] In some embodiments, the encoding unit 640 further comprises: configured to encode the first identifier.
[0548] Here, the first identifier indicates that fusion prediction is to be performed using the IntraTMP mode.
[0549] In some embodiments, the encoding unit 640 further comprises: configured to encode the second identifier.
[0550] Here, the second identifier indicates that the prediction is to be made using the IntraTMP mode.
[0551] In some embodiments, the encoding unit 640 specifically: determining a target context index; and encoding the first identifier using the target context index.
[0552] In some embodiments, the encoding unit 640 specifically: Determining the target context index based on coding information of neighboring coding blocks of the current block; and / or determining the target context index based on a size of the current block.
[0553] In some embodiments, the coordinates of the current block are (x, y), and the neighboring coding blocks include a first coding block with coordinates (x-1, y) and a second coding block with coordinates (x, y-1), where the coding information of the first coding block includes a prediction mode used by a prediction block of the first coding block, and the coding information of the second coding block includes a prediction mode used by a prediction block of the second coding block.
[0554] Here, the encoding unit 640 specifically: If a prediction mode used by a prediction block of the first coding block is a mode in which fusion prediction is performed based on the IntraTMP mode, assign A to a first numerical value; otherwise, assign B to the first numerical value (both A and B are integers); If the prediction mode used by the prediction block of the second coding block is a prediction mode that performs fusion prediction based on the IntraTMP mode, assign C to the second numerical value; otherwise, assign D to the second numerical value (C and D are both integers); and determining the sum of the first numerical value and the second numerical value as the target context index.
[0555] In some embodiments, the prediction unit 610 specifically: performing template matching on the current block based on the IntraTMP mode to obtain X candidate matching blocks; and determining the at least one matching block based on the X candidate matching blocks.
[0556] In some embodiments, the prediction unit 610 specifically: According to the IntraTMP mode, performing intra-template matching within a search area of the current block to obtain all candidate matching blocks of the current block; and and determining the matching blocks arranged in the first X positions in ascending order of template error value as the X candidate matching blocks.
[0557] In some embodiments, the prediction unit 610 specifically: Based on the IntraTMP mode, a candidate matching block list is constructed, and the candidate matching block list is used to store X matching blocks with the smallest template error value that are matched when performing intra-template matching within the search area of the current block.
[0558] In some embodiments, the prediction unit 610 specifically: Dividing the search area of the current block into Y sub-areas; and The method is configured to perform intra-template matching within each sub-region of the Y sub-regions based on the IntraTMP mode to obtain a candidate matching block within each sub-region.
[0559] Here, the X candidate matching blocks include candidate matching blocks in each of the sub-regions.
[0560] In some embodiments, X=Y, or X is a multiple of Y.
[0561] In some embodiments, the prediction unit 610 specifically: determining N available matching blocks based on the X candidate matching blocks (X≧N); and determining the at least one matching block based on the N available matching blocks.
[0562] In some embodiments, X is a multiple of N.
[0563] In some embodiments, the prediction unit 610 specifically: The method is configured to prune the X candidate matching blocks based on the spacing between the X candidate matching blocks to obtain the N available matching blocks.
[0564] In some embodiments, the prediction unit 610 specifically: determining a current candidate matching block to be used for pruning among the X candidate matching blocks according to the ascending order of template error values; determining a pruning range for the current candidate matching block; and The method is configured to remove other candidate matching blocks within the pruning range except for the current candidate matching block to obtain candidate matching blocks remaining after pruning the current candidate matching block, until the number of pruning of the X candidate matching blocks reaches N, and determine the N candidate matching blocks before the remaining candidate matching block as the N available matching blocks, or until the number of candidate matching blocks remaining after pruning the current candidate matching block is N or less, and determine the N candidate matching blocks before among the candidate matching blocks remaining after the previous pruning as the N available matching blocks.
[0565] In some embodiments, the prediction unit 610 specifically: The pruning range is configured to be determined based on the size of the current block and the current candidate matching block.
[0566] In some embodiments, the prediction unit 610 specifically: The pruning range is determined to be (S / E)*H, centered on a block vector pointing from the current block to the current candidate matching block.
[0567] where / is a division operator, * is a multiplication operator, S is the matching step width adopted by the X candidate matching blocks, H is the height of the current block, and E is a positive integer.
[0568] In some embodiments, the prediction unit 610 specifically: The pruning range is determined based on a predefined numerical value.
[0569] In some embodiments, the prediction unit 610 specifically: The X candidate matching blocks are refined to obtain the N available matching blocks.
[0570] In some embodiments, the prediction unit 610 specifically: determining a refinement range for a current candidate matching block among the X candidate matching blocks; performing intra-template matching within the refinement range based on at least one matching step width to obtain matching blocks matched within the refinement range, wherein each step width among the at least one matching step width is smaller than the matching step widths adopted by the X candidate matching blocks; determining a matching block having a minimum template error value among the matching blocks matched within the refinement range as a candidate matching block obtained by refining the current candidate matching block; and determining a candidate matching block obtained by refining the current candidate matching block as an available matching block among the N available matching blocks.
[0571] In some embodiments, the prediction unit 610 specifically: The refinement range is configured to be determined based on the size of the current block and the current candidate matching block.
[0572] In some embodiments, the prediction unit 610 specifically: The refinement range is determined to be (S / F)*H, centered on a block vector pointing from the current block to the current candidate matching block.
[0573] where / is a division operator, * is a multiplication operator, S is the matching step width adopted by the X candidate matching blocks, H is the height of the current block, and F is a positive integer.
[0574] In some embodiments, the prediction unit 610 specifically: The refinement range is determined based on a predefined numerical value.
[0575] In some embodiments, the prediction unit 610 specifically: When the current candidate matching block is the ith matching block among the X candidate matching blocks, and the jth matching block matched within the refinement range is the matching block with the smallest template error value among the previous j matching blocks within the refinement range, if the candidate matching blocks obtained by refining the previous i-1 candidate matching blocks among the X candidate matching blocks do not include the jth matching block, the jth matching block is determined to be the candidate matching block obtained by refining the current candidate matching block.
[0576] In some embodiments, the prediction unit 610 specifically: The X candidate matching blocks are pruned and refined to obtain the N available matching blocks.
[0577] In some embodiments, the prediction unit 610 specifically: After pruning the X candidate matching blocks, refine the pruned candidate matching blocks; or After refining the X candidate matching blocks, pruning the refined candidate matching blocks; or The method is configured to prune the X candidate matching blocks once based on a current candidate matching block among the X candidate matching blocks, and then refine the current candidate matching block.
[0578] In some embodiments, the prediction unit 610 specifically: determining a fusion condition used by the N available matching blocks; and and determining, as the at least one matching block, an available matching block that satisfies the fusion condition among the N available matching blocks.
[0579] In some embodiments, the prediction unit 610 specifically: The size of the template of the current block, sample and a minimum template error value of the N available matching blocks.
[0580] In some embodiments, the merging condition includes a first threshold, which is determined based on the size of the template of the current block and the bit width.
[0581] Here, the prediction unit 610 specifically: The method is configured to determine, as the at least one matching block, an available matching block among the N available matching blocks whose template error value is less than or equal to the first threshold value.
[0582] In some embodiments, the first threshold is determined by the following formula: T1=n1<<(b depth -n2)*n template where << is a left shift operator, - is a subtraction operator, * is a multiplication operator, T1 is the first threshold value, and b depth represents the bit width, and n template is in the template of the current block sample Both n1 and n2 are positive integers.
[0583] In some embodiments, the fusion condition includes a second threshold, and the second threshold is determined based on the minimum template error value. The method is configured to determine, as the at least one matching block, an available matching block among the N available matching blocks whose template error value is less than or equal to the second threshold value.
[0584] In some embodiments, the second threshold is determined by the following formula: T2=min SAD < <n3 where << is the left shift operator, T2 is the second threshold, and min SAD represents the minimum template error value, and n3 is a positive integer.
[0585] In some embodiments, the encoding unit 640 further comprises: determining indication information, the indication information being used to indicate the at least one matching block among the N available matching blocks; and and encoding the indication information.
[0586] In some embodiments, the determining unit 620 may specifically: If the at least one matching block is a plurality of matching blocks, a weighting process is performed on the plurality of matching blocks to obtain a target prediction block of the current block.
[0587] In some embodiments, the determining unit 620 may specifically: determining a weight value for each matching block in the plurality of matching blocks; and and performing a weighting process on the plurality of matching blocks based on the weight value of each matching block to obtain the target prediction block.
[0588] In some embodiments, the determining unit 620 may specifically: The weight value for each matching block is determined based on the template error value of each matching block, the number of the plurality of matching blocks, and the sum of the weights of the plurality of matching blocks.
[0589] In some embodiments, the determining unit 620 may specifically: determining a third numerical value corresponding to each matching block based on the template error value of each matching block; adding the third numerical values corresponding to each matching block to obtain a fourth numerical value; and determining a weight value for each matching block based on the fourth numerical value and the template error value for each matching block.
[0590] In some embodiments, the determining unit 620 may specifically: If the template error value of the i-th matching block among the plurality of matching blocks is 0, determining a predetermined value greater than 0 as a third numerical value corresponding to the i-th matching block; and If the template error value of the i-th matching block is not 0, determining the template error value of the i-th matching block as a third numerical value corresponding to the i-th matching block.
[0591] In some embodiments, the determining unit 620 may specifically: The method is configured to determine a weight value of an i-th matching block in the plurality of matching blocks according to the following method: subtracting the third number corresponding to the i-th matching block from the fourth number to obtain a fifth number; multiplying n-1 by the fourth number to obtain a sixth number, where n represents the number of matching blocks in the plurality of matching blocks; and determining a weight value of the i-th matching block based on the fifth numerical value and the sixth numerical value.
[0592] In some embodiments, the determining unit 620 may specifically: If the i-th matching block is not the last matching block among the plurality of matching blocks, determining a ratio of the fifth numerical value to the sixth numerical value as a weight value of the i-th matching block; and If the i-th matching block is the last matching block, the weight value of the last matching block is obtained by subtracting the weight values of the previous n-1 matching blocks in the plurality of matching blocks from the preset sum of weights.
[0593] In some embodiments, the determining unit 620 may specifically: The ratio of the fifth numerical value to the sixth numerical value is configured to be determined as the weight value of the i-th matching block.
[0594] Here, the sum of the weight values of the plurality of matching blocks is equal to a preset total weight.
[0595] In some embodiments, the ratio of the fifth number and the sixth number is a number obtained using bitwise, addition, and subtraction operations.
[0596] In some embodiments, the ratio of the fifth number to the sixth number is expressed by the formula: W i =(D5*V*W sum +D Add )>>D Shift where * is the multiplication operator, + is the addition operator, >> is the right shift operator, D5 represents the fifth number, and W sum represents the weighted sum, V represents a value determined by table lookup based on the seventh value, and D Shift represents a right shift amount calculated based on the seventh numerical value, and the seventh numerical value represents a numerical value determined based on the sixth numerical value, and D Add is D Shift It is a number determined based on the
[0597] In some embodiments, V and D Shift The following method,
number
number
[0598] In some embodiments, D Add =1<<(DShift -1), or D Add =1< <D Shift where << is the left shift operator and - is the subtraction operator.
[0599] In some embodiments, the determining unit 620 may specifically: selecting, based on the number of the plurality of matching blocks, from a plurality of candidate sets, a first candidate set including a number of weight values equal to the number of the plurality of matching blocks, wherein each candidate set in the plurality of candidate sets includes at least one candidate weight value; and determining a weight value for each of the matching blocks based on the first candidate set.
[0600] In some embodiments, the template error value of each matching block and the weight value of each matching block are negatively correlated.
[0601] In some embodiments, the determining unit 620 may specifically: multiplying each matching block with its weight value and then adding them to obtain an eighth number; The eighth number is C offset to obtain a ninth number; and The 9th number is C to the right Shift and shifting the target prediction block to obtain the target prediction block.
[0602] where 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 values of the plurality of matching blocks.
[0603] In some embodiments, C offset =1<<(C Shift -1),
number
number
[0604] In some embodiments, the determining unit 620 may specifically: Dividing the current block into a plurality of regions; determining, for a first region in the plurality of regions, a weight value in the first region for each matching block in the plurality of matching blocks; and and performing a weighting process on the plurality of matching blocks in the first region based on the weight value of each matching block in the first region to obtain a predicted value of the target predicted block in the first region.
[0605] Here, the target predicted block includes a predicted value for each region in the plurality of regions.
[0606] In some embodiments, the determining unit 620 may specifically: The current block is divided into a plurality of regions along the horizontal or vertical direction.
[0607] In some embodiments, the determining unit 620 may specifically: If the at least one matching block is a single matching block, predicting the current block using a first intra prediction mode to obtain a first predicted block; and and performing a weighting process on the single matching block and the first predicted block to obtain the target predicted block.
[0608] In some embodiments, the weight value of the single matching block and the weight value of the first prediction block are both predefined weight values.
[0609] In some embodiments, the determining unit 620 further comprises: The weight value of the single matching block and the weight value of the first predictive block are determined based on at least one of the coding information of the neighboring coding blocks, the size of the current block, the template size of the current block, the type of the first intra prediction mode, and the position of each region of the current block.
[0610] In some embodiments, the determining unit 620 may specifically: If the at least one matching block is a plurality of matching blocks, predicting the current block using a second intra prediction mode to obtain a second predicted block; and and performing a weighting process on the plurality of matching blocks and the second predicted block to obtain the target predicted block.
[0611] In some embodiments, the weight value of the second predictive block is a predefined weight value.
[0612] In some embodiments, the determining unit 620 further comprises: The weight value of the second prediction block is determined based on at least one of the coding information of the neighboring coding blocks, the size of the current block, the template size of the current block, the type of the second intra prediction mode, the sum of the weights of the multiple matching blocks, and the position of each region of the current block.
[0613] In some embodiments, the template for the current block is: Current block left side reconstruction sample , lower left reconstruction sample , upper left reconstruction sample , upper reconstruction sample , upper right side reconstruction sample It includes at least one of the following:
[0614] In some embodiments, the prediction unit 610 specifically: determining the limiting conditions under which the IntraTMP mode is used; and If the constraint condition is met, predicting the at least one matching block based on the IntraTMP mode.
[0615] In some embodiments, the constraint is obtained by at least one of the following: the size of the current block, the coding information of neighboring coding blocks, a sequence level flag bit, a frame level flag bit, a macroblock level flag bit, the type of slice to which the current block belongs, or the frame type of the image frame to which the current block belongs.
[0616] It should be noted that the apparatus embodiments and the method embodiments may correspond to each other, and similar descriptions may refer to the method embodiments. To avoid repetition, further details will not be provided here. Specifically, the decoder 500 shown in FIG. 13 may correspond to an entity that performs the method 300 of the present invention, and the above-mentioned and other operations and / or functions of each unit in the decoder 500 are for implementing the corresponding process in each method, such as the method 300. Similarly, the encoder 600 shown in FIG. 14 may correspond to an entity that performs the method 400 of the present invention, i.e., the above-mentioned and other operations and / or functions of each unit in the encoder 600 are for implementing the corresponding process in each method, such as the method 400.
[0617] Furthermore, each unit in the decoder 500 or encoder 600 according to the embodiments of the present invention may be integrated into one or more other units, or some of the units may be further divided into multiple smaller units, which can perform the same operation and do not affect the technical effects of the embodiments of the present invention. The above-mentioned 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. According to other embodiments of the present invention, the decoder 500 or encoder 600 may include other units, and in actual applications, these functions may be realized by other units or multiple units working together. According to another embodiment of the present invention, the decoder 500 or encoder 600 according to the embodiments of the present invention may be constructed and the encoding method or decoding method according to the embodiments of the present invention may be realized by executing a computer program (including program code) capable of executing each step of the corresponding method on a general-purpose computing device such as a general-purpose computer including processing elements and storage elements, such as a central processing unit (CPU), a random access memory (RAM), and a read-only memory (ROM). The computer program can be recorded in, for example, a computer-readable storage medium, and can be implemented in an electronic device via the computer-readable storage medium and executed therein to realize the corresponding method of the embodiments of the present invention.
[0618] In other words, the above-mentioned units may be implemented in hardware, or by software instructions, or even by a combination of software and hardware. Specifically, each step of the method embodiments according to the present invention may be performed by a hardware integrated logic circuit in a processor and / or by software instructions. The steps of the method disclosed in the embodiments of the present invention may be directly executed and completed by a hardware decoding processor, or may be executed and completed by a combination of hardware and software in the decoding processor. Alternatively, the software may be located in a storage medium well-established in the art, such as a random memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above-mentioned method embodiments in combination with the hardware.
[0619] figure 15 7 is a structural schematic diagram of an electronic device 700 according to an embodiment of the present invention.
[0620] figure 15 As shown in FIG. 7, 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 can be connected by a bus or other means. The computer-readable storage medium 720 is used to store a computer program 721, which includes computer instructions, and the processor 710 is used to execute the computer instructions stored in the computer-readable storage medium 720. The processor 710 is a calculation core and a control core of the electronic device 700, and is suitable for implementing one or more computer instructions, specifically, for implementing a corresponding method process or a corresponding function by loading and executing one or more computer instructions.
[0621] By way of example, processor 710 may also be referred to as a central processing unit (CPU), including, but 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 gate or transistor logic device, a discrete hardware component, etc.
[0622] For example, the computer-readable storage medium 720 may be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. Optionally, the computer-readable storage medium 720 may be a computer-readable storage medium remote from the at least one processor 710. Specifically, the computer-readable storage medium 720 includes, but is not limited to, a volatile memory and / or a non-volatile memory. Here, the non-volatile memory may be a read-only memory (ROM), a programmable ROM (PROM), an erasable programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), used as an external high-speed cache. By way of example, but not limitation, many types of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synch link DRAM (SLDRAM), and direct Rambus RAM (DR RAM).
[0623] In one embodiment, the electronic device 700 may be an encoder or encoding framework according to an embodiment of the present invention. A first computer instruction is stored in the computer-readable storage medium 720. The processor 710 loads and executes the first computer instruction stored in the computer-readable storage medium 720 to implement a corresponding step in the encoding method according to an embodiment of the present invention. In other words, the first computer instruction in the computer-readable storage medium 720 is loaded by the processor 710 to execute the corresponding step. To avoid redundancy, the first computer instruction will not be described in further detail here.
[0624] In one embodiment, the electronic device 700 may be a decoder or decoding framework according to an embodiment of the present invention. Second computer instructions are stored in the computer-readable storage medium 720. The processor 710 loads and executes the second computer instructions stored in the computer-readable storage medium 720 to implement corresponding steps in the decoding method according to an embodiment of the present invention. In other words, the second computer instructions in the computer-readable storage medium 720 are loaded by the processor 710 to execute the corresponding steps. To avoid repetition, they will not be described in further detail here.
[0625] According to another aspect of the present invention, an embodiment of the present invention further provides an encoding system, including the encoder and decoder described above.
[0626] According to another aspect of the present invention, an embodiment of the present invention 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, the 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, and 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 further stores one or more computer instructions, which may be one or more computer programs 721 (including program code), that are loaded and executed by the processor 710.
[0627] According to another aspect of the present invention, there is provided a computer program product or a computer program, which includes computer instructions 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 a processor 710 reads the computer instructions from the computer-readable storage medium 720 and executes the computer instructions to cause the computer to perform the encoding or decoding method according to each of the above-mentioned alternative schemes.
[0628] In other words, when implemented in software, it can be implemented in whole or in part 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 on a computer, the process or function of the embodiment of the present invention is executed 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 can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from a website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, radio, microwave, etc.) methods.
[0629] Those skilled in the art will recognize that the units and process steps of each example described in the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software is determined by the specific application and design constraints of the technical solution. Professionals may implement the described functions using different methods for each specific application, but such implementation should not be considered to exceed the protection scope of the present invention.
[0630] It should be noted that the above content is merely a specific embodiment of the present invention, and the scope of protection of the present invention is not limited thereto. Any modifications or alternatives that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be regulated by the claims.
Claims
1. 1. A decoding method comprising: determining a residual block of a current block in a current sequence based on the bitstream; predicting at least one matching block of the current block based on an intra-template matching prediction (IntraTMP) mode; determining a target prediction block for the current block based on the at least one matching block; and 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 predicting at least one matching block of the current block based on an intra-template matching prediction (IntraTMP) mode includes: determining a first identifier based on the bitstream; and and if the first identifier indicates that fusion prediction is to be performed using the IntraTMP mode, predicting the at least one matching block based on the IntraTMP mode.
2. The method of claim 1 .
3. Determining a first identifier based on the bitstream, determining a second identifier based on the bitstream; and and determining the first identifier based on the bitstream if the second identifier indicates that prediction is to be performed using the IntraTMP mode.
3. The method of claim 2.
4. Determining a first identifier based on the bitstream, determining a target context index; and determining the first identifier based on the bitstream using the target context index.
3. The method of claim 2.
5. As mentioned above, determining the target context index may include: 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 method of 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 decoding information of the first decoded block includes a prediction mode used by a predicted block of the first decoded block, and the decoding information of the second decoded block includes a prediction mode used by a predicted block of the second decoded block; The determining the target context index based on decoding information of adjacent decoding blocks of the current block includes: If a prediction mode used by the prediction block of the first decoded block is a mode in which a fusion prediction mode is performed based on the IntraTMP mode, A is substituted into a first numerical value, and otherwise, B is substituted into the first numerical value, where A and B are both integers; If the prediction mode used by the prediction block of the second decoded block is a prediction mode that performs fusion prediction mode based on the IntraTMP mode, assign C to the second numerical value; otherwise, assign D to the second numerical value, where C and D are both integers; and determining the sum of the first and second numerical values as the target context index.
6. The method of claim 5.
7. The step of predicting at least one matching block of the current block based on an intra-template matching prediction (IntraTMP) mode includes: performing template matching on the current block based on the IntraTMP mode to obtain X candidate matching blocks; and determining the at least one matching block based on the X candidate matching blocks.
7. The method according to any one of claims 1 to 6.
8. The above-mentioned method of performing template matching on the current block based on the IntraTMP mode to obtain X candidate matching blocks includes: performing intra-template matching within a search area of the current block according to the IntraTMP mode to obtain all candidate matching blocks of the current block; and determining the X candidate matching blocks as the X matching blocks arranged in ascending order of template error value.
8. The method of claim 7.
9. The above-mentioned method of performing template matching on the current block based on the IntraTMP mode to obtain X candidate matching blocks includes: building a candidate matching block list based on the IntraTMP mode; The candidate matching block list is used to store X matching blocks that match when performing intra-template matching within the search area of the current block and have the smallest template error value.
8. The method of claim 7.
10. The above-mentioned method of performing template matching on the current block based on the IntraTMP mode to obtain X candidate matching blocks includes: Dividing the search area of the current block into Y sub-areas; and performing intra-template matching within each of the Y sub-regions based on the IntraTMP mode to obtain candidate matching blocks within each of the Y sub-regions; Here, the X candidate matching blocks include candidate matching blocks in each of the sub-regions.
10. The method of claim 9.
11. X=Y or X is a multiple of Y 11. The method of claim 10.
12. determining the at least one matching block based on the X candidate matching blocks includes: determining N available matching blocks based on the X candidate matching blocks, where X≧N; and determining the at least one matching block based on the N available matching blocks.
12. The method according to any one of claims 7 to 11.
13. X is a multiple of N 13. The method of claim 12.
14. Determining N available matching blocks based on the X candidate matching blocks includes: pruning the X candidate matching blocks based on spacing between the X candidate matching blocks to obtain the N available matching blocks.
13. The method of claim 12.
15. The step of pruning the X candidate matching blocks based on the intervals between the X candidate matching blocks to obtain the N available matching blocks includes: determining a current candidate matching block to be used for pruning from among the X candidate matching blocks in ascending order of template error value; determining a pruning range for the current candidate matching block; and removing other candidate matching blocks except the current candidate matching block within the pruning range to obtain candidate matching blocks remaining after pruning the current candidate matching block, until the number of pruning of the X candidate matching blocks reaches N, and determining N candidate matching blocks preceding the remaining candidate matching block as the N available matching blocks, or performing this until the number of candidate matching blocks remaining after pruning the current candidate matching block becomes N or less, and determining N candidate matching blocks preceding the remaining candidate matching block as the N available matching blocks.
15. The method of claim 14.
16. The step of determining a pruning range of the current candidate matching block includes: determining the pruning range based on a size of the current block and the current candidate matching block.
16. The method of claim 15.
17. determining the pruning range based on the size of the current block and the current candidate matching block; determining (S / E)*H as the pruning range centered on a block vector pointing from the current block to the current candidate matching block; where / is a division operator, * is a multiplication operator, S is a matching step width adopted by the X candidate matching blocks, H is the height of the current block, and E is a positive integer.
17. The method of claim 16.
18. The step of determining a pruning range of the current candidate matching block includes: determining the pruning range based on a predefined value.
16. The method of claim 15.
19. Determining N available matching blocks based on the X candidate matching blocks includes: refining the X candidate matching blocks to obtain the N available matching blocks.
13. The method of claim 12.
20. The step of refining the X candidate matching blocks to obtain the N available matching blocks includes: determining a refinement range for a current candidate matching block among the X candidate matching blocks; performing intra-template matching within the refinement range based on at least one matching step width to obtain matching blocks matched within the refinement range, wherein each step width of the at least one matching step width is smaller than the matching step widths adopted by the X candidate matching blocks; determining a matching block with a minimum template loss value among the matching blocks matched within the refinement range as a candidate matching block obtained by refining the current candidate matching block; and determining a candidate matching block obtained by refining the current candidate matching block as an available matching block among the N available matching blocks.
20. The method of claim 19.
21. The step of determining a refinement range of the current candidate matching block among the X candidate matching blocks includes: determining the refinement range based on the size of the current block and the current candidate matching block.
21. The method of claim 20.
22. The step of determining the refinement range based on the size of the current block and the current candidate matching block includes: determining (S / F)*H as the refinement range centered on a block vector pointing from the current block to the current candidate matching block; where / is a division operator, * is a multiplication operator, S is a matching step width adopted by the X candidate matching blocks, H is the height of the current block, and F is a positive integer.
22. The method of claim 21 .
23. The step of determining a refinement range of the current candidate matching block among the X candidate matching blocks includes: determining the refinement range based on a predefined value.
21. The method of claim 20.
24. The step of determining the matching block having the smallest template loss value among the matching blocks matched within the refinement range as the candidate matching block obtained by refining the current candidate matching block includes: When the current candidate matching block is the ith matching block among the X candidate matching blocks, and the jth matching block matched within the refinement range is the matching block with the smallest template loss value among the jth matching blocks within the refinement range, if candidate matching blocks obtained by refining the (i-1)th candidate matching blocks among the X candidate matching blocks do not include the jth matching block, determining the jth matching block as the candidate matching block obtained by refining the current candidate matching block.
21. The method of claim 20.
25. Determining N available matching blocks based on the X candidate matching blocks includes: pruning and refining the X candidate matching blocks to obtain the N available matching blocks.
13. The method of claim 12.
26. The pruning and refining of the X candidate matching blocks to obtain the N available matching blocks may include: After pruning the X candidate matching blocks, refining the pruned candidate matching blocks; or After refining the X candidate matching blocks, pruning the refined candidate matching blocks; or pruning the X candidate matching blocks once based on a current candidate matching block among the X candidate matching blocks, and then refining the current candidate matching block.
26. The method of claim 25.
27. Determining the at least one matching block based on the N available matching blocks includes: determining a fusion condition used by the N available matching blocks; and determining an available matching block among the N available matching blocks that satisfies the fusion condition as the at least one matching block.
27. The method according to any one of claims 12 to 26.
28. The step of determining the fusion conditions used by the N available matching blocks includes: determining the merging condition based on at least one of a template size of the current block, a bit width of pixels in the current block, and a minimum template error value of the N available matching blocks.
28. The method of claim 27.
29. the merging condition includes a first threshold, the first threshold being determined based on a size of a template of the current block and the bit width; The step of determining an available matching block that satisfies the fusion condition among the N available matching blocks as the at least one matching block includes the steps of: determining, as the at least one matching block, an available matching block among the N available matching blocks whose template error value is equal to or less than the first threshold.
29. The method of claim 28.
30. The first threshold value is T 1 =n 1 <<(b depth -n 2 )*n template where << is the left shift operator, − is the subtraction operator, * is the multiplication operator, and T 1 is the first threshold, b depth is the bit width, n template is the number of pixels in the template of the current block, n 1 and n 2 is a positive integer 30. The method of claim 29.
31. the fusion condition includes a second threshold value, the second threshold value being determined based on the minimum template error value; The step of determining an available matching block that satisfies the fusion condition among the N available matching blocks as the at least one matching block includes the steps of: determining, as the at least one matching block, an available matching block among the N available matching blocks whose template error value is equal to or less than the second threshold.
31. The method according to any one of claims 28 to 30.
32. The second threshold value is () 2 m) SAD <| 3 where << is the left shift operator, T 2 is the second threshold, min SAD is the minimum template error value, n 3 is a positive integer 32. The method of claim 31 .
33. Determining the at least one matching block based on the N available matching blocks includes: determining indication information based on the bitstream, the indication information being used to indicate the at least one matching block from among the N available matching blocks; and determining the at least one matching block based on the indication.
27. The method according to any one of claims 12 to 26.
34. Determining the target prediction block based on the at least one matching block includes: and if the at least one matching block is a plurality of matching blocks, performing a weighting process on the plurality of matching blocks to obtain a target predicted block of the current block.
34. The method of any one of claims 1 to 33.
35. The weighting process for the plurality of matching blocks to obtain the target prediction block is performed as follows: determining a weight value for each matching block of the plurality of matching blocks; and performing a weighting process on the plurality of matching blocks based on a weight value of each matching block to obtain the target predicted block.
35. The method of claim 34.
36. Determining a weight value for each of the plurality of matching blocks includes: determining a weight value for each matching block based on a template error value for each matching block, the number of the plurality of matching blocks, and a sum of weights for the plurality of matching blocks.
36. The method of claim 35.
37. determining a weight value for each matching block based on the template error value of each matching block, the number of the plurality of matching blocks, and the sum of weights of the plurality of matching blocks; determining a third numerical value corresponding to each matching block based on the template error value of each matching block; adding the third numerical values corresponding to each matching block to obtain a fourth numerical value; and determining a weight value for each of the matching blocks based on the fourth numerical value and a template error value for each of the matching blocks.
37. The method of claim 36.
38. determining a third numerical value corresponding to each matching block based on the template error value of each matching block; If the template error value of the i-th matching block among the plurality of matching blocks is 0, determining a predetermined value greater than 0 as a third numerical value corresponding to the i-th matching block; and If the template error value of the i-th matching block is 0, determining the template error value of the i-th matching block as a third numerical value corresponding to the i-th matching block.
38. The method of claim 37.
39. determining a weight value for each matching block based on the fourth numerical value and a template error value for each matching block; subtracting the third number corresponding to the i-th matching block from the fourth number to obtain a fifth number; multiplying the fourth number by n-1 to obtain a sixth number, where n represents the number of matching blocks; determining a weight value of the i-th matching block among the plurality of matching blocks according to a formula including: determining a weight value of the i-th matching block based on the fifth numerical value and the sixth numerical value.
38. The method of claim 37.
40. determining a weight value of the i-th matching block based on the fifth and sixth numerical values, If the i-th matching block is not the last matching block among the plurality of matching blocks, determining a ratio of the fifth numerical value to the sixth numerical value as a weight value of the i-th matching block; and If the i-th matching block is the last matching block, subtracting weight values of the previous n-1 matching blocks from a predetermined weight sum to obtain a weight value of the last matching block.
40. The method of claim 39.
41. determining a weight value of the i-th matching block based on the fifth and sixth numerical values; determining a ratio of the fifth numerical value to the sixth numerical value as a weight value of the i-th matching block; Here, the sum of the weight values of the plurality of matching blocks is equal to a preset total weight.
40. The method of claim 39.
42. The ratio of the fifth number to the sixth number is a number obtained by bit operations, addition operations, and subtraction operations.
42. The method of claim 40 or 41.
43. The ratio of the fifth numerical value to the sixth numerical value is W i =(D 5 *V*W sum +D Add )>>D Shift where * is the multiplication operator, + is the addition operator, >> is the right shift operator, and D 5 is the fifth number, W sum is the weight sum, V is a value determined by table lookup based on the seventh value, D Shift is a right shift amount calculated based on the seventh numerical value, the seventh numerical value is a numerical value determined based on the sixth numerical value, D Add is D Shift is a number determined based on 43. The method of claim 42.
44. V and D Shift teeth, [Equation 1] D 7 =((n-1)*D 4 <<4>>X)&15 V=table[D 7 ]|8 X=D 7 ==0?X:X+1 D Shift =X+3 is determined according to the formula: [Equation 2] is the rounding operator, * is the multiplication operator, << is the left shift operator, >> is the right shift operator, & is the logical product operator, | is the logical sum operator, ? is the conditional operator, + is the addition operator, and D 6 is the sixth numerical value, D 4 is the fourth numerical value, table[ ] is a table reference, D 7 represents the seventh numerical value 44. The method of claim 43.
45. D Add = 1 << (D Shift -1) or D Add = 1 << D Shift and where << is the left shift operator and - is the subtraction operator 44. The method of claim 43.
46. Determining a weight value for each of the plurality of matching blocks includes: selecting, based on the number of the plurality of matching blocks, from a plurality of candidate sets, a first candidate set including a number of weight values equal to the number of the plurality of matching blocks, wherein each candidate set among the plurality of candidate sets includes at least one candidate weight value; and determining a weight value for each of the matching blocks based on the first candidate set.
36. The method of claim 35.
47. The template error value of each matching block and the weight value of each matching block are negatively correlated.
47. The method of claim 46.
48. The weighting process for the plurality of matching blocks based on the weight value of each matching block to obtain the target prediction block is performed by: multiplying each matching block's weight value by each matching block and then summing to obtain an eighth number; Add C to the eighth number offset to obtain a ninth number; and The ninth number is C to the right Shift shifting the target predicted block to obtain the target predicted 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 values of the plurality of matching blocks 35. The method of claim 34.
49. C offset =1<<(C Shift -1)、 [Equation 3] and where: [Equation 4] is the rounding operator, << is the left shift operator, W sum represents the sum of the weight values of the multiple matching blocks 49. The method of claim 48.
50. The weighting process for the plurality of matching blocks to obtain a target predicted block for the current block is performed as follows: Dividing the current block into a plurality of regions; determining a weight value for each matching block of the plurality of matching blocks in a first region of the plurality of regions; and performing a weighting process on the plurality of matching blocks in the first region based on a weight value of each of the matching blocks in the first region to obtain a predicted value of the target predicted block in the first region; Here, the target predicted block includes a predicted value for each of the plurality of regions.
35. The method of claim 34.
51. The above-mentioned dividing the current block into a plurality of regions includes: dividing the current block into a plurality of regions along a horizontal or vertical direction.
51. The method of claim 50.
52. Determining the target prediction block based on the at least one matching block includes: If the at least one matching block is a single matching block, predicting the current block using a first intra prediction mode to obtain a first predicted block; and performing a weighting process on the single matching block and the first predicted block to obtain the target predicted block.
34. The method of any one of claims 1 to 33.
53. The weight value of the single matching block and the weight value of the first prediction block are predefined weight values.
53. The method of claim 52.
54. The method comprises: determining a weight value of the single matching block and a weight value of the first predicted 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 intra prediction mode, and a position of each region of the current block.
53. The method of claim 52.
55. determining a target predicted block of the current block based on the at least one matching block, If the at least one matching block is a plurality of matching blocks, predicting the current block using a second intra prediction mode to obtain a second predicted block; and performing a weighting process on the plurality of matching blocks and the second predicted block to obtain the target predicted block.
34. The method of any one of claims 1 to 33.
56. The weight value of the second predicted block is a predefined weight value.
56. The method of claim 55.
57. The method comprises: determining a weight value 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 second intra prediction mode, a weight sum of the plurality of matching blocks, and a position of each region of the current block.
56. The method of claim 55.
58. The template for the current block includes at least one of a left reconstructed pixel, a lower left reconstructed pixel, an upper left reconstructed pixel, an upper reconstructed pixel, and an upper right reconstructed pixel.
58. The method of any one of claims 1 to 57.
59. The step of predicting at least one matching block of the current block based on an intra-template matching prediction (IntraTMP) mode includes: determining a limiting condition for using the IntraTMP mode; and and if the constraint condition is satisfied, predicting the at least one matching block based on the IntraTMP mode.
59. The method of any one of claims 1 to 58.
60. The limiting condition is: 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 to which the current block belongs, and the frame type of the image frame to which the current block belongs.
60. The method of claim 59.
61. 1. An encoding method comprising: predicting at least one matching block of a current block in a current sequence based on an intra-template matching prediction (IntraTMP) mode; determining a target prediction block for the current block based on the at least one matching block; Obtaining a residual block of the current block based on the target predicted block and the original block of the current block; and encoding a residual block of the current block.
10. A coding method comprising:
62. The method comprises: further comprising encoding the first identifier; Here, the first identifier indicates that fusion prediction is performed using the IntraTMP mode.
62. The method of claim 61 .
63. The method comprises: further comprising encoding the second identifier; Here, the second identifier indicates that the prediction is performed using the IntraTMP mode.
63. The method of claim 62.
64. The encoding of the second identifier as described above includes: determining a target context index; and encoding the first identifier with the target context index.
63. The method of claim 62.
65. As mentioned above, determining the target context index may include: determining the target context index based on coding information of neighboring coding blocks of the current block; and / or determining the target context index based on a size of the current block.
65. The method of claim 64.
66. The coordinates of the current block are (x, y), the neighboring coding blocks include a first coding block having coordinates (x-1, y) and a second coding block having coordinates (x, y-1), coding information of the first coding block includes a prediction mode used by a prediction block of the first coding block, and coding information of the second coding block includes a prediction mode used by a prediction block of the second coding block; The step of determining the target context index based on coding information of adjacent coding blocks of the current block includes: If a prediction mode used by a prediction block of the first coding block is a mode in which a fusion prediction mode is performed based on the IntraTMP mode, assigning A to a first numerical value, and otherwise assigning B to the first numerical value, where A and B are both integers; If the prediction mode used by the prediction block of the second coding block is a mode in which a fusion prediction mode is performed based on the IntraTMP mode, assign C to the second numerical value; otherwise, assign D to the second numerical value, where C and D are both integers; and determining the sum of the first and second numerical values as the target context index.
66. The method of claim 65.
67. The above-mentioned predicting at least one matching block of the current block in the current sequence based on the intra-template matching prediction (IntraTMP) mode includes: performing template matching on the current block based on the IntraTMP mode to obtain X candidate matching blocks; and determining the at least one matching block based on the X candidate matching blocks.
67. The method of any one of claims 61 to 66.
68. The above-mentioned method of performing template matching on the current block based on the IntraTMP mode to obtain X candidate matching blocks includes: performing intra-template matching within a search area of the current block based on the IntraTMP mode to obtain all candidate matching blocks of the current block; and determining the X candidate matching blocks as the X matching blocks arranged in ascending order of template error value.
68. The method of claim 67.
69. The above-mentioned method of performing template matching on the current block based on the IntraTMP mode to obtain X candidate matching blocks includes: building a candidate matching block list based on the IntraTMP mode; The candidate matching block list is used to store X matching blocks that match when performing intra-template matching within the search area of the current block and have the smallest template error value.
68. The method of claim 67.
70. The above-mentioned method of performing template matching on the current block based on the IntraTMP mode to obtain X candidate matching blocks includes: Dividing the search area of the current block into Y sub-areas; and performing intra-template matching within each of the Y sub-regions based on the IntraTMP mode to obtain candidate matching blocks within each of the Y sub-regions; Here, the X candidate matching blocks include candidate matching blocks in each of the sub-regions.
70. The method of claim 69.
71. X=Y or X is a multiple of Y 71. The method of claim 70.
72. determining the at least one matching block based on the X candidate matching blocks includes: determining N available matching blocks based on the X candidate matching blocks, where X≧N; and determining the at least one matching block based on the N available matching blocks.
72. The method of any one of claims 67 to 71.
73. X is a multiple of N 73. The method of claim 72.
74. Determining N available matching blocks based on the X candidate matching blocks includes: pruning the X candidate matching blocks based on spacing between the X candidate matching blocks to obtain the N available matching blocks.
73. The method of claim 72.
75. The step of pruning the X candidate matching blocks based on the intervals between the X candidate matching blocks to obtain the N available matching blocks includes: determining a current candidate matching block to be used for pruning from among the X candidate matching blocks in ascending order of template error value; determining a pruning range for the current candidate matching block; and removing other candidate matching blocks except the current candidate matching block within the pruning range to obtain candidate matching blocks remaining after pruning the current candidate matching block, until the number of pruning of the X candidate matching blocks reaches N, and determining N candidate matching blocks before the remaining candidate matching block as the N available matching blocks, or performing this until the number of candidate matching blocks remaining after pruning the current candidate matching block becomes N or less, and determining N candidate matching blocks before the remaining candidate matching block as the N available matching blocks.
75. The method of claim 74.
76. The step of determining a pruning range of the current candidate matching block includes: determining the pruning range based on a size of the current block and the current candidate matching block.
76. The method of claim 75.
77. determining the pruning range based on the size of the current block and the current candidate matching block; determining (S / E)*H as the pruning range centered on a block vector pointing from the current block to the current candidate matching block; where / is a division operator, * is a multiplication operator, S is a matching step width adopted by the X candidate matching blocks, H is the height of the current block, and E is a positive integer.
77. The method of claim 76.
78. The step of determining a pruning range of the current candidate matching block includes: determining the pruning range based on a predefined value.
76. The method of claim 75.
79. Determining N available matching blocks based on the X candidate matching blocks includes: refining the X candidate matching blocks to obtain the N available matching blocks.
73. The method of claim 72.
80. The step of refining the X candidate matching blocks to obtain the N available matching blocks includes: determining a refinement range for a current candidate matching block among the X candidate matching blocks; performing intra-template matching within the refinement range based on at least one matching step width to obtain matching blocks matched within the refinement range, wherein each step width of the at least one matching step width is smaller than the matching step widths adopted by the X candidate matching blocks; determining a matching block with a minimum template error value among the matching blocks matched within the refinement range as a candidate matching block obtained by refining the current candidate matching block; and determining a candidate matching block obtained by refining the current candidate matching block as an available matching block among the N available matching blocks.
80. The method of claim 79.
81. The step of determining a refinement range of the current candidate matching block among the X candidate matching blocks includes: determining the refinement range based on a size of the current block and the current candidate matching block.
81. The method of claim 80.
82. The step of determining the refinement range based on the size of the current block and the current candidate matching block includes: determining (S / F)*H as the refinement range centered on a block vector pointing from the current block to the current candidate matching block; where / is a division operator, * is a multiplication operator, S is a matching step width adopted by the X candidate matching blocks, H is the height of the current block, and F is a positive integer.
82. The method of claim 81 .
83. The step of determining a refinement range of the current candidate matching block among the X candidate matching blocks includes: determining the refinement range based on a predefined value.
81. The method of claim 80.
84. The step of determining the matching block having the smallest template error value among the matching blocks matched within the refinement range as the candidate matching block obtained by refining the current candidate matching block includes: When the current candidate matching block is the ith matching block among the X candidate matching blocks, and the jth matching block matched within the refinement range is the matching block with the smallest template error value among the jth matching blocks within the refinement range, if the candidate matching blocks obtained by refining the (i-1)th candidate matching blocks among the X candidate matching blocks do not include the jth matching block, determining the jth matching block as the candidate matching block obtained by refining the current candidate matching block.
81. The method of claim 80.
85. Determining N available matching blocks based on the X candidate matching blocks includes: pruning and refining the X candidate matching blocks to obtain the N available matching blocks.
73. The method of claim 72.
86. The pruning and refining of the X candidate matching blocks to obtain the N available matching blocks may include: After pruning the X candidate matching blocks, refining the pruned candidate matching blocks; or After refining the X candidate matching blocks, pruning the refined candidate matching blocks; or pruning the X candidate matching blocks once based on a current candidate matching block among the X candidate matching blocks, and then refining the current candidate matching block.
86. The method of claim 85.
87. Determining the at least one matching block based on the N available matching blocks includes: determining a fusion condition used by the N available matching blocks; and determining an available matching block among the N available matching blocks that satisfies the fusion condition as the at least one matching block.
87. The method of any one of claims 72 to 86.
88. The step of determining the fusion conditions used by the N available matching blocks includes: determining the merging condition based on at least one of a template size of the current block, a bit width of pixels in the current block, and a minimum template error value of the N available matching blocks.
88. The method of claim 87.
89. the merging condition includes a first threshold, the first threshold being determined based on a size of a template of the current block and the bit width; The step of determining an available matching block that satisfies the fusion condition among the N available matching blocks as the at least one matching block includes the steps of: determining, as the at least one matching block, an available matching block among the N available matching blocks whose template error value is equal to or less than the first threshold.
89. The method of claim 88.
90. The first threshold value is T 1 =n 1 <<(b depth -n 2 )*n template where << is the left shift operator, − is the subtraction operator, * is the multiplication operator, and T 1 is the first threshold, b depth is the bit width, n template is the number of pixels in the template of the current block, n 1 and n 2 is a positive integer 90. The method of claim 89.
91. the fusion condition includes a second threshold value, the second threshold value being determined based on the minimum template error value; The step of determining an available matching block that satisfies the fusion condition among the N available matching blocks as the at least one matching block includes the steps of: determining, as the at least one matching block, an available matching block among the N available matching blocks whose template error value is equal to or less than the second threshold.
91. The method of any one of claims 88 to 90.
92. The second threshold value is () 2 m) SAD <| 3 where << is the left shift operator, T 2 is the second threshold, min SAD is the minimum template error value, n 3 is a positive integer 92. The method of claim 91 .
93. The method comprises: determining indication information, the indication information being used to indicate the at least one matching block from among the N available matching blocks; and encoding the instruction information.
87. The method of any one of claims 72 to 86.
94. Determining the target prediction block based on the at least one matching block includes: and if the at least one matching block is a plurality of matching blocks, performing a weighting process on the plurality of matching blocks to obtain a target predicted block of the current block.
94. The method of any one of claims 61 to 93.
95. The weighting process for the plurality of matching blocks to obtain the target prediction block is performed as follows: determining a weight value for each matching block of the plurality of matching blocks; and performing a weighting process on the plurality of matching blocks based on a weight value of each matching block to obtain the target predicted block.
95. The method of claim 94.
96. Determining a weight value for each of the plurality of matching blocks includes: determining a weight value for each matching block based on a template error value for each matching block, the number of the plurality of matching blocks, and a sum of weights for the plurality of matching blocks.
96. The method of claim 95.
97. determining a weight value for each matching block based on the template error value of each matching block, the number of the plurality of matching blocks, and the sum of weights of the plurality of matching blocks; determining a third numerical value corresponding to each matching block based on the template error value of each matching block; adding the third numerical values corresponding to each matching block to obtain a fourth numerical value; and determining a weight value for each of the matching blocks based on the fourth numerical value and a template error value for each of the matching blocks.
97. The method of claim 96.
98. determining a third numerical value corresponding to each matching block based on the template error value of each matching block; If the template error value of the i-th matching block among the plurality of matching blocks is 0, determining a predetermined value greater than 0 as a third numerical value corresponding to the i-th matching block; and If the template error value of the i-th matching block is 0, determining the template error value of the i-th matching block as a third numerical value corresponding to the i-th matching block.
98. The method of claim 97.
99. determining a weight value for each matching block based on the fourth numerical value and a template error value for each matching block; subtracting the third number corresponding to the i-th matching block from the fourth number to obtain a fifth number; multiplying the fourth number by n-1 to obtain a sixth number, where n represents the number of matching blocks; determining a weight value of the i-th matching block among the plurality of matching blocks according to a formula including: determining a weight value of the i-th matching block based on the fifth numerical value and the sixth numerical value.
98. The method of claim 97.
100. determining a weight value of the i-th matching block based on the fifth and sixth numerical values, If the i-th matching block is not the last matching block among the plurality of matching blocks, determining a ratio of the fifth numerical value to the sixth numerical value as a weight value of the i-th matching block; and If the i-th matching block is the last matching block, subtracting weight values of the previous n-1 matching blocks from a predetermined weight sum to obtain a weight value of the last matching block.
100. The method of claim 99.
101. determining a weight value of the i-th matching block based on the fifth and sixth numerical values, determining a ratio of the fifth numerical value to the sixth numerical value as a weight value of the i-th matching block; Here, the sum of the weight values of the plurality of matching blocks is equal to a preset total weight.
100. The method of claim 99.
102. The ratio of the fifth number to the sixth number is a number obtained by bit operations, addition operations, and subtraction operations.
102. The method of claim 100 or 101.
103. The ratio of the fifth numerical value to the sixth numerical value is W i =(D 5 *V*W sum +D Add )>>D Shift where * is the multiplication operator, + is the addition operator, >> is the right shift operator, and D 5 is the fifth number, W sum is the weight sum, V is a value determined by table lookup based on the seventh value, D Shift is a right shift amount calculated based on the seventh numerical value, the seventh numerical value is a numerical value determined based on the sixth numerical value, D Add is D Shift is a number determined based on 103. The method of claim 102.
104. V and D Shift teeth, [Equation 5] D 7 =((n-1)*D 4 <<4>>X)&15 V=table[D 7 ]|8 X=D 7 ==0?X:X+1 D Shift =X+3 is determined according to the formula: [Equation 6] is the rounding operator, * is the multiplication operator, << is the left shift operator, >> is the right shift operator, & is the logical product operator, | is the logical sum operator, ? is the conditional operator, + is the addition operator, and D 6 is the sixth numerical value, D 4 is the fourth numerical value, table[ ] is a table reference, D 7 represents the seventh numerical value 104. The method of claim 103.
105. D Add = 1 << (D Shift -1) or D Add = 1 << D Shift and where << is the left shift operator and - is the subtraction operator 104. The method of claim 103.
106. Determining a weight value for each matching block among the plurality of matching blocks includes: selecting 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 number of weight values equal to the number of the plurality of matching blocks, wherein each candidate set among the plurality of candidate sets includes at least one candidate weight value; and determining a weight value for each of the matching blocks based on the first candidate set.
96. The method of claim 95.
107. The template error value of each matching block and the weight value of each matching block are negatively correlated.
107. The method of claim 106.
108. The weighting process for the plurality of matching blocks based on the weight value of each matching block to obtain the target prediction block is performed by: multiplying each matching block's weight value by each matching block and then summing to obtain an eighth number; Add C to the eighth number offset to obtain a ninth number; and The ninth number is C to the right Shift shifting the target predicted block to obtain the target predicted 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 values of the plurality of matching blocks 95. The method of claim 94. [Request Item 109] [Number 7] and where: [Equation 8] is the rounding operator, << is the left shift operator, W sum represents the sum of the weight values of the multiple matching blocks 109. The method of claim 108.
110. The weighting process for the plurality of matching blocks to obtain a target predicted block for the current block is performed as follows: Dividing the current block into a plurality of regions; determining a weight value for each matching block of the plurality of matching blocks in a first region of the plurality of regions; and performing a weighting process on the plurality of matching blocks in the first region based on a weight value of each of the matching blocks in the first region to obtain a predicted value of the target predicted block in the first region; Here, the target predicted block includes a predicted value for each of the plurality of regions.
95. The method of claim 94.
111. The above-mentioned dividing the current block into a plurality of regions includes: dividing the current block into a plurality of regions along a horizontal or vertical direction.
111. The method of claim 110.
112. Determining the target prediction block based on the at least one matching block includes: If the at least one matching block is a single matching block, predicting the current block using a first intra prediction mode to obtain a first predicted block; and performing a weighting process on the single matching block and the first predicted block to obtain the target predicted block.
94. The method of any one of claims 61 to 93.
113. The weight value of the single matching block and the weight value of the first prediction block are predefined weight values.
113. The method of claim 112.
114. The method comprises: determining a weight value of the single matching block and a weight value of the first predicted block based on at least one of coding information of neighboring coding blocks, a size of the current block, a template size of the current block, a type of the first intra prediction mode, and a position of each region of the current block.
113. The method of claim 112.
115. determining a target predicted block of the current block based on the at least one matching block, If the at least one matching block is a plurality of matching blocks, predicting the current block using a second intra prediction mode to obtain a second predicted block; and performing a weighting process on the plurality of matching blocks and the second predicted block to obtain the target predicted block.
94. The method of any one of claims 61 to 93.
116. The weight value of the second predicted block is a predefined weight value.
116. The method of claim 115.
117. The method comprises: determining a weight value of the second prediction block based on at least one of coding information of neighboring coding blocks, a size of the current block, a template size of the current block, a type of the second intra prediction mode, a sum of weights of the plurality of matching blocks, and a position of each region of the current block.
116. The method of claim 115.
118. The template for the current block includes at least one of a left reconstructed pixel, a lower left reconstructed pixel, an upper left reconstructed pixel, an upper reconstructed pixel, and an upper right reconstructed pixel.
118. The method of any one of claims 61 to 117.
119. The above-mentioned predicting at least one matching block of the current block in the current sequence based on the intra-template matching prediction (IntraTMP) mode includes: determining a limiting condition for using the IntraTMP mode; and and if the constraint condition is satisfied, predicting the at least one matching block based on the IntraTMP mode.
119. The method of any one of claims 61 to 118.
120. The limiting condition is: the size of the current block, the coding information of the neighboring coding blocks, the sequence level flag bits, the frame level flag bits, the macroblock level flag bits, the type of slice to which the current block belongs, and the frame type of the image frame to which the current block belongs.
120. The method of claim 119.
121. A decoder comprising: a residual unit configured to determine a residual block of a current block in a current sequence based on the bitstream; a prediction unit configured to predict at least one matching block of the current block based on an intra-template matching prediction (IntraTMP) mode; a determining unit configured to determine a target prediction block of the current block based on the at least one matching block; and 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 decoder characterized by:
122. 1. An encoder comprising: a prediction unit configured to predict at least one matching block of a current block in a current sequence based on an intra-template matching prediction (IntraTMP) mode; a determining unit configured to determine a target prediction block of the current block based on the at least one matching 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; and a coding unit configured to code a residual block of the current block; An encoder characterized by:
123. An electronic device, a processor configured to execute a computer program; and a computer-readable storage medium; The computer-readable storage medium has stored thereon a computer program that, when executed by the processor, implements the method of any one of claims 1 to 60 or any one of claims 61 to 120. An electronic device characterized by:
124. 1. A computer-readable storage medium, comprising: A computer program is configured to store therein a computer program, the computer program causing a computer to carry out the method of any one of claims 1 to 60 or the method of any one of claims 61 to 120. A computer-readable storage medium comprising:
125. 1. A computer program product comprising: Contains computer programs / instructions, The computer program / instructions, when executed by a processor, implement the method of any one of claims 1 to 60 or the method of any one of claims 61 to 120.
1. A computer program product comprising:
126. A bitstream comprising: A bitstream for the method of any one of claims 1 to 60 or a bitstream generated by the method of any one of claims 61 to 120. A bitstream characterized in that