KR20230088234A - Method And Apparatus for Video Coding Using Secondary MPM List Based on Template Matching - Google Patents

Method And Apparatus for Video Coding Using Secondary MPM List Based on Template Matching Download PDF

Info

Publication number
KR20230088234A
KR20230088234A KR1020220130305A KR20220130305A KR20230088234A KR 20230088234 A KR20230088234 A KR 20230088234A KR 1020220130305 A KR1020220130305 A KR 1020220130305A KR 20220130305 A KR20220130305 A KR 20220130305A KR 20230088234 A KR20230088234 A KR 20230088234A
Authority
KR
South Korea
Prior art keywords
mpm
block
gradient
current block
template
Prior art date
Application number
KR1020220130305A
Other languages
Korean (ko)
Inventor
홍명오
이민훈
심동규
허진
박승욱
Original Assignee
현대자동차주식회사
기아 주식회사
광운대학교 산학협력단
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 현대자동차주식회사, 기아 주식회사, 광운대학교 산학협력단 filed Critical 현대자동차주식회사
Priority to PCT/KR2022/015493 priority Critical patent/WO2023106603A1/en
Publication of KR20230088234A publication Critical patent/KR20230088234A/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • H04N19/11Selection of coding mode or of prediction mode among a plurality of spatial predictive coding modes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/593Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving spatial prediction techniques
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/70Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by syntax aspects related to video coding, e.g. related to compression standards
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/80Details of filtering operations specially adapted for video compression, e.g. for pixel interpolation

Abstract

템플릿 매칭 기반 이차적인 MPM 리스트를 이용하는 비디오 코딩방법 및 장치에 관한 개시로서, 본 실시예는, 비디오 부호화 효율을 향상시키고 비디오 화질을 개선하기 위해, 그래디언트(gradient) 기반 템플릿 매칭 결과에 따라 이차적인(secondary) MPM(Most Probable Mode) 리스트를 생성하고, 현재블록의 인트라 예측에 이차적인 MPM 리스트를 이용하는 비디오 코딩방법 및 장치를 제공한다. As a disclosure of a video coding method and apparatus using a secondary MPM list based on template matching, the present embodiment provides a secondary (gradient) based template matching result to improve video encoding efficiency and video quality. secondary) Provides a video coding method and apparatus for generating a Most Probable Mode (MPM) list and using the secondary MPM list for intra prediction of a current block.

Description

템플릿 매칭 기반 이차적인 MPM 리스트를 이용하는 비디오 코딩방법 및 장치{Method And Apparatus for Video Coding Using Secondary MPM List Based on Template Matching}Method and Apparatus for Video Coding Using Secondary MPM List Based on Template Matching

본 개시는 템플릿 매칭 기반 이차적인 MPM 리스트를 이용하는 비디오 코딩방법 및 장치에 관한 것이다. The present disclosure relates to a video coding method and apparatus using a secondary MPM list based on template matching.

이하에 기술되는 내용은 단순히 본 실시예와 관련되는 배경 정보만을 제공할 뿐 종래기술을 구성하는 것이 아니다. The contents described below merely provide background information related to the present embodiment and do not constitute prior art.

비디오 데이터는 음성 데이터나 정지 영상 데이터 등에 비하여 많은 데이터량을 가지기 때문에, 압축을 위한 처리 없이 그 자체를 저장하거나 전송하기 위해서는 메모리를 포함하여 많은 하드웨어 자원을 필요로 한다. Since video data has a large amount of data compared to audio data or still image data, it requires a lot of hardware resources including memory to store or transmit itself without processing for compression.

따라서, 통상적으로 비디오 데이터를 저장하거나 전송할 때에는 부호화기를 사용하여 비디오 데이터를 압축하여 저장하거나 전송하며, 복호화기에서는 압축된 비디오 데이터를 수신하여 압축을 해제하고 재생한다. 이러한 비디오 압축 기술로는 H.264/AVC, HEVC(High Efficiency Video Coding) 등을 비롯하여, HEVC에 비해 약 30% 이상의 부호화 효율을 향상시킨 VVC(Versatile Video Coding)가 존재한다. Therefore, when video data is stored or transmitted, an encoder is used to compress and store or transmit the video data, and a decoder receives, decompresses, and reproduces the compressed video data. Examples of such video compression technologies include H.264/AVC, High Efficiency Video Coding (HEVC), and Versatile Video Coding (VVC), which has improved coding efficiency by about 30% or more compared to HEVC.

그러나, 영상의 크기 및 해상도, 프레임률이 점차 증가하고 있고, 이에 따라 부호화해야 하는 데이터량도 증가하고 있으므로 기존의 압축 기술보다 더 부호화 효율이 좋고 화질 개선 효과도 높은 새로운 압축 기술이 요구된다. However, since the size, resolution, and frame rate of video are gradually increasing, and the amount of data to be encoded accordingly increases, a new compression technology with higher encoding efficiency and higher picture quality improvement effect than existing compression technologies is required.

템플릿 매칭(template matching) 기반 인트라 예측 기술은, 현재블록에 인접하는 기복원된 샘플들로 구성된 템플릿을 이용하여 기복원 영역에서 가장 유사한 템플릿을 탐색한 후, 유사 템플릿(similar template)에 대응하는 블록(corresponding block)을 현재블록의 예측블록(prediction block)으로 생성한다. 도 6에 예시된 바는 템플릿 매칭 기반 인트라 예측을 나타낸다. 부호화기와 복호화기는 동일한 방법에 기반하여, 현재블록에 인접하는 템플릿을 이용하여 예측블록을 생성할 수 있다. 이때, 템플릿과 유사 템플릿 간의 변위에 해당하는 움직임벡터 정보는 전송되지 않는다. 데이터량 증가에 따른, 비디오 부호화 효율을 향상시키고 화질을 개선하기 위해, 템플릿 매칭 기반 인트라 예측 기술이 추가적으로 개선될 필요가 있다.In the template matching-based intra prediction technology, after searching for the most similar template in the undulation region using a template composed of undulation-reconstructed samples adjacent to the current block, a block corresponding to the similar template (corresponding block) is created as a prediction block of the current block. 6 illustrates intra prediction based on template matching. The encoder and the decoder may generate a prediction block using a template adjacent to the current block based on the same method. At this time, motion vector information corresponding to the displacement between the template and the similar template is not transmitted. In order to improve video encoding efficiency and image quality according to an increase in the amount of data, template matching-based intra prediction technology needs to be further improved.

본 개시는, 비디오 부호화 효율을 향상시키고 비디오 화질을 개선하기 위해, 그래디언트(gradient) 기반 템플릿 매칭 결과에 따라 이차적인(secondary) MPM(Most Probable Mode) 리스트를 생성하고, 현재블록의 인트라 예측에 이차적인 MPM 리스트를 이용하는 비디오 코딩방법 및 장치를 제공하는 데 목적이 있다. The present disclosure generates a secondary Most Probable Mode (MPM) list according to a gradient-based template matching result in order to improve video encoding efficiency and video quality, and provides a secondary list for intra prediction of a current block. An object of the present invention is to provide a video coding method and apparatus using an MPM list.

본 개시의 실시예에 따르면, 영상 복호화 장치가 수행하는, 현재블록을 복호화하는 방법에 있어서, 비트스트림으로부터 상기 현재블록의 잔차블록(residual block), 및 이차적인 MPM(Most Probable Mode) 플래그를 복호화하는 단계, 여기서, 상기 이차적인 MPM 플래그는 이차적인(secondary) MPM 리스트의 사용 여부를 지시함; 및 상기 이차적인 MPM 플래그를 확인하는 단계를 포함하되, 상기 이차적인 MPM 플래그가 참인 경우, 상기 현재블록의 기정의된 탐색 영역에서 그래디언트 기반 템플릿 매칭(template matching)을 수행하여 유사 템플릿(similar template)을 탐색하는 단계; 상기 유사 템플릿의 대응블록을 이용하여 인트라 예측모드들을 유도하고 정렬하는 단계; 상기 정렬된 인트라 예측모드들을 이용하여 상기 현재블록에 대해 상기 이차적인 MPM 리스트를 구성하는 단계; 및 상기 비트스트림으로부터 이차적인 MPM 인덱스를 복호화하는 단계를 포함하는 것을 특징으로 하는, 방법을 제공한다. According to an embodiment of the present disclosure, in a method of decoding a current block performed by an image decoding apparatus, a residual block of the current block and a secondary MPM (Most Probable Mode) flag are decoded from a bitstream step, where the secondary MPM flag indicates whether to use a secondary MPM list; and checking the secondary MPM flag, wherein if the secondary MPM flag is true, a similar template is obtained by performing gradient-based template matching in a predefined search area of the current block. Searching for; inducing and arranging intra prediction modes using corresponding blocks of the similar template; constructing the secondary MPM list for the current block using the sorted intra prediction modes; and decoding a secondary MPM index from the bitstream.

본 개시의 다른 실시예에 따르면, 영상 부호화 장치가 수행하는, 현재블록을 부호화하는 방법에 있어서, 상기 현재블록의 템플릿을 생성하고, 상기 템플릿의 그래디언트의 크기를 산정하는 단계; 상기 그래디언트의 크기를 기설정된 임계치와 비교하는 단계를 포함하되, 상기 그래디언트의 크기가 기설정된 임계치보다 큰 경우, 상기 현재블록의 기정의된 탐색 영역에서 그래디언트 기반 템플릿 매칭(template matching)을 수행하여, 상기 템플릿에 대해 유사 템플릿(similar template)을 탐색하는 단계; 상기 유사 템플릿의 대응블록을 이용하여 인트라 예측모드들을 유도하고 정렬하는 단계; 상기 정렬된 인트라 예측모드들을 이용하여 상기 현재블록에 대해 이차적인(secondary) MPM(Most Probable Mode) 리스트를 구성하고, 이차적인 MPM 플래그를 설정하는 단계, 여기서, 상기 이차적인 MPM 플래그는 상기 이차적인 MPM 리스트의 사용 여부를 지시함; 및 이차적인 MPM 인덱스를 결정하는 단계를 포함하는 것을 특징으로 하는, 방법을 제공한다. According to another embodiment of the present disclosure, a method of encoding a current block, performed by an image encoding apparatus, includes generating a template of the current block and calculating a gradient size of the template; Comparing the size of the gradient with a preset threshold, but when the size of the gradient is greater than the preset threshold, performing gradient-based template matching in a predefined search area of the current block, searching for a similar template to the template; inducing and arranging intra prediction modes using corresponding blocks of the similar template; Constructing a secondary MPM (Most Probable Mode) list for the current block using the sorted intra prediction modes and setting a secondary MPM flag, wherein the secondary MPM flag is the secondary Indicates whether to use the MPM list; and determining a secondary MPM index.

본 개시의 다른 실시예에 따르면, 영상 부호화 방법에 의해 생성된 비트스트림을 저장하는 컴퓨터 판독 가능한 기록매체로서, 상기 영상 부호화 방법은, 현재블록의 템플릿을 생성하고, 상기 템플릿의 그래디언트의 크기를 산정하는 단계; 상기 그래디언트의 크기를 기설정된 임계치와 비교하는 단계를 포함하되, 상기 그래디언트의 크기가 기설정된 임계치보다 큰 경우, 상기 현재블록의 기정의된 탐색 영역에서 그래디언트 기반 템플릿 매칭(template matching)을 수행하여, 상기 템플릿에 대해 유사 템플릿(similar template)을 탐색하는 단계; 상기 유사 템플릿의 대응블록을 이용하여 인트라 예측모드들을 유도하고 정렬하는 단계; 상기 정렬된 인트라 예측모드들을 이용하여 상기 현재블록에 대해 이차적인(secondary) MPM(Most Probable Mode) 리스트를 구성하고, 이차적인 MPM 플래그를 설정하는 단계, 여기서, 상기 이차적인 MPM 플래그는 상기 이차적인 MPM 리스트의 사용 여부를 지시함; 및 이차적인 MPM 인덱스를 결정하는 단계를 포함하는 것을 특징으로 하는, 기록매체를 제공한다.According to another embodiment of the present disclosure, a computer-readable recording medium storing a bitstream generated by an image encoding method, wherein the image encoding method generates a template of a current block and calculates a gradient size of the template. doing; Comparing the size of the gradient with a preset threshold, but when the size of the gradient is greater than the preset threshold, performing gradient-based template matching in a predefined search area of the current block, searching for a similar template to the template; inducing and arranging intra prediction modes using corresponding blocks of the similar template; Constructing a secondary MPM (Most Probable Mode) list for the current block using the sorted intra prediction modes and setting a secondary MPM flag, wherein the secondary MPM flag is the secondary Indicates whether to use the MPM list; and determining a secondary MPM index.

이상에서 설명한 바와 같이 본 실시예에 따르면, 그래디언트 기반 템플릿 매칭 결과에 따라 이차적인 MPM 리스트를 생성하고, 현재블록의 인트라 예측에 이차적인 MPM 리스트를 이용하는 비디오 코딩방법 및 장치를 제공함으로써, 비디오 부호화 효율을 향상시키고 비디오 화질을 개선하는 것이 가능해지는 효과가 있다.As described above, according to the present embodiment, by providing a video coding method and apparatus that generates a secondary MPM list according to a result of gradient-based template matching and uses the secondary MPM list for intra prediction of a current block, video encoding efficiency There is an effect that it becomes possible to improve the video quality and improve the video quality.

도 1은 본 개시의 기술들을 구현할 수 있는 영상 부호화 장치에 대한 예시적인 블록도이다.
도 2는 QTBTTT 구조를 이용하여 블록을 분할하는 방법을 설명하기 위한 도면이다.
도 3a 및 도 3b는 광각 인트라 예측모드들을 포함한 복수의 인트라 예측모드들을 나타낸 도면이다.
도 4는 현재블록의 주변블록에 대한 예시도이다.
도 5는 본 개시의 기술들을 구현할 수 있는 영상 복호화 장치의 예시적인 블록도이다.
도 6은 템플릿 매칭 기반 인트라 예측을 나타내는 블록도이다.
도 7은 본 개시의 일 실시예에 따른, 영상 부호화 장치가 이차적인 MPM 리스트를 생성하는 방법을 나타내는 순서도이다.
도 8은 본 개시의 일 실시예에 따른, 영상 복호화 장치가 이차적인 MPM 리스트를 생성하는 방법을 나타내는 순서도이다.
도 9는 본 개시의 다른 실시예에 따른, 영상 복호화 장치가 이차적인 MPM 리스트를 생성하는 방법을 나타내는 순서도이다.
도 10은 본 개시의 또다른 실시예에 따른, 영상 부호화 장치가 MPM 리스트를 생성하는 방법을 나타내는 순서도이다.
도 11은 본 개시의 또다른 실시예에 따른, 영상 복호화 장치가 MPM 리스트를 생성하는 방법을 나타내는 순서도이다.
도 12는 본 개시의 일 실시예에 따른 템플릿의 형태를 나타내는 예시도이다.
도 13은 본 개시의 일 실시예에 따른, 기복원 영역의 예측모드에 기초하는 템플릿의 형태를 나타내는 예시도이다.
도 14는 본 개시의 일 실시예에 따른 템플릿의 회전을 나타내는 예시도이다.
도 15는 본 개시의 일 실시예에 따른, 템플릿 매칭을 위한 탐색 영역들을 나타내는 예시도이다.
도 16은 본 개시의 일 실시예에 따른, 탐색 영역에서 그래디언트 크기의 산정을 나타내는 예시도이다.
도 17은 본 개시의 일 실시예에 따른, HoG가 산정되는 영역을 나타내는 예시도이다.
도 18은 현재블록이 분할된 서브블록들을 나타내는 예시도이다.
도 19는 본 개시의 일 실시예에 따른, 이차적인 MPM 리스트의 구성을 나타내는 예시도이다.
도 20은 본 개시의 일 실시예에 따른, 서브블록 단위의 템플릿 매칭을 나타내는 예시도이다.
1 is an exemplary block diagram of an image encoding apparatus capable of implementing the techniques of this disclosure.
2 is a diagram for explaining a method of dividing a block using a QTBTTT structure.
3A and 3B are diagrams illustrating a plurality of intra prediction modes including wide-angle intra prediction modes.
4 is an exemplary diagram of neighboring blocks of a current block.
5 is an exemplary block diagram of a video decoding apparatus capable of implementing the techniques of this disclosure.
6 is a block diagram illustrating intra prediction based on template matching.
7 is a flowchart illustrating a method for generating a secondary MPM list by a video encoding apparatus according to an embodiment of the present disclosure.
8 is a flowchart illustrating a method for generating a secondary MPM list by a video decoding apparatus according to an embodiment of the present disclosure.
9 is a flowchart illustrating a method for generating a secondary MPM list by a video decoding apparatus according to another embodiment of the present disclosure.
10 is a flowchart illustrating a method for generating an MPM list by a video encoding apparatus according to another embodiment of the present disclosure.
11 is a flowchart illustrating a method for generating an MPM list by a video decoding apparatus according to another embodiment of the present disclosure.
12 is an exemplary diagram illustrating a form of a template according to an embodiment of the present disclosure.
13 is an exemplary view illustrating a form of a template based on a prediction mode of an undulation and restoration area according to an embodiment of the present disclosure.
14 is an exemplary diagram illustrating rotation of a template according to an embodiment of the present disclosure.
15 is an exemplary diagram illustrating search areas for template matching according to an embodiment of the present disclosure.
16 is an exemplary diagram illustrating calculation of a gradient size in a search area according to an embodiment of the present disclosure.
17 is an exemplary diagram illustrating a region in which HoG is calculated according to an embodiment of the present disclosure.
18 is an exemplary diagram illustrating subblocks from which a current block is divided.
19 is an exemplary diagram illustrating a configuration of a secondary MPM list according to an embodiment of the present disclosure.
20 is an exemplary diagram illustrating template matching in units of subblocks according to an embodiment of the present disclosure.

이하, 본 개시의 일부 실시예들을 예시적인 도면을 참조하여 상세하게 설명한다. 각 도면의 구성요소들에 참조부호를 부가함에 있어서, 동일한 구성요소들에 대해서는 비록 다른 도면상에 표시되더라도 가능한 한 동일한 부호를 가지도록 하고 있음에 유의해야 한다. 또한, 본 실시예들을 설명함에 있어, 관련된 공지 구성 또는 기능에 대한 구체적인 설명이 본 실시예들의 요지를 흐릴 수 있다고 판단되는 경우에는 그 상세한 설명은 생략한다.DETAILED DESCRIPTION Some embodiments of the present disclosure are described in detail below with reference to exemplary drawings. In adding reference numerals to components of each drawing, it should be noted that the same components have the same numerals as much as possible even if they are displayed on different drawings. In addition, in describing the present embodiments, if it is determined that a detailed description of a related known configuration or function may obscure the gist of the present embodiments, the detailed description will be omitted.

도 1은 본 개시의 기술들을 구현할 수 있는 영상 부호화 장치에 대한 예시적인 블록도이다. 이하에서는 도 1의 도시를 참조하여 영상 부호화 장치와 이 장치의 하위 구성들에 대하여 설명하도록 한다.1 is an exemplary block diagram of an image encoding apparatus capable of implementing the techniques of this disclosure. Hereinafter, with reference to the illustration of FIG. 1, an image encoding device and sub-components of the device will be described.

영상 부호화 장치는 픽처 분할부(110), 예측부(120), 감산기(130), 변환부(140), 양자화부(145), 재정렬부(150), 엔트로피 부호화부(155), 역양자화부(160), 역변환부(165), 가산기(170), 루프 필터부(180) 및 메모리(190)를 포함하여 구성될 수 있다.The image encoding apparatus includes a picture division unit 110, a prediction unit 120, a subtractor 130, a transform unit 140, a quantization unit 145, a rearrangement unit 150, an entropy encoding unit 155, and an inverse quantization unit. 160, an inverse transform unit 165, an adder 170, a loop filter unit 180, and a memory 190.

영상 부호화 장치의 각 구성요소는 하드웨어 또는 소프트웨어로 구현되거나, 하드웨어 및 소프트웨어의 결합으로 구현될 수 있다. 또한, 각 구성요소의 기능이 소프트웨어로 구현되고 마이크로프로세서가 각 구성요소에 대응하는 소프트웨어의 기능을 실행하도록 구현될 수도 있다.Each component of the image encoding device may be implemented as hardware or software, or as a combination of hardware and software. Also, the function of each component may be implemented as software, and the microprocessor may be implemented to execute the software function corresponding to each component.

