Method for adaptive search region determination for template matching prediction

By adaptively determining search areas and orders using motion information, the method enhances video coding efficiency and quality for IntraTMP technology, addressing the limitations of existing video coding technologies in handling increasing video data complexities.

WO2024232516A1PCT designated stage expired Publication Date: 2024-11-14HYUNDAI MOTOR CO LTD +2

Patent Information

Application Number
PCT/KR2024/002798
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-03-04
Filing Date
2024-03-05
Publication Date
2024-11-14

AI Technical Summary

Technical Problem

Current video coding technologies, such as H.264/AVC, HEVC, and VVC, face challenges in efficiently compressing video data due to increasing image size, resolution, and frame rate, necessitating improved coding efficiency and picture quality, particularly in determining effective search areas and search orders for Intra Template Matching Prediction (IntraTMP) technology.

Method used

The method involves adaptively determining search areas and search orders for template matching in video coding by utilizing motion information to adjust the positions and order of search areas, ensuring each lower search area is included within upper search areas, and selecting a prediction block based on minimum cost template matching, thereby enhancing video coding efficiency and quality.

Benefits of technology

This approach improves video coding efficiency and quality by optimizing search areas and orders for IntraTMP technology, leading to better prediction blocks and reduced computational resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure KR2024002798_14112024_PF_FP_ABST
    Figure KR2024002798_14112024_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed are a video coding method and device using adaptive search region determination for template matching prediction. In the present embodiment, a video decoding device determines search regions for template matching in a surrounding pre-reconstructed region of a current block and determines a search order for the search regions. The video decoding device obtains motion information of adjacent regions of the current block and then changes the positions of the search regions and the search order on the basis of the motion information. The video decoding device performs a search for each region according to the search order, searches for a template with the lowest cost on the basis of the cost of template matching, and determines a prediction block of the current block on the basis of the template with the lowest cost.
Need to check novelty before this filing date? Find Prior Art

Description

A method for adaptive search space determination for template matching prediction.

[0001] The present disclosure relates to a video coding method and apparatus using adaptive search region determination for template matching prediction.

[0002] The content described below merely provides background information related to the present invention and does not constitute prior art.

[0003] Since video data has a large amount of data compared to voice data or still image data, it requires a lot of hardware resources, including memory, to store or transmit it without processing for compression.

[0004] Therefore, when storing or transmitting video data, an encoder is used to compress the video data and store or transmit it, and a decoder receives the compressed video data, decompresses it, and plays it back. Examples of such video compression technologies include H.264 / AVC, HEVC (High Efficiency Video Coding), and VVC (Versatile Video Coding), which improves encoding efficiency by about 30% compared to HEVC.

[0005] However, as the size, resolution, and frame rate of images are gradually increasing, and the amount of data that needs to be encoded is also increasing, a new compression technology that has better encoding efficiency and better image quality improvement than existing compression technologies is required.

[0006] In the next-generation technology, ECM (Enhanced Compression Model), IntraTMP (Intra Template Matching Prediction) technology sets L-shaped / left / top templates around the current block, searches for the template most similar to the current template in the restoration area of ​​the current frame, and then uses a block adjacent to the searched template and having the same size as the current block as the prediction block of the current block. The IntraTMP technology searches for similar templates based on a loss function, and uses SAD (Sum of Absolute Differences) as the loss function. For template matching, four search regions, such as the example in Fig. 6, are used. The IntraTMP technology uses a search order of R4 → R1 → R3 → R2 for the search regions illustrated in Fig. 6, and uses a reverse z-scan order that searches from the bottom right to the top left in each search region. These search regions and search orders are just examples. Therefore, in order to improve video encoding efficiency and enhance video quality, a method for effectively determining the search area and search order when applying IntraTMP technology to the current block is required.

[0007] The present disclosure aims to provide a video coding method and device that adaptively determines search areas for template matching and a search order for the search areas when applying IntraTMP (Intra Template Matching Prediction) technology to a current block.

[0008] According to an embodiment of the present disclosure, a method for restoring a current block, performed by an image decoding device, is provided, characterized in that the method comprises: determining lower search areas for template matching in a reconstructed area neighboring the current block, wherein each lower search area is included in one of upper search areas, and the upper search areas are composed of an upper search area, a left search area, and an upper left search area, and each upper search area includes at least two lower search areas; obtaining motion information of adjacent areas of the current block; changing positions of the lower search areas based on the motion information; determining a search order for the lower search areas based on a distance from the current block; performing a search for each area according to the search order to search for a template with a minimum cost based on a cost according to the template matching, wherein the cost depends on a difference between the template of the current block and a template in each of the lower search areas; and determining a prediction block of the current block based on the template with the minimum cost.

[0009] According to another embodiment of the present disclosure, a method for encoding a current block, performed by a video encoding device, is provided, comprising: determining lower search areas for template matching in a neighboring reconstructed area of ​​the current block, wherein each lower search area is included in one of upper search areas, and the upper search areas are composed of an upper search area, a left search area, and an upper left search area, and each upper search area includes at least two lower search areas; obtaining motion information of adjacent areas of the current block; changing positions of the lower search areas based on the motion information; determining a search order for the lower search areas based on a distance from the current block; performing a search for an area by area according to the search order and searching for a template with a minimum cost based on a cost according to the template matching, wherein the cost depends on a difference between the template of the current block and a template in each of the lower search areas; and determining a first prediction block of the current block based on the template with the minimum cost.

[0010] According to another embodiment of the present disclosure, a recording medium is provided, characterized in that the recording medium comprises the steps of: determining lower search areas for template matching in a neighboring reconstructed area of ​​a current block, wherein each lower search area is included in one of upper search areas, and the upper search areas are composed of a top search area, a left search area, and an upper left search area, and each upper search area includes at least two lower search areas; obtaining motion information of adjacent areas of the current block; changing positions of the lower search areas based on the motion information; determining a search order for the lower search areas based on a distance from the current block; performing a search for an area according to the search order to search for a template with a minimum cost based on a cost according to the template matching, wherein the cost depends on a difference between the template of the current block and a template in each of the lower search areas; and determining a prediction block of the current block based on the template with the minimum cost.

[0011] As described above, according to the present embodiment, when applying the IntraTMP technology to the current block, a video coding method and device are provided that adaptively determine search areas for template matching and a search order for the search areas, thereby making it possible to improve video encoding efficiency and enhance video quality.

[0012] FIG. 1 is an exemplary block diagram of an image encoding device capable of implementing the techniques of the present disclosure.

[0013] Figure 2 is a drawing for explaining a method of dividing a block using the QTBTTT (QuadTree plus BinaryTree TernaryTree) structure.

[0014] FIGS. 3A and 3B are diagrams illustrating multiple intra prediction modes, including wide-angle intra prediction modes.

[0015] Figure 4 is an example diagram of the surrounding blocks of the current block.

[0016] FIG. 5 is an exemplary block diagram of an image decoding device capable of implementing the techniques of the present disclosure.

[0017] Figure 6 is an example diagram showing search areas in IntraTMP (Intra Template Matching Prediction).

[0018] Figure 7 is an example diagram showing changes in search areas in IntraTMP.

[0019] FIG. 8 is an exemplary diagram showing search areas in IntraTMP according to one embodiment of the present disclosure.

[0020] FIG. 9 is a block diagram illustrating in detail a portion of an image decoding device according to one embodiment of the present disclosure.

[0021] FIG. 10 is an exemplary diagram showing a template according to one embodiment of the present disclosure.

[0022] FIG. 11 is an exemplary diagram showing blocks surrounding a current block according to one embodiment of the present disclosure.

[0023] FIG. 12 is an exemplary diagram showing search areas in IntraTMP according to another embodiment of the present disclosure.

[0024] FIG. 13 is an exemplary diagram showing changes in search areas according to one embodiment of the present disclosure.

[0025] FIG. 14 is an exemplary diagram showing changes in search areas according to another embodiment of the present disclosure.

[0026] FIG. 15 is a flowchart illustrating a method for an image encoding device to encode a current block according to one embodiment of the present disclosure.

[0027] FIG. 16 is a flowchart illustrating a method for an image decoding device to restore a current block according to one embodiment of the present disclosure.

[0028] Hereinafter, embodiments of the present invention will be described in detail with reference to exemplary drawings. When designating components in each drawing, it should be noted that, where possible, identical components are given the same reference numerals, even if they appear in different drawings. Furthermore, in describing the present embodiments, detailed descriptions of related known structures or functions will be omitted if they are deemed to obscure the gist of the present embodiments.

[0029] FIG. 1 is an exemplary block diagram of an image encoding device capable of implementing the techniques of the present disclosure. Hereinafter, the image encoding device and its subcomponents will be described with reference to the illustration in FIG. 1.

[0030] The video encoding device may be configured to include a picture segmentation unit (110), a prediction unit (120), a subtractor (130), a transformation unit (140), a quantization unit (145), a reordering unit (150), an entropy encoding unit (155), an inverse quantization unit (160), an inverse transformation unit (165), an adder (170), a loop filter unit (180), and a memory (190).

