Method and apparatus for video encoding using intra template matching prediction based on multiple blocks

By using template matching in video encoding technology to search for multiple candidate prediction blocks and weighted combinations, the prediction accuracy limitation problem caused by the dependence of a single prediction block in the prior art is solved, and higher video encoding efficiency and quality are achieved.

CN119999212APending Publication Date: 2025-05-13HYUNDAI MOTOR CO LTD +2
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202380070398.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-08-24
Filing Date
2023-08-28
Publication Date
2025-05-13

Smart Images

  • Figure CN119999212A_ABST
    Figure CN119999212A_ABST
Patent Text Reader

Abstract

Disclosed are a method and an apparatus for video encoding using intra template matching prediction based on multiple blocks. In a disclosed embodiment, a video decoding apparatus establishes a search region for template matching, and then searches the search region based on a template of a current block to generate a plurality of candidate prediction blocks indexed in an order to increase template matching cost. The video decoding apparatus obtains a weight of the candidate prediction block, and then generates a prediction block of the current block by weighting and combining one or more of the plurality of candidate prediction blocks using the weight.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to a method and device for performing video encoding based on multi-block intra-frame template matching prediction. Background Art

[0002] The statements in this section merely provide background information related to the present disclosure and may not constitute prior art.

[0003] Since video data has a large amount of data compared to audio or still image data, video data requires a large amount of hardware resources (including memory) to store or transmit the uncompressed video data.

[0004] Therefore, the encoder is generally used to compress and store or transmit video data. The decoder receives the compressed video data, decompresses the received compressed video data, and plays the decompressed video data. Video compression technologies include H.264 / Advanced Video Coding (AVC), High Efficiency Video Coding (HEVC), and Versatile Video Coding (VVC), and VVC has an improved coding efficiency of about 30% or more compared to HEVC.

[0005] However, as image size, resolution, and frame rate gradually increase, the amount of data to be encoded also increases. Therefore, new compression techniques are needed that provide higher encoding efficiency and improved image enhancement effects than existing compression techniques.

[0006] Intra Template Matching Prediction (TMP) is an intra prediction mode using template matching, which searches for prediction blocks within the search area to minimize the template matching cost, and uses the corresponding block as the prediction block of the current block. The encoder sends a signal to the decoder to use the intra TMP mode, and the decoder performs the same prediction operation as the encoder. The decoder searches for the template with the minimum cost function value for the current template, and uses the corresponding block of the searched template as the prediction block. Traditional intra TMP relies on a single prediction block, which hinders the improvement of prediction accuracy. Therefore, in order to improve video coding efficiency, and in particular to improve the quality of chrominance components, it is necessary to consider methods for improving intra TMP. Summary of the invention

[0007]

Technical issues

[0008] The present disclosure aims to provide a video encoding method and device, which use template matching to search for multiple candidate prediction blocks and generate a prediction block of a current block from the searched multiple candidate prediction blocks.

[0009]

Technical solution

[0010] At least one aspect of the present disclosure provides a method for decoding a current block, which is performed by a video decoding device. The method includes establishing a search area for template matching. The method also includes searching the search area based on the template of the current block to generate a plurality of candidate prediction blocks indexed in the order of increasing template matching cost, and forming a set of the candidate prediction blocks. The method also includes obtaining weights for the candidate prediction blocks. The method also includes generating a prediction block for the current block by weighted combination of one or more of the candidate prediction blocks using the weights.

[0011] Another aspect of the present disclosure provides a method for encoding a current block, which is performed by a video encoding device. The method includes establishing a search area for template matching. The method also includes searching the search area based on the template of the current block to generate a plurality of candidate prediction blocks indexed in order of increasing template matching cost, and forming a set of the candidate prediction blocks. The method also includes obtaining weights of the candidate prediction blocks. The method also includes generating a first prediction block of the current block by weightedly combining one or more of the candidate prediction blocks using weights.

[0012] Another aspect of the present disclosure provides a computer-readable recording medium that stores a bitstream generated by a video encoding method. The video encoding method includes establishing a search area for template matching. The video encoding method also includes searching the search area based on a template of a current block to generate a plurality of candidate prediction blocks indexed in order of increasing template matching cost, and forming a set of candidate prediction blocks. The video encoding method also includes obtaining weights of the candidate prediction blocks. The video encoding method also includes generating a first prediction block of the current block by weightedly combining one or more of the candidate prediction blocks using weights.

[0013]

Beneficial Effects

[0014] As described above, the present disclosure provides a video encoding method and device, which uses template matching to search for multiple candidate prediction blocks and generates a prediction block of a current block from the multiple searched candidate prediction blocks. Therefore, the video encoding method and device improve video encoding efficiency and enhance video quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 is a block diagram of a video encoding device that may implement the techniques of this disclosure.

[0016] Figure 2 A method for partitioning blocks using a quadtree plus binary tree-ternary tree (QTBTTT) structure is shown.

[0017] Figure 3A and Figure 3BMultiple intra prediction modes are shown including a wide-angle intra prediction mode.

[0018] Figure 4 Neighboring blocks of the current block are shown.

[0019] Figure 5 is a block diagram of a video decoding device that may implement the techniques of this disclosure.

[0020] Figure 6 Template matching predictions are shown.

[0021] Figure 7 Intra-frame template matching prediction is shown.

[0022] Figure 8 The flowchart shows a method for encoding a current block based on intra-frame template matching prediction by a video encoding device according to an embodiment of the present disclosure.

[0023] Fig. 9 The flowchart shows a method for decoding a current block based on intra-frame template matching prediction by a video decoding device according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0024] Hereinafter, some embodiments of the present disclosure will be described in detail with reference to the accompanying drawings. In the following description, similar reference numerals represent similar elements, although these elements are shown in different drawings. In addition, in the following description of some embodiments, for the purpose of clarity and brevity, when it is considered that the relevant known components and functions obscure the subject matter of the present disclosure, the detailed description of these known components and functions may be omitted.

[0025] Figure 1 is a block diagram of a video encoding device that can implement the technology of the present disclosure. Figure 1 A diagram of a video encoding device and components of the device is described.

[0026] The encoding apparatus may include a picture divider 110 , a predictor 120 , a subtractor 130 , a transformer 140 , a quantizer 145 , a rearrangement unit 150 , an entropy encoder 155 , an inverse quantizer 160 , an inverse transformer 165 , an adder 170 , a loop filter unit 180 , and a memory 190 .

[0027] Each component of the coding device can be implemented as hardware or software, or as a combination of hardware and software. In addition, the function of each component can be implemented as software, and a microprocessor can also be implemented to execute the function of the software corresponding to each component.

[0028] A video consists of one or more sequences including multiple pictures. Each picture is divided into multiple regions, and encoding is performed on each region. For example, a picture is divided into one or more tiles or / and slices. Here, one or more tiles can be defined as a tile group. Each tile or / and slice is divided into one or more coding tree units (CTUs). In addition, each CTU is divided into one or more coding units (CUs) through a tree structure. The information applied to each coding unit (CU) is encoded as the syntax of the CU, and the information generally applied to the CU included in a CTU is encoded as the syntax of the CTU. In addition, the information generally applied to all blocks in a slice is encoded as the syntax of the slice header, and the information applied to all blocks constituting one or more pictures is encoded as a picture parameter set (PPS) or a picture header. In addition, the information generally referenced by multiple pictures is encoded as a sequence parameter set (SPS). In addition, the information generally referenced by one or more SPSs is encoded as a video parameter set (VPS). In addition, the information generally applied to a tile or tile group can also be encoded as the syntax of the tile or tile group header. The syntax included in an SPS, a PPS, a slice header, a tile, or a tile group header may be referred to as a high-level syntax.

[0029] The picture divider 110 determines the size of a coding tree unit (CTU). Information on the size of the CTU (CTU size) is encoded as a syntax of an SPS or a PPS and transmitted to a video decoding apparatus.