하나의 영상(비디오)은 복수의 픽처들을 포함하는 하나 이상의 시퀀스로 구성된다. 각 픽처들은 복수의 영역으로 분할되고 각 영역마다 부호화가 수행된다. 예를 들어, 하나의 픽처는 하나 이상의 타일(Tile) 및/또는 슬라이스(Slice)로 분할된다. 여기서, 하나 이상의 타일을 타일 그룹(Tile Group)으로 정의할 수 있다. 각 타일 또는/슬라이스는 하나 이상의 CTU(Coding Tree Unit)로 분할된다. 그리고 각 CTU는 트리 구조에 의해 하나 이상의 CU(Coding Unit)들로 분할된다. 각 CU에 적용되는 정보들은 CU의 신택스로서 부호화되고, 하나의 CTU에 포함된 CU들에 공통적으로 적용되는 정보는 CTU의 신택스로서 부호화된다. 또한, 하나의 슬라이스 내의 모든 블록들에 공통적으로 적용되는 정보는 슬라이스 헤더의 신택스로서 부호화되며, 하나 이상의 픽처들을 구성하는 모든 블록들에 적용되는 정보는 픽처 파라미터 셋(PPS, Picture Parameter Set) 혹은 픽처 헤더에 부호화된다. 나아가, 복수의 픽처가 공통으로 참조하는 정보들은 시퀀스 파라미터 셋(SPS, Sequence Parameter Set)에 부호화된다. 그리고, 하나 이상의 SPS가 공통으로 참조하는 정보들은 비디오 파라미터 셋(VPS, Video Parameter Set)에 부호화된다. 또한, 하나의 타일 또는 타일 그룹에 공통으로 적용되는 정보는 타일 또는 타일 그룹 헤더의 신택스로서 부호화될 수도 있다. SPS, PPS, 슬라이스 헤더, 타일 또는 타일 그룹 헤더에 포함되는 신택스들은 상위수준(high level) 신택스로 칭할 수 있다. One image (video) is composed of one or more sequences including a plurality of pictures. Each picture is divided into a plurality of areas and encoding is performed for each area. For example, one picture is divided into one or more tiles and/or slices. Here, one or more tiles may be defined as a tile group. Each tile or/slice is divided into one or more Coding Tree Units (CTUs). And each CTU is divided into one or more CUs (Coding Units) by a tree structure. Information applied to each CU is coded as a CU syntax, and information commonly applied to CUs included in one CTU is coded as a CTU syntax. In addition, information commonly applied to all blocks in one slice is coded as syntax of a slice header, and information applied to all blocks constituting one or more pictures is a picture parameter set (PPS) or picture coded in the header. Furthermore, information commonly referred to by a plurality of pictures is coded into a Sequence Parameter Set (SPS). Also, information commonly referred to by one or more SPSs is coded into a video parameter set (VPS). Also, information commonly applied to one tile or tile group may be encoded as syntax of a tile or tile group header. Syntax included in the SPS, PPS, slice header, tile or tile group header may be referred to as high level syntax.

픽처 분할부(110)는 CTU(Coding Tree Unit)의 크기를 결정한다. CTU의 크기에 대한 정보(CTU size)는 SPS 또는 PPS의 신택스로서 부호화되어 영상 복호화 장치로 전달된다. The picture divider 110 determines the size of a coding tree unit (CTU). Information on the size of the CTU (CTU size) is encoded as SPS or PPS syntax and transmitted to the video decoding apparatus.

픽처 분할부(110)는 영상을 구성하는 각 픽처(picture)를 미리 결정된 크기를 가지는 복수의 CTU(Coding Tree Unit)들로 분할한 이후에, 트리 구조(tree structure)를 이용하여 CTU를 반복적으로(recursively) 분할한다. 트리 구조에서의 리프 노드(leaf node)가 부호화의 기본 단위인 CU(coding unit)가 된다. The picture division unit 110 divides each picture constituting an image into a plurality of Coding Tree Units (CTUs) having a predetermined size, and then iteratively divides the CTUs using a tree structure. Divide (recursively). A leaf node in the tree structure becomes a coding unit (CU), which is a basic unit of encoding.

트리 구조로는 상위 노드(혹은 부모 노드)가 동일한 크기의 네 개의 하위 노드(혹은 자식 노드)로 분할되는 쿼드트리(QuadTree, QT), 또는 상위 노드가 두 개의 하위 노드로 분할되는 바이너리트리(BinaryTree, BT), 또는 상위 노드가 1:2:1 비율로 세 개의 하위 노드로 분할되는 터너리트리(TernaryTree, TT), 또는 이러한 QT 구조, BT 구조 및 TT 구조 중 둘 이상을 혼용한 구조일 수 있다. 예컨대, QTBT(QuadTree plus BinaryTree) 구조가 사용될 수 있고, 또는 QTBTTT(QuadTree plus BinaryTree TernaryTree) 구조가 사용될 수 있다. 여기서, BTTT를 합쳐서 MTT(Multiple-Type Tree)라 지칭될 수 있다. As a tree structure, a quad tree (QT) in which a parent node (or parent node) is divided into four subnodes (or child nodes) of the same size, or a binary tree (BinaryTree) in which a parent node is divided into two subnodes , BT), or a TernaryTree (TT) in which a parent node is split into three subnodes at a ratio of 1:2:1, or a structure in which two or more of these QT structures, BT structures, and TT structures are mixed. there is. For example, a QuadTree plus BinaryTree (QTBT) structure may be used, or a QuadTree plus BinaryTree TernaryTree (QTBTTT) structure may be used. Here, BTTT may be combined to be referred to as MTT (Multiple-Type Tree).

도 2는 QTBTTT 구조를 이용하여 블록을 분할하는 방법을 설명하기 위한 도면이다.2 is a diagram for explaining a method of dividing a block using a QTBTTT structure.

도 2에 도시된 바와 같이, CTU는 먼저 QT 구조로 분할될 수 있다. 쿼드트리 분할은 분할 블록(splitting block)의 크기가 QT에서 허용되는 리프 노드의 최소 블록 크기(MinQTSize)에 도달할 때까지 반복될 수 있다. QT 구조의 각 노드가 하위 레이어의 4개의 노드들로 분할되는지 여부를 지시하는 제1 플래그(QT_split_flag)는 엔트로피 부호화부(155)에 의해 부호화되어 영상 복호화 장치로 시그널링된다. QT의 리프 노드가 BT에서 허용되는 루트 노드의 최대 블록 크기(MaxBTSize)보다 크지 않은 경우, BT 구조 또는 TT 구조 중 어느 하나 이상으로 더 분할될 수 있다. BT 구조 및/또는 TT 구조에서는 복수의 분할 방향이 존재할 수 있다. 예컨대, 해당 노드의 블록이 가로로 분할되는 방향과 세로로 분할되는 방향 두 가지가 존재할 수 있다. 도 2의 도시와 같이, MTT 분할이 시작되면, 노드들이 분할되었는지 여부를 지시하는 제2 플래그(mtt_split_flag)와, 분할이 되었다면 추가적으로 분할 방향(vertical 혹은 horizontal)을 나타내는 플래그 및/또는 분할 타입(Binary 혹은 Ternary)을 나타내는 플래그가 엔트로피 부호화부(155)에 의해 부호화되어 영상 복호화 장치로 시그널링된다.As shown in FIG. 2, the CTU may first be divided into QT structures. Quadtree splitting can be repeated until the size of the splitting block reaches the minimum block size (MinQTSize) of leaf nodes allowed by QT. A first flag (QT_split_flag) indicating whether each node of the QT structure is split into four nodes of a lower layer is encoded by the entropy encoder 155 and signaled to the video decoding device. If the leaf node of QT is not larger than the maximum block size (MaxBTSize) of the root node allowed in BT, it may be further divided into either a BT structure or a TT structure. A plurality of division directions may exist in the BT structure and/or the TT structure. For example, there may be two directions in which blocks of the corresponding node are divided horizontally and vertically. As shown in FIG. 2, when MTT splitting starts, a second flag (mtt_split_flag) indicating whether nodes are split, and if split, a flag indicating additional split direction (vertical or horizontal) and/or split type (Binary or Ternary) is encoded by the entropy encoding unit 155 and signaled to the video decoding apparatus.

대안적으로, 각 노드가 하위 레이어의 4개의 노드들로 분할되는지 여부를 지시하는 제1 플래그(QT_split_flag)를 부호화하기에 앞서, 그 노드가 분할되는지 여부를 지시하는 CU 분할 플래그(split_cu_flag)가 부호화될 수도 있다. CU 분할 플래그(split_cu_flag) 값이 분할되지 않았음을 지시하는 경우, 해당 노드의 블록이 분할 트리 구조에서의 리프 노드(leaf node)가 되어 부호화의 기본 단위인 CU(coding unit)가 된다. CU 분할 플래그(split_cu_flag) 값이 분할됨을 지시하는 경우, 영상 부호화 장치는 전술한 방식으로 제1 플래그부터 부호화를 시작한다.Alternatively, prior to coding 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 is coded. It could be. When the value of the CU split flag (split_cu_flag) indicates that it is not split, the block of the corresponding node becomes a leaf node in the split tree structure and becomes a coding unit (CU), which is a basic unit of encoding. When the value of the CU split flag (split_cu_flag) indicates splitting, the video encoding apparatus starts encoding from the first flag in the above-described manner.

트리 구조의 다른 예시로서 QTBT가 사용되는 경우, 해당 노드의 블록을 동일 크기의 두 개 블록으로 가로로 분할하는 타입(즉, symmetric horizontal splitting)과 세로로 분할하는 타입(즉, symmetric vertical splitting) 두 가지가 존재할 수 있다. BT 구조의 각 노드가 하위 레이어의 블록으로 분할되는지 여부를 지시하는 분할 플래그(split_flag) 및 분할되는 타입을 지시하는 분할 타입 정보가 엔트로피 부호화부(155)에 의해 부호화되어 영상 복호화 장치로 전달된다. 한편, 해당 노드의 블록을 서로 비대칭 형태의 두 개의 블록으로 분할하는 타입이 추가로 더 존재할 수도 있다. 비대칭 형태에는 해당 노드의 블록을 1:3의 크기 비율을 가지는 두 개의 직사각형 블록으로 분할하는 형태가 포함될 수 있고, 혹은 해당 노드의 블록을 대각선 방향으로 분할하는 형태가 포함될 수도 있다.As another example of a tree structure, when QTBT is used, the block of the corresponding node is divided into two blocks of the same size horizontally (i.e., symmetric horizontal splitting) and the type that splits vertically (i.e., symmetric vertical splitting). Branches may exist. 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 a split type are encoded by the entropy encoder 155 and transmitted to the video decoding device. Meanwhile, a type in which a block of a corresponding node is divided into two blocks having an asymmetric shape may additionally exist. The asymmetric form may include a form in which the block of the corresponding node is divided into two rectangular blocks having a size ratio of 1:3, or a form in which the block of the corresponding node is divided in a diagonal direction may be included.

CU는 CTU로부터의 QTBT 또는 QTBTTT 분할에 따라 다양한 크기를 가질 수 있다. 이하에서는, 부호화 또는 복호화하고자 하는 CU(즉, QTBTTT의 리프 노드)에 해당하는 블록을 '현재블록'이라 칭한다. QTBTTT 분할의 채용에 따라, 현재블록의 모양은 정사각형뿐만 아니라 직사각형일 수도 있다.A CU can have various sizes depending on the QTBT or QTBTTT split from the CTU. Hereinafter, a block corresponding to a CU to be encoded or decoded (ie, a leaf node of QTBTTT) is referred to as a 'current block'. Depending on the adoption of the QTBTTT division, the shape of the current block may be rectangular as well as square.

예측부(120)는 현재블록을 예측하여 예측블록을 생성한다. 예측부(120)는 인트라 예측부(122)와 인터 예측부(124)를 포함한다. The prediction unit 120 predicts a current block and generates a prediction block. The prediction unit 120 includes an intra prediction unit 122 and an inter prediction unit 124 .

일반적으로, 픽처 내 현재블록들은 각각 예측적으로 코딩될 수 있다. 일반적으로 현재블록의 예측은 (현재블록을 포함하는 픽처로부터의 데이터를 사용하는) 인트라 예측 기술 또는 (현재블록을 포함하는 픽처 이전에 코딩된 픽처로부터의 데이터를 사용하는) 인터 예측 기술을 사용하여 수행될 수 있다. 인터 예측은 단방향 예측과 양방향 예측 모두를 포함한다.In general, each current block in a picture can be coded predictively. In general, prediction of a current block uses an intra-prediction technique (using data from a picture containing the current block) or an inter-prediction technique (using data from a picture coded before the picture containing the current block). can be performed Inter prediction includes both uni-prediction and bi-prediction.

인트라 예측부(122)는 현재블록이 포함된 현재 픽처 내에서 현재블록의 주변에 위치한 픽셀(참조 픽셀)들을 이용하여 현재블록 내의 픽셀들을 예측한다. 예측 방향에 따라 복수의 인트라 예측모드가 존재한다. 예컨대, 도 3a에서 보는 바와 같이, 복수의 인트라 예측모드는 planar 모드와 DC 모드를 포함하는 2개의 비방향성 모드와 65개의 방향성 모드를 포함할 수 있다. 각 예측모드에 따라 사용할 주변 픽셀과 연산식이 다르게 정의된다.The intra predictor 122 predicts pixels in the current block using pixels (reference pixels) located around the current block in the current picture including the current block. A plurality of intra prediction modes exist according to the prediction direction. For example, as shown in FIG. 3A, the plurality of intra prediction modes may include two non-directional modes including a planar mode and a DC mode and 65 directional modes. Depending on each prediction mode, the neighboring pixels to be used and the arithmetic expression are defined differently.

직사각형 모양의 현재블록에 대한 효율적인 방향성 예측을 위해, 도 3b에 점선 화살표로 도시된 방향성 모드들(67 ~ 80번, -1 ~ -14 번 인트라 예측모드들)이 추가로 사용될 수 있다. 이들은 "광각 인트라 예측모드들(wide angle intra-prediction modes)"로 지칭될 수 있다. 도 3b에서 화살표들은 예측에 사용되는 대응하는 참조샘플들을 가리키는 것이며, 예측 방향을 나타내는 것이 아니다. 예측 방향은 화살표가 가리키는 방향과 반대이다. 광각 인트라 예측모드들은 현재블록이 직사각형일 때 추가적인 비트 전송 없이 특정 방향성 모드를 반대방향으로 예측을 수행하는 모드이다. 이때 광각 인트라 예측모드들 중에서, 직사각형의 현재블록의 너비와 높이의 비율에 의해, 현재블록에 이용 가능한 일부 광각 인트라 예측모드들이 결정될 수 있다. 예컨대, 45도보다 작은 각도를 갖는 광각 인트라 예측모드들(67 ~ 80번 인트라 예측모드들)은 현재블록이 높이가 너비보다 작은 직사각형 형태일 때 이용 가능하고, -135도보다 큰 각도를 갖는 광각 인트라 예측모드들(-1 ~ -14 번 인트라 예측모드들)은 현재블록이 너비가 높이보다 큰 직사각형 형태일 때 이용 가능하다.For efficient directional prediction of the rectangular current block, directional modes (numbers 67 to 80 and -1 to -14 intra prediction modes) 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 , arrows indicate corresponding reference samples used for prediction and do not indicate prediction directions. The prediction direction is opposite to the direction the arrow is pointing. 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 usable for the current block may be determined by the ratio of the width and height of the rectangular current block. For example, wide-angle intra prediction modes (67 to 80 intra prediction modes) having an angle smaller than 45 degrees are usable when the current block has a rectangular shape with a height smaller than a width, and a wide angle having an angle greater than -135 degrees. Intra prediction modes (-1 to -14 intra prediction modes) are available when the current block has a rectangular shape where the width is greater than the height.

인트라 예측부(122)는 현재블록을 부호화하는데 사용할 인트라 예측모드를 결정할 수 있다. 일부 예들에서, 인트라 예측부(122)는 여러 인트라 예측모드들을 사용하여 현재블록을 인코딩하고, 테스트된 모드들로부터 사용할 적절한 인트라 예측모드를 선택할 수도 있다. 예를 들어, 인트라 예측부(122)는 여러 테스트된 인트라 예측모드들에 대한 비트율 왜곡(rate-distortion) 분석을 사용하여 비트율 왜곡 값들을 계산하고, 테스트된 모드들 중 최선의 비트율 왜곡 특징들을 갖는 인트라 예측모드를 선택할 수도 있다.The intra prediction unit 122 may determine an intra prediction mode to be used for encoding the current block. In some examples, the intra prediction unit 122 may encode the current block using several intra prediction modes and select an appropriate intra prediction mode to be used from the tested modes. For example, the intra predictor 122 calculates rate-distortion values using rate-distortion analysis for several tested intra-prediction modes, and has the best rate-distortion characteristics among the tested modes. Intra prediction mode can also be selected.

인트라 예측부(122)는 복수의 인트라 예측모드 중에서 하나의 인트라 예측모드를 선택하고, 선택된 인트라 예측모드에 따라 결정되는 주변 픽셀(참조 픽셀)과 연산식을 사용하여 현재블록을 예측한다. 선택된 인트라 예측모드에 대한 정보는 엔트로피 부호화부(155)에 의해 부호화되어 영상 복호화 장치로 전달된다.The intra prediction unit 122 selects one intra prediction mode from among a plurality of intra prediction modes, and predicts a current block using neighboring pixels (reference pixels) determined according to the selected intra prediction mode and an arithmetic expression. Information on the selected intra prediction mode is encoded by the entropy encoder 155 and transmitted to the video decoding apparatus.

인터 예측부(124)는 움직임 보상 과정을 이용하여 현재블록에 대한 예측블록을 생성한다. 인터 예측부(124)는 현재 픽처보다 먼저 부호화 및 복호화된 참조픽처 내에서 현재블록과 가장 유사한 블록을 탐색하고, 그 탐색된 블록을 이용하여 현재블록에 대한 예측블록을 생성한다. 그리고, 현재 픽처 내의 현재블록과 참조픽처 내의 예측블록 간의 변위(displacement)에 해당하는 움직임벡터(Motion Vector: MV)를 생성한다. 일반적으로, 움직임 추정은 루마(luma) 성분에 대해 수행되고, 루마 성분에 기초하여 계산된 움직임벡터는 루마 성분 및 크로마 성분 모두에 대해 사용된다. 현재블록을 예측하기 위해 사용된 참조픽처에 대한 정보 및 움직임벡터에 대한 정보를 포함하는 움직임 정보는 엔트로피 부호화부(155)에 의해 부호화되어 영상 복호화 장치로 전달된다.The inter prediction unit 124 generates a prediction block for a current block using a motion compensation process. The inter-prediction unit 124 searches for a block most similar to the current block in the encoded and decoded reference picture prior to the current picture, and generates a prediction block for the current block using the searched block. Then, a motion vector (MV) corresponding to displacement between the current block in the current picture and the prediction block in the reference picture is generated. In general, motion estimation is performed on a luma component, and a motion vector calculated based on the luma component is used for both the luma component and the chroma component. Motion information including reference picture information and motion vector information used to predict the current block is encoded by the entropy encoding unit 155 and transmitted to the video decoding apparatus.

인터 예측부(124)는, 예측의 정확성을 높이기 위해, 참조픽처 또는 참조 블록에 대한 보간을 수행할 수도 있다. 즉, 연속한 두 정수 샘플 사이의 서브 샘플들은 그 두 정수 샘플을 포함한 연속된 복수의 정수 샘플들에 필터 계수들을 적용하여 보간된다. 보간된 참조픽처에 대해서 현재블록과 가장 유사한 블록을 탐색하는 과정을 수행하면, 움직임벡터는 정수 샘플 단위의 정밀도(precision)가 아닌 소수 단위의 정밀도까지 표현될 수 있다. 움직임벡터의 정밀도 또는 해상도(resolution)는 부호화하고자 하는 대상 영역, 예컨대, 슬라이스, 타일, CTU, CU 등의 단위마다 다르게 설정될 수 있다. 이와 같은 적응적 움직임벡터 해상도(Adaptive Motion Vector Resolution: AMVR)가 적용되는 경우 각 대상 영역에 적용할 움직임벡터 해상도에 대한 정보는 대상 영역마다 시그널링되어야 한다. 예컨대, 대상 영역이 CU인 경우, 각 CU마다 적용된 움직임벡터 해상도에 대한 정보가 시그널링된다. 움직임벡터 해상도에 대한 정보는 후술할 차분 움직임벡터의 정밀도를 나타내는 정보일 수 있다.The inter-prediction unit 124 may perform interpolation on a reference picture or reference block in order to increase 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 for the interpolated reference picture, the motion vector can be expressed with precision of decimal units instead of integer sample units. The precision or resolution of the motion vector may be set differently for each unit of a target region to be encoded, for example, a slice, tile, CTU, or CU. When such adaptive motion vector resolution (AMVR) is applied, information on 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 motion vector resolution applied to each CU is signaled. Information on the motion vector resolution may be information indicating the precision of differential motion vectors, which will be described later.