[0031] Each component of the video encoding device may be implemented in hardware, software, or a combination of hardware and software. Furthermore, the functions of each component may be implemented in software, with a microprocessor executing the software functions corresponding to each component.

[0032] A single image (video) is composed of one or more sequences containing multiple pictures. Each picture is divided into multiple regions, and encoding is performed for each region. For example, a single picture is divided into one or more tiles and / or slices. Here, one or more tiles can be defined as a tile group. Each tile or slice is divided into one or more Coding Tree Units (CTUs). Each CTU is then divided into one or more Coding Units (CUs) by a tree structure. Information applied to each CU is encoded as the syntax of the CU, and information commonly applied to CUs included in a CTU is encoded as the syntax of the CTU. In addition, information commonly applied to all blocks within a single slice is encoded as the syntax of the slice header, and information applied to all blocks constituting one or more pictures is encoded in the Picture Parameter Set (PPS) or the picture header. Furthermore, information commonly referenced by multiple pictures is encoded in a Sequence Parameter Set (SPS). And, information commonly referenced by one or more SPS is encoded in a Video Parameter Set (VPS). In addition, information commonly applied to one tile or tile group may be encoded as syntax of a tile or tile group header. Syntaxes included in an SPS, PPS, slice header, tile or tile group header may be referred to as high level syntax.

[0033] The picture segmentation unit (110) determines the size of the CTU. Information about the size of the CTU (CTU size) is encoded as the syntax of SPS or PPS and transmitted to the image decoding device.

[0034] The picture segmentation unit (110) divides each picture constituting an image into a plurality of CTUs having a predetermined size, and then recursively divides the CTUs using a tree structure. A leaf node in the tree structure becomes a CU, which is a basic unit of encoding.

[0035] The tree structure may be a QuadTree (QT) in which an upper node (or parent node) is divided into four lower nodes (or child nodes) of the same size, a BinaryTree (BT) in which an upper node is divided into two lower nodes, or a TernaryTree (TT) in which an upper node is divided into three lower nodes in a 1:2:1 ratio, or a structure that mixes two or more of the QT structures, BT structures, and TT structures. For example, a QTBT (QuadTree plus BinaryTree) structure may be used, or a QTBTTT (QuadTree plus BinaryTree TernaryTree) structure may be used. Here, BTTT may be combined and referred to as a MTT (Multiple-Type Tree).

[0036] Figure 2 is a drawing for explaining a method of dividing a block using the QTBTTT structure.

[0037] As illustrated in FIG. 2, a CTU may first be split into a QT structure. The quadtree splitting may be repeated until the size of the splitting block reaches the minimum block size (MinQTSize) of the leaf node allowed in the QT. A first flag (QT_split_flag) indicating whether each node of the QT structure is split into four nodes of the lower layer is encoded by the entropy encoding unit (155) and signaled to the image decoding device. If the leaf node of the QT is not larger than the maximum block size (MaxBTSize) of the root node allowed in the BT, it may be further split into one or more 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 in which the block of the corresponding node is split horizontally and two directions in which the block is split vertically. As illustrated in FIG. 2, when MTT splitting begins, a second flag (mtt_split_flag) indicating whether nodes have been split, and if splitting has occurred, a flag indicating the splitting direction (vertical or horizontal) and / or a flag indicating the splitting type (Binary or Ternary) are encoded by the entropy encoding unit (155) and signaled to the image decoding device.

[0038] Alternatively, before encoding the first flag (QT_split_flag) indicating whether each node is split into four nodes of a lower layer, a CU split flag (split_cu_flag) indicating whether the node is split may be encoded. If the CU split flag (split_cu_flag) value indicates that the node is not split, the block of the corresponding node becomes a leaf node in the split tree structure and becomes a CU (coding unit), which is a basic unit of encoding. If the CU split flag (split_cu_flag) value indicates that the node is split, the video encoding device starts encoding from the first flag in the above-described manner.

[0039] As another example of a tree structure, when QTBT is used, there may be two types: a type that horizontally splits the block of the corresponding node into two blocks of the same size (i.e., symmetric horizontal splitting) and a type that vertically splits it (i.e., symmetric vertical splitting). 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 type of split are encoded by the entropy encoding unit (155) and transmitted to the image decoding device. Meanwhile, there may additionally be a type that splits the block of the corresponding node into two blocks of an asymmetrical shape. The asymmetric shape may include a shape that splits the block of the corresponding node into two rectangular blocks with a size ratio of 1:3, or a shape that splits the block of the corresponding node in a diagonal direction.

[0040] A CU can have various sizes depending on the QTBT or QTBTTT partitioning from the CTU. Hereinafter, 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." Depending on the QTBTTT partitioning employed, the current block may be rectangular as well as square.

[0041] The prediction unit (120) predicts the current block and generates a prediction block. The prediction unit (120) includes an intra prediction unit (122) and an inter prediction unit (124).

[0042] In general, each current block within a picture can be predictively coded. Prediction of the current block can typically be performed using either intra-prediction (using data from the picture containing the current block) or inter-prediction (using data from a picture coded before the picture containing the current block). Inter-prediction encompasses both unidirectional and bidirectional prediction.

[0043] The intra prediction unit (122) predicts pixels within the current block using pixels (reference pixels) located around the current block within the current picture including the current block. There are multiple intra prediction modes depending on the prediction direction. For example, as shown in Fig. 3a, the multiple intra prediction modes may include two non-directional modes including the Planar mode and the DC mode, and 65 directional modes. The surrounding pixels to be used and the calculation formula are defined differently depending on each prediction mode.

[0044] For efficient directional prediction for a rectangular current block, directional modes (intra prediction modes 67 to 80 and -1 to -14) indicated by dotted arrows in Fig. 3b may be additionally used. These may be referred to as "wide-angle intra-prediction modes." In Fig. 3b, the arrows point to corresponding reference samples used for prediction, and do not indicate the prediction direction. The prediction direction is opposite to the direction indicated by the arrows. Wide-angle intra-prediction modes are modes that perform prediction in the opposite direction of a specific directional mode without additional bit transmission when the current block is rectangular. At this time, among the wide-angle intra-prediction modes, some wide-angle intra-prediction modes available for the current block may be determined based on the ratio of the width and height of the rectangular current block. For example, wide-angle intra prediction modes (intra prediction modes 67 to 80) having an angle less than 45 degrees are available when the current block is a rectangular shape whose height is smaller than its width, and wide-angle intra prediction modes (intra prediction modes -1 to -14) having an angle greater than -135 degrees are available when the current block is a rectangular shape whose width is larger than its height.

[0045] The intra prediction unit (122) can determine an intra prediction mode to be used to encode the current block. In some examples, the intra prediction unit (122) can encode the current block using multiple intra prediction modes and select an appropriate intra prediction mode to be used from the tested modes. For example, the intra prediction unit (122) can calculate bit-rate distortion values ​​using rate-distortion analysis for multiple tested intra prediction modes and select an intra prediction mode with the best bit-rate distortion characteristics among the tested modes.

[0046] The intra prediction unit (122) selects one intra prediction mode from among multiple intra prediction modes and predicts the current block using surrounding pixels (reference pixels) and an operation formula determined according to the selected intra prediction mode. Information about the selected intra prediction mode is encoded by the entropy encoding unit (155) and transmitted to the image decoding device.

[0047] The inter prediction unit (124) generates a prediction block for the current block using a motion compensation process. The inter prediction unit (124) searches for a block most similar to the current block within reference pictures that were encoded and decoded before the current picture, and generates a prediction block for the current block using the searched block. Then, a motion vector (MV) corresponding to the displacement between the current block within the current picture and the prediction block within the reference picture is generated. Generally, motion estimation is performed on the luma component, and the motion vector calculated based on the luma component is used for both the luma component and the chroma component. The motion information including information on the reference picture used to predict the current block and information on the motion vector is encoded by the entropy encoding unit (155) and transmitted to the image decoding device.

[0048] The inter prediction unit (124) may perform interpolation on a reference picture or a reference block to improve prediction accuracy. That is, subsamples between two consecutive integer samples are interpolated by applying filter coefficients to a plurality of consecutive integer samples including the two integer samples. When a process of searching for a block most similar to the current block is performed on the interpolated reference picture, the motion vector can be expressed up to a precision in decimal units rather than a precision in integer sample units. The precision or resolution of the motion vector can be set differently for each target region to be encoded, such as a slice, tile, CTU, CU, etc. When such adaptive motion vector resolution (AMVR) is applied, information on the motion vector resolution to be applied to each target region must be signaled for each target region. For example, when the target region is a CU, information on the motion vector resolution applied to each CU is signaled. Information on the motion vector resolution may be information indicating the precision of a differential motion vector, which will be described later.