[0030] The picture divider 110 divides each picture constituting a video into a plurality of coding tree units (CTUs) having a predetermined size, and then recursively divides the CTUs by using a tree structure. A leaf node in the tree structure becomes a coding unit (CU), which is a basic unit of encoding.

[0031] The tree structure can be a quadtree (QT), in which a higher node (or parent node) is split into four lower nodes (or child nodes) of the same size. The tree structure can also be a binary tree (BT), in which a higher node is split into two lower nodes. The tree structure can also be a ternary tree (TT), in which a higher node is split into three lower nodes at a ratio of 1:2:1. The tree structure can also be a structure in which two or more structures in the QT structure, BT structure, and TT structure are mixed. For example, a quadtree plus binary tree (QTBT) structure or a quadtree plus binary tree-ternary tree (QTBTTT) structure can be used. Here, a binary tree-ternary tree (BTTT) is added to the tree structure, which is called a multi-type tree (MTT).

[0032] Figure 2 is a diagram for describing a method of partitioning a block by using a QTBTTT structure.

[0033] like Figure 2As shown, the CTU can be first split into a QT structure. The quadtree splitting can be recursive until the size of the split block reaches the minimum block size (MinQTSize) of the leaf node allowed in the QT. The entropy encoder 155 encodes a first flag (QT_split_flag) indicating whether each node of the QT structure is split into four nodes of a lower layer, and sends it to the video decoding device with a signal. When the leaf node of the QT is not larger than the maximum block size (MaxBTSize) of the root node allowed in the BT, the leaf node can be further split into at least one of the BT structure or the TT structure. There may be multiple splitting directions in the BT structure and / or the TT structure. For example, there may be two directions, namely, the direction in which the blocks of the corresponding nodes are split horizontally and the direction in which the blocks of the corresponding nodes are split vertically. As Figure 2 As shown, when MTT splitting starts, the entropy encoder 155 encodes a second flag (MTT_split_flag) indicating whether the node is split and a flag further indicating the split direction (vertical or horizontal), and / or a flag indicating the split type (binary or ternary) if the node is split, and sends it to the video decoding device with a signal.

[0034] Alternatively, before encoding the first flag (QT_split_flag) indicating whether each node is split into four nodes of the lower layer, the CU split flag (split_cu_flag) indicating whether the node is split may also be encoded. When the value of the CU split flag (split_cu_flag) indicates that each node is not split, the block of the corresponding node becomes a leaf node in the split tree structure and becomes a CU as a basic unit of encoding. When the value of the CU split flag (split_cu_flag) indicates that each node is split, the video encoding device first starts encoding the first flag through the above scheme.

[0035] When QTBT is used as another example of a tree structure, there may be two types, namely, a type in which the block of the corresponding node is horizontally split into two blocks of the same size (i.e., symmetrical horizontal splitting) and a type in which the block of the corresponding node is vertically split into two blocks of the same size (i.e., symmetrical vertical splitting). The entropy encoder 155 encodes a split flag (split_flag) indicating whether each node of the BT structure is split into blocks of a lower layer and split type information indicating the split type, and transmits them to the video decoding device. At the same time, there may also be a type in which the block of the corresponding node is split into two blocks that are asymmetric to each other. The asymmetric form may include a form in which the block of the corresponding node is split into two rectangular blocks with a size ratio of 1:3, or may also include a form in which the block of the corresponding node is split in a diagonal direction.

[0036] According to the QTBT or the QTBTTT partitioned from the CTU, the CU can have various sizes. In the following, the block corresponding to the CU to be encoded or decoded (i.e., the leaf node of the QTBTTT) is referred to as the "current block". Due to the QTBTTT partitioning, the shape of the current block can be a rectangle in addition to a square.

[0037] The predictor 120 predicts the current block to generate a predicted block. The predictor 120 includes an intra predictor 122 and an inter predictor 124.

[0038] Typically, each of the current blocks in a picture can be predictively encoded. Typically, the prediction of the current block can be performed using intra-prediction techniques (using data from the picture that includes the current block) or inter-prediction techniques (using data from pictures that were encoded before the current block). Inter-prediction includes both unidirectional prediction and bidirectional prediction.

[0039] The intra-frame predictor 122 predicts pixels in the current block by using pixels (reference pixels) located on neighbors of the current block in the current picture including the current block. There are multiple intra-frame prediction modes according to the prediction direction. For example, Figure 3A As shown, the plurality of intra prediction modes may include 2 non-directional modes (including a planar mode and a DC mode), and may include 65 directional modes. According to each prediction mode, neighboring pixels and an arithmetic formula to be used are differently defined.