한편, 인터 예측부(124)는 양방향 예측(bi-prediction)을 이용하여 인터 예측을 수행할 수 있다. 양방향 예측의 경우, 두 개의 참조픽처와 각 참조픽처 내에서 현재블록과 가장 유사한 블록 위치를 나타내는 두 개의 움직임벡터가 이용된다. 인터 예측부(124)는 참조픽처 리스트 0(RefPicList0) 및 참조픽처 리스트 1(RefPicList1)로부터 각각 제1 참조픽처 및 제2 참조픽처를 선택하고, 각 참조픽처 내에서 현재블록과 유사한 블록을 탐색하여 제1 참조블록과 제2 참조블록을 생성한다. 그리고, 제1 참조블록과 제2 참조블록을 평균 또는 가중 평균하여 현재블록에 대한 예측블록을 생성한다. 그리고 현재블록을 예측하기 위해 사용한 두 개의 참조픽처에 대한 정보 및 두 개의 움직임벡터에 대한 정보를 포함하는 움직임 정보를 부호화부(150)로 전달한다. 여기서, 참조픽처 리스트 0은 기복원된 픽처들 중 디스플레이 순서에서 현재 픽처 이전의 픽처들로 구성되고, 참조픽처 리스트 1은 기복원된 픽처들 중 디스플레이 순서에서 현재 픽처 이후의 픽처들로 구성될 수 있다. 그러나 반드시 이에 한정되는 것은 아니며, 디스플레이 순서 상으로 현재 픽처 이후의 기복원 픽처들이 참조픽처 리스트 0에 추가로 더 포함될 수 있고, 역으로 현재 픽처 이전의 기복원 픽처들이 참조픽처 리스트 1에 추가로 더 포함될 수도 있다.Meanwhile, the inter prediction unit 124 may perform inter prediction using bi-prediction. In the case of bi-directional prediction, two reference pictures and two motion vectors representing positions of blocks 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. A first reference block and a second reference block are generated. Then, a prediction block for the current block is generated by averaging or weighted averaging the first reference block and the second reference block. Further, motion information including information on two reference pictures used to predict the current block and information on two motion vectors is delivered to the encoder 150. Here, reference picture list 0 may include pictures prior to the current picture in display order among restored pictures, and reference picture list 1 may include pictures after the current picture in display order among restored pictures. there is. However, it is not necessarily limited to this, and in order of display, ups and downs pictures subsequent to the current picture may be additionally included in reference picture list 0, and conversely, ups and downs pictures prior to the current picture may be additionally included in reference picture list 1. may also be included.

움직임 정보를 부호화하는 데에 소요되는 비트량을 최소화하기 위해 다양한 방법이 사용될 수 있다. Various methods may be used to minimize the amount of bits required to encode motion information.

예컨대, 현재블록의 참조픽처와 움직임벡터가 주변블록의 참조픽처 및 움직임벡터와 동일한 경우에는 그 주변블록을 식별할 수 있는 정보를 부호화함으로써, 현재블록의 움직임 정보를 영상 복호화 장치로 전달할 수 있다. 이러한 방법을 '머지 모드(merge mode)'라 한다.For example, when the reference picture and motion vector of the current block are the same as those of the neighboring block, the motion information of the current block can be delivered to the video decoding apparatus by encoding information capable of identifying the neighboring block. This method is called 'merge mode'.

머지 모드에서, 인터 예측부(124)는 현재블록의 주변블록들로부터 기 결정된 개수의 머지 후보블록(이하, '머지 후보'라 함)들을 선택한다. In the merge mode, the inter prediction unit 124 selects a predetermined number of merge candidate blocks (hereinafter referred to as 'merge candidates') from neighboring blocks of the current block.

머지 후보를 유도하기 위한 주변블록으로는, 도 4에 도시된 바와 같이, 현재 픽처 내에서 현재블록에 인접한 좌측블록(A0), 좌하단블록(A1), 상단블록(B0), 우상단블록(B1), 및 좌상단블록(A2) 중에서 전부 또는 일부가 사용될 수 있다. 또한, 현재블록이 위치한 현재 픽처가 아닌 참조픽처(현재블록을 예측하기 위해 사용된 참조픽처와 동일할 수도 있고 다를 수도 있음) 내에 위치한 블록이 머지 후보로서 사용될 수도 있다. 예컨대, 참조픽처 내에서 현재블록과 동일 위치에 있는 블록(co-located block) 또는 그 동일 위치의 블록에 인접한 블록들이 머지 후보로서 추가로 더 사용될 수 있다. 이상에서 기술된 방법에 의해 선정된 머지 후보의 개수가 기설정된 개수보다 작으면, 0 벡터를 머지 후보에 추가한다. Neighboring blocks for deriving merge candidates include a left block (A0), a lower left block (A1), an upper block (B0), and an upper right block (B1) adjacent to the current block in the current picture, as shown in FIG. ), and all or part of the upper left block A2 may be used. Also, a block located in a reference picture (which may be the same as or different from a 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 in the reference picture or blocks adjacent to 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 the preset number, a 0 vector is added to the merge candidates.

인터 예측부(124)는 이러한 주변블록들을 이용하여 기 결정된 개수의 머지 후보를 포함하는 머지 리스트를 구성한다. 머지 리스트에 포함된 머지 후보들 중에서 현재블록의 움직임정보로서 사용할 머지 후보를 선택하고 선택된 후보를 식별하기 위한 머지 인덱스 정보를 생성한다. 생성된 머지 인덱스 정보는 부호화부(150)에 의해 부호화되어 영상 복호화 장치로 전달된다.The inter prediction unit 124 constructs a merge list including a predetermined number of merge candidates using these neighboring blocks. Among the merge candidates included in the merge list, a 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 encoder 150 and transmitted to the video decoding apparatus.

머지 스킵(merge skip) 모드는 머지 모드의 특별한 경우로서, 양자화를 수행한 후, 엔트로피 부호화를 위한 변환 계수가 모두 영(zero)에 가까울 때, 잔차신호들의 전송 없이 주변블록 선택 정보만을 전송한다. 머지 스킵 모드를 이용함으로써, 움직임이 적은 영상, 정지 영상, 스크린 콘텐츠 영상 등에서 상대적으로 높은 부호화 효율을 달성할 수 있다. Merge skip mode is a special case of merge mode. After performing quantization, when all transform coefficients for entropy encoding are close to zero, only neighboring block selection information is transmitted without transmitting residual signals. By using the merge skip mode, it is possible to achieve a relatively high encoding efficiency in low-motion images, still images, screen content images, and the like.

이하, 머지 모드와 머지 스킵 모드를 통칭하여, 머지/스킵 모드로 나타낸다. Hereinafter, merge mode and merge skip mode are collectively referred to as merge/skip mode.

움직임 정보를 부호화하기 위한 또 다른 방법은 AMVP(Advanced Motion Vector Prediction) 모드이다.Another method for encoding motion information is Advanced Motion Vector Prediction (AMVP) mode.

AMVP 모드에서, 인터 예측부(124)는 현재블록의 주변블록들을 이용하여 현재블록의 움직임벡터에 대한 예측 움직임벡터 후보들을 유도한다. 예측 움직임벡터 후보들을 유도하기 위해 사용되는 주변블록으로는, 도 4에 도시된 현재 픽처 내에서 현재블록에 인접한 좌측블록(A0), 좌하단블록(A1), 상단블록(B0), 우상단블록(B1), 및 좌상단블록(A2) 중에서 전부 또는 일부가 사용될 수 있다. 또한, 현재블록이 위치한 현재 픽처가 아닌 참조픽처(현재블록을 예측하기 위해 사용된 참조픽처와 동일할 수도 있고 다를 수도 있음) 내에 위치한 블록이 예측 움직임벡터 후보들을 유도하기 위해 사용되는 주변블록으로서 사용될 수도 있다. 예컨대, 참조픽처 내에서 현재블록과 동일 위치에 있는 블록(collocated block) 또는 그 동일 위치의 블록에 인접한 블록들이 사용될 수 있다. 이상에서 기술된 방법에 의해 움직임벡터 후보의 개수가 기설정된 개수보다 작으면, 0 벡터를 움직임벡터 후보에 추가한다. In the AMVP mode, the inter prediction unit 124 derives predictive motion vector candidates for the motion vector of the current block using neighboring blocks of the current block. Neighboring blocks used to derive predictive motion vector candidates include a left block A0, a lower left block A1, an upper block B0, and an upper right block adjacent to the current block in the current picture shown in FIG. B1), and all or part of the upper left block (A2) may be used. In addition, a block located in a reference picture (which may be the same as or different from the reference picture used to predict the current block) other than the current picture where the current block is located will be used as a neighboring block used to derive motion vector candidates. may be For example, a collocated block co-located with the current block within the reference picture or blocks adjacent to the collocated block may be used. If the number of motion vector candidates is smaller than the preset number according to the method described above, a 0 vector is added to the motion vector candidates.

인터 예측부(124)는 이 주변블록들의 움직임벡터를 이용하여 예측 움직임벡터 후보들을 유도하고, 예측 움직임벡터 후보들을 이용하여 현재블록의 움직임벡터에 대한 예측 움직임벡터를 결정한다. 그리고, 현재블록의 움직임벡터로부터 예측 움직임벡터를 감산하여 차분 움직임벡터를 산출한다. The inter-prediction unit 124 derives predicted motion vector candidates using the motion vectors of the neighboring blocks, and determines a predicted motion vector for the motion vector of the current block using the predicted motion vector candidates. Then, a differential motion vector is calculated by subtracting the predicted motion vector from the motion vector of the current block.

예측 움직임벡터는 예측 움직임벡터 후보들에 기 정의된 함수(예컨대, 중앙값, 평균값 연산 등)를 적용하여 구할 수 있다. 이 경우, 영상 복호화 장치도 기 정의된 함수를 알고 있다. 또한, 예측 움직임벡터 후보를 유도하기 위해 사용하는 주변블록은 이미 부호화 및 복호화가 완료된 블록이므로 영상 복호화 장치도 그 주변블록의 움직임벡터도 이미 알고 있다. 그러므로 영상 부호화 장치는 예측 움직임벡터 후보를 식별하기 위한 정보를 부호화할 필요가 없다. 따라서, 이 경우에는 차분 움직임벡터에 대한 정보와 현재블록을 예측하기 위해 사용한 참조픽처에 대한 정보가 부호화된다.The predicted motion vector may be obtained by applying a predefined function (eg, median value, average value operation, etc.) to predicted motion vector candidates. In this case, the video decoding apparatus also knows the predefined function. In addition, since a neighboring block used to derive a predicted motion vector candidate is a block that has already been encoded and decoded, the video decoding apparatus also knows the motion vector of the neighboring block. Therefore, the video encoding apparatus does not need to encode information for identifying a predictive motion vector candidate. Therefore, in this case, information on differential motion vectors and information on reference pictures used to predict the current block are encoded.

한편, 예측 움직임벡터는 예측 움직임벡터 후보들 중 어느 하나를 선택하는 방식으로 결정될 수도 있다. 이 경우에는 차분 움직임벡터에 대한 정보 및 현재블록을 예측하기 위해 사용한 참조픽처에 대한 정보와 함께, 선택된 예측 움직임벡터 후보를 식별하기 위한 정보가 추가로 부호화된다.Meanwhile, the predicted motion vector may be determined by selecting one of the predicted motion vector candidates. In this case, along with information on differential motion vectors and information on reference pictures used to predict the current block, information for identifying the selected predictive motion vector candidate is additionally encoded.

감산기(130)는 현재블록으로부터 인트라 예측부(122) 또는 인터 예측부(124)에 의해 생성된 예측블록을 감산하여 잔차블록을 생성한다.The subtractor 130 subtracts the prediction block generated by the intra prediction unit 122 or the inter prediction unit 124 from the current block to generate a residual block.

변환부(140)는 공간 영역의 픽셀 값들을 가지는 잔차블록 내의 잔차신호를 주파수 도메인의 변환 계수로 변환한다. 변환부(140)는 잔차블록의 전체 크기를 변환 단위로 사용하여 잔차블록 내의 잔차신호들을 변환할 수 있으며, 또는 잔차블록을 복수 개의 서브블록으로 분할하고 그 서브블록을 변환 단위로 사용하여 변환을 할 수도 있다. 또는, 변환 영역 및 비변환 영역인 두 개의 서브블록으로 구분하여, 변환 영역 서브블록만 변환 단위로 사용하여 잔차신호들을 변환할 수 있다. 여기서, 변환 영역 서브블록은 가로축 (혹은 세로축) 기준 1:1의 크기 비율을 가지는 두 개의 직사각형 블록 중 하나일 수 있다. 이런 경우, 서브블록 만을 변환하였음을 지시하는 플래그(cu_sbt_flag), 방향성(vertical/horizontal) 정보(cu_sbt_horizontal_flag) 및/또는 위치 정보(cu_sbt_pos_flag)가 엔트로피 부호화부(155)에 의해 부호화되어 영상 복호화 장치로 시그널링된다. 또한, 변환 영역 서브블록의 크기는 가로축 (혹은 세로축) 기준 1:3의 크기 비율을 가질 수 있으며, 이런 경우 해당 분할을 구분하는 플래그(cu_sbt_quad_flag)가 추가적으로 엔트로피 부호화부(155)에 의해 부호화되어 영상 복호화 장치로 시그널링된다. The transform unit 140 transforms the residual signal in the residual block having pixel values in the spatial domain into transform coefficients in the frequency domain. The transform unit 140 may transform residual signals in the residual block by using the entire size of the residual block as a transform unit, or divide the residual block into a plurality of subblocks and use the subblocks as a transform unit to perform transformation. You may. Alternatively, the residual signals may be divided into two subblocks, a transform region and a non-transform region, and transform the residual signals using only the transform region subblock as a transform unit. Here, the transformation region subblock may be one of two rectangular blocks having a size ratio of 1:1 based on a horizontal axis (or a vertical axis). In this case, a flag (cu_sbt_flag) indicating that only subblocks have been transformed, directional (vertical/horizontal) information (cu_sbt_horizontal_flag), and/or location information (cu_sbt_pos_flag) are encoded by the entropy encoding unit 155 and signaled to the video decoding device. do. In addition, the size of the transform region subblock may have a size ratio of 1:3 based on the horizontal axis (or vertical axis), and in this case, a flag (cu_sbt_quad_flag) for distinguishing the corresponding division is additionally encoded by the entropy encoder 155 to obtain an image It is signaled to the decryption device.

한편, 변환부(140)는 잔차블록에 대해 가로 방향과 세로 방향으로 개별적으로 변환을 수행할 수 있다. 변환을 위해, 다양한 타입의 변환 함수 또는 변환 행렬이 사용될 수 있다. 예컨대, 가로 방향 변환과 세로 방향 변환을 위한 변환 함수의 쌍을 MTS(Multiple Transform Set)로 정의할 수 있다. 변환부(140)는 MTS 중 변환 효율이 가장 좋은 하나의 변환 함수 쌍을 선택하고 가로 및 세로 방향으로 각각 잔차블록을 변환할 수 있다. MTS 중에서 선택된 변환 함수 쌍에 대한 정보(mts_idx)는 엔트로피 부호화부(155)에 의해 부호화되어 영상 복호화 장치로 시그널링된다. Meanwhile, the transform unit 140 may individually transform the residual block in the horizontal direction and the vertical direction. For the transformation, various types of transformation functions or transformation matrices may be used. For example, a pair of transformation functions for horizontal transformation and vertical transformation may be defined as a multiple transform set (MTS). The transform unit 140 may select one transform function pair having the highest transform efficiency among the MTS and transform the residual blocks in the horizontal and vertical directions, respectively. Information (mts_idx) on a pair of transform functions selected from the MTS is encoded by the entropy encoding unit 155 and signaled to the video decoding device.

양자화부(145)는 변환부(140)로부터 출력되는 변환 계수들을 양자화 파라미터를 이용하여 양자화하고, 양자화된 변환 계수들을 엔트로피 부호화부(155)로 출력한다. 양자화부(145)는, 어떤 블록 혹은 프레임에 대해, 변환 없이, 관련된 잔차 블록을 곧바로 양자화할 수도 있다. 양자화부(145)는 변환블록 내의 변환 계수들의 위치에 따라 서로 다른 양자화 계수(스케일링 값)을 적용할 수도 있다. 2차원으로 배열된 양자화된 변환 계수들에 적용되는 양자화 행렬은 부호화되어 영상 복호화 장치로 시그널링될 수 있다. The quantization unit 145 quantizes transform coefficients output from the transform unit 140 using a quantization parameter, 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 apply different quantization coefficients (scaling values) according to positions of transform coefficients in the transform block. A quantization matrix applied to the two-dimensionally arranged quantized transform coefficients may be coded and signaled to the video decoding apparatus.

재정렬부(150)는 양자화된 잔차값에 대해 계수값의 재정렬을 수행할 수 있다.The rearrangement unit 150 may rearrange the coefficient values of the quantized residual values.

재정렬부(150)는 계수 스캐닝(coefficient scanning)을 이용하여 2차원의 계수 어레이를 1차원의 계수 시퀀스로 변경할 수 있다. 예를 들어, 재정렬부(150)에서는 지그-재그 스캔(zig-zag scan) 또는 대각선 스캔(diagonal scan)을 이용하여 DC 계수부터 고주파수 영역의 계수까지 스캔하여 1차원의 계수 시퀀스를 출력할 수 있다. 변환 단위의 크기 및 인트라 예측모드에 따라 지그-재그 스캔 대신 2차원의 계수 어레이를 열 방향으로 스캔하는 수직 스캔, 2차원의 블록 형태 계수를 행 방향으로 스캔하는 수평 스캔이 사용될 수도 있다. 즉, 변환 단위의 크기 및 인트라 예측모드에 따라 지그-재그 스캔, 대각선 스캔, 수직 방향 스캔 및 수평 방향 스캔 중에서 사용될 스캔 방법이 결정될 수도 있다.The reordering unit 150 may change a 2D coefficient array into a 1D coefficient sequence using coefficient scanning. For example, the reordering unit 150 may output a one-dimensional coefficient sequence by scanning DC coefficients to coefficients in a high frequency region using a zig-zag scan or a diagonal scan. . Depending on the size of the transformation unit and intra prediction mode, instead of zig-zag scan, vertical scan that scans a 2D coefficient array in a column direction and horizontal scan that scans 2D block-shaped coefficients in a row direction may be used. That is, a scan method to be used among zig-zag scan, diagonal scan, vertical scan, and horizontal scan may be determined according to the size of the transform unit and the intra prediction mode.

엔트로피 부호화부(155)는, CABAC(Context-based Adaptive Binary Arithmetic Code), 지수 골롬(Exponential Golomb) 등의 다양한 부호화 방식을 사용하여, 재정렬부(150)로부터 출력된 1차원의 양자화된 변환 계수들의 시퀀스를 부호화함으로써 비트스트림을 생성한다. The entropy encoding unit 155 uses various encoding schemes such as CABAC (Context-based Adaptive Binary Arithmetic Code) and Exponential Golomb to convert the one-dimensional quantized transform coefficients output from the reordering unit 150 to each other. A bitstream is created by encoding the sequence.