[0049] Meanwhile, the inter prediction unit (124) can perform inter prediction using bi-prediction. In the case of bi-prediction, two reference pictures and two motion vectors indicating the block position most similar to the current block within each reference picture are used. The inter prediction unit (124) selects a first reference picture and a second reference picture from reference picture list 0 (RefPicList0) and reference picture list 1 (RefPicList1), respectively, and searches for a block similar to the current block within each reference picture to generate a first reference block and a second reference block. Then, the first reference block and the second reference block are averaged or weighted averaged to generate a prediction block for the current block. Then, motion information including information on two reference pictures used to predict the current block and information on two motion vectors is transmitted to the entropy encoding unit (155). Here, reference picture list 0 may be composed of pictures that are before the current picture in display order among the restored pictures, and reference picture list 1 may be composed of pictures that are after the current picture in display order among the restored pictures. However, this is not necessarily limited to this, and restored pictures that are after the current picture in display order may be additionally included in reference picture list 0, and conversely, restored pictures that are before the current picture may be additionally included in reference picture list 1.

[0050] Various methods can be used to minimize the number of bits required to encode motion information.

[0051] For example, if the reference picture and motion vector of the current block are identical to those of a neighboring block, the motion information of the current block can be transmitted to the image decoding device by encoding information that can identify the neighboring block. This method is called 'merge mode'.

[0052] In merge mode, the inter prediction unit (124) selects a predetermined number of merge candidate blocks (hereinafter referred to as 'merge candidates') from the surrounding blocks of the current block.

[0053] As the surrounding blocks for deriving merge candidates, all or part 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 within the current picture may be used, as illustrated in FIG. 4. In addition, a block located within a reference picture (which may or may not be the same as the reference picture used to predict the current block) other than the current picture in which the current block is located may be used as a merge candidate. For example, a block co-located with the current block within the reference picture or blocks adjacent to the block at the co-located block may be additionally used as a merge candidate. If the number of merge candidates selected by the method described above is less than a preset number, a 0 vector is added to the merge candidates.

[0054] The inter prediction unit (124) uses these surrounding blocks to construct a merge list containing a predetermined number of merge candidates. Among the merge candidates included in the merge list, the merge candidate to be used as motion information of the current block is selected and merge index information for identifying the selected candidate is generated. The generated merge index information is encoded by the entropy encoding unit (155) and transmitted to the video decoding device.

[0055] Merge Skip mode is a special case of merge mode. After quantization, when all transform coefficients for entropy encoding are close to zero, only neighboring block selection information is transmitted without transmitting residual signals. By utilizing merge skip mode, relatively high encoding efficiency can be achieved for low-motion images, still images, and screen content images.

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

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

[0058] In AMVP mode, the inter prediction unit (124) derives predicted motion vector candidates for the motion vector of the current block using neighboring blocks of the current block. As neighboring blocks used to derive predicted motion vector candidates, 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 as shown in FIG. 4 may be used. In addition, a block located in a reference picture (which may or may not be the same as the reference picture used to predict the current block) other than the current picture in which the current block is located may be used as the neighboring block used to derive predicted motion vector candidates. For example, a block co-located with the current block in the reference picture or blocks adjacent to the block in the co-located block may be used. If the number of motion vector candidates is less than a preset number by the method described above, a 0 vector is added to the motion vector candidates.

[0059] The inter prediction unit (124) derives predicted motion vector candidates using the motion vectors of these surrounding blocks, and determines a predicted motion vector for the motion vector of the current block using the predicted motion vector candidates. Then, the predicted motion vector is subtracted from the motion vector of the current block to produce a differential motion vector.

[0060] The predicted motion vector can be obtained by applying a predefined function (e.g., median, mean, etc.) to the predicted motion vector candidates. In this case, the image decoding device also knows the predefined function. In addition, since the surrounding blocks used to derive the predicted motion vector candidates are blocks that have already been encoded and decoded, the image decoding device also already knows the motion vectors of the surrounding blocks. Therefore, the image encoding device does not need to encode information to identify the predicted motion vector candidates. Therefore, in this case, information about the differential motion vector and information about the reference picture used to predict the current block are encoded.

[0061] Alternatively, the predicted motion vector can be determined by selecting one of the predicted motion vector candidates. In this case, information for identifying the selected predicted motion vector candidate is additionally encoded, along with information about the differential motion vector and the reference picture used to predict the current block.

[0062] The subtractor (130) subtracts the prediction block generated by the intra prediction unit (122) or inter prediction unit (124) from the current block to generate a residual block.

[0063] The transformation unit (140) transforms residual signals within a residual block having pixel values ​​in a spatial domain into transform coefficients in a frequency domain. The transformation unit (140) may transform the residual signals within the residual block using the entire size of the residual block as a transformation unit, or may divide the residual block into a plurality of sub-blocks and use the sub-blocks as transformation units to perform the transformation. Alternatively, the residual signals may be transformed using only the transformation domain sub-block as a transformation unit by dividing the sub-blocks into two sub-blocks, that is, a transformation domain and a non-transform domain. Here, the transformation domain sub-block may be one of two rectangular blocks having a size ratio of 1:1 with respect to the horizontal axis (or vertical axis). In this case, a flag (cu_sbt_flag) indicating that only a sub-block has been converted, directionality (vertical / horizontal) information (cu_sbt_horizontal_flag), and / or position information (cu_sbt_pos_flag) are encoded by the entropy encoding unit (155) and signaled to the image decoding device. In addition, the size of the conversion area sub-block may have a size ratio of 1:3 with respect to the horizontal axis (or vertical axis), and in this case, a flag (cu_sbt_quad_flag) distinguishing the corresponding division is additionally encoded by the entropy encoding unit (155) and signaled to the image decoding device.

[0064] Meanwhile, the transformation unit (140) can individually perform transformations on the residual block in the horizontal and vertical directions. 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 transformation unit (140) can select one transformation function pair with the best transformation efficiency among the MTS and transform the residual block in the horizontal and vertical directions, respectively. Information (mts_idx) on the transformation function pair selected among the MTS is encoded by the entropy encoding unit (155) and signaled to the image decoding device.

[0065] The quantization unit (145) quantizes the transform coefficients output from the transform unit (140) using quantization parameters and outputs the quantized transform coefficients to the entropy encoding unit (155). The quantization unit (145) may directly quantize a related residual block without transformation for a certain block or frame. The quantization unit (145) may also apply different quantization coefficients (scaling values) according to the positions of the transform coefficients within the transform block. The quantization matrix applied to the quantized transform coefficients arranged in two dimensions may be encoded and signaled to an image decoding device.

[0066] The rearrangement unit (150) can perform rearrangement of coefficient values ​​for quantized residual values.

[0067] The reordering unit (150) can change a two-dimensional coefficient array into a one-dimensional coefficient sequence by using coefficient scanning. For example, the reordering unit (150) can output a one-dimensional coefficient sequence by scanning from the DC coefficient to the coefficients of the high-frequency region by using a zig-zag scan or a diagonal scan. Depending on the size of the transformation unit and the intra prediction mode, a vertical scan that scans the two-dimensional coefficient array in the column direction or a horizontal scan that scans the two-dimensional block-shaped coefficients in the row direction may be used instead of the zig-zag scan. That is, depending on the size of the transformation unit and the intra prediction mode, the scanning method to be used may be determined among the zig-zag scan, the diagonal scan, the vertical scan, and the horizontal scan.

[0068] The entropy encoding unit (155) generates a bitstream by encoding a sequence of one-dimensional quantized transform coefficients output from the rearrangement unit (150) using various encoding methods such as CABAC (Context-based Adaptive Binary Arithmetic Code) and Exponential Golomb.

[0069] In addition, the entropy encoding unit (155) encodes information related to block division, such as CTU size, CU division flag, QT division flag, MTT division type, and MTT division direction, so that the image decoding device can divide the block in the same manner as the image encoding device. In addition, the entropy encoding unit (155) encodes information about a prediction type indicating whether the current block is encoded by intra prediction or inter prediction, and encodes intra prediction information (i.e., information about an intra prediction mode) or inter prediction information (information about an encoding mode of motion information (merge mode or AMVP mode), a merge index in the case of a merge mode, and a reference picture index and a differential motion vector in the case of an AMVP mode) according to the prediction type. In addition, the entropy encoding unit (155) encodes information related to quantization, that is, information about a quantization parameter and information about a quantization matrix.

[0070] The inverse quantization unit (160) inversely quantizes the quantized transform coefficients output from the quantization unit (145) to generate transform coefficients. The inverse transform unit (165) transforms the transform coefficients output from the inverse quantization unit (160) from the frequency domain to the spatial domain to restore the residual block.

[0071] An adder (170) adds the restored residual block and the predicted block generated by the prediction unit (120) to restore the current block. The pixels within the restored current block are used as reference pixels when intra-predicting the next block.

[0072] The loop filter unit (180) performs filtering on restored pixels to reduce blocking artifacts, ringing artifacts, blurring artifacts, etc. that occur due to block-based prediction and transformation / quantization. The loop filter unit (180) may include all or part of a deblocking filter (182), a sample adaptive offset (SAO) filter (184), and an adaptive loop filter (ALF, 186) as an in-loop filter.