[0040] In order to perform efficient directional prediction for a current block with a rectangular shape, we can additionally use Figure 3B The directional modes (#67 to #80, intra prediction modes #-1 to #-14) are shown as dotted arrows. The directional modes may be referred to as "wide-angle intra prediction modes". Figure 3B , the arrow indicates the corresponding reference sample used for prediction and does not represent the prediction direction. The prediction direction is opposite to the direction indicated by the arrow. When the current block has a rectangular shape, the wide-angle intra prediction mode is a mode in which prediction is performed in a direction opposite to the specific direction mode without additional bit transmission. In this case, in the wide-angle intra prediction mode, some wide-angle intra prediction modes that can be used for the current block can be determined by the ratio of the width and height of the current block having a rectangular shape. For example, when the current block has a rectangular shape with a height less than the width, a wide-angle intra prediction mode (intra prediction modes #67 to #80) with an angle less than 45 degrees can be used. When the current block has a rectangular shape with a width greater than the height, a wide-angle intra prediction mode with an angle greater than -135 degrees can be used.

[0041] The intra-frame predictor 122 may determine an intra-frame prediction for encoding the current block. In some examples, the intra-frame predictor 122 may encode the current block by using multiple intra-frame prediction modes, and may also select an appropriate intra-frame prediction mode to be used from the tested modes. For example, the intra-frame predictor 122 may calculate rate-distortion values ​​using rate-distortion analysis for multiple tested intra-frame prediction modes, and may also select an intra-frame prediction mode having the best rate-distortion characteristics from the tested modes.

[0042] The intra predictor 122 selects an intra prediction mode from a plurality of intra prediction modes and predicts the current block by using adjacent pixels (reference pixels) and an arithmetic formula determined according to the selected intra prediction mode. Information about the selected intra prediction mode is encoded by the entropy encoder 155 and transmitted to the video decoding device.

[0043] The inter-frame predictor 124 generates a prediction block of the current block by using a motion compensation process. The inter-frame predictor 124 searches for a block most similar to the current block in a reference picture that is encoded and decoded earlier than the current picture, and generates a prediction block of the current block by using the searched block. In addition, a motion vector (MV) is generated, which corresponds to the displacement between the current block in the current picture and the prediction block in the reference picture. Typically, motion estimation is performed on the luminance component, and the motion vector calculated based on the luminance component is used for the luminance component and the chrominance component. The entropy encoder 155 encodes motion information including information about the reference picture and information about the motion vector used to predict the current block, and transmits it to the video decoding device.

[0044] The inter-frame predictor 124 may also perform interpolation for a reference picture or a reference block to improve the accuracy of the prediction. In other words, the subsamples between two consecutive integer samples are interpolated by applying the filter coefficients to a plurality of consecutive integer samples including two integer samples. When performing the process of searching for the block most similar to the current block for the interpolated reference picture, the motion vector may be expressed as a decimal unit precision instead of an integer sample unit precision. For each target area to be encoded, such as a unit such as a slice, a tile, a CTU, a CU, etc., the precision or resolution of the motion vector may be set differently. When such an adaptive motion vector resolution (AMVR) is applied, information about the motion vector resolution to be applied to each target area should be signaled for each target area. For example, when the target area is a CU, information about the motion vector resolution applied to each CU is signaled. The information about the motion vector resolution may be information representing the precision of the motion vector difference to be described below.

[0045] Meanwhile, the inter-frame predictor 124 may perform inter-frame prediction by using bidirectional prediction. In the case of bidirectional prediction, two reference pictures and two motion vectors representing the block position most similar to the current block in each reference picture are used. The inter-frame predictor 124 selects a first reference picture and a second reference picture from reference picture list 0 (RefPicList0) and reference picture list 1 (RefPicList 1), respectively. The inter-frame predictor 124 also searches for the block most similar to the current block in each reference picture to generate a first reference block and a second reference block. In addition, a prediction block of the current block is generated by averaging or weighted averaging the first reference block and the second reference block. In addition, motion information including information about two reference pictures used to predict the current block and information about two motion vectors is transmitted to the entropy encoder 155. Here, the reference picture list 0 may be composed of pictures arranged before the current picture in the display order in the pre-reconstructed picture, and the reference picture list 1 may be composed of pictures arranged after the current picture in the display order in the pre-reconstructed picture. However, although there is no particular limitation, the pre-reconstructed picture after the current picture in the display order may be additionally included in the reference picture list 0. On the contrary, a pre-reconstructed picture before the current picture may also be additionally included in the reference picture list 1.

[0046] In order to minimize the amount of bits consumed to encode motion information, various methods can be used.

[0047] For example, when the reference picture and motion vector of the current block are the same as those of the adjacent block, information capable of identifying the adjacent block is encoded to transmit the motion information of the current block to the video decoding device. This method is called merge mode.

[0048] In the merge mode, the inter predictor 124 selects a predetermined number of merge candidate blocks (hereinafter referred to as “merge candidates”) from neighboring blocks of the current block.

[0049] As neighboring blocks used to derive merge candidates, such as Figure 4 As shown, all or some of the left block A0, the lower left block A1, the upper block B0, the upper right block B1, and the upper left block B2 adjacent to the current block in the current picture can be used. In addition, in addition to the current picture in which the current block is positioned, blocks positioned in a reference picture (which may be the same as or different from the reference picture used to predict the current block) can also be used as merge candidates. For example, a block co-located with the current block or a block adjacent to the co-located block in the reference picture can be additionally used as a merge candidate. If the number of merge candidates selected by the above method is less than the preset number, a zero vector is added to the merge candidate.

[0050] The inter-frame predictor 124 configures a merge list including a predetermined number of merge candidates by using adjacent blocks. A merge candidate to be used as motion information of the current block is selected from the merge candidates included in the merge list, and merge index information for identifying the selected candidate is generated. The generated merge index information is encoded by the entropy encoder 155 and transmitted to the video decoding device.

[0051] Merge skip mode is a special case of merge mode. After quantization, when all transform coefficients of entropy coding are close to zero, only the neighbor block selection information is transmitted without the residual signal. By using merge skip mode, relatively high coding efficiency can be achieved for images with slight motion, still images, screen content images, etc.

[0052] Hereinafter, the merge mode and the merge skip mode are collectively referred to as the merge / skip mode.

[0053] Another method for encoding motion information is the Advanced Motion Vector Prediction (AMVP) mode.

[0054] In the AMVP mode, the inter-frame predictor 124 derives a motion vector predictor candidate for the motion vector of the current block by using the neighboring blocks of the current block. As the neighboring blocks for deriving the motion vector predictor candidate, Figure 4 All or some of the left block A0, lower left block A1, upper block B0, upper right block B1 and upper left block B2 adjacent to the current block in the current picture shown. In addition, in addition to the current picture where the current block is located, blocks located in a reference picture (which may be the same as or different from the reference picture used to predict the current block) may also be used as adjacent blocks for deriving motion vector predictor candidates. For example, a block co-located with the current block in the reference picture or a block adjacent to the co-located block may be used. If the number of motion vector candidates selected by the above method is less than the preset number, a zero vector is added to the motion vector candidates.

[0055] The inter predictor 124 derives a motion vector predictor candidate by using the motion vector of the neighboring block, and determines a motion vector predictor of the motion vector of the current block by using the motion vector predictor candidate. In addition, a motion vector difference is calculated by subtracting the motion vector predictor from the motion vector of the current block.

[0056] The motion vector predictor can be obtained by applying a predefined function (e.g., center value and average value calculation, etc.) to the motion vector predictor candidate. In this case, the video decoding device also knows the predefined function. In addition, since the neighboring blocks used to derive the motion vector predictor candidate are blocks that have completed encoding and decoding, the video decoding device may also already know the motion vectors of the neighboring blocks. Therefore, the video encoding device does not need to encode the information for identifying the motion vector predictor candidate. Therefore, in this case, the information about the motion vector difference and the information about the reference picture used to predict the current block are encoded.

[0057] Meanwhile, the motion vector predictor may also be determined by selecting any one of the motion vector predictor candidates. In this case, information for identifying the selected motion vector predictor candidate is additionally encoded together with information about the motion vector difference and information about the reference picture used to predict the current block.

[0058] The subtractor 130 generates a residual block by subtracting a prediction block generated by the intra predictor 122 or the inter predictor 124 from the current block.

[0059] The transformer 140 transforms the residual signal in the residual block having the spatial domain pixel value into a transform coefficient in the frequency domain. The transformer 140 may transform the residual signal in the residual block by using the total size of the residual block as a transform unit, or may also divide the residual block into a plurality of sub-blocks, and may perform the transform by using the sub-block as a transform unit. Alternatively, the residual block is divided into two sub-blocks, namely a transform region and a non-transform region, to transform the residual signal by using only the transform region sub-block as a transform unit. Here, the transform region sub-block may be one of two rectangular blocks having a size ratio of 1:1 based on the horizontal axis (or vertical axis). In this case, the flag (cu_sbt_flag) indicates that only the sub-block is transformed, and the direction (vertical / horizontal) information (cu_sbt_horizontal_flag) and / or the position information (cu_sbt_pos_flag) are encoded by the entropy encoder 155 and sent to the video decoding device with a signal. In addition, based on the horizontal axis (or vertical axis), the size of the transform region sub-block may have a size ratio of 1:3. In this case, a flag (cu_sbt_quad_flag) of dividing the corresponding partition is additionally encoded by the entropy encoder 155 and signaled to the video decoding apparatus.

[0060] At the same time, the transformer 140 can perform transformations on the residual block separately in the horizontal direction and the vertical direction. For the transformation, various types of transformation functions or transformation matrices can be used. For example, a pair of transformation functions for horizontal transformation and vertical transformation can be defined as a multiple transform set (MTS). The transformer 140 can select a transformation function pair with the highest transformation efficiency in the MTS, and can transform the residual block in each direction of the horizontal direction and the vertical direction. Information about the transformation function pair in the MTS (mts_idx) is encoded by the entropy encoder 155 and sent to the video decoding device with a signal.

[0061] The quantizer 145 quantizes the transform coefficients output from the transformer 140 using the quantization parameters and outputs the quantized transform coefficients to the entropy encoder 155. The quantizer 145 can also quantize the relevant residual block immediately without transforming any block or frame. The quantizer 145 can also apply different quantization coefficients (scaling values) according to the position of the transform coefficient in the transform block. The quantization matrix applied to the quantized transform coefficients arranged in two dimensions can be encoded and sent to the video decoding device.

[0062] The rearrangement unit 150 may perform rearrangement on coefficient values ​​of the quantized residual value.

[0063] The rearrangement unit 150 may change a two-dimensional (2D) coefficient array into a one-dimensional (1D) coefficient sequence by using coefficient scanning. For example, the rearrangement unit 150 may output a 1D coefficient sequence by scanning a DC coefficient to a high frequency domain coefficient using a zigzag scan or a diagonal scan. Depending on the size of the transform unit and the intra-frame prediction mode, a vertical scan that scans the 2D coefficient array in the column direction and a horizontal scan that scans the 2D block-type coefficients in the row direction may also be used instead of the zigzag scan. In other words, depending on the size of the transform unit and the intra-frame prediction mode, the scanning method to be used may be determined among zigzag scanning, diagonal scanning, vertical scanning, and horizontal scanning.

[0064] The entropy encoder 155 generates a bitstream by encoding the sequence of 1D quantized transform coefficients output from the rearrangement unit 150 using various encoding schemes including context-based adaptive binary arithmetic coding (CABAC), exponential Golomb, and the like.

[0065] In addition, the entropy encoder 155 encodes information related to block segmentation, such as CTU size, CTU segmentation flag, QT segmentation flag, MTT segmentation type, MTT segmentation direction, etc., to allow the video decoding device to equally segment blocks to the video encoding device. In addition, the entropy encoder 155 encodes information about the prediction type indicating whether the current block is encoded by intra-frame prediction or inter-frame prediction. The entropy encoder 155 encodes intra-frame prediction information (i.e., information about intra-frame prediction mode) or inter-frame prediction information (in the case of merge mode, merge index, and in the case of AMVP mode, information about reference picture index and motion vector difference) according to the prediction type. In addition, the entropy encoder 155 encodes information related to quantization, i.e., information about quantization parameters and information about quantization matrices.

[0066] The inverse quantizer 160 inversely quantizes the quantized transform coefficient output from the quantizer 145 to generate a transform coefficient. The inverse transformer 165 transforms the transform coefficient output from the inverse quantizer 160 from the frequency domain to the spatial domain to reconstruct a residual block.

[0067] The adder 170 adds the reconstructed residual block and the prediction block generated by the predictor 120 to reconstruct the current block. When intra-predicting a next-order block, pixels in the reconstructed current block may be used as reference pixels.

[0068] The loop filter unit 180 performs filtering on the reconstructed pixels in order to reduce block artifacts, ringing artifacts, blurring artifacts, etc. occurring due to block-based prediction and transform / quantization. The loop filter unit 180 as an in-loop filter may include all or some of a deblocking filter 182, a sample adaptive offset (SAO) filter 184, and an adaptive loop filter (ALF) 186.

[0069] The deblocking filter 182 filters the boundaries between the reconstructed blocks to remove the blocking artifacts that occur due to block unit encoding / decoding, and the SAO filter 184 and the ALF 186 perform additional filtering on the video after deblocking filtering. The SAO filter 184 and the ALF 186 are filters for compensating for the difference between the reconstructed pixels and the original pixels that occur due to lossy encoding. The SAO filter 184 applies an offset as a CTU unit to enhance subjective image quality and coding efficiency. On the other hand, the ALF 186 applies different filters by dividing the boundaries of the corresponding blocks and the degree of the amount of change, performs block unit filtering and compensates for distortion. Information about the filter coefficients used for the ALF can be encoded and sent to the video decoding device with a signal.

[0070] The reconstructed blocks filtered by the deblocking filter 182, the SAO filter 184, and the ALF 186 are stored in the memory 190. When all blocks in one picture are reconstructed, the reconstructed picture may be used as a reference picture for inter-frame prediction of blocks in a picture to be encoded later.

[0071] The video encoding device may store a bit stream of encoded video data in a non-transitory storage medium, or transmit the bit stream to a video decoding device through a communication network.

[0072] Figure 5 is a functional block diagram of a video decoding device that can implement the technology of the present disclosure. Figure 5 , describing a video decoding device and components of the device.

[0073] The video decoding apparatus may include an entropy decoder 510 , a rearrangement unit 515 , an inverse quantizer 520 , an inverse transformer 530 , a predictor 540 , an adder 550 , a loop filter unit 560 , and a memory 570 .

[0074] and Figure 1 Similar to the video encoding device of the present invention, each component of the video decoding device can be implemented as hardware or software, or as a combination of hardware and software. In addition, the function of each component can be implemented as software, and a microprocessor can also be implemented to execute the function of the software corresponding to each component.

[0075] The entropy decoder 510 extracts information related to block partitioning by decoding a bit stream generated by a video encoding apparatus to determine a current block to be decoded, and extracts prediction information required to reconstruct the current block and information about a residual signal.

[0076] The entropy decoder 510 determines the size of the CTU by extracting information about the CTU size from a sequence parameter set (SPS) or a picture parameter set (PPS), and partitions the picture into CTUs having the determined size. In addition, the CTU is determined as the highest level of the tree structure, i.e., the root node, and partition information of the CTU can be extracted to partition the CTU by using the tree structure.

[0077] For example, when a CTU is segmented by using a QTBTTT structure, a first flag (QT_split_flag) related to QT segmentation is first extracted to segment each node into four nodes of a lower layer. In addition, a second flag (mtt_split_flag) related to the segmentation of MTT, a segmentation direction (vertical / horizontal), and / or a segmentation type (binary / ternary) are extracted with respect to a node corresponding to a leaf node of QT to segment the corresponding leaf node into an MTT structure. Therefore, each of the nodes below the leaf node of QT is recursively segmented into a BT or TT structure.

[0078] As another example, when a CTU is split by using a QTBTTT structure, a CU split flag (split_cu_flag) indicating whether the CU is split is extracted. When the corresponding block is split, the first flag (QT_split_flag) may also be extracted. During the splitting process, with respect to each node, after 0 or more recursive QT splits, 0 or more recursive MTT splits may also occur. For example, with respect to a CTU, MTT splitting may occur immediately, or conversely, multiple QT splits may occur only.

[0079] As another example, when CTU is segmented by using the QTBT structure, the first flag (QT_split_flag) related to QT segmentation is extracted to segment each node into four nodes of the lower layer. In addition, a segmentation flag (split_flag) indicating whether a node corresponding to a leaf node of QT is further segmented into BTs and segmentation direction information are extracted.

[0080] Meanwhile, when the entropy decoder 510 determines the current block to be decoded by using the partitioning of the tree structure, the entropy decoder 510 extracts information about the prediction type indicating whether the current block is intra-prediction or inter-prediction. When the prediction type information indicates intra-prediction, the entropy decoder 510 extracts syntax elements of intra-prediction information (intra-prediction mode) of the current block. When the prediction type information indicates inter-prediction, the entropy decoder 510 extracts information of syntax elements representing inter-prediction information, i.e., a motion vector and a reference picture referred to by the motion vector.

[0081] In addition, the entropy decoder 510 extracts quantization-related information, and extracts information on a quantized transform coefficient of the current block as information on a residual signal.

[0082] The rearrangement unit 515 may change the sequence of 1D quantized transform coefficients entropy-decoded by the entropy decoder 510 into a 2D coefficient array (ie, block) again in the reverse order of the coefficient scanning order performed by the video encoding apparatus.

[0083] The inverse quantizer 520 dequantizes the quantized transform coefficients and dequantizes the quantized transform coefficients using the quantization parameters. The inverse quantizer 520 may also apply different quantization coefficients (scaling values) to the quantized transform coefficients arranged in 2D. The inverse quantizer 520 may perform dequantization by applying a matrix of quantization coefficients (scaling values) from a video encoding device to a 2D array of quantized transform coefficients.

[0084] The inverse transformer 530 reconstructs a residual signal by inversely transforming the dequantized transform coefficients from the frequency domain into the spatial domain, thereby generating a residual block of the current block.

[0085] In addition, when the inverse transformer 530 inversely transforms a partial region (sub-block) of the transform block, the inverse transformer 530 extracts a flag (cu_sbt_flag) for transforming only the sub-block of the transform block, direction (vertical / horizontal) information (cu_sbt_horizontal_flag) of the sub-block, and / or position information (cu_sbt_pos_flag) of the sub-block. The inverse transformer 530 also inversely transforms the transform coefficient of the corresponding sub-block from the frequency domain to the spatial domain to reconstruct the residual signal, and fills the uninverse-transformed region with a value of "0" as the residual signal to generate a final residual block of the current block.

[0086] In addition, when MTS is applied, the inverse transformer 530 determines a transform index or a transform matrix to be applied in each of the horizontal direction and the vertical direction by using MTS information (MTS_idx) signaled from the video encoding device. The inverse transformer 530 also performs inverse transform on the transform coefficients in the transform block in the horizontal direction and the vertical direction by using the determined transform function.

[0087] The predictor 540 may include an intra predictor 542 and an inter predictor 544. The intra predictor 542 is activated when the prediction type of the current block is intra prediction, and the inter predictor 544 is activated when the prediction type of the current block is inter prediction.

[0088] The intra predictor 542 determines an intra prediction block of the current block in a plurality of intra prediction modes according to syntax elements for the intra prediction mode extracted from the entropy decoder 510. The intra predictor 542 also predicts the current block by using neighboring reference pixels of the current block according to the intra prediction mode.

[0089] The inter predictor 544 determines a motion vector of a current block and a reference picture to which the motion vector refers by using a syntax element for the inter prediction mode extracted from the entropy decoder 510 .

[0090] The adder 550 reconstructs the current block by adding the residual block output from the inverse transformer 530 and the prediction block output from the inter predictor 544 or the intra predictor 542. When a block is to be decoded after intra prediction, pixels within the reconstructed current block are used as reference pixels.

[0091] The loop filter unit 560 as an in-loop filter may include a deblocking filter 562, an SAO filter 564, and an ALF 566. The deblocking filter 562 performs deblocking filtering on the boundary between the reconstructed blocks in order to remove block artifacts that occur due to block unit decoding. The SAO filter 564 and the ALF 566 perform additional filtering on the reconstructed blocks after deblocking filtering in order to compensate for the difference between the reconstructed pixels and the original pixels that occur due to lossy encoding. The filter coefficients of the ALF are determined by using information about the filter coefficients decoded from the bitstream.

[0092] The reconstructed blocks filtered by the deblocking filter 562, the SAO filter 564, and the ALF 566 are stored in the memory 570. When all blocks in one picture are reconstructed, the reconstructed picture can be used as a reference picture for inter-frame prediction of blocks in a picture to be encoded later.

[0093] In some embodiments, the present disclosure relates to encoding and decoding a video image as described above. More specifically, the present disclosure provides a video encoding method and apparatus that uses template matching to search for multiple candidate prediction blocks and generates a prediction block of a current block from the searched multiple candidate prediction blocks.

[0094] The following embodiments may be performed by the intra predictor 122 in the video encoding device. The following embodiments may also be performed by the intra predictor 542 in the video decoding device.

[0095] The video encoding device encoding the current block can generate signaling information associated with the present embodiment in terms of optimizing rate distortion. The video encoding device can encode the signaling information using the entropy encoder 155 and transmit the encoded signaling information to the video decoding device. The video decoding device can decode the signaling information associated with the decoding of the current block from the bitstream using the entropy decoder 510.

[0096] In the following description, the term 'target block' may be used interchangeably with a current block or a coding unit (CU), or may refer to a certain region of a coding unit.

[0097] Additionally, a flag's value of true indicates when the flag is set to 1. Additionally, a flag's value of false indicates when the flag is set to 0.

[0098] I. Intra-frame prediction technology

[0099] As mentioned above, intra prediction is a method for predicting a current block by referring to samples existing around the block to be encoded. Figure 3A As shown in FIG. 1 , the intra prediction mode of the luminance block includes fine directional modes (such as 2 to 66) in addition to the non-directional modes (i.e., planar and DC). Figure 3BAs shown in the example in , the intra prediction mode of the luminance block includes directional modes (-14 to -1 and 67 to 80) based on wide-angle intra prediction (WAIP).

[0100] In addition, intra prediction can utilize prediction techniques such as multiple reference line intra prediction (MRLP), position-dependent intra prediction combination (PDPC), intra subpartitioning (ISP), matrix-based intra prediction (MIP), most probable mode (MPM) and template matching prediction (TMP).

[0101] In the intra prediction process using MRLP, the video encoding / decoding device can use multiple reference lines (MRL) to adopt additional reference lines. When MRL is applied, in addition to the original reference line, the video encoding / decoding device can also use two additional sample lines attached to the top edge and the left edge of the current block to perform intra prediction on the current block. In order to select a reference line when applying MRL, an index (MRL_idx) indicating the reference line can be sent to the video decoding device with a signal.

[0102] Among the intra prediction methods, one of the rule-based prediction methods is position-dependent intra prediction combination (PDPC). In other words, a predictor can be generated based on a predefined operation by using encoding information of a target block on which intra prediction is performed and spatially adjacent neighboring pixels of the target block.

[0103] PDPC modifies the prediction samples generated according to a specific intra prediction mode to create an intra predictor for the current block. Figure 3A Among the prediction modes shown, specific intra-frame prediction modes include planar mode, DC mode, horizontal mode (prediction mode 18), vertical mode (prediction mode 50), a directional mode along the diagonal line in the lower left direction (prediction block 2) and its 15 adjacent directional modes, and a directional mode along the diagonal line in the upper right direction (prediction mode 66) and its 15 adjacent directional modes.

[0104] In PDPC, pixel values ​​of prediction samples of a current block generated according to a specific intra prediction mode may be adjusted using predefined weights and location information of neighboring pixels.

[0105] ISP technology divides the current block into smaller sub-blocks of equal size, sharing the same intra prediction mode between all sub-blocks while allowing separate transformations for each sub-block. The block can be divided in either horizontal or vertical directions.

[0106] Hereinafter, the larger block before division is referred to as a current block, and each of the smaller divided blocks is referred to as a sub-block.

[0107] When splitting the current block horizontally or vertically, if the size of the current block is too small, the coding efficiency of the split sub-blocks may decrease, or the sub-blocks may become smaller than the minimum unit required for the transform, making it impossible to transform. To prevent such situations, the application of ISP may be limited based on the size of the sub-blocks obtained after splitting. In other words, splitting can be applied when the number of pixels in the split sub-block is 16 or more. For example, if the size of the current block is 4×4, ISP is not applied. Blocks of size 4×8 or 8×4 can be split into two sub-blocks of the same shape and size, called Half_Split. Blocks of other sizes can be split into four sub-blocks of the same shape and size, called Quarter_Split.

[0108] Using the neighboring pixels of the current block on which intra prediction is performed and the encoding information of the current block, a predictor can be generated based on a predefined matrix operation. This rule-based prediction method is called matrix-based intra prediction (MIP).

[0109] The MIP generates all or part of the intra predictor using predefined matrix operations. If only part of the predictor is generated, the MIP may further use the part of the predictor to perform interpolation for upsampling or upscaling to generate the final intra prediction samples that match the size of the current block.

[0110] Template Matching Prediction (TMP) searches for the best prediction block that minimizes the difference between templates within a predefined search area in the current frame. Here, the predefined search area exists within the reconstructed area of ​​the current frame. The current template consists of neighboring samples located above and to the left of the current block. Figure 6 As shown, TMP searches for the best similar template in the search area and derives a prediction block (or "reference block") corresponding to the best template searched. TMP uses a cost function (which calculates the difference between the current template and the searched template) to search for the template that generates the minimum cost in the search area. At this time, the sum of absolute differences (SAD) is mainly used as the cost function of template matching. TMP determines the block corresponding to the template that generates the minimum cost as the prediction block of the current block.

[0111] Intra-frame TMP is an intra-frame prediction mode using template matching, which searches for a prediction block that produces the minimum template matching cost in a search area, and uses the corresponding block as the prediction block of the current block. The video encoding device transmits a flag indicating whether the intra-frame TMP mode is used to the video decoding device (hereinafter referred to as the "template mode flag"). If the parsed flag is true, the video decoding device performs template matching-based prediction based on the same template as the template used in the video encoding device. The video decoding device searches for a template that produces the minimum value of the cost function for the current template, and uses the block corresponding to the searched template as the prediction block of the current block.

[0112] To reduce memory usage during template matching, intra-frame TMP can limit the search area to the current coding tree unit (CTU), the upper left CTU, the upper CTU, and the left CTU where the current block is located. Figure 7 In the example of , the regions represented as R1 (current CTU), R2 (upper left CTU), R3 (upper CTU), and R4 (left CTU) represent the above search regions. In addition, the search range within the search region can be adaptively determined by multiplying the height and width (BlkW, BlkH) of the current block by a predefined constant c. For example, by setting c=5, the search ranges SearchRange_w and SearchRange_h can be determined as shown in Formula 1.

[0113] [Formula 1]

[0114] SearchRange_w=c×BlkW

[0115] SearchRange_h=c×BlkH

[0116] The MPM technology utilizes the intra prediction mode of the neighboring blocks during the intra prediction of the current block. By transmitting the index of the MPM list instead of the index of the prediction mode, the video encoding device can improve the encoding efficiency of the intra prediction mode.

[0117] The template-based intra-frame mode derivation (TIMD) method includes, after performing prediction for each intra-frame prediction mode stored in the MPM list to generate a prediction template in the template area, calculating the cost between the pixels of the generated prediction template and the pixels of the previously reconstructed template. The TIMD method includes selecting two intra-frame prediction modes as TIMD modes in ascending order of cost. After applying the PDPC process to the prediction blocks derived according to the two TIMD modes to generate a filtered prediction block, the TIMD method may include: applying weights to the filtered prediction blocks to construct a final intra-frame prediction block.

[0118] The decoder-side intra mode derivation (DIMD) method includes calculating the gradient of each sample of the neighboring samples around the current block, and deriving the prediction mode of the intra prediction of the current block from the calculated gradient. Unlike the traditional method of encoding the intra prediction mode and transmitting it to the decoder, the DIMD method enables the intra prediction mode to be derived on the decoder side.

[0119] Although the following embodiments are described with reference to a video decoding device, these embodiments may also be implemented in a video encoding device in the same or similar manner as that implemented in the video decoding device.

[0120] II. Embodiments according to the present disclosure

[0121] The above-mentioned intra-frame TMP uses a single prediction block, which hinders the improvement of prediction accuracy. The intra-frame TMP according to the present embodiment utilizes multiple candidate prediction blocks to enhance prediction accuracy.

[0122] As described above, the video decoding device constructs a plurality of candidate prediction blocks by searching the search area using template matching. If the template matching cost between the template of each candidate prediction block and the template of the current block exceeds a predefined threshold, the video decoding device excludes the corresponding candidate from the set of candidate prediction blocks. When one or more blocks are used as prediction candidates, the video decoding device may generate a final prediction block by performing a weighted combination of the candidate prediction blocks. At this time, each weight for the weighted combination may be determined based on the template matching cost. At the same time, if no block exhibits a template matching cost below the predefined threshold, the video decoding device may use a single prediction block by default according to a conventional method.

[0123] In the following, an embodiment of constructing a plurality of candidate prediction blocks using template matching is described.

[0124] The video decoding device establishes a search area to search for multiple candidate blocks, and uses the traditional TMP method to calculate the cost function value (i.e., template matching cost) of the blocks in the search area. The video decoding device forms a set B = {B 1 ,B 2 ,…,B N}, the set consists of N (where N is a natural number) candidate blocks B 1 ,B 2 ,…,B N The composition is arranged in the order of increasing template matching cost. In set B, B 1 has the minimum cost, and the cost increases as the corresponding index increases.

[0125] If two candidate blocks exhibit the same cost when forming set B, the video decoding device may follow one or a combination of the following methods to select one of the two candidate blocks.

[0126] The video decoding device may select a block that is first searched according to the TMP method between the two candidate blocks. The video decoding device may select a block that is closer to the current block. The video decoding device may select a block with a higher priority included in the CTU, where the priority is arranged in the order of the current CTU, R2, R3, and R4. The video decoding device may average the two blocks at the same cost to generate a new block, and may include the newly generated block in set B to replace the two blocks.

[0127] The video decoding device may remove some blocks from the set based on the template matching cost instead of using all the blocks included in the set B. In the following, the candidate block B 1,B 2 ,…,B N The template matching costs are defined as C 1 ,C 2 ,…,C N The video decoding device may directly use the SAD as the cost C according to the cost function. Alternatively, the video decoding device may also use a value generated by dividing the SAD by the height, width, or size of the current block as the cost C. The video decoding device may also use one of the following methods to remove the candidate block.

[0128] For example, if the cost value C i (where 1≤i≤N) exceeds a predefined threshold, the video decoding device removes all candidate blocks with indexes greater than or equal to i from set B.

[0129] In another example, if the cost value C i-1 and C i If the difference between exceeds a predefined threshold, the video decoding device removes all candidate blocks with indexes greater than or equal to i from set B.

[0130] According to an embodiment, all candidate blocks except a single block may be removed from the set B. In this case, the above method is the same as the conventional intra TMP method using a single prediction block.

[0131] In yet another example, the number of candidate blocks may be predefined according to a protocol between the video encoding device and the video decoding device, rather than determining the number of candidate blocks based on the template matching cost. For example, N may be predefined as N=2.

[0132] Hereinafter, embodiments of generating a prediction block of a current block using candidate prediction blocks are described.

[0133] Based on the above candidate removal process, assume that the set B contains M blocks (where 1≤M≤N). In other words, B={B 1 ,B 2 ,…,B M Using one or more of the M blocks, the video decoding device can generate a prediction block P of the current block as shown in Formula 2.

[0134] [Formula 2]

[0135] P=w 1 B 1 +w 2 B 2 +…+w M B M

[0136] Meanwhile, even if the candidate elimination process (M=N) is not adopted, Formula 2 can be applied.

[0137] In Formula 2, the weight w i It can be calculated according to one or a combination of the following methods.

[0138] Video decoding device using C i (1≤i≤M) calculate w i For example, w i The calculation formula is w i =(CC i ) / ((M-1)·C). Here, C is C i The sum of M values ​​of .

[0139] The video decoding device can use the predefined constant w i For example, w i Can be set to w i =1 / M. In this case, the weight may be predefined according to an agreement between the video encoding device and the video decoding device.

[0140] The video encoding device can send a signal w to the video decoding device i . In parsing w i Thereafter, the video decoding device may use the weights to generate a prediction block for the current block.

[0141] w i Some of (1≤i≤M) can be set to zero.

[0142] As described above, during the process of selecting multiple candidate blocks, if the template matching cost is greater than a threshold, the corresponding block is removed from set B. In the process of generating a prediction block for the current block, the template matching cost can be used instead of using the removal process. For example, if the cost value C M+1 If the threshold is exceeded, the video decoding device may set the weights of all candidate blocks with indexes greater than or equal to M+1 to zero. In addition, the video decoding device may determine the weights of candidate blocks with indexes less than or equal to M according to one of the following methods.

[0143] Video decoding device using C i (1≤i≤M) calculate w i For example, w i It can be calculated as w i =(CC i ) / ((M-1)·C). Here, C is the sum of the costs of candidate blocks with indices less than or equal to M.

[0144] The video decoding device can use the predefined constant w i For example, w i Can be set to w i=1 / M. In this case, the weight may be predefined according to an agreement between the video encoding device and the video decoding device.

[0145] The video encoding device can send a signal w to the video decoding device i . In parsing w i Thereafter, the video decoding device may use the weights to generate a prediction block for the current block.

[0146] w i Some of (1≤i≤M) can be set to zero.

[0147] Finally, the video decoding device can generate a prediction block of the current block according to Formula 2.

[0148] As described above, when selecting a plurality of candidate blocks, if the template matching cost exceeds a threshold, the corresponding block is removed from the set B. For example, instead of using the removal process, the video decoding device may generate a new candidate block by averaging the candidate blocks, and the new candidate block may be used. For example, if the cost value C i (where 1≤i≤N) exceeds a predefined threshold, the video decoding device may generate a new candidate block by averaging the candidate blocks with indexes greater than i. Subsequently, the video decoding device may include the new candidate block in set B to replace the candidate block with index greater than i. Alternatively, if the cost value C i-1 and C i If the difference between is greater than a predefined threshold, the video decoding device may also generate a new candidate block by averaging the candidate blocks with indexes greater than i. Afterwards, the video decoding device may include the new candidate block in set B to replace the candidate blocks with indexes greater than i.

[0149] Meanwhile, for example, if no block exhibits a template matching cost below a predefined threshold, the video decoding device may use only the prediction block B exhibiting the minimum template matching cost. 1 To configure Formula 2. This situation is the same as the conventional intra TMP using a single prediction block.

[0150] According to the above process, the video decoding device can select multiple candidate blocks, and can generate a final prediction block using the prediction blocks included in the set B. Hereinafter, a method for generating a final prediction block using both a prediction block based on a template matching search and a prediction block D generated based on neighboring samples of a current block is described. For example, the video decoding device can generate a prediction block D based on neighboring samples of the current block according to one or a combination of the following methods.

[0151] For example, the video decoding device may derive a prediction mode according to the DIMD method, and may generate the prediction block D using the derived prediction mode.

[0152] In another example, the video decoding device may derive a prediction mode according to the TIMD method, and may generate the prediction block D using the derived prediction mode.

[0153] In yet another example, the video decoding device may generate the prediction block D using a conventional directional prediction mode or MIP technology.

[0154] Subsequently, the video decoding apparatus may generate a final prediction block P as shown in Formula 3 by using the template matching-based prediction block B included in the set B and the prediction block D generated using the adjacent reference samples.

[0155] [Formula 3]

[0156] P=w 1 B+(1-w 1 )D

[0157] Here, the weight w 1 It can be determined by one or a combination of the following methods.

[0158] The video decoding device can use the predefined constant w i For example, w i Can be set to w i = 1 / 2. In this case, the weight may be predefined according to an agreement between the video encoding device and the video decoding device.

[0159] The video encoding device can send a signal w to the video decoding device 1 . In parsing w 1 Thereafter, the video decoding device may use the weights to generate a prediction block for the current block.

[0160] The video encoding device may utilize the cost C of the prediction block B. For example, if the cost C exceeds a predefined threshold, the video encoding device may 1 On the other hand, if the cost C is less than or equal to the predefined threshold, the video encoding device may set w 1 Set to 1 / 2.

[0161] Although Formula 2 for intra-frame prediction is introduced in the present disclosure, Formula 2 can also be extended to inter-frame prediction. After searching reference frames for multiple candidate blocks, the video decoding device constructs a set of N candidate blocks B according to the order of increasing matching cost. 1 ,B 2 ,…,B N The set {B 1 ,B 2 ,…,B M}. In set B, B 1 The cost is the smallest, and as the index i (1≤i≤N) increases, the corresponding cost also increases.

[0162] Similar to the method represented by Formula 2, the video decoding device can use the weighted sum of the candidate blocks to generate a prediction block. At this time, the video decoding device uses C i Calculate w i For example, w i The calculation formula is w i =(CC i ) / ((N-1)·C). Here, C is C i The sum of N values ​​of .

[0163] In the following, reference Figure 8 and Fig. 9 A method of performing intra template matching prediction using multiple candidate prediction blocks is described.

[0164] Figure 8 The flowchart shows a method for encoding a current block based on intra-frame template matching prediction by a video encoding device according to an embodiment of the present disclosure.

[0165] The video encoding apparatus establishes a search area for template matching (S800).

[0166] The search area may be established within the reconstruction area of ​​the current frame. To reduce memory usage during template matching, the video encoding device may establish the search area to include the current CTU, the upper left CTU, the upper CTU, and the left CTU.

[0167] The video encoding apparatus searches a search area based on a template of a current block to generate a plurality of candidate prediction blocks indexed in order of increasing template matching cost and forms a set of candidate prediction blocks (S802).

[0168] If the template matching costs of the two candidate prediction blocks are the same, the video encoding device may select one of the two blocks as follows. For example, the video decoding device may select a block that is first searched during the search process between the two candidate prediction blocks. The video encoding device may select a block that is closer to the current block from the two candidate prediction blocks. The video encoding device may select a block with a higher priority included in the CTU, where the priority is arranged in the order of the current CTU, the upper left CTU, the upper CTU, and the left CTU. In addition, the video encoding device may average the two candidate prediction blocks to generate a new block, and may include the new block in the set of candidate prediction blocks to replace the two candidate prediction blocks.

[0169] The video encoding device may remove some blocks from the set of candidate prediction blocks based on the template matching cost. At this time, the video encoding device may use the cost function value of each candidate prediction block as the template matching cost. Alternatively, the video encoding device may use a value generated by dividing the cost function value by the height, width or size of the current block as the template matching cost.

[0170] For example, if the template matching cost of a candidate prediction block with index i exceeds a predefined threshold, the video encoding device may remove the candidate prediction blocks with indexes greater than or equal to i from the set of candidate prediction blocks.

[0171] In another example, if the difference between the template matching cost of the candidate prediction block with index i-1 and the template matching cost of the candidate prediction block with index i exceeds a predefined threshold, the video encoding device may remove the candidate prediction blocks with indexes greater than or equal to i from the set of candidate prediction blocks.

[0172] The video encoding apparatus obtains weights of candidate prediction blocks (S804).

[0173] The video encoding apparatus may calculate a weight of each candidate prediction block based on a template matching cost of each candidate prediction block.

[0174] The video encoding device may use the predefined weights as weights of the candidate prediction blocks. At this time, the weights may be predefined according to an agreement between the video encoding device and the video decoding device.

[0175] At the same time, the video encoding device can obtain the weights from a higher level. Subsequently, the video encoding device can send the weights to the video decoding device using a signal.

[0176] The video encoding apparatus generates a first prediction block of the current block by weighted-combining one or more candidate prediction blocks using a weight (S806).

[0177] The video encoding device acquires an intra prediction mode (S808). Here, the intra prediction mode is a prediction mode that does not use template matching prediction. For example, the video encoding device can acquire the intra prediction mode from a higher level.

[0178] The video encoding apparatus generates a second prediction block of a current block using an intra prediction mode (S810).

[0179] The video encoding apparatus determines a template mode flag based on the first prediction block and the second prediction block (S812). Here, the template mode flag indicates whether to use intra template matching prediction.

[0180] From the perspective of rate-distortion optimization, the video encoding device may compare the first prediction block and the second prediction block to determine the template mode flag. For example, if the first prediction block is optimal, the video encoding device may set the template mode flag to true. On the other hand, if the second prediction block is optimal, the video encoding device may set the template mode flag to false.

[0181] The video encoding apparatus encodes the template mode flag (S814).

[0182] Subsequently, based on the template mode flag, the video encoding apparatus generates a residual signal by subtracting the first prediction block or the second prediction block from the current block. The video encoding apparatus may generate a bit stream of the residual signal by quantizing, transforming, and entropy encoding the residual signal.

[0183] Fig. 9 The flowchart shows a method for decoding a current block based on intra-frame template matching prediction by a video decoding device according to an embodiment of the present disclosure.

[0184] The video decoding apparatus decodes a template mode flag from a bitstream (S900). Here, the template mode flag indicates whether intra-frame template matching prediction is used.

[0185] The video decoding device checks a template mode flag (S902).

[0186] If the template mode flag is true (Yes in S902 ), the video decoding device performs the following steps.

[0187] The video decoding apparatus establishes a search area for template matching (S904).

[0188] The video decoding apparatus searches the search area based on the template of the current block to generate a plurality of candidate prediction blocks indexed in order of increasing template matching cost and forms a set of candidate prediction blocks (S906).

[0189] The video decoding apparatus obtains the weight of the candidate prediction block (S908).

[0190] The video decoding device may calculate a weight of each candidate prediction block based on a template matching cost of each candidate prediction block.

[0191] The video decoding device may use the predefined weight as the weight of the candidate prediction block. Here, the weight may be predefined according to an agreement between the video encoding device and the video decoding device.

[0192] Meanwhile, the video decoding device may decode the weights from the bitstream.

[0193] The video decoding apparatus generates a prediction block of a current block by weighted-combining one or more candidate prediction blocks using a weight ( S910 ).

[0194] On the other hand, if the template mode flag is false (No in S902), the video decoding device performs the following steps.

[0195] The video decoding apparatus decodes an intra prediction mode from a bitstream (S920). Here, the intra prediction mode is a prediction mode that does not use template matching prediction.

[0196] The video decoding apparatus generates a prediction block of the current block using the intra prediction mode (S922).

[0197] Subsequently (after S910 or S922 ), the video decoding apparatus may reconstruct the current block by decoding the residual signal and adding the decoded residual signal to the prediction block.

[0198] Although the steps in each flow chart are described as being performed in sequence, these steps only illustrate the technical ideas of some embodiments of the present disclosure. Therefore, a person of ordinary skill in the art to which the present disclosure relates can perform these steps by changing the order described in each figure or performing two or more steps in parallel. Therefore, the steps in each flow chart are not limited to the chronological order shown. It should be understood that the above description presents illustrative embodiments that can be implemented in various other ways. The functions described in some embodiments can be implemented by hardware, software, firmware and / or a combination thereof. It should also be understood that the functional components described in the present disclosure are marked with "... units" to strongly emphasize the possibility of their independent implementation.

[0199] At the same time, the various methods or functions described in some embodiments may be implemented as instructions stored in a non-transitory recording medium that can be read and executed by one or more processors. The non-transitory recording medium may include, for example, various types of recording devices in which data is stored in a form readable by a computer system. For example, the non-transitory recording medium may include a storage medium such as an erasable programmable read-only memory (EPROM), a flash drive, an optical drive, a magnetic hard drive, and a solid-state drive (SSD).

[0200] Although the embodiments of the present disclosure are described for the purpose of illustration, it should be understood by those skilled in the art that various modifications, additions and substitutions may be made without departing from the concept and scope of the present disclosure. Therefore, for the sake of simplicity and clarity, the embodiments of the present disclosure have been described. The scope of the technical ideas of the embodiments of the present disclosure is not limited by the diagrams. Therefore, it should be understood by those skilled in the art that the scope of the present disclosure should not be limited by the embodiments explicitly described above, but should be limited by the claims and their equivalents.

[0201] (reference numerals)

[0202] 110: Image Splitter

[0203] 122: Intra-frame predictor

[0204] 542: Intra-frame predictor

[0205] CROSS-REFERENCE TO RELATED APPLICATIONS

[0206] This application claims priority to and the benefit of Korean Patent Application No. 10-2022-0126633, filed on October 4, 2022, and Korean Patent Application No. 10-2023-0111332, filed on August 24, 2023, the entire contents of each of which are incorporated herein by reference.

Claims

1. A method for decoding a current block, the method being performed by a video decoding device, the method comprising the following steps: Establishing a search area for template matching; Searching the search area based on the template of the current block to generate a plurality of candidate prediction blocks indexed in order of increasing template matching cost, and forming a set of the candidate prediction blocks; Obtaining the weight of the candidate prediction block; as well as The prediction block of the current block is generated by weightedly combining one or more of the candidate prediction blocks using the weights.

2. The method according to claim 1, further comprising the steps of: decoding a template mode flag from a bitstream, wherein the template mode flag indicates whether intra-frame template matching prediction is used; as well as Check the template mode flag, Wherein when the template mode flag is true, The step of establishing the search area to generate the prediction block is performed.

3. The method according to claim 2, when the template mode flag is false, further comprising the following steps: decoding an intra prediction mode that does not use the intra template matching prediction from the bitstream; as well as A prediction block of the current block is generated using the intra prediction mode.

4. The method according to claim 1, wherein when the template matching costs of two candidate prediction blocks are the same, the step of forming the set comprises: A block that is searched first during the search process is selected between the two candidate prediction blocks.

5. The method according to claim 1, wherein when the template matching costs of two candidate prediction blocks are the same, the step of forming the set comprises: The two candidate prediction blocks are averaged to generate a new block, and the new block is included in the set of candidate prediction blocks to replace the two candidate prediction blocks.

6. The method of claim 1, wherein the step of forming the set comprises: Removing some blocks from the set of candidate prediction blocks based on template matching cost, The cost function value of each candidate prediction block is used as the template matching cost, or the value generated by dividing the cost function value by the height, width or size of the current block is used as the template matching cost.

7. The method according to claim 6, wherein when the template matching cost of the candidate prediction block with index i exceeds a predefined threshold, the step of removing some blocks from the set of candidate prediction blocks comprises: The candidate prediction blocks with indexes greater than or equal to i are removed from the set of candidate prediction blocks.

8. The method according to claim 6, wherein when the difference between the template matching cost of the candidate prediction block with index i-1 and the template matching cost of the candidate prediction block with index i exceeds a predefined threshold, the step of removing some blocks from the set of candidate prediction blocks comprises: The candidate prediction blocks with indexes greater than or equal to i are removed from the set of candidate prediction blocks.

9. The method according to claim 1, wherein the step of obtaining the weight comprises: The weight of each candidate prediction block is calculated based on the template matching cost of each candidate prediction block, or a predefined weight is used as the weight of each candidate prediction block.

10. The method of claim 1, wherein the step of forming the set comprises: generating a new candidate block by averaging the candidate prediction blocks based on the template matching cost; as well as The new candidate block is included in the set of candidate prediction blocks.

11. The method according to claim 10, wherein when the template matching cost of the candidate prediction block with index i exceeds a predefined threshold, the step of generating the new candidate block comprises: The new candidate block is generated by averaging the candidate prediction blocks with indexes greater than or equal to i.

12. The method according to claim 10, wherein when the difference between the template matching cost of the candidate prediction block with index i-1 and the template matching cost of the candidate prediction block with index i exceeds a predefined threshold, the step of generating the new candidate block comprises: The new candidate block is generated by averaging the candidate prediction blocks with indexes greater than or equal to i.

13. A method for encoding a current block, the method being performed by a video encoding device, the method comprising the following steps: Establishing a search area for template matching; Searching the search area based on the template of the current block to generate a plurality of candidate prediction blocks indexed in order of increasing template matching cost, and forming a set of the candidate prediction blocks; Obtaining the weight of the candidate prediction block; as well as A first prediction block of the current block is generated by weightedly combining one or more of the candidate prediction blocks using the weights.

14. The method according to claim 13, further comprising the steps of: Obtaining an intra prediction mode that does not use intra template matching prediction; and A second prediction block for the current block is generated using the intra prediction mode.

15. The method according to claim 14, further comprising the steps of: Determine a template mode flag based on the first prediction block and the second prediction block, wherein the template mode flag indicates whether to use the intra-frame template matching prediction; as well as The template mode flag is encoded.

16. A computer-readable recording medium storing a bit stream generated by a video encoding method, the video encoding method comprising the steps of: Establishing a search area for template matching; Searching the search area based on the template of the current block to generate a plurality of candidate prediction blocks indexed in order of increasing template matching cost, and forming a set of the candidate prediction blocks; Obtaining the weight of the candidate prediction block; as well as A first prediction block of the current block is generated by weightedly combining one or more of the candidate prediction blocks using the weights.

Citation Information

Patent Citations

  • Memory device with multi subword line driver

    KR100204542B1

  • Method of forming tungsten film and system therefor

    KR1020220126633A

  • Tile construction structure of building wall

    KR1020230111332A