또한, 엔트로피 부호화부(155)는 블록 분할과 관련된 CTU size, CU 분할 플래그, QT 분할 플래그, MTT 분할 타입, MTT 분할 방향 등의 정보를 부호화하여, 영상 복호화 장치가 영상 부호화 장치와 동일하게 블록을 분할할 수 있도록 한다. 또한, 엔트로피 부호화부(155)는 현재블록이 인트라 예측에 의해 부호화되었는지 아니면 인터 예측에 의해 부호화되었는지 여부를 지시하는 예측 타입에 대한 정보를 부호화하고, 예측 타입에 따라 인트라 예측정보(즉, 인트라 예측모드에 대한 정보) 또는 인터 예측정보(움직임 정보의 부호화 모드(머지 모드 또는 AMVP 모드), 머지 모드의 경우 머지 인덱스, AMVP 모드의 경우 참조픽처 인덱스 및 차분 움직임벡터에 대한 정보)를 부호화한다. 또한, 엔트로피 부호화부(155)는 양자화와 관련된 정보, 즉, 양자화 파라미터에 대한 정보 및 양자화 행렬에 대한 정보를 부호화한다.In addition, the entropy encoding unit 155 encodes information such as CTU size, CU splitting flag, QT splitting flag, MTT splitting type, and MTT splitting direction related to block splitting so that the video decoding apparatus can divide the block in the same way as the video encoding apparatus. make it possible to divide 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 (ie, intra prediction) according to the prediction type. mode) or inter prediction information (motion information encoding mode (merge mode or AMVP mode), merge index in case of merge mode, reference picture index and differential motion vector information in case of AMVP mode) are encoded. Also, the entropy encoding unit 155 encodes information related to quantization, that is, information about quantization parameters and information about quantization matrices.

역양자화부(160)는 양자화부(145)로부터 출력되는 양자화된 변환 계수들을 역양자화하여 변환 계수들을 생성한다. 역변환부(165)는 역양자화부(160)로부터 출력되는 변환 계수들을 주파수 도메인으로부터 공간 도메인으로 변환하여 잔차블록을 복원한다.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 transform coefficients output from the inverse quantization unit 160 from a frequency domain to a spatial domain to restore a residual block.

가산부(170)는 복원된 잔차블록과 예측부(120)에 의해 생성된 예측블록을 가산하여 현재블록을 복원한다. 복원된 현재블록 내의 픽셀들은 다음 순서의 블록을 인트라 예측할 때 참조 픽셀로서 사용된다.The adder 170 restores the current block by adding the restored residual block and the predicted block generated by the predictor 120. Pixels in the reconstructed current block are used as reference pixels when intra-predicting the next block.

루프(loop) 필터부(180)는 블록 기반의 예측 및 변환/양자화로 인해 발생하는 블록킹 아티팩트(blocking artifacts), 링잉 아티팩트(ringing artifacts), 블러링 아티팩트(blurring artifacts) 등을 줄이기 위해 복원된 픽셀들에 대한 필터링을 수행한다. 필터부(180)는 인루프(in-loop) 필터로서 디블록킹 필터(182), SAO(Sample Adaptive Offset) 필터(184) 및 ALF(Adaptive Loop Filter, 186)의 전부 또는 일부를 포함할 수 있다.The loop filter unit 180 reconstructs pixels in order to reduce blocking artifacts, ringing artifacts, blurring artifacts, etc. caused by block-based prediction and transformation/quantization. perform filtering on The filter unit 180 is an in-loop filter and may include all or part of a deblocking filter 182, a sample adaptive offset (SAO) filter 184, and an adaptive loop filter (ALF) 186. .

디블록킹 필터(182)는 블록 단위의 부호화/복호화로 인해 발생하는 블록킹 현상(blocking artifact)을 제거하기 위해 복원된 블록 간의 경계를 필터링하고, SAO 필터(184) 및 alf(186)는 디블록킹 필터링된 영상에 대해 추가적인 필터링을 수행한다. SAO 필터(184) 및 alf(186)는 손실 부호화(lossy coding)로 인해 발생하는 복원된 픽셀과 원본 픽셀 간의 차이를 보상하기 위해 사용되는 필터이다. SAO 필터(184)는 CTU 단위로 오프셋을 적용함으로써 주관적 화질뿐만 아니라 부호화 효율도 향상시킨다. 이에 비하여 ALF(186)는 블록 단위의 필터링을 수행하는데, 해당 블록의 에지 및 변화량의 정도를 구분하여 상이한 필터를 적용하여 왜곡을 보상한다. ALF에 사용될 필터 계수들에 대한 정보는 부호화되어 영상 복호화 장치로 시그널링될 수 있다.The deblocking filter 182 filters the boundary between reconstructed blocks to remove blocking artifacts caused by block-by-block encoding/decoding, and the SAO filter 184 and alf 186 perform deblocking filtering. Additional filtering is performed on the image. The SAO filter 184 and the alf 186 are filters used to compensate for a difference between a reconstructed pixel and an original pixel caused by lossy coding. The SAO filter 184 improves not only subjective picture quality but also coding efficiency by applying an offset in units of CTUs. In contrast, the ALF 186 performs block-by-block filtering. Distortion is compensated for by applying different filters by distinguishing the edge of the corresponding block and the degree of change. Information on filter coefficients to be used for ALF may be coded and signaled to the video decoding apparatus.

디블록킹 필터(182), SAO 필터(184) 및 ALF(186)를 통해 필터링된 복원블록은 메모리(190)에 저장된다. 한 픽처 내의 모든 블록들이 복원되면, 복원된 픽처는 이후에 부호화하고자 하는 픽처 내의 블록을 인터 예측하기 위한 참조픽처로 사용될 수 있다.The reconstruction block filtered through the deblocking filter 182, the SAO filter 184, and the ALF 186 is stored in the memory 190. When all blocks in one picture are reconstructed, the reconstructed picture can be used as a reference picture for inter-prediction of blocks in the picture to be encoded later.

도 5는 본 개시의 기술들을 구현할 수 있는 영상 복호화 장치의 예시적인 블록도이다. 이하에서는 도 5를 참조하여 영상 복호화 장치와 이 장치의 하위 구성들에 대하여 설명하도록 한다.5 is an exemplary block diagram of a video decoding apparatus capable of implementing the techniques of this disclosure. Hereinafter, referring to FIG. 5, a video decoding device and sub-elements of the device will be described.

영상 복호화 장치는 엔트로피 복호화부(510), 재정렬부(515), 역양자화부(520), 역변환부(530), 예측부(540), 가산기(550), 루프 필터부(560) 및 메모리(570)를 포함하여 구성될 수 있다. The image decoding apparatus includes an entropy decoding unit 510, a rearrangement unit 515, an inverse quantization unit 520, an inverse transform unit 530, a prediction unit 540, an adder 550, a loop filter unit 560, and a memory ( 570) may be configured.

도 1의 영상 부호화 장치와 마찬가지로, 영상 복호화 장치의 각 구성요소는 하드웨어 또는 소프트웨어로 구현되거나, 하드웨어 및 소프트웨어의 결합으로 구현될 수 있다. 또한, 각 구성요소의 기능이 소프트웨어로 구현되고 마이크로프로세서가 각 구성요소에 대응하는 소프트웨어의 기능을 실행하도록 구현될 수도 있다.Like the image encoding device of FIG. 1 , each component of the image decoding device may be implemented as hardware or software, or a combination of hardware and software. Also, the function of each component may be implemented as software, and the microprocessor may be implemented to execute the software function corresponding to each component.

엔트로피 복호화부(510)는 영상 부호화 장치에 의해 생성된 비트스트림을 복호화하여 블록 분할과 관련된 정보를 추출함으로써 복호화하고자 하는 현재블록을 결정하고, 현재블록을 복원하기 위해 필요한 예측정보와 잔차신호에 대한 정보 등을 추출한다.The entropy decoding unit 510 determines a current block to be decoded by extracting information related to block division by decoding the bitstream generated by the video encoding apparatus, and provides prediction information and residual signals necessary for restoring the current block. extract information, etc.

엔트로피 복호화부(510)는 SPS(Sequence Parameter Set) 또는 PPS(Picture Parameter Set)로부터 CTU size에 대한 정보를 추출하여 CTU의 크기를 결정하고, 픽처를 결정된 크기의 CTU로 분할한다. 그리고, CTU를 트리 구조의 최상위 레이어, 즉, 루트 노드로 결정하고, CTU에 대한 분할정보를 추출함으로써 트리 구조를 이용하여 CTU를 분할한다. The entropy decoding unit 510 determines the size of the CTU by extracting information about the CTU size from a sequence parameter set (SPS) or a picture parameter set (PPS), and divides the picture into CTUs of the determined size. Then, the CTU is divided using the tree structure by determining the CTU as the top layer of the tree structure, that is, the root node, and extracting division information for the CTU.

예컨대, QTBTTT 구조를 사용하여 CTU를 분할하는 경우, 먼저 QT의 분할과 관련된 제1 플래그(QT_split_flag)를 추출하여 각 노드를 하위 레이어의 네 개의 노드로 분할한다. 그리고, QT의 리프 노드에 해당하는 노드에 대해서는 MTT의 분할과 관련된 제2 플래그(MTT_split_flag) 및 분할 방향(vertical / horizontal) 및/또는 분할 타입(binary / ternary) 정보를 추출하여 해당 리프 노드를 MTT 구조로 분할한다. 이에 따라 QT의 리프 노드 이하의 각 노드들을 BT 또는 TT 구조로 반복적으로(recursively) 분할한다.For example, when a CTU is split using the QTBTTT structure, a first flag (QT_split_flag) related to splitting of QT is first extracted and each node is split into four nodes of a lower layer. In addition, for a node corresponding to a leaf node of QT, a second flag (MTT_split_flag) related to splitting of MTT and split direction (vertical / horizontal) and / or split type (binary / ternary) information are extracted and the corresponding leaf node is MTT split into structures Accordingly, each node below the leaf node of QT is recursively divided into a BT or TT structure.

또 다른 예로서, QTBTTT 구조를 사용하여 CTU를 분할하는 경우, 먼저 CU의 분할 여부를 지시하는 CU 분할 플래그(split_cu_flag)를 추출하고, 해당 블록이 분할된 경우, 제1 플래그(QT_split_flag)를 추출할 수도 있다. 분할 과정에서 각 노드는 0번 이상의 반복적인 QT 분할 후에 0번 이상의 반복적인 MTT 분할이 발생할 수 있다. 예컨대, CTU는 바로 MTT 분할이 발생하거나, 반대로 다수 번의 QT 분할만 발생할 수도 있다. As another example, when a CTU is split using the QTBTTT structure, a CU split flag (split_cu_flag) indicating whether the CU is split is first extracted, and when the corresponding block is split, a first flag (QT_split_flag) is extracted. may be During the splitting process, each node may have zero or more iterative MTT splits after zero or more repetitive QT splits. For example, the CTU may immediately undergo MTT splitting, or conversely, only QT splitting may occur multiple times.

다른 예로서, QTBT 구조를 사용하여 CTU를 분할하는 경우, QT의 분할과 관련된 제1 플래그(QT_split_flag)를 추출하여 각 노드를 하위 레이어의 네 개의 노드로 분할한다. 그리고, QT의 리프 노드에 해당하는 노드에 대해서는 BT로 더 분할되는지 여부를 지시하는 분할 플래그(split_flag) 및 분할 방향 정보를 추출한다.As another example, when a CTU is split using a QTBT structure, a first flag (QT_split_flag) related to QT splitting is extracted and each node is split into four nodes of a lower layer. And, for a node corresponding to a leaf node of QT, a split flag (split_flag) indicating whether to further split into BTs and split direction information are extracted.

한편, 엔트로피 복호화부(510)는 트리 구조의 분할을 이용하여 복호화하고자 하는 현재블록을 결정하게 되면, 현재블록이 인트라 예측되었는지 아니면 인터 예측되었는지를 지시하는 예측 타입에 대한 정보를 추출한다. 예측 타입 정보가 인트라 예측을 지시하는 경우, 엔트로피 복호화부(510)는 현재블록의 인트라 예측정보(인트라 예측모드)에 대한 신택스 요소를 추출한다. 예측 타입 정보가 인터 예측을 지시하는 경우, 엔트로피 복호화부(510)는 인터 예측정보에 대한 신택스 요소, 즉, 움직임벡터 및 그 움직임벡터가 참조하는 참조픽처를 나타내는 정보를 추출한다.Meanwhile, when the entropy decoding unit 510 determines a current block to be decoded by using tree structure partitioning, it extracts information about a prediction type indicating whether the current block is intra-predicted or inter-predicted. When 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. When the prediction type information indicates inter prediction, the entropy decoding unit 510 extracts syntax elements for the inter prediction information, that is, information indicating a motion vector and a reference picture to which the motion vector refers.

또한, 엔트로피 복호화부(510)는 양자화 관련된 정보, 및 잔차신호에 대한 정보로서 현재블록의 양자화된 변환계수들에 대한 정보를 추출한다.In addition, the entropy decoding unit 510 extracts quantization-related information and information about quantized transform coefficients of the current block as information about the residual signal.

재정렬부(515)는, 영상 부호화 장치에 의해 수행된 계수 스캐닝 순서의 역순으로, 엔트로피 복호화부(510)에서 엔트로피 복호화된 1차원의 양자화된 변환계수들의 시퀀스를 다시 2차원의 계수 어레이(즉, 블록)로 변경할 수 있다.The reordering unit 515 converts the sequence of 1-dimensional quantized transform coefficients entropy-decoded in the entropy decoding unit 510 into a 2-dimensional coefficient array (ie, in the reverse order of the coefficient scanning performed by the image encoding apparatus). block) can be changed.

역양자화부(520)는 양자화된 변환계수들을 역양자화하고, 양자화 파라미터를 이용하여 양자화된 변환계수들을 역양자화한다. 역양자화부(520)는 2차원으로 배열된 양자화된 변환계수들에 대해 서로 다른 양자화 계수(스케일링 값)을 적용할 수도 있다. 역양자화부(520)는 영상 부호화 장치로부터 양자화 계수(스케일링 값)들의 행렬을 양자화된 변환계수들의 2차원 어레이에 적용하여 역양자화를 수행할 수 있다. The inverse quantization unit 520 inverse quantizes the quantized transform coefficients and inverse quantizes the quantized transform coefficients using a quantization parameter. The inverse quantization unit 520 may apply different quantization coefficients (scaling values) to the two-dimensionally arranged quantized transform coefficients. The inverse quantization unit 520 may perform inverse quantization by applying a matrix of quantization coefficients (scaling values) from the image encoding device to a 2D array of quantized transformation coefficients.

역변환부(530)는 역양자화된 변환계수들을 주파수 도메인으로부터 공간 도메인으로 역변환하여 잔차신호들을 복원함으로써 현재블록에 대한 잔차블록을 생성한다.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.

또한, 역변환부(530)는 변환블록의 일부 영역(서브블록)만 역변환하는 경우, 변환블록의 서브블록만을 변환하였음을 지시하는 플래그(cu_sbt_flag), 서브블록의 방향성(vertical/horizontal) 정보(cu_sbt_horizontal_flag) 및/또는 서브블록의 위치 정보(cu_sbt_pos_flag)를 추출하여, 해당 서브블록의 변환계수들을 주파수 도메인으로부터 공간 도메인으로 역변환함으로써 잔차신호들을 복원하고, 역변환되지 않은 영역에 대해서는 잔차신호로 “0”값을 채움으로써 현재블록에 대한 최종 잔차블록을 생성한다.In addition, when the inverse transform unit 530 inverse transforms only a partial region (subblock) of a transform block, a flag (cu_sbt_flag) indicating that only a subblock of the transform block has been transformed, and direction information (vertical/horizontal) information (cu_sbt_horizontal_flag) of the transform block ) and/or the location information (cu_sbt_pos_flag) of the subblock, and inversely transforms the transform coefficients of the corresponding subblock from the frequency domain to the spatial domain to restore the residual signals. By filling , the final residual block for the current block is created.

또한, MTS가 적용된 경우, 역변환부(530)는 영상 부호화 장치로부터 시그널링된 MTS 정보(mts_idx)를 이용하여 가로 및 세로 방향으로 각각 적용할 변환 함수 또는 변환 행렬을 결정하고, 결정된 변환 함수를 이용하여 가로 및 세로 방향으로 변환블록 내의 변환계수들에 대해 역변환을 수행한다.In addition, when the MTS is applied, the inverse transform unit 530 determines transform functions or transform matrices to be applied in the horizontal and vertical directions, respectively, using MTS information (mts_idx) signaled from the video encoding device, and uses the determined transform functions. Inverse transform is performed on the transform coefficients in the transform block in the horizontal and vertical directions.

예측부(540)는 인트라 예측부(542) 및 인터 예측부(544)를 포함할 수 있다. 인트라 예측부(542)는 현재블록의 예측 타입이 인트라 예측일 때 활성화되고, 인터 예측부(544)는 현재블록의 예측 타입이 인터 예측일 때 활성화된다.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.

인트라 예측부(542)는 엔트로피 복호화부(510)로부터 추출된 인트라 예측모드에 대한 신택스 요소로부터 복수의 인트라 예측모드 중 현재블록의 인트라 예측모드를 결정하고, 인트라 예측모드에 따라 현재블록 주변의 참조 픽셀들을 이용하여 현재블록을 예측한다.The intra prediction unit 542 determines the intra prediction mode of the current block among a plurality of intra prediction modes from the syntax element for the intra prediction mode extracted from the entropy decoding unit 510, and references the current block according to the intra prediction mode. The current block is predicted using pixels.

인터 예측부(544)는 엔트로피 복호화부(510)로부터 추출된 인터 예측모드에 대한 신택스 요소를 이용하여 현재블록의 움직임벡터와 그 움직임벡터가 참조하는 참조픽처를 결정하고, 움직임벡터와 참조픽처를 이용하여 현재블록을 예측한다.The inter prediction unit 544 determines the motion vector of the current block and the reference picture referred to by the motion vector by using the syntax element for the inter prediction mode extracted from the entropy decoding unit 510, and converts the motion vector and the reference picture. to predict the current block.

가산기(550)는 역변환부로부터 출력되는 잔차블록과 인터 예측부 또는 인트라 예측부로부터 출력되는 예측블록을 가산하여 현재블록을 복원한다. 복원된 현재블록 내의 픽셀들은 이후에 복호화할 블록을 인트라 예측할 때의 참조픽셀로서 활용된다.The adder 550 restores the current block by adding the residual block output from the inverse transform unit and the prediction block output from the inter prediction unit or intra prediction unit. Pixels in the reconstructed current block are used as reference pixels when intra-predicting a block to be decoded later.

루프 필터부(560)는 인루프 필터로서 디블록킹 필터(562), SAO 필터(564) 및 ALF(566)를 포함할 수 있다. 디블록킹 필터(562)는 블록 단위의 복호화로 인해 발생하는 블록킹 현상(blocking artifact)을 제거하기 위해, 복원된 블록 간의 경계를 디블록킹 필터링한다. SAO 필터(564) 및 ALF(566)는 손실 부호화(lossy coding)으로 인해 발생하는 복원된 픽셀과 원본 픽셀 간의 차이를 보상하기 위해, 디블록킹 필터링 이후의 복원된 블록에 대해 추가적인 필터링을 수행한다. ALF의 필터 계수는 비스트림으로부터 복호한 필터 계수에 대한 정보를 이용하여 결정된다. 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 performs deblocking filtering on boundaries between reconstructed blocks in order to remove blocking artifacts generated by block-by-block decoding. The SAO filter 564 and the ALF 566 perform additional filtering on the reconstructed block after deblocking filtering to compensate for the difference between the reconstructed pixel and the original pixel caused by lossy coding. ALF filter coefficients are determined using information on filter coefficients decoded from the non-stream.

디블록킹 필터(562), SAO 필터(564) 및 ALF(566)를 통해 필터링된 복원블록은 메모리(570)에 저장된다. 한 픽처 내의 모든 블록들이 복원되면, 복원된 픽처는 이후에 부호화하고자 하는 픽처 내의 블록을 인터 예측하기 위한 참조픽처로 사용된다.The reconstruction block filtered through the deblocking filter 562, the SAO filter 564, and the ALF 566 is stored in the memory 570. When all blocks in one picture are reconstructed, the reconstructed picture is used as a reference picture for inter-prediction of blocks in the picture to be encoded later.

본 실시예는 이상에서 설명한 바와 같은 영상(비디오)의 부호화 및 복호화에 관한 것이다. 보다 자세하게는, 그래디언트(gradient) 기반 템플릿 매칭 결과에 따라 이차적인(secondary) MPM(Most Probable Mode) 리스트를 생성하고, 현재블록의 인트라 예측에 이차적인 MPM 리스트를 이용하는 비디오 코딩방법 및 장치를 제공한다.This embodiment relates to encoding and decoding of images (video) as described above. More specifically, a secondary MPM (Most Probable Mode) list is generated according to a gradient-based template matching result, and a video coding method and apparatus using the secondary MPM list for intra prediction of a current block are provided. .