[0073] The deblocking filter (182) filters the boundaries between restored blocks to remove blocking artifacts caused by block-based encoding / decoding, and the SAO filter (184) and the ALF (186) perform additional filtering on the deblocking-filtered image. The SAO filter (184) and the ALF (186) are filters used to compensate for the differences between restored pixels and original pixels caused by lossy coding. The SAO filter (184) improves not only subjective image quality but also encoding efficiency by applying an offset in units of CTUs. In contrast, the ALF (186) performs block-based filtering, and compensates for distortion by applying different filters by distinguishing the edges and degrees of variation of the corresponding block. Information on filter coefficients to be used in the ALF can be encoded and signaled to an image decoding device.

[0074] The restored blocks filtered through the deblocking filter (182), SAO filter (184), and ALF (186) are stored in the memory (190). When all blocks within a picture are restored, the restored picture can be used as a reference picture for inter-predicting blocks within a picture to be encoded later.

[0075] The video encoding device can store the bitstream of encoded video data on a non-transitory storage medium or transmit it to the video decoding device using a communication network.

[0076] FIG. 5 is an exemplary block diagram of an image decoding device capable of implementing the techniques of the present disclosure. Hereinafter, the image decoding device and its subcomponents will be described with reference to FIG. 5.

[0077] The video decoding device may be configured to include an entropy decoding unit (510), a rearrangement unit (515), an inverse quantization unit (520), an inverse transformation unit (530), a prediction unit (540), an adder (550), a loop filter unit (560), and a memory (570).

[0078] Similar to the video encoding device of FIG. 1, each component of the video decoding device may be implemented in hardware, software, or a combination of hardware and software. Furthermore, the functions of each component may be implemented in software, with a microprocessor executing the software functions corresponding to each component.

[0079] The entropy decoding unit (510) decodes the bitstream generated by the image encoding device to extract information related to block division, thereby determining the current block to be decoded, and extracts prediction information, information on residual signals, etc. required to restore the current block.

[0080] The entropy decoding unit (510) extracts information about the CTU size from the Sequence Parameter Set (SPS) or the Picture Parameter Set (PPS), determines the size of the CTU, and divides the picture into CTUs of the determined size. Then, the CTU is determined as the top layer of the tree structure, i.e., the root node, and the CTU is divided using the tree structure by extracting division information about the CTU.

[0081] For example, when splitting a CTU using the QTBTTT structure, first, the first flag (QT_split_flag) related to the splitting of QT is extracted, and each node is split into four nodes of the lower layer. Then, for the nodes corresponding to the leaf nodes of QT, the second flag (mtt_split_flag) related to the splitting of MTT and the split direction (vertical / horizontal) and / or split type (binary / ternary) information are extracted, and the corresponding leaf nodes are split into the MTT structure. Accordingly, each node below the leaf nodes of QT are split recursively into the BT or TT structure.

[0082] As another example, when splitting a CTU using the QTBTTT structure, the CU split flag (split_cu_flag) indicating whether the CU is split is first extracted, and if the block is split, the first flag (QT_split_flag) may be extracted. During the splitting process, each node may undergo zero or more repeated QT splits followed by zero or more repeated MTT splits. For example, a CTU may undergo an MTT split right away, or conversely, may undergo only multiple QT splits.

[0083] As another example, when splitting a CTU using the QTBT structure, the first flag (QT_split_flag) related to the splitting of QT is extracted, and each node is split into four nodes of the lower layer. Furthermore, for nodes corresponding to leaf nodes of QT, a split flag (split_flag) indicating whether to further split into BTs and splitting direction information are extracted.

[0084] Meanwhile, when the entropy decoding unit (510) determines the current block to be decoded by using the division of the tree structure, it extracts information on the prediction type indicating whether the current block is intra-predicted or inter-predicted. If the prediction type information indicates intra-prediction, the entropy decoding unit (510) extracts syntax elements for intra-prediction information (intra-prediction mode) of the current block. If the prediction type information indicates inter-prediction, the entropy decoding unit (510) extracts syntax elements for inter-prediction information, i.e., information indicating a motion vector and a reference picture referenced by the motion vector.

[0085] Additionally, the entropy decoding unit (510) extracts information about the quantized transform coefficients of the current block as information related to quantization and information about residual signals.

[0086] The rearrangement unit (515) can change the sequence of one-dimensional quantized transform coefficients entropy-decoded in the entropy decoding unit (510) back into a two-dimensional coefficient array (i.e., block) in the reverse order of the coefficient scanning performed by the image encoding device.

[0087] The inverse quantization unit (520) inversely quantizes the quantized transform coefficients and inversely quantizes the quantized transform coefficients using the quantization parameters. The inverse quantization unit (520) may also apply different quantization coefficients (scaling values) to the quantized transform coefficients arranged in two dimensions. The inverse quantization unit (520) may perform inverse quantization by applying a matrix of quantized coefficients (scaling values) from an image encoding device to a two-dimensional array of quantized transform coefficients.

[0088] The inverse transform unit (530) inversely transforms the inverse quantized transform coefficients from the frequency domain to the spatial domain to restore residual signals, thereby generating a residual block for the current block.

[0089] In addition, when the inverse transform unit (530) inversely transforms only a portion of a transform block (sub-block), it extracts a flag (cu_sbt_flag) indicating that only a sub-block of the transform block has been transformed, directionality (vertical / horizontal) information (cu_sbt_horizontal_flag) of the sub-block, and / or position information (cu_sbt_pos_flag) of the sub-block, and inversely transforms the transform coefficients of the corresponding sub-block from the frequency domain to the spatial domain to restore residual signals, and fills “0” values ​​with residual signals for areas that have not been inversely transformed, thereby generating a final residual block for the current block.

[0090] In addition, when MTS is applied, the inverse transform unit (530) determines a transform function or a transform matrix to be applied in the horizontal and vertical directions using MTS information (mts_idx) signaled from the image encoding device, and performs inverse transform on the transform coefficients within the transform block in the horizontal and vertical directions using the determined transform function.

[0091] The prediction unit (540) may include an intra prediction unit (542) and an inter prediction unit (544). The intra prediction unit (542) is activated when the prediction type of the current block is intra prediction, and the inter prediction unit (544) is activated when the prediction type of the current block is inter prediction.

[0092] The intra prediction unit (542) determines the intra prediction mode of the current block among a plurality of intra prediction modes from the syntax elements for the intra prediction mode extracted from the entropy decoding unit (510), and predicts the current block using reference pixels around the current block according to the intra prediction mode.

[0093] The inter prediction unit (544) uses the syntax elements for the inter prediction mode extracted from the entropy decoding unit (510) to determine the motion vector of the current block and the reference picture referenced by the motion vector, and predicts the current block using the motion vector and the reference picture.

[0094] An adder (550) adds the residual block output from the inverse transform unit (530) and the predicted block output from the inter prediction unit (544) or the intra prediction unit (542) to restore the current block. The pixels within the restored current block are used as reference pixels when intra-predicting a block to be decoded later.

[0095] The loop filter unit (560) may include a deblocking filter (562), an SAO filter (564), and an ALF (566) as in-loop filters. The deblocking filter (562) deblocks the boundaries between restored blocks to remove blocking artifacts caused by block-by-block decoding. The SAO filter (564) and the ALF (566) perform additional filtering on restored blocks after deblocking filtering to compensate for differences between restored pixels and original pixels caused by lossy coding. The filter coefficients of the ALF are determined using information about filter coefficients decoded from the non-stream.

[0096] The restored blocks filtered through the deblocking filter (562), SAO filter (564), and ALF (566) are stored in the memory (570). When all blocks within a picture are restored, the restored picture is used as a reference picture for inter-predicting blocks within a picture to be encoded later.

[0097]

[0098] The present embodiment relates to encoding and decoding of images (video) as described above. More specifically, the present invention provides a video coding method and device that adaptively determines search areas for template matching and a search order for the search areas when applying IntraTMP (Intra Template Matching Prediction) technology to a current block.

[0099] The following embodiments may be performed by an intra prediction unit (122) within a video encoding apparatus. Additionally, they may be performed by an intra prediction unit (542) within a video decoding apparatus.

[0100] The video encoding device can generate signaling information related to the present embodiment in terms of rate distortion optimization in encoding the current block. The video encoding device can encode the signaling information using the entropy encoding unit (155) and then transmit it to the video decoding device. The video decoding device can decode the signaling information related to the decoding of the current block from the bitstream using the entropy decoding unit (510).

[0101] In the following description, the term "target block" may be used interchangeably with the current block or coding unit (CU). Alternatively, the term "target block" may also refer to a portion of a coding unit.

[0102] Also, a value of a flag being true indicates that the flag is set to 1. Also, a value of a flag being false indicates that the flag is set to 0.

[0103] I. IntraTMP (intra Template Matching Prediction)

[0104] IntraTMP, a next-generation technology called ECM (Enhanced Compression Model), sets an L-shaped / left / top template around the current block, searches for the template most similar to the current template in the current frame's undistorted region, and then uses a block adjacent to the searched template and of the same size as the current block as the prediction block for the current block. IntraTMP searches for similar templates based on a loss function, using SAD (Sum of Absolute Differences) as the loss function.