이하의 실시예들은 영상 부호화 장치(video encoding device) 내 인트라 예측부(122)에 의해 수행될 수 있다. 또한, 영상 복호화 장치(video decoding device) 내 인트라 예측부(542)에 의해 수행될 수 있다. The following embodiments may be performed by the intra prediction unit 122 in a video encoding device. Also, it may be performed by the intra prediction unit 542 in the video decoding device.

영상 부호화 장치는, 현재블록의 인트라 예측에 있어서, 비트율 왜곡 최적화 측면에서 본 실시예와 관련된 시그널링 정보를 생성할 수 있다. 영상 부호화 장치는 엔트로피 부호화부(155)를 이용하여 이를 부호화한 후, 영상 복호화 장치로 전송할 수 있다. 영상 복호화 장치는 엔트로피 복호화부(510)를 이용하여 비트스트림으로부터 현재블록의 인트라 예측과 관련된 시그널링 정보를 복호화할 수 있다. The video encoding apparatus may generate signaling information related to the present embodiment in terms of bit rate distortion optimization in intra prediction of the current block. The image encoding device may encode the image using the entropy encoding unit 155 and transmit it to the image decoding device. The video decoding apparatus may decode signaling information related to intra prediction of the current block from a bitstream using the entropy decoding unit 510 .

이하의 설명에서, '대상 블록'이라는 용어는 현재블록 또는 코딩유닛(CU, Coding Unit)과 동일한 의미로 사용될 수 있고, 또는 코딩유닛의 일부 영역을 의미할 수도 있다.In the following description, the term 'target block' may be used in the same meaning as a current block or a coding unit (CU, Coding Unit), or may mean a partial region of a coding unit.

또한, 하나의 플래그의 값이 참이라는 것은 플래그가 1로 설정되는 경우를 나타낸다. 또한, 하나의 플래그의 값이 거짓이라는 것은 플래그가 0으로 설정되는 경우를 나타낸다. Also, a value of one flag being true indicates a case in which the flag is set to 1. In addition, a false value of one flag indicates a case in which the flag is set to 0.

I. 인트라 예측 기술들I. Intra prediction techniques

인트라 예측은, 전술한 바와 같이, 현재 부호화하려는 블록의 주변에 존재하는 샘플들을 참조하여 현재블록을 예측하는 방법이다. VVC 기술에 있어서, 인트라 예측모드는, 도 3a에 예시된 바와 같이, 비방향성 모드(즉, planar 및 DC) 외에, 세분화된 방향성 모드(즉, 2 내지 66)를 갖는다. 또한, 도 3b의 예시에 추가된 바와 같이, 루마 블록의 인트라 예측모드는 광각 인트라 예측(WAIP, Wide-angle Intra Prediction)에 따른 방향성 모드(-14 내지 -1 및 67 내지 80)를 갖는다.As described above, intra prediction is a method of predicting a current block by referring to samples existing around a block to be currently encoded. In the VVC technique, intra prediction modes have subdivided directional modes (ie, 2 to 66) in addition to non-directional modes (ie, planar and DC), as illustrated in FIG. 3A. Also, as added to the example of FIG. 3B, the intra prediction mode of the luma block has directional modes (-14 to -1 and 67 to 80) according to wide-angle intra prediction (WAIP).

또한, 인트라 예측은, MRLP(Multiple Reference Line intra Prediction), ISP(Intra Sub-Partitions), MPM(Most Probable Mode) 등과 같은 예측 기술을 이용할 수 있다.In addition, intra prediction may use prediction techniques such as multiple reference line intra prediction (MRLP), intra sub-partitions (ISP), and most probable mode (MPM).

인트라 예측의 MRLP(Multiple Reference Line intra Prediction)에 있어서, 영상 부호화/복호화 장치는 MRL(Multiple Reference Line)을 이용하여 더 많은 참조 라인들을 사용할 수 있다. MRL이 적용되는 경우, 영상 부호화/복호화 장치는, 원래의 참조 라인 외에 현재블록의 상단 및 좌변에 추가된 2 개의 라인들을 이용할 수 있다. MRL 적용 시 참조 라인의 선택을 위해, 참조 라인을 표시하는 인덱스(mrl_idx)가 영상 복호화 장치로 시그널링될 수 있다. In multiple reference line intra prediction (MRLP) of intra prediction, an image encoding/decoding apparatus may use more reference lines by using multiple reference lines (MRL). When MRL is applied, the video encoding/decoding apparatus may use two lines added to the top and left sides of the current block in addition to the original reference line. To select a reference line when applying MRL, an index (mrl_idx) indicating a reference line may be signaled to the video decoding apparatus.

인트라 예측에 있어서 MPM(Most Probable Mode) 기술은, 현재블록의 인트라 예측 시 주변 블록의 인트라 예측모드를 이용한다. 영상 부호화 장치는, 현재블록에 공간적으로 인접한 기정의된 위치들로부터 유도되는 인트라 예측모드들을 포함하도록 MPM 리스트를 생성한다. MPM 모드 적용 시, 영상 부호화 장치는 MPM 리스트의 사용 여부를 지시하는 플래그인 MPM_flag를 영상 복호화 장치로 전송할 수 있다. 또한, 영상 부호화 장치는 예측모드의 인덱스를 대신하여 MPM 인덱스인 mpm_idx를 전송함으로써, 인트라 예측모드의 부호화 효율을 향상시킬 수 있다.In intra prediction, a most probable mode (MPM) technique uses intra prediction modes of neighboring blocks when intra prediction of a current block is performed. The video encoding apparatus generates an MPM list to include intra prediction modes derived from predefined positions spatially adjacent to a current block. When the MPM mode is applied, the video encoding apparatus may transmit MPM_flag, which is a flag indicating whether to use the MPM list, to the video decoding apparatus. In addition, the video encoding apparatus can improve the encoding efficiency of the intra prediction mode by transmitting the MPM index, mpm_idx, instead of the index of the prediction mode.

ISP 기술은, 현재블록을 동일한 크기의 작은 블록들로 서브분할한 후, 서브블록들 전체에 인트라 예측모드를 공유시키지만, 서브블록 각각에 변환을 적용할 수 있다. 이때, 블록의 서브분할은 수평 방향 또는 수직 방향으로 수행될 수 있다. In the ISP technique, after subdividing a current block into small blocks of the same size, an intra prediction mode is shared across all subblocks, but a transform may be applied to each subblock. At this time, subdivision of blocks may be performed in a horizontal direction or a vertical direction.

이하의 설명에서, 서브분할되기 전의 큰 블록을 현재블록이라 하고, 서브분할된 작은 블록들 각각을 서브블록으로 표현한다.In the following description, a large block before being subdivided is referred to as a current block, and each of the subdivided small blocks is referred to as a subblock.

현재블록을 수평 방향 또는 수직 방향으로 서브분할함에 있어서, 현재블록의 크기가 너무 작은 경우, 분할된 서브블록들에 대해 오히려 부호화 효율이 저하되거나, 변환을 위한 최소 단위보다도 서브블록들의 크기가 작아져서 변환 자체가 불가능할 수 있다. 이러한 경우가 발생하지 않도록, 분할 후 획득되는 서브블록의 크기를 참조하여 ISP 적용이 제한될 수 있다. 즉, 분할된 서브블록의 픽셀의 개수가 16 이상인 경우에, 서브분할이 적용될 수 있다. 예컨대, 현재블록의 크기가 4×4인 경우, ISP는 적용되지 않는다. 4×8 또는 8×4 크기를 갖는 블록은 동일한 모양과 크기를 갖는 2 개의 서브블록들로 분할될 수 있는데, 이를 Half_Split이라 한다. 그리고 그 외의 크기를 갖는 블록은 동일한 모양과 크기를 갖는 4 개의 서브블록들로 분할될 수 있는데, 이를 Quarter_Split이라 한다.In sub-division of the current block in the horizontal or vertical direction, if the size of the current block is too small, the encoding efficiency of the divided sub-blocks is rather deteriorated or the size of the sub-blocks is smaller than the minimum unit for transformation. Conversion itself may not be possible. To prevent such a case from occurring, ISP application may be limited by referring to the size of a subblock obtained after division. That is, when the number of pixels of a divided subblock is 16 or more, subdivision may be applied. For example, if the size of the current block is 4x4, ISP is not applied. A block having a size of 4×8 or 8×4 can be split into two subblocks having the same shape and size, which is called Half_Split. Blocks having other sizes may be divided into 4 subblocks having the same shape and size, which is called Quarter_Split.

II. 템플릿 매칭 기반 이차적인 MPM 리스트II. Secondary MPM list based on template matching

이하의 실시예들은 영상 부호화 장치 내 인트라 예측부(122) 및 엔트로피 부호화부(155)에 의해 수행될 수 있다. 또한, 영상 복호화 장치 내 엔트로피 복호화부(510) 및 인트라 예측부(542)에 의해 수행될 수 있다. The following embodiments may be performed by the intra prediction unit 122 and the entropy encoding unit 155 in the image encoding apparatus. In addition, it may be performed by the entropy decoding unit 510 and the intra prediction unit 542 in the video decoding apparatus.

이하, 전술한 MPM 리스트는 주(primary) MPM 리스트와 호환적으로 이용된다. 또한, 이하의 설명에서 템플릿 매칭에 기반하여 생성되는 MPM 리스트를 이차적인(secondary) MPM 리스트로 명칭한다. Hereinafter, the aforementioned MPM list is used interchangeably with the primary MPM list. Also, in the following description, an MPM list generated based on template matching is referred to as a secondary MPM list.

도 7은 본 개시의 일 실시예에 따른, 영상 부호화 장치가 이차적인 MPM 리스트를 생성하는 방법을 나타내는 순서도이다. 7 is a flowchart illustrating a method for generating a secondary MPM list by a video encoding apparatus according to an embodiment of the present disclosure.

영상 부호화 장치는 MPM_flag를 결정한다(S700). 여기서, MPM_flag는 주 MPM 리스트의 사용 여부를 지시한다. The video encoding device determines MPM_flag (S700). Here, MPM_flag indicates whether to use the main MPM list.

영상 부호화 장치는 MPM_flag를 확인한다(S702).The video encoding device checks MPM_flag (S702).

MPM_flag가 거짓인 경우, 영상 부호화 장치는 다음과 같은 단계들을 수행한다. When MPM_flag is false, the video encoding device performs the following steps.

영상 부호화 장치는 현재블록의 기정의된 탐색 영역에서 그래디언트 기반 템플릿 매칭을 수행한다(S704).The video encoding apparatus performs gradient-based template matching in a predefined search area of the current block (S704).

본 실시예에 따른 템플릿 매칭을 수행하는 단계는, 현재블록의 템플릿을 설정하는 단계, 템플릿에 미분 필터(differential filter)를 적용하여 템플릿의 그래디언트의 크기를 산정하는 단계, 현재블록의 기정의된 탐색 영역에 대해 그래디언트 크기를 산정하는 단계, 및 템플릿의 그래디언트의 크기와 탐색 영역의 그래디언트 크기를 이용하여 그래디언트 기반 템플릿 매칭을 수행함으로써, 유사 템플릿을 탐색하는 단계를 포함할 수 있다. The step of performing template matching according to the present embodiment includes setting a template of the current block, calculating the gradient size of the template by applying a differential filter to the template, and predefined search of the current block. Calculating a gradient size for the area, and searching for a similar template by performing gradient-based template matching using the gradient size of the template and the gradient size of the search area.

영상 부호화 장치는 템플릿의 그래디언트 크기를 임계치와 비교한다(S706).The video encoding device compares the gradient size of the template with a threshold value (S706).

템플릿의 그래디언트 크기가 임계치보다 큰 경우, 영상 부호화 장치는 다음과 같은 단계들(S708 내지 S712)을 수행한다. When the size of the gradient of the template is greater than the threshold value, the video encoding apparatus performs the following steps (S708 to S712).

연산 복잡도의 감소 측면에서, 템플릿 매칭을 수행하는 단계 중 현재블록의 템플릿을 설정하는 단계, 및 템플릿에 미분 필터를 적용하여 템플릿의 그래디언트의 크기를 산정하는 단계만이 S704 단계에서 수행될 수 있다. 따라서, 그래디언트 크기가 임계치보다 큰 경우, 기정의된 탐색 영역에 대해 그래디언트 크기를 산정하는 단계, 및 템플릿의 그래디언트의 크기와 탐색 영역의 그래디언트 크기를 이용하여 그래디언트 기반 템플릿 매칭을 수행함으로써, 유사 템플릿을 탐색하는 단계가 S708 단계 이전에 수행될 수 있다. In terms of reducing computational complexity, only the step of setting the template of the current block and the step of calculating the size of the gradient of the template by applying a differentiation filter to the template among the steps of performing template matching can be performed in step S704. Therefore, if the gradient size is greater than the threshold value, calculating the gradient size for the predefined search area, and performing gradient-based template matching using the gradient size of the template and the search area to find similar templates. A search step may be performed before step S708.

영상 부호화 장치는 유사 템플릿의 대응블록을 이용하여 인트라 예측모드들를 유도하고 정렬한다(S708).The image encoding apparatus derives and arranges intra prediction modes using a corresponding block of a similar template (S708).

영상 부호화 장치는 정렬된 인트라 예측모드들을 이용하여 이차적인 MPM 리스트를 구성하고, secondary_mpm_flag를 1로 설정한다(S710). 여기서, 이차적인 MPM 플래그인 secondary_mpm_flag는 이차적인 MPM 리스트의 사용 여부를 지시한다. The video encoding apparatus constructs a secondary MPM list using the sorted intra prediction modes and sets secondary_mpm_flag to 1 (S710). Here, secondary_mpm_flag, a secondary MPM flag, indicates whether to use a secondary MPM list.

영상 부호화 장치는 secondary_mpm_idx를 결정한다(S712). 여기서, 이차적인 MPM 인덱스인 secondary_mpm_idx는 이차적인 MPM 리스트에 저장된 인트라 예측모드들 중 하나를 지시한다. 부호화 효율 최적화 측면에서 영상 부호화 장치는 secondary_mpm_idx를 결정할 수 있다. The video encoding device determines secondary_mpm_idx (S712). Here, secondary_mpm_idx, which is a secondary MPM index, indicates one of intra prediction modes stored in the secondary MPM list. In terms of encoding efficiency optimization, the video encoding device may determine secondary_mpm_idx.

이후, 영상 부호화 장치는 secondary_mpm_idx를 이용하여 이차적인 MPM 리스트로부터 현재블록의 인트라 예측모드를 유도할 수 있다. 영상 부호화 장치는 인트라 예측모드를 이용하여 예측블록을 생성한 후, 현재블록으로부터 예측블록을 감산하여 잔차블록을 생성할 수 있다. 영상 부호화 장치는 MPM_flag, secondary_mpm_flag, secondary_mpm_idx 및 잔차블록을 부호화할 수 있다. Thereafter, the video encoding device may derive the intra prediction mode of the current block from the secondary MPM list using secondary_mpm_idx. After generating a prediction block using the intra prediction mode, the image encoding apparatus may generate a residual block by subtracting the prediction block from the current block. The video encoding device may encode MPM_flag, secondary_mpm_flag, secondary_mpm_idx, and a residual block.

템플릿의 그래디언트 크기가 임계치 이하인 경우, 영상 부호화 장치는 secondary_mpm_flag를 0으로 설정하고(S720), MPM 리메인더를 결정한다(S722). MPM 리메인더는, 이차적인 MPM 리스트 또는 주 MPM 리스트에 포함되지 않은 인트라 예측모드이다. If the gradient size of the template is less than or equal to the threshold value, the video encoding device sets secondary_mpm_flag to 0 (S720) and determines an MPM reminder (S722). The MPM reminder is an intra prediction mode that is not included in the secondary MPM list or the main MPM list.

이후, 영상 부호화 장치는 MPM 리메인더에 따라 현재블록의 인트라 예측모드를 유도할 수 있다. 영상 부호화 장치는 인트라 예측모드를 이용하여 예측블록을 생성한 후, 현재블록으로부터 예측블록을 감산하여 잔차블록을 생성할 수 있다. 영상 부호화 장치는 MPM_flag, secondary_mpm_flag, MPM 리메인더 및 잔차블록을 부호화할 수 있다. Thereafter, the video encoding apparatus may derive an intra prediction mode of the current block according to the MPM reminder. After generating a prediction block using the intra prediction mode, the image encoding apparatus may generate a residual block by subtracting the prediction block from the current block. The video encoding apparatus may encode MPM_flag, secondary_mpm_flag, MPM reminder, and residual block.

한편, MPM_flag가 참인 경우, 영상 부호화 장치는 다음과 같은 단계들을 수행한다. Meanwhile, when MPM_flag is true, the video encoding apparatus performs the following steps.

영상 부호화 장치는 mpm_idx를 결정한다(S730). The video encoding device determines mpm_idx (S730).

이후, 영상 부호화 장치는 mpm_idx를 이용하여 주 MPM 리스트로부터 현재블록의 인트라 예측모드를 유도할 수 있다. 영상 부호화 장치는 인트라 예측모드를 이용하여 예측블록을 생성한 후, 현재블록으로부터 예측블록을 감산하여 잔차블록을 생성할 수 있다. 영상 부호화 장치는 MPM_flag, mpm_idx 및 잔차블록을 부호화할 수 있다. Thereafter, the video encoding apparatus may derive an intra prediction mode of the current block from the main MPM list using mpm_idx. After generating a prediction block using the intra prediction mode, the image encoding apparatus may generate a residual block by subtracting the prediction block from the current block. The video encoding apparatus may encode MPM_flag, mpm_idx, and a residual block.

도 8은 본 개시의 일 실시예에 따른, 영상 복호화 장치가 이차적인 MPM 리스트를 생성하는 방법을 나타내는 순서도이다. 8 is a flowchart illustrating a method for generating a secondary MPM list by a video decoding apparatus according to an embodiment of the present disclosure.

영상 복호화 장치는 비트스트림으로부터 잔차블록 및 MPM_flag를 복호화한다(S800).The video decoding apparatus decodes the residual block and MPM_flag from the bitstream (S800).

영상 복호화 장치는 MPM_flag를 확인한다(S802).The video decoding apparatus checks MPM_flag (S802).

MPM_flag가 거짓인 경우, 영상 복호화 장치는 다음과 같은 단계들을 수행한다.When MPM_flag is false, the video decoding apparatus performs the following steps.

영상 복호화 장치는 비트스트림으로부터 secondary_mpm_flag를 복호화한다(S804). 여기서, secondary_mpm_flag는 이차적인 MPM 리스트의 사용 여부를 지시한다. The video decoding apparatus decodes secondary_mpm_flag from the bitstream (S804). Here, secondary_mpm_flag indicates whether to use the secondary MPM list.

영상 복호화 장치는 secondary_mpm_flag를 확인한다(S806).The video decoding device checks secondary_mpm_flag (S806).

secondary_mpm_flag가 참인 경우, 영상 복호화 장치는 다음과 같은 단계들을 수행한다.If secondary_mpm_flag is true, the video decoding apparatus performs the following steps.

영상 복호화 장치는 현재블록의 기정의된 탐색 영역에서 그래디언트 기반 템플릿 매칭을 수행하여 유사 템플릿을 탐색한다(S808).The video decoding apparatus searches for a similar template by performing gradient-based template matching in a predefined search area of the current block (S808).

본 실시예에 따른 템플릿 매칭을 수행하는 단계는, 현재블록의 템플릿을 설정하는 단계, 템플릿에 미분 필터(differential filter)를 적용하여 템플릿의 그래디언트의 크기를 산정하는 단계, 현재블록의 기정의된 탐색 영역에 대해 그래디언트 크기를 산정하는 단계, 및 템플릿의 그래디언트의 크기와 탐색 영역의 그래디언트 크기를 이용하여 그래디언트 기반 템플릿 매칭을 수행함으로써, 유사 템플릿을 탐색하는 단계를 포함할 수 있다. The step of performing template matching according to the present embodiment includes setting a template of the current block, calculating the gradient size of the template by applying a differential filter to the template, and predefined search of the current block. Calculating a gradient size for the area, and searching for a similar template by performing gradient-based template matching using the gradient size of the template and the gradient size of the search area.

영상 복호화 장치는 유사 템플릿의 대응블록을 이용하여 인트라 예측모드들을 유도하고 정렬한다(S810).The video decoding apparatus derives and arranges intra prediction modes using corresponding blocks of similar templates (S810).