[0105] As an example, four search regions for template matching can be expressed as in the example of Fig. 6. In the ECM, α illustrated in Fig. 6 is set to 5. The IntraTMP technique uses a search order of R4 → R1 → R3 → R2 for the search regions illustrated in Fig. 6, and uses a reverse z-scan order that searches from the lower right to the upper left in each search region. Instead of searching pixel by pixel in each search region, the IntraTMP technique can search for templates in units of 2 pixels after upsampling by 2x. The IntraTMP technique precisely performs template matching in the region where the template with the minimum cost exists to calculate the final template, and then determines the prediction block adjacent to the final template.

[0106] Figure 7 is an example diagram showing changes in search areas in IntraTMP.

[0107] As another example, the search areas R3 and R4 for template matching can be changed as in the example of Fig. 7. Based on the width / height (W / H) of the current block, the boundaries of the search areas in the example of Fig. 6 are determined as α×W and α×H, but in the example of Fig. 7, α×W and α×H are changed to SearchRangeWidth and SearchRangeHeight, respectively. SearchRangeWidth is defined as max(α×W, minSearchRange), and SearchRangeHeight is defined as max(α×H, minSearchRange). Similar to the example of Fig. 6, α is set to 5 in the example of Fig. 7. Additionally, minSearchRange is set to 64.

[0108] FIG. 8 is an exemplary diagram showing search areas in IntraTMP according to one embodiment of the present disclosure.

[0109] As another example, the search area for template matching can be changed as shown in the example of Fig. 8. In addition to the areas R1, R2, R3, and R4, areas R5 and R6 are added as search areas as shown in the example of Fig. 8. That is, search for template matching is possible in the newly defined areas R5 and R6. The search order according to the example of Fig. 8 is set to the order of R4 → R5 → R6 → R1 → R3 → R2.

[0110] The following embodiments are described with a focus on an image decoding device, but can be implemented identically or similarly in an image encoding device.

[0111] II. Embodiments according to the present disclosure

[0112] The video decoding device according to the present embodiment determines prediction and transformation units, and performs prediction and inverse transformation on the current block corresponding to the determined unit using the determined prediction technique and prediction mode, thereby finally generating a restoration block of the current block. The example illustrated in FIG. 9 may be performed by the inverse transformation unit (530), the prediction unit (540), and the adder (550) of the video decoding device. Meanwhile, the same operations as the example illustrated in FIG. 9 may be performed by the inverse transformation unit (165), the picture division unit (110), the prediction unit (120), and the adder (170) of the video encoding device. At this time, the video decoding device uses encoding information parsed from the bitstream, but the video encoding device may use encoding information set from a higher level in terms of minimizing rate distortion. Hereinafter, for convenience, the present embodiment will be described with a focus on the video decoding device.

[0113] As shown in the example of FIG. 5, the prediction unit (540) includes an intra prediction unit (542) and an inter prediction unit (544) depending on the prediction technology, but as shown in FIG. 9, the prediction unit (540) may include all or part of the prediction unit determination unit (902), the prediction technology determination unit (904), the prediction mode determination unit (906), and the prediction execution unit (908).

[0114] If the color format of the input video is a YUV format (such as YUV420, YUV411, YUV422, YUV444), the video decoding device can perform prediction and restoration of the chroma component after performing prediction and restoration of the luma component. That is, the luma component and the chroma component can be sequentially restored by the components illustrated in Fig. 9. Meanwhile, if the color format of the input video is RGB, the video encoding device can perform color format conversion from RGB to YUV and then encode the converted video. Here, in the case of the YUV format, the color format represents the correspondence between the pixels of the luma component and the pixels of the chroma component.

[0115] The prediction unit determination unit (902) determines a prediction unit (PU). The prediction technique determination unit (904) determines a prediction technique (e.g., intra prediction, inter prediction, IBC (Intra Block Copy) mode, palette mode, etc.) for the prediction unit. The prediction mode determination unit (906) determines a detailed prediction mode for the prediction technique. The prediction execution unit (908) generates a prediction block of the current block according to the determined prediction mode.

[0116] The inverse transform unit (530) includes a transform unit determination unit (910) and an inverse transform execution unit (912). The transform unit determination unit (910) determines a transform unit (TU) for the inverse quantization signals of the current block, and the inverse transform execution unit (912) inversely transforms the transform unit expressed as the inverse quantization signals to generate residual signals.

[0117] An adder (550) adds the prediction block and residual signals to generate a restoration block. The restoration block is stored in memory and can be used to predict other blocks.

[0118] The prediction unit determined by the prediction unit determination unit (902) may be the current block or one of the sub-blocks into which the current block is divided. At this time, the prediction unit of the chroma component may have a size corresponding to the prediction unit of the luma component according to the color format. Alternatively, after the prediction units of the luma component and the chroma component are determined separately, prediction may be performed on the prediction unit of the chroma component.

[0119] The prediction technology determination unit (904) determines the prediction technology for each prediction unit. As described above, the prediction technology may be one of inter-prediction, intra-prediction, IBC mode, and palette mode. In this case, the prediction technology for the chroma component can be determined in the same manner as the prediction technology for the corresponding luma component, without separate signaling or parsing of information.

[0120] For example, if the prediction technique of the current block is not intra prediction, the video decoding device parses 1-bit flag information. For example, if the parsed flag indicates Skip mode, the video decoding device determines the prediction mode of the current block as the merge mode of inter prediction or the IBC merge mode. In the case of Skip mode, the video decoding device can use the prediction signals as restored signals without performing the inverse transformation process (i.e., without parsing the residual signals).

[0121] On the other hand, if the parsed flag does not indicate a Skip mode for the current block, the prediction technique determination unit (904) can parse a series of 1-bit flags to determine the prediction technique of the current block as one of techniques such as inter prediction, intra prediction, IBC mode, palette mode, etc.

[0122] For example, if Skip is not applied to the current block and the prediction technique is determined to be Inter-Prediction or IBC mode, the video decoding device parses a 1-bit flag. Depending on the parsed flag, the prediction mode of the current block can be determined as either General Merge mode or Advanced Motion Vector Prediction (AMVP) mode.

[0123] The prediction mode determination unit (906) determines a detailed prediction mode for the prediction technology.

[0124] As an example, if the prediction technique of the current block is intra prediction, the prediction mode determination unit (906) can determine one directional prediction mode, a Planar mode (Horizontal Planar, Vertical Planar, or Regular Planar), or a DC mode as the prediction mode of the current block.

[0125] As another example, if the prediction technique of the current block is intra prediction, the prediction mode determination unit (906) may determine a matrix-based intra prediction mode as the prediction mode of the current block. The matrix is ​​defined in advance by an agreement between the video encoding device and the video decoding device. For matrix-based prediction, the video encoding device / video decoding device may signal / parse an index indicating the matrix used for prediction, or may signal / parse the matrix.

[0126] As another example, if the prediction technology of the current block is intra prediction, the prediction mode determination unit (906) can determine the IntraTMP mode as the prediction mode of the current block.

[0127] As illustrated in the example of Fig. 10, the IntraTMP mode uses positive integers a and b to define an L-shaped / left / above region in the surrounding restoration area of ​​the current block as a template. Thereafter, the IntraTMP mode performs template matching in the surrounding area of ​​the current block to search for similar templates to generate prediction signals of the current block.

[0128] The prediction execution unit (908) generates a prediction block of the current block according to the determined prediction technology and prediction mode.

[0129] Below, the prediction of the current block according to the IntraTMP mode is described.

[0130] The video decoding device parses a flag (hereinafter referred to as the "IntraTMP flag") indicating whether the IntraTMP mode is applied. If the IntraTMP flag is false, the video decoding device generates prediction signals for the current block according to an intra prediction mode other than the IntraTMP mode.

[0131] On the other hand, if the IntraTMP flag is true, that is, if the prediction mode is determined as IntraTMP, the video decoding device generates a prediction block of the current block as follows. The video decoding device determines search areas for template matching (TM) in the surrounding restored area of ​​the current block and determines a search order for the search areas. The video decoding device performs a search for each area according to the determined search order to search for a template with the minimum cost. For the area where the template with the minimum cost is searched, the video decoding device performs a search on a pixel-by-pixel basis to calculate an optimal template. Thereafter, the video decoding device determines a block adjacent to the calculated optimal template and having the same size as the current block as the prediction block of the current block.

[0132] At this time, in order to search for a template in each search area, the image decoding device performs a search after upsampling the template of the current block and each search area by N pixels. Here, N represents a positive integer. For each search area, the image decoding device performs a search in a set order from the lower right to the upper left of each search area. The set order may be, for example, an inverse z-scan order, an inverse diagonal scan order, or an inverse raster scan order.

[0133] For example, to determine the degree of template matching during a search, the image decoding device calculates a cost using one of the measures, such as the Sum of Absolute Differences (SAD) or the Mean Squared Error (MSE), and determines the similarity of the template matching based on the calculated cost. For example, if a template having a cost lower than a preset threshold is searched during the search of each search area, the image decoding device may terminate the search in that area early.