영상 복호화 장치는 정렬된 인트라 예측모드들을 이용하여 이차적인 MPM 리스트를 구성한다(S812)The video decoding apparatus constructs a secondary MPM list using the sorted intra prediction modes (S812).

영상 복호화 장치는 비트스트림으로부터 secondary_mpm_idx를 복호화한다(S814). 여기서, 이차적인 MPM 인덱스인 secondary_mpm_idx는 이차적인 MPM 리스트에 저장된 인트라 예측모드들 중 하나를 지시한다. The video decoding apparatus decodes secondary_mpm_idx from the bitstream (S814). Here, secondary_mpm_idx, which is a secondary MPM index, indicates one of intra prediction modes stored in the secondary MPM list.

이후, 영상 복호화 장치는 secondary_mpm_idx를 이용하여 이차적인 MPM 리스트로부터 현재블록의 인트라 예측모드를 유도할 수 있다. 영상 복호화 장치는 인트라 예측모드를 이용하여 예측블록을 생성한 후, 예측블록과 잔차블록을 가산하여 현재블록을 복원할 수 있다. Thereafter, the video decoding apparatus may derive the intra prediction mode of the current block from the secondary MPM list using secondary_mpm_idx. After generating a prediction block using the intra prediction mode, the video decoding apparatus may reconstruct the current block by adding the prediction block and the residual block.

secondary_mpm_flag가 거짓인 경우, 영상 복호화 장치는 비트스트림으로부터 MPM 리메인더를 복호화한다(S820).If secondary_mpm_flag is false, the video decoding apparatus decodes the MPM reminder from the bitstream (S820).

이후, 영상 복호화 장치는 MPM 리메인더에 따라 현재블록의 인트라 예측모드를 유도할 수 있다. 영상 복호화 장치는 인트라 예측모드를 이용하여 예측블록을 생성한 후, 예측블록과 잔차블록을 가산하여 현재블록을 복원할 수 있다. Thereafter, the video decoding apparatus may derive an intra prediction mode of the current block according to the MPM reminder. After generating a prediction block using the intra prediction mode, the video decoding apparatus may reconstruct the current block by adding the prediction block and the residual block.

한편, MPM_flag가 참인 경우, 영상 복호화 장치는 다음과 같은 단계들을 수행한다.Meanwhile, when MPM_flag is true, the video decoding apparatus performs the following steps.

영상 복호화 장치는 비트스트림으로부터 mpm_idx를 복호화한다(S830). The video decoding apparatus decodes mpm_idx from the bitstream (S830).

이후, 영상 복호화 장치는 mpm_idx를 이용하여 주 MPM 리스트로부터 현재블록의 인트라 예측모드를 유도할 수 있다. 영상 복호화 장치는 인트라 예측모드를 이용하여 예측블록을 생성한 후, 예측블록과 잔차블록을 가산하여 현재블록을 복원할 수 있다. Thereafter, the video decoding apparatus may derive an intra prediction mode of the current block from the main MPM list using mpm_idx. After generating a prediction block using the intra prediction mode, the video decoding apparatus may reconstruct the current block by adding the prediction block and the residual block.

다른 예로서, 영상 부호화 장치는 그래디언트 크기가 임계치 이하인 경우, secondary_mpm_flag를 0으로 설정하고, 도 6에 예시된 바와 같은 템플릿 매칭을 수행할 수 있다. 템플릿 매칭을 수행하는 방법은 영상 부호화 장치와 영상 복호화 장치 간 약속에 따라 사전에 설정될 수 있다. As another example, when the size of the gradient is less than or equal to the threshold value, the video encoding device may set secondary_mpm_flag to 0 and perform template matching as illustrated in FIG. 6 . A method of performing template matching may be set in advance according to an agreement between the video encoding device and the video decoding device.

이후, 영상 부호화 장치는 템플릿 매칭에 따른 유사 템플릿에 대응하는 블록을 현재블록의 예측블록을 생성한 후, 현재블록으로부터 예측블록을 감산하여 잔차블록을 생성할 수 있다. 영상 부호화 장치는 MPM_flag, secondary_mpm_flag 및 잔차블록을 부호화할 수 있다. Thereafter, the video encoding apparatus may generate a residual block by subtracting the prediction block from the current block after generating a block corresponding to the similar template according to template matching as a prediction block of the current block. The video encoding device may encode MPM_flag, secondary_mpm_flag, and a residual block.

도 9는 본 개시의 다른 실시예에 따른, 영상 복호화 장치가 이차적인 MPM 리스트를 생성하는 방법을 나타내는 순서도이다. 9 is a flowchart illustrating a method for generating a secondary MPM list by a video decoding apparatus according to another embodiment of the present disclosure.

다른 단계들은 도 8에 예시된 순서도와 동일하므로, secondary_mpm_flag가 거짓인 경우만을 기술한다. secondary_mpm_flag가 거짓인 경우, 영상 복호화 장치는 템플릿 매칭을 수행한다(S920).Since other steps are the same as the flowchart illustrated in FIG. 8, only the case where secondary_mpm_flag is false is described. If secondary_mpm_flag is false, the video decoding apparatus performs template matching (S920).

이후, 영상 복호화 장치는 템플릿 매칭에 따른 유사 템플릿에 대응하는 블록을 현재블록의 예측블록을 생성한 후, 예측블록과 잔차블록을 가산하여 현재블록을 복원할 수 있다. Thereafter, the video decoding apparatus may generate a prediction block of the current block using a block corresponding to a similar template according to template matching, and then restore the current block by adding the prediction block and the residual block.

또다른 실시예로서, 영상 부호화 장치는 secondary_mpm_flag을 생성하지 않은 채로, 그래디언트 값의 크기에 따라 이차적인 MPM 리스트의 사용여부가 결정될 수 있다. As another embodiment, the video encoding apparatus may determine whether to use the secondary MPM list according to the size of the gradient value without generating the secondary_mpm_flag.

도 10은 본 개시의 또다른 실시예에 따른, 영상 부호화 장치가 이차적인 MPM 리스트를 생성하는 방법을 나타내는 순서도이다. 10 is a flowchart illustrating a method for generating a secondary MPM list by a video encoding apparatus according to another embodiment of the present disclosure.

다른 단계들은 도 7에 예시된 순서도와 동일하므로, secondary_mpm_flag의 삭제와 관련된 부분만을 기술한다. Since the other steps are the same as the flowchart illustrated in FIG. 7, only the parts related to secondary_mpm_flag deletion are described.

템플릿의 그래디언트 크기가 임계치보다 큰 경우, 영상 부호화 장치는 다음과 같은 단계들(S1008 내지 S1012)을 수행한다. When the size of the gradient of the template is greater than the threshold value, the video encoding apparatus performs the following steps (S1008 to S1012).

전술한 바와 같이, 그래디언트 크기가 임계치보다 큰 경우, 현재블록의 기정의된 탐색 영역에 대해 그래디언트 크기를 산정하는 단계, 및 템플릿의 그래디언트의 크기와 탐색 영역의 그래디언트 크기를 이용하여 그래디언트 기반 템플릿 매칭을 수행함으로써, 유사 템플릿을 탐색하는 단계가 S1008 단계 이전에 수행될 수 있다. As described above, if the gradient size is greater than the threshold, calculating the gradient size for the predefined search area of the current block, and performing gradient-based template matching using the gradient size of the template and the gradient size of the search area. By doing so, the step of searching for similar templates can be performed before step S1008.

영상 부호화 장치는 유사 템플릿의 대응블록을 이용하여 인트라 예측모드들을 유도하고 정렬한다(S1008).The image encoding apparatus induces and arranges intra prediction modes using corresponding blocks of similar templates (S1008).

영상 부호화 장치는 정렬된 인트라 예측모드들을 이용하여 이차적인 MPM 리스트를 구성한다(S1010).The video encoding apparatus constructs a secondary MPM list using the sorted intra prediction modes (S1010).

영상 부호화 장치는 secondary_mpm_idx를 결정한다(S1012). 여기서, 이차적인 MPM 인덱스인 secondary_mpm_idx는 이차적인 MPM 리스트에 저장된 인트라 예측모드들 중 하나를 지시한다. The video encoding device determines secondary_mpm_idx (S1012). Here, secondary_mpm_idx, which is a secondary MPM index, indicates one of intra prediction modes stored in the secondary MPM list.

이후, 영상 부호화 장치는 secondary_mpm_idx를 이용하여 이차적인 MPM 리스트로부터 현재블록의 인트라 예측모드를 유도할 수 있다. 영상 부호화 장치는 인트라 예측모드를 이용하여 예측블록을 생성한 후, 현재블록으로부터 예측블록을 감산하여 잔차블록을 생성할 수 있다. 영상 부호화 장치는 MPM_flag, secondary_mpm_idx 및 잔차블록을 부호화할 수 있다. Thereafter, the video encoding device may derive the intra prediction mode of the current block from the secondary MPM list using secondary_mpm_idx. After generating a prediction block using the intra prediction mode, the image encoding apparatus may generate a residual block by subtracting the prediction block from the current block. The video encoding device may encode MPM_flag, secondary_mpm_idx, and a residual block.

템플릿의 그래디언트 크기가 임계치 이하인 경우, 영상 부호화 장치는 MPM 리메인더를 결정한다(S1020). When the gradient size of the template is less than or equal to the threshold value, the video encoding apparatus determines an MPM reminder (S1020).

이후, 영상 부호화 장치는 MPM 리메인더에 따라 현재블록의 인트라 예측모드를 유도할 수 있다. 영상 부호화 장치는 인트라 예측모드를 이용하여 예측블록을 생성한 후, 현재블록으로부터 예측블록을 감산하여 잔차블록을 생성할 수 있다. 영상 부호화 장치는 MPM_flag, MPM 리메인더 및 잔차블록을 부호화할 수 있다. Thereafter, the video encoding apparatus may derive an intra prediction mode of the current block according to the MPM reminder. After generating a prediction block using the intra prediction mode, the image encoding apparatus may generate a residual block by subtracting the prediction block from the current block. The video encoding apparatus may encode MPM_flag, MPM reminder, and residual block.

도 11은 본 개시의 또다른 실시예에 따른, 영상 복호화 장치가 이차적인 MPM 리스트를 생성하는 방법을 나타내는 순서도이다. 11 is a flowchart illustrating a method for generating a secondary MPM list by a video decoding apparatus according to another embodiment of the present disclosure.

다른 단계들은 도 7에 예시된 순서도와 동일하므로, secondary_mpm_flag의 삭제와 관련된 부분만을 기술한다. Since the other steps are the same as the flowchart illustrated in FIG. 7, only the parts related to secondary_mpm_flag deletion are described.

MPM_flag가 거짓인 경우, 영상 복호화 장치는 다음과 같은 단계들을 수행한다.When MPM_flag is false, the video decoding apparatus performs the following steps.

영상 복호화 장치는 기정의된 탐색 영역에서 그래디언트 기반 템플릿 매칭을 수행하여 유사 템플릿을 탐색한다(S1104).The video decoding apparatus searches for a similar template by performing gradient-based template matching in a predefined search area (S1104).

영상 복호화 장치는 그래디언트 크기를 임계치와 비교한다(S1106).The video decoding apparatus compares the gradient size with a threshold value (S1106).

그래디언트 크기가 임계치보다 큰 경우, 영상 복호화 장치는 다음과 같은 단계들을 수행한다.When the gradient size is greater than the threshold value, the video decoding apparatus performs the following steps.

연산 복잡도의 감소 측면에서, 템플릿 매칭을 수행하는 단계 중 현재블록의 템플릿을 설정하는 단계, 및 템플릿에 미분 필터를 적용하여 템플릿의 그래디언트의 크기를 산정하는 단계만이 S1104 단계에서 수행될 수 있다. 따라서, 그래디언트 크기가 임계치보다 큰 경우, 현재블록의 기정의된 탐색 영역에 대해 그래디언트 크기를 산정하는 단계, 및 템플릿의 그래디언트의 크기와 탐색 영역의 그래디언트 크기를 이용하여 그래디언트 기반 템플릿 매칭을 수행함으로써, 유사 템플릿을 탐색하는 단계가 S1108 단계 이전에 수행될 수 있다. In terms of reducing computational complexity, only the step of setting the template of the current block and the step of calculating the size of the gradient of the template by applying a differentiation filter to the template among the steps of performing template matching may be performed in step S1104. Therefore, if the gradient size is greater than the threshold value, calculating the gradient size for the predefined search area of the current block, and performing gradient-based template matching using the gradient size of the template and the gradient size of the search area, A step of searching for a similar template may be performed before step S1108.

영상 복호화 장치는 유사 템플릿의 대응블록을 이용하여 인트라 예측모드들을 유도하고 정렬한다(S1108).The video decoding apparatus derives and arranges intra prediction modes using corresponding blocks of similar templates (S1108).

영상 복호화 장치는 정렬된 인트라 예측모드들을 이용하여 이차적인 MPM 리스트를 구성한다(S1110)The video decoding apparatus constructs a secondary MPM list using the sorted intra prediction modes (S1110)

영상 복호화 장치는 비트스트림으로부터 secondary_mpm_idx를 복호화한다(S1112). 여기서, 이차적인 MPM 인덱스인 secondary_mpm_idx는 이차적인 MPM 리스트에 저장된 인트라 예측모드들 중 하나를 지시한다. The video decoding apparatus decodes secondary_mpm_idx from the bitstream (S1112). Here, secondary_mpm_idx, which is a secondary MPM index, indicates one of intra prediction modes stored in the secondary MPM list.

이후, 영상 복호화 장치는 secondary_mpm_idx를 이용하여 이차적인 MPM 리스트로부터 현재블록의 인트라 예측모드를 유도할 수 있다. 영상 복호화 장치는 인트라 예측모드를 이용하여 예측블록을 생성한 후, 예측블록과 잔차블록을 가산하여 현재블록을 복원할 수 있다. Thereafter, the video decoding apparatus may derive the intra prediction mode of the current block from the secondary MPM list using secondary_mpm_idx. After generating a prediction block using the intra prediction mode, the video decoding apparatus may reconstruct the current block by adding the prediction block and the residual block.

그래디언트 크기가 임계치 이하인 경우, 영상 복호화 장치는 비트스트림으로부터 MPM 리메인더를 복호화한다(S1120).If the gradient size is less than or equal to the threshold value, the video decoding apparatus decodes the MPM reminder from the bitstream (S1120).

이후, 영상 복호화 장치는 MPM 리메인더에 따라 현재블록의 인트라 예측모드를 유도할 수 있다. 영상 복호화 장치는 인트라 예측모드를 이용하여 예측블록을 생성한 후, 예측블록과 잔차블록을 가산하여 현재블록을 복원할 수 있다. Thereafter, the video decoding apparatus may derive an intra prediction mode of the current block according to the MPM reminder. After generating a prediction block using the intra prediction mode, the video decoding apparatus may reconstruct the current block by adding the prediction block and the residual block.

한편, 그래디언트 크기를 산정하는 방법은 영상 부호화 장치와 영상 복호화 장치 간 약속에 따라 동일한 방법이 설정될 수 있다. 또한 그래디언트 크기와 비교되는 임계치도 영상 부호화 장치와 영상 복호화 장치 간 약속에 따라 기설정된 값이 설정될 수 있다. Meanwhile, the same method for calculating the size of the gradient may be set according to an agreement between the video encoding device and the video decoding device. In addition, a predetermined value may be set for the threshold value compared with the gradient size according to an agreement between the video encoding apparatus and the video decoding apparatus.

이하, 그래디언트 기반 템플릿 매칭 단계, 인트라 예측모드 유도 및 정렬 단계, 및 이차적인 MPM 리스트 구성 단계를, 영상 부호화 장치를 중심으로 기술한다. 이하에 기술되는 단계들은 영상 복호화 장치에도 동일하게 적용될 수 있다. 먼저, 그래디언트 기반 템플릿 매칭 단계를 기술한다. Hereinafter, the gradient-based template matching step, the intra prediction mode derivation and sorting step, and the secondary MPM list construction step will be described, focusing on the video encoding device. The steps described below may be equally applied to an image decoding device. First, the gradient-based template matching step is described.

영상 부호화 장치는 복원 영역의 그래디언트 크기 및 템플릿의 그래디언트 크기를 산정한다. 산정된 그래디언트 크기의 값들을 기반으로 기복원 영역에서 유사한 템플릿을 탐색함으로써, 그래디언트 기반 템플릿 매칭이 수행될 수 있다. The image encoding apparatus calculates the gradient size of the reconstruction region and the gradient size of the template. Gradient-based template matching may be performed by searching for similar templates in the relief region based on the calculated values of the gradient size.

템플릿은 현재블록의 이웃하는 영역으로 구성되되, 도 12에 예시된 바와 같은 형태일 수 있다. 도 12의 예시에서, TW 및 TH는 각각 템플릿의 가로의 길이 및 세로 길이를 나타내고, 영상 부호화 장치와 영상 복호화 장치 간 약속에 따라 사전에 설정될 수 있다. 템플릿의 형태는 영상 부호화 장치와 영상 복호화 장치 간 약속에 따라 사전에 설정될 수 있다. 또는, 영상 부호화 장치는 기설정된 템플릿의 형태들 중 하나를 지시하는 인덱스를 부호화한 후, 영상 복호화 장치로 시그널링할 수 있다.The template is composed of a region adjacent to the current block, and may have a form as illustrated in FIG. 12 . In the example of FIG. 12 , TW and TH represent horizontal and vertical lengths of the template, respectively, and may be set in advance according to an agreement between the video encoding device and the video decoding device. The shape of the template may be set in advance according to an agreement between the video encoding device and the video decoding device. Alternatively, the video encoding apparatus may encode an index indicating one of preset template types and then signal the video decoding apparatus.

템플릿의 형태는 기복원 영역의 예측모드에 따라 달라질 수 있다. 도 13의 예시와 같이, 상단 블록이 수직 방향 모드로 예측되고 좌측 블록이 비방향성 모드로 예측된 경우, 상단 블록에 해당하는 템플릿만이 사용될 수 있다. 또는, 상단 블록이 비방향성 모드로 예측되고 좌측 블록이 수평 방향 모드인 경우, 좌측 블록의 템플릿만이 사용될 수 있다.The shape of the template may vary according to the prediction mode of the relief region. As in the example of FIG. 13 , when the upper block is predicted in the vertical mode and the left block is predicted in the non-directional mode, only the template corresponding to the upper block can be used. Alternatively, when the upper block is predicted in the non-directional mode and the left block is in the horizontal mode, only the template of the left block may be used.

다른 예로서, 영상 부호화 장치는 템플릿을 회전한 후, 탐색 영역에서 유사한 템플릿을 찾을 수 있다. 도 14에 예시된 바와 같이, 기본 템플릿(ⓐ), 시계방향으로 90도 회전한 템플릿(ⓑ), 180도 회전한 템플릿(ⓒ), 및 270도 회전한 템플릿(ⓓ)이 사용될 수 있다. As another example, the video encoding device may find a similar template in the search area after rotating the template. As illustrated in FIG. 14 , a basic template (ⓐ), a template rotated 90 degrees clockwise (ⓑ), a template rotated 180 degrees (ⓒ), and a template rotated 270 degrees (ⓓ) may be used.

템플릿에 미분 필터(differential filter)를 적용하여 템플릿의 그래디언트 값이 산정될 수 있다. 수평 방향과 수직 방향에 대해 프리윗(Prewitt) 필터, 로버츠(Roberts) 필터, 소벨(Sobel) 필터 등이 미분 필터로서 사용될 수 있다. 미분 필터를 이용하여 산정한 그래디언트 값인 dx 및 dy 값을 이용하여, 수학식 1 또는 수학식 2와 같이 템플릿 내 각 픽셀에 대해 그래디언트 크기가 산정될 수 있다. 산정된 템플릿의 그래디언트 크기는 추후 이용을 위해 저장 및 관리될 수 있다.A gradient value of the template may be calculated by applying a differential filter to the template. For the horizontal and vertical directions, a Prewitt filter, a Roberts filter, a Sobel filter, or the like may be used as a differential filter. A gradient size may be calculated for each pixel in the template as shown in Equation 1 or Equation 2 using dx and dy values, which are gradient values calculated using a differential filter. The calculated gradient size of the template may be stored and managed for future use.

Figure pat00001
Figure pat00001

Figure pat00002
Figure pat00002