[0134] As an example, if the prediction mode of the current block having the size of W×H is IntraTMP, the image decoding device can determine the search areas R1 to R6 based on the integer α, as in the example of Fig. 8. In the example of Fig. 8, α is set to 5 as described above.

[0135] As an example, search areas can be set by referencing Coding Tree Units (CTUs) within the surrounding restoration areas of the current block. For example, in the example of Fig. 8, the search areas are distributed across the current CTU, the left CTU, the upper left CTU, the upper CTU, and the upper right CTU.

[0136] As an example, the image decoding device determines the search order of the search areas as R4 → R5 → R6 → R1 → R3 → R2. Additionally, the search order may be implicitly determined based on the size of the current block, information about the surrounding restoration areas, etc.

[0137] As another example, the video decoding device determines the search order in the order of top → left → top left based on the current block. In the example of Fig. 8, R6 represents an upper search area, regions R1, R3, and R4 represent an upper left search area, and regions R2 and R5 represent a left search area. For the search areas included in the top search area, the top left search area, or the left search area, the search order may be determined based on the distance from the current block. For example, the search may be performed starting from a nearby area. According to the determination of the search order described above, the video decoding device may determine the search order in the order of R6 → R5 → R2 → R4 → R3 → R1. Hereinafter, each of the top, top left, or left search areas is referred to as an upper search area, and each of the search areas R1 to R6 is referred to as a lower search area or search area.

[0138] As described above, the image decoding device performs searches in a predetermined order from the lower right to the upper left in each search area. Alternatively, the image decoding device may perform searches starting from pixels closest to the current block in each search area.

[0139] Hereinafter, the term 'adjacent' refers to a case where two objects are in spatial contact, and the term 'surrounding' includes the meaning of 'adjacent' and refers to a case where another object exists within a certain distance of one object.

[0140] As an example, the video decoding device can check the motion information of the adjacent reconstructed region of the current block as in the example of FIG. 11, and then change the search order for template matching, the size of the search region, and the position based on the checked motion information. Among the regions A to I illustrated in FIG. 11, the video decoding device can use only some regions. If IBC (Intra Block Copy) is applied to the adjacent block, the motion information is a BV (Block Vector). In addition, if the IntraTMP mode is applied to the adjacent block, the motion information is a BV according to the IntraTMP mode. Here, the BV according to the IntraTMP mode represents the displacement between the template of the adjacent block and the template of the prediction block of the adjacent block. Hereinafter, in the example of FIG. 11, the adjacent region including blocks A, B, and C is defined as the upper region of the current block, the adjacent region including blocks D, E, and F is defined as the left region of the current block, and the adjacent region including blocks G, H, and I is defined as the upper left region of the current block.

[0141] Meanwhile, IBC performs intra prediction of the current block by copying a reference block within the same frame using a block vector to generate a prediction block for the current block. The video encoding device performs block matching to derive an optimal block vector. Here, the block vector represents the displacement from the current block to the reference block.

[0142] As an example, the video decoding device can implicitly determine the search order, the size of the search region, and the position for template matching based on the motion information of the upper region, the left region, and the upper left region of the current block. The video decoding device can obtain the upper motion information of the current block by checking one or more regions among the A, B, and C blocks in the example of FIG. 11. The video decoding device can obtain the left motion information of the current block by checking one or more regions among the D, E, and F blocks in the example of FIG. 11. The video decoding device can obtain the upper left motion information of the current block by checking one or more regions among the G, H, and I blocks in the example of FIG. 11.

[0143] As an example, the motion information of the upper area, left area, or upper left area of ​​the current block may be the average or median value of the motion information of adjacent blocks included in the corresponding area.

[0144] FIG. 12 is an exemplary diagram showing search areas in IntraTMP according to another embodiment of the present disclosure.

[0145] For example, if the prediction mode of the current block having the size of W×H is IntraTMP, the image decoding device can determine search areas R0 to R8 based on the integer α, as in the example of Fig. 12. At this time, a value preset as minSearchRange can be used. The lower search areas R0 and R6 are included in the upper search area, R1, R2, R3, R4, and R5 are included in the upper left search area, and R7 and R8 are included in the left search area.

[0146] As an example, the image decoding device can determine search areas as follows.

[0147] The video decoding device can define the lower search areas for template matching of the current block as R0 to R8 as in the example of FIG. 12, and then adjust the search areas based on the motion information of the adjacent restoration area of ​​the current block.

[0148] FIG. 13 is an exemplary diagram showing changes in search areas according to one embodiment of the present disclosure.

[0149] For example, if the motion information of the left area, the upper left area, and the upper area around the current block are checked and the motion information of the left area does not exist, the video decoding device can change the R7 and R8 areas (i.e., the left search area) as in the example of Fig. 13. In the example of Fig. 13, the video decoding device moves the R7 and R8 areas, which are the left search areas, to the top of the current block. The video decoding device can change the search area by checking only the motion information of the left area and the upper area around the current block.

[0150] At this time, after defining the entire width of the search areas as S, the image decoding device can change the R7 and R8 areas while maintaining the entire width of the search areas.

[0151] As in the example of Fig. 13, when the R7 and R8 regions are changed and the changed R7 and R8 regions create a region that goes beyond the upper boundary of the CTU at the top of the current CTU, the image decoding device may not perform a search in the out-of-bounds region.

[0152] FIG. 14 is an exemplary diagram showing changes in search areas according to another embodiment of the present disclosure.

[0153] As another example, if the motion information of the left area, the upper left area, and the upper area around the current block are checked and the motion information of the upper area does not exist, the video decoding device can change the R0 and R6 areas (i.e., the upper search area) as in the example of Fig. 14. In the example of Fig. 14, the video decoding device moves the R0 and R6 areas, which are the upper search areas, to the left of the current block. The video decoding device can change the search area by checking only the motion information of the left area and the upper area around the current block.

[0154] At this time, after defining the entire width of the search areas as S, the image decoding device can change the R0 and R6 areas while maintaining the entire width of the search areas.

[0155] As in the example of Fig. 14, when the R0 and R6 regions are changed and the changed R0 and R6 regions create a region that goes beyond the left boundary of the CTU on the left side of the current CTU, the image decoding device may not perform a search in the outgoing region.

[0156] As an example, the video decoding device can determine the search order as follows.

[0157] The video decoding device can define the sub-search areas for template matching of the current block as R0 to R8 as in the example of Fig. 12, and then adjust the search order based on the motion information of the adjacent restoration area of ​​the current block.

[0158] As an example, the video decoding device can search upper search areas according to a preset search order. For example, the search areas can be searched in the order of top → left → top left. That is, the video decoding device can search areas R0 and R6, search areas R7 and R8, and then search areas R1, R2, R3, R4, and R5. As described above, the search order can be determined based on the distance from the current block for lower search areas included in the upper search area, the left search area, or the top left search area. For example, the search can be performed starting from a nearby area. Accordingly, the order of R6 → R0 in the upper search area is defined as the basic search order, the order of R8 → R7 in the left search area is defined as the basic search order, and the order of R4 → R5 → R3 → R1 → R2 in the top left search area is defined as the basic search order. In addition, the search order described above can be changed.

[0159] If one or more adjacent blocks at the top of the current block are predicted according to IBC or IntraTMP, the video decoding device determines the search order of the lower search areas included in the upper search area using the corresponding motion information. For example, if the upper motion information of the current block indicates the inside of the R0 area, the video decoding device changes the search order of the upper search area in the order of R0 → R6. On the other hand, if the upper motion information of the current block indicates the inside of the R6 area, the video decoding device maintains the basic search order in the order of R6 → R0. At this time, the video decoding device can use only the areas of the R6 area that have been restored and are available for searching. Even if the R7 and R8 areas are moved to the top of the current block according to the motion information, the change in the search order as described above can be applied.

[0160] As another example, if one or more adjacent blocks in the upper left of the current block are predicted according to IBC or IntraTMP, the video decoding device changes the search order of the lower search areas included in the upper left search area using the corresponding motion information. As described above, the upper left search area uses the order of R4 → R5 → R3 → R1 → R2 as the basic search order. The video decoding device can change the basic search order based on the motion information. With respect to the above-described basic search order, the video decoding device can determine the search order of the upper left area by changing the area indicated by the upper left motion information of the current block to the highest search order. For example, if the upper left motion information of the current block indicates the R3 area, the video decoding device can search the upper left search area in the order of R3 → R4 → R5 → R1 → R2.

[0161] As another example, if one or more adjacent blocks on the left side of the current block are predicted according to IBC or IntraTMP, the video decoding device determines the search order of the sub-search areas included in the left search area using the corresponding motion information. For example, if the left motion information of the current block indicates the inside of the R7 area, the video decoding device changes the search order of the left search area in the order of R7 → R8. On the other hand, if the left motion information of the current block indicates the inside of the R8 area, the video decoding device maintains the basic search order in the order of R8 → R7. At this time, the video decoding device can use only the areas of the R8 area that have been restored and are available for searching. Even if the R0 and R6 areas are moved to the left of the current block according to the motion information, the change in the search order as described above can be applied.