전술한 바와 같이, 템플릿에 포함된 픽셀들의 그래디언트 크기의 합이 기설정된 임계치 이하인 경우, 이차적인 MPM 리스트가 구성되지 않는다. 이때, secondary_mpm_flag은 0으로 설정되고, MPM 리메인더가 시그널링된다. As described above, when the sum of gradient sizes of pixels included in the template is equal to or less than a preset threshold value, a secondary MPM list is not configured. At this time, secondary_mpm_flag is set to 0, and the MPM reminder is signaled.

도 15는 본 개시의 일 실시예에 따른, 템플릿 매칭을 위한 탐색 영역들을 나타내는 예시도이다. 15 is an exemplary diagram illustrating search areas for template matching according to an embodiment of the present disclosure.

도 15의 예시에서, 복원 영역 내의 R1, R2, R3 및 R4 영역들은 각각 현재 CTU 내 블록, 현재 CTU의 좌상단 블록, 현재 CTU의 상단 블록, 현재 CTU의 좌측 블록이 될 수 있다. 이러한 탐색 영역들은 영상 부호화 장치와 영상 복호화 장치 간 약속에 따라 사전에 설정될 수 있다. 또한, 도 15의 예시에서 SearchRange_W 및 SearchRange_H는 영상 부호화 장치와 영상 복호화 장치 간 약속에 따라 사전에 설정될 수 있다. In the example of FIG. 15 , regions R1, R2, R3, and R4 in the restoration region may be a block in the current CTU, an upper left block of the current CTU, an upper block of the current CTU, or a left block of the current CTU, respectively. These search areas may be set in advance according to an agreement between the video encoding device and the video decoding device. In addition, in the example of FIG. 15, SearchRange_W and SearchRange_H may be set in advance according to an agreement between the video encoding device and the video decoding device.

도 15에 예시된 탐색 영역들에 대해, 전술한 바와 같은 미분 필터를 적용하여 그래디언트 값이 산정될 수 있다. 미분 필터를 이용하여 산정한 그래디언트 값인 dx 및 dy 값을 이용하여, 수학식 1 또는 수학식 2와 같이 탐색 영역들 내 각 픽셀에 대해 그래디언트 크기가 산정될 수 있다. 산정된 그래디언트 크기는 추후 이용을 위해 저장 및 관리될 수 있다. For the search areas illustrated in FIG. 15 , a gradient value may be calculated by applying the differential filter as described above. A gradient size may be calculated for each pixel in the search areas as shown in Equation 1 or Equation 2 using dx and dy values, which are gradient values calculated using a differential filter. The calculated gradient size can be stored and managed for future use.

미분 필터의 타입, 및 그래디언트 크기를 산정하는 방법은 영상 부호화 장치와 영상 복호화 장치 간 약속에 따라 사전에 설정될 수 있다. 또한, 템플릿 및 탐색 영역들에 대해 미분 필터의 타입, 및 그래디언트 크기를 산정하는 방법이 동일하게 적용된다.The type of the differential filter and the method of calculating the gradient size may be set in advance according to an agreement between the video encoding apparatus and the video decoding apparatus. In addition, the same applies to the type of differentiation filter and the method of calculating the gradient size for the template and the search areas.

도 16은 본 개시의 일 실시예에 따른, 탐색 영역에서 그래디언트 크기의 산정을 나타내는 예시도이다. 16 is an exemplary diagram illustrating calculation of a gradient size in a search area according to an embodiment of the present disclosure.

영상 부호화 장치는 부호화 순서에 따라 부호화를 진행하면서, K×Q 블록마다 그래디언트 크기를 산정한 후 저장한다. 여기서, K×Q 블록의 크기는 CTU, CU, PU(Prediction Unit, 예측유닛) 또는 TU(Transform Unit, 변환유닛) 크기일 수 있다. 현재블록에 대해 K×Q 블록이 SearchRange_W 및 SearchRange_H에 따라 한정되는 탐색 영역들에 포함되지 않는 경우, 영상 부호화 장치는 해당되는 블록의 기저장된 그래디언트 크기를 버릴 수 있다. 영상 부호화 장치는 SearchRange_W 및 SearchRange_H에 따른 탐색 영역들 내에 저장된 K×Q 블록 단위의 그래디언트 크기를 임계치과 비교한 후, 그래디언트 크기가 임계치보다 큰 블록에 대해서만 템플릿 매칭을 수행할 수 있다. 그래디언트 크기가 임계치 이하인 영역은 탐색하지 않음으로써, 템플릿 매칭의 수행 복잡도가 감소될 수 있다. 여기서, K×Q 블록 단위의 그래디언트 크기는 K×Q 블록 내 픽셀들의 그래디언트 크기의 합을 나타낸다. The video encoding apparatus calculates and stores the gradient size for each K×Q block while performing encoding according to the encoding order. Here, the size of the K×Q block may be a CTU, CU, PU (Prediction Unit) or TU (Transform Unit) size. When the K×Q block for the current block is not included in search areas limited according to SearchRange_W and SearchRange_H, the video encoding apparatus may discard the pre-stored gradient size of the corresponding block. The image encoding apparatus may perform template matching only for blocks having a gradient size greater than the threshold after comparing gradient sizes in units of K×Q blocks stored in search areas according to SearchRange_W and SearchRange_H with a threshold. The complexity of performing template matching may be reduced by not searching for a region where the gradient size is less than or equal to the threshold value. Here, the gradient size in units of K×Q blocks represents the sum of gradient sizes of pixels in the K×Q block.

도 16의 예시에서, K 및 Q는 1 이상의 정수이다. 또한, 전술한 바와 같이, 템플릿 및 탐색 영역들에서 미분 필터 및 그래디언트 크기를 산정하는 방법은 동일하게 적용된다.In the example of FIG. 16 , K and Q are integers greater than or equal to 1. Also, as described above, the method of calculating the differential filter and the gradient size in the template and search areas is equally applied.

영상 부호화 장치는, 템플릿의 그래디언트 크기를 산정한 후, SearchRange_W 및 SearchRange_H 내에 기저장된 K×Q 블록 단위의 그래디언트 크기를 이용하여 그래디언트 기반 템플릿 매칭을 수행한다. 템플릿 매칭을 위한 비용함수로는, SAD(Sum of Absolute Difference), SSD(Sum of Squared Difference) 등이 사용될 수 있다. 비용함수는 영상 부호화 장치와 영상 복호화 장치 간 약속에 따라 사전에 설정될 수 있다. After calculating the gradient size of the template, the video encoding apparatus performs gradient-based template matching using K×Q block-based gradient sizes pre-stored in SearchRange_W and SearchRange_H. As a cost function for template matching, SAD (Sum of Absolute Difference), SSD (Sum of Squared Difference), and the like may be used. The cost function may be set in advance according to an agreement between the video encoding apparatus and the video decoding apparatus.

도 16에 예시된 바와 같은 K×Q 블록마다 그래디언트 크기를 산정하는 방법은, 영상 복호화 장치에도 동일하게 적용될 수 있다.The method of calculating the gradient size for each K×Q block as illustrated in FIG. 16 may be equally applied to the video decoding apparatus.

이하, 인트라 예측모드 유도 및 정렬 단계를 기술한다. Hereinafter, intra prediction mode derivation and alignment steps are described.

영상 부호화 장치는 그래디언트 기반 템플릿 매칭 단계에서 찾은 유사 템플릿, 및 유사 템플릿에 인접된 대응블록(corresponding block)으로부터 인트라 예측모드들을 유도하기 위해, HoG(Histogram of oriented Gradients)를 이용할 수 있다. HoG는, 도 17에 예시된 바와 같이, W×H 크기의 대응블록, 또는 유사 템플릿과 대응블록을 포함하는 (W+TW)×(H+TH) 크기의 블록에 적용될 수 있다. 이하, 편의상 W×H 블록 또는 (W+TW)×(H+TH) 블록을 통칭하여 대응블록으로 표현한다. The video encoding apparatus may use Histogram of Oriented Gradients (HoG) to derive intra prediction modes from similar templates found in the gradient-based template matching step and corresponding blocks adjacent to the similar templates. As illustrated in FIG. 17 , HoG may be applied to a W×H size corresponding block or a (W+TW)×(H+TH) size block including a similar template and a corresponding block. Hereinafter, for convenience, a W×H block or a (W+TW)×(H+TH) block is collectively referred to as a corresponding block.

대응블록에 대해 HoG를 사용하여 그래디언트의 방향성과 그래디언트의 크기를 산정하여 히스토그램이 구성될 수 있다. 대응블록의 각 픽셀들에 대해 그래디언트의 방향성과 그래디언트의 크기를 산정하기 위해, 미분 필터, 예컨대 소벨 필터가 적용될 수 있다. A histogram can be constructed by calculating the gradient direction and the magnitude of the gradient using HoG for the corresponding block. A differential filter, for example, a Sobel filter, may be applied to calculate the direction of the gradient and the magnitude of the gradient for each pixel of the corresponding block.

또한, 히스토그램은 다음과 같이 산정될 수 있다. 수직 방향 및 수평 방향에 대해 소벨 필터를 이용하여 대응블록의 각 픽셀에 대해 그래디언트 값 dx 및 dy를 산정한다. 각 픽셀에 대해 그래디언트의 크기는 dx 및 dy를 이용하여 수학식 1 또는 2에 따라 산정될 수 있다. 또한, 각 픽셀에 대해 방향성을 나타내는 angle_value는, 수학식 3에 따라 dx 및 dy를 이용하여 기울기(dy/dx)를 산정한 후, 시프트 연산을 적용하여 산정될 수 있다.Also, the histogram can be calculated as follows. Gradient values dx and dy are calculated for each pixel of the corresponding block using a Sobel filter in the vertical and horizontal directions. The size of the gradient for each pixel may be calculated according to Equation 1 or 2 using dx and dy. In addition, angle_value representing the directionality of each pixel may be calculated by calculating the gradient (dy/dx) using dx and dy according to Equation 3 and then applying a shift operation.

Figure pat00003
Figure pat00003

인트라 예측모드, 즉 인트라 예측모드의 인덱스 intra_mode_index를 생성할 수 있도록 사전에 방향성테이블 angleTable이 정의될 수 있다. 이때, 방향성테이블의 인덱스 i가 인트라 예측모드의 인덱스를 나타낼 수 있다. 수학식 4에 나타낸 바와 같이, angleTable[i]와 angle_value 간 SAD 값이 가장 작아지도록 각 픽셀의 인트라 예측모드의 인덱스가 산정될 수 있다. A direction table angleTable may be defined in advance to generate an intra prediction mode, that is, intra_mode_index, an index of the intra prediction mode. In this case, index i of the direction table may indicate an index of an intra prediction mode. As shown in Equation 4, the index of the intra prediction mode of each pixel may be calculated so that the SAD value between angleTable[i] and angle_value is the smallest.

Figure pat00004
Figure pat00004

일 예로서, 각 픽셀의 인트라 예측모드 인덱스에 따른 그래디언트 크기의 히스토그램을 생성한 후, 누적 그래디언트의 크기에 따라 내림차순으로 예측모드의 인덱스들(즉, 인트라 예측모드들)이 정렬될 수 있다. As an example, after generating a histogram of gradient sizes according to intra prediction mode indices of each pixel, prediction mode indices (ie, intra prediction modes) may be sorted in descending order according to cumulative gradient sizes.

다른 예로서, 인트라 예측모드의 발생 빈도의 히스토그램을 생성한 후, 발생 빈도수에 따라 내림차순으로 예측모드의 인덱스들(즉, 인트라 예측모드들)이 정렬될 수 있다. As another example, after generating a histogram of occurrence frequencies of intra prediction modes, indexes of prediction modes (ie, intra prediction modes) may be sorted in descending order according to the frequency of occurrence.

전술한 바와 같은 HoG를 생성하는 방법은 영상 부호화 장치와 영상 복호화 장치 간 약속에 따라 사전에 설정될 수 있다. The method for generating HoG as described above may be set in advance according to an agreement between the video encoding device and the video decoding device.

도 18은 현재블록이 분할된 서브블록들을 나타내는 예시도이다. 18 is an exemplary diagram illustrating subblocks from which a current block is divided.

ISP(Intra Sub-Partitions) 기술이 사용되는 경우, 도 18에 예시된 바와 같이 현재블록 크기에 따라 수직 또는 수평 방향으로 분할될 수 있다. 영상 부호화 장치는 서브블록 단위의 예측블록에 대해 HoG를 생성하고, 예컨대, 누적 그래디언트의 크기에 따라 내림차순으로 예측모드들을 정렬할 수 있다. When ISP (Intra Sub-Partitions) technology is used, as illustrated in FIG. 18, it may be vertically or horizontally partitioned according to the size of the current block. The video encoding apparatus may generate HoG for a prediction block in units of subblocks, and may arrange the prediction modes in descending order according to the magnitude of the cumulative gradient, for example.

이하, 이차적인 MPM 리스트 구성 단계를 기술한다. The secondary MPM list construction step is described below.

영상 부호화 장치는, 내림차순으로 정렬된 예측모드의 인덱스들을 이차적인 MPM 리스트를 구성할 수 있다. MPM flag가 0인 경우 이차적인 MPM 리스트가 구성되므로, 중복을 방지하기 위해 주 MPM 리스트에 포함된 예측모드들을 제거한 채로, 이차적인 MPM 리스트가 구성될 수 있다. 도 19의 예시에서, 인트라 예측모드 인덱스 a, b, c, d, e, …는 내림차순으로 정렬된 인트라 예측모드의 인덱스들로서 이차적인 MPM 리스트의 후보들이 될 수 있다. 인트라 예측모드 인덱스 c 및 f가 주 MPM 리스트에 포함된 예측모드들인 경우, 도 19의 예시와 같이, 후보들에서 제거될 수 있다. The video encoding apparatus may configure a secondary MPM list with indexes of prediction modes arranged in descending order. If the MPM flag is 0, since a secondary MPM list is constructed, a secondary MPM list may be constructed while removing prediction modes included in the main MPM list to prevent duplication. In the example of FIG. 19, intra prediction mode indices a, b, c, d, e, ... are indexes of intra prediction modes sorted in descending order, and may be candidates of a secondary MPM list. When the intra prediction mode indices c and f are prediction modes included in the main MPM list, they can be removed from the candidates as shown in the example of FIG. 19 .

이차적인 MPM 리스트는 기정의된 크기를 갖는다. 이차적인 MPM 리스트의 크기는 영상 부호화 장치와 영상 복호화 장치 간 약속에 따라 사전에 설정될 수 있다. The secondary MPM list has a predefined size. The size of the secondary MPM list may be set in advance according to an agreement between the video encoding device and the video decoding device.

기정의된 크기의 이차적인 MPM 리스트에 대해 내림차순으로 정렬된 예측모드들만으로 MPM 리스트의 후보들이 채워지지 못할 수 있다. 이러한 경우, 이차적인 MPM 리스트에 저장된 후보들의 인접 인덱스들을 이용하여 이차적인 MPM 리스트의 나머지 후보들이 채워질 수 있다. 예를 들어, 이차적인 MPM 리스트의 크기가 5이고 예측모드 a, b 및 e가 이차적인 MPM 리스트에 후보들로서 저장된 경우를 가정한다. 저장된 인덱스들에 대해 인접 인덱스들인 a-γ, a+γ, b-γ, b+γ, e-γ, e+γ 등을 이용하여 이차적인 MPM 리스트의 나머지 후보들이 채워질 수 있다. 이때, 내림차순 상 높은 순위의 인트라 예측모드에 대해 해당 인접 인덱스가 우선적으로 이용될 수 있다. 여기서, γ는 1 이상의 정수이다.Candidates of the MPM list may not be filled with only the prediction modes sorted in descending order for the secondary MPM list having a predefined size. In this case, the remaining candidates of the secondary MPM list may be filled using the adjacent indices of the candidates stored in the secondary MPM list. For example, it is assumed that the size of the secondary MPM list is 5 and prediction modes a, b, and e are stored as candidates in the secondary MPM list. The remaining candidates of the secondary MPM list may be filled using adjacent indices a-γ, a+γ, b-γ, b+γ, e-γ, e+γ, etc. for the stored indices. In this case, a corresponding neighbor index may be preferentially used for an intra prediction mode having a higher rank in descending order. Here, γ is an integer greater than or equal to 1.

일 예로서, 기정의된 크기의 이차적인 MPM 리스트에 대해 내림차순으로 정렬된 예측모드들만으로 MPM 리스트의 후보들이 채워지지 못하는 경우, 이차적인 MPM 리스트가 이용되지 않을 수 있다. 이차적인 MPM 리스트가 이용되지 않는 경우, 영상 부호화 장치는 secondary_mpm_flag을 0으로 설정하고 MPM 리메인더를 결정한다. 이후, 영상 부호화 장치는 secondary_mpm_flag 및 MPM 리메인더를 영상 복호화 장치로 시그널링한다. 영상 복호화 장치는 secondary_mpm_flag 및 MPM 리메인더를 복호화한 후, secondary_mpm_flag가 거짓이므로 MPM 리메인더에 따라 인트라 예측모드를 유도할 수 있다. As an example, when candidates of the MPM list are not filled with only prediction modes sorted in descending order for the secondary MPM list having a predefined size, the secondary MPM list may not be used. If the secondary MPM list is not used, the video encoding device sets secondary_mpm_flag to 0 and determines the MPM reminder. Then, the video encoding device signals the secondary_mpm_flag and the MPM reminder to the video decoding device. After decoding the secondary_mpm_flag and the MPM reminder, the video decoding apparatus may induce the intra prediction mode according to the MPM reminder because the secondary_mpm_flag is false.

도 20은 본 개시의 일 실시예에 따른, 서브블록 단위의 템플릿 매칭을 나타내는 예시도이다. 20 is an exemplary diagram illustrating template matching in units of subblocks according to an embodiment of the present disclosure.

전술한 바와 같이 현재블록이 서브블록들로 분할된 경우, 영상 부호화 장치는 서브블록 단위로 템플릿 매칭을 수행할 수 있다. 도 20의 예시와 같이, 각 서브블록에 대해 템플릿이 정의될 수 있다. As described above, when the current block is divided into subblocks, the video encoding apparatus may perform template matching in units of subblocks. As in the example of FIG. 20 , a template may be defined for each subblock.

영상 부호화 장치는 서브블록 단위로 그래디언트 기반 템플릿 매칭 단계, 인트라 예측모드 유도 및 정렬 단계, 및 이차적인 MPM 리스트 구성 단계를 수행할 수 있다. 제1 서브블록에 대해 그래디언트 기반 템플릿 매칭 단계, 인트라 예측모드 유도 및 정렬 단계, 및 이차적인 MPM 리스트 구성 단계가 수행된다. 이후, 예측, 변환, 양자화, 역양자화 및 역변환을 거쳐 제1 서브블록이 복원될 수 있다. 복원된 제1 서브블록의 일부는 제2 서브블록의 새로운 템플릿으로 구성될 수 있다. 이후, 제2 서브블록에 대해 그래디언트 기반 템플릿 매칭 단계, 인트라 예측모드 유도 및 정렬 단계, 및 이차적인 MPM 리스트 구성 단계가 수행될 수 있다. The video encoding apparatus may perform a gradient-based template matching step, an intra prediction mode derivation and alignment step, and a secondary MPM list constructing step on a sub-block basis. For the first subblock, a gradient-based template matching step, an intra prediction mode derivation and sorting step, and a secondary MPM list construction step are performed. Thereafter, the first subblock may be reconstructed through prediction, transformation, quantization, inverse quantization, and inverse transformation. A part of the reconstructed first subblock may be configured as a new template of the second subblock. Thereafter, a gradient-based template matching step, an intra prediction mode derivation and sorting step, and a secondary MPM list constructing step may be performed on the second subblock.

본 명세서의 흐름도/타이밍도에서는 각 과정들을 순차적으로 실행하는 것으로 기재하고 있으나, 이는 본 개시의 일 실시예의 기술 사상을 예시적으로 설명한 것에 불과한 것이다. 다시 말해, 본 개시의 일 실시예가 속하는 기술 분야에서 통상의 지식을 가진 자라면 본 개시의 일 실시예의 본질적인 특성에서 벗어나지 않는 범위에서 흐름도/타이밍도에 기재된 순서를 변경하여 실행하거나 각 과정들 중 하나 이상의 과정을 병렬적으로 실행하는 것으로 다양하게 수정 및 변형하여 적용 가능할 것이므로, 흐름도/타이밍도는 시계열적인 순서로 한정되는 것은 아니다.In the flow chart/timing diagram of the present specification, it is described that each process is sequentially executed, but this is merely an example of the technical idea of one embodiment of the present disclosure. In other words, those skilled in the art to which an embodiment of the present disclosure belongs may change and execute the order described in the flowchart/timing diagram within the range that does not deviate from the essential characteristics of the embodiment of the present disclosure, or one of each process Since the above process can be applied by performing various modifications and variations in parallel, the flow chart/timing chart is not limited to a time-series sequence.

이상의 설명에서 예시적인 실시예들은 많은 다른 방식으로 구현될 수 있다는 것을 이해해야 한다. 하나 이상의 예시들에서 설명된 기능들 혹은 방법들은 하드웨어, 소프트웨어, 펌웨어 또는 이들의 임의의 조합으로 구현될 수 있다. 본 명세서에서 설명된 기능적 컴포넌트들은 그들의 구현 독립성을 특히 더 강조하기 위해 "...부(unit)" 로 라벨링되었음을 이해해야 한다. In the above description, it should be understood that the exemplary embodiments may be implemented in many different ways. Functions or methods described in one or more examples may be implemented in hardware, software, firmware, or any combination thereof. It should be understood that the functional components described in this specification have been labeled "...unit" to particularly emphasize their implementation independence.

한편, 본 실시예에서 설명된 다양한 기능들 혹은 방법들은 하나 이상의 프로세서에 의해 판독되고 실행될 수 있는 비일시적 기록매체에 저장된 명령어들로 구현될 수도 있다. 비일시적 기록매체는, 예를 들어, 컴퓨터 시스템에 의하여 판독가능한 형태로 데이터가 저장되는 모든 종류의 기록장치를 포함한다. 예를 들어, 비일시적 기록매체는 EPROM(erasable programmable read only memory), 플래시 드라이브, 광학 드라이브, 자기 하드 드라이브, 솔리드 스테이트 드라이브(SSD)와 같은 저장매체를 포함한다.Meanwhile, various functions or methods described in this embodiment may be implemented as instructions stored in a non-transitory recording medium that can be read and executed by one or more processors. Non-transitory recording media include, for example, all types of recording devices in which data is stored in a form readable by a computer system. For example, the non-transitory recording medium includes storage media such as an erasable programmable read only memory (EPROM), a flash drive, an optical drive, a magnetic hard drive, and a solid state drive (SSD).

이상의 설명은 본 실시예의 기술 사상을 예시적으로 설명한 것에 불과한 것으로서, 본 실시예가 속하는 기술 분야에서 통상의 지식을 가진 자라면 본 실시예의 본질적인 특성에서 벗어나지 않는 범위에서 다양한 수정 및 변형이 가능할 것이다. 따라서, 본 실시예들은 본 실시예의 기술 사상을 한정하기 위한 것이 아니라 설명하기 위한 것이고, 이러한 실시예에 의하여 본 실시예의 기술 사상의 범위가 한정되는 것은 아니다. 본 실시예의 보호 범위는 아래의 청구범위에 의하여 해석되어야 하며, 그와 동등한 범위 내에 있는 모든 기술 사상은 본 실시예의 권리범위에 포함되는 것으로 해석되어야 할 것이다.The above description is merely an example of the technical idea of the present embodiment, and various modifications and variations can be made to those skilled in the art 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 to explain, and the scope of the technical idea of the present embodiment is not limited by these embodiments. The scope of protection of this embodiment should be construed according to the claims below, and all technical ideas within the scope equivalent thereto should be construed as being included in the scope of rights of this embodiment.

122: 인트라 예측부
155: 엔트로피 부호화부
510: 엔트로피 복호화부
542: 인트라 예측부
122: intra prediction unit
155: entropy encoding unit
510: entropy decoding unit
542: intra prediction unit

Claims (16)

영상 복호화 장치가 수행하는, 현재블록을 복호화하는 방법에 있어서,
비트스트림으로부터 상기 현재블록의 잔차블록(residual block), 및 이차적인 MPM(Most Probable Mode) 플래그를 복호화하는 단계, 여기서, 상기 이차적인 MPM 플래그는 이차적인(secondary) MPM 리스트의 사용 여부를 지시함; 및
상기 이차적인 MPM 플래그를 확인하는 단계
를 포함하되,
상기 이차적인 MPM 플래그가 참인 경우,
상기 현재블록의 기정의된 탐색 영역에서 그래디언트 기반 템플릿 매칭(template matching)을 수행하여 유사 템플릿(similar template)을 탐색하는 단계;
상기 유사 템플릿의 대응블록을 이용하여 인트라 예측모드들을 유도하고 정렬하는 단계;
상기 정렬된 인트라 예측모드들을 이용하여 상기 현재블록에 대해 상기 이차적인 MPM 리스트를 구성하는 단계; 및
상기 비트스트림으로부터 이차적인 MPM 인덱스를 복호화하는 단계
를 포함하는 것을 특징으로 하는, 방법.
In the method of decoding a current block, performed by an image decoding apparatus,
Decoding a residual block of the current block and a secondary Most Probable Mode (MPM) flag from a bitstream, wherein the secondary MPM flag indicates whether to use a secondary MPM list ; and
Checking the secondary MPM flag
Including,
If the secondary MPM flag is true,
searching for a similar template by performing gradient-based template matching in a predefined search area of the current block;
inducing and arranging intra prediction modes using corresponding blocks of the similar template;
constructing the secondary MPM list for the current block using the sorted intra prediction modes; and
Decoding a secondary MPM index from the bitstream
Characterized in that, the method comprising a.
제1항에 있어서,
주(primary) MPM 리스트의 사용 여부를 지시하는 플래그가 거짓인 경우, 상기 이차적인 MPM 플래그를 복호화하는 단계가 수행되는 것을 특징으로 하는, 방법.
According to claim 1,
When a flag indicating whether to use a primary MPM list is false, the step of decoding the secondary MPM flag is performed.
제1항에 있어서,
유사 템플릿을 탐색하는 단계는,
상기 현재블록의 템플릿을 설정하는 단계;
상기 템플릿에 미분 필터(differential filter)를 적용하여 상기 템플릿의 그래디언트의 크기를 산정하는 단계;
상기 기정의된 탐색 영역에 대해, K×Q 블록 단위의 그래디언트 크기를 산정하는 단계, 여기서, K 및 Q는 1 이상의 정수임; 및
상기 템플릿의 그래디언트의 크기와 상기 K×Q 블록 단위의 그래디언트 크기를 이용하여 상기 그래디언트 기반 템플릿 매칭을 수행함으로써, 상기 유사 템플릿을 탐색하는 단계
를 포함하는 것을 특징으로 하는, 방법.
According to claim 1,
Steps to explore similar templates include:
setting a template of the current block;
Calculating the size of the gradient of the template by applying a differential filter to the template;
Calculating a gradient size in units of K×Q blocks for the predefined search area, where K and Q are integers greater than or equal to 1; and
Searching for the similar template by performing the gradient-based template matching using the gradient size of the template and the gradient size in units of K×Q blocks
Characterized in that, the method comprising a.
제3항에 있어서,
상기 유사 템플릿을 탐색하는 단계는,
상기 K×Q 블록 단위의 그래디언트 크기가 기설정된 임계치 이상인 경우, 상기 그래디언트 기반 템플릿 매칭을 수행하는 것을 특징으로 하는, 방법.
According to claim 3,
The step of searching for the similar template,
And performing the gradient-based template matching when the size of the gradient in units of K×Q blocks is greater than or equal to a predetermined threshold value.
제3항에 있어서,
상기 정렬하는 단계는,
상기 대응블록의 각 픽셀에 대해 그래디언트의 크기를 산정하는 단계
상기 대응블록의 각 픽셀에 대해 인트라 예측모드의 인덱스를 산정하는 단계; 및
각 픽셀의 인트라 예측모드에 따른 그래디언트 크기의 히스토그램을 생성한 후, 누적 그래디언트의 크기에 따라 내림차순으로 예측모드의 인덱스들을 정렬하는 단계
를 포함하는 것을 특징으로 하는, 방법.
According to claim 3,
The sorting step is
Calculating the size of the gradient for each pixel of the corresponding block
calculating an index of an intra prediction mode for each pixel of the corresponding block; and
After generating a histogram of the gradient size according to the intra prediction mode of each pixel, sorting the indexes of the prediction mode in descending order according to the cumulative gradient size
Characterized in that, the method comprising a.
제5항에 있어서,
상기 인트라 예측모드의 인덱스를 산정하는 단계는,
상기 대응블록의 각 픽셀에 대해 그래디언트 값을 산정하고, 상기 그래디언트 값을 이용하여 방향성을 산정한 후, 상기 방향성 및 기정의된 방향성테이블을 이용하여 상기 인트라 예측모드의 인덱스를 산정하는 것을 특징으로 하는, 방법.
According to claim 5,
In the step of calculating the index of the intra prediction mode,
Calculating a gradient value for each pixel of the corresponding block, calculating a directionality using the gradient value, and then calculating an index of the intra prediction mode using the directionality and a predefined directionality table , method.
제5항에 있어서,
상기 이차적인 MPM 리스트를 구성하는 단계는,
주 MPM 리스트에 포함된 예측모드들을 제거한 채로, 상기 정렬된 예측모드의 인덱스들을 이용하여 상기 이차적인 MPM 리스트를 구성하는 것을 특징으로 하는, 방법.
According to claim 5,
The step of constructing the secondary MPM list,
The secondary MPM list is constructed using indexes of the sorted prediction modes while removing prediction modes included in the main MPM list.
제7항에 있어서,
상기 이차적인 MPM 리스트를 구성하는 단계는,
기정의된 크기의 이차적인 MPM 리스트를 상기 정렬된 예측모드의 인덱스들만으로 채울 수 없는 경우, 상기 이차적인 MPM 리스트에 저장된 예측모드들의 인접 인덱스들을 이용하여 상기 이차적인 MPM 리스트의 나머지 부분을 채우는 것을 특징으로 하는, 방법.
According to claim 7,
The step of constructing the secondary MPM list,
When the secondary MPM list of a predefined size cannot be filled with only the indexes of the sorted prediction modes, the remainder of the secondary MPM list is filled using adjacent indices of prediction modes stored in the secondary MPM list. How to do it.
제1항에 있어서,
상기 이차적인 MPM 인덱스를 이용하여 상기 이차적인 MPM 리스트로부터 상기 현재블록의 인트라 예측모드를 유도하는 단계;
상기 인트라 예측모드를 이용하여 상기 현재블록의 예측블록을 생성하는 단계; 및
상기 예측블록과 상기 잔차블록을 가산하여 상기 현재블록을 복원하는 단계
를 더 포함하는 것을 특징으로 하는, 방법.
According to claim 1,
deriving an intra prediction mode of the current block from the secondary MPM list using the secondary MPM index;
generating a prediction block of the current block by using the intra prediction mode; and
restoring the current block by adding the prediction block and the residual block;
Characterized in that it further comprises, the method.
제1항에 있어서,
상기 이차적인 MPM 플래그가 거짓인 경우, MPM 리메인더(reminder)를 복호화하는 단계를 더 포함하되,
상기 MPM 리메인더는,
상기 이차적인 MPM 리스트 또는 주 MPM 리스트에 포함되지 않은 인트라 예측모드인 것을 특징으로 하는, 방법.
According to claim 1,
If the secondary MPM flag is false, further comprising decoding an MPM reminder,
The MPM reminder,
Characterized in that the intra prediction mode is not included in the secondary MPM list or the main MPM list.
영상 부호화 장치가 수행하는, 현재블록을 부호화하는 방법에 있어서,
상기 현재블록의 템플릿을 생성하고, 상기 템플릿의 그래디언트의 크기를 산정하는 단계;
상기 그래디언트의 크기를 기설정된 임계치와 비교하는 단계
를 포함하되,
상기 그래디언트의 크기가 기설정된 임계치보다 큰 경우,
상기 현재블록의 기정의된 탐색 영역에서 그래디언트 기반 템플릿 매칭(template matching)을 수행하여, 상기 템플릿에 대해 유사 템플릿(similar template)을 탐색하는 단계;
상기 유사 템플릿의 대응블록을 이용하여 인트라 예측모드들을 유도하고 정렬하는 단계;
상기 정렬된 인트라 예측모드들을 이용하여 상기 현재블록에 대해 이차적인(secondary) MPM(Most Probable Mode) 리스트를 구성하고, 이차적인 MPM 플래그를 설정하는 단계, 여기서, 상기 이차적인 MPM 플래그는 상기 이차적인 MPM 리스트의 사용 여부를 지시함; 및
이차적인 MPM 인덱스를 결정하는 단계
를 포함하는 것을 특징으로 하는, 방법.
In the method of encoding a current block, performed by an image encoding apparatus,
generating a template of the current block and calculating a gradient size of the template;
Comparing the magnitude of the gradient with a preset threshold
Including,
When the size of the gradient is greater than a predetermined threshold value,
searching for a similar template to the template by performing gradient-based template matching in a predefined search area of the current block;
inducing and arranging intra prediction modes using corresponding blocks of the similar template;
Constructing a secondary MPM (Most Probable Mode) list for the current block using the sorted intra prediction modes and setting a secondary MPM flag, wherein the secondary MPM flag is the secondary Indicates whether to use the MPM list; and
Determining Secondary MPM Index
Characterized in that, the method comprising a.
제11항에 있어서,
주(primary) MPM 리스트의 사용 여부를 지시하는 플래그가 거짓인 경우, 상기 유사 템플릿을 탐색하는 단계가 수행되는 것을 특징으로 하는, 방법.
According to claim 11,
When a flag indicating whether to use a primary MPM list is false, the step of searching for the similar template is performed.
제11항에 있어서,
상기 이차적인 MPM 인덱스를 이용하여 상기 이차적인 MPM 리스트로부터 상기 현재블록의 인트라 예측모드를 유도하는 단계;
상기 인트라 예측모드를 이용하여 상기 현재블록의 예측블록을 생성하는 단계; 및
상기 현재블록으로부터 상기 예측블록을 감산하여 잔차블록을 생성하는 단계
를 더 포함하는 것을 특징으로 하는, 방법.
According to claim 11,
deriving an intra prediction mode of the current block from the secondary MPM list using the secondary MPM index;
generating a prediction block of the current block by using the intra prediction mode; and
Generating a residual block by subtracting the prediction block from the current block
Characterized in that it further comprises, the method.
제13항에 있어서,
상기 이차적인 MPM 플래그, 상기 이차적인 MPM 인덱스, 및 상기 잔차블록을 부호화하는 단계를 더 포함하는 것을 특징으로 하는, 방법.
According to claim 13,
characterized in that it further comprises the step of encoding the secondary MPM flag, the secondary MPM index, and the residual block.
제11항에 있어서,
상기 그래디언트의 크기가 기설정된 임계치 이하인 경우, MPM 리메인더(reminder)를 결정하는 단계를 더 포함하되,
상기 MPM 리메인더는,
상기 이차적인 MPM 리스트 또는 주 MPM 리스트에 포함되지 않은 인트라 예측모드인 것을 특징으로 하는, 방법.
According to claim 11,
Further comprising determining an MPM reminder when the size of the gradient is less than or equal to a predetermined threshold,
The MPM reminder,
Characterized in that the intra prediction mode is not included in the secondary MPM list or the main MPM list.
영상 부호화 방법에 의해 생성된 비트스트림을 저장하는 컴퓨터 판독 가능한 기록매체로서, 상기 영상 부호화 방법은,
현재블록의 템플릿을 생성하고, 상기 템플릿의 그래디언트의 크기를 산정하는 단계;
상기 그래디언트의 크기를 기설정된 임계치와 비교하는 단계
를 포함하되,
상기 그래디언트의 크기가 기설정된 임계치보다 큰 경우,
상기 현재블록의 기정의된 탐색 영역에서 그래디언트 기반 템플릿 매칭(template matching)을 수행하여, 상기 템플릿에 대해 유사 템플릿(similar template)을 탐색하는 단계;
상기 유사 템플릿의 대응블록을 이용하여 인트라 예측모드들을 유도하고 정렬하는 단계;
상기 정렬된 인트라 예측모드들을 이용하여 상기 현재블록에 대해 이차적인(secondary) MPM(Most Probable Mode) 리스트를 구성하고, 이차적인 MPM 플래그를 설정하는 단계, 여기서, 상기 이차적인 MPM 플래그는 상기 이차적인 MPM 리스트의 사용 여부를 지시함; 및
이차적인 MPM 인덱스를 결정하는 단계
를 포함하는 것을 특징으로 하는, 기록매체.
A computer-readable recording medium storing a bitstream generated by an image encoding method, the image encoding method comprising:
generating a template of the current block and calculating a gradient size of the template;
Comparing the magnitude of the gradient with a preset threshold
Including,
When the size of the gradient is greater than a predetermined threshold value,
searching for a similar template to the template by performing gradient-based template matching in a predefined search area of the current block;
inducing and arranging intra prediction modes using corresponding blocks of the similar template;
Constructing a secondary MPM (Most Probable Mode) list for the current block using the sorted intra prediction modes and setting a secondary MPM flag, wherein the secondary MPM flag is the secondary Indicates whether to use the MPM list; and
Determining Secondary MPM Index
Characterized in that it comprises, a recording medium.
KR1020220130305A 2021-12-10 2022-10-12 Method And Apparatus for Video Coding Using Secondary MPM List Based on Template Matching KR20230088234A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/KR2022/015493 WO2023106603A1 (en) 2021-12-10 2022-10-13 Method and apparatus for video coding using secondary mpm list based on template matching

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
KR1020210176722 2021-12-10
KR20210176722 2021-12-10

Publications (1)

Publication Number Publication Date
KR20230088234A true KR20230088234A (en) 2023-06-19

Family

ID=86988586

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020220130305A KR20230088234A (en) 2021-12-10 2022-10-12 Method And Apparatus for Video Coding Using Secondary MPM List Based on Template Matching

Country Status (1)

Country Link
KR (1) KR20230088234A (en)

Similar Documents

Publication Publication Date Title
KR20220077095A (en) Video Coding Method and Apparatus Using Intra Prediction
KR20230105646A (en) Method for Template-based Intra Mode Derivation for Chroma Component
KR20220071939A (en) Method and Apparatus For Video Encoding and Decoding
KR20220071131A (en) Video Encoding and Decoding Method and Apparatus Using Subblock Based Intra Prediction
KR20220017380A (en) Arbitrary Block Split Based Video Encoding and Decoding
KR20230088234A (en) Method And Apparatus for Video Coding Using Secondary MPM List Based on Template Matching
KR20230068286A (en) Method And Apparatus for Video Coding Using Implicit Arbitrary Block Partitioning And Prediction According Thereto
KR20240037834A (en) Method and Apparatus for Video Coding Using Single Tree and Dual Tree Adaptively in Single Block
KR20230105648A (en) Method for Decoder Side Motion Vector Derivation Using Spatial Correlation
KR20230073970A (en) Method And Apparatus for Video Coding Using Template Matching Based Intra Prediction
KR20240047298A (en) Method and Apparatus for Video Coding Using Intra Template Matching Prediction Based on Multiple Blocks
KR20230036967A (en) Video Coding Method And Apparatus Using Subblcok Coding Order Change And Intra Prediction According Thereto
KR20220131178A (en) Video Coding Method and Apparatus Using Motion Vector with Component-wise Adaptive Spatial Resolution
KR20230005763A (en) Method and apparatus for video encoding and decoding
KR20230106103A (en) Method and Apparatus for Video Coding Using Improved AMVP--MERGE Mode
KR20230059136A (en) Method And Apparatus for Video Coding Using Geometric Intra Prediction Mode
KR20220118351A (en) Method for generating prediction block using weighted sum of intra prediction signal and inter prediction signal and apparatus using the same
KR20230085063A (en) Method And Apparatus for Video Coding Using Intra Prediction Based on Derivation of Reference Sample Line
KR20220126226A (en) Video Coding Method and Apparatus Using Spiral Scan Order
KR20230059135A (en) Video Coding Method And Apparatus Using Various Block Partitioning Structure
KR20230026944A (en) Video Coding Method And Apparatus Using Improved Inloop Filter
KR20230157861A (en) Method and Apparatus for Video Coding Using Inter/Intra Prediction Based on Geometric Partition
KR20230049568A (en) Method and apparatus for video encoding and decoding applying merge mode using geometric partitioning mode
KR20220071130A (en) Video Encoding and Decoding Method and Apparatus Using Selective Subblock Spilt Information Signaling
KR20220017372A (en) Method for Predicting Quantization Parameter Used in Image Encoding/Decoding Device