[0162] Below, we describe matters related to inverse transformation.

[0163] The entropy decoding unit (510) decodes the quantized secondary transform coefficients from the bitstream when a secondary transform is applied. On the other hand, when the secondary transform is not applied, the entropy decoding unit (510) decodes the quantized primary transform coefficients. In addition, the entropy decoding unit (510) decodes the quantization method and quantization parameters of the decoded transform coefficients.

[0164] The inverse quantization unit (520) generates inverse quantized transform coefficients by inverse quantizing the quantized transform coefficients based on the decoded quantization method and quantization parameters.

[0165] The transformation unit determination unit (910), as described above, determines a transformation unit (TU) for the current block. The unit for inverse transformation may be a single TU. Alternatively, the unit for inverse transformation may be each sub-block among multiple sub-blocks generated by dividing a single TU.

[0166] The inverse transform performing unit (912) can determine a non-separable second inverse transform kernel when a second transform is applied. In addition, the inverse transform performing unit (912) can determine a separable first inverse transform kernel or a non-separable first inverse transform kernel. As described above, the inverse transform performing unit (912) applies the determined inverse transform kernel to the inverse quantized transform coefficients to generate residual signals of the current block. Thereafter, the image decoding device adds the prediction block of the current block and the residual signals to generate a reconstructed block of the current block.

[0167] Hereinafter, a method of encoding or restoring a current block according to the IntraTMP mode is described using the cities of FIGS. 15 and 16.

[0168] FIG. 15 is a flowchart illustrating a method for an image encoding device to encode a current block according to one embodiment of the present disclosure.

[0169] The image encoding device determines sub-search areas for template matching in the restored area surrounding the current block (S1500).

[0170] Here, each sub-navigation area is contained within one of the upper navigation areas. The upper navigation areas are composed of a top navigation area, a left navigation area, and an upper-left navigation area, and each upper navigation area includes at least two sub-navigation areas.

[0171] The image encoding device obtains motion information of adjacent areas of the current block (S1502).

[0172] The adjacent regions of the current block include the upper region, the left region, and the upper left region of the current block. Each adjacent region is a restored region and contains at least one adjacent block.

[0173] When the IBC mode is applied to an adjacent block of the current block, the motion information is a block vector, and when the IntraTMP mode is applied to the adjacent block, the motion information is a displacement between the template of the adjacent block and the template of the predicted block of the adjacent block.

[0174] The image encoding device changes the positions of the sub-search areas based on the motion information (S1504).

[0175] If there is no motion information in the left area of ​​the current block, the video encoding device moves the lower search areas included in the left search area to the top of the upper search area. Alternatively, if there is no motion information in the upper area of ​​the current block, the video encoding device moves the lower search areas included in the upper search area to the left of the left search area.

[0176] The image encoding device determines the search order for the sub-search areas (S1506).

[0177] The video encoding device sets a preset search order for the upper search areas. For example, the preset search order may be in the order of top → left → upper left search area. The video encoding device may determine the search order for the lower search areas included in each upper search area in the order of the lower search area closest to the current block and the lower search area farthest from the current block.

[0178] The video encoding device changes the search order based on motion information (S1508).

[0179] For example, if one or more adjacent blocks in the upper region of the current block are predicted according to the IBC mode or the IntraTMP mode, the video encoding device changes the search order to first search the lower search region indicated by the motion information of the adjacent blocks in the upper search region.

[0180] The video encoding device performs a search for each region according to the search order, and searches for a template with the lowest cost based on the cost of template matching (S1510). Here, the cost of template matching can be calculated based on the difference between the template of the current block and the templates in each sub-search region.

[0181] The video encoding device upsamples the template of the current block and each sub-search area by a preset number of pixels, and then searches for the template with the minimum cost in a preset order from the lower right to the upper left of each sub-search area.

[0182] The video encoding device determines the first prediction block of the current block based on the minimum cost template (S1512).

[0183] The video encoding device performs a pixel-by-pixel search in a sub-search area containing a template with the lowest cost to determine an optimal template. The video encoding device may determine a block adjacent to the optimal template as a first prediction block.

[0184] The video encoding device obtains the intra prediction mode of the current block (S1514). The video encoding device can obtain the intra prediction mode of the current block from a higher level, excluding the IntraTMP mode. Alternatively, the video encoding device can determine the intra prediction mode of the current block from the perspective of rate distortion optimization.

[0185] The video encoding device generates a second prediction block of the current block according to the intra prediction mode (S1516).

[0186] The video encoding device determines the IntraTMP flag based on the first prediction block and the second prediction block (S1518). Here, the IntraTMP flag indicates whether the IntraTMP mode based on template matching is applied. In terms of rate distortion optimization, the video encoding device can determine the IntraTMP flag. For example, if the first prediction block is optimal, the IntraTMP flag is determined to be true. On the other hand, if the second prediction block is optimal, the IntraTMP flag is determined to be false.

[0187] The video encoding device encodes the IntraTMP flag (S1520).

[0188] Thereafter, the video encoding device checks the IntraTMP flag and, depending on the value of the IntraTMP flag, subtracts the first prediction block or the second prediction block from the current block to generate residual signals. The video encoding device transforms / quantizes the residual signals to generate quantized transform coefficients and encodes the quantized transform coefficients.

[0189] FIG. 16 is a flowchart illustrating a method for an image decoding device to restore a current block according to one embodiment of the present disclosure.

[0190] The video decoding device decodes the IntraTMP flag from the bitstream (S1600). Here, the IntraTMP flag indicates whether to apply intra prediction based on template matching.

[0191] The video decoding device checks the IntraTMP flag (S1602).

[0192] If the IntraTMP flag is true (Yes in S1602), the video decoding device performs the following steps.

[0193] The image decoding device determines sub-search areas for template matching in the surrounding restoration area of ​​the current block (S1604).

[0194] Here, each sub-navigation area is contained within one of the upper navigation areas. The upper navigation areas are composed of a top navigation area, a left navigation area, and an upper-left navigation area, and each upper navigation area includes at least two sub-navigation areas.

[0195] The video decoding device obtains motion information of adjacent areas of the current block (S1606).

[0196] The adjacent regions of the current block include the top region, the left region, and the upper left region. Each adjacent region is a restored region and contains at least one adjacent block.

[0197] When the IBC mode is applied to an adjacent block of the current block, the motion information is a block vector, and when the IntraTMP mode is applied to the adjacent block, the motion information is a displacement between the template of the adjacent block and the template of the predicted block of the adjacent block.

[0198] The video decoding device changes the positions of the sub-search areas based on the motion information (S1608).

[0199] If there is no motion information in the left area of ​​the current block, the video decoding device moves the lower search areas included in the left search area to the top of the upper search area. Alternatively, if there is no motion information in the upper area of ​​the current block, the video decoding device moves the lower search areas included in the upper search area to the left of the left search area.

[0200] The video decoding device determines the search order for the lower search areas (S1610).

[0201] The video decoding device sets a preset search order for the upper search areas. For example, the preset search order may be in the order of top → left → upper left search area. The video decoding device may determine the search order for the lower search areas included in each upper search area in the order of the lower search area closest to the current block and the lower search area farthest from the current block.

[0202] The video decoding device changes the search order based on motion information (S1612).

[0203] For example, if one or more adjacent blocks in the upper region of the current block are predicted according to the IBC mode or the IntraTMP mode, the image decoding device changes the search order to first search the lower search region indicated by the motion information of the adjacent blocks in the upper search region.

[0204] The video decoding device performs a search for each region according to the search order, and searches for the template with the lowest cost based on the cost of template matching (S1614). Here, the cost of template matching can be calculated based on the difference between the template of the current block and the templates in each sub-search region.

[0205] The video decoding device upsamples the template of the current block and each sub-search area by a preset number of pixels, and then searches for the template with the minimum cost in a preset order from the lower right to the upper left of each sub-search area.

[0206] The video decoding device determines a prediction block of the current block based on the template with the minimum cost (S1616).

[0207] The video decoding device performs a pixel-by-pixel search in a sub-search area containing the template with the lowest cost to determine the optimal template. The video decoding device can determine a block adjacent to the optimal template as a predicted block.

[0208] If the IntraTMP flag is false (No in S1602), the video decoding device performs the following steps.

[0209] The video decoding device obtains the intra prediction mode of the current block (S1630). The intra prediction mode of the current block is a prediction mode other than IntraTMP mode. The video decoding device can decode the intra prediction mode of the current block from the bitstream or implicitly derive it.

[0210] The video decoding device generates a prediction block of the current block according to the intra prediction mode (S1632).

[0211] The video decoding device decodes quantized transform coefficients from the bitstream and dequantizes / inversely transforms the quantized transform coefficients to restore residual signals. The video decoding device adds the prediction block and residual signals to generate a restored block of the current block.

[0212] Although the flowchart / timing diagram of this specification describes each process as being executed sequentially, this is merely an illustrative description of the technical idea of ​​one embodiment of the present disclosure. In other words, a person of ordinary skill in the art to which one embodiment of the present disclosure belongs may modify and apply various modifications and variations by changing the order described in the flowchart / timing diagram without departing from the essential characteristics of one embodiment of the present disclosure, or by executing one or more of the processes in parallel. Therefore, the flowchart / timing diagram is not limited to a chronological order.

[0213] It should be understood that the exemplary embodiments described above can be implemented in many different ways. The functions or methods described in one or more examples can be implemented in hardware, software, firmware, or any combination thereof. It should be understood that the functional components described herein are labeled as "units" to further emphasize their implementation independence.

[0214] Meanwhile, the various functions or methods described in this embodiment may also be implemented as instructions stored on a non-transitory storage medium that can be read and executed by one or more processors. Non-transitory storage media include, for example, all types of storage devices that store data in a form readable by a computer system. For example, non-transitory storage media include storage media such as erasable programmable read-only memory (EPROM), flash drives, optical drives, magnetic hard drives, and solid-state drives (SSDs).

[0215] The above description is merely an example of the technical idea of ​​the present embodiment, and those skilled in the art will appreciate that various modifications and variations can be made without departing from the essential characteristics of the present embodiment. Therefore, the present embodiments are not intended to limit the technical idea of ​​the present embodiment, but rather to explain it, and the scope of the technical idea of ​​the present embodiment is not limited by these embodiments. The scope of protection of the present embodiment should be interpreted by the claims below, and all technical ideas within a scope equivalent thereto should be interpreted as being included in the scope of rights of the present embodiment.

[0216] (Explanation of symbols)

[0217] 122: Intra prediction unit

[0218] 542: Intra prediction unit

[0219] 902: Prediction Unit Decision Unit

[0220] 904: Prediction Technology Decision Division

[0221] 906: Prediction mode decision unit

[0222] 908: Prediction Performance Department

[0223]

[0224] CROSS-REFERENCE TO RELATED APPLICATION

[0225] This patent application claims priority to Korean patent application No. 10-2023-0060327, filed in Korea on May 10, 2023, and Korean patent application No. 10-2024-0030641, filed in Korea on March 4, 2024, the entire contents of which are incorporated herein by reference.

Claims

1. A method for restoring a current block performed by a video decoding device, A step of determining lower search areas for template matching in a neighboring reconstructed area of ​​the current block, wherein each lower search area is included in one of the upper search areas, and the upper search areas are composed of an upper search area, a left search area, and an upper-left search area, and each upper search area includes at least two lower search areas; A step of obtaining movement information of adjacent areas of the current block; A step of changing the positions of the sub-search areas based on the above movement information; A step of determining a search order for the sub-search areas based on the distance from the current block; A step of performing a search by region according to the search order and searching for a template with the minimum cost based on a cost according to the template matching, wherein the cost depends on the difference between the template of the current block and the template in each of the sub-search regions; and A step of determining a prediction block of the current block based on the template of the minimum cost. A method, characterized by including:

2. In paragraph 1, A step of decoding an IntraTMP (Intra Template Matching Prediction) flag from a bitstream, wherein the IntraTMP flag indicates whether to apply an IntraTMP mode based on the template matching; and Step to check the above IntraTMP flag Including more, If the above IntraTMP flag is true, A method characterized by performing a step of determining the above sub-search areas.

3. In paragraph 1, The step of searching for the above minimum cost template is: A method characterized in that the template of the current block and each of the sub-search areas are upsampled by a preset number of pixels, and then the template with the minimum cost is searched for in a preset order from the lower right to the upper left of each of the sub-search areas.

4. In paragraph 1, In the sub-search area including the template with the minimum cost, a step of performing a pixel-by-pixel search to calculate an optimal template is further included. The step of determining the above prediction block is: A method characterized in that a block adjacent to the optimal template is determined as the prediction block.

5. In paragraph 1, The step of determining the above search order is: A method characterized in that a preset search order is set for the upper search areas, and the search order is determined in the order of the lower search areas included in each upper search area from the lower search area closest to the current block to the lower search area farthest from the current block.

6. In paragraph 1, The adjacent areas of the current block above are: Includes the upper area, the left area and the upper left area of ​​the current block, A method, characterized in that each adjacent area of ​​the current block is a restored area and includes at least one adjacent block.

7. In paragraph 6, A method characterized in that when the IBC (Intra Block Copy) mode is applied to the adjacent block, the motion information is a block vector, and when the IntraTMP mode is applied to the adjacent block, the motion information is a displacement between the template of the adjacent block and the template of the prediction block of the adjacent block.

8. In paragraph 6, The steps for changing the positions of the above sub-navigation areas are: If there is no movement information in the left area of ​​the current block, the lower search areas included in the left search area are moved to the top of the upper search area, The step of searching for the above minimum cost template is: A method characterized in that, if the moved sub-search areas create an area that goes beyond the upper boundary of the upper CTU (Coding Tree Unit) of the current CTU, the search for the out-of-bounds area is omitted.

9. In paragraph 6, The steps for changing the positions of the above sub-navigation areas are: If there is no movement information in the upper area of ​​the current block, the lower search areas included in the upper search area are moved to the left of the left search area, The step of searching for the above minimum cost template is: A method characterized in that, if the above-described moved sub-search areas create an area that goes beyond the left boundary of the left CTU of the current CTU, the search for the out-of-bound area is omitted.

10. In paragraph 6, A method characterized in that it further includes a step of changing the search order so that, when one or more adjacent blocks in the upper area of ​​the current block are predicted according to the IBC mode or the IntraTMP mode, a lower search area indicated by the motion information of the adjacent blocks in the upper search area is first searched.

11. In paragraph 6, A method characterized in that it further includes a step of changing the search order so that, when one or more adjacent blocks in the upper left area of ​​the current block are predicted according to the IBC mode or the IntraTMP mode, a lower search area indicated by the motion information of the adjacent block in the upper left search area is first searched.

12. In paragraph 6, A method characterized in that it further includes a step of changing the search order so that, when one or more adjacent blocks in the left area of ​​the current block are predicted according to the IBC mode or the IntraTMP mode, a lower search area indicated by the motion information of the adjacent block in the left search area is first searched.

13. A method for encoding a current block performed by a video encoding device, A step of determining lower search areas for template matching in a neighboring reconstructed area of ​​the current block, wherein each lower search area is included in one of the upper search areas, and the upper search areas are composed of an upper search area, a left search area, and an upper-left search area, and each upper search area includes at least two lower search areas; A step of obtaining movement information of adjacent areas of the current block; A step of changing the positions of the sub-search areas based on the above movement information; A step of determining a search order for the sub-search areas based on the distance from the current block; A step of performing a search by region according to the search order and searching for a template with the minimum cost based on a cost according to the template matching, wherein the cost depends on the difference between the template of the current block and the template in each of the sub-search regions; and A step of determining a first prediction block of the current block based on the template of the minimum cost. A method, characterized by including:

14. In paragraph 13, A step of obtaining an intra prediction mode of the current block; and A step of generating a second prediction block of the current block according to the intra prediction mode. A method, characterized in that it further comprises:

15. In paragraph 14, A step of determining an IntraTMP (Intra Template Matching Prediction) flag based on the first prediction block and the second prediction block, wherein the IntraTMP flag indicates whether to apply an IntraTMP mode based on the template matching; and Step of encoding the above IntraTMP flag A method, characterized in that it further comprises:

16. In paragraph 13, In the sub-search area including the template with the minimum cost, a step of performing a pixel-by-pixel search to calculate an optimal template is further included. The step of determining the first prediction block is: A method characterized in that a block adjacent to the above optimal template is determined as the first prediction block.

17. A computer-readable recording medium storing a bitstream generated by an image encoding method, wherein the image encoding method comprises: A step of determining lower search areas for template matching in a reconstructed area neighboring a current block, wherein each lower search area is included in one of upper search areas, and the upper search areas are composed of an upper search area, a left search area, and an upper-left search area, and each upper search area includes at least two lower search areas; A step of obtaining movement information of adjacent areas of the current block; A step of changing the positions of the sub-search areas based on the above movement information; A step of determining a search order for the sub-search areas based on the distance from the current block; A step of performing a search by region according to the search order and searching for a template with the minimum cost based on a cost according to the template matching, wherein the cost depends on the difference between the template of the current block and the template in each of the sub-search regions; and A step of determining a prediction block of the current block based on the template of the minimum cost. A recording medium, characterized by including:

Citation Information

Patent Citations

  • Template-based inter-prediction technique based on encoding and decoding latency reduction

    JP2021518059A

  • Method and apparatus for compressing video using template matching and motion prediction

    KR101396754B1

  • Method and apparatus for encoding and decoding to image using template matching

    KR101836981B1

  • Method for managing load profile information for time of use and meter reading device and meter using the same

    KR1020210100934A

  • Ice maker and refrigerator

    KR102577507B1

Cited By

  • Template matching region searching enhancements

    WO2026143151A1