KR20240049203A - Method, apparatus and recording medium for encoding/decoding image - Google Patents

Method, apparatus and recording medium for encoding/decoding image Download PDF

Info

Publication number
KR20240049203A
KR20240049203A KR1020230133679A KR20230133679A KR20240049203A KR 20240049203 A KR20240049203 A KR 20240049203A KR 1020230133679 A KR1020230133679 A KR 1020230133679A KR 20230133679 A KR20230133679 A KR 20230133679A KR 20240049203 A KR20240049203 A KR 20240049203A
Authority
KR
South Korea
Prior art keywords
block
information
prediction
template
mode
Prior art date
Application number
KR1020230133679A
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/KR2023/015465 priority Critical patent/WO2024076220A1/en
Publication of KR20240049203A publication Critical patent/KR20240049203A/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/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/57Motion estimation characterised by a search window with variable size or shape
    • 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/105Selection of the reference unit for prediction within a chosen coding or prediction mode, e.g. adaptive choice of position and number of pixels used for prediction
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

영상 부호화/복호화를 위한 방법, 장치 및 기록 매체가 개시된다. 영상 부호화/복호화를 위한 방법은 대상 블록에 대한 템플릿을 결정하는 단계, 템플릿 매칭 참조 영상을 선택하는 단계, 템플릿을 사용하여 템플릿 매칭 참조 영상 내에서 템플릿 매칭 최적 블록을 탐색하는 단계 및 탬플릿 매칭 최적 블록을 사용하는 부호화/복호화를 수행하는 단계를 포함한다. 템플릿 매칭 최적 블록을 사용하여 대상 블록에 대한 예측이 수행될 수 있다. 기록 매체는 영상 복호화 방법을 위한 컴퓨터 실행 가능한 코드를 저장할 수 있고, 영상 부호화 방법에 의해 생성된 정보를 저장할 수 있다.A method, device, and recording medium for video encoding/decoding are disclosed. The method for video encoding/decoding includes the following steps: determining a template for a target block, selecting a template matching reference image, using a template to search for a template matching optimal block within the template matching reference image, and template matching optimal block. It includes the step of performing encoding/decoding using. Prediction for the target block may be performed using the template matching optimal block. The recording medium may store computer-executable code for an image decoding method and may store information generated by the image encoding method.

Description

영상 부호화/복호화를 위한 방법, 장치 및 기록 매체{METHOD, APPARATUS AND RECORDING MEDIUM FOR ENCODING/DECODING IMAGE}Method, device and recording medium for image encoding/decoding {METHOD, APPARATUS AND RECORDING MEDIUM FOR ENCODING/DECODING IMAGE}

본 발명은 영상 부호화/복호화를 위한 방법, 장치 및 기록 매체에 관한 것이다. 구체적으로, 본 발명은 예측을 사용하는 영상 부호화/복호화를 위한 방법, 장치 및 기록 매체를 개시한다.The present invention relates to a method, device, and recording medium for video encoding/decoding. Specifically, the present invention discloses a method, apparatus, and recording medium for video encoding/decoding using prediction.

정보 통신 산업의 지속적인 발달을 통해 HD(High Definition) 해상도를 가지는 방송 서비스가 세계적으로 확산되었다. 이러한 확산을 통해, 많은 사용자들이 고해상도이며 고화질인 영상(image) 및/또는 비디오(video)에 익숙해지게 되었다.Through the continued development of the information and communications industry, broadcasting services with HD (High Definition) resolution have spread globally. Through this proliferation, many users have become accustomed to high-resolution, high-definition images and/or videos.

높은 화질에 대한 사용자들의 수요를 만족시키기 위하여, 많은 기관들이 차세대 영상 기기에 대한 개발에 박차를 가하고 있다. 에이치디티브이(High Definition TV; HDTV) 및 풀에이치디(Full HD; FHD) TV뿐만 아니라, FHD TV에 비해 4배 이상의 해상도를 갖는 울트라에이치디(Ultra High Definition; UHD) TV에 대한 사용자들의 관심이 증대하였고, 이러한 관심의 증대에 따라, 더 높은 해상도 및 화질을 갖는 영상에 대한 영상 부호화(encoding)/복호화(decoding) 기술이 요구된다.In order to satisfy users' demand for high image quality, many organizations are accelerating the development of next-generation imaging devices. User interest in not only High Definition TV (HDTV) and Full HD (FHD) TV, but also Ultra High Definition (UHD) TV, which has a resolution more than four times that of FHD TV. has increased, and with this increase in interest, image encoding/decoding technology for images with higher resolution and image quality is required.

영상 압축 기술로서, 인터 예측 기술, 인트라 예측 기술, 변환 및 양자화 기술 및 엔트로피 부호화 기술 등 다양한 기술이 존재한다.As video compression technology, there are various technologies such as inter prediction technology, intra prediction technology, transformation and quantization technology, and entropy coding technology.

인터 예측 기술은 현재 픽처의 이전 픽처 및/또는 이후 픽처를 사용하여 현재 픽처에 포함되는 픽셀의 값을 예측하는 기술이다. 인트라 예측 기술은 현재 픽처 내의 픽셀에 대한 정보를 사용하여 현재 픽처에 포함되는 픽셀의 값을 예측하는 기술이다. 변환 및 양자화 기술은 잔차 영상의 에너지를 압축하기 위한 기술이다. 엔트로피 부호화 기술은 높은 출현 빈도가 높은 값에 짧은 부호를 할당하고, 출현 빈도가 낮은 값에 긴 부호를 할당하는 기술이다.Inter prediction technology is a technology that predicts the value of a pixel included in the current picture using pictures before and/or after the current picture. Intra prediction technology is a technology that predicts the value of a pixel included in the current picture using information about the pixel in the current picture. Transformation and quantization technology is a technology for compressing the energy of the residual image. Entropy coding technology is a technology that assigns short codes to values with a high frequency of occurrence and long codes to values with a low frequency of occurrence.

이러한 영상 압축 기술을 사용하여 영상에 대한 데이터가 효과적으로 압축, 전송 및 저장될 수 있다.Using this video compression technology, video data can be effectively compressed, transmitted, and stored.

일 실시예는 템플릿 매칭을 사용하여 영상에 대한 부호화/복호화를 수행하는 장치, 방법 및 기록 매체를 제공할 수 있다.One embodiment may provide an apparatus, method, and recording medium for encoding/decoding an image using template matching.

일 실시예는 예측을 사용하여 영상에 대한 부호화/복호화를 수행하는 장치, 방법 및 기록 매체를 제공할 수 있다.One embodiment may provide an apparatus, method, and recording medium for encoding/decoding an image using prediction.

일 측에 있어서, 대상 블록에 대한 템플릿을 결정하는 단계; 템플릿 매칭 참조 영상을 선택하는 단계; 상기 템플릿을 사용하여 상기 템플릿 매칭 참조 영상 내에서 템플릿 매칭 최적 블록을 탐색하는 단계; 및 상기 탬플릿 매칭 최적 블록을 사용하는 복호화를 수행하는 단계를 포함하는 영상 복호화 방법이 제공된다.On one side, determining a template for a target block; selecting a template matching reference image; Searching for an optimal template matching block within the template matching reference image using the template; and performing decoding using the template matching optimal block.

상기 템플릿을 생성함에 있어서 서브샘플링이 사용될 수 있다.Subsampling may be used in generating the template.

복수의 템플릿 매칭 참조 영상 구성 방법들 중 복수의 템플릿 매칭 참조 영상 구성 방법이 상기 템플릿 매칭 참조 영상의 선택을 위해 선택될 수 있다.Among the plurality of template matching reference image construction methods, a plurality of template matching reference image construction methods may be selected to select the template matching reference image.

서로 다른 형태를 갖는 탐색 영역들 중 하나의 탐색 영역이 상기 탬플릿 매칭 최적 블록을 도출하기 위한 탐색 영역으로서 선택될 수 있다.One search area among search areas having different shapes may be selected as a search area for deriving the optimal template matching block.

상기 탬플릿 매칭 최적 블록을 도출하기 위한 탐색 영역의 템플릿 매칭 탐색 시작 점이 설정될 수 있다.A template matching search starting point in the search area for deriving the optimal template matching block may be set.

상기 복호화에 대하여 템플릿 매칭 기반 인트라 잔차 신호 예측이 수행될 수 있다.Template matching-based intra residual signal prediction may be performed for the decoding.

상기 복호화에 대하여 인터 및 템플릿 매칭의 블랜딩 예측이 사용될 수 있다.For the decoding, blending prediction of inter and template matching can be used.

다른 일 측에 있어서, 대상 블록에 대한 템플릿을 결정하는 단계; 템플릿 매칭 참조 영상을 선택하는 단계; 상기 템플릿을 사용하여 상기 템플릿 매칭 참조 영상 내에서 템플릿 매칭 최적 블록을 탐색하는 단계; 및 상기 탬플릿 매칭 최적 블록을 사용하는 부호화를 수행하는 단계를 포함하는 영상 부호화 방법이 제공된다.On the other hand, determining a template for a target block; selecting a template matching reference image; Searching for an optimal template matching block within the template matching reference image using the template; and performing encoding using the template matching optimal block.

상기 템플릿을 생성함에 있어서 서브샘플링이 사용될 수 있다.Subsampling may be used in generating the template.

복수의 템플릿 매칭 참조 영상 구성 방법들 중 복수의 템플릿 매칭 참조 영상 구성 방법이 상기 템플릿 매칭 참조 영상의 선택을 위해 선택될 수 있다.Among the plurality of template matching reference image construction methods, a plurality of template matching reference image construction methods may be selected to select the template matching reference image.

서로 다른 형태를 갖는 탐색 영역들 중 하나의 탐색 영역이 상기 탬플릿 매칭 최적 블록을 도출하기 위한 탐색 영역으로서 선택될 수 있다.One search area among search areas having different shapes may be selected as a search area for deriving the optimal template matching block.

상기 탬플릿 매칭 최적 블록을 도출하기 위한 탐색 영역의 템플릿 매칭 탐색 시작 점이 설정될 수 있다.A template matching search starting point in the search area for deriving the optimal template matching block may be set.

상기 부호화에 대하여 템플릿 매칭 기반 인트라 잔차 신호 예측이 수행될 수 있다.Template matching-based intra residual signal prediction may be performed for the encoding.

상기 부호화에 대하여 인터 및 템플릿 매칭의 블랜딩 예측이 사용될 수 있다.For the above encoding, blending prediction of inter and template matching can be used.

상기 영상 부호화 방법에 의해 생성된 비트스트림을 저장하는 컴퓨터 판독 가능한 기록 매체가 제공될 수 있다.A computer-readable recording medium that stores a bitstream generated by the video encoding method may be provided.

또 다른 일 측에 있어서, 영상 복호화를 위한 비트스트림을 저장하는 컴퓨터 판독 가능한 기록 매체에 있어서, 상기 비트스트림은, 코딩 정보를 포함하고, 대상 블록에 대한 템플릿이 결정되고, 템플릿 매칭 참조 영상이 선택되고, 상기 템플릿을 사용하여 상기 템플릿 매칭 참조 영상 내에서 템플릿 매칭 최적 블록을 탐색되고, 상기 탬플릿 매칭 최적 블록을 사용하는 복호화가 수행되고, 상기 코딩 정보는 상기 템플릿의 결정, 상기 참조 영상의 선택, 상기 템플릿 매칭 최적 블록의 도출 및 상기 복호화 중 적어도 하나에 대하여 사용되는 컴퓨터 판독 가능한 기록 매체가 제공될 수 있다.On another side, in a computer-readable recording medium storing a bitstream for image decoding, the bitstream includes coding information, a template for a target block is determined, and a template matching reference image is selected. A template matching optimal block is searched within the template matching reference image using the template, decoding is performed using the template matching optimal block, and the coding information is used to determine the template, select the reference image, A computer-readable recording medium used for at least one of deriving the template matching optimal block and decoding may be provided.

상기 템플릿을 생성함에 있어서 서브샘플링이 사용될 수 있다.Subsampling may be used in generating the template.

복수의 템플릿 매칭 참조 영상 구성 방법들 중 복수의 템플릿 매칭 참조 영상 구성 방법이 상기 템플릿 매칭 참조 영상의 선택을 위해 선택될 수 있다.Among the plurality of template matching reference image construction methods, a plurality of template matching reference image construction methods may be selected to select the template matching reference image.

서로 다른 형태를 갖는 탐색 영역들 중 하나의 탐색 영역이 상기 탬플릿 매칭 최적 블록을 도출하기 위한 탐색 영역으로서 선택될 수 있다.One search area among search areas having different shapes may be selected as a search area for deriving the optimal template matching block.

상기 탬플릿 매칭 최적 블록을 도출하기 위한 탐색 영역의 템플릿 매칭 탐색 시작 점이 설정될 수 있다.A template matching search starting point in the search area for deriving the optimal template matching block may be set.

템플릿 매칭을 사용하여 영상에 대한 부호화/복호화를 수행하는 장치, 방법 및 기록 매체가 제공된다.An apparatus, method, and recording medium for encoding/decoding an image using template matching are provided.

예측을 사용하여 영상에 대한 부호화/복호화를 수행하는 장치, 방법 및 기록 매체가 제공된다.An apparatus, method, and recording medium for encoding/decoding an image using prediction are provided.

도 1은 본 발명이 적용되는 부호화 장치의 일 실시예에 따른 구성을 나타내는 블록도이다.
도 2는 본 발명이 적용되는 복호화 장치의 일 실시예에 따른 구성을 나타내는 블록도이다.
도 3은 영상을 부호화 및 복호화할 때의 영상의 분할 구조를 개략적으로 나타내는 도면이다.
도 4는 코딩 유닛이 포함할 수 있는 예측 유닛의 형태를 도시한 도면이다.
도 5는 코딩 유닛에 포함될 수 있는 변환 유닛의 형태를 도시한 도면이다.
도 6은 일 예에 따른 블록의 분할을 나타낸다.
도 7은 인트라 예측 과정의 실시예를 설명하기 위한 도면이다.
도 8은 인트라 예측 과정에서 사용되는 참조 샘플을 설명하기 위한 도면이다.
도 9는 인터 예측 과정의 실시예를 설명하기 위한 도면이다.
도 10은 일 예에 따른 공간적 후보들을 나타낸다.
도 11은 일 예에 따른 공간적 후보들의 움직임 정보들의 머지 리스트로의 추가 순서를 나타낸다.
도 12은 일 예에 따른 변환 및 양자화의 과정을 설명한다.
도 13은 일 예에 따른 대각선 스캐닝을 나타낸다.
도 14는 일 예에 따른 수평 스캐닝을 나타낸다.
도 15는 일 예에 따른 수직 스캐닝을 나타낸다.
도 16은 일 실시예에 따른 부호화 장치의 구조도이다.
도 17은 일 실시예에 따른 복호화 장치의 구조도이다.
도 18은 일 실시예에 따른 대상 블록의 예측 방법 및 비트스트림 생성 방법의 흐름도이다.
도 19는 일 실시예에 따른 비트스트림을 사용하는 대상 블록의 예측 방법의 흐름도이다.
도 20은 일 예에 따른 예측 방법의 흐름도이다.
도 21은 일 예에 따른 대상 블록의 영역들을 나타낸다.
도 22는 일 예에 따른 일부의 픽셀들을 사용하는 템플릿 생성을 나타낸다.
도 23은 일 예에 따른 배수의 픽셀들을 사용하는 템플릿 생성을 나타낸다.
도 24는 일 예에 따른 배수의 픽셀들을 사용하는 템플릿 생성을 나타낸다.
도 25는 일 예에 따른 배수의 픽셀들을 사용하는 템플릿 생성을 나타낸다.
도 26은 일 예에 따른 라인들에 대하여 서로 다른 시작 위치 픽셀들 및 서브샘플링들이 사용되는 템플릿 생성을 나타낸다.
도 27은 일 예에 따른 대상 블록, 영역들 및 CTU 경계를 나타낸다.
도 28은 일 예에 따른 대상 블록의 영역들을 나타낸다.
도 29a 내지 도 29g는 일 예에 다른 대상 블록의 복수의 템플릿들을 나타낸다.
도 29a는 일 예에 따른 제1 템플릿의 구성을 나타낸다.
도 29b는 일 예에 따른 제2 템플릿의 구성을 나타낸다.
도 29c는 일 예에 따른 제3 템플릿의 구성을 나타낸다.
도 29d는 일 예에 따른 제4 템플릿의 구성을 나타낸다.
도 29e는 일 예에 따른 제5 템플릿의 구성을 나타낸다.
도 29f는 일 예에 따른 제6 템플릿의 구성을 나타낸다.
도 29g는 일 예에 따른 제7 템플릿의 구성을 나타낸다.
도 30은 일 예에 따른 대상 블록의 영역들의 샘플들을 나타낸다.
도 31a는 일 예에 따른 제1 템플릿을 위한 샘플들을 나타낸다.
도 31b는 일 예에 따른 제2 템플릿을 위한 샘플들을 나타낸다.
도 31c는 일 예에 따른 제3 템플릿을 위한 샘플들을 나타낸다.
도 32는 일 예에 따른 템플릿을 가리키는 인덱스를 나타내는 표이다.
도 33은 일 예에 따른 패딩을 사용하는 템플릿의 생성을 나타낸다.
도 34a는 일 예에 따른 플리핑이 적용되기 전의 템플릿을 나타낸다.
도 34b는 일 예에 따른 플리핑이 적용된 후의 템플릿을 나타낸다.
도 35는 일 예에 따른 템플릿 매칭 참조 영상 리스트에 속하는 각 후보 템플릿 매칭 참조 영상의 고유 인덱스를 나타낼 수 있다.
도 36은 일 예에 따른 대상 영상을 포함하지 않는 템플릿 매칭 참조 영상 리스트에 속하는 각 후보 템플릿 매칭 참조 영상의 고유 인덱스를 나타낼 수 있다.
도 37a은 일 예에 따른 템플릿 매칭 참조 영상 리스트 L0에 속하는 각 후보 템플릿 매칭 참조 영상의 고유 인덱스를 나타낼 수 있다.
도 37b는 일 예에 따른 템플릿 매칭 참조 영상 리스트 L1에 속하는 각 후보 템플릿 매칭 참조 영상의 고유 인덱스를 나타낼 수 있다.
도 38a은 일 예에 따른 대상 영상을 포함하지 않는 템플릿 매칭 참조 영상 리스트 L0에 속하는 각 후보 템플릿 매칭 참조 영상의 고유 인덱스를 나타낼 수 있다.
도 38b는 일 예에 따른 대상 영상을 포함하지 않는 템플릿 매칭 참조 영상 리스트 L1에 속하는 각 후보 템플릿 매칭 참조 영상의 고유 인덱스를 나타낼 수 있다.
도 39는 일 예에 따른 템플릿 매칭 최적 블록의 도출을 나타낸다.
도 40은 일 예에 따른 템플릿 매칭 움직임 벡터를 도출하는 제1 방법을 나타낸다.
도 41은 일 예에 따른 템플릿 매칭 움직임 벡터를 도출하는 제2 방법을 나타낸다.
도 42는 일 예에 따른 템플릿 매칭 참조 영상 및 대상 영상이 서로 다른 경우의 움직임 벡터를 도출하는 제1 방법을 나타낸다.
도 43은 일 예에 따른 템플릿 매칭 참조 영상 및 대상 영상이 서로 다른 경우의 움직임 벡터를 도출하는 제2 방법을 나타낸다.
도 44는 일 예에 따른 대상 영상 내의 템플릿 매칭 탐색 영역의 모양이 직사각형인 경우를 나타낸다.
도 45는 일 예에 따른 복호화된 과거 영상 또는 복호화된 미래 영상 내의 템플릿 매칭 탐색 영역의 모양이 직사각형인 경우를 나타낸다.
도 46은 일 예에 따른 템플릿 매칭 참조 영상이 대상 영상인 경우 템플릿 매칭 참조 영상 내의 템플릿 매칭 탐색 영역 내의 일부의 영역이 탐색에서 제외된 것을 나타낸다.
도 47은 일 예에 따른 템플릿 매칭 참조 영상이 복호화된 과거 영상 또는 복호화된 미래 영상인 경우 템플릿 매칭 참조 영상 내의 템플릿 매칭 탐색 영역 내의 일부의 영역이 탐색에서 제외된 것을 나타낸다.
도 48은 일 예에 따른 템플릿 매칭 탐색 영역의 모양이 직사각형인 경우의 템플릿 매칭 탐색 영역의 크기를 정의하는 제1 방법을 나타낸다.
도 49는 일 예에 따른 템플릿 매칭 탐색 영역의 모양이 직사각형인 경우의 템플릿 매칭 탐색 영역의 크기를 정의하는 제2 방법을 나타낸다.
도 50은 일 예에 따른 대상 영상 내의 템플릿 매칭 탐색 영역의 모양이 마름모인 경우를 나타낸다.
도 51은 일 예에 따른 복호화된 과거 영상 또는 복호화된 미래 영상 내의 템플릿 매칭 탐색 영역의 모양이 마름모인 경우를 나타낸다.
도 52는 일 예에 따른 템플릿 매칭 참조 영상이 대상 영상인 경우 템플릿 매칭 참조 영상 내의 템플릿 매칭 탐색 영역 내의 일부의 영역이 탐색에서 제외된 것을 나타낸다.
도 53은 일 예에 따른 템플릿 매칭 참조 영상이 복호화된 과거 영상 또는 복호화된 미래 영상인 경우 템플릿 매칭 참조 영상 내의 템플릿 매칭 탐색 영역 내의 일부의 영역이 탐색에서 제외된 것을 나타낸다.
도 54는 일 예에 따른 템플릿 매칭 탐색 영역의 모양이 마름모인 경우의 템플릿 매칭 탐색 영역의 크기를 정의하는 제1 방법을 나타낸다.
도 55는 일 예에 따른 템플릿 매칭 탐색 영역의 모양이 마름모인 경우의 템플릿 매칭 탐색 영역의 크기를 정의하는 제2 방법을 나타낸다.
도 56은 일 예에 따른 대상 블록의 템플릿의 대응 좌표들을 이용하는 템플릿 매칭 탐색 시작 픽셀의 결정을 나타낸다.
도 57은 일 예에 따른 템플릿 매칭 탐색 시작 화소를 초기화하는 방법을 가리키는 인덱스를 나타내는 표이다.
도 58a는 일 예에 따른 대상 영상이 템플릿 매칭 참조 영상인 경우의 대상 블록, 템플릿 매칭 최적 블록 및 인트라 예측 모드들을 나타낸다.
도 58b는 일 예에 따른 대상 영상 및 템플릿 매칭 참조 영상이 서로 다른 경우의 대상 블록, 템플릿 매칭 최적 블록 및 인트라 예측 모드들을 나타낸다.
도 59는 일 예에 따른 제1 특정 영역에 대한 제한적 템플릿 매칭 기반 인트라 잔차 신호 예측을 나타낸다.
도 60은 일 예에 따른 제2 특정 영역에 대한 제한적 템플릿 매칭 기반 인트라 잔차 신호 예측을 나타낸다.
도 61은 일 예에 따른 제3 특정 영역에 대한 제한적 템플릿 매칭 기반 인트라 잔차 신호 예측을 나타낸다.
도 62는 일 예에 따른 제4 특정 영역에 대한 제한적 템플릿 매칭 기반 인트라 잔차 신호 예측을 나타낸다.
도 63a는 일 예에 따른 대상 블록, 대상 블록의 템플릿 및 템플릿의 픽셀들을 도시한다.
도 63b는 일 예에 템플릿 매칭 최적 블록, 대상 블록의 템플릿 및 템플릿의 픽셀들을 도시한다.
도 64a는 일 예에 따른 대상 블록, 대상 블록의 템플릿 및 템플릿의 서브샘플링된 픽셀들을 도시한다.
도 64b는 일 예에 템플릿 매칭 최적 블록, 대상 블록의 템플릿 및 템플릿의 서브샘플링된 픽셀들을 도시한다.
도 65는 일 예에 따른 대상 블록의 템플릿에 대한 대표 값들을 나타낸다.
도 66은 일 예에 따른 인트라 및 TM의 블랜딩 예측을 위한 정보를 개시한다.
도 67은 일 예에 따른 인터 및 템플릿 매칭의 블랜딩 예측을 위한 템플릿 매칭 참조 영상, 대상 영상 및 인터 예측 참조 영상을 도시한다.
도 68은 일 예에 따른 템플릿 매칭을 위한 신택스를 나타낸다.
도 69는 일 예에 따른 8 개 방향으로의 인접한 하프-펠 위치들을 나타낸다.
도 70은 일 예에 따른 정밀도 인덱스의 제1 이진화를 나타낸다.
도 71은 일 예에 따른 정밀도 인덱스의 제2 이진화를 나타낸다.
도 72는 일 예에 따른 필터의 공간적 부분을 나타낸다.
도 73은 일 예에 따른 필터 계수들을 유도하기 위해 사용되는 탐색 영역들을 나타낸다.
도 74는 일 예에 따른 IntraTMP 합성의 절차를 나타낸다.
도 75는 일 예에 따른 IntraTMP의 탐색 영역을 나타낸다.
도 76은 일 예에 따른 IntraTMP의 확장된 탐색 영역을 나타낸다.
도 77은 일 예에 따른 IntraTMP의 제한된 탐색 영역을 나타낸다.
도 78a는 일 예에 따른 CTU 크기가 128인 경우의 IBC 탐색 영역을 나타낸다.
도 78b는 일 예에 따른 CTU 크기가 256인 경우의 IBC 탐색 영역을 나타낸다.
도 79는 일 예에 따른 블록 크기가 64×64인 경우의 IntraTMP 탐색 영역을 나타낸다.
도 80은 일 예에 따른 탐색 범위를 제한하기 위한 코드를 나타낸다.
도 81은 일 예에 따른 2 개의 서로 다른 샘플링 레이트들을 갖는 IntraTMP 탐색 영역 및 IBC 탐색 영역들을 나타낸다.
1 is a block diagram showing the configuration of an encoding device to which the present invention is applied according to an embodiment.
Figure 2 is a block diagram showing the configuration of a decoding device according to an embodiment to which the present invention is applied.
Figure 3 is a diagram schematically showing the division structure of an image when encoding and decoding an image.
Figure 4 is a diagram showing the form of a prediction unit that a coding unit can include.
Figure 5 is a diagram showing the form of a conversion unit that can be included in a coding unit.
Figure 6 shows division of a block according to an example.
Figure 7 is a diagram for explaining an embodiment of the intra prediction process.
Figure 8 is a diagram to explain a reference sample used in the intra prediction process.
Figure 9 is a diagram for explaining an embodiment of the inter prediction process.
Figure 10 shows spatial candidates according to an example.
Figure 11 shows the order of adding motion information of spatial candidates to a merge list according to an example.
Figure 12 explains the process of conversion and quantization according to an example.
13 shows diagonal scanning according to an example.
14 shows horizontal scanning according to an example.
15 shows vertical scanning according to one example.
Figure 16 is a structural diagram of an encoding device according to an embodiment.
Figure 17 is a structural diagram of a decoding device according to an embodiment.
Figure 18 is a flowchart of a method for predicting a target block and generating a bitstream according to an embodiment.
Figure 19 is a flowchart of a method for predicting a target block using a bitstream according to an embodiment.
20 is a flowchart of a prediction method according to an example.
Figure 21 shows areas of a target block according to an example.
Figure 22 shows template creation using some pixels according to an example.
Figure 23 shows template creation using multiple pixels according to an example.
Figure 24 illustrates template creation using multiple pixels according to an example.
Figure 25 shows template creation using multiple pixels according to one example.
Figure 26 shows template creation in which different starting position pixels and subsampling are used for lines according to an example.
Figure 27 shows target blocks, regions, and CTU boundaries according to an example.
Figure 28 shows areas of a target block according to an example.
FIGS. 29A to 29G show a plurality of templates of different target blocks as an example.
Figure 29a shows the configuration of a first template according to an example.
Figure 29b shows the configuration of a second template according to an example.
Figure 29c shows the configuration of a third template according to an example.
Figure 29D shows the configuration of a fourth template according to an example.
Figure 29e shows the configuration of a fifth template according to an example.
Figure 29f shows the configuration of a sixth template according to an example.
Figure 29g shows the configuration of a seventh template according to an example.
Figure 30 shows samples of areas of a target block according to an example.
31A shows samples for a first template according to an example.
31B shows samples for a second template according to one example.
Figure 31C shows samples for a third template according to an example.
Figure 32 is a table showing indices indicating templates according to an example.
Figure 33 shows the creation of a template using padding according to an example.
Figure 34a shows a template before flipping is applied according to an example.
Figure 34b shows a template after flipping is applied according to an example.
FIG. 35 may show a unique index of each candidate template matching reference image belonging to a template matching reference image list according to an example.
FIG. 36 may show a unique index of each candidate template matching reference image belonging to a template matching reference image list that does not include the target image according to an example.
FIG. 37A may represent a unique index of each candidate template matching reference image belonging to the template matching reference image list L0 according to an example.
FIG. 37B may show a unique index of each candidate template matching reference image belonging to the template matching reference image list L1 according to an example.
FIG. 38A may represent a unique index of each candidate template matching reference image belonging to the template matching reference image list L0 that does not include the target image according to an example.
FIG. 38B may represent a unique index of each candidate template matching reference image belonging to the template matching reference image list L1 that does not include the target image according to an example.
Figure 39 shows derivation of an optimal template matching block according to an example.
Figure 40 shows a first method of deriving a template matching motion vector according to an example.
Figure 41 shows a second method of deriving a template matching motion vector according to an example.
Figure 42 shows a first method of deriving a motion vector when a template matching reference image and a target image are different from each other, according to an example.
Figure 43 shows a second method of deriving a motion vector when a template matching reference image and a target image are different from each other, according to an example.
Figure 44 shows a case where the shape of the template matching search area in the target image is rectangular, according to an example.
Figure 45 shows a case where the shape of the template matching search area in a decoded past image or a decoded future image according to an example is rectangular.
Figure 46 shows that when a template matching reference image according to an example is the target image, some areas within the template matching search area within the template matching reference image are excluded from the search.
FIG. 47 illustrates that when the template matching reference image according to an example is a decoded past image or a decoded future image, a portion of an area within the template matching search area within the template matching reference image is excluded from the search.
Figure 48 shows a first method of defining the size of a template matching search area when the shape of the template matching search area is rectangular according to an example.
Figure 49 shows a second method of defining the size of the template matching search area when the shape of the template matching search area is rectangular, according to an example.
Figure 50 shows a case where the shape of the template matching search area in the target image according to an example is a diamond.
Figure 51 shows a case where the shape of the template matching search area in a decoded past image or a decoded future image according to an example is a diamond.
Figure 52 illustrates that when a template matching reference image according to an example is the target image, some areas within the template matching search area within the template matching reference image are excluded from the search.
FIG. 53 illustrates that when the template matching reference image according to an example is a decoded past image or a decoded future image, a portion of an area within the template matching search area within the template matching reference image is excluded from the search.
Figure 54 illustrates a first method of defining the size of a template matching search area when the shape of the template matching search area is a diamond according to an example.
Figure 55 shows a second method of defining the size of the template matching search area when the shape of the template matching search area is a diamond according to an example.
Figure 56 illustrates determination of a template matching search start pixel using corresponding coordinates of a template of a target block according to an example.
Figure 57 is a table showing indices indicating a method of initializing a template matching search start pixel according to an example.
FIG. 58A shows a target block, template matching optimal block, and intra prediction modes when the target image is a template matching reference image according to an example.
Figure 58b shows a target block, template matching optimal block, and intra prediction modes when the target image and the template matching reference image are different according to an example.
Figure 59 shows intra residual signal prediction based on limited template matching for a first specific region according to an example.
Figure 60 shows intra residual signal prediction based on limited template matching for a second specific region according to an example.
Figure 61 shows intra residual signal prediction based on limited template matching for a third specific region according to an example.
Figure 62 shows intra residual signal prediction based on limited template matching for a fourth specific region according to an example.
FIG. 63A shows a target block, a template of the target block, and pixels of the template according to an example.
FIG. 63B shows a template matching optimal block, a template of a target block, and pixels of the template in an example.
Figure 64A shows a target block, a template of the target block, and subsampled pixels of the template, according to an example.
Figure 64B shows a template matching optimal block, a template of a target block, and subsampled pixels of the template in an example.
Figure 65 shows representative values for a template of a target block according to an example.
Figure 66 discloses information for predicting intra and TM blending according to an example.
Figure 67 illustrates a template matching reference image, a target image, and an inter prediction reference image for blending prediction of inter and template matching according to an example.
Figure 68 shows syntax for template matching according to an example.
Figure 69 shows adjacent half-pel positions in eight directions according to one example.
Figure 70 shows a first binarization of a precision index according to an example.
Figure 71 shows a second binarization of a precision index according to an example.
Figure 72 shows the spatial portion of a filter according to one example.
Figure 73 shows search areas used to derive filter coefficients according to an example.
Figure 74 shows the procedure of IntraTMP synthesis according to one example.
Figure 75 shows a search area of IntraTMP according to an example.
Figure 76 shows an expanded search area of IntraTMP according to an example.
Figure 77 shows a limited search area of IntraTMP according to an example.
Figure 78a shows an IBC search area when the CTU size is 128 according to an example.
Figure 78b shows an IBC search area when the CTU size is 256 according to an example.
Figure 79 shows an IntraTMP search area when the block size is 64×64 according to an example.
Figure 80 shows code for limiting the search range according to an example.
Figure 81 shows IntraTMP search area and IBC search area with two different sampling rates according to an example.

본 발명은 다양한 변경을 가할 수 있고 여러 가지 실시예를 가질 수 있는 바, 특정 실시예들을 도면에 예시하고 상세한 설명에 상세하게 설명하고자 한다. 그러나, 이는 본 발명을 특정한 실시 형태에 대해 한정하려는 것이 아니며, 본 발명의 사상 및 기술 범위에 포함되는 모든 변경, 균등물 내지 대체물을 포함하는 것으로 이해되어야 한다.Since the present invention can make various changes and have various embodiments, specific embodiments will be illustrated in the drawings and described in detail in the detailed description. However, this is not intended to limit the present invention to specific embodiments, and should be understood to include all changes, equivalents, and substitutes included in the spirit and technical scope of the present invention.

후술하는 예시적 실시예들에 대한 상세한 설명은, 특정 실시예를 예시로서 도시하는 첨부 도면을 참조한다. 이들 실시예는 당업자가 실시예를 실시할 수 있기에 충분하도록 상세히 설명된다. 다양한 실시예들은 서로 다르지만 상호 배타적일 필요는 없음이 이해되어야 한다. 예를 들면, 여기에 기재되어 있는 특정 형상, 구조 및 특성은 일 실시예에 관련하여 본 발명의 정신 및 범위를 벗어나지 않으면서 다른 실시예로 구현될 수 있다. 또한, 각각의 개시된 실시예 내의 개별 구성요소의 위치 또는 배치는 실시예의 정신 및 범위를 벗어나지 않으면서 변경될 수 있음이 이해되어야 한다. 따라서, 후술하는 상세한 설명은 한정적인 의미로서 취하려는 것이 아니며, 예시적 실시예들의 범위는, 적절하게 설명된다면, 그 청구항들이 주장하는 것과 균등한 모든 범위와 더불어 첨부된 청구항에 의해서만 한정된다.For a detailed description of the exemplary embodiments described below, refer to the accompanying drawings, which illustrate specific embodiments by way of example. These embodiments are described in sufficient detail to enable those skilled in the art to practice the embodiments. It should be understood that the various embodiments are different from one another but are not necessarily mutually exclusive. For example, specific shapes, structures and characteristics described herein with respect to one embodiment may be implemented in other embodiments without departing from the spirit and scope of the invention. Additionally, it should be understood that the location or arrangement of individual components within each disclosed embodiment may be changed without departing from the spirit and scope of the embodiment. Accordingly, the detailed description that follows is not to be taken in a limiting sense, and the scope of the exemplary embodiments, if properly described, is limited only by the appended claims, together with all equivalents to what those claims assert.

도면에서 유사한 참조부호는 여러 측면에 걸쳐서 동일하거나 유사한 기능을 지칭한다. 도면에서의 요소들의 형상 및 크기 등은 보다 명확한 설명을 위해 과장될 수 있다.Similar reference numbers in the drawings refer to identical or similar functions across various aspects. The shapes and sizes of elements in the drawings may be exaggerated for clearer explanation.

본 발명에서 제1, 제2 등의 용어는 다양한 구성요소들을 설명하는데 사용될 수 있지만, 상기 구성요소들은 상기 용어들에 의해 한정되어서는 안 된다. 상기 용어들은 하나의 구성요소를 다른 구성요소로부터 구별하는 목적으로만 사용된다. 예를 들면, 본 발명의 권리 범위를 벗어나지 않으면서 제1 구성요소는 제2 구성요소로 명명될 수 있고, 유사하게 제2 구성요소도 제1 구성요소로 명명될 수 있다. "및/또는"이라는 용어는 복수의 관련된 기재된 항목들의 조합 또는 복수의 관련된 기재된 항목들 중의 어느 항목을 포함할 수 있다.In the present invention, terms such as first and second may be used to describe various components, but the components should not be limited by the terms. The above terms are used only for the purpose of distinguishing one component from another. For example, a first component may be named a second component without departing from the scope of the present invention, and similarly, the second component may also be named a first component. The term “and/or” may include any of a plurality of related stated items or a combination of a plurality of related stated items.

어떤 구성요소(component)가 다른 구성요소에 "연결되어" 있다거나 "접속되어" 있다고 언급된 때에는, 상기의 2개의 구성요소들이 서로 간에 직접적으로 연결되어 있거나 또는 접속되어 있을 수도 있으나, 상기의 2개의 구성요소들의 중간에 다른 구성요소가 존재할 수도 있다고 이해되어야 할 것이다. 반면에, 어떤 구성요소(component)가 다른 구성요소에 "직접 연결되어" 있다거나 "직접 접속되어" 있다고 언급된 때에는, 상기의 2개의 구성요소들의 중간에 다른 구성요소가 존재하지 않는 것으로 이해되어야 할 것이다.When a component is said to be "connected" or "connected" to another component, the two components may be directly connected or connected to each other, but It should be understood that other components may exist in the middle of the components. On the other hand, when a component is said to be "directly connected" or "directly connected" to another component, it should be understood that no other component exists in between the two components. something to do.

실시예들에서 나타나는 구성요소들은 서로 다른 특징적인 기능들을 나타내기 위해 독립적으로 도시되는 것으로, 각 구성요소들이 분리된 하드웨어나 하나의 소프트웨어 구성단위로 이루어짐을 의미하지 않는다. 즉, 각 구성요소는 설명의 편의상 각각의 구성요소로 나열하여 포함한 것으로 각 구성요소 중 적어도 두 개의 구성요소가 합쳐져 하나의 구성요소로 이루어지거나, 하나의 구성요소가 복수 개의 구성요소로 나뉘어져 기능을 수행할 수 있고 이러한 각 구성요소의 통합된 실시예 및 분리된 실시예도 본 발명의 본질에서 벗어나지 않는 한 본 발명의 권리범위에 포함된다.Components appearing in the embodiments are shown independently to represent different characteristic functions, and do not mean that each component consists of separate hardware or a single software component. In other words, each component is listed and included as separate components for convenience of explanation, and at least two of each component are combined to form one component, or one component is divided into multiple components to function. It can be performed, and integrated and separate embodiments of each of these components are included in the scope of the present invention as long as they do not deviate from the essence of the present invention.

실시예들에서 사용된 용어는 단지 특정한 실시예를 설명하기 위해 사용된 것으로, 본 발명을 한정하려는 의도가 아니다. 단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한, 복수의 표현을 포함한다. 실시예들에서, "포함하다" 또는 "가지다" 등의 용어는 명세서 상에 기재된 특징, 숫자, 단계, 동작, 구성요소, 부품 또는 이들을 조합한 것이 존재함을 지정하려는 것이지, 하나 또는 그 이상의 다른 특징들이나 숫자, 단계, 동작, 구성요소, 부품 또는 이들을 조합한 것들의 존재 또는 부가 가능성을 미리 배제하지 않는 것으로 이해되어야 한다. 즉, 실시예들에서 특정 구성을 "포함"한다고 기술하는 내용은 해당 구성 이외의 구성을 배제하는 것이 아니며, 추가적인 구성 또한 본 발명의 실시 또는 본 발명의 기술적 사상의 범위에 포함될 수 있음을 의미한다.The terms used in the examples are only used to describe specific examples and are not intended to limit the invention. Singular expressions include plural expressions unless the context clearly dictates otherwise. In embodiments, terms such as “comprise” or “have” are intended to designate the presence of features, numbers, steps, operations, components, parts, or combinations thereof described in the specification, but are intended to indicate the presence of one or more other features, numbers, steps, operations, components, parts, or combinations thereof. It should be understood that this does not exclude in advance the presence or addition of features, numbers, steps, operations, components, parts, or combinations thereof. In other words, the description of “including” a specific configuration in the embodiments does not exclude configurations other than the configuration, and means that additional configurations may also be included in the practice of the present invention or the scope of the technical idea of the present invention. .

실시예들에서 용어 "적어도 하나(at least one)"는 1, 2, 3 및 4와 같은 1 이상의 개수들 중 하나를 의미할 수 있다. 실시예들에서 용어 "복수(a plurality of)"는 2, 3 및 4와 같은 2 이상의 개수들 중 하나를 의미할 수 있다.In embodiments, the term “at least one” may mean one of one or more numbers, such as 1, 2, 3, and 4. In embodiments, the term “a plurality of” may mean one of two or more numbers, such as 2, 3, and 4.

실시예들의 일부의 구성요소는 본 발명에서 본질적인 기능을 수행하는 필수적인 구성요소는 아니고 단지 성능을 향상시키기 위한 선택적 구성요소일 수 있다. 실시예들은, 단지 성능 향상을 위해 사용되는 구성요소가 제외된, 실시예들의 본질을 구현함에 있어 필수적인 구성요소만을 포함하여 구현될 수 있다. 단지 성능 향상을 위해 사용되는 선택적인 구성요소가 제외된 필수적인 구성요소만을 포함하는 구조도 실시예들의 권리범위에 포함된다.Some of the components of the embodiments may not be essential components that perform essential functions in the present invention, but may simply be optional components to improve performance. Embodiments may be implemented by including only components essential for implementing the essence of the embodiments, excluding components used only to improve performance. Structures that include only essential components excluding optional components used to improve performance are also included in the scope of the embodiments.

이하에서는, 기술분야에서 통상의 지식을 가진 자가 실시예들을 용이하게 실시할 수 있도록 하기 위하여, 첨부된 도면을 참조하여 실시 형태에 대하여 구체적으로 설명한다. 실시예들을 설명함에 있어, 관련된 공지 구성 또는 기능에 대한 구체적인 설명이 본 명세서의 요지를 흐릴 수 있다고 판단되는 경우에는 그 상세한 설명은 생략한다. 또한, 도면 상의 동일한 구성요소에 대해서는 동일한 참조부호를 사용하고, 동일한 구성요소에 대한 중복된 설명은 생략한다.Hereinafter, embodiments will be described in detail with reference to the attached drawings so that those skilled in the art can easily implement the embodiments. In describing the embodiments, if it is determined that a detailed description of a related known configuration or function may obscure the gist of the present specification, the detailed description will be omitted. In addition, the same reference numerals are used for the same components in the drawings, and duplicate descriptions of the same components are omitted.

이하에서, 영상은 비디오(video)를 구성하는 하나의 픽처(picture)를 의미할 수 있으며, 비디오 자체를 나타낼 수도 있다. 예를 들면, "영상의 부호화 및/또는 복호화"는 "비디오의 부호화 및/또는 복호화"를 의미할 수 있으며, "비디오를 구성하는 영상들 중 하나의 영상의 부호화 및/또는 복호화"를 의미할 수도 있다.Hereinafter, an image may refer to a single picture constituting a video, and may also represent the video itself. For example, “encoding and/or decoding of an image” may mean “encoding and/or decoding of a video,” and may mean “encoding and/or decoding of one of the images that constitute a video.” It may be possible.

이하에서, 용어들 "비디오(video)" 및 "동영상(motion picture(s))"은 동일한 의미로 사용될 수 있으며, 서로 교체되어 사용될 수 있다.Hereinafter, the terms “video” and “motion picture(s)” may be used with the same meaning and may be used interchangeably.

이하에서, 대상 영상은 부호화의 대상인 부호화 대상 영상 및/또는 복호화의 대상인 복호화 대상 영상일 수 있다. 또한, 대상 영상은 부호화 장치로 입력된 입력 영상일 수 있고, 복호화 장치로 입력된 입력 영상일 수 있다. 또한, 대상 영상은 현재 부호화 및/또는 복호화의 대상인 현재 영상일 수 있다. 예를 들면, 용어들 "대상 영상" 및 "현재 영상"은 동일한 의미로 사용될 수 있으며, 서로 교체되어 사용될 수 있다.Hereinafter, the target image may be an encoding target image that is the target of encoding and/or a decoding target image that is the target of decoding. Additionally, the target image may be an input image input to an encoding device or may be an input image input to a decoding device. Additionally, the target video may be a current video that is currently subject to encoding and/or decoding. For example, the terms “target image” and “current image” may be used interchangeably and may have the same meaning.

이하에서, 용어들 "영상(image)", "픽처(picture)", "프레임(frame)" 및 "스크린(screen)"은 동일한 의미로 사용될 수 있으며, 서로 교체되어 사용될 수 있다.Hereinafter, the terms “image”, “picture”, “frame” and “screen” may be used with the same meaning and may be used interchangeably.

이하에서, 대상 블록은 부호화의 대상인 부호화 대상 블록 및/또는 복호화의 대상인 복호화 대상 블록일 수 있다. 또한, 대상 블록은 현재 부호화 및/또는 복호화의 대상인 현재 블록일 수 있다. 예를 들면, 용어들 "대상 블록" 및 "현재 블록"은 동일한 의미로 사용될 수 있으며, 서로 교체되어 사용될 수 있다. 현재 블록은 부호화 시 부호화의 대상이 되는 부호화 대상 블록 및/또는 복호화 시 복호화의 대상이 되는 복호화 대상 블록을 의미할 수 있다. 또한, 현재 블록은 코딩(coding) 블록, 예측 블록, 잔차 블록 및 변환 블록 중 적어도 하나일 수 있다.Hereinafter, the target block may be an encoding target block that is the target of encoding and/or a decoding target block that is the target of decoding. Additionally, the target block may be a current block that is currently the target of encoding and/or decoding. For example, the terms “target block” and “current block” may be used interchangeably and may be used interchangeably. The current block may mean an encoding target block that is the target of encoding during encoding and/or a decoding target block that is the target of decoding during decoding. Additionally, the current block may be at least one of a coding block, a prediction block, a residual block, and a transform block.

이하에서, 용어들 "블록" 및 "유닛"은 동일한 의미로 사용될 수 있으며, 서로 교체되어 사용될 수 있다. 또는 "블록"은 특정한 유닛을 나타낼 수 있다.Hereinafter, the terms “block” and “unit” may be used with the same meaning and may be used interchangeably. Alternatively, “block” may refer to a specific unit.

이하에서, 용어들 "영역(region)" 및 "세그먼트(segment)"는 서로 교체되어 사용될 수 있다.Hereinafter, the terms “region” and “segment” may be used interchangeably.

실시예들에서, 특정된 정보, 데이터, 플래그(flag), 인덱스(index) 및 요소(element), 속성(attribute) 등의 각각은 값을 가질 수 있다. 정보, 데이터, 플래그, 인덱스, 요소 및 속성 등의 값 "0"은 거짓(false), 논리 거짓(logical false) 또는 제1 기정의된(predefined) 값을 나타낼 수 있다. 말하자면, 값 "0", 거짓, 논리 거짓 및 제1 기정의된 값은 서로 대체되어 사용될 수 있다. 정보, 데이터, 플래그, 인덱스, 요소 및 속성 등의 값 "1"은 참(true), 논리 참(logical true) 또는 제2 기정의된(predefined) 값을 나타낼 수 있다. 말하자면, 값 "1", 참, 논리 참 및 제2 기정의된 값은 서로 대체되어 사용될 수 있다.In embodiments, each of the specified information, data, flag, index, element, attribute, etc. may have a value. The value "0" of information, data, flags, indexes, elements, and attributes may represent false, logical false, or a first predefined value. That is, the values “0”, false, logical false and the first predefined value can be used interchangeably. The value "1" in information, data, flags, indexes, elements, and attributes may represent true, logical true, or a second predefined value. That is, the value “1”, true, logical true and the second predefined value can be used interchangeably.

행, 열 또는 인덱스를 나타내기 위해 i 또는 j 등의 변수가 사용될 때, i의 값은 0 이상의 정수일 수 있으며, 1 이상의 정수일 수도 있다. 말하자면, 실시예들에서 행, 열 및 인덱스 등은 0에서부터 카운트될 수 있으며, 1에서부터 카운트될 수 있다.When a variable such as i or j is used to represent a row, column, or index, the value of i may be an integer greater than or equal to 0, or an integer greater than or equal to 1. That is, in embodiments rows, columns, indices, etc. may be counted from 0, and may be counted from 1.

실시예들에서, 용어 "하나 이상" 또는 용어 "적어도 하나"는 용어 "복수"를 의미할 수 있다. "하나 이상" 또는 "적어도 하나"는 "복수"로 교체되어 사용될 수 있다.In embodiments, the term “one or more” or the term “at least one” may mean the term “plural.” “One or more” or “at least one” can be used interchangeably with “plural.”

아래에서는, 실시예들에서 사용되는 용어가 설명된다.Below, terms used in the embodiments are explained.

부호화기(encoder): 부호화기는 부호화(encoding)를 수행하는 장치를 의미할 수 있다. 말하자면, 부호화기는 부호화 장치를 의미할 수 있다.Encoder: An encoder may refer to a device that performs encoding. In other words, an encoder may mean an encoding device.

복호화기(decoder): 복호화기는 복호화(decoding)를 수행하는 장치를 의미할 수 있다. 말하자면, 복호화기는 복호화 장치를 의미할 수 있다.Decoder: A decoder may refer to a device that performs decoding. In other words, a decoder may mean a decryption device.

유닛(unit): 유닛은 영상의 부호화 및/또는 복호화의 단위를 나타낼 수 있다. 용어들 "유닛" 및 "블록(block)"은 동일한 의미로 사용될 수 있으며, 서로 교체되어 사용될 수 있다.Unit: A unit may represent a unit of video encoding and/or decoding. The terms “unit” and “block” may be used interchangeably and may be used interchangeably.

- 유닛은 샘플(sample)의 MxN 배열일 수 있다. M 및 N은 각각 양의 정수일 수 있다. 유닛은 흔히 2차원의 형태의 샘플들의 배열을 의미할 수 있다.- A unit may be an MxN array of samples. M and N can each be positive integers. A unit can often refer to an array of samples in a two-dimensional form.

- 영상의 부호화 및 복호화에 있어서, 유닛은 하나의 영상의 분할에 의해 생성된 영역일 수 있다. 말하자면, 유닛은 하나의 영상 내의 특정된 영역일 수 있다. 하나의 영상은 복수의 유닛들로 분할될 수 있다. 또는, 유닛은 하나의 영상을 세분화된 부분들로 분할하고, 분할된 부분에 대한 부호화 또는 복호화가 수행될 때, 상기의 분할된 부분을 의미할 수 있다.- In video encoding and decoding, a unit may be an area created by dividing one video. In other words, a unit may be a specified area within one image. One image may be divided into multiple units. Alternatively, a unit may refer to the divided parts when one image is divided into segmented parts and encoding or decoding is performed on the segmented parts.

- 영상의 부호화 및 복호화에 있어서, 유닛의 타입에 따라서 유닛에 대한 기정의된 처리가 수행될 수 있다.- In encoding and decoding of images, predefined processing may be performed on the unit depending on the type of unit.

- 기능에 따라서, 유닛의 타입은 매크로 유닛(Macro Unit), 코딩 유닛(Coding Unit; CU), 예측 유닛(Prediction Unit; PU), 잔차 유닛(Residual Unit) 및 변환 유닛(Transform Unit; TU) 등으로 분류될 수 있다. 또는, 기능에 따라서, 유닛은 블록, 매크로블록(Macroblock), 코딩 트리 유닛(Coding Tree Unit), 코딩 트리 블록(Coding Tree Block), 코딩 유닛(Coding Unit), 부호화 블록(Coding Block), 예측 유닛(Prediction Unit), 예측 블록(Prediction Block), 잔차 유닛(Residual Unit), 잔차 블록(Residual Block), 변환 유닛(Transform Unit) 및 변환 블록(Transform Block) 등을 의미할 수 있다. 예를 들면, 대상 유닛은 부호화 및/또는 복호화의 대상인 CU, PU, 잔차 유닛 및 TU 중 적어도 하나일 수 있다.- Depending on the function, the types of units include Macro Unit, Coding Unit (CU), Prediction Unit (PU), Residual Unit, and Transform Unit (TU), etc. It can be classified as: Or, depending on the function, the unit may be a block, macroblock, Coding Tree Unit, Coding Tree Block, Coding Unit, Coding Block, or Prediction Unit. It may mean (Prediction Unit), Prediction Block, Residual Unit, Residual Block, Transform Unit, Transform Block, etc. For example, the target unit may be at least one of a CU, PU, residual unit, and TU that are the target of encoding and/or decoding.

- 유닛은, 블록과 구분하여 지칭하기 위해, 루마(luma) 성분 블록 및 이에 대응하는 크로마(chroma) 성분 블록, 그리고 각 블록에 대한 신택스 요소(syntax element)를 포함하는 정보를 의미할 수 있다.- A unit may refer to information including a luma component block, a corresponding chroma component block, and a syntax element for each block in order to refer to it separately from a block.

- 유닛의 크기 및 형태는 다양할 수 있다. 또한, 유닛은 다양한 크기 및 다양한 형태를 가질 수 있다. 특히 유닛의 형태는 정사각형뿐만 아니라 직사각형, 사다리꼴, 삼각형 및 오각형 등 2차원으로 표현될 수 있는 기하학적 도형을 포함할 수 있다.- The size and shape of the unit may vary. Additionally, units may have various sizes and shapes. In particular, the shape of the unit may include geometric shapes that can be expressed in two dimensions, such as squares, rectangles, trapezoids, triangles, and pentagons.

- 또한, 유닛 정보는 유닛의 타입, 유닛의 크기, 유닛의 깊이, 유닛의 부호화 순서 및 유닛의 복호화 순서 등 중 적어도 하나 이상을 포함할 수 있다. 예를 들면, 유닛의 타입은 CU, PU, 잔차 유닛 및 TU 등 중 하나를 가리킬 수 있다.- Additionally, the unit information may include at least one of the unit type, unit size, unit depth, unit encoding order, and unit decoding order. For example, the type of unit may indicate one of CU, PU, residual unit, and TU.

- 하나의 유닛은 유닛에 비해 더 작은 크기를 갖는 하위 유닛으로 더 분할될 수 있다.- One unit can be further divided into subunits with a smaller size than the unit.

깊이(depth): 깊이는 유닛의 분할된 정도를 의미할 수 있다. 또한, 유닛의 깊이는 트리 구조로서 유닛(들)이 표현되었을 때 유닛이 존재하는 레벨을 나타낼 수 있다.Depth: Depth may refer to the degree to which a unit is divided. Additionally, the depth of a unit may indicate the level at which the unit(s) exist when the unit(s) are expressed as a tree structure.

- 유닛 분할 정보는 유닛의 깊이에 관한 깊이를 포함할 수 있다. 깊이는 유닛이 분할되는 회수 및/또는 정도를 나타낼 수 있다.- Unit division information may include depth regarding the depth of the unit. Depth may indicate the number and/or extent to which a unit is divided.

- 트리 구조에서, 루트 노드(root node)의 깊이가 가장 얕고, 리프 노드(leaf node)의 깊이가 가장 깊다고 볼 수 있다. 루트 노드는 가장 상위의 노드일 수 있다. 리프 노드는 가장 하위의 노드일 수 있다.- In a tree structure, the root node has the shallowest depth, and the leaf node has the deepest depth. The root node may be the highest node. A leaf node may be the lowest node.

- 하나의 유닛은 트리 구조(tree structure)에 기반하여 깊이 정보(depth)를 가지면서 계층적으로(hierarchically) 복수의 하위 유닛들로 분할될 수 있다. 말하자면, 유닛 및 상기의 유닛의 분할에 의해 생성된 하위 유닛은 노드 및 상기의 노드의 자식 노드에 각각 대응할 수 있다. 각각의 분할된 하위 유닛은 깊이를 가질 수 있다. 깊이는 유닛이 분할된 회수 및/또는 정도를 나타내므로, 하위 유닛의 분할 정보는 하위 유닛의 크기에 관한 정보를 포함할 수도 있다.- One unit can be hierarchically divided into a plurality of sub-units while having depth information based on a tree structure. In other words, a unit and a sub-unit created by division of the unit may respectively correspond to a node and a child node of the node. Each divided sub-unit can have depth. Since depth indicates the number and/or extent to which a unit is divided, division information of a sub-unit may include information about the size of the sub-unit.

- 트리 구조에서, 가장 상위 노드는 분할되지 않은 최초의 유닛에 대응할 수 있다. 가장 상위 노드는 루트 노드로 칭해질 수 있다. 또한, 가장 상위 노드는 최소의 깊이 값을 가질 수 있다. 이 때, 가장 상위 노드는 레벨 0의 깊이를 가질 수 있다. - In a tree structure, the highest node may correspond to the first undivided unit. The highest node may be referred to as the root node. Additionally, the highest node may have the minimum depth value. At this time, the highest node may have a depth of level 0.

- 레벨 1의 깊이를 갖는 노드는 최초의 유닛이 한 번 분할됨에 따라 생성된 유닛을 나타낼 수 있다. 레벨 2의 깊이를 갖는 노드는 최초의 유닛이 두 번 분할됨에 따라 생성된 유닛을 나타낼 수 있다.- A node with a depth of level 1 may represent a unit created as the original unit is divided once. A node with a depth of level 2 may represent a unit created by dividing the original unit twice.

- 레벨 n의 깊이를 갖는 노드는 최초의 유닛이 n번 분할됨에 따라 생성된 유닛을 나타낼 수 있다.- A node with a depth of level n may represent a unit created as the original unit is divided n times.

- 리프 노드는 가장 하위의 노드일 수 있으며, 더 분할될 수 없는 노드일 수 있다. 리프 노드의 깊이는 최대 레벨일 수 있다. 예를 들면, 최대 레벨의 기정의된 값은 3일 수 있다.- A leaf node may be the lowest node and may be a node that cannot be further divided. The depth of the leaf node may be at the maximum level. For example, the predefined value of the maximum level may be 3.

- QT 깊이는 쿼드 분할에 대한 깊이를 나타낼 수 있다. BT 깊이는 이진 분할에 대한 깊이를 나타낼 수 있다. TT 깊이는 삼진 분할에 대한 깊이를 나타낼 수 있다.- QT depth can indicate the depth of quad division. BT depth may indicate the depth for binary division. TT depth can indicate depth to strikeout splits.

샘플(sample): 샘플은 블록을 구성하는 기반(base) 단위일 수 있다. 샘플은 비트 깊이(bit depth; Bd)에 따라서 0부터 2Bd-1까지의 값들로서 표현될 수 있다.Sample: A sample may be the base unit that constitutes a block. Samples can be expressed as values from 0 to 2 Bd -1 depending on the bit depth (Bd).

- 샘플은 픽셀 또는 픽셀 값일 수 있다.- Samples can be pixels or pixel values.

- 이하에서, 용어들 "픽셀", "화소" 및 "샘플"은 동일한 의미로 사용될 수 있으며, 서로 교체되어 사용될 수 있다.- Hereinafter, the terms “pixel”, “pixel” and “sample” may be used with the same meaning and may be used interchangeably.

코딩 트리 유닛(Coding Tree Unit; CTU): CTU는 하나의 루마 성분(Y) 코딩 트리 블록과, 상기의 루마 성분 코딩 트리 블록에 관련된 두 크로마 성분(Cb, Cr) 코딩 트리 블록들로 구성될 수 있다. 또한, CTU는 상기의 블록들과 상기의 블록들의 각 블록에 대한 신택스 요소를 포함한 것을 의미할 수도 있다.Coding Tree Unit (CTU): A CTU may be composed of one luma component (Y) coding tree block and two chroma component (Cb, Cr) coding tree blocks related to the luma component coding tree block. there is. Additionally, CTU may mean including the above blocks and syntax elements for each block of the above blocks.

- 각 코딩 트리 유닛은 코딩 유닛, 예측 유닛 및 변환 유닛 등의 하위 유닛을 구성하기 위하여 쿼드 트리(Quad Tree: QT), 이진 트리(Binary Tree; BT) 및 삼진 트리(Ternary Tree; TT) 등과 같은 하나 이상의 분할 방식을 이용하여 분할될 수 있다. 쿼드 트리는 4진 트리(quarternary tree)를 의미할 수 있다. 또한, 각 코딩 트리 유닛은 하나 이상의 분할 방식들을 사용하는 복수 트리(MultiType Tree; MTT)을 이용하여 분할될 수 있다.- Each coding tree unit is composed of sub-units such as coding unit, prediction unit, and transformation unit, such as Quad Tree (QT), Binary Tree (BT), and Ternary Tree (TT). It can be partitioned using one or more partitioning methods. Quad tree may refer to a quarternary tree. Additionally, each coding tree unit may be partitioned using a MultiType Tree (MTT) using one or more partitioning methods.

- CTU는 입력 영상의 분할에서와 같이, 영상의 복호화 및 부호화 과정에서의 처리 단위인 픽셀 블록을 지칭하기 위한 용어로서 사용될 수 있다.- CTU can be used as a term to refer to a pixel block, which is a processing unit in the decoding and encoding process of an image, as in segmentation of an input image.

코딩 트리 블록(Coding Tree Block; CTB): 코딩 트리 블록은 Y 코딩 트리 블록, Cb 코딩 트리 블록 및 Cr 코딩 트리 블록 중 어느 하나를 지칭하기 위한 용어로 사용될 수 있다.Coding Tree Block (CTB): Coding tree block can be used as a term to refer to any one of Y coding tree block, Cb coding tree block, and Cr coding tree block.

이웃 블록(neighbor block): 이웃 블록은 대상 블록에 인접한 블록을 의미할 수 있다. 이웃 블록은 재구축된 이웃 블록을 의미할 수도 있다.Neighbor block: A neighboring block may refer to a block adjacent to the target block. A neighboring block may also mean a reconstructed neighboring block.

- 이하에서, 용어들 "이웃 블록" 및 "인접 블록(adjacent block)"은 동일한 의미로 사용될 수 있으며, 서로 교체되어 사용될 수 있다.- Hereinafter, the terms “neighboring block” and “adjacent block” may be used with the same meaning and may be used interchangeably.

- 이웃 블록은 재구축된 이웃 블록(reconstructed neighbor block)을 의미할 수도 있다.- A neighbor block may mean a reconstructed neighbor block.

공간적 이웃 블록(spatial neighbor block): 공간적 이웃 블록은 대상 블록에 공간적으로 인접한 블록일 수 있다. 이웃 블록은 공간적 이웃 블록을 포함할 수 있다.Spatial neighboring block: A spatial neighboring block may be a block spatially adjacent to the target block. Neighboring blocks may include spatial neighboring blocks.

- 대상 블록 및 공간적 이웃 블록은 대상 픽처 내에 포함될 수 있다.- The target block and spatial neighboring blocks may be included in the target picture.

- 공간적 이웃 블록은 대상 블록에 경계가 맞닿은 블록 또는 대상 블록으로부터 소정의 거리 내에 위치한 블록을 의미할 수 있다.- A spatial neighboring block may refer to a block bordering the target block or a block located within a predetermined distance from the target block.

- 공간적 이웃 블록은 대상 블록의 꼭지점에 인접한 블록을 의미할 수 있다. 여기에서, 대상 블록의 꼭지점에 인접한 블록이란, 대상 블록에 가로로 인접한 이웃 블록에 세로로 인접한 블록 또는 대상 블록에 세로로 인접한 이웃 블록에 가로로 인접한 블록일 수 있다.- A spatial neighboring block may refer to a block adjacent to the vertex of the target block. Here, the block adjacent to the vertex of the target block may be a block vertically adjacent to a neighboring block horizontally adjacent to the target block, or a block horizontally adjacent to a neighboring block vertically adjacent to the target block.

시간적 이웃 블록(temporal neighbor block): 시간적 이웃 블록은 대상 블록에 시간적으로 인접한 블록일 수 있다. 이웃 블록은 시간적 이웃 블록을 포함할 수 있다.Temporal neighboring block: A temporal neighboring block may be a block temporally adjacent to the target block. A neighboring block may include temporal neighboring blocks.

- 시간적 이웃 블록은 콜 블록(co-located block; col block)을 포함할 수 있다.- A temporal neighboring block may include a co-located block (col block).

- 콜 블록은 이미 재구축된 콜 픽처(co-located picture; col picture) 내의 블록일 수 있다. 콜 블록의 콜 픽처 내에서의 위치는 대상 블록의 대상 픽처 내의 위치에 대응할 수 있다. 또는, 콜 블록의 콜 픽처 내에서의 위치는 대상 블록의 대상 픽처 내의 위치와 동일할 수 있다. 콜 픽처는 참조 픽처 리스트에 포함된 픽처일 수 있다.- A call block may be a block in an already reconstructed co-located picture (col picture). The position of the call block within the call picture may correspond to the position of the target block within the target picture. Alternatively, the location of the collocated block in the collocated picture may be the same as the location of the target block in the target picture. A call picture may be a picture included in the reference picture list.

- 시간적 이웃 블록은 대상 블록의 공간적 이웃 블록에 시간적으로 인접한 블록일 수 있다.- A temporal neighboring block may be a block temporally adjacent to a spatial neighboring block of the target block.

예측 모드(prediction mode): 예측 모드는 인트라 예측을 위해 사용되는 모드 또는 인터 예측을 위해 사용되는 모드를 지시하는 정보일 수 있다.Prediction mode: The prediction mode may be information indicating the mode used for intra prediction or the mode used for inter prediction.

예측 유닛(prediction unit): 예측 유닛은 인터 예측, 인트라 예측, 인터 보상(compensation), 인트라 보상 및 움직임 보상 등의 예측에 대한 기반 단위를 의미할 수 있다.Prediction unit: A prediction unit may refer to a base unit for prediction such as inter prediction, intra prediction, inter compensation, intra compensation, and motion compensation.

- 하나의 예측 유닛은 더 작은 크기를 갖는 복수의 파티션(partition)들 또는 하위 예측 유닛들로 분할될 수도 있다. 복수의 파티션들 또한 예측 또는 보상의 수행에 있어서의 기반 단위일 수 있다. 예측 유닛의 분할에 의해 생성된 파티션 또한 예측 유닛일 수 있다.- One prediction unit may be divided into a plurality of partitions or sub-prediction units with smaller sizes. A plurality of partitions may also be a basic unit in performing prediction or compensation. A partition created by dividing a prediction unit may also be a prediction unit.

예측 유닛 파티션(prediction unit partition): 예측 유닛 파티션은 예측 유닛이 분할된 형태를 의미할 수 있다.Prediction unit partition: Prediction unit partition may refer to the form in which the prediction unit is divided.

재구축된 이웃 유닛(reconstructed neighboring unit): 재구축된 이웃 유닛은 대상 유닛의 이웃에 이미 복호화되어 재구축된 유닛일 수 있다.Reconstructed neighboring unit: The reconstructed neighboring unit may be a unit that has already been decrypted and rebuilt in the neighborhood of the target unit.

- 재구축된 이웃 유닛은 대상 유닛에 대한 공간적(spatial) 인접 유닛 또는 시간적(temporal) 인접 유닛일 수 있다.- The reconstructed neighboring unit may be a spatially adjacent unit or a temporally adjacent unit to the target unit.

- 재구축된 공간적 이웃 유닛은 대상 픽처 내의 유닛이면서 부호화 및/또는 복호화를 통해 이미 재구축된 유닛일 수 있다.- The reconstructed spatial neighboring unit may be a unit in the target picture and a unit that has already been reconstructed through encoding and/or decoding.

- 재구축된 시간적 이웃 유닛은 참조 영상 내의 유닛이면서 부호화 및/또는 복호화를 통해 이미 재구축된 유닛일 수 있다. 재구축된 시간적 이웃 유닛의 참조 영상 내에서의 위치는 대상 유닛의 대상 픽처 내에서의 위치와 같거나, 대상 유닛의 대상 픽처 내에서의 위치에 대응할 수 있다. 또는, 재구축된 시간적 이웃 유닛은 참조 영상 내의 대응하는 블록의 이웃 블록일 수 있다. 여기에서, 대응하는 블록의 참조 영상 내에서의 위치는 대상 영상 내에서의 대상 블록의 위치에 대응할 수 있다. 여기에서, 블록들의 위치들이 대응한다는 것은, 블록들의 위치들이 동일하다는 것을 의미할 수 있고, 하나의 블록이 다른 블록에 포함된다는 것을 의미할 수 있고, 하나의 블록이 다른 블록의 특정된 위치를 차지한다는 것을 의미할 수 있다.- The reconstructed temporal neighboring unit may be a unit in the reference image and a unit that has already been reconstructed through encoding and/or decoding. The location of the reconstructed temporal neighboring unit within the reference image may be the same as the location of the target unit within the target picture, or may correspond to the location of the target unit within the target picture. Alternatively, the reconstructed temporal neighboring unit may be a neighboring block of the corresponding block in the reference image. Here, the location of the corresponding block within the reference image may correspond to the location of the target block within the target image. Here, that the positions of the blocks correspond may mean that the positions of the blocks are the same, that one block is included in another block, and that one block occupies the specified position of the other block. It could mean doing it.

서브-픽처: 픽처는 하나 이상의 서브-픽처들로 분할될 수 있다. 서브-픽처는 하나 이상의 타일 행들 및 하나 이상의 타일 열들로 구성될 수 있다.Sub-picture: A picture can be divided into one or more sub-pictures. A sub-picture may consist of one or more tile rows and one or more tile columns.

- 서브-픽처는 픽처 내의 정사각형(square) 형태 또는 직사각형(rectangular)(즉, 비-정사각형(non-square) 형태를 가지는 영역일 수 있다. 또한, 서브-픽처는 하나 이상의 CTU들을 포함할 수 있다.- A sub-picture may be an area with a square or rectangular (i.e. non-square) shape within the picture. Additionally, the sub-picture may include one or more CTUs. .

- 서브-픽처는 하나의 픽처 내의 하나 이상의 슬라이스들의 직사각형 영역일 수 있다.- A sub-picture may be a rectangular area of one or more slices within one picture.

- 하나의 서브-픽처는 하나 이상의 타일(tile)들, 하나 이상의 브릭(brick)들 및/또는 하나 이상의 슬라이스(slice)들을 포함할 수 있다.- One sub-picture may include one or more tiles, one or more bricks, and/or one or more slices.

타일: 타일은 픽처 내의 정사각형 형태 또는 직사각형(즉, 비-정사각형 형태를 가지는 영역일 수 있다.Tiles: A tile can be an area within a picture that has a square or rectangular shape (i.e., a non-square shape).

- 타일은 하나 이상의 CTU들을 포함할 수 있다.- A tile may contain one or more CTUs.

- 타일은 하나 이상의 브릭들로 분할될 수 있다.- A tile can be split into one or more bricks.

브릭: 브릭은 타일 내의 하나 이상의 CTU 행들을 의미할 수 있다.Brick: A brick may refer to one or more CTU rows within a tile.

- 타일은 하나 이상의 브릭들로 분할될 수 있다. 각 브릭은 하나 이상의 CTU 행들을 포함할 수 있다.- A tile can be split into one or more bricks. Each brick may contain one or more CTU rows.

- 2 개 이상으로 분할되지 않는 타일도 브릭을 의미할 수 있다.- Tiles that are not divided into two or more can also refer to bricks.

슬라이스: 슬라이스는 픽처 내의 하나 이상의 타일들을 포함할 수 있다. 또는, 슬라이스는 타일 내의 하나 이상의 브릭들을 포함할 수 있다.Slice: A slice may contain one or more tiles within a picture. Alternatively, a slice may include one or more bricks within a tile.

- 서브-픽처는 픽처 내의 직사각형 영역을 집합적으로 커버하는 하나 이상의 슬라이스들을 포함할 수 있다. 이에 따라, 각 서브-픽처 경계는 항상 슬라이스 경계일 수 있다. 또한, 각 수직 서브-픽처 경계는 항상 수직 타일 경계일 수 있다.- A sub-picture may contain one or more slices that collectively cover a rectangular area within the picture. Accordingly, each sub-picture boundary may always be a slice boundary. Additionally, each vertical sub-picture boundary may always be a vertical tile boundary.

파라미터 세트(parameter set): 파라미터 세트는 비트스트림 내의 구조(structure) 중 헤더(header) 정보에 해당할 수 있다.Parameter set: The parameter set may correspond to header information among the structures in the bitstream.

- 파라미터 세트는 비디오 파라미터 세트(Video Parameter Set; VPS), 시퀀스 파라미터 세트(Sequence Parameter Set: SPS), 픽처 파라미터 세트(Picture Parameter Set; PPS), 적응 파라미터 세트(Adaptation Parameter Set; APS) 및 복호화 파라미터 세트(Decoding Parameter Set; DPS) 등 중 적어도 하나를 포함할 수 있다.- Parameter sets include Video Parameter Set (VPS), Sequence Parameter Set (SPS), Picture Parameter Set (PPS), Adaptation Parameter Set (APS), and decoding parameters. It may include at least one of a set (Decoding Parameter Set (DPS)), etc.

파라미터 세트를 통해 시그널링된 정보는 파라미터 세트를 참조하는 픽처들에게 적용될 수 있다. 예를 들면, VPS 내의 정보는 VPS를 참조하는 픽처들에게 적용될 수 있다. SPS 내의 정보는 SPS를 참조하는 픽처들에게 적용될 수 있다. PPS 내의 정보는 PPS를 참조하는 픽처들에게 적용될 수 있다.Information signaled through a parameter set can be applied to pictures referencing the parameter set. For example, information in the VPS can be applied to pictures referencing the VPS. Information in the SPS can be applied to pictures referencing the SPS. Information in the PPS can be applied to pictures referencing the PPS.

파라미터 세트는 상위의 파라미터 세트를 참조할 수 있다. 예를 들면, PPS는 SPS를 참조할 수 있다. SPS는 VPS를 참조할 수 있다.A parameter set can refer to a parent parameter set. For example, PPS may refer to SPS. SPS may refer to VPS.

- 또한, 파라미터 세트는 타일(tile) 그룹, 슬라이스(slice) 헤더 정보 및 타일(tile) 헤더 정보를 포함할 수 있다. 타일 그룹은 복수의 타일들을 포함하는 그룹을 의미할 수 있다. 또한, 타일 그룹의 의미는 슬라이스의 의미와 동일할 수 있다.- Additionally, the parameter set may include tile group, slice header information, and tile header information. A tile group may refer to a group including a plurality of tiles. Additionally, the meaning of a tile group may be the same as that of a slice.

율-왜곡 최적화(rate-distortion optimization): 부호화 장치는 코딩 유닛의 크기, 예측 모드, 예측 유닛의 크기, 움직임 정보 및, 변환 유닛의 크기 등의 조합을 이용해서 높은 부호화 효율을 제공하기 위해 율-왜곡 최적화를 사용할 수 있다.Rate-distortion optimization: The coding device uses a combination of coding unit size, prediction mode, prediction unit size, motion information, and transformation unit size to provide high coding efficiency. Distortion optimization can be used.

- 율-왜곡 최적화 방식은 상기의 조합들 중에서 최적의 조합을 선택하기 위해 각 조합의 율-왜곡 비용(rate-distortion cost)을 계산할 수 있다. 율-왜곡 비용은 수식 "D+λ*R"을 이용하여 계산될 수 있다. 일반적으로 수식 "D+λ*R"에 의한 율-왜곡 비용이 최소가 되는 조합이 율-왜곡 최적화 방식에 있어서의 최적의 조합으로 선택될 수 있다.- The rate-distortion optimization method can calculate the rate-distortion cost of each combination to select the optimal combination among the above combinations. The rate-distortion cost can be calculated using the formula “D+λ*R”. In general, the combination that minimizes the rate-distortion cost according to the formula "D+λ*R" can be selected as the optimal combination in the rate-distortion optimization method.

- D는 왜곡을 나타낼 수 있다. D는 변환 유닛 내에서 원래의 변환 계수들 및 재구축된 변환 계수들 간의 차이 값들의 제곱들의 평균(mean square error)일 수 있다.- D may indicate distortion. D may be the mean square error of the difference values between the original transform coefficients and the reconstructed transform coefficients within the transform unit.

- R은 율을 나타낼 수 있다. R은 관련된 문맥 정보를 이용한 비트 율을 나타낼 수 있다.- R can represent a rate. R can represent the bit rate using related context information.

- λ는 라그랑지안 승수(Lagrangian multiplier)를 나타낼 수 있다. R은 예측 모드, 움직임 정보 및 코드된 블록 플래그(coded block flag) 등과 같은 코딩 파라미터 정보뿐만 아니라, 변환 계수의 부호화에 의해 발생하는 비트도 포함할 수 있다.- λ may represent a Lagrangian multiplier. R may include not only coding parameter information such as prediction mode, motion information, and coded block flag, but also bits generated by encoding of transform coefficients.

- 부호화 장치는 정확한 D 및 R을 계산하기 위해 인터 예측, 인트라 예측, 변환, 양자화, 엔트로피 부호화, 역양자화 및/또는 역변환 등의 과정들을 수행할 수 있다. 이러한 과정들은 부호화 장치에서의 복잡도를 크게 증가시킬 수 있다.- The encoding device may perform processes such as inter prediction, intra prediction, transformation, quantization, entropy coding, inverse quantization, and/or inverse transformation to calculate accurate D and R. These processes can greatly increase the complexity of the encoding device.

비트스트림(bitstream): 비트스트림은 부호화된 영상 정보를 포함하는 비트의 열을 의미할 수 있다.Bitstream: A bitstream may refer to a string of bits containing encoded image information.

파싱(parsing): 파싱은 비트스트림을 엔트로피 복호화하여 신택스 요소(syntax element)의 값을 결정하는 것을 의미할 수 있다. 또는, 파싱은 엔트로피 복호화 자체를 의미할 수 있다.Parsing: Parsing may mean entropy decoding a bitstream to determine the value of a syntax element. Alternatively, parsing may mean entropy decoding itself.

심볼(symbol): 부호화 대상 유닛 및/또는 복호화 대상 유닛의 신택스 요소, 코딩 파라미터(coding parameter) 및 변환 계수(transform coefficient) 등 중 적어도 하나를 의미할 수 있다. 또한, 심볼은 엔트로피 부호화의 대상 또는 엔트로피 복호화의 결과를 의미할 수 있다.Symbol: May refer to at least one of a syntax element, a coding parameter, and a transform coefficient of an encoding target unit and/or a decoding target unit. Additionally, a symbol may mean the object of entropy encoding or the result of entropy decoding.

참조 픽처(reference picture): 참조 픽처는 인터 예측 또는 움직임 보상을 위하여 유닛이 참조하는 영상을 의미할 수 있다. 또는, 참조 픽처는 인터 예측 또는 움직임 보상을 위해 대상 유닛이 참조하는 참조 유닛을 포함하는 영상일 수 있다.Reference picture: A reference picture may refer to an image that a unit refers to for inter prediction or motion compensation. Alternatively, the reference picture may be an image that includes a reference unit referenced by the target unit for inter prediction or motion compensation.

이하, 용어 "참조 픽처" 및 "참조 영상"은 동일한 의미로 사용될 수 있으며, 서로 교체되어 사용될 수 있다.Hereinafter, the terms “reference picture” and “reference image” may be used with the same meaning and may be used interchangeably.

참조 픽처 리스트(reference picture list): 참조 픽처 리스트는 인터 예측 또는 움직임 보상에 사용되는 하나 이상의 참조 영상들을 포함하는 리스트일 수 있다.Reference picture list: A reference picture list may be a list containing one or more reference pictures used for inter prediction or motion compensation.

- 참조 픽처 리스트의 타입은 리스트 조합(List Combined; LC), 리스트 0(List 0; L0), 리스트 1(List 1; L1), 리스트 2(List 2; L2) 및 리스트 3(List 3; L3) 등이 있을 수 있다.- The types of reference picture lists are List Combined (LC), List 0 (L0), List 1 (L1), List 2 (L2), and List 3 (List 3; L3). ), etc.

- 인터 예측에는 하나 이상의 참조 픽처 리스트들이 사용될 수 있다.- One or more reference picture lists can be used in inter prediction.

인터 예측 지시자(inter prediction indicator): 인터 예측 지시자는 대상 유닛에 대한 인터 예측의 방향을 가리킬 수 있다. 인터 예측은 단방향 예측 및 양방향 예측 등 중 하나일 수 있다. 또는, 인터 예측 지시자는 대상 유닛의 예측 유닛을 생성할 때 사용되는 참조 픽처의 개수를 나타낼 수 있다. 또는, 인터 예측 지시자는 대상 유닛에 대한 인터 예측 혹은 움직임 보상을 위해 사용되는 예측 블록의 개수를 의미할 수 있다.Inter prediction indicator: The inter prediction indicator may indicate the direction of inter prediction for the target unit. Inter prediction can be either one-way prediction or two-way prediction. Alternatively, the inter prediction indicator may indicate the number of reference pictures used when generating a prediction unit of the target unit. Alternatively, the inter prediction indicator may mean the number of prediction blocks used for inter prediction or motion compensation for the target unit.

예측 리스트 활용 플래그(prediction list utilization flag): 예측 리스트 활용 플래그는 특정한 참조 픽처 리스트 내의 적어도 하나의 참조 픽처를 사용하여 예측 유닛을 생성하는지 여부를 나타낼 수 있다.Prediction list utilization flag: The prediction list utilization flag may indicate whether a prediction unit is generated using at least one reference picture in a specific reference picture list.

- 예측 리스트 활용 플래그를 사용하여 인터 예측 지시자가 도출될 수 있다. 반대로, 인터 예측 지시자를 사용하여 예측 리스트 활용 플래그가 도출될 수 있다. 예를 들면, 예측 리스트 활용 플래그가 제1 값인 0을 지시하는 것은, 대상 유닛에 대하여, 참조 픽처 리스트 내의 참조 픽처를 사용하여 예측 블록이 생성되지 않는 것을 나타낼 수 있다. 예측 리스트 활용 플래그가 제2 값인 1을 지시하는 것은, 대상 유닛에 대하여, 참조 픽처 리스트를 이용하여 예측 유닛이 생성되는 것을 나타낼 수 있다.- An inter prediction indicator can be derived using the prediction list utilization flag. Conversely, the prediction list utilization flag can be derived using the inter prediction indicator. For example, when the prediction list utilization flag indicates the first value of 0, it may indicate that a prediction block is not generated using a reference picture in the reference picture list for the target unit. When the prediction list utilization flag indicates a second value of 1, it may indicate that a prediction unit is generated using a reference picture list for the target unit.

참조 픽처 인덱스(reference picture index): 참조 픽처 인덱스는 참조 픽처 리스트에서 특정 참조 픽처를 지시하는 인덱스일 수 있다.Reference picture index: The reference picture index may be an index that indicates a specific reference picture in the reference picture list.

픽처 오더 카운트(Picture Order Count; POC): 픽처의 POC는 픽처의 디스플레이 순서를 나타낼 수 있다.Picture Order Count (POC): The POC of a picture may indicate the display order of the picture.

움직임 벡터(Motion Vector; MV): 움직임 벡터는 인터 예측 또는 움직임 보상에서 사용되는 2차원의 벡터일 수 있다. 움직임 벡터는 대상 영상 및 참조 영상 간의 오프셋을 의미할 수 있다.Motion Vector (MV): A motion vector may be a two-dimensional vector used in inter prediction or motion compensation. A motion vector may mean an offset between a target image and a reference image.

- 예를 들면, MV는 (mvx, mvy)와 같은 형태로 표현될 수 있다. mvx는 수평(horizontal) 성분을 나타낼 수 있고, mvy는 수직(vertical) 성분을 나타낼 수 있다.- For example, MV can be expressed in the form (mv x , mv y ). mv x can represent the horizontal component, and mv y can represent the vertical component.

탐색 영역(search range): 탐색 영역은 인터 예측 중 MV에 대한 탐색이 이루어지는 2차원의 영역일 수 있다. 예를 들면, 탐색 영역의 크기는 MxN일 수 있다. M 및 N은 각각 양의 정수일 수 있다.Search range: The search range may be a two-dimensional area where a search for MV is performed during inter prediction. For example, the size of the search area may be MxN. M and N can each be positive integers.

움직임 벡터 후보(motion vector candidate): 움직임 벡터 후보는 움직임 벡터를 예측할 때 예측 후보인 블록 혹은 예측 후보인 블록의 움직임 벡터를 의미할 수 있다. Motion vector candidate: A motion vector candidate may refer to a block that is a prediction candidate or a motion vector of a block that is a prediction candidate when predicting a motion vector.

- 움직임 벡터 후보는 움직임 벡터 후보 리스트에 포함될 수 있다.- The motion vector candidate may be included in the motion vector candidate list.

움직임 벡터 후보 리스트(motion vector candidate list): 움직임 벡터 후보 리스트는 하나 이상의 움직임 벡터 후보들을 이용하여 구성된 리스트를 의미할 수 있다.Motion vector candidate list: The motion vector candidate list may refer to a list constructed using one or more motion vector candidates.

움직임 벡터 후보 인덱스(motion vector candidate index): 움직임 벡터 후보 인덱스는 움직임 벡터 후보 리스트 내의 움직임 벡터 후보를 가리키는 지시자를 의미할 수 있다. 또는, 움직임 벡터 후보 인덱스는 움직임 벡터 예측기(motion vector predictor)의 인덱스(index)일 수 있다.Motion vector candidate index: The motion vector candidate index may refer to an indicator indicating a motion vector candidate in the motion vector candidate list. Alternatively, the motion vector candidate index may be the index of a motion vector predictor.

움직임 정보(motion information): 움직임 정보는 움직임 벡터, 참조 픽처 인덱스 및 인터 예측 지시자(inter prediction indicator) 뿐만 아니라 참조 픽처 리스트 정보, 참조 영상, 움직임 벡터 후보, 움직임 벡터 후보 인덱스, 머지 후보 및 머지 인덱스 등 중 적어도 하나를 포함하는 정보를 의미할 수 있다.Motion information: Motion information includes motion vectors, reference picture indices, and inter prediction indicators, as well as reference picture list information, reference pictures, motion vector candidates, motion vector candidate indices, merge candidates, and merge indices. It may mean information containing at least one of the following.

머지 후보 리스트(merge candidate list): 머지 후보 리스트는 하나 이상의 머지 후보들을 이용하여 구성된 리스트를 의미할 수 있다.Merge candidate list: The merge candidate list may refer to a list constructed using one or more merge candidates.

머지 후보(merge candidate): 머지 후보는 공간적 머지 후보, 시간적 머지 후보, 조합된 머지 후보, 조합 양예측(combined bi-prediction) 머지 후보, 히스토리에 기반한 후보, 2 개의 후보들의 평균에 기반한 후보 및 제로 머지 후보 등을 의미할 수 있다. 머지 후보는 인터 예측 지시자를 포함할 수 있고, 각 리스트에 대한 참조 픽처 인덱스, 움직임 벡터, 예측 리스트 활용 플래그 및 인터 예측 지시자 등의 움직임 정보를 포함할 수 있다.Merge candidates: Merge candidates include spatial merge candidates, temporal merge candidates, combined merge candidates, combined bi-prediction merge candidates, candidates based on history, candidates based on the average of two candidates, and zero. It may mean a merge candidate, etc. The merge candidate may include an inter prediction indicator and may include motion information such as a reference picture index for each list, a motion vector, a prediction list utilization flag, and an inter prediction indicator.

머지 인덱스(merge index): 머지 인덱스는 머지 후보 리스트 내의 머지 후보를 가리키는 지시자일 수 있다.Merge index: The merge index may be an indicator pointing to a merge candidate in the merge candidate list.

- 머지 인덱스는 대상 유닛에 공간적으로 인접한 재구축된 유닛 및 대상 유닛에 시간적으로 인접한 재구축된 유닛 중 머지 후보를 유도한 재구축된 유닛을 지시할 수 있다.- The merge index may indicate the reconstructed unit that derived the merge candidate among the reconstructed units that are spatially adjacent to the target unit and the reconstructed units that are temporally adjacent to the target unit.

- 머지 인덱스는 머지 후보의 움직임 정보들 중 적어도 하나를 지시할 수 있다.- The merge index may indicate at least one of the motion information of the merge candidate.

변환 유닛(transform unit): 변환 유닛은 변환, 역변환, 양자화, 역양자화, 변환 계수 부호화 및 변환 계수 복호화 등과 같은 잔차 신호(residual signal) 부호화 및/또는 잔차 신호 복호화에 있어서의 기본 유닛일 수 있다. 하나의 변환 유닛은 더 작은 크기를 갖는 복수의 하위 변환 유닛들로 분할될 수 있다. 여기에서, 변환은 1차 변환 및 2차 변환 중 하나 이상을 포함할 수 있고, 역변환은 1차 역변환 및 2차 역변환 중 하나 이상을 포함할 수 있다.Transform unit: A transform unit may be a basic unit in residual signal coding and/or residual signal decoding, such as transform, inverse transform, quantization, inverse quantization, transform coefficient coding, and transform coefficient decoding. One transformation unit may be divided into a plurality of sub-transformation units with smaller sizes. Here, the transformation may include one or more of a first-order transformation and a second-order transformation, and the inverse transformation may include one or more of a first-order inversion and a second-order inversion.

스케일링(scaling): 스케일링은 변환 계수 레벨에 인수를 곱하는 과정을 의미할 수 있다. Scaling: Scaling may refer to the process of multiplying the transform coefficient level by a factor.

- 변환 계수 레벨에 대한 스케일링의 결과로서, 변환 계수가 생성될 수 있다. 스케일링은 역양자화(dequantization)로 칭해질 수도 있다.- As a result of scaling to the transform coefficient level, a transform coefficient can be generated. Scaling may also be referred to as dequantization.

양자화 파라미터(Quantization Parameter; QP): 양자화 파라미터는 양자화에서 변환 계수에 대해 변환 계수 레벨(transform coefficient level)을 생성할 때 사용되는 값을 의미할 수 있다. 또는, 양자화 파라미터는 역양자화에서 변환 계수 레벨을 스케일링(scaling)함으로써 변환 계수를 생성할 때 사용되는 값을 의미할 수도 있다. 또는, 양자화 파라미터는 양자화 스탭 크기(step size)에 매핑된 값일 수 있다.Quantization Parameter (QP): A quantization parameter may refer to a value used when generating a transform coefficient level for a transform coefficient in quantization. Alternatively, the quantization parameter may refer to a value used when generating a transform coefficient by scaling the transform coefficient level in dequantization. Alternatively, the quantization parameter may be a value mapped to the quantization step size.

델타 양자화 파라미터(delta quantization parameter): 델타 양자화 파라미터는 예측된 양자화 파라미터 및 대상 유닛의 양자화 파라미터의 차분(difference) 값을 의미할 수 있다.Delta quantization parameter: The delta quantization parameter may mean the difference between the predicted quantization parameter and the quantization parameter of the target unit.

스캔(scan): 스캔은 유닛, 블록 또는 행렬 내의 계수들의 순서를 정렬하는 방법을 의미할 수 있다. 예를 들면, 2차원 배열을 1차원 배열 형태로 정렬하는 것을 스캔이라고 칭할 수 있다. 또는, 1차원 배열을 2차원 배열 형태로 정렬하는 것도 스캔 또는 역 스캔(inverse scan)이라고 칭할 수 있다.Scan: Scan can refer to a method of sorting the order of coefficients within a unit, block, or matrix. For example, sorting a two-dimensional array into a one-dimensional array can be called scanning. Alternatively, arranging a one-dimensional array into a two-dimensional array can also be referred to as a scan or inverse scan.

변환 계수(transform coefficient): 변환 계수는 부호화 장치에서 변환을 수행함에 따라 생성된 계수 값일 수 있다. 또는, 변환 계수는 복호화 장치에서 엔트로피 복호화 및 역양자화 중 적어도 하나를 수행함에 따라 생성된 계수 값일 수 있다. Transform coefficient: The transform coefficient may be a coefficient value generated as the encoding device performs transformation. Alternatively, the transformation coefficient may be a coefficient value generated as the decoding device performs at least one of entropy decoding and inverse quantization.

- 변환 계수 또는 잔차 신호에 양자화를 적용함으로써 생성된 양자화된 레벨 또는 양자화된 변환 계수 레벨 또한 변환 계수의 의미에 포함될 수 있다.- Quantized levels or quantized transform coefficient levels generated by applying quantization to the transform coefficient or residual signal may also be included in the meaning of the transform coefficient.

양자화된 레벨(quantized level): 양자화된 레벨은 부호화 장치에서 변환 계수 또는 잔차 신호에 양자화를 수행함으로써 생성된 값을 의미할 수 있다. 또는, 양자화된 레벨은 복호화 장치에서 역양자화를 수행함에 있어서 역양자화의 대상이 되는 값을 의미할 수도 있다.Quantized level: A quantized level may refer to a value generated by performing quantization on a transform coefficient or residual signal in an encoding device. Alternatively, the quantized level may mean a value that is the target of inverse quantization when performing inverse quantization in a decoding device.

- 변환 및 양자화의 결과인 양자화된 변환 계수 레벨도 양자화된 레벨의 의미에 포함될 수 있다.- The quantized transform coefficient level, which is the result of transformation and quantization, can also be included in the meaning of the quantized level.

비-제로 변환 계수(non-zero transform coefficient): 비-제로 변환 계수는 0이 아닌 값을 갖는 변환 계수 또는 0이 아닌 값을 갖는 변환 계수 레벨을 의미할 수 있다. 또는, 비-제로 변환 계수는 값의 크기가 0이 아닌 변환 계수 또는 값의 크기가 0이 아닌 변환 계수 레벨을 의미할 수 있다.Non-zero transform coefficient: A non-zero transform coefficient may mean a transform coefficient with a non-zero value or a transform coefficient level with a non-zero value. Alternatively, a non-zero transform coefficient may mean a transform coefficient whose value size is not 0 or a transform coefficient level whose value size is not 0.

양자화 행렬(quantization matrix): 양자화 행렬은 영상의 주관적 화질 또는 객관적 화질을 향상시키기 위해서 양자화 과정 또는 역양자화 과정에서 이용되는 행렬을 의미할 수 있다. 양자화 행렬은 스케일링 리스트(scaling list)라고도 칭해질 수 있다.Quantization matrix: A quantization matrix may refer to a matrix used in a quantization process or dequantization process to improve the subjective or objective image quality of an image. The quantization matrix may also be referred to as a scaling list.

양자화 행렬 계수(quantization matrix coefficient): 양자화 행렬 계수는 양자화 행렬 내의 각 원소(element)를 의미할 수 있다. 양자화 행렬 계수는 행렬 계수(matrix coefficient)라고도 칭해질 수 있다.Quantization matrix coefficient: The quantization matrix coefficient may refer to each element in the quantization matrix. Quantization matrix coefficients may also be referred to as matrix coefficients.

디폴트 행렬(default matrix): 디폴트 행렬은 부호화 장치 및 복호화 장치에서 기정의된 양자화 행렬일 수 있다.Default matrix: The default matrix may be a quantization matrix predefined in the encoding device and the decoding device.

비-디폴트 행렬(non-default matrix): 비-디폴트 행렬은 부호화 장치 및 복호화 장치에서 기정의되어 있지 않은 양자화 행렬일 수 있다. 비-디폴트 행렬은 사용자에 의해서 부호화 장치로부터 복호화 장치로 시그널링되는 양자화 행렬을 의미할 수 있다.Non-default matrix: A non-default matrix may be a quantization matrix that is not predefined in the encoding device and the decoding device. A non-default matrix may refer to a quantization matrix signaled by a user from an encoding device to a decoding device.

가장 가능성있는 모드(Most Probable Mode; MPM): MPM은 대상 블록의 인트라 예측을 위해 사용될 가능성이 높은 인트라 예측 모드를 나타낼 수 있다.Most Probable Mode (MPM): MPM may indicate an intra prediction mode that is likely to be used for intra prediction of the target block.

- 부호화 장치 및 복호화 장치는 대상 블록에 관련된 코딩 파라미터 및 대상 블록에 관련된 개체의 속성에 기반하여 하나 이상의 MPM들을 결정할 수 있다.- The encoding device and the decoding device may determine one or more MPMs based on coding parameters related to the target block and properties of entities related to the target block.

- 부호화 장치 및 복호화 장치는 참조 블록의 인트라 예측 모드에 기반하여 하나 이상의 MPM들을 결정할 수 있다. 참조 블록은 복수일 수 있다. 복수의 참조 블록들은 대상 블록의 좌측에 인접한 공간적 이웃 블록 및 대상 블록의 상단에 인접한 공간적 이웃 블록을 포함할 수 있다. 말하자면, 참조 블록들에 대하여 어떠한 인트라 예측 모드들이 사용되었는가에 따라서 서로 다른 하나 이상의 MPM들이 결정될 수 있다.- The encoding device and the decoding device may determine one or more MPMs based on the intra prediction mode of the reference block. There may be multiple reference blocks. The plurality of reference blocks may include a spatial neighboring block adjacent to the left of the target block and a spatial neighboring block adjacent to the top of the target block. In other words, one or more different MPMs may be determined depending on which intra prediction modes are used for the reference blocks.

- 하나 이상의 MPM들은 부호화 장치 및 복호화 장치에서 동일한 방식으로 결정될 수 있다. 말하자면, 부호화 장치 및 복호화 장치는 동일한 하나 이상의 MPM들을 포함하는 MPM 리스트를 공유할 수 있다.- One or more MPMs can be determined in the same way in the encoding device and the decoding device. In other words, the encoding device and the decoding device may share an MPM list containing the same one or more MPMs.

MPM 리스트: MPM 리스트는 하나 이상의 MPM들을 포함하는 리스트일 수 있다. MPM 리스트 내의 하나 이상의 MPM들의 개수는 기정의될 수 있다.MPM list: The MPM list may be a list containing one or more MPMs. The number of one or more MPMs in the MPM list may be predefined.

MPM 지시자: MPM 지시자는 MPM 리스트의 하나 이상의 MPM들 중 대상 블록의 인트라 예측을 위해 사용되는 MPM을 지시할 수 있다. 예를 들면, MPM 지시자는 MPM 리스트에 대한 인덱스일 수 있다.MPM indicator: The MPM indicator may indicate the MPM used for intra prediction of the target block among one or more MPMs in the MPM list. For example, the MPM indicator may be an index to the MPM list.

- MPM 리스트는 부호화 장치 및 복호화 장치에서 동일한 방식으로 결정되기 때문에 MPM 리스트 자체는 부호화 장치로부터 복호화 장치로 전송될 필요가 없을 수 있다.- Since the MPM list is determined in the same way in the encoding device and the decoding device, the MPM list itself may not need to be transmitted from the encoding device to the decoding device.

- MPM 지시자는 부호화 장치로부터 복호화 장치로 시그널링될 수 있다. MPM 지시자가 시그널링됨에 따라 복호화 장치는 MPM 리스트의 MPM들 중 대상 블록에 대한 인트라 예측을 위해 사용될 MPM을 결정할 수 있다.- The MPM indicator can be signaled from the encoding device to the decoding device. As the MPM indicator is signaled, the decoding device can determine the MPM to be used for intra prediction for the target block among the MPMs in the MPM list.

MPM 사용 지시자: MPM 사용 지시자는 대상 블록에 대한 예측을 위해 MPM 사용 모드가 사용될지 여부를 지시할 수 있다. MPM 사용 모드는 MPM 리스트를 사용하여 대상 블록에 대한 인트라 예측을 위해 사용될 MPM을 결정하는 모드일 수 있다.MPM usage indicator: The MPM usage indicator may indicate whether the MPM usage mode will be used for prediction of the target block. The MPM use mode may be a mode that uses the MPM list to determine the MPM to be used for intra prediction for the target block.

- MPM 사용 지시자는 부호화 장치로부터 복호화 장치로 시그널링될 수 있다.- The MPM use indicator can be signaled from the encoding device to the decoding device.

시그널링: 시그널링은 정보가 부호화 장치로부터 복호화 장치로 전송되는 것을 나타낼 수 있다. 또는, 시그널링은 부호화 장치가 정보를 비트스트림 또는 기록 매체 내에 포함시키는 것을 의미할 수 있다. 부호화 장치에 의해 시그널링된 정보는 복호화 장치에 의해 사용될 수 있다.Signaling: Signaling may indicate that information is transmitted from an encoding device to a decoding device. Alternatively, signaling may mean that an encoding device includes information in a bitstream or recording medium. Information signaled by the encoding device can be used by the decoding device.

- 부호화 장치는 시그널링되는 정보에 대한 부호화를 수행하여 부호화된 정보를 생성할 수 있다. 부호화된 정보는 부호화 장치로부터 복호화 장치로 전송될 수 있다. 복호화 장치는 전송된 부호화된 정보에 대한 복호화를 수행하여 정보를 획득할 수 있다. 여기에서, 부호화는 엔트로피 부호화일 수 있고, 복호화는 엔트로피 복호화일 수 있다.- The encoding device can generate encoded information by performing encoding on the signaled information. Encoded information can be transmitted from an encoding device to a decoding device. The decoding device can obtain information by performing decoding on the transmitted encoded information. Here, the encoding may be entropy encoding, and the decoding may be entropy decoding.

선택적인 시그널링: 정보는 선택적으로 시그널링될 수 있다. 정보에 대한 선택적인 시그널링은 부호화 장치가 정보를 (특정 조건에 따라) 선택적으로 비트스트림 또는 기록 매체 내에 포함시키는 것을 의미할 수 있다. 정보에 대한 선택적인 시그널링은 복호화 장치가 정보를 (특정 조건에 따라) 선택적으로 비트스트림으로부터 추출하는 것을 의미할 수 있다.Selective signaling: Information can be signaled selectively. Selective signaling of information may mean that an encoding device selectively includes information (according to certain conditions) within a bitstream or recording medium. Selective signaling of information may mean that the decoding device selectively extracts information from the bitstream (according to specific conditions).

시그널링의 생략: 정보에 대한 시그널링은 생략될 수 있다. 정보에 대한 정보에 대한 시그널링의 생략은 부호화 장치가 (특정 조건에 따라)정보를 비트스트림 또는 기록 매체 내에 포함시키지 않는 것을 의미할 수 있다. 정보에 대한 시그널링의 생략은 복호화 장치가 (특정 조건에 따라) 정보를 비트스트림으로부터 추출하지 않는 것을 의미할 수 있다.Omission of signaling: Signaling of information may be omitted. Omission of signaling about information may mean that the encoding device does not include the information (depending on certain conditions) in the bitstream or recording medium. Omission of signaling for information may mean that the decoding device does not extract information from the bitstream (according to certain conditions).

통계 값(statistic value): 변수, 코딩 파라미터 및 상수 등은 연산될 수 있는 값을 가질 수 있다. 통계 값은 이러한 특정된 대상들의 값들에 대한 연산에 의해 생성된 값일 수 있다. 예를 들면, 통계 값은 특정된 변수, 특정된 코딩 파라미터 및 특정된 상수 등의 값들에 대한 평균 값, 가중치가 부여된(weighted) 평균 값, 가중치가 부여된 합, 최소 값, 최대 값, 최빈 값, 중간 값 및 보간 값 중 하나 이상일 수 있다.Statistical value: Variables, coding parameters, constants, etc. can have values that can be operated on. The statistical value may be a value generated by an operation on the values of these specified objects. For example, a statistical value may be the average value, weighted average value, weighted sum, minimum value, maximum value, mode, etc. for values of specified variables, specified coding parameters, and specified constants. Can be one or more of values, intermediate values, and interpolated values.

도 1은 본 발명이 적용되는 부호화 장치의 일 실시예에 따른 구성을 나타내는 블록도이다.1 is a block diagram showing the configuration of an encoding device to which the present invention is applied according to an embodiment.

부호화 장치(100)는 인코더, 비디오 부호화 장치 또는 영상 부호화 장치일 수 있다. 비디오는 하나 이상의 영상들을 포함할 수 있다. 부호화 장치(100)는 비디오의 하나 이상의 영상들을 순차적으로 부호화할 수 있다.The encoding device 100 may be an encoder, a video encoding device, or an image encoding device. A video may contain one or more images. The encoding device 100 may sequentially encode one or more images of a video.

도 1을 참조하면, 부호화 장치(100)는 인터 예측부(110), 인트라 예측부(120), 스위치(115), 감산기(125), 변환부(130), 양자화부(140), 엔트로피 부호화부(150), 역양자화부(160), 역변환부(170), 가산기(175), 필터부(180) 및 참조 픽처 버퍼(190)를 포함할 수 있다.Referring to FIG. 1, the encoding device 100 includes an inter prediction unit 110, an intra prediction unit 120, a switch 115, a subtractor 125, a transform unit 130, a quantization unit 140, and an entropy encoding unit. It may include a unit 150, an inverse quantization unit 160, an inverse transform unit 170, an adder 175, a filter unit 180, and a reference picture buffer 190.

부호화 장치(100)는 인트라 모드 및/또는 인터 모드를 사용하여 대상 영상에 대한 부호화를 수행할 수 있다. 말하자면, 대상 블록에 대한 예측 모드는 인트라 모드 및 인터 모드 중 하나일 수 있다.The encoding device 100 may perform encoding on the target image using intra mode and/or inter mode. In other words, the prediction mode for the target block may be one of intra mode and inter mode.

이하에서, 용어들 "인트라 모드", "인트라 예측 모드", "화면 내 모드" 및 "화면 내 예측 모드"는 동일한 의미로 사용될 수 있으며, 서로 교체되어 사용될 수 있다.Hereinafter, the terms “intra mode”, “intra prediction mode”, “intra-picture mode” and “intra-picture prediction mode” may be used with the same meaning and may be used interchangeably.

이하에서, 용어들 "인터 모드", "인터 예측 모드", "화면 간 모드" 및 "화면 간 예측 모드"는 동일한 의미로 사용될 수 있으며, 서로 교체되어 사용될 수 있다.Hereinafter, the terms “inter mode”, “inter prediction mode”, “inter-screen mode”, and “inter-screen prediction mode” may be used with the same meaning and may be used interchangeably.

이하에서, 용어 "영상"은 단지 영상의 일부를 가리킬 수 있으며, 블록을 가리킬 수 있다. 또한, "영상"에 대한 처리는 복수의 블록들에 대한 순차적인 처리를 나타낼 수 있다.Hereinafter, the term “image” may refer only to a portion of an image or may refer to a block. Additionally, processing of “image” may represent sequential processing of a plurality of blocks.

또한, 부호화 장치(100)는 대상 영상에 대한 부호화를 통해 부호화된 정보를 포함하는 비트스트림을 생성할 수 있고, 생성된 비트스트림을 출력 및 저장할 수 있다. 생성된 비트스트림은 컴퓨터 판독가능한 기록 매체에 저장될 수 있고, 유선 및/또는 무선 전송 매체를 통해 스트리밍될 수 있다.Additionally, the encoding device 100 can generate a bitstream including encoded information through encoding of a target image, and output and store the generated bitstream. The generated bitstream may be stored in a computer-readable recording medium and streamed through wired and/or wireless transmission media.

예측 모드로서, 인트라 모드가 사용되는 경우, 스위치(115)는 인트라로 전환될 수 있다. 예측 모드로서, 인터 모드가 사용되는 경우, 스위치(115)는 인터로 전환될 수 있다.As the prediction mode, if intra mode is used, switch 115 can be switched to intra. As the prediction mode, if the inter mode is used, the switch 115 can be switched to inter.

부호화 장치(100)는 대상 블록에 대한 예측 블록을 생성할 수 있다. 또한, 부호화 장치(100)는 예측 블록이 생성된 후, 대상 블록 및 예측 블록의 잔차(residual)를 사용하여 대상 블록에 대한 잔차 블록을 부호화할 수 있다.The encoding device 100 may generate a prediction block for the target block. Additionally, after the prediction block is generated, the encoding device 100 may encode the residual block for the target block using the residual of the target block and the prediction block.

예측 모드가 인트라 모드인 경우, 인트라 예측부(120)는 대상 블록의 이웃에 있는, 이미 부호화 및/또는 복호화된 블록의 픽셀을 참조 샘플로서 이용할 수 있다. 인트라 예측부(120)는 참조 샘플을 이용하여 대상 블록에 대한 공간적 예측을 수행할 수 있고, 공간적 예측을 통해 대상 블록에 대한 예측 샘플들을 생성할 수 있다. 예측 샘플은 예측 블록 내의 샘플을 의미할 수 있다.When the prediction mode is intra mode, the intra prediction unit 120 may use a pixel of a block that is already encoded and/or decoded, which is a neighbor of the target block, as a reference sample. The intra prediction unit 120 may perform spatial prediction for the target block using a reference sample and generate prediction samples for the target block through spatial prediction. A prediction sample may refer to a sample within a prediction block.

인터 예측부(110)는 움직임 예측부 및 움직임 보상부를 포함할 수 있다.The inter prediction unit 110 may include a motion prediction unit and a motion compensation unit.

예측 모드가 인터 모드인 경우, 움직임 예측부는, 움직임 예측 과정에서 참조 영상으로부터 대상 블록과 가장 매치가 잘 되는 영역을 검색할 수 있고, 검색된 영역을 이용하여 대상 블록 및 검색된 영역에 대한 움직임 벡터를 도출할 수 있다. 이 때, 움직임 예측부는 검색의 대상인 영역으로서 탐색 영역을 사용할 수 있다.When the prediction mode is inter mode, the motion prediction unit can search for the area that best matches the target block from the reference image during the motion prediction process, and use the searched area to derive motion vectors for the target block and the searched area. can do. At this time, the motion prediction unit may use the search area as the area that is the target of the search.

참조 영상은 참조 픽처 버퍼(190)에 저장될 수 있으며, 참조 영상에 대한 부호화 및/또는 복호화가 처리되었을 때 부호화 및/또는 복호화된 참조 영상은 참조 픽처 버퍼(190)에 저장될 수 있다.The reference image may be stored in the reference picture buffer 190, and when encoding and/or decoding of the reference image is processed, the encoded and/or decoded reference image may be stored in the reference picture buffer 190.

복호화된 픽처가 저장됨에 따라, 참조 픽처 버퍼(190)는 복호화된 픽처 버퍼(Decoded Picture Buffer; DPB)일 수 있다.As the decoded picture is stored, the reference picture buffer 190 may be a decoded picture buffer (DPB).

움직임 보상부는 움직임 벡터를 이용하는 움직임 보상을 수행함으로써 대상 블록에 대한 예측 블록을 생성할 수 있다. 여기에서, 움직임 벡터는 인터 예측에 사용되는 2차원 벡터일 수 있다. 또한 움직임 벡터는 대상 영상 및 참조 영상 간의 오프셋(offset)을 나타낼 수 있다.The motion compensation unit may generate a prediction block for the target block by performing motion compensation using a motion vector. Here, the motion vector may be a two-dimensional vector used for inter prediction. Additionally, the motion vector may indicate an offset between the target image and the reference image.

움직임 예측부 및 움직임 보상부는 움직임 벡터가 정수가 아닌 값을 가진 경우 참조 영상 내의 일부 영역에 대해 보간 필터(interpolation filter)를 적용함으로써 예측 블록을 생성할 수 있다. 인터 예측 또는 움직임 보상을 수행하기 위해, CU를 기준으로 CU에 포함된 PU의 움직임 예측 및 움직임 보상의 방법이 스킵 모드(skip mode), 머지 모드(merge mode), 향상된 움직임 벡터 예측(Advanced Motion Vector Prediction; AMVP) 모드 및 현재 픽처 참조 모드 중 어떠한 방법인지 여부가 판단될 수 있고, 각 모드에 따라 인터 예측 또는 움직임 보상이 수행될 수 있다.When the motion prediction unit and the motion compensation unit have a non-integer value, the motion prediction unit and the motion compensation unit may generate a prediction block by applying an interpolation filter to some areas in the reference image. In order to perform inter prediction or motion compensation, the methods of motion prediction and motion compensation of the PU included in the CU based on the CU include skip mode, merge mode, and advanced motion vector prediction. Prediction (AMVP) mode or the current picture reference mode can be determined, and inter prediction or motion compensation can be performed according to each mode.

감산기(125)는 대상 블록 및 예측 블록의 차분인 잔차 블록(residual block)을 생성할 수 있다. 잔차 블록은 잔차 신호로 칭해질 수도 있다.The subtractor 125 may generate a residual block, which is the difference between the target block and the prediction block. A residual block may also be referred to as a residual signal.

잔차 신호는 원 신호 및 예측 신호 간의 차이(difference)를 의미할 수 있다. 또는, 잔차 신호는 원신호 및 예측 신호 간의 차이를 변환(transform)하거나 양자화하거나 또는 변환 및 양자화함으로써 생성된 신호일 수 있다. 잔차 블록은 블록 단위에 대한 잔차 신호일 수 있다.The residual signal may refer to the difference between the original signal and the predicted signal. Alternatively, the residual signal may be a signal generated by transforming or quantizing, or transforming and quantizing, the difference between the original signal and the prediction signal. A residual block may be a residual signal on a block basis.

변환부(130)는 잔차 블록에 대해 변환(transform)을 수행하여 변환 계수를 생성할 수 있고, 생성된 변환 계수(transform coefficient)를 출력할 수 있다. 여기서, 변환 계수는 잔차 블록에 대한 변환을 수행함으로써 생성된 계수 값일 수 있다.The transform unit 130 may generate a transform coefficient by performing transformation on the residual block and output the generated transform coefficient. Here, the transformation coefficient may be a coefficient value generated by performing transformation on the residual block.

변환부(130)는 변환을 수행함에 있어서 기정의된 복수의 변환 방법들 중 하나를 사용할 수 있다.The conversion unit 130 may use one of a plurality of predefined conversion methods when performing conversion.

기정의된 복수의 변환 방법들은 이산 코사인 변환(Discrete Cosine Transform; DCT), 이산 사인 변환(Discrete Sine Transform; DST) 및 카루넨-루베 변환(Karhunen-Loeve Transform; KLT) 기반 변환 등을 포함할 수 있다.The plurality of predefined transformation methods may include Discrete Cosine Transform (DCT), Discrete Sine Transform (DST), and Karhunen-Loeve Transform (KLT) based transformation, etc. there is.

잔차 블록에 대한 변환을 위해 사용되는 변환 방법은 대상 블록 및/또는 이웃 블록에 대한 코딩 파라미터들 중 적어도 하나에 따라 결정될 수 있다. 예를 들면, 변환 방법은 PU에 대한 인터 예측 모드, PU에 대한 인트라 예측 모드, TU의 크기 및 TU의 형태 중 적어도 하나에 기반하여 결정될 수 있다. 또는, 변환 방법을 지시하는 변환 정보가 부호화 장치(100)로부터 복호화 장치(200)로 시그널링될 수도 있다.The transformation method used to transform the residual block may be determined according to at least one of coding parameters for the target block and/or the neighboring block. For example, the conversion method may be determined based on at least one of the inter prediction mode for the PU, the intra prediction mode for the PU, the size of the TU, and the shape of the TU. Alternatively, conversion information indicating a conversion method may be signaled from the encoding device 100 to the decoding device 200.

변환 스킵(transform skip) 모드가 적용되는 경우, 변환부(130)는 잔차 블록에 대한 변환을 생략할 수도 있다.When the transform skip mode is applied, the transform unit 130 may omit transforming the residual block.

변환 계수에 양자화를 적용함으로써 양자화된 변환 계수 레벨(transform coefficient level) 또는 양자화된 레벨이 생성될 수 있다. 이하, 실시예들에서는 양자화된 변환 계수 레벨 및 양자화된 레벨도 변환 계수로 칭해질 수 있다.A quantized transform coefficient level or quantized level can be generated by applying quantization to the transform coefficient. Hereinafter, in embodiments, the quantized transform coefficient level and the quantized level may also be referred to as transform coefficients.

양자화부(140)는 변환 계수를 양자화 파라미터에 맞춰 양자화함으로써 양자화된 변환 계수 레벨(quantized transform coefficient level)(말하자면, 양자화된 레벨 또는 양자화된 계수)를 생성할 수 있다. 양자화부(140)는 생성된 양자화된 변환 계수 레벨을 출력할 수 있다. 이때, 양자화부(140)에서는 양자화 행렬을 사용하여 변환 계수를 양자화할 수 있다.The quantization unit 140 may generate a quantized transform coefficient level (that is, a quantized level or a quantized coefficient) by quantizing the transform coefficient according to the quantization parameter. The quantization unit 140 may output the generated quantized transform coefficient level. At this time, the quantization unit 140 may quantize the transformation coefficient using a quantization matrix.

엔트로피 부호화부(150)는, 양자화부(140)에서 산출된 값들 및/또는 부호화 과정에서 산출된 코딩 파라미터 값들 등에 기초하여 확률 분포에 따른 엔트로피 부호화를 수행함으로써 비트스트림(bitstream)을 생성할 수 있다. 엔트로피 부호화부(150)는 생성된 비트스트림을 출력할 수 있다.The entropy encoding unit 150 may generate a bitstream by performing entropy encoding according to a probability distribution based on the values calculated by the quantization unit 140 and/or coding parameter values calculated during the encoding process. . The entropy encoding unit 150 may output the generated bitstream.

엔트로피 부호화부(150)는 영상의 픽셀에 관한 정보 및 영상의 복호화를 위한 정보에 대한 엔트로피 부호화를 수행할 수 있다. 예를 들면, 영상의 복호화를 위한 정보는 신택스 요소(syntax element) 등을 포함할 수 있다. The entropy encoding unit 150 may perform entropy encoding on information about pixels of an image and information for decoding the image. For example, information for decoding an image may include syntax elements, etc.

엔트로피 부호화가 적용되는 경우, 높은 발생 확률을 갖는 심볼에 적은 수의 비트가 할당될 수 있고, 낮은 발생 확률을 갖는 심볼에 많은 수의 비트가 할당될 수 있다. 이러한 할당을 통해 심볼이 표현됨에 따라, 부호화의 대상인 심볼들에 대한 비트열(bitstring)의 크기가 감소될 수 있다. 따라서, 엔트로피 부호화를 통해서 영상 부호화의 압축 성능이 향상될 수 있다. When entropy coding is applied, a small number of bits may be assigned to symbols with a high probability of occurrence, and a large number of bits may be assigned to symbols with a low probability of occurrence. As symbols are expressed through this allocation, the size of the bitstring for the symbols that are the target of encoding can be reduced. Therefore, the compression performance of video encoding can be improved through entropy coding.

또한, 엔트로피 부호화부(150)는 엔트로피 부호화를 위해 지수 골롬(exponential golomb), 문맥-적응형 가변 길이 코딩(Context-Adaptive Variable Length Coding; CAVLC) 및 문맥-적응형 이진 산술 코딩(Context-Adaptive Binary Arithmetic Coding; CABAC) 등과 같은 부호화 방법을 사용할 수 있다. 예를 들면, 엔트로피 부호화부(150)는 가변 길이 코딩(Variable Length Coding/Code; VLC) 테이블을 이용하여 엔트로피 부호화를 수행할 수 있다. 예를 들면, 엔트로피 부호화부(150)는 대상 심볼에 대한 이진화(binarization) 방법을 도출할 수 있다. 또한, 엔트로피 부호화부(150)는 대상 심볼/빈(bin)의 확률 모델(probability model)을 도출할 수 있다. 엔트로피 부호화부(150)는 도출된 이진화 방법, 확률 모델 및 문맥 모델(context model)을 사용하여 산술 부호화를 수행할 수도 있다.In addition, the entropy encoding unit 150 uses exponential golomb, context-adaptive variable length coding (CAVLC), and context-adaptive binary arithmetic coding for entropy encoding. Coding methods such as Arithmetic Coding (CABAC) can be used. For example, the entropy encoding unit 150 may perform entropy encoding using a Variable Length Coding/Code (VLC) table. For example, the entropy encoding unit 150 may derive a binarization method for the target symbol. Additionally, the entropy encoder 150 can derive a probability model of the target symbol/bin. The entropy encoding unit 150 may perform arithmetic encoding using the derived binarization method, probability model, and context model.

엔트로피 부호화부(150)는 양자화된 변환 계수 레벨을 부호화하기 위해 변환 계수 스캐닝(transform coefficient scanning) 방법을 통해 2차원의 블록의 형태(form)의 계수를 1차원의 벡터의 형태로 변경할 수 있다.The entropy encoder 150 can change the coefficients of the two-dimensional block form into the form of a one-dimensional vector through a transform coefficient scanning method to encode the quantized transform coefficient level.

코딩 파라미터는 부호화 및/또는 복호화를 위해 요구되는 정보일 수 있다. 코딩 파라미터는 부호화 장치(100)에서 부호화되어 부호화 장치(100)로부터 복호화 장치로 전달되는 정보를 포함할 수 있고, 부호화 혹은 복호화 과정에서 유도될 수 있는 정보를 포함할 수 있다. 예를 들면, 복호화 장치로 전달되는 정보로서, 신택스 요소가 있다.Coding parameters may be information required for encoding and/or decoding. The coding parameter may include information encoded in the encoding device 100 and transmitted from the encoding device 100 to the decoding device, and may include information that can be derived during the encoding or decoding process. For example, information transmitted to the decoding device includes syntax elements.

코딩 파라미터(coding parameter)는 신택스 요소와 같이 부호화 장치에서 부호화되고, 부호화 장치로부터 복호화 장치로 시그널링되는 정보(또는, 플래그 및 인덱스 등)뿐만 아니라, 부호화 과정 또는 복호화 과정에서 유도되는 정보를 포함할 수 있다. 또한, 코딩 파라미터는 영상을 부호화하거나 복호화함에 있어서 요구되는 정보를 포함할 수 있다. 예를 들면, 유닛/블록의 크기, 유닛/블록의 형태 유닛/블록의 깊이, 유닛/블록의 분할 정보, 유닛/블록의 분할 구조, 유닛/블록이 쿼드 트리 형태로 분할되는지 여부를 나타내는 정보, 유닛/블록이 이진 트리 형태로 분할되는지 여부를 나타내는 정보, 이진 트리 형태의 분할 방향(가로 방향 또는 세로 방향), 이진 트리 형태의 분할 형태(대칭 분할 또는 비대칭 분할), 유닛/블록이 삼진 트리 형태로 분할되는지 여부를 나타내는 정보, 삼진 트리 형태의 분할 방향(가로 방향 또는 세로 방향), 삼진 트리 형태의 분할 형태(대칭 분할 또는 비대칭 분할 등), 유닛/블록이 멀티-타입(multi-type) 트리 형태로 분할되는지 여부를 나타내는 정보, 멀티-타입 트리 형태의 분할의 조합 및 방향(가로 방향 또는 세로 방향 등), 멀티-타입 트리 형태의 분할의 분할 형태(대칭 분할 또는 비대칭 분할), 멀티-타입 트리 형태의 분할 트리(이진 트리 또는 삼진 트리), 예측 모드의 타입(인트라 예측 또는 인터 예측), 인트라 예측 모드/방향, 인트라 루마 예측 모드/방향, 인트라 크로마 예측 모드/방향, 인트라 분할 정보, 인터 분할 정보, 코딩 블록 분할 플래그, 예측 블록 분할 플래그, 변환 블록 분할 플래그, 참조 샘플 필터링 방법, 참조 샘플 필터 탭(tap), 참조 샘플 필터 계수, 예측 블록 필터링 방법, 예측 블록 필터 탭, 예측 블록 필터 계수, 예측 블록 경계 필터링 방법, 예측 블록 경계 필터 탭, 예측 블록 경계 필터 계수, 인터 예측 모드, 움직임 정보, 움직임 벡터, 움직임 벡터 차분, 참조 픽처 인덱스, 인터 예측 방향, 인터 예측 지시자, 예측 리스트 활용(utilization) 플래그, 참조 픽처 리스트, 참조 영상, POC, 움직임 벡터 예측기, 움직임 벡터 예측 인덱스, 움직임 벡터 예측 후보, 움직임 벡터 후보 리스트, 머지 모드를 사용하는지 여부를 나타내는 정보, 머지 인덱스, 머지 후보, 머지 후보 리스트, 스킵(skip) 모드를 사용하는지 여부를 나타내는 정보, 보간 필터의 타입, 보간 필터의 필터 탭, 보간 필터의 필터 계수, 움직임 벡터 크기, 움직임 벡터 표현 정확도, 변환 타입, 변환 크기, 1차 변환을 사용하는지 여부를 나타내는 정보, 추가(2차) 변환을 사용하는지 여부를 나타내는 정보, 1차 변환 선택 정보(또는, 1차 변환 인덱스), 2차 변환 선택 정보(또는, 2차 변환 인덱스), 잔차 신호의 유무를 나타내는 정보, 코드된 블록 패턴(coded block pattern), 코드된 블록 플래그(coded block flag), 양자화 파라미터, 잔차 양자화 파라미터, 양자화 행렬, 인트라-루프 필터에 대한 정보, 인트라-루프 필터를 적용하는지 여부를 나타내는 정보, 인트라-루프 필터의 계수, 인트라-루프의 필터 탭, 인트라 루프 필터의 모양(shape)/형태(form), 디블록킹 필터를 적용하는지 여부를 나타내는 정보, 디블록킹 필터의 계수, 디블록킹 필터의 필터 탭, 디블록킹 필터의 강도, 디블록킹 필터의 모양/형태, 적응적 샘플 오프셋을 적용하는지 여부를 나타내는 정보, 적응적 샘플 오프셋 값, 적응적 샘플 오프셋 카테고리, 적응적 샘플 오프셋 타입, 적응적 인-루프(in-loop) 필터를 적용하는지 여부를 나타내는 정보, 적응적 인-루프 필터의 계수, 적응적 인-루프 필터의 필터 탭, 적응적 인-루프 필터의 모양/형태, 이진화/역이진화 방법, 문맥 모델, 문맥 모델 결정 방법, 문맥 모델 업데이트 방법, 레귤러 모드를 수행하는지 여부를 나타내는 정보, 바이패스 모드를 수행하는지 여부를 나타내는 정보, 중요(significant) 계수 플래그, 마지막 중요 계수 플래그, 계수 그룹 단위 코딩 플래그, 마지막 중요 계수 위치, 계수 값이 1보다 더 큰지 여부를 나타내는 플래그, 계수 값이 2보다 더 큰지 여부를 나타내는 플래그, 계수 값이 3보다 더 큰지 여부를 나타내는 플래그, 나머지 계수 값 정보, 부호(sign) 정보, 재구축된 루마 샘플, 재구축된 크로마 샘플, 문맥 빈, 바이패스 빈, 잔차 루마 샘플, 잔차 크로마 샘플, 변환 계수, 루마 변환 계수, 크로마 변환 계수, 양자화된 레벨, 루마 양자화된 레벨, 크로마 양자화된 레벨, 변환 계수 레벨, 루마 변환 계수 레벨, 크로마 변환 계수 레벨, 변환 계수 레벨 스캐닝 방법, 복호화 장치의 측면에서의 움직임 벡터 탐색 영역의 크기, 복호화 장치의 측면에서의 움직임 벡터 탐색 영역의 형태, 복호화 장치의 측면에서의 움직임 벡터 탐색 횟수, CTU 크기,최소 블록 크기, 최대 블록 크기, 최대 블록 깊이, 최소 블록 깊이, 영상의 디스플레이/출력 순서, 슬라이스 식별 정보, 슬라이스 타입, 슬라이스 분할 정보, 타일 그룹 식별 정보, 타일 그룹 타입, 타일 그룹 분할 정보, 타일 식별 정보, 타일 타입, 타일 분할 정보, 픽처 타입, 비트 심도, 입력 샘플 비트 심도, 재구축된 샘플 비트 심도, 잔차 샘플 비트 심도, 변환 계수 비트 심도, 양자화된 레벨 비트 심도, 루마 신호에 대한 정보, 크로마 신호에 대한 정보, 대상 블록의 색 공간(color space) 및 잔차 블록의 색 공간 중 적어도 하나의 값, 조합된 형태 또는 통계가 코딩 파라미터에 포함될 수 있다. 또한, 전술된 코딩 파라미터에 관련된 정보도 코딩 파라미터에 포함될 수 있다. 전술된 코딩 파라미터를 계산 및/또는 유도하기 위해 사용되는 정보도 코딩 파라미터에 포함될 수 있다. 전술된 코딩 파라미터를 사용하여 계산 또는 유도되는 정보도 코딩 파라미터에 포함될 수 있다.Coding parameters are encoded in an encoding device, such as syntax elements, and may include information derived from the encoding process or decoding process, as well as information (or flags and indexes, etc.) signaled from the encoding device to the decoding device. there is. Additionally, coding parameters may include information required for encoding or decoding an image. For example, the size of the unit/block, the shape of the unit/block, the depth of the unit/block, the division information of the unit/block, the division structure of the unit/block, information indicating whether the unit/block is divided into a quad tree form, Information indicating whether the unit/block is split into a binary tree, the direction of the binary tree split (horizontal or vertical), the split type of the binary tree (symmetric split or asymmetric split), and whether the unit/block is split into a ternary tree. Information indicating whether the unit/block is divided into a ternary tree, the direction of division (horizontal or vertical), the division type of the ternary tree (symmetric division or asymmetric division, etc.), and whether the unit/block is a multi-type tree. Information indicating whether the division is divided in the form of a multi-type tree, combination and direction of the division in the multi-type tree form (horizontal or vertical direction, etc.), division type of the division in the multi-type tree form (symmetric division or asymmetric division), multi-type Splitting tree in the form of a tree (binary tree or ternary tree), type of prediction mode (intra prediction or inter prediction), intra prediction mode/direction, intra luma prediction mode/direction, intra chroma prediction mode/direction, intra splitting information, inter Segmentation information, coding block segmentation flag, prediction block segmentation flag, transformation block segmentation flag, reference sample filtering method, reference sample filter tab (tap), reference sample filter coefficient, prediction block filtering method, prediction block filter tab, prediction block filter coefficient , prediction block boundary filtering method, prediction block boundary filter tab, prediction block boundary filter coefficient, inter prediction mode, motion information, motion vector, motion vector difference, reference picture index, inter prediction direction, inter prediction indicator, prediction list utilization. ) Flag, reference picture list, reference image, POC, motion vector predictor, motion vector prediction index, motion vector prediction candidate, motion vector candidate list, information indicating whether merge mode is used, merge index, merge candidate, merge candidate list , information indicating whether skip mode is used, type of interpolation filter, filter tab of the interpolation filter, filter coefficient of the interpolation filter, motion vector size, motion vector expression accuracy, transformation type, transformation size, and first-order transformation. Information indicating whether to use, information indicating whether to use additional (secondary) transformation, primary transformation selection information (or primary transformation index), secondary transformation selection information (or secondary transformation index), residual Information indicating the presence or absence of a signal, coded block pattern, coded block flag, quantization parameter, residual quantization parameter, quantization matrix, information on intra-loop filter, intra-loop filter Information indicating whether to apply, coefficient of intra-loop filter, filter tab of intra-loop, shape/form of intra-loop filter, information indicating whether to apply deblocking filter, deblocking filter Coefficients, filter tab of deblocking filter, strength of deblocking filter, shape/form of deblocking filter, information indicating whether adaptive sample offset is applied, adaptive sample offset value, adaptive sample offset category, adaptive sample Offset type, information indicating whether to apply an adaptive in-loop filter, coefficients of the adaptive-loop filter, filter tab of the adaptive-loop filter, shape of the adaptive-loop filter/ Shape, binarization/debinarization method, context model, context model determination method, context model update method, information indicating whether regular mode is performed, information indicating whether bypass mode is performed, significant coefficient flag, and finally Significant coefficient flag, coefficient group unit coding flag, last significant coefficient position, flag indicating whether the coefficient value is greater than 1, flag indicating whether the coefficient value is greater than 2, flag indicating whether the coefficient value is greater than 3 , remaining coefficient value information, sign information, reconstructed luma sample, reconstructed chroma sample, context bin, bypass bin, residual luma sample, residual chroma sample, transformation coefficient, luma transformation coefficient, chroma transformation coefficient, Quantized level, luma quantized level, chroma quantized level, transform coefficient level, luma transform coefficient level, chroma transform coefficient level, transform coefficient level scanning method, size of motion vector search area on the side of the decoding device, size of the motion vector search area on the side of the decoding device Shape of motion vector search area on the side, number of motion vector searches on the side of the decoder, CTU size, minimum block size, maximum block size, maximum block depth, minimum block depth, video display/output order, slice identification information , slice type, slice division information, tile group identification information, tile group type, tile group division information, tile identification information, tile type, tile division information, picture type, bit depth, input sample bit depth, reconstructed sample bit depth. , at least one value of residual sample bit depth, transform coefficient bit depth, quantized level bit depth, information about luma signal, information about chroma signal, color space of target block, and color space of residual block, Combined forms or statistics may be included in coding parameters. Additionally, information related to the above-described coding parameters may also be included in the coding parameters. Information used to calculate and/or derive the coding parameters described above may also be included in the coding parameters. Information calculated or derived using the above-described coding parameters may also be included in the coding parameters.

1차 변환 선택 정보는 대상 블록에 적용되는 1차 변환을 나타낼 수 있다.Primary transformation selection information may indicate the primary transformation applied to the target block.

2차 변환 선택 정보는 대상 블록에 적용되는 2차 변환을 나타낼 수 있다.Secondary transformation selection information may indicate secondary transformation applied to the target block.

잔차 신호는 원 신호 및 예측 신호 간의 차분(difference)을 나타낼 수 있다. 또는, 잔차 신호는 원신호 및 예측 신호 간의 차분을 변환(transform)함으로써 생성된 신호일 수 있다. 또는, 잔차 신호는 원 신호 및 예측 신호 간의 차분을 변환 및 양자화함으로써 생성된 신호일 수 있다. 잔차 블록은 블록에 대한 잔차 신호일 수 있다.The residual signal may represent the difference between the original signal and the predicted signal. Alternatively, the residual signal may be a signal generated by transforming the difference between the original signal and the predicted signal. Alternatively, the residual signal may be a signal generated by converting and quantizing the difference between the original signal and the predicted signal. A residual block may be a residual signal for a block.

여기서, 정보를 시그널링(signaling)한다는 것은 부호화 장치(100)에서는 플래그 또는 인덱스에 대한 엔트로피 부호화(entropy encoding)를 수행함으로써 생성된 엔트로피 부호화된 정보를 비트스트림(Bitstream)에 포함시키는 것을 의미할 수 있고, 복호화 장치(200)에서는 비트스트림으로부터 추출된 엔트로피 부호화된 정보에 대한 엔트로피 복호화(entropy decoding)를 수행함으로써 정보를 획득하는 것을 의미할 수 있다. 여기에서, 정보는 플래그 및 인덱스 등을 포함할 수 있다.Here, signaling information may mean that the encoding device 100 includes entropy-encoded information generated by performing entropy encoding on a flag or index in a bitstream. , this may mean that the decoding device 200 obtains information by performing entropy decoding on entropy-encoded information extracted from the bitstream. Here, the information may include flags and indexes.

신호는 시그널링되는 정보를 의미할 수 있다. 이하에서, 영상 및 블록에 대한 정보는 신호로 칭해질 수 있다. 또한, 이하에서, 용어들 "정보" 및 "신호"는 동일한 의미로 사용될 수 있으며, 서로 교체되어 사용될 수 있다. 예를 들면, 특정한 신호는 특정한 블록을 나타내는 신호일 수 있다. 원(original) 신호는 대상 블록을 나타내는 신호일 수 있다. 예측(prediction) 신호는 예측 블록을 나타내는 신호일 수 있다. 잔차(residual) 신호는 잔차 블록을 나타내는 신호일 수 있다.A signal may refer to signaled information. Hereinafter, information about images and blocks may be referred to as signals. Additionally, hereinafter, the terms “information” and “signal” may be used with the same meaning and may be used interchangeably. For example, a specific signal may be a signal representing a specific block. The original signal may be a signal representing the target block. A prediction signal may be a signal representing a prediction block. The residual signal may be a signal representing a residual block.

비트스트림은 특정된 신택스에 따른 정보를 포함할 수 있다. 부호화 장치(100)는 특정된 신택스에 따라 정보를 포함하는 비트스트림을 생성할 수 있다. 부호화 장치(200)는 특정된 신택스에 따라 비트스트림으로부터 정보를 획득할 수 있다.The bitstream may include information according to a specified syntax. The encoding device 100 may generate a bitstream including information according to a specified syntax. The encoding device 200 may obtain information from the bitstream according to the specified syntax.

부호화 장치(100)에 의해 인터 예측을 통한 부호화가 수행되기 때문에, 부호화된 대상 영상은 이후에 처리되는 다른 영상(들)에 대하여 참조 영상으로서 사용될 수 있다. 따라서, 부호화 장치(100)는 부호화된 대상 영상을 다시 재구축 또는 복호화할 수 있고, 재구축 또는 복호화된 영상을 참조 영상으로서 참조 픽처 버퍼(190)에 저장할 수 있다. 복호화를 위해 부호화된 대상 영상에 대한 역양자화 및 역변환이 처리될 수 있다.Since encoding through inter prediction is performed by the encoding device 100, the encoded target image can be used as a reference image for other image(s) to be processed later. Accordingly, the encoding device 100 can reconstruct or decode the encoded target image, and store the reconstructed or decoded image as a reference image in the reference picture buffer 190. For decoding, inverse quantization and inverse transformation may be processed on the encoded target image.

양자화된 레벨은 역양자화부(160)에서 역양자화될(inversely quantized) 수 있고, 역변환부(170)에서 역변환될(inversely transformed) 수 있다. 역양자화부(160)는 양자화된 레벨에 대한 역양자화를 수행함으로써 역양자화된 계수를 생성할 수 있다. 역변환부(170)는 역양자화된 계수에 대한 역변환을 수행함으로써 역양자화 및 역변환된 계수를 생성할 수 있다.The quantized level may be inversely quantized in the inverse quantization unit 160 and inversely transformed in the inverse transformation unit 170. The inverse quantization unit 160 may generate an inverse quantized coefficient by performing inverse quantization on the quantized level. The inverse transform unit 170 may generate inverse quantized and inverse transformed coefficients by performing inverse transformation on the inverse quantized coefficients.

역양자화 및 역변환된 계수는 가산기(175)를 통해 예측 블록과 합해질 수 있다, 역양자화 및 역변환된 계수와 예측 블록을 합함으로써 재구축된(reconstructed) 블록이 생성될 수 있다. 여기서, 역양자화 및/또는 역변환된 계수는 역양자화(dequantization) 및 역변환(inverse-transformation) 중 적어도 하나 이상이 수행된 계수를 의미할 수 있고, 재구축된 잔차 블록을 의미할 수 있다. 여기서, 재구축된 블록은 복원(recovered) 블록 또는 복호(decoded) 블록을 의미할 수 있다.The inverse-quantized and inverse-transformed coefficients can be combined with the prediction block through the adder 175. A reconstructed block can be generated by combining the inverse-quantized and inverse-transformed coefficients with the prediction block. Here, the dequantized and/or inverse-transformed coefficient may mean a coefficient on which at least one of dequantization and inverse-transformation has been performed, and may mean a reconstructed residual block. Here, the reconstructed block may mean a recovered block or a decoded block.

재구축된 블록은 필터부(180)를 거칠 수 있다. 필터부(180)는 디블록킹 필터(deblocking filter), 샘플 적응적 오프셋(Sample Adaptive Offset; SAO), 적응적 루프 필터(Adaptive Loop Filter; ALF) 및 논 로컬 필터(Non Local Filter; NLF) 중 적어도 하나 이상을 재구축된 샘플, 재구축된 블록 또는 재구축된 픽처에 적용할 수 있다. 필터부(180)는 인-루프(in-loop) 필터로 칭해질 수도 있다.The reconstructed block may pass through the filter unit 180. The filter unit 180 includes at least a deblocking filter, a sample adaptive offset (SAO), an adaptive loop filter (ALF), and a non-local filter (NLF). One or more can be applied to a reconstructed sample, reconstructed block, or reconstructed picture. The filter unit 180 may also be referred to as an in-loop filter.

디블록킹 필터는 재구축된 픽처 내의 블록들 간의 경계에서 발생한 블록 왜곡을 제거할 수 있다. 디블록킹 필터를 적용할지 여부를 판단하기 위해, 블록에 포함된 몇 개의 열 또는 행에 포함된 픽셀(들)에 기반하여 대상 블록에 디블록킹 필터를 적용할지 여부가 판단될 수 있다.The deblocking filter can remove block distortion occurring at the boundaries between blocks in the reconstructed picture. To determine whether to apply a deblocking filter, it may be determined whether to apply a deblocking filter to the target block based on the pixel(s) included in a few columns or rows included in the block.

대상 블록에 디블록킹 필터를 적용하는 경우, 적용되는 필터는 요구되는 디블록킹 필터링의 강도에 따라 다를 수 있다. 말하자면, 서로 다른 필터들 중 디블록킹 필터링의 강도에 따라 결정된 필터가 대상 블록에 적용될 수 있다. 대상 블록에 디블록킹 필터가 적용되는 경우, 요구되는 디블록킹 필터링의 강도에 따라 롱-탭 필터(long-tap filter), 강한 필터(strong filter), 약한 필터(weak filter) 및 가우시안 필터(Gaussian filter) 중 하나 이상의 필터가 대상 블록에 적용될 수 있다.When applying a deblocking filter to a target block, the applied filter may vary depending on the strength of deblocking filtering required. In other words, among different filters, a filter determined according to the strength of deblocking filtering may be applied to the target block. When a deblocking filter is applied to the target block, a long-tap filter, strong filter, weak filter, and Gaussian filter are used depending on the strength of the deblocking filtering required. ) one or more filters may be applied to the target block.

또한, 대상 블록에 수직 방향 필터링 및 수평 방향 필터링이 수행되는 경우, 수평 방향 필터링 및 수직 방향 필터링이 병행으로 처리될 수 있다.Additionally, when vertical filtering and horizontal filtering are performed on the target block, horizontal filtering and vertical filtering may be processed in parallel.

SAO는 코딩 에러에 대한 보상을 위해 픽셀의 픽셀 값에 적정한 오프셋(offset)을 더할 수 있다. SAO는 디블록킹이 적용된 영상에 대해, 픽셀의 단위로 원본 영상 및 디블록킹이 적용된 영상 간의 차이에 대하여 오프셋을 사용하는 보정을 수행할 수 있다. 영상에 대한 오프셋 보정을 수행하기 위해, 영상에 포함된 픽셀들을 일정한 수의 영역들로 구분한 후, 구분된 영역들 중 오프셋이 수행될 영역을 결정하고, 결정된 영역에 오프셋을 적용하는 방법이 사용될 수 있고, 영상의 각 픽셀의 에지 정보를 고려하여 오프셋을 적용하는 방법이 사용될 수 있다.SAO can add an appropriate offset to the pixel value of a pixel to compensate for coding errors. SAO can perform correction using an offset for the difference between the original image and the deblocked image in pixel units for the image to which deblocking has been applied. In order to perform offset correction on an image, a method is used to divide the pixels included in the image into a certain number of areas, determine the area where offset is to be performed among the divided areas, and apply the offset to the determined area. A method of applying an offset by considering edge information of each pixel of the image may be used.

ALF는 재구축된 영상 및 원래의 영상을 비교한 값에 기반하여 필터링을 수행할 수 있다. 영상에 포함된 픽셀들을 소정의 그룹들로 분할한 후, 각 분할된 그룹에 적용될 필터가 결정될 수 있고, 그룹 별로 차별적으로 필터링이 수행될 수 있다. 적응적 루프 필터를 적용할지 여부에 관련된 정보는 CU 별로 시그널링될 수 있다. 이러한 정보는 루마 신호에 대하여 시그널링될 수 있다. 각 블록에 적용될 ALF의 모양 및 필터 계수는 블록 별로 다를 수 있다. 또는, 블록의 특징과는 무관하게, 고정된 형태의 ALF가 블록에 적용될 수 있다.ALF can perform filtering based on a comparison between the reconstructed image and the original image. After dividing the pixels included in the image into predetermined groups, a filter to be applied to each divided group can be determined, and filtering can be performed differentially for each group. Information related to whether to apply an adaptive loop filter may be signaled for each CU. This information can be signaled for the luma signal. The shape of the ALF and filter coefficients to be applied to each block may be different for each block. Alternatively, regardless of the characteristics of the block, a fixed form of ALF may be applied to the block.

논 로컬 필터는 대상 블록과 유사한 재구축된 블록들에 기반하여 필터링을 수행할 수 있다. 재구축된 영상에서 대상 블록과 유사한 영역이 선택될 수 있고, 선택된 유사한 영역의 통계적 성질을 사용하여 대상 블록의 필터링이 수행될 수 있다. 논 로컬 필터를 적용할지 여부에 관련된 정보는 CU에 대하여 시그널링될 수 있다. 또한, 블록들에 적용될 논 로컬 필터의 모양들 및 필터 계수들은 블록에 따라서 서로 다를 수 있다.A non-local filter can perform filtering based on reconstructed blocks similar to the target block. An area similar to the target block may be selected from the reconstructed image, and filtering of the target block may be performed using statistical properties of the selected similar area. Information related to whether to apply a non-local filter may be signaled to the CU. Additionally, the shapes and filter coefficients of non-local filters to be applied to blocks may be different depending on the block.

필터부(180)를 거친 재구축된 블록 또는 재구축된 영상은 참조 픽처로서 참조 픽처 버퍼(190)에 저장될 수 있다. 필터부(180)를 거친 재구축된 블록은 참조 픽처의 일부일 수 있다. 말하자면, 참조 픽처는 필터부(180)를 거친 재구축된 블록들로 구성된 재구축된 픽처일 수 있다. 저장된 참조 픽처는 이후 인터 예측 또는 움직임 보상에 사용될 수 있다.The reconstructed block or reconstructed image that has passed through the filter unit 180 may be stored in the reference picture buffer 190 as a reference picture. The reconstructed block that has passed through the filter unit 180 may be part of a reference picture. In other words, the reference picture may be a reconstructed picture composed of reconstructed blocks that have passed through the filter unit 180. The stored reference picture can then be used for inter prediction or motion compensation.

도 2는 본 발명이 적용되는 복호화 장치의 일 실시예에 따른 구성을 나타내는 블록도이다.Figure 2 is a block diagram showing the configuration of a decoding device according to an embodiment to which the present invention is applied.

복호화 장치(200)는 디코더, 비디오 복호화 장치 또는 영상 복호화 장치일 수 있다.The decoding device 200 may be a decoder, a video decoding device, or an image decoding device.

도 2를 참조하면, 복호화 장치(200)는 엔트로피 복호화부(210), 역양자화부(220), 역변환부(230), 인트라 예측부(240), 인터 예측부(250), 스위치(245), 가산기(255), 필터부(260) 및 참조 픽처 버퍼(270)를 포함할 수 있다.Referring to FIG. 2, the decoding device 200 includes an entropy decoding unit 210, an inverse quantization unit 220, an inverse transform unit 230, an intra prediction unit 240, an inter prediction unit 250, and a switch 245. , may include an adder 255, a filter unit 260, and a reference picture buffer 270.

복호화 장치(200)는 부호화 장치(100)에서 출력된 비트스트림을 수신할 수 있다. 복호화 장치(200)는 컴퓨터 판독가능한 기록 매체에 저장된 비트스트림을 수신할 수 있고, 유선/무선 전송 매체를 통해 스트리밍되는 비트스트림을 수신할 수 있다.The decoding device 200 may receive the bitstream output from the encoding device 100. The decoding device 200 can receive a bitstream stored in a computer-readable recording medium and can receive a bitstream streaming through a wired/wireless transmission medium.

복호화 장치(200)는 비트스트림에 대하여 인트라 모드 및/또는 인터 모드의 복호화를 수행할 수 있다. 또한, 복호화 장치(200)는 복호화를 통해 재구축된 영상 또는 복호화된 영상을 생성할 수 있고, 생성된 재구축된 영상 또는 복호화된 영상을 출력할 수 있다.The decoding device 200 may perform intra-mode and/or inter-mode decoding on the bitstream. Additionally, the decoding device 200 can generate a reconstructed image or a decoded image through decoding, and output the generated reconstructed image or a decoded image.

예를 들면, 복호화에 사용되는 예측 모드에 따른 인트라 모드 또는 인터 모드로의 전환은 스위치(245)에 의해 이루어질 수 있다. 복호화에 사용되는 예측 모드가 인트라 모드인 경우 스위치(245)가 인트라로 전환될 수 있다. 복호화에 사용되는 예측 모드가 인터 모드인 경우 스위치(245)가 인터로 전환될 수 있다.For example, switching to intra mode or inter mode according to the prediction mode used for decoding may be performed by the switch 245. If the prediction mode used for decoding is intra mode, the switch 245 may be switched to intra mode. If the prediction mode used for decoding is the inter mode, the switch 245 may be switched to inter.

복호화 장치(200)는 입력된 비트스트림을 복호화함으로써 재구축된 잔차 블록(reconstructed residual block)을 획득할 수 있고, 예측 블록을 생성할 수 있다. 재구축된 잔차 블록 및 예측 블록이 획득되면, 복호화 장치(200)는 재구축된 잔차 블록 및 예측 블록을 합함으로써 복호화의 대상이 되는 재구축된 블록을 생성할 수 있다.The decoding device 200 can obtain a reconstructed residual block by decoding the input bitstream and generate a prediction block. When the reconstructed residual block and the prediction block are obtained, the decoding device 200 can generate a reconstructed block that is the target of decoding by combining the reconstructed residual block and the prediction block.

엔트로피 복호화부(210)는 비트스트림에 대한 확률 분포에 기초하여 비트스트림에 대한 엔트로피 복호화를 수행함으로써 심볼들을 생성할 수 있다. 생성된 심볼들은 양자화된 변환 계수 레벨(quantized transform coefficient level)(말하자면, 양자화된 레벨 또는 양자화된 계수) 형태의 심볼을 포함할 수 있다. 여기에서, 엔트로피 복호화 방법은 상술된 엔트로피 부호화 방법과 유사할 수 있다. 예를 들면, 엔트로피 복호화 방법은 상술된 엔트로피 부호화 방법의 역과정일 수 있다.The entropy decoding unit 210 may generate symbols by performing entropy decoding on the bitstream based on a probability distribution for the bitstream. The generated symbols may include symbols in the form of quantized transform coefficient levels (i.e., quantized levels or quantized coefficients). Here, the entropy decoding method may be similar to the entropy encoding method described above. For example, the entropy decoding method may be the reverse process of the entropy encoding method described above.

엔트로피 복호화부(210)는 양자화된 변환 계수 레벨을 복호화하기 위해 변환 계수 스캐닝 방법을 통해 1차원의 벡터의 형태의 계수를 2차원의 블록의 형태로 변경할 수 있다.The entropy decoder 210 can change coefficients in the form of a one-dimensional vector into a two-dimensional block form through a transform coefficient scanning method in order to decode the quantized transform coefficient level.

예를 들면, 우상단 대각 스캔을 이용하여 블록의 계수들을 스캔함으로써 계수들이 2차원 블록 형태로 변경될 수 있다. 또는, 블록의 크기 및/또는 인트라 예측 모드에 따라 우상단 대각 스캔, 수직 스캔 및 수평 스캔 중 어떤 스캔이 사용될 것인지가 결정될 수 있다.For example, by scanning the coefficients of a block using a diagonal scan in the upper right corner, the coefficients can be changed into a two-dimensional block form. Alternatively, which scan to use among the upper right diagonal scan, vertical scan, and horizontal scan may be determined depending on the block size and/or intra prediction mode.

양자화된 계수는 역양자화부(220)에서 역양자화될 수 있다. 역양자화부(220)는 양자화된 계수에 대한 역양자화를 수행함으로써 역양자화된 계수를 생성할 수 있다. 또한, 역양자화된 계수는 역변환부(230)에서 역변환될 수 있다. 역변환부(230)는 역양자화된 계수에 대한 역변환을 수행함으로써 재구축된 잔차 블록을 생성할 수 있다. 양자화된 계수에 대한 역양자화 및 역변환이 수행된 결과로서, 재구축된 잔차 블록이 생성될 수 있다. 이때, 역양자화부(220)는 재구축된 잔차 블록을 생성함에 있어서 양자화된 계수에 양자화 행렬을 적용할 수 있다.The quantized coefficient may be inverse quantized in the inverse quantization unit 220. The inverse quantization unit 220 may generate an inverse quantized coefficient by performing inverse quantization on the quantized coefficient. Additionally, the inverse quantized coefficient may be inversely transformed in the inverse transform unit 230. The inverse transform unit 230 may generate a reconstructed residual block by performing inverse transform on the inverse quantized coefficients. As a result of performing inverse quantization and inverse transformation on the quantized coefficients, a reconstructed residual block may be generated. At this time, the inverse quantization unit 220 may apply a quantization matrix to the quantized coefficients when generating a reconstructed residual block.

인트라 모드가 사용되는 경우, 인트라 예측부(240)는 대상 블록의 이웃의 이미 복호화된 블록의 픽셀 값을 이용하는 공간적 예측을 대상 블록에 대하여 수행함으로써 예측 블록을 생성할 수 있다.When the intra mode is used, the intra prediction unit 240 may generate a prediction block by performing spatial prediction on the target block using pixel values of already decoded blocks neighboring the target block.

인터 예측부(250)는 움직임 보상부를 포함할 수 있다. 또는, 인터 예측부(250)는 움직임 보상부로 명명될 수 있다.The inter prediction unit 250 may include a motion compensation unit. Alternatively, the inter prediction unit 250 may be called a motion compensation unit.

인터 모드가 사용되는 경우, 움직임 보상부는 움직임 벡터 및 참조 픽처 버퍼(270)에 저장된 참조 영상을 이용하는 움직임 보상을 대상 블록에 대하여 수행함으로써 예측 블록을 생성할 수 있다.When the inter mode is used, the motion compensation unit may generate a prediction block by performing motion compensation on the target block using a motion vector and a reference image stored in the reference picture buffer 270.

움직임 보상부는 움직임 벡터가 정수가 아닌 값을 가진 경우, 참조 영상 내의 일부 영역에 대해 보간 필터를 적용할 수 있고, 보간 필터가 적용된 참조 영상을 사용하여 예측 블록을 생성할 수 있다. 움직임 보상부는 움직임 보상을 수행하기 위해 CU를 기준으로 CU에 포함된 PU를 위해 사용되는 움직임 보상 방법이 스킵 모드, 머지 모드, AMVP 모드 및 현재 픽처 참조 모드 중 어떤 모드인가를 결정할 수 있고, 결정된 모드에 따라 움직임 보상을 수행할 수 있다.When the motion vector has a non-integer value, the motion compensation unit can apply an interpolation filter to some areas in the reference image and generate a prediction block using the reference image to which the interpolation filter has been applied. In order to perform motion compensation, the motion compensation unit may determine which of skip mode, merge mode, AMVP mode, and current picture reference mode is the motion compensation method used for the PU included in the CU based on the CU, and the determined mode. Motion compensation can be performed according to .

재구축된 잔차 블록 및 예측 블록은 가산기(255)를 통해 더해질 수 있다. 가산기(255)는 재구축된 잔차 블록 및 예측 블록을 더함으로써 재구축된 블록을 생성할 수 있다.The reconstructed residual block and prediction block can be added through an adder 255. The adder 255 may generate a reconstructed block by adding the reconstructed residual block and the prediction block.

재구축된 블록은 필터부(260)를 거칠 수 있다. 필터부(260)는 디블록킹 필터, SAO, ALF 및 논 로컬 필터 중 적어도 하나를 재구축된 블록 또는 재구축된 영상에 적용할 수 있다. 재구축된 영상은 재구축된 블록을 포함하는 픽처일 수 있다.The reconstructed block may pass through the filter unit 260. The filter unit 260 may apply at least one of a deblocking filter, SAO, ALF, and non-local filter to the reconstructed block or the reconstructed image. The reconstructed image may be a picture containing reconstructed blocks.

필터부(260)는 재구축된 영상을 출력할 수 있다.The filter unit 260 may output a reconstructed image.

필터부(260)를 거친 재구축된 블록 및/또는 재구축된 영상은 참조 픽처 버퍼(270)에 참조 픽처로서 저장될 수 있다. 필터부(260)를 거친 재구축된 블록은 참조 픽처의 일부일 수 있다. 말하자면, 참조 픽처는 필터부(260)를 거친 재구축된 블록들로 구성된 재구축된 영상일 수 있다. 저장된 참조 픽처는 이후 인터 예측 및/또는 움직임 보상을 위해 사용될 수 있다.The reconstructed block and/or the reconstructed image that has passed through the filter unit 260 may be stored as a reference picture in the reference picture buffer 270. The reconstructed block that has passed through the filter unit 260 may be part of a reference picture. In other words, the reference picture may be a reconstructed image composed of reconstructed blocks that have passed through the filter unit 260. The stored reference picture can then be used for inter prediction and/or motion compensation.

도 3은 영상을 부호화 및 복호화할 때의 영상의 분할 구조를 개략적으로 나타내는 도면이다.Figure 3 is a diagram schematically showing the division structure of an image when encoding and decoding an image.

도 3은 하나의 유닛이 복수의 하위 유닛들로 분할되는 예를 개략적으로 나타낼 수 있다.Figure 3 may schematically show an example in which one unit is divided into a plurality of sub-units.

영상을 효율적으로 분할하기 위해, 부호화 및 복호화에 있어서, 코딩 유닛(Coding Unit; CU)이 사용될 수 있다. 유닛은 1) 영상 샘플들을 포함하는 블록 및 2) 신택스 요소(syntax element)을 합쳐서 지칭하는 용어일 수 있다. 예를 들면, "유닛의 분할"은 "유닛에 해당하는 블록의 분할"을 의미할 수 있다.In order to efficiently segment an image, a coding unit (CU) may be used in encoding and decoding. A unit may be a term that refers to a combination of 1) a block containing video samples and 2) a syntax element. For example, “division of a unit” may mean “division of a block corresponding to a unit.”

영상 부호화 및/또는 복호화의 기반 단위로서 CU가 사용될 수 있다. 또한, CU는 영상 부호화 및/또는 복호화에 있어서 인트라 모드 및 인터 모드 중 하나의 선택된 모드가 적용되는 단위로 사용될 수 있다. 말하자면, 영상 부호화 및/또는 복호화에 있어서, 각 CU에 대해서 인트라 모드 및 인터 모드 중 어떤 모드가 적용될 것인가가 결정될 수 있다.CU may be used as a base unit for video encoding and/or decoding. Additionally, a CU may be used as a unit to which a selected mode of intra mode and inter mode is applied in video encoding and/or decoding. In other words, in video encoding and/or decoding, it can be determined which mode among intra mode and inter mode will be applied to each CU.

또한, CU는 예측, 변환, 양자화, 역변환, 역양자화 및 변환 계수의 부호화 및/또는 복호화에 있어서 기반 단위일 수 있다.Additionally, a CU may be a basic unit in prediction, transformation, quantization, inverse transformation, inverse quantization, and encoding and/or decoding of transformation coefficients.

도 3을 참조하면, 영상(300)은 최대 코딩 유닛(Largest Coding Unit; LCU)의 단위로 순차적으로 분할될 수 있다. 각 LCU에 대해, 분할 구조가 결정될 수 있다. 여기서, LCU는 코딩 트리 유닛(Coding Tree Unit; CTU)과 동일한 의미로 사용될 수 있다.Referring to FIG. 3, the image 300 may be sequentially divided into units of largest coding units (LCUs). For each LCU, a partition structure may be determined. Here, LCU may be used with the same meaning as Coding Tree Unit (CTU).

유닛의 분할은 유닛에 해당하는 블록의 분할을 의미할 수 있다. 블록 분할 정보는 유닛의 깊이(depth)에 관한 깊이 정보를 포함할 수 있다. 깊이 정보는 유닛이 분할되는 회수 및/또는 정도를 나타낼 수 있다. 하나의 유닛은 트리 구조(tree structure)에 기반하여 깊이 정보를 가지고 계층적으로 복수의 하위 유닛들로 분할될 수 있다.Division of a unit may mean division of a block corresponding to the unit. Block division information may include depth information regarding the depth of the unit. Depth information may indicate the number and/or extent to which a unit is divided. One unit may be hierarchically divided into a plurality of sub-units with depth information based on a tree structure.

각각의 분할된 하위 유닛은 깊이 정보를 가질 수 있다. 깊이 정보는 CU의 크기를 나타내는 정보일 수 있다. 깊이 정보는 각 CU마다 저장될 수 있다.Each divided sub-unit may have depth information. Depth information may be information indicating the size of the CU. Depth information may be stored for each CU.

각 CU는 깊이 정보를 가질 수 있다. CU가 분할되면, 분할에 의해 생성된 CU들은 분할된 CU의 깊이에서 1 증가한 깊이를 가질 수 있다.Each CU may have depth information. When a CU is split, CUs created by splitting may have a depth that increases by 1 from the depth of the split CU.

분할 구조는 LCU(310) 내에서의, 영상을 효율적으로 부호화하기 위한, CU의 분포를 의미할 수 있다. 이러한 분포는 하나의 CU를 복수의 CU들로 분할할지 여부에 따라 결정될 수 있다. 분할된 CU들의 개수는 2, 4, 8 및 16 등을 포함하는 2 이상의 양의 정수일 수 있다.The division structure may refer to the distribution of CUs within the LCU 310 for efficiently encoding images. This distribution may be determined depending on whether to divide one CU into multiple CUs. The number of divided CUs may be a positive integer greater than or equal to 2, including 2, 4, 8, and 16.

분할에 의해 생성된 CU의 가로 크기 및 세로 크기는, 분할에 의해 생성된 CU들의 개수에 따라, 분할 전의 CU의 가로 크기 및 세로 크기보다 더 작을 수 있다. 예를 들면, 분할에 의해 생성된 CU의 가로 크기 및 세로 크기는 분할 전의 CU의 가로 크기의 절반 및 세로 크기의 절반일 수 있다.The horizontal and vertical sizes of the CU created by division may be smaller than the horizontal and vertical sizes of the CU before division, depending on the number of CUs created by division. For example, the horizontal and vertical sizes of the CU created by division may be half the horizontal size and half the vertical size of the CU before division.

분할된 CU는 동일한 방식으로 복수의 CU들로 재귀적으로 분할될 수 있다. 재귀적 분할에 의해, 분할된 CU의 가로 크기 및 세로 크기 중 적어도 하나의 크기가 분할 전의 CU의 가로 크기 및 세로 크기 중 적어도 하나에 비해 감소될 수 있다.A split CU can be recursively split into multiple CUs in the same manner. By recursive division, at least one of the horizontal and vertical sizes of the divided CU may be reduced compared to at least one of the horizontal and vertical sizes of the CU before division.

CU의 분할은 기정의된 깊이 또는 기정의된 크기까지 재귀적으로 이루어질 수 있다.Division of the CU can be done recursively up to a predefined depth or predefined size.

예를 들면, CU의 깊이는 0 내지 3의 값을 가질 수 있다. CU의 크기는 CU의 깊이에 따라 64x64로부터 8x8까지의 크기일 수 있다.For example, the depth of the CU may have a value of 0 to 3. The size of the CU can range from 64x64 to 8x8 depending on the depth of the CU.

예를 들면, LCU(310)의 깊이는 0일 수 있고, 최소 코딩 유닛(Smallest Coding Unit; SCU)의 깊이는 기정의된 최대 깊이일 수 있다. 여기서, LCU는 상술된 것과 같이 최대의 코딩 유닛 크기를 가지는 CU일 수 있고, SCU는 최소의 코딩 유닛 크기를 가지는 CU일 수 있다. For example, the depth of the LCU 310 may be 0, and the depth of the Smallest Coding Unit (SCU) may be a predefined maximum depth. Here, the LCU may be a CU with the maximum coding unit size as described above, and the SCU may be a CU with the minimum coding unit size.

LCU(310)로부터 분할이 시작될 수 있고, 분할에 의해 CU의 가로 크기 및/또는 세로 크기가 줄어들 때마다 CU의 깊이는 1씩 증가할 수 있다. Division may begin from the LCU 310, and the depth of the CU may increase by 1 whenever the horizontal and/or vertical size of the CU is reduced due to division.

예를 들면, 각각의 깊이 별로, 분할되지 않는 CU는 2Nx2N 크기를 가질 수 있다. 또한, 분할되는 CU의 경우, 2Nx2N 크기의 CU가 NxN 크기를 가지는 4개의 CU들로 분할될 수 있다. N의 크기는 깊이가 1씩 증가할 때마다 절반으로 감소할 수 있다. For example, for each depth, an undivided CU may have a size of 2Nx2N. Additionally, in the case of a divided CU, a CU of 2Nx2N size may be divided into 4 CUs of NxN size. The size of N can be reduced by half each time the depth increases by 1.

도 3을 참조하면, 깊이가 0인 LCU는 64x64 픽셀들 또는 64x64 블록일 수 있다. 0은 최소 깊이일 수 있다. 깊이가 3인 SCU는 8x8 픽셀들 또는 8x8 블록일 수 있다. 3은 최대 깊이일 수 있다. 이때, LCU인 64x64 블록의 CU는 깊이 0으로 표현될 수 있다. 32x32 블록의 CU는 깊이 1로 표현될 수 있다. 16x16 블록의 CU는 깊이 2로 표현될 수 있다. SCU인 8x8 블록의 CU는 깊이 3으로 표현될 수 있다. Referring to FIG. 3, an LCU with a depth of 0 may be 64x64 pixels or a 64x64 block. 0 may be the minimum depth. A SCU with a depth of 3 may be 8x8 pixels or an 8x8 block. 3 may be the maximum depth. At this time, the CU of the 64x64 block, which is the LCU, can be expressed as depth 0. A CU in a 32x32 block can be expressed with a depth of 1. A CU in a 16x16 block can be expressed with a depth of 2. A CU of an 8x8 block, which is an SCU, can be expressed with a depth of 3.

CU가 분할되는지 여부에 대한 정보는 CU의 분할 정보를 통해 표현될 수 있다. 분할 정보는 1비트의 정보일 수 있다. SCU를 제외한 모든 CU는 분할 정보를 포함할 수 있다. 예를 들면, 분할되지 않는 CU의 분할 정보의 값은 제1 값일 수 있고, 분할되는 CU의 분할 정보의 값은 제2 값일 수 있다. 분할 정보가 CU가 분할하는지 여부를 나타내는 경우, 제1 값은 0일 수 있고, 제2 값은 1일 수 있다.Information about whether a CU is divided can be expressed through the division information of the CU. Segmentation information may be 1 bit of information. All CUs except SCU may include segmentation information. For example, the partition information value of a CU that is not divided may be a first value, and the partition information value of a divided CU may be a second value. When the division information indicates whether the CU is divided, the first value may be 0 and the second value may be 1.

예를 들면, 하나의 CU가 4 개의 CU들로 분할되는 경우, 분할에 의해 생성된 4 개의 CU들의 각 CU의 가로 크기 및 세로 크기는 각각 분할 전의 CU의 가로 크기의 절반 및 세로 크기의 절반일 수 있다. 32x32 크기의 CU가 4 개의 CU들로 분할되는 경우, 분할된 4 개의 CU들의 크기들은 16x16일 수 있다. 하나의 CU가 4 개의 CU들로 분할되는 경우, CU가 쿼드-트리 형태로 분할되었다고 할 수 있다. 말하자면, CU에 대해 쿼드 트리 분할(quad-tree partition)이 적용되었다고 볼 수 있다.For example, when one CU is divided into four CUs, the horizontal and vertical sizes of each of the four CUs created by division are half the horizontal size and half the vertical size of the CU before division, respectively. You can. When a CU of size 32x32 is divided into 4 CUs, the sizes of the 4 divided CUs may be 16x16. When one CU is divided into four CUs, it can be said that the CU is divided into a quad-tree form. In other words, it can be seen that quad-tree partitioning has been applied to the CU.

예를 들면, 하나의 CU가 2 개의 CU들로 분할되는 경우, 분할에 의해 생성된 2 개의 CU들의 각 CU의 가로 크기 또는 세로 크기는 각각 분할 전의 CU의 가로 크기의 절반 또는 세로 크기의 절반일 수 있다. 32x32 크기의 CU가 2 개의 CU들로 세로로 분할되는 경우, 분할된 2 개의 CU들의 크기들은 16x32일 수 있다. 32x32 크기의 CU가 2 개의 CU들로 가로로 분할되는 경우, 분할된 2 개의 CU들의 크기들은 32x16일 수 있다. 하나의 CU가 2 개의 CU들로 분할되는 경우, CU가 이진-트리(binary-tree) 형태로 분할되었다고 할 수 있다. 말하자면, CU에 대해 2진 트리 분할(binary-tree partition)이 적용되었다고 볼 수 있다.For example, when one CU is divided into two CUs, the horizontal or vertical size of each CU of the two CUs created by division is half the horizontal size or half the vertical size of the CU before division, respectively. You can. When a CU of size 32x32 is vertically divided into two CUs, the sizes of the two divided CUs may be 16x32. When a CU of size 32x32 is horizontally divided into two CUs, the sizes of the two divided CUs may be 32x16. When one CU is divided into two CUs, it can be said that the CU is divided in a binary-tree form. In other words, it can be seen that binary-tree partitioning has been applied to the CU.

예를 들면, 하나의 CU가 3 개의 CU들로 분할 될 경우, 분할되기 전의 CU의 가로 크기 또는 세로 크기를 1:2:1의 비율로 분할함으로써, 3 개의 분할된 CU들이 생성될 수 있다. 예를 들면, 16x32 크기의 CU가 가로 방향으로 3 개의 CU들로 분할되는 경우, 분할된 3 개의 CU들은 위에서부터 각각 16x8, 16x16 및 16x8의 크기를 가질 수 있다. 예를 들면, 32x32 크기의 CU가 세로 방향으로 3 개의 CU들로 분할되는 경우, 분할된 3 개의 CU들은 좌측으로부터 각각 8x32, 16x32 및 8x32의 크기를 가질 수 있다. 하나의 CU가 3 개의 CU들로 분할되는 경우, CU가 삼진-트리(ternary-tree) 형태로 분할되었다고 할 수 있다. 말하자면, CU에 대해 3진 트리 분할(ternary-tree partition)이 적용되었다고 볼 수 있다.For example, when one CU is divided into three CUs, three divided CUs can be created by dividing the horizontal or vertical size of the CU before division at a ratio of 1:2:1. For example, if a CU with a size of 16x32 is divided into three CUs in the horizontal direction, the three divided CUs may have sizes of 16x8, 16x16, and 16x8, respectively, from the top. For example, if a CU with a size of 32x32 is divided into three CUs in the vertical direction, the three divided CUs may have sizes of 8x32, 16x32, and 8x32, respectively, from the left. When one CU is divided into three CUs, it can be said that the CU is divided in a ternary-tree form. In other words, it can be seen that ternary-tree partitioning has been applied to the CU.

도 3의 LCU(310)에는 쿼드-트리 형태의 분할 및 이진-트리 형태의 분할이 모두 적용되었다.Both quad-tree type partitioning and binary-tree type partitioning were applied to the LCU 310 of FIG. 3.

부호화 장치(100)에서, 64x64 크기의 코딩 트리 유닛(Coding Tree Unit; CTU)은 재귀적인 쿼드-크리 구조에 의해 더 작은 복수의 CU들로 분할될 수 있다. 하나의 CU는 동일한 크기들을 갖는 4개의 CU들로 분할될 수 있다. CU는 재귀적으로 분할될 수 있으며, 각 CU는 쿼드 트리의 구조를 가질 수 있다.In the encoding device 100, a Coding Tree Unit (CTU) of 64x64 size may be divided into a plurality of smaller CUs using a recursive Quad-Cree structure. One CU can be divided into four CUs with identical sizes. CUs can be divided recursively, and each CU can have a quad tree structure.

CU에 대한 재귀적인 분할을 통해, 최소의 율-왜곡 비율을 발생시키는 최적의 분할 방법이 선택될 수 있다.Through recursive partitioning of the CU, the optimal partitioning method that generates the minimum rate-distortion ratio can be selected.

도 3의 CTU(320)는 쿼드 트리 분할, 이진 트리 분할 및 삼진 트리 분할이 모두 적용된 CTU의 일 예이다.The CTU 320 in FIG. 3 is an example of a CTU to which quad tree partitioning, binary tree partitioning, and ternary tree partitioning are all applied.

전술된 것과 같이, CTU를 분할하기 위해, 쿼드 트리 분할, 이진 트리 분할 및 삼진 트리 분할 중 적어도 하나가 CTU에 적용될 수 있다. 분할들은 특정된 우선 순위에 기초하여 적용될 수 있다.As described above, to partition a CTU, at least one of quad tree partitioning, binary tree partitioning, and ternary tree partitioning may be applied to the CTU. Partitions may be applied based on a specified priority.

예를 들면, CTU에 대해 쿼드 트리 분할이 우선적으로 적용될 수 있다. 더 이상 쿼드 트리 분할될 수 없는 CU는 쿼드 트리의 리프 노드에 해당될 수 있다. 쿼드 트리의 리프 노드에 해당하는 CU는 이진 트리 및/또는 삼진 트리의 루트 노드가 될 수 있다. 즉, 쿼드 트리의 리프 노드에 해당하는 CU는 이진 트리 형태 또는 삼진 트리 형태로 분할될 수 있고, 또는 더 이상 분할되지 않을 수 있다. 이 때, 쿼드 트리의 리프 노드에 해당하는 CU에 이진 트리 분할 또는 삼진 트리 분할을 적용함으로써 생성된 CU에 대해서는 다시 쿼드 트리 분할이 적용되지 않도록 함으로써, 블록의 분할 및/또는 블록 분할 정보의 시그널링이 효과적으로 수행될 수 있다.For example, quad tree partitioning may be applied preferentially for CTU. A CU that can no longer be divided into a quad tree may correspond to a leaf node of the quad tree. The CU corresponding to the leaf node of the quad tree can be the root node of the binary tree and/or ternary tree. That is, the CU corresponding to the leaf node of the quad tree may be divided into a binary tree or a ternary tree, or may not be divided any further. At this time, quad tree division is not applied again to the CU created by applying binary tree division or ternary tree division to the CU corresponding to the leaf node of the quad tree, thereby preventing block division and/or signaling of block division information. It can be performed effectively.

쿼드 트리의 각 노드에 해당하는 CU의 분할은 쿼드 분할 정보를 이용하여 시그널링될 수 있다. 제1 값(예를 들면, "1")을 갖는 쿼드 분할 정보는 CU가 쿼드 트리 형태로 분할됨을 지시할 수 있다. 제2 값(예를 들면, "0")을 갖는 쿼드 분할 정보는 CU가 쿼드 트리 형태로 분할되지 않음을 지시할 수 있다. 쿼드 분할 정보는 특정된 길이(예를 들면, 1비트)를 갖는 플래그일 수 있다.The division of the CU corresponding to each node of the quad tree can be signaled using quad division information. Quad partition information with a first value (eg, “1”) may indicate that the CU is partitioned in a quad tree form. Quad partition information with a second value (eg, “0”) may indicate that the CU is not partitioned in a quad tree form. Quad split information may be a flag with a specified length (eg, 1 bit).

이진 트리 분할 및 삼진 트리 분할의 간에는 우선순위가 존재하지 않을 수 있다. 즉, 쿼드 트리의 리프 노드에 해당하는 CU는 이진 트리 형태로 분할되거나 삼진 트리 형태로 분할될 수 있다. 또한, 이진 트리 분할 또는 삼진 트리 분할에 의해 생성된 CU는 다시 이진 트리 형태 또는 삼진 트리 형태로 분할될 수 있고, 또는 더 이상 분할되지 않을 수 있다. There may be no priority between binary tree partitioning and ternary tree partitioning. That is, the CU corresponding to the leaf node of the quad tree may be divided into a binary tree or a ternary tree. Additionally, the CU generated by binary tree partitioning or ternary tree partitioning may be partitioned again into a binary tree form or a ternary tree form, or may not be partitioned any further.

이진 트리 분할 및 삼진 트리 분할 간에 우선순위가 존재하지 않는 경우의 분할은 멀티-타입 트리 분할(multi-type tree partition)로 칭해질 수 있다. 즉, 쿼드 트리의 리프 노드에 해당하는 CU는 멀티-타입 트리(multi-type tree)의 루트 노드가 될 수 있다. 멀티-타입 트리의 각 노드에 해당하는 CU의 분할에 대해서, 멀티-타입 트리의 분할 여부를 나타내는 정보, 분할 방향 정보 및 분할 트리 정보 중 적어도 하나를 이용하여 시그널링될 수 있다. 멀티-타입 트리의 각 노드에 해당하는 CU의 분할을 위해 순차적으로 분할 여부를 나타내는 정보, 분할 방향 정보 및 분할 트리 정보가 시그널링될 수도 있다.Partitioning when no priority exists between binary tree partitioning and ternary tree partitioning may be referred to as multi-type tree partitioning. In other words, the CU corresponding to the leaf node of the quad tree can become the root node of the multi-type tree. The division of the CU corresponding to each node of the multi-type tree may be signaled using at least one of information indicating whether the multi-type tree is divided, division direction information, and division tree information. To split the CU corresponding to each node of the multi-type tree, information indicating whether to split sequentially, split direction information, and split tree information may be signaled.

예를 들면, 제1 값(예를 들면, "1")을 갖는 멀티-타입 트리의 분할 여부를 나타내는 정보는 해당 CU가 멀티-타입 트리 형태로 분할됨을 지시할 수 있다. 제2 값(예를 들면, "0")을 갖는 멀티-타입 트리의 분할 여부를 나타내는 정보는 해당 CU이 멀티-타입 트리 형태로 분할되지 않음을 지시할 수 있다.For example, information indicating whether a multi-type tree with a first value (eg, “1”) is split may indicate that the corresponding CU is split in the form of a multi-type tree. Information indicating whether a multi-type tree with a second value (eg, “0”) is divided may indicate that the corresponding CU is not divided into a multi-type tree.

멀티-타입 트리의 각 노드에 해당하는 CU가 멀티-타입 트리 형태로 분할되는 경우, 해당 CU는 분할 방향 정보를 더 포함할 수 있다.When the CU corresponding to each node of the multi-type tree is split in the form of a multi-type tree, the corresponding CU may further include split direction information.

분할 방향 정보는 멀티-타입 트리 분할의 분할 방향을 지시할 수 있다. 제1 값(예를 들면, "1")을 갖는 분할 방향 정보는 해당 CU가 세로 방향으로 분할됨을 지시할 수 있다. 제2 값(예를 들면, "0")을 갖는 분할 방향 정보는 해당 CU가 가로 방향으로 분할됨을 지시할 수 있다.Splitting direction information may indicate the splitting direction of multi-type tree splitting. Division direction information with a first value (eg, “1”) may indicate that the corresponding CU is divided in the vertical direction. Division direction information with a second value (eg, “0”) may indicate that the corresponding CU is divided in the horizontal direction.

멀티-타입 트리의 각 노드에 해당하는 CU가 멀티-타입 트리 형태로 분할되는 경우, 해당 CU는 분할 트리 정보를 더 포함할 수 있다. 분할 트리 정보는 멀티-타입 트리 분할을 위해 사용된 트리를 지시할 수 있다.When the CU corresponding to each node of the multi-type tree is split into a multi-type tree, the corresponding CU may further include split tree information. Splitting tree information may indicate the tree used for multi-type tree splitting.

예를 들면, 제1 값(예를 들면, "1")을 갖는 분할 트리 정보는 해당 CU가 이진 트리 형태로 분할됨을 지시할 수 있다. 제2 값(예를 들면, "0")을 갖는 분할 트리 정보는 해당 CU가 삼진 트리 형태로 분할됨을 지시할 수 있다.For example, split tree information with a first value (eg, “1”) may indicate that the corresponding CU is split in the form of a binary tree. Split tree information with a second value (eg, “0”) may indicate that the corresponding CU is split in a ternary tree form.

여기에서, 전술된 분할 여부를 나타내는 정보, 분할 트리 정보 및 분할 방향 정보의 각각은 특정된 길이(예를 들면, 1 비트)를 갖는 플래그일 수 있다.Here, each of the above-described information indicating whether to split, split tree information, and split direction information may be a flag with a specified length (eg, 1 bit).

전술된 쿼드 분할 정보, 멀티-타입 트리의 분할 여부를 나타내는 정보, 분할 방향 정보 및 분할 트리 정보 중 적어도 하나는 엔트로피 부호화 및/또는 엔트로피 복호화될 수 있다. 이러한 정보들의 엔트로피 부호화/복호화를 위해, 대상 CU에 인접한 이웃 CU의 정보가 이용될 수 있다.At least one of the above-described quad split information, information indicating whether the multi-type tree is split, split direction information, and split tree information may be entropy encoded and/or entropy decoded. For entropy encoding/decoding of such information, information on a neighboring CU adjacent to the target CU can be used.

예를 들면, 좌측 CU 및/또는 상측 CU의 분할 형태(말하자면, 분할 여부, 분할 트리 및/또는 분할 방향) 및 대상 CU의 분할 형태는 서로 유사할 확률이 높다고 간주될 수 있다. 따라서, 이웃 CU의 정보에 기초하여, 대상 CU의 정보의 엔트로피 부호화 및/또는 엔트로피 복호화를 위한 컨텍스트 정보가 유도될 수 있다. 이때, 이웃 CU의 정보는 이웃 CU의 1) 쿼드 분할 정보, 2) 멀티-타입 트리의 분할 여부를 나타내는 정보, 3) 분할 방향 정보 및 4) 분할 트리 정보 중 적어도 하나를 포함할 수 있다.For example, the splitting form of the left CU and/or the upper CU (i.e., whether to split, splitting tree, and/or splitting direction) and the splitting form of the target CU may be considered highly likely to be similar to each other. Therefore, based on information on the neighboring CU, context information for entropy encoding and/or entropy decoding of information on the target CU may be derived. At this time, the information on the neighboring CU may include at least one of the neighboring CU's 1) quad split information, 2) information indicating whether the multi-type tree is split, 3) split direction information, and 4) split tree information.

다른 실시예로서, 이진 트리 분할 및 삼진 트리 분할 중에서, 이진 트리 분할이 우선적으로 수행될 수 있다. 즉, 이진 트리 분할이 먼저 적용되고, 이진 트리의 리프 노드에 해당하는 CU가 삼진 트리의 루트 노드로 설정될 수도 있다. 이러한 경우, 삼진 트리의 노드에 해당하는 CU에 대해서는 쿼드 트리 분할 및 이진 트리 분할이 수행되지 않을 수 있다.As another embodiment, among binary tree partitioning and ternary tree partitioning, binary tree partitioning may be performed preferentially. That is, binary tree division is applied first, and the CU corresponding to the leaf node of the binary tree may be set as the root node of the ternary tree. In this case, quad tree division and binary tree division may not be performed on the CU corresponding to the node of the ternary tree.

쿼드 트리 분할, 이진 트리 분할 및/또는 삼진 트리 분할에 의해 더 이상 분할되지 않는 CU는 부호화, 예측 및/또는 변환의 단위가 될 수 있다. 즉, 예측 및/또는 변환을 위해, CU가 더 이상 분할되지 않을 수 있다. 따라서, CU를 예측 유닛 및/또는 변환 유닛으로 분할하기 위한 분할 구조 및 분할 정보 등이 비트스트림 내에 존재하지 않을 수 있다.A CU that is no longer split by quad tree splitting, binary tree splitting, and/or ternary tree splitting may become a unit of encoding, prediction, and/or transformation. That is, for prediction and/or transformation, the CU may no longer be split. Accordingly, a split structure and split information for splitting a CU into prediction units and/or transform units may not exist in the bitstream.

다만, 분할의 단위가 되는 CU의 크기가 최대 변환 블록의 크기보다 더 큰 경우, 이러한 CU는 CU의 크기가 최대 변환 블록의 크기의 이하가 될 때까지 재귀적으로 분할될 수 있다. 예를 들면, CU의 크기가 64x64이고, 최대 변환 블록의 크기가 32x32인 경우, CU는 변환을 위해, 4개의 32x32 블록들로 분할될 수 있다. 예를 들면, CU의 크기가 32x64이고, 최대 변환 블록의 크기가 32x32인 경우, CU는 변환을 위해, 2개의 32x32 블록들로 분할될 수 있다.However, if the size of the CU that is the unit of division is larger than the size of the maximum conversion block, this CU may be recursively divided until the size of the CU becomes less than or equal to the size of the maximum conversion block. For example, if the size of the CU is 64x64 and the maximum conversion block size is 32x32, the CU may be divided into four 32x32 blocks for conversion. For example, if the size of the CU is 32x64 and the maximum conversion block size is 32x32, the CU may be divided into two 32x32 blocks for conversion.

이러한 경우, 변환을 위해 CU가 분할되는지 여부에 대한 정보는 별도로 시그널링되지 않을 수 있다. 시그널링 없이, CU의 분할의 여부는 CU의 가로 크기(및/또는 세로 크기) 및 최대 변환 블록의 가로 크기(및/또는, 세로 크기) 간의 비교에 의해 결정될 수 있다. 예를 들면, CU의 가로 크기가 최대 변환 블록의 가로 크기보다 더 큰 경우, CU는 세로로 2 등분될 수 있다. 또한, CU의 세로 크기가 최대 변환 블록의 세로 크기보다 더 큰 경우, CU는 가로로 2 등분될 수 있다.In this case, information about whether the CU is divided for conversion may not be signaled separately. Without signaling, whether to split a CU may be determined by comparison between the horizontal size (and/or vertical size) of the CU and the horizontal size (and/or vertical size) of the maximum transform block. For example, if the horizontal size of the CU is larger than the horizontal size of the maximum transformation block, the CU may be divided vertically into two. Additionally, if the vertical size of the CU is larger than the vertical size of the maximum transformation block, the CU may be divided horizontally into two.

CU의 최대 크기 및/또는 최소 크기에 관한 정보, 변환 블록의 최대 크기 및/또는 최소 크기에 관한 정보는 CU에 대한 상위 레벨에서 시그널링되거나 결정될 수 있다. 예를 들면, 상위 레벨은 시퀀스 레벨, 픽처 레벨, 타일 레벨, 타일 그룹 레벨 및 슬라이스 레벨 등일 수 있다. 예를 들면, CU의 최소 크기는 4x4로 결정될 수 있다. 예를 들면, 변환 블록의 최대 크기는 64x64로 결정될 수 있다. 예를 들면, 변환 블록의 최소 크기는 4x4로 결정될 수 있다.Information about the maximum size and/or minimum size of the CU and information about the maximum size and/or minimum size of the transform block may be signaled or determined at a higher level for the CU. For example, higher levels may be sequence level, picture level, tile level, tile group level, and slice level. For example, the minimum size of a CU may be determined to be 4x4. For example, the maximum size of a transform block may be determined to be 64x64. For example, the minimum size of the transform block may be determined to be 4x4.

쿼드 트리의 리프 노드에 해당하는 CU의 최소 크기(말하자면, 쿼드 트리 최소 크기)에 관한 정보 및/또는 멀티-타입 트리의 루트 노드로부터 리프 노드로의 경로의 최대 깊이(말하자면, 멀티-타입 트리 최대 깊이)에 관한 정보는 CU에 대한 상위 레벨에서 시그널링되거나 결정될 수 있다. 예를 들면, 상위 레벨은 시퀀스 레벨, 픽처 레벨, 슬라이스 레벨, 타일 그룹 레벨 및 타일 레벨 등일 수 있다. 쿼드 트리 최소 크기에 관한 정보 및/또는 멀티-타입 트리 최대 깊이에 관한 정보는 인트라 내 슬라이스 및 인터 슬라이스의 각각에 대해 별도로 시그널링되거나 결정될 수 있다.Information about the minimum size of the CU corresponding to the leaf node of the quad tree (say, the quad tree minimum size) and/or the maximum depth of the path from the root node to the leaf node of the multi-type tree (say, the multi-type tree maximum Information about depth) may be signaled or determined at a higher level for the CU. For example, higher levels may be sequence level, picture level, slice level, tile group level, and tile level. Information about the quad tree minimum size and/or information about the multi-type tree maximum depth may be signaled or determined separately for each of the intra-slice and inter-slice.

CTU의 크기 및 변환 블록의 최대 크기에 대한 차분 정보는 CU에 대한 상위 레벨에서 시그널링되거나 결정될 수 있다. 예를 들면, 상위 레벨은 시퀀스 레벨, 픽처 레벨, 슬라이스 레벨, 타일 그룹 레벨 및 타일 레벨 등일 수 있다. 이진 트리의 각 노드에 해당하는 CU의 최대 크기(말하자면, 이진 트리 최대 크기)에 관한 정보는 CTU의 크기 및 차분 정보를 기반으로 결정될 수 있다. 삼진 트리의 각 노드에 해당하는 CU의 최대 크기(말하자면, 삼진 트리 최대 크기)는 슬라이스의 타입에 따라서 다른 값을 가질 수 있다. 예를 들면, 인트라 슬라이스 내에서, 삼진 트리 최대 크기는 32x32일 수 있다. 또한, 예를 들면, 인터 슬라이스 내에서, 삼진 트리 최대 크기는 128x128일 수 있다. 예를 들면, 이진 트리의 각 노드에 해당하는 CU의 최소 크기(말하자면, 이진 트리 최소 크기) 및/또는 삼진 트리의 각 노드에 해당하는 CU의 최소 크기(말하자면, 삼진 트리 최소 크기)는 CU의 최소 크기로 설정될 수 있다.Differential information about the size of the CTU and the maximum size of the transform block may be signaled or determined at a higher level for the CU. For example, higher levels may be sequence level, picture level, slice level, tile group level, and tile level. Information about the maximum size of the CU corresponding to each node of the binary tree (that is, the maximum size of the binary tree) can be determined based on the size and difference information of the CTU. The maximum size of the CU corresponding to each node of the ternary tree (that is, the maximum size of the ternary tree) may have different values depending on the type of slice. For example, within an intra slice, the maximum ternary tree size may be 32x32. Additionally, for example, within an inter slice, the maximum ternary tree size may be 128x128. For example, the minimum size of a CU corresponding to each node in a binary tree (say, the binary tree minimum size) and/or the minimum size of a CU corresponding to each node in a ternary tree (say, the ternary tree minimum size) is Can be set to the minimum size.

또 다른 예로, 이진 트리 최대 크기 및/또는 삼진 트리 최대 크기는 슬라이스 레벨에서 시그널링되거나 결정될 수 있다. 또한, 이진 트리 최소 크기 및/또는 삼진 트리 최소 크기는 슬라이스 레벨에서 시그널링되거나 결정될 수 있다. As another example, the binary tree maximum size and/or the ternary tree maximum size may be signaled or determined at the slice level. Additionally, the binary tree minimum size and/or ternary tree minimum size may be signaled or determined at the slice level.

전술된 다양한 블록 크기 및 다양한 깊이에 기반하여, 쿼드 분할 정보, 멀티-타입 트리의 분할 여부를 나타내는 정보, 분할 트리 정보 및/또는 분할 방향 정보 등은 비트스트림 내에 존재하거나 존재하지 않을 수 있다. Based on the various block sizes and various depths described above, quad split information, information indicating whether the multi-type tree is split, split tree information, and/or split direction information may or may not exist in the bitstream.

예를 들면, CU의 크기가 쿼드 트리 최소 크기보다 더 크지 않으면, CU는 쿼드 분할 정보를 포함하지 않을 수 있고, CU에 대한 쿼드 분할 정보는 제2 값으로 추론될 수 있다.For example, if the size of the CU is not larger than the quad tree minimum size, the CU may not include quad partition information, and the quad partition information for the CU may be inferred as the second value.

예를 들면, 멀티-타입 트리의 노드에 해당하는 CU의 크기(가로 크기 및 세로 크기)가 이진 트리 최대 크기(가로 크기 및 세로 크기) 및/또는 삼진 트리 최대 크기(가로 크기 및 세로 크기)보다 더 큰 경우, CU는 이진 트리 형태 및/또는 삼진 트리 형태로 분할되지 않을 수 있다. 이러한 결정 방식에 따라, 멀티-타입 트리의 분할 여부를 나타내는 정보는 시그널링되지 않을 수 있고, 제2 값으로 추론될 수 있다. For example, the size (horizontal and vertical size) of the CU corresponding to a node in a multi-type tree is larger than the binary tree maximum size (horizontal size and vertical size) and/or the ternary tree maximum size (horizontal size and vertical size). For larger cases, the CU may not be partitioned into binary and/or ternary tree form. According to this decision method, information indicating whether to split the multi-type tree may not be signaled and may be inferred as a second value.

또는, 멀티-타입 트리의 노드에 해당하는 CU의 크기(가로 크기 및 세로 크기)가 이진 트리 최소 크기(가로 크기 및 세로 크기)와 동일하거나, CU의 크기(가로 크기 및 세로 크기)가 삼진 트리 최소 크기(가로 크기 및 세로 크기)의 2 배와 동일한 경우, CU는 이진 트리 형태 및/또는 삼진 트리 형태로 분할되지 않을 수 있다. 이러한 결정 방식에 따라, 멀티-타입 트리의 분할 여부를 나타내는 정보는 시그널링되지 않을 수 있고, 제2 값으로 추론될 수 있다. 왜냐하면, CU을 이진 트리 형태 및/또는 삼진 트리 형태로 분할할 경우, 이진 트리 최소 크기 및/또는 삼진 트리 최소 크기보다 더 작은 CU이 생성되기 때문이다.Alternatively, the size (horizontal and vertical size) of the CU corresponding to the node of the multi-type tree is equal to the minimum size (horizontal and vertical size) of the binary tree, or the size of the CU (horizontal and vertical size) is equal to the minimum size (horizontal and vertical size) of the binary tree. If equal to twice the minimum size (horizontal and vertical sizes), the CU may not be partitioned into binary tree form and/or ternary tree form. According to this decision method, information indicating whether to split the multi-type tree may not be signaled and may be inferred as a second value. This is because, when dividing a CU into a binary tree form and/or a ternary tree form, a CU smaller than the minimum binary tree size and/or the minimum ternary tree size is generated.

또는, 이진 트리 분할 또는 삼진 트리 분할은 가상의 파이프라인 데이터 유닛의 크기(즉, 파이프라인 버퍼 크기)에 기초하여 제한될 수 있다. 예를 들면, 이진 트리 분할 또는 삼진 트리 분할에 의해, CU가 파이프라인 버퍼 크기에 적합하지 않은 서브 CU로 분할될 경우, 이진 트리 분할 또는 삼진 트리 분할은 제한될 수 있다. 파이프라인 버퍼 크기는 최대 변환 블록의 크기(예를 들면, 64X64)와 동일할 수 있다.Alternatively, binary tree partitioning or ternary tree partitioning may be limited based on the size of the virtual pipeline data unit (i.e., pipeline buffer size). For example, if a CU is split into sub-CUs that do not fit the pipeline buffer size by binary tree partitioning or ternary tree partitioning, binary tree partitioning or ternary tree partitioning may be limited. The pipeline buffer size may be equal to the size of the maximum conversion block (e.g., 64X64).

예를 들면, 파이프라인 버퍼 크기가 64X64일 때, 아래와 같은 분할들은 제한될 수 있다.For example, when the pipeline buffer size is 64X64, the following partitions may be limited.

- NxM(N 및/또는 M은 128) CU에 대한 삼진 트리 분할- ternary tree split for NxM (N and/or M is 128) CUs

- 128xN(N <= 64) CU에 대한 수평 방향 이진 트리 분할- Horizontally directed binary tree split for 128xN (N <= 64) CUs

- Nx128(N <= 64) CU에 대한 수직 방향 이진 트리 분할- Vertically oriented binary tree partitioning for Nx128 (N <= 64) CUs

또는, 멀티-타입 트리의 노드에 해당하는 CU의 멀티-타입 트리 내의 깊이가 멀티-타입 트리 최대 깊이와 동일한 경우, CU는 이진 트리 형태 및/또는 삼진 트리 형태로 분할되지 않을 수 있다. 이러한 결정 방식에 따라, 멀티-타입 트리의 분할 여부를 나타내는 정보는 시그널링되지 않을 수 있고, 제2 값으로 추론될 수 있다.Alternatively, if the depth within the multi-type tree of the CU corresponding to the node of the multi-type tree is equal to the maximum depth of the multi-type tree, the CU may not be divided into a binary tree form and/or a ternary tree form. According to this decision method, information indicating whether to split the multi-type tree may not be signaled and may be inferred as a second value.

또는, 멀티-타입 트리의 노드에 해당하는 CU에 대해, 수직 방향 이진 트리 분할, 수평 방향 이진 트리 분할, 수직 방향 삼진 트리 분할 및 수평 방향 삼진 트리 분할 중 적어도 하나가 가능한 경우에만, 멀티-타입 트리의 분할 여부를 나타내는 정보가 시그널링될 수 있다. 그렇지 않으면, CU는 이진 트리 형태 및/또는 삼진 트리 형태로 분할되지 않을 수 있다. 이러한 결정 방식에 따라, 멀티-타입 트리의 분할 여부를 나타내는 정보는 시그널링되지 않을 수 있고, 제2 값으로 추론될 수 있다.Or, for a CU corresponding to a node of a multi-type tree, a multi-type tree only if at least one of vertical binary tree partitioning, horizontal binary tree partitioning, vertical ternary tree partitioning, and horizontal ternary tree partitioning is possible. Information indicating whether to divide may be signaled. Otherwise, the CU may not be partitioned into binary tree form and/or ternary tree form. According to this decision method, information indicating whether to split the multi-type tree may not be signaled and may be inferred as a second value.

또는, 멀티-타입 트리의 노드에 해당하는 CU에 대해 수직 방향 이진 트리 분할 및 수평 방향 이진 트리 분할이 모두 가능하거나, 수직 방향 삼진 트리 분할 및 수평 방향 삼진 트리 분할이 모두 가능한 경우에만, 분할 방향 정보가 시그널링될 수 있다. 그렇지 않으면, 분할 방향 정보는 시그널링되지 않을 수 있고, CU가 분할될 수 있는 방향을 지시하는 값으로 추론될 수 있다.Alternatively, split direction information only if both vertical binary tree splitting and horizontal binary tree splitting are possible for the CU corresponding to the node of the multi-type tree, or both vertical ternary tree splitting and horizontal ternary tree splitting are possible. can be signaled. Otherwise, the division direction information may not be signaled and may be inferred as a value indicating the direction in which the CU can be divided.

또는, 멀티-타입 트리의 노드에 해당하는 CU에 대해 수직 방향 이진 트리 분할 및 수직 방향 삼진 트리 분할이 모두 가능하거나, 수평 방향 이진 트리 분할 및 수평 방향 삼진 트리 분할이 모두 가능한 경우에만, 분할 트리 정보가 시그널링될 수 있다. 그렇지 않으면, 분할 트리 정보는 시그널링되지 않을 수 있고, CU의 분할에 적용될 수 있는 트리를 지시하는 값으로 추론될 수 있다.Alternatively, split tree information only if both vertical binary tree splitting and vertical ternary tree splitting are possible for the CU corresponding to the node of the multi-type tree, or both horizontal binary tree splitting and horizontal ternary tree splitting are possible. can be signaled. Otherwise, the split tree information may not be signaled and may be inferred as a value indicating a tree applicable to splitting the CU.

도 4는 코딩 유닛이 포함할 수 있는 예측 유닛의 형태를 도시한 도면이다.Figure 4 is a diagram showing the form of a prediction unit that a coding unit can include.

LCU로부터 분할된 CU 중 더 이상 분할되지 않는 CU는 하나 이상의 예측 유닛(Prediction Unit; PU)들로 분할될 수 있다.Among the CUs divided from the LCU, CUs that are no longer divided may be divided into one or more prediction units (PUs).

PU는 예측에 대한 기본 단위일 수 있다. PU는 스킵(skip) 모드, 인터 모드 및 인트라 모드 중 어느 하나로 부호화 및 복호화될 수 있다. PU는 각 모드에 따라서 다양한 형태로 분할될 수 있다. 예를 들면, 도 1을 참조하여 전술된 대상 블록 및 도 2를 참조하여 전술된 대상 블록은 PU일 수 있다.PU may be the basic unit for prediction. PU can be encoded and decoded in any one of skip mode, inter mode, and intra mode. PU can be divided into various forms depending on each mode. For example, the target block described above with reference to FIG. 1 and the target block described with reference to FIG. 2 may be a PU.

CU는 PU들로 분할되지 않을 수 있다. CU가 PU들로 분할되지 않는 경우 CU의 크기 및 PU의 크기는 같을 수 있다.A CU may not be divided into PUs. If the CU is not divided into PUs, the size of the CU and the size of the PU may be the same.

스킵 모드에서는, CU 내에 분할이 존재하지 않을 수 있다. 스킵 모드에서는 분할 없이 PU 및 CU의 크기들이 동일한 2Nx2N 모드(410)가 지원될 수 있다.In skip mode, there may be no partitions within the CU. In skip mode, 2Nx2N mode 410 in which the sizes of PU and CU are the same without division can be supported.

인터 모드에서는, CU 내에서 8가지로 분할된 형태들이 지원될 수 있다. 예를 들면, 인터 모드에서는 2Nx2N 모드(410), 2NxN 모드(415), Nx2N 모드(420), NxN 모드(425), 2NxnU 모드(430), 2NxnD 모드(435), nLx2N 모드(440) 및 nRx2N 모드(445)가 지원될 수 있다.In inter mode, eight partition types can be supported within the CU. For example, in inter mode, 2Nx2N mode (410), 2NxN mode (415), Nx2N mode (420), NxN mode (425), 2NxnU mode (430), 2NxnD mode (435), nLx2N mode (440), and nRx2N Mode 445 may be supported.

인트라 모드에서는, 2Nx2N 모드(410) 및 NxN 모드(425)가 지원될 수 있다.In intra mode, 2Nx2N mode 410 and NxN mode 425 may be supported.

2Nx2N 모드(410)에서는 2Nx2N의 크기의 PU가 부호화될 수 있다. 2Nx2N의 크기의 PU는 CU의 크기와 동일한 크기의 PU를 의미할 수 있다. 예를 들면, 2Nx2N의 크기의 PU는 64x64, 32x32, 16x16 또는 8x8의 크기를 가질 수 있다.In 2Nx2N mode 410, a PU with a size of 2Nx2N can be encoded. A PU of size 2Nx2N may mean a PU of the same size as the size of the CU. For example, a PU of size 2Nx2N may have sizes of 64x64, 32x32, 16x16 or 8x8.

NxN 모드(425)에서는 NxN의 크기의 PU가 부호화될 수 있다.In NxN mode 425, PUs of NxN size can be encoded.

예를 들면, 인트라 예측에서, PU의 크기가 8x8일 때, 4개의 분할된 PU들이 부호화될 수 있다. 분할된 PU의 크기는 4x4일 수 있다.For example, in intra prediction, when the size of a PU is 8x8, four divided PUs can be encoded. The size of the divided PU may be 4x4.

PU가 인트라 모드에 의해 부호화될 경우, PU는 복수의 인트라 예측 모드들 중 하나의 인트라 예측 모드를 사용하여 부호화될 수 있다. 예를 들면, 고 효율 비디오 코딩(High Efficiency Video Coding; HEVC) 기술에서는 35 개의 인트라 예측 모드들을 제공할 수 있고, PU는 35 개의 인트라 예측 모드들 중 하나의 인트라 예측 모드로 부호화될 수 있다.When the PU is encoded by intra mode, the PU may be encoded using one intra prediction mode among a plurality of intra prediction modes. For example, High Efficiency Video Coding (HEVC) technology can provide 35 intra prediction modes, and a PU can be encoded with one intra prediction mode among the 35 intra prediction modes.

PU가 2Nx2N 모드(410) 및 NxN 모드(425) 중 어느 모드에 의해 부호화될 것인가는 율-왜곡 비용(rate-distortion cost)에 의해 결정될 수 있다.Which of the 2Nx2N mode 410 and NxN mode 425 will be used to encode the PU can be determined by the rate-distortion cost.

부호화 장치(100)는 2Nx2N 크기의 PU에 대해 부호화 연산을 수행할 수 있다. 여기에서, 부호화 연산은 부호화 장치(100)가 사용할 수 있는 복수의 인트라 예측 모드들의 각각으로 PU를 부호화하는 것일 수 있다. 부호화 연산을 통해 2Nx2N 크기의 PU에 대한 최적의 인트라 예측 모드가 도출될 수 있다. 최적의 인트라 예측 모드는 부호화 장치(100)가 사용할 수 있는 복수의 인트라 예측 모드들 중 2Nx2N 크기의 PU의 부호화에 대하여 최소의 율-왜곡 비용을 발생시키는 인트라 예측 모드일 수 있다.The encoding device 100 can perform an encoding operation on a PU of size 2Nx2N. Here, the encoding operation may be encoding the PU in each of a plurality of intra prediction modes that the encoding device 100 can use. Through encoding operations, the optimal intra prediction mode for a PU of size 2Nx2N can be derived. The optimal intra prediction mode may be an intra prediction mode that generates the minimum rate-distortion cost for encoding a PU of 2Nx2N size among a plurality of intra prediction modes that the encoding device 100 can use.

또한, 부호화 장치(100)는 NxN으로 분할된 PU들의 각 PU에 대해서 순차적으로 부호화 연산을 수행할 수 있다. 여기에서, 부호화 연산은 부호화 장치(100)가 사용할 수 있는 복수의 인트라 예측 모드들의 각각으로 PU를 부호화하는 것일 수 있다. 부호화 연산을 통해 NxN 크기의 PU에 대한 최적의 인트라 예측 모드가 도출될 수 있다. 최적의 인트라 예측 모드는 부호화 장치(100)가 사용할 수 있는 복수의 인트라 예측 모드들 중 NxN 크기의 PU의 부호화에 대하여 최소의 율-왜곡 비용을 발생시키는 인트라 예측 모드일 수 있다.Additionally, the encoding device 100 may sequentially perform an encoding operation on each PU of the NxN divided PUs. Here, the encoding operation may be encoding the PU in each of a plurality of intra prediction modes that the encoding device 100 can use. The optimal intra prediction mode for a PU of NxN size can be derived through encoding operations. The optimal intra prediction mode may be an intra prediction mode that generates the minimum rate-distortion cost for encoding an NxN sized PU among a plurality of intra prediction modes that the encoding device 100 can use.

부호화 장치(100)는 2Nx2N 크기의 PU의 율-왜곡 비용 및 NxN 크기의 PU들의 율-왜곡 비용들의 비교에 기반하여 2Nx2N 크기의 PU 및 NxN 크기의 PU들 중 어느 것을 부호화할 지를 결정할 수 있다.The encoding device 100 may determine which of the 2Nx2N sized PUs and the NxN sized PUs to encode based on comparison of the rate-distortion costs of the 2Nx2N sized PU and the rate-distortion costs of the NxN sized PUs.

하나의 CU는 하나 이상의 PU들로 분할될 수 있고, PU도 복수의 PU들로 분할될 수 있다.One CU can be divided into one or more PUs, and a PU can also be divided into multiple PUs.

예를 들면, 하나의 PU가 4 개의 PU들로 분할되는 경우, 분할에 의해 생성된 4 개의 PU들의 각 PU의 가로 크기 및 세로 크기는 각각 분할 전의 PU의 가로 크기의 절반 및 세로 크기의 절반일 수 있다. 32x32 크기의 PU가 4 개의 PU들로 분할되는 경우, 분할된 4 개의 PU들의 크기들은 16x16일 수 있다. 하나의 PU가 4 개의 PU들로 분할되는 경우, PU가 쿼드-트리 형태로 분할되었다고 할 수 있다.For example, when one PU is divided into four PUs, the horizontal and vertical sizes of each of the four PUs created by division are half the horizontal size and half the vertical size of the PU before division, respectively. You can. When a PU of size 32x32 is divided into 4 PUs, the sizes of the 4 divided PUs may be 16x16. When one PU is divided into four PUs, it can be said that the PU is divided into a quad-tree form.

예를 들면, 하나의 PU가 2 개의 PU들로 분할되는 경우, 분할에 의해 생성된 2 개의 PU들의 각 PU의 가로 크기 또는 세로 크기는 각각 분할 전의 PU의 가로 크기의 절반 또는 세로 크기의 절반일 수 있다. 32x32 크기의 PU가 2 개의 PU들로 세로로 분할되는 경우, 분할된 2 개의 PU들의 크기들은 16x32일 수 있다. 32x32 크기의 PU가 2 개의 PU들로 가로로 분할되는 경우, 분할된 2 개의 PU들의 크기들은 32x16일 수 있다. 하나의 PU가 2 개의 PU들로 분할되는 경우, PU가 이진-트리 형태로 분할되었다고 할 수 있다.For example, when one PU is divided into two PUs, the horizontal or vertical size of each PU of the two PUs created by division is half the horizontal size or half the vertical size of the PU before division, respectively. You can. When a PU of size 32x32 is vertically divided into two PUs, the sizes of the two divided PUs may be 16x32. When a PU of size 32x32 is horizontally divided into two PUs, the sizes of the two divided PUs may be 32x16. When one PU is divided into two PUs, it can be said that the PU is divided into a binary-tree form.

도 5는 코딩 유닛에 포함될 수 있는 변환 유닛의 형태를 도시한 도면이다.Figure 5 is a diagram showing the form of a conversion unit that can be included in a coding unit.

변환 유닛(Transform Unit; TU)은 CU 내에서 변환, 양자화, 역변환, 역양자화, 엔트로피 부호화 및 엔트로피 복호화의 과정을 위해 사용되는 기본 단위일 수 있다.Transform Unit (TU) may be a basic unit used for the processes of transformation, quantization, inverse transformation, inverse quantization, entropy encoding, and entropy decoding within the CU.

TU는 정사각형 형태 또는 직사각형 형태를 가질 수 있다. TU의 형태는 CU의 크기 및/또는 형태에 의존하여 결정될 수 있다.TU may have a square or rectangular shape. The shape of the TU may be determined depending on the size and/or shape of the CU.

LCU로부터 분할된 CU 중, 더 이상 CU들로 분할되지 않는 CU는 하나 이상의 TU들로 분할될 수 있다. 이때, TU의 분할 구조는 쿼드-트리(quad-tree) 구조일 수 있다. 예컨대, 도 5에서 도시된 것과 같이, 하나의 CU(510)가 쿼드-트리 구조에 따라서 한 번 또는 그 이상 분할될 수 있다. 분할을 통해, 하나의 CU(510)는 다양한 크기의 TU들로 구성될 수 있다.Among the CUs divided from the LCU, CUs that are no longer divided into CUs may be divided into one or more TUs. At this time, the division structure of the TU may be a quad-tree structure. For example, as shown in FIG. 5, one CU 510 may be divided one or more times according to a quad-tree structure. Through division, one CU 510 can be composed of TUs of various sizes.

하나의 CU가 2 번 이상 분할될 경우, CU는 재귀적으로 분할되는 것으로 볼 수 있다. 분할을 통해, 하나의 CU는 다양한 크기들을 갖는 TU들로 구성될 수 있다.If one CU is divided more than two times, the CU can be viewed as being divided recursively. Through partitioning, one CU can be composed of TUs with various sizes.

또는, 하나의 CU는 CU를 분할하는 수직 선 및/또는 수평 선의 개수에 기반하여 하나 이상의 TU들로 분할될 수도 있다.Alternatively, one CU may be divided into one or more TUs based on the number of vertical lines and/or horizontal lines dividing the CU.

CU는 대칭형의 TU들로 분할될 수 있고, 비대칭형의 TU들로 분할될 수도 있다. 비대칭형의 TU들로의 분할을 위해, TU의 크기 및/또는 형태에 대한 정보가 부호화 장치(100)로부터 복호화 장치(200)로 시그널링될 수 있다. 또는, TU의 크기 및/또는 형태는 CU의 크기 및/또는 형태에 대한 정보로부터 유도될 수 있다.A CU may be divided into symmetric TUs or may be divided into asymmetric TUs. For division into asymmetric TUs, information about the size and/or shape of the TU may be signaled from the encoding device 100 to the decoding device 200. Alternatively, the size and/or shape of the TU may be derived from information about the size and/or shape of the CU.

CU는 TU들로 분할되지 않을 수 있다. CU가 TU들로 분할되지 않는 경우 CU의 크기 및 TU의 크기는 같을 수 있다.A CU may not be divided into TUs. If the CU is not divided into TUs, the size of the CU and the size of the TU may be the same.

하나의 CU는 하나 이상의 TU들로 분할될 수 있고, TU도 복수의 TU들로 분할될 수 있다.One CU may be divided into one or more TUs, and a TU may also be divided into multiple TUs.

예를 들면, 하나의 TU가 4 개의 TU들로 분할되는 경우, 분할에 의해 생성된 4 개의 TU들의 각 TU의 가로 크기 및 세로 크기는 각각 분할 전의 TU의 가로 크기의 절반 및 세로 크기의 절반일 수 있다. 32x32 크기의 TU가 4 개의 TU들로 분할되는 경우, 분할된 4 개의 TU들의 크기들은 16x16일 수 있다. 하나의 TU가 4 개의 TU들로 분할되는 경우, TU가 쿼드-트리 형태로 분할되었다고 할 수 있다.For example, when one TU is split into four TUs, the horizontal and vertical sizes of each of the four TUs created by the split are half the horizontal size and half the vertical size of the TU before splitting, respectively. You can. When a TU of size 32x32 is divided into 4 TUs, the sizes of the 4 divided TUs may be 16x16. When one TU is divided into four TUs, it can be said that the TU is divided into a quad-tree form.

예를 들면, 하나의 TU가 2 개의 TU들로 분할되는 경우, 분할에 의해 생성된 2 개의 TU들의 각 TU의 가로 크기 또는 세로 크기는 각각 분할 전의 TU의 가로 크기의 절반 또는 세로 크기의 절반일 수 있다. 32x32 크기의 TU가 2 개의 TU들로 세로로 분할되는 경우, 분할된 2 개의 TU들의 크기들은 16x32일 수 있다. 32x32 크기의 TU가 2 개의 TU들로 가로로 분할되는 경우, 분할된 2 개의 TU들의 크기들은 32x16일 수 있다. 하나의 TU가 2 개의 TU들로 분할되는 경우, TU가 이진-트리 형태로 분할되었다고 할 수 있다.For example, when one TU is split into two TUs, the horizontal or vertical size of each TU of the two TUs created by the split is half the horizontal size or half the vertical size of the TU before splitting, respectively. You can. When a TU of size 32x32 is vertically divided into two TUs, the sizes of the two divided TUs may be 16x32. When a TU of size 32x32 is horizontally divided into two TUs, the sizes of the two divided TUs may be 32x16. When one TU is divided into two TUs, it can be said that the TU is divided into a binary-tree form.

도 5에서 도시된 것 외의 다른 방식으로 CU가 분할될 수도 있다.The CU may be divided in a manner other than that shown in FIG. 5.

예를 들면, 하나의 CU는 3 개의 CU들로 분할될 수 있다. 분할된 3 개의 CU들의 가로 크기 또는 세로 크기는 각각 분할전의 CU의 가로 크기 또는 세로 크기의 1/4, 1/2 및 1/4일 수 있다.For example, one CU can be divided into three CUs. The horizontal or vertical size of the three divided CUs may be 1/4, 1/2, and 1/4 of the horizontal or vertical size of the CU before division, respectively.

일 예로, 32x32 크기의 CU가 3 개의 CU들로 세로로 분할되는 경우, 분할된 3 개의 CU들의 크기들은 각각 8x32, 16x32 및 8x32일 수 있다. 이와 같이, 하나의 CU가 3 개의 CU들로 분할되는 경우, CU는 삼진 트리의 형태로 분할되었다고 볼 수 있다.For example, when a CU of size 32x32 is vertically divided into 3 CUs, the sizes of the 3 divided CUs may be 8x32, 16x32, and 8x32, respectively. In this way, when one CU is divided into three CUs, the CU can be viewed as being divided in the form of a ternary tree.

예시된 쿼드 트리의 형태의 분할, 이진 트리의 형태의 분할 및 삼진 트리의 형태의 분할 중 하나가 CU의 분할을 위해 적용될 수 있으며, 복수 개의 분할 방식들이 함께 조합되어 CU의 분할을 위해 사용될 수도 있다. 이 때, 복수 개의 분할 방식들이 조합되어 사용되는 경우를 복합 트리의 형태의 분할이라고 칭할 수 있다.One of the exemplified quad tree-type partitioning, binary tree-type partitioning, and ternary tree-type partitioning may be applied for partitioning the CU, and a plurality of partitioning methods may be combined together and used for partitioning the CU. . At this time, the case where a plurality of partitioning methods are used in combination can be referred to as partitioning in the form of a composite tree.

도 6은 일 예에 따른 블록의 분할을 나타낸다.Figure 6 shows division of a block according to an example.

영상의 부호화 및/또는 복호화의 과정에서, 도 6과 같이 대상 블록이 분할될 수 있다. 예를 들면, 대상 블록은 CU일 수 있다.In the process of encoding and/or decoding an image, the target block may be divided as shown in FIG. 6. For example, the target block may be a CU.

대상 블록의 분할을 위해, 분할 정보를 나타내는 지시자가 부호화 장치(100)로부터 복호화 장치(200)로 시그널링될 수 있다. 분할 정보는 대상 블록이 어떻게 분할되는가를 나타내는 정보일 수 있다.To split the target block, an indicator indicating splitting information may be signaled from the encoding device 100 to the decoding device 200. Splitting information may be information indicating how the target block is divided.

분할 정보는 분할 플래그(이하, "split_flag"로 표시), 쿼드-이진 플래그(이하, "QB_flag"로 표시), 쿼드 트리 플래그(이하, "quadtree_flag"로 표시), 이진 트리 플래그(이하, "binarytree_flag"로 표시) 및 이진 타입 플래그(이하, "Btype_flag"로 표시) 중 하나 이상일 수 있다.Splitting information includes split flag (hereinafter referred to as “split_flag”), quad-binary flag (hereinafter referred to as “QB_flag”), quad tree flag (hereinafter referred to as “quadtree_flag”), and binary tree flag (hereinafter referred to as “binarytree_flag”). It may be one or more of a binary type flag (hereinafter denoted as "Btype_flag").

split_flag는 블록이 분할되는지 여부를 나타내는 플래그일 수 있다. 예를 들면, split_flag의 값 1은 블록이 분할됨을 나타낼 수 있다. split_flag의 값 0은 블록이 분할되지 않음을 나타낼 수 있다.split_flag may be a flag indicating whether the block is split. For example, a value of 1 in split_flag may indicate that the block is split. A value of 0 for split_flag may indicate that the block is not split.

QB_flag는 블록이 쿼드 트리 형태 및 이진 트리 형태 중 어떤 형태로 분할되는가를 나타내는 플래그일 수 있다. 예를 들면, QB_flag의 값 0은 블록이 쿼드 트리 형태로 분할됨을 나타낼 수 있다. QB_flag의 값 1은 블록이 이진 트리 형태로 분할됨을 나타낼 수 있다. 또는, QB_flag의 값 0은 블록이 이진 트리 형태로 분할됨을 나타낼 수 있다. QB_flag의 값 1은 블록이 쿼드 트리 형태로 분할됨을 나타낼 수 있다.QB_flag may be a flag indicating whether the block is divided into a quad tree format or a binary tree format. For example, a value of 0 for QB_flag may indicate that the block is divided into a quad tree format. A value of 1 for QB_flag may indicate that the block is divided into a binary tree form. Alternatively, the value of QB_flag 0 may indicate that the block is divided into a binary tree form. A value of 1 in QB_flag may indicate that the block is divided into a quad tree format.

quadtree_flag는 블록이 쿼드 트리 형태로 분할되는지 여부를 나타내는 플래그일 수 있다. 예를 들면, quadtree_flag의 값 1은 블록이 쿼드 트리 형태로 분할됨을 나타낼 수 있다. quadtree_flag의 값 0은 블록이 쿼드 트리 형태로 분할되지 않음을 나타낼 수 있다.quadtree_flag may be a flag indicating whether the block is divided into a quad tree format. For example, a value of 1 in quadtree_flag may indicate that the block is divided into a quad tree format. A value of 0 for quadtree_flag may indicate that the block is not divided into a quad tree format.

binarytree_flag는 블록이 이진 트리 형태로 분할되었는지 여부를 나타내는 플래그일 수 있다. 예를 들면, binarytree_flag의 값 1은 블록이 이진 트리 형태로 분할됨을 나타낼 수 있다. binarytree_flag의 값 0은 블록이 이진 트리 형태로 분할되지 않음을 나타낼 수 있다.binarytree_flag may be a flag indicating whether the block is divided in binary tree form. For example, a value of 1 in binarytree_flag may indicate that the block is split into a binary tree. A value of 0 for binarytree_flag may indicate that the block is not divided into a binary tree form.

Btype_flag는 블록이 이진 트리 형태로 분할되는 경우, 수직 분할 및 수평 분할 중 어떤 것으로 분할되었는지를 나타내는 플래그일 수 있다. 예를 들면, Btype_flag의 값 0은 블록이 수평 방향으로 분할됨을 나타낼 수 있다. Btype_flag의 값 1은 블록이 수직 방향으로 분할됨을 나타낼 수 있다. 또는, Btype_flag의 값 0은 블록이 수직 방향으로 분할되었음을 나타낼 수 있다. Btype_flag의 값 1은 블록이 수평 방향으로 분할되었음을 나타낼 수 있다.Btype_flag may be a flag indicating whether the block is divided into vertical division or horizontal division when the block is divided into binary tree form. For example, a value of 0 in Btype_flag may indicate that the block is divided in the horizontal direction. A value of 1 in Btype_flag may indicate that the block is divided in the vertical direction. Alternatively, the value 0 of Btype_flag may indicate that the block is divided in the vertical direction. A value of 1 in Btype_flag may indicate that the block is divided in the horizontal direction.

예를 들면, 도 6의 블록에 대한 분할 정보는 아래의 표 1과 같이 quadtree_flag, binarytree_flag 및 Btype_flag 중 적어도 하나를 시그널링함으로써 유도할 수 있다.For example, partition information for the block of FIG. 6 can be derived by signaling at least one of quadtree_flag, binarytree_flag, and Btype_flag as shown in Table 1 below.

[표 1][Table 1]

Figure pat00001
Figure pat00001

예를 들면, 도 6의 블록에 대한 분할 정보는 아래의 표 2와 같이 split_flag, QB_flag 및 Btype_flag 중 적어도 하나를 시그널링함으로써 유도할 수 있다.For example, split information for the block of FIG. 6 can be derived by signaling at least one of split_flag, QB_flag, and Btype_flag as shown in Table 2 below.

[표 2][Table 2]

Figure pat00002
Figure pat00002

분할 방법은 블록의 크기 및/또한 형태에 따라 쿼드 트리로만 제한될 수 있고, 또는 이진 트리로만 제한될 수 있다. 이러한 제한이 적용되는 경우, split_flag는 쿼드 트리 형태로의 분할 여부를 나타내는 플래그 또는 이진 트리 형태로의 분할 여부를 나타내는 플래그일 수 있다. 블록의 크기 및 형태는 블록의 깊이 정보에 따라서 유도될 수 있으며, 깊이 정보는 부호화 장치(100)로부터 복호화 장치(200)로 시그널링 될 수 있다. The partitioning method may be limited to quad trees only, or only binary trees, depending on the size and/or shape of the block. When this restriction is applied, split_flag may be a flag indicating whether to split into a quad tree form or a flag indicating whether to split into a binary tree form. The size and shape of the block can be derived according to the depth information of the block, and the depth information can be signaled from the encoding device 100 to the decoding device 200.

블록의 크기가 특정된 범위 내에 속하는 경우, 쿼드 트리 형태의 분할만이 가능할 수 있다. 예를 들면, 특정된 범위는 쿼드 트리 형태의 분할만이 가능한 최대 블록 크기 및 최소 블록 크기 중 적어도 하나에 의해 정의될 수 있다.If the size of the block falls within a specified range, only quad tree-type division may be possible. For example, the specified range may be defined by at least one of the maximum block size and minimum block size for which only quad tree-type division is possible.

쿼트 트리 형태의 분할만이 가능한 최대 블록 크기 및/또는 최소 블록 크기를 나타내는 정보는 비트스트림을 통해 부호화 장치(100)로부터 복호화 장치(200)로 시그널링될 수 있다. 또한, 이러한 정보는 비디오, 시퀀스, 픽처, 파라미터, 타일 그룹 및 슬라이스(또는, 세그먼트) 중 적어도 하나의 단위에 대하여 시그널링될 수 있다.Information indicating the maximum block size and/or minimum block size for which only quad tree-type division is possible may be signaled from the encoding device 100 to the decoding device 200 through a bitstream. Additionally, this information may be signaled for at least one unit among video, sequence, picture, parameter, tile group, and slice (or segment).

또는, 최대 블록 크기 및/또는 최소 블록 크기는 부호화 장치(100) 및 복호화 장치(200)에서 기정의된 고정된 크기일 수 있다. 예를 들면, 블록의 크기가 64x64의 이상이며, 256x256의 이하인 경우에는 쿼드 트리 형태의 분할만이 가능할 수 있다. 이러한 경우, split_flag는 쿼드 트리 형태로의 분할 여부를 나타내는 플래그일 수 있다.Alternatively, the maximum block size and/or minimum block size may be fixed sizes predefined in the encoding device 100 and the decoding device 200. For example, if the block size is 64x64 or larger and 256x256 or smaller, only quad tree type division may be possible. In this case, split_flag may be a flag indicating whether to split into quad tree form.

블록의 크기가 최대 변환 블록 크기보다 더 큰 경우, 쿼드 트리 형태의 분할만이 가능할 수 있다. 이 때, 분할되는 블록은 CU 및 TU 중 적어도 하나일 수 있다.If the block size is larger than the maximum conversion block size, only quad tree-type division may be possible. At this time, the divided block may be at least one of CU and TU.

이러한 경우, split_flag는 쿼드 트리 형태로의 분할 여부를 나타내는 플래그일 수 있다.In this case, split_flag may be a flag indicating whether to split into quad tree form.

블록의 크기가 특정된 범위 내에 속하는 경우, 이진 트리 형태 또는 삼진 트리 형태의 분할만이 가능할 수 있다. 여기서, 예를 들면, 특정된 범위는 이진 트리 형태 또는 삼진 트리 형태의 분할만이 가능한 최대 블록 크기 및 최소 블록 크기 중 적어도 하나에 의해 정의될 수 있다.If the block size falls within a specified range, only binary tree or ternary tree division may be possible. Here, for example, the specified range may be defined by at least one of the maximum block size and minimum block size for which only division in the form of a binary tree or a ternary tree is possible.

이진 트리 형태의 분할 또는 삼진 트리 형태의 분할만이 가능한 최대 블록 크기 및/또는 최소 블록 크기를 나타내는 정보는 비트스트림을 통해 부호화 장치(100)로부터 복호화 장치(200)로 시그널링될 수 있다. 또한, 이러한 정보는 시퀀스, 픽처 및 슬라이스(또는, 세그먼트) 중 적어도 하나의 단위에 대하여 시그널링될 수 있다.Information indicating the maximum block size and/or minimum block size for which only binary tree-type splitting or ternary tree-type splitting is possible may be signaled from the encoding device 100 to the decoding device 200 through a bitstream. Additionally, this information may be signaled for at least one unit among sequence, picture, and slice (or segment).

또는, 최대 블록 크기 및/또는 최소 블록 크기는 부호화 장치(100) 및 복호화 장치(200)에서 기정의된 고정된 크기일 수 있다. 예를 들면, 블록의 크기가 8x8의 이상이며, 16x16의 이하인 경우에는 이진 트리 형태의 분할만이 가능할 수 있다. 이러한 경우, split_flag는 이진 트리 형태 또는 삼진 트리 형태로의 분할 여부를 나타내는 플래그일 수 있다.Alternatively, the maximum block size and/or minimum block size may be fixed sizes predefined in the encoding device 100 and the decoding device 200. For example, if the block size is 8x8 or larger and 16x16 or smaller, only division in the form of a binary tree may be possible. In this case, split_flag may be a flag indicating whether to split in binary tree form or ternary tree form.

전술된 쿼드 트리 형태의 분할에 관한 설명은 이진 트리 형태 및/또는 삼진 트리 형태의 분할에 대해서도 동일하게 적용될 수 있다.The above-described description of quad tree-type partitioning can be equally applied to binary tree-type and/or ternary-tree form partitioning.

블록의 분할은 이전의 분할에 의해 제한될 수 있다. 예를 들면, 블록이 특정된 이진 트리 형태로 분할되어 복수의 분할된 블록들이 생성된 경우, 각 분할된 블록은 특정된 트리 형태로만 추가로 분할될 수 있다. 여기에서, 특정된 트리 형태는 이진 트리 형태, 삼진 트리 형태 및 쿼드 트리 형태 중 적어도 하나일 수 있다.Splitting of a block may be limited by previous splitting. For example, when a block is divided into a specified binary tree form and a plurality of divided blocks are created, each divided block can be further divided only into the specified tree form. Here, the specified tree form may be at least one of a binary tree form, a ternary tree form, and a quad tree form.

분할된 블록의 가로 크기 또는 세로 크기가 더 이상 분할될 수 없는 크기에 해당하는 경우 전술된 지시자는 시그널링되지 않을 수 있다.If the horizontal or vertical size of the divided block corresponds to a size that cannot be further divided, the above-described indicator may not be signaled.

도 7은 인트라 예측 과정의 실시예를 설명하기 위한 도면이다.Figure 7 is a diagram for explaining an embodiment of the intra prediction process.

도 7의 그래프의 중심으로부터 외곽으로의 화살표들은 방향성 인트라 예측 모드들의 예측 방향들을 나타낼 수 있다. 또한, 화살표에 근접하게 표시된 숫자는 인트라 예측 모드 또는 인트라 예측 모드의 예측 방향에 할당된 모드 값의 일 예를 나타낼 수 있다.Arrows from the center of the graph of FIG. 7 to the outside may indicate prediction directions of directional intra prediction modes. Additionally, numbers displayed close to the arrows may represent an example of a mode value assigned to the intra prediction mode or the prediction direction of the intra prediction mode.

도 7에서, 숫자 0은 비방향성 인트라 예측 모드인 플래너(Planar) 모드를 나타낼 수 있다. 숫자 1은 비방향성 인트라 예측 모드인 디씨(DC) 모드를 나타낼 수 있다.In FIG. 7, the number 0 may represent Planar mode, which is a non-directional intra prediction mode. The number 1 may represent DC mode, which is a non-directional intra prediction mode.

인트라 부호화 및/또는 복호화는 대상 블록의 이웃 블록의 참조 샘플을 이용하여 수행될 수 있다. 이웃 블록은 재구축된 이웃 블록일 수 있다. 참조 샘플은 이웃 샘플을 의미할 수 있다.Intra encoding and/or decoding may be performed using reference samples of neighboring blocks of the target block. The neighboring block may be a reconstructed neighboring block. A reference sample may refer to a neighboring sample.

예를 들면, 인트라 부호화 및/또는 복호화는 재구축된 이웃 블록이 포함하는 참조 샘플의 값 또는 코딩 파라미터를 이용하여 수행될 수 있다.For example, intra encoding and/or decoding may be performed using the value or coding parameter of a reference sample included in the reconstructed neighboring block.

부호화 장치(100) 및/또는 복호화 장치(200)는 대상 영상 내의 샘플의 정보에 기초하여 대상 블록에 대한 인트라 예측을 수행함으로써 예측 블록을 생성할 수 있다. 인트라 예측을 수행할 때, 부호화 장치(100) 및/또는 복호화 장치(200)는 대상 영상 내의 샘플의 정보에 기반하여 인트라 예측을 수행함으로써 대상 블록에 대한 예측 블록을 생성할 수 있다. 인트라 예측을 수행할 때, 부호화 장치(100) 및/또는 복호화 장치(200)는 적어도 하나의 재구축된 참조 샘플에 기반하여 방향성 예측 및/또는 비방향성 예측을 수행할 수 있다.The encoding device 100 and/or the decoding device 200 may generate a prediction block by performing intra prediction on the target block based on information on samples in the target image. When performing intra prediction, the encoding device 100 and/or the decoding device 200 may generate a prediction block for the target block by performing intra prediction based on information on samples in the target image. When performing intra prediction, the encoding device 100 and/or the decoding device 200 may perform directional prediction and/or non-directional prediction based on at least one reconstructed reference sample.

예측 블록은 인트라 예측의 수행의 결과로 생성된 블록을 의미할 수 있다. 예측 블록은 CU, PU 및 TU 중 적어도 하나에 해당할 수 있다.A prediction block may refer to a block generated as a result of performing intra prediction. A prediction block may correspond to at least one of CU, PU, and TU.

예측 블록의 단위는 CU, PU 및 TU 중 적어도 하나의 크기일 수 있다. 예측 블록은 2Nx2N의 크기 또는 NxN의 크기를 갖는, 정사각형의 형태를 가질 수 있다. NxN의 크기는 4x4, 8x8, 16x16, 32x32 및 64x64 등을 포함할 수 있다.The unit of the prediction block may be the size of at least one of CU, PU, and TU. The prediction block may have a square shape with a size of 2Nx2N or NxN. NxN sizes can include 4x4, 8x8, 16x16, 32x32, and 64x64.

또는, 예측 블록은 2x2, 4x4, 8x8, 16x16, 32x32 또는 64x64 등의 크기를 갖는 정사각형의 형태의 블록일 수 있고, 2x8, 4x8, 2x16, 4x16 및 8x16 등의 크기를 갖는 직사각형 모양의 블록일 수도 있다.Alternatively, the prediction block may be a square-shaped block with a size of 2x2, 4x4, 8x8, 16x16, 32x32, or 64x64, or a rectangular block with a size of 2x8, 4x8, 2x16, 4x16, and 8x16. there is.

인트라 예측은 대상 블록에 대한 인트라 예측 모드에 따라 수행될 수 있다. 대상 블록이 가질 수 있는 인트라 예측 모드의 개수는 기정의된 고정된 값일 수 있으며, 예측 블록의 속성에 따라 다르게 결정된 값일 수 있다. 예를 들면, 예측 블록의 속성은 예측 블록의 크기 및 예측 블록의 타입 등을 포함할 수 있다. 또한, 예측 블록의 속성은 예측 블록에 대한 코딩 파라미터를 가리킬 수 있다.Intra prediction may be performed according to the intra prediction mode for the target block. The number of intra prediction modes that a target block can have may be a predefined fixed value or a value determined differently depending on the properties of the prediction block. For example, properties of the prediction block may include the size of the prediction block and the type of the prediction block. Additionally, properties of a prediction block may indicate coding parameters for the prediction block.

예를 들면, 인트라 예측 모드의 개수는 예측 블록의 크기에 관계없이 N 개로 고정될 수 있다. 또는, 예를 들면, 인트라 예측 모드의 개수는 3, 5, 9, 17, 34, 35, 36, 65, 67 또는 95 등일 수 있다.For example, the number of intra prediction modes may be fixed to N regardless of the size of the prediction block. Or, for example, the number of intra prediction modes may be 3, 5, 9, 17, 34, 35, 36, 65, 67, or 95.

인트라 예측 모드는 비방향성(non-directional) 모드 또는 방향성(directional) 모드일 수 있다.The intra prediction mode may be a non-directional mode or a directional mode.

예를 들면, 인트라 예측 모드는, 도 7에서 도시된 번호 0 내지 66에 대응하는, 2 개의 비방향성 모드들 및 65 개의 방향성 모드들을 포함할 수 있다.For example, an intra prediction mode may include 2 undirectional modes and 65 directional modes, corresponding to numbers 0 to 66 shown in FIG. 7 .

예를 들면, 특정된 인트라 예측 방법이 사용되는 경우, 인트라 예측 모드는 도 7에서 도시된 번호 -14 내지 80에 대응하는, 2 개의 비방향성 모드들 및 93 개의 방향성 모드들을 포함할 수 있다.For example, when a specified intra prediction method is used, the intra prediction mode may include 2 undirectional modes and 93 directional modes, corresponding to numbers -14 to 80 shown in FIG. 7.

2 개의 비방향성 모드들은 디씨(DC) 모드 및 플래너(Planar) 모드를 포함할 수 있다.The two non-directional modes may include DC mode and Planar mode.

방향성 모드는 특정한 방향 또는 특정한 각도를 갖는 예측 모드일 수 있다. 방향성 모드는 각 모드(argular mode)로 칭해질 수도 있다.The directional mode may be a prediction mode with a specific direction or a specific angle. Directional mode may also be referred to as an argular mode.

인트라 예측 모드는 모드 번호, 모드 값 모드 각도 및 모드 방향 중 적어도 하나로 표현될 수 있다. 말하자면, 용어들 "인트라 예측 모드의 (모드) 번호", "인트라 예측 모드의 (모드) 값", "인트라 예측 모드의 (모드) 각도" 및 "인트라 예측 모드의 (모드) 방향)은 동일한 의미로 사용될 수 있으며, 서로 교체되어 사용될 수 있다.The intra prediction mode may be expressed by at least one of a mode number, mode value, mode angle, and mode direction. That is to say, the terms “(mode) number of intra prediction mode”, “(mode) value of intra prediction mode”, “(mode) angle of intra prediction mode” and “(mode) direction of intra prediction mode” have the same meaning. can be used, and can be used interchangeably.

인트라 예측 모드의 개수는 M일 수 있다. M은 1 이상일 수 있다. 말하자면, 인트라 예측 모드는 비방향성 모드의 개수 및 방향성 모드의 개수를 포함하는 M 개일 수 있다.The number of intra prediction modes may be M. M may be 1 or more. In other words, the number of intra prediction modes may be M, including the number of non-directional modes and the number of directional modes.

인트라 예측 모드의 개수는 블록의 크기 및/또는 색 성분(color component)에 관계없이 M 개로 고정될 수 있다. 예를 들면, 인트라 예측 모드의 개수는, 블록의 크기와 무관하게, 35 또는 67 중 하나로 고정될 수 있다.The number of intra prediction modes may be fixed to M regardless of the size and/or color component of the block. For example, the number of intra prediction modes may be fixed to either 35 or 67, regardless of the block size.

또는, 인트라 예측 모드의 개수는 블록의 모양, 크기 및/또는 색 성분의 타입에 따라 상이할 수 있다.Alternatively, the number of intra prediction modes may vary depending on the shape, size, and/or type of color component of the block.

예를 들면, 도 7에서, 점선으로 도시된 방향성 예측 모드들은 비-정사각형(non-square) 블록에 대한 예측에만 적용될 수 있다.For example, in FIG. 7, directional prediction modes shown in dotted lines can only be applied to prediction for non-square blocks.

예를 들면, 블록의 크기가 커질수록 인트라 예측 모드의 개수는 많아질 수 있다. 또는, 블록의 크기가 커질수록 인트라 예측 모드의 개수는 적어질 수 있다. 블록의 크기가 4x4 또는 8x8인 경우에는 인트라 예측 모드의 개수는 67일 수 있다. 블록의 크기가 16x16인 경우에는 인트라 예측 모드의 개수는 35일 수 있다. 블록의 크기가 32x32인 경우에는 인트라 예측 모드의 개수는 19일 수 있다. 블록의 크기가 64x64인 경우에는 인트라 예측 모드의 개수는 7일 수 있다.For example, as the block size increases, the number of intra prediction modes may increase. Alternatively, as the block size increases, the number of intra prediction modes may decrease. If the block size is 4x4 or 8x8, the number of intra prediction modes may be 67. If the block size is 16x16, the number of intra prediction modes may be 35. If the block size is 32x32, the number of intra prediction modes may be 19. If the block size is 64x64, the number of intra prediction modes may be 7.

예를 들면, 색 성분이 루마(luma) 신호인지 아니면 크로마(chroma) 신호인지에 따라 인트라 예측 모드의 개수가 다를 수 있다. 또는 루마 성분 블록의 인트라 예측 모드의 개수는 크로마 성분 블록의 인트라 예측 모드의 개수보다 더 클 수 있다.For example, the number of intra prediction modes may vary depending on whether the color component is a luma signal or a chroma signal. Alternatively, the number of intra prediction modes of the luma component block may be greater than the number of intra prediction modes of the chroma component block.

예를 들면, 모드 값이 50인 수직 모드의 경우, 참조 샘플의 픽셀 값에 기반하여 수직 방향으로 예측이 수행될 수 있다. 예를 들면, 모드 값이 18인 수평 모드의 경우, 참조 샘플의 픽셀 값에 기반하여 수평 방향으로 예측이 수행될 수 있다.For example, in the case of vertical mode with a mode value of 50, prediction may be performed in the vertical direction based on the pixel value of the reference sample. For example, in the case of horizontal mode with a mode value of 18, prediction may be performed in the horizontal direction based on the pixel value of the reference sample.

전술된 모드 이외의 방향성 모드인 경우에도 부호화 장치(100) 및 복호화 장치(200)는 방향성 모드에 대응하는 각도에 따라 참조 샘플을 이용하여 대상 유닛에 대한 인트라 예측을 수행할 수 있다.Even in the case of a directional mode other than the above-described mode, the encoding device 100 and the decoding device 200 can perform intra prediction on the target unit using a reference sample according to the angle corresponding to the directional mode.

수직 모드의 우측에 위치한 인트라 예측 모드는 수직 우측 모드(vertical-right mode)로 명명될 수 있다. 수평 모드의 하단에 위치한 인트라 예측 모드는 수형 하단 모드(horizontal-below mode)로 명명될 수 있다. 예를 들면, 도 7에서, 모드 값이 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65 및 66 중 하나인 인트라 예측 모드들은 수직 우측 모드들일 수 있다. 모드 값이 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 및 17 중 하나인 인트라 예측 모드들은 수평 하단 모드들일 수 있다.The intra prediction mode located to the right of the vertical mode may be named vertical-right mode. The intra prediction mode located below the horizontal mode may be named the horizontal-below mode. For example, in Figure 7, intra prediction modes with mode values one of 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, and 66 are vertical These may be the right modes. Intra prediction modes with mode values of one of 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, and 17 may be horizontal bottom modes.

비방향성 모드는 디씨(DC) 모드 및 플래너(planar) 모드를 포함할 수 있다. 예를 들면, 디씨 모드의 모드 값은 1일 수 있다. 플래너 모드의 모드 값은 0일 수 있다.Non-directional modes may include DC mode and planar mode. For example, the mode value of DC mode may be 1. The mode value of the planner mode may be 0.

방향성 모드는 각진(angular) 모드를 포함할 수 있다. 복수의 인트라 예측 모드들 중 DC 모드 및 플래너 모드를 제외한 나머지의 모드는 방향성 모드일 수 있다.Directional modes may include angular modes. Among the plurality of intra prediction modes, the remaining modes except DC mode and planner mode may be directional modes.

인트라 예측 모드가 DC 모드인 경우, 복수의 참조 샘플들의 픽셀 값들의 평균에 기반하여 예측 블록이 생성될 수 있다. 예를 들면, 예측 블록의 픽셀의 값은 복수의 참조 샘플들의 픽셀 값들의 평균에 기반하여 결정될 수 있다.When the intra prediction mode is DC mode, a prediction block may be generated based on the average of pixel values of a plurality of reference samples. For example, the pixel value of the prediction block may be determined based on the average of pixel values of a plurality of reference samples.

전술된 인트라 예측 모드들의 개수 및 각 인트라 예측 모드들의 모드 값은 단지 예시적인 것일 수 있다. 전술된 인트라 예측 모드들의 개수 및 각 인트라 예측 모드들의 모드 값은 실시예, 구현 및/또는 필요에 따라 다르게 정의될 수도 있다.The number of intra prediction modes described above and the mode value of each intra prediction mode may be merely exemplary. The number of intra prediction modes described above and the mode value of each intra prediction mode may be defined differently depending on embodiment, implementation, and/or need.

대상 블록에 대한 인트라 예측을 수행하기 위해 재구축된 이웃 블록에 포함되는 샘플들이 대상 블록의 참조 샘플로서 이용될 수 있는지 여부를 검사하는 단계가 수행될 수 있다. 이웃 블록의 샘플들 중 대상 블록의 참조 샘플로 이용할 수 없는 샘플이 존재하는 경우, 재구축된 이웃 블록에 포함된 샘플들 중 적어도 하나의 샘플 값을 사용하는 복사 및/또는 보간에 의해 생성된 값이 참조 샘플로 이용될 수 없는 샘플의 샘플 값으로 대체될 수 있다. 복사 및/또는 보간에 의해 생성된 값이 샘플의 샘플 값으로 대체되면, 샘플이 대상 블록의 참조 샘플로서 이용될 수 있다.In order to perform intra prediction on the target block, a step may be performed to check whether samples included in the reconstructed neighboring block can be used as reference samples of the target block. If there is a sample among the samples of a neighboring block that cannot be used as a reference sample of the target block, a value generated by copying and/or interpolation using at least one sample value among the samples included in the reconstructed neighboring block. This can be replaced with the sample value of a sample that cannot be used as a reference sample. If the value generated by copying and/or interpolation is replaced with the sample value of the sample, the sample can be used as a reference sample of the target block.

인트라 예측이 사용될 때, 인트라 예측 모드 및 대상 블록의 크기 중 적어도 하나에 기반하여 참조 샘플 또는 예측 샘플 중 적어도 하나에 필터가 적용될 수 있다.When intra prediction is used, a filter may be applied to at least one of a reference sample or a prediction sample based on at least one of the intra prediction mode and the size of the target block.

참조 샘플 또는 예측 샘플 중 적어도 하나에 적용되는 필터의 타입은 대상 블록의 인트라 예측 모드, 대상 블록의 크기 및 대상 블록의 형태 중 적어도 하나에 따라서 다를 수 있다. 필터의 타입은 필터 탭(tap)의 길이, 필터 계수의 값 및 필터 강도 중 하나 이상에 따라서 분류될 수 있다. 상기의 필터 탭의 길이는 필터 탭 수를 의미할 수 있다. 또한, 필터 탭 수는 필터의 길이를 의미할 수 있다.The type of filter applied to at least one of the reference sample and the prediction sample may vary depending on at least one of the intra prediction mode of the target block, the size of the target block, and the shape of the target block. The type of filter can be classified according to one or more of the length of the filter tap, the value of the filter coefficient, and the filter strength. The length of the above filter tabs may mean the number of filter tabs. Additionally, the number of filter tabs may mean the length of the filter.

인트라 예측 모드가 플래너 모드인 경우, 대상 블록의 예측 블록을 생성함에 있어서, 예측 대상 샘플의 예측 블록 내 위치에 따라, 대상 샘플의 상단 참조 샘플, 대상 샘플의 좌측 참조 샘플, 대상 블록의 우상단 참조 샘플 및 대상 블록의 좌하단 참조 샘플의 가중치가 부여된 합(weight-sum)을 이용하여 예측 대상 샘플의 샘플 값이 생성될 수 있다.When the intra prediction mode is planar mode, when generating the prediction block of the target block, depending on the location of the prediction target sample in the prediction block, the upper reference sample of the target sample, the left reference sample of the target sample, and the upper right reference sample of the target block And the sample value of the prediction target sample may be generated using the weighted sum (weight-sum) of the lower left reference sample of the target block.

인트라 예측 모드가 DC 모드인 경우, 대상 블록의 예측 블록을 생성함에 있어서, 대상 블록의 상단 참조 샘플들 및 좌측 참조 샘플들의 평균 값이 이용될 수 있다. 또한, 대상 블록 내의 특정된 행들 또는 특정된 열들에 대해서는 참조 샘플들의 값들을 이용하는 필터링이 수행될 수 있다. 특정된 행들은 참조 샘플과 인접한 하나 이상의 상단 행들일 수 있다. 특정된 열들은 참조 샘플과 인접한 하나 이상의 좌측 열들일 수 있다.When the intra prediction mode is DC mode, when generating the prediction block of the target block, the average value of the top reference samples and the left reference samples of the target block can be used. Additionally, filtering using values of reference samples may be performed on specified rows or specified columns within the target block. The rows specified may be one or more top rows adjacent to the reference sample. The specified columns may be one or more left columns adjacent to the reference sample.

인트라 예측 모드가 방향성 모드인 경우 대상 블록의 상단 참조 샘플, 좌측 참조 샘플, 우상단 참조 샘플 및/또는 좌하단 참조 샘플을 이용하여 예측 블록이 생성될 수 있다.When the intra prediction mode is a directional mode, a prediction block may be generated using the top reference sample, left reference sample, top right reference sample, and/or bottom left reference sample of the target block.

전술된 예측 샘플을 생성하기 위해 실수 단위의 보간이 수행될 수도 있다. Real-valued interpolation may be performed to generate the prediction samples described above.

대상 블록의 인트라 예측 모드는 대상 블록의 이웃 블록의 인트라 예측 모드로부터 예측될 수 있으며, 예측을 위해 사용되는 정보가 엔트로피 부호화/복호화될 수 있다.The intra prediction mode of the target block may be predicted from the intra prediction mode of the target block's neighboring block, and information used for prediction may be entropy encoded/decoded.

예를 들면, 대상 블록 및 이웃 블록의 인트라 예측 모드들이 동일하면 기정의된 플래그를 이용하여 대상 블록 및 이웃 블록의 인트라 예측 모드들이 동일하다는 것이 시그널링될 수 있다.For example, if the intra prediction modes of the target block and the neighboring block are the same, it may be signaled that the intra prediction modes of the target block and the neighboring block are the same using a predefined flag.

예를 들면, 복수의 이웃 블록들의 인트라 예측 모드들 중 대상 블록의 인트라 예측 모드와 동일한 인트라 예측 모드를 가리키는 지시자가 시그널링될 수 있다.For example, an indicator indicating an intra prediction mode that is the same as the intra prediction mode of the target block among the intra prediction modes of a plurality of neighboring blocks may be signaled.

대상 블록 및 이웃 블록의 인트라 예측 모드들이 서로 다르면, 엔트로피 부호화 및/또는 복호화를 사용하여 대상 블록의 인트라 예측 모드의 정보가 부호화 및/또는 복호화될 수 있다.If the intra prediction modes of the target block and the neighboring block are different from each other, information on the intra prediction mode of the target block may be encoded and/or decoded using entropy coding and/or decoding.

도 8은 인트라 예측 과정에서 사용되는 참조 샘플을 설명하기 위한 도면이다.Figure 8 is a diagram for explaining reference samples used in the intra prediction process.

대상 블록의 인트라 예측에 사용되는 재구축된 참조 샘플은 하단 좌측(below-left) 참조 샘플들, 좌측(left) 참조 샘플들, 상단 좌측(above-left) 코너 참조 샘플, 상단(above) 참조 샘플들 및 상단 우측(above-right) 참조 샘플들 등을 포함할 수 있다.The reconstructed reference samples used for intra prediction of the target block are below-left reference samples, left reference samples, above-left corner reference samples, and above reference samples. and above-right reference samples, etc.

예를 들면, 좌측 참조 샘플들은 대상 블록의 좌측에 인접한 재구축된 참조 픽셀을 의미할 수 있다. 상단 참조 샘플들은 대상 블록의 상단에 인접한 재구축된 참조 픽셀을 의미할 수 있다. 상단 좌측 코너 참조 샘플은 대상 블록의 상단 좌측 코너에 위치한 재구축된 참조 픽셀을 의미할 수 있다. 또한, 하단 좌측 참조 샘플들은 좌측 참조 샘플들로 구성된 좌측 샘플 라인과 동일 선상에 위치한 샘플들 중에서 좌측 샘플 라인의 하단에 위치한 참조 샘플을 의미할 수 있다. 상단 우측 참조 샘플들은 상단 참조 샘플들로 구성된 상단 샘플 라인과 동일 선상에 위치한 샘플들 중에서 상단 픽셀 라인의 우측에 위치한 참조 샘플들을 의미할 수 있다.For example, left reference samples may refer to reconstructed reference pixels adjacent to the left side of the target block. Top reference samples may refer to reconstructed reference pixels adjacent to the top of the target block. The upper left corner reference sample may refer to a reconstructed reference pixel located at the upper left corner of the target block. Additionally, the lower left reference samples may refer to a reference sample located at the bottom of the left sample line among samples located on the same line as the left sample line composed of left reference samples. The upper right reference samples may refer to reference samples located to the right of the upper pixel line among samples located on the same line as the upper sample line composed of upper reference samples.

대상 블록의 크기가 NxN일 때, 하단 좌측 참조 샘플들, 좌측 참조 샘플들, 상단 참조 샘플들 및 상단 우측 참조 샘플들은 각각 N개일 수 있다.When the size of the target block is NxN, the number of bottom left reference samples, left reference samples, top reference samples, and top right reference samples may each be N.

대상 블록에 대한 인트라 예측을 통해 예측 블록이 생성될 수 있다. 예측 블록의 생성은 예측 블록의 픽셀들의 값이 결정되는 것을 포함할 수 있다. 대상 블록 및 예측 블록의 크기는 동일할 수 있다.A prediction block may be generated through intra prediction for the target block. Generating a prediction block may include determining values of pixels of the prediction block. The sizes of the target block and prediction block may be the same.

대상 블록의 인트라 예측에 사용되는 참조 샘플은 대상 블록의 인트라 예측 모드에 따라 달라질 수 있다. 인트라 예측 모드의 방향은 참조 샘플들 및 예측 블록의 픽셀들 간의 의존 관계를 나타낼 수 있다. 예를 들면, 특정된 참조 샘플의 값이 예측 블록의 특정된 하나 이상의 픽셀들의 값으로서 사용될 수 있다. 이 경우, 특정된 참조 샘플 및 예측 블록의 특정된 하나 이상의 픽셀들은 인트라 예측 모드의 방향의 직선으로 지정되는 샘플 및 픽셀들일 수 있다. 말하자면, 특정된 참조 샘플의 값은 인트라 예측 모드의 방향의 역방향에 위치한 픽셀의 값으로 복사될 수 있다. 또는, 예측 블록의 픽셀의 값은 상기의 픽셀의 위치를 기준으로 인트라 예측 모드의 방향에 위치한 참조 샘플의 값일 수 있다.The reference sample used for intra prediction of the target block may vary depending on the intra prediction mode of the target block. The direction of the intra prediction mode may indicate a dependency relationship between reference samples and pixels of the prediction block. For example, the value of a specified reference sample can be used as the value of one or more specified pixels of the prediction block. In this case, the specified reference sample and one or more specified pixels of the prediction block may be samples and pixels designated by a straight line in the direction of the intra prediction mode. In other words, the value of the specified reference sample can be copied to the value of the pixel located in the reverse direction of the intra prediction mode. Alternatively, the pixel value of the prediction block may be the value of a reference sample located in the direction of the intra prediction mode based on the position of the pixel.

예를 들면, 대상 블록의 인트라 예측 모드가 수직 모드인 경우, 상단 참조 샘플들이 인트라 예측에 사용될 수 있다. 인트라 예측 모드가 수직 모드인 경우, 예측 블록의 픽셀의 값은 상기의 픽셀의 위치를 기준으로 수직으로 위에 위치한 참조 샘플의 값일 수 있다. 따라서, 대상 블록에 상단으로 인접한 상단 참조 샘플들이 인트라 예측을 위해 사용될 수 있다. 또한, 예측 블록의 한 행의 픽셀들의 값들은 상단 참조 샘플들의 값들과 동일할 수 있다.For example, when the intra prediction mode of the target block is vertical mode, top reference samples can be used for intra prediction. When the intra prediction mode is a vertical mode, the pixel value of the prediction block may be the value of a reference sample located vertically above the position of the pixel. Therefore, top reference samples adjacent to the top of the target block can be used for intra prediction. Additionally, the values of pixels in one row of the prediction block may be the same as the values of the upper reference samples.

예를 들면, 대상 블록의 인트라 예측 모드가 수평 모드인 경우, 좌측 참조 샘플들이 인트라 예측에 사용될 수 있다. 인트라 예측 모드가 수평 모드인 경우, 예측 블록의 픽셀의 값은 상기의 픽셀을 기준으로 수평으로 좌측에 위치한 참조 샘플의 값일 수 있다. 따라서, 대상 블록에 좌측으로 인접한 좌측 참조 샘플들이 인트라 예측을 위해 사용될 수 있다. 또한, 예측 블록의 한 열의 픽셀들의 값들은 좌측 참조 샘플들의 값들과 동일할 수 있다.For example, when the intra prediction mode of the target block is horizontal mode, left reference samples can be used for intra prediction. When the intra prediction mode is a horizontal mode, the pixel value of the prediction block may be the value of a reference sample located horizontally to the left of the pixel. Therefore, left reference samples adjacent to the left of the target block can be used for intra prediction. Additionally, the values of pixels in one column of the prediction block may be the same as the values of the left reference samples.

예를 들면, 대상 블록의 인트라 예측 모드의 모드 값이 34인 경우 좌측 참조 샘플들의 적어도 일부, 상단 좌측 코너 참조 샘플 및 상단 참조 샘플들의 적어도 일부가 인트라 예측에 사용될 수 있다. 인트라 예측 모드의 모드 값이 34인 경우, 예측 블록의 픽셀의 값은 상기의 픽셀을 기준으로 대각선으로 상단 좌측에 위치한 참조 샘플의 값일 수 있다.For example, when the mode value of the intra prediction mode of the target block is 34, at least some of the left reference samples, the top left corner reference sample, and at least some of the top reference samples may be used for intra prediction. When the mode value of the intra prediction mode is 34, the pixel value of the prediction block may be the value of a reference sample located diagonally to the upper left with respect to the pixel.

또한, 모드 값이 52 내지 66 중 하나인 인트라 예측 모드가 사용되는 경우에는 상단 우측 참조 샘플들 중 적어도 일부가 인트라 예측에 사용될 수 있다.Additionally, when an intra prediction mode with a mode value of one of 52 to 66 is used, at least some of the upper right reference samples may be used for intra prediction.

또한, 모드 값이 2 내지 17 중 하나인 인트라 예측 모드가 사용되는 경우에는 하단 좌측 참조 샘플들 중 적어도 일부가 인트라 예측에 사용될 수 있다.Additionally, when an intra prediction mode with a mode value of one of 2 to 17 is used, at least some of the lower left reference samples may be used for intra prediction.

또한, 모드 값이 19 내지 49 중 하나인 인트라 예측 모드가 사용되는 경우에는 상단 좌측 코너 참조 샘플이 인트라 예측에 사용될 수 있다.Additionally, when an intra prediction mode with a mode value of one of 19 to 49 is used, the upper left corner reference sample can be used for intra prediction.

예측 블록의 하나의 픽셀의 픽셀 값을 결정하기 위해 사용되는 참조 샘플은 1개일 수 있고, 2개 이상일 수도 있다.The reference sample used to determine the pixel value of one pixel of the prediction block may be one or two or more.

전술된 것과 같이 예측 블록의 픽셀의 픽셀 값은 상기의 픽셀의 위치 및 인트라 예측 모드의 방향에 의해 가리켜지는 참조 샘플의 위치에 따라 결정될 수 있다. 픽셀의 위치 및 인트라 예측 모드의 방향에 의해 가리켜지는 참조 샘플의 위치가 정수 위치인 경우, 정수 위치가 가리키는 하나의 참조 샘플의 값이 예측 블록의 픽셀의 픽셀 값을 결정하기 위해 사용될 수 있다.As described above, the pixel value of the pixel of the prediction block may be determined according to the location of the pixel and the location of the reference sample indicated by the direction of the intra prediction mode. If the position of the reference sample indicated by the pixel position and the direction of the intra prediction mode is an integer position, the value of one reference sample indicated by the integer position may be used to determine the pixel value of the pixel of the prediction block.

픽셀의 위치 및 인트라 예측 모드의 방향에 의해 가리켜지는 참조 샘플의 위치가 정수 위치가 아닌 경우, 참조 샘플의 위치에 가장 가까운 2개의 참조 샘플들에 기반하여 보간된(interpolated) 참조 샘플이 생성될 수 있다. 보간된 참조 샘플의 값이 예측 블록의 픽셀의 픽셀 값을 결정하기 위해 사용될 수 있다. 말하자면, 예측 블록의 픽셀의 위치 및 인트라 예측 모드의 방향에 의해 가리켜지는 참조 샘플의 위치가 2개의 참조 샘플들 간의 사이를 나타낼 때, 상기의 2개의 샘플들의 값들에 기반하여 보간된 값이 생성될 수 있다.If the position of the reference sample indicated by the pixel position and the direction of the intra prediction mode is not an integer position, an interpolated reference sample can be generated based on the two reference samples closest to the position of the reference sample. there is. The value of the interpolated reference sample can be used to determine the pixel value of the pixel of the prediction block. In other words, when the position of the reference sample indicated by the position of the pixel of the prediction block and the direction of the intra prediction mode indicates the gap between two reference samples, an interpolated value is generated based on the values of the two samples. You can.

예측에 의해 생성된 예측 블록은 원래의 대상 블록과는 동일하지 않을 수 있다. 말하자면, 대상 블록 및 예측 블록 간의 차이(difference)인 예측 오차(prediction error)가 존재할 수 있으며, 대상 블록의 픽셀 및 예측 블록의 픽셀 간에도 예측 오차가 존재할 수 있다.The prediction block generated by prediction may not be identical to the original target block. In other words, a prediction error, which is a difference between the target block and the prediction block, may exist, and a prediction error may also exist between the pixels of the target block and the pixels of the prediction block.

이하에서, 용어들 "차이(difference)", "오차(error)" 및 "잔차(residual)"는 동일한 의미로 사용될 수 있으며, 서로 교체되어 사용될 수 있다.Hereinafter, the terms “difference”, “error” and “residual” may be used with the same meaning and may be used interchangeably.

예를 들면, 방향성 인트라 예측의 경우, 예측 블록의 픽셀 및 참조 샘플 간의 거리가 더 멀수록 더 큰 예측 오차가 발생할 수 있다. 이러한 예측 오차에 등 의해 생성된 예측 블록 및 이웃 블록 간에는 불연속성이 발생할 수 있다.For example, in the case of directional intra prediction, the larger the distance between the pixel of the prediction block and the reference sample, the larger the prediction error may occur. Discontinuity may occur between the prediction block and neighboring blocks generated due to such prediction errors.

예측 오차의 감소를 위해 예측 블록에 대한 필터링이 사용될 수 있다. 필터링은 예측 블록 중 큰 예측 오차를 갖는 것으로 간주되는 영역에 대해 적응적으로 필터를 적용하는 것일 수 있다. 예를 들면, 큰 예측 오차를 갖는 것으로 간주되는 영역은 예측 블록의 경계일 수 있다. 또한, 인트라 예측 모드에 따라서 예측 블록 중 큰 예측 오차를 갖는 것으로 간주되는 영역이 다를 수 있으며, 필터의 특징이 다를 수 있다.Filtering on prediction blocks may be used to reduce prediction error. Filtering may be adaptively applying a filter to an area considered to have a large prediction error among prediction blocks. For example, an area considered to have a large prediction error may be the boundary of a prediction block. Additionally, depending on the intra-prediction mode, the area considered to have a large prediction error among prediction blocks may be different, and the characteristics of the filter may be different.

도 8에서 도시된 것과 같이, 대상 블록의 인트라 예측을 위해, 참조 라인 0 내지 참조 라인 3 중 적어도 하나가 이용될 수 있다. As shown in FIG. 8, at least one of reference lines 0 to 3 may be used for intra prediction of the target block.

도 8의 각 참조 라인은 하나 이상의 참조 샘플들을 포함하는 참조 샘플 라인을 나타낼 수 있다. 참조 라인의 번호가 더 작을수록 대상 블록에 더 가까운 참조 샘플들의 라인일 수 있다.Each reference line in FIG. 8 may represent a reference sample line including one or more reference samples. The smaller the reference line number, the closer the reference sample line may be to the target block.

세그먼트 A 및 세그먼트 F의 샘플들은 재구축된 이웃 블록으로부터 획득되는 대신, 각각 세그먼트 B 및 세그먼트 E의 가장 가까운 샘플들을 사용하는 패딩을 통해 획득될 수 있다.Instead of being obtained from a reconstructed neighboring block, the samples of segment A and segment F may be obtained through padding using the closest samples of segment B and segment E, respectively.

대상 블록의 인트라 예측을 위해 사용될 참조 샘플 라인을 지시하는 인덱스 정보가 시그널링될 수 있다. 인덱스 정보는 복수의 참조 샘플 라인들 중 대상 블록의 인트라 예측을 위해 사용되는 참조 샘플 라인을 가리킬 수 있다. 예를 들면, 인덱스 정보는 0 내지 3 중 하나의 값을 가질 수 있다.Index information indicating a reference sample line to be used for intra prediction of the target block may be signaled. Index information may indicate a reference sample line used for intra prediction of a target block among a plurality of reference sample lines. For example, index information may have a value between 0 and 3.

대상 블록의 상단 경계가 CTU의 경계인 경우, 참조 샘플 라인 0만이 가용할 수 있다. 따라서 이러한 경우, 인덱스 정보는 시그널링되지 않을 수 있다. 참조 샘플 라인 0 이외에 다른 참조 샘플 라인이 사용되는 경우, 후술되는 예측 블록에 대한 필터링은 수행되지 않을 수 있다.If the upper boundary of the target block is the boundary of the CTU, only reference sample line 0 may be available. Therefore, in this case, index information may not be signaled. If a reference sample line other than reference sample line 0 is used, filtering on the prediction block, which will be described later, may not be performed.

색 성분간(inter-color) 인트라 예측의 경우, 제1 색 성분(component)의 대응 재구축된 블록에 기초하여, 제2 색 성분의 대상 블록에 대한 예측 블록이 생성될 수 있다.In the case of inter-color intra prediction, a prediction block for the target block of the second color component may be generated based on the corresponding reconstructed block of the first color component.

예를 들면, 제1 색 성분은 루마 성분일 수 있고, 제2 색 성분은 크로마 성분일 수 있다.For example, the first color component may be a luma component, and the second color component may be a chroma component.

색 성분간 인트라 예측을 위해, 제1 색 성분 및 제2 색 성분 간의 선형 모델의 파라미터가 템플릿에 기초하여 유도될 수 있다.For intra prediction between color components, parameters of a linear model between the first color component and the second color component may be derived based on the template.

템플릿은 대상 블록의 상단 참조 샘플 및/또는 좌측 참조 샘플을 포함할 수 있고, 이러한 참조 샘플들에 대응하는 제1 색 성분의 재구축된 블록의 상단 참조 샘플 및/또는 좌측 참조 샘플을 포함할 수 있다.The template may include a top reference sample and/or a left reference sample of the target block, and may include a top reference sample and/or a left reference sample of the reconstructed block of the first color component corresponding to these reference samples. there is.

예를 들면, 선형 모델의 파라미터는 1) 템플릿 내의 샘플들 중 최대 값을 갖는 제1 색 성분의 샘플의 값, 2) 이러한 제1 색 성분의 샘플에 대응하는 제2 색 성분의 샘플의 값, 3) 템플릿 내의 샘플들 중 최소 값을 갖는 제1 색 성분의 샘플의 값 및 4) 이러한 제1 색 성분의 샘플에 대응하는 제2 색 성분의 샘플의 값을 사용하여 유도될 수 있다.For example, the parameters of a linear model are 1) the value of the sample of the first color component that has the maximum value among the samples in the template, 2) the value of the sample of the second color component corresponding to this sample of the first color component, 3) the value of the sample of the first color component having the minimum value among the samples in the template, and 4) the value of the sample of the second color component corresponding to the sample of the first color component.

선형 모델의 파라미터가 유도되면, 대응 재구축된 블록을 선형 모델에 적용함으로써 대상 블록에 대한 예측 블록이 생성될 수 있다.Once the parameters of the linear model are derived, a prediction block for the target block can be generated by applying the corresponding reconstructed block to the linear model.

영상 포맷에 따라서, 제1 색 성분의 재구축된 블록의 주변 샘플 및 대응 재구축된 블록에 대해 서브 샘플링이 수행될 수 있다. 예를 들면, 제2 색 성분의 1 개의 샘플이 제1 색 성분의 4 개의 샘플들에 대응하는 경우, 제1 색 성분의 4 개의 샘플들에 대한 서브 샘플링에 의해 1 개의 대응 샘플이 계산될 수 있다. 서브 샘플링이 수행되는 경우, 선형 모델의 파라미터의 유도 및 색 성분간 인트라 예측은 서브 샘플링된 대응 샘플에 기초하여 수행될 수 있다.Depending on the video format, subsampling may be performed on neighboring samples of the reconstructed block of the first color component and the corresponding reconstructed block. For example, if 1 sample of the second color component corresponds to 4 samples of the first color component, 1 corresponding sample can be calculated by subsampling the 4 samples of the first color component. there is. When subsampling is performed, derivation of parameters of a linear model and intra prediction between color components can be performed based on the subsampled corresponding samples.

색 성분간 인트라 예측을 수행하는지 여부 및/또는 템플릿의 범위는 인트라 예측 모드로서 시그널링될 수 있다.Whether to perform intra prediction between color components and/or the range of the template may be signaled as an intra prediction mode.

대상 블록은 가로 방향 및/또는 세로 방향으로 2 개 또는 4 개의 서브 블록들로 분할될 수 있다.The target block may be divided into 2 or 4 sub-blocks in the horizontal and/or vertical directions.

분할된 서브 블록들은 순차적으로 재구축될 수 있다. 즉, 서브 블록에 대해 인트라 예측이 수행됨에 따라, 서브 블록에 대한 서브 예측 블록이 생성될 수 있다. 또한, 서브 블록에 대해 역양자화 및/또는 역변환이 수행됨에 따라 서브 블록에 대한 서브 잔차 블록이 생성될 수 있다. 서브 예측 블록을 서브 잔차 블록에 더함으로써 재구축된 서브 블록이 생성될 수 있다. 재구축된 서브 블록은 후 순위의 서브 블록의 인트라 예측을 위한 참조 샘플로서 이용될 수 있다.The divided sub-blocks can be sequentially reconstructed. That is, as intra prediction is performed on the sub-block, a sub-prediction block for the sub-block may be generated. Additionally, as inverse quantization and/or inverse transformation is performed on the sub-block, a sub-residual block for the sub-block may be generated. A reconstructed sub-block can be generated by adding the sub-prediction block to the sub-residual block. The reconstructed subblock can be used as a reference sample for intra prediction of the lower priority subblock.

서브 블록은 특정된 개수(예를 들면, 16개)의 이상의 샘플들을 포함하는 블록일 수 있다. 따라서, 예를 들면, 대상 블록이 8x4 블록 또는 4x8 블록의 경우, 대상 블록은 2 개의 서브 블록들로 분할될 수 있다. 또한, 대상 블록이 4x4 블록인 경우, 대상 블록은 서브 블록들로 분할될 수 없다. 대상 블록이 그 외의 크기를 갖는 경우, 대상 블록은 4 개의 서브 블록들로 분할될 수 있다.A subblock may be a block containing a specified number (eg, 16) or more samples. Therefore, for example, if the target block is an 8x4 block or a 4x8 block, the target block may be divided into two sub-blocks. Additionally, if the target block is a 4x4 block, the target block cannot be divided into sub-blocks. If the target block has a different size, the target block may be divided into 4 sub-blocks.

이러한 서브 블록에 기반하는 인트라 예측이 수행되는지 여부 및/또는 분할 방향(가로 방향 또는 세로 방향)에 관한 정보가 시그널링될 수 있다.Information regarding whether intra prediction based on these subblocks is performed and/or the division direction (horizontal or vertical direction) may be signaled.

이러한 서브 블록 기반의 인트라 예측은 참조 샘플 라인 0을 이용하는 경우에만 수행되도록 제한될 수 있다. 서브 블록 기반의 인트라 예측이 수행되는 경우, 후술하는 예측 블록에 대한 필터링은 수행되지 않을 수 있다.Such sub-block-based intra prediction may be limited to being performed only when using reference sample line 0. When sub-block-based intra prediction is performed, filtering on the prediction block, which will be described later, may not be performed.

인트라 예측에 의해 생성된 예측 블록에 대한 필터링을 수행함으로써 최종 예측 블록이 생성될 수 있다.A final prediction block can be generated by performing filtering on the prediction block generated by intra prediction.

필터링은 필터링의 대상인 필터링 대상 샘플, 좌측 참조 샘플, 상단 참조 샘플 및/또는 좌상단 참조 샘플에 특정된 가중치를 적용함으로써 수행될 수 있다.Filtering may be performed by applying a specific weight to the filtering target sample, left reference sample, top reference sample, and/or top left reference sample that are the objects of filtering.

필터링에 이용되는 가중치 및/또는 참조 샘플(또는, 참조 샘플의 범위 또는 참조 샘플의 위치 등)은 블록 크기, 인트라 예측 모드 및 필터링 대상 샘플의 예측 블록 내에서의 위치 중 적어도 하나에 기초하여 결정될 수 있다.Weights and/or reference samples (or ranges of reference samples or positions of reference samples, etc.) used for filtering may be determined based on at least one of block size, intra prediction mode, and location within the prediction block of the sample to be filtered. there is.

예를 들면, 필터링은 특정된 인트라 예측 모드(예컨대, DC 모드, 플래너 모드, 수직 모드, 수평 모드, 대각 모드 및/또는 인접 대각 모드)에 대해서만 수행될 수 있다.For example, filtering may be performed only for specified intra prediction modes (eg, DC mode, planar mode, vertical mode, horizontal mode, diagonal mode, and/or adjacent diagonal mode).

인접 대각 모드는 대각 모드의 번호에 k가 더해진 번호를 갖는 모드일 수 있고, 대각 모드의 번호로부터 k가 감해진 번호를 갖는 모드일 수 있다. 말하자면, 인접 대각 모드의 번호는 대각 모드의 번호 및 k의 합일 수 있으며, 대각 모드의 번호 및 k 간의 차일 수 있다. 예를 들면, k는 8 이하의 양의 정수일 수 있다.The adjacent diagonal mode may be a mode with a number in which k is added to the number of the diagonal mode, or it may be a mode with a number in which k is subtracted from the number of the diagonal mode. That is, the number of adjacent diagonal modes may be the sum of the number of diagonal modes and k, or the difference between the number of diagonal modes and k. For example, k may be a positive integer of 8 or less.

대상 블록의 인트라 예측 모드는 대상 블록의 주변에 존재하는 이웃 블록의 인트라 예측 모드를 사용하여 유도될 수 있고, 이러한 유도된 인트라 예측 모드가 엔트로피 부호화 및/또는 엔트로피 복호화될 수 있다.The intra prediction mode of the target block may be derived using the intra prediction mode of a neighboring block existing around the target block, and this derived intra prediction mode may be entropy encoded and/or entropy decoded.

예를 들면, 대상 블록의 인트라 예측 모드 및 이웃 블록의 인트라 예측 모드가 동일하면, 특정된 플래그 정보를 사용하여 대상 블록의 인트라 예측 모드 및 이웃 블록의 인트라 예측 모드가 동일하다는 정보가 시그널링될 수 있다.For example, if the intra prediction mode of the target block and the intra prediction mode of the neighboring block are the same, information that the intra prediction mode of the target block and the intra prediction mode of the neighboring block are the same may be signaled using the specified flag information. .

또한, 예를 들면, 복수의 이웃 블록들의 인트라 예측 모드들 중 대상 블록의 인트라 예측 모드와 동일한 인트라 예측 모드를 갖는 이웃 블록에 대한 지시자 정보가 시그널링될 수 있다.Additionally, for example, indicator information about a neighboring block having the same intra prediction mode as the intra prediction mode of the target block among the intra prediction modes of a plurality of neighboring blocks may be signaled.

예를 들면, 대상 블록의 인트라 예측 모드 및 이웃 블록의 인트라 예측 모드가 서로 다르면, 이웃 블록의 인트라 예측 모드에 기반하는 엔트로피 부호화 및/또는 엔트로피 복호화를 수행함으로써 대상 블록의 인트라 예측 모드에 대한 정보에 대한 엔트로피 부호화 및/또는 엔트로피 복호화가 수행될 수 있다.For example, if the intra prediction mode of the target block and the intra prediction mode of the neighboring block are different from each other, entropy coding and/or entropy decoding based on the intra prediction mode of the neighboring block are performed to obtain information about the intra prediction mode of the target block. Entropy encoding and/or entropy decoding may be performed.

도 9는 인터 예측 과정의 실시예를 설명하기 위한 도면이다.Figure 9 is a diagram for explaining an embodiment of the inter prediction process.

도 9에서 도시된 사각형은 영상(또는, 픽처)를 나타낼 수 있다. 또한, 도 9에서 화살표는 예측 방향을 나타낼 수 있다. 제1 픽처로부터 제2 픽처로의 화살표는 제2 픽처가 제1 픽처를 참조한다는 것을 나타낼 수 있다. 즉, 영상은 예측 방향에 따라 부호화 및/또는 복호화될 수 있다.The square shown in FIG. 9 may represent an image (or picture). Additionally, in FIG. 9, the arrow may indicate the prediction direction. An arrow from the first picture to the second picture may indicate that the second picture refers to the first picture. That is, the image can be encoded and/or decoded according to the prediction direction.

각 영상은 부호화 타입에 따라 I 픽처(Intra Picture), P 픽처(Uni-prediction Picture) 및 B 픽처(Bi-prediction Picture)로 분류될 수 있다. 각 픽처는 각 픽처의 부호화 타입에 따라 부호화 및/또는 복호화될 수 있다.Each image can be classified into I picture (Intra Picture), P picture (Uni-prediction Picture), and B picture (Bi-prediction Picture) depending on the encoding type. Each picture may be encoded and/or decoded according to the encoding type of each picture.

부호화의 대상인 대상 영상이 I 픽처인 경우, 대상 영상은 다른 영상을 참조하는 인터 예측 없이 영상 자체 내의 데이터를 사용하여 부호화될 수 있다. 예를 들면, I 픽처는 인트라 예측으로만 부호화될 수 있다.If the target image that is the target of encoding is an I picture, the target image can be encoded using data within the image itself without inter prediction referring to other images. For example, an I picture can be encoded only with intra prediction.

대상 영상이 P 픽처인 경우, 대상 영상은 단방향에 존재하는 참조 픽처만을 이용하는 인터 예측을 통해 부호화될 수 있다. 여기에서, 단방향은 순방향 또는 역방향일 수 있다.When the target image is a P picture, the target image can be encoded through inter prediction using only reference pictures that exist in one direction. Here, unidirectional can be forward or reverse.

대상 영상이 B 픽처인 경우, 대상 영상은 양방향에 존재하는 참조 픽처들을 이용하는 인터 예측 또는 순방향 및 역방향 중 일 방향에 존재하는 참조 픽처를 이용하는 인터 예측을 통해 부호화될 수 있다. 여기에서, 양방향은 순방향 및 역방향일 수 있다.When the target image is a B picture, the target image can be encoded through inter prediction using reference pictures existing in both directions or inter prediction using reference pictures existing in one of the forward and reverse directions. Here, the two directions can be forward and reverse.

참조 픽처를 이용하여 부호화 및/또는 복호화되는 P 픽처 및 B 픽처는 인터 예측이 사용되는 영상으로 간주될 수 있다.P pictures and B pictures that are encoded and/or decoded using a reference picture may be considered images for which inter prediction is used.

아래에서, 실시예에 따른 인터 모드에서의 인터 예측에 대해 구체적으로 설명된다.Below, inter prediction in inter mode according to the embodiment is described in detail.

인터 예측 또는 움직임 보상은 참조 영상 및 움직임 정보를 이용하여 수행될 수 있다.Inter prediction or motion compensation can be performed using reference images and motion information.

인터 모드에서, 부호화 장치(100)는 대상 블록에 대한 인터 예측 및/또는 움직임 보상을 수행할 수 있다. 복호화 장치(200)는 대상 블록에 대하여 부호화 장치(100)에서의 인터 예측 및/또는 움직임 보상에 대응하는 인터 예측 및/또는 움직임 보상을 수행할 수 있다.In inter mode, the encoding device 100 may perform inter prediction and/or motion compensation for the target block. The decoding device 200 may perform inter prediction and/or motion compensation corresponding to the inter prediction and/or motion compensation in the encoding device 100 on the target block.

대상 블록에 대한 움직임 정보는 부호화 장치(100) 및 복호화 장치(200)의 각각에 의해 인터 예측 중 도출될 수 있다. 움직임 정보는 재구축된 이웃 블록의 움직임 정보, 콜 블록의 움직임 정보 및/또는 콜 블록에 인접한 블록의 움직임 정보를 이용하여 도출될 수 있다.Motion information about the target block may be derived by each of the encoding device 100 and the decoding device 200 during inter prediction. The motion information may be derived using motion information of a reconstructed neighboring block, motion information of a call block, and/or motion information of a block adjacent to the call block.

예를 들면, 부호화 장치(100) 또는 복호화 장치(200)는 공간적 후보(spatial candidate) 및/또는 시간적 후보(temporal candidate)의 움직임 정보를 대상 블록의 움직임 정보로 사용함으로써 예측 및/또는 움직임 보상을 수행할 수 있다. 대상 블록은 PU 및/또는 PU 파티션을 의미할 수 있다.For example, the encoding device 100 or the decoding device 200 performs prediction and/or motion compensation by using motion information of a spatial candidate and/or temporal candidate as motion information of the target block. It can be done. The target block may refer to PU and/or PU partition.

공간적 후보는 대상 블록에 공간적으로 인접한 재구축된 블록일 수 있다.The spatial candidate may be a reconstructed block that is spatially adjacent to the target block.

시간적 후보는 이미 재구축된 콜 픽처(collocated picture; col picture) 내의 대상 블록에 대응하는 재구축된 블록일 수 있다.The temporal candidate may be a reconstructed block corresponding to a target block in an already reconstructed collocated picture (col picture).

인터 예측에 있어서, 부호화 장치(100) 및 복호화 장치(200)는 공간적 후보 및/또는 시간적 후보의 움직임 정보를 이용함으로써 부호화 효율 및 복호화 효율을 향상시킬 수 있다. 공간적 후보의 움직임 정보는 공간적 움직임 정보로 칭해질 수 있다. 시간적 후보의 움직임 정보는 시간적 움직임 정보로 칭해질 수 있다.In inter prediction, the encoding device 100 and the decoding device 200 can improve encoding efficiency and decoding efficiency by using motion information of spatial candidates and/or temporal candidates. The motion information of the spatial candidate may be referred to as spatial motion information. The motion information of the temporal candidate may be referred to as temporal motion information.

이하에서, 공간적 후보의 움직임 정보는, 공간적 후보를 포함하는 PU의 움직임 정보일 수 있다. 시간적 후보의 움직임 정보는, 시간적 후보를 포함하는 PU의 움직임 정보일 수 있다. 후보 블록의 움직임 정보는, 후보 블록을 포함하는 PU의 움직임 정보일 수 있다.Hereinafter, the motion information of the spatial candidate may be the motion information of the PU including the spatial candidate. The motion information of the temporal candidate may be motion information of a PU including the temporal candidate. The motion information of the candidate block may be motion information of the PU including the candidate block.

인터 예측은 참조 픽처를 이용하여 수행될 수 있다.Inter prediction can be performed using a reference picture.

참조 픽처(reference picture)는 대상 픽처의 이전 픽처 또는 대상 픽처의 이후 픽처 중 적어도 하나일 수 있다. 참조 픽처는 대상 블록의 예측에 이용되는 영상을 의미할 수 있다.A reference picture may be at least one of a picture before the target picture or a picture after the target picture. A reference picture may refer to an image used for prediction of a target block.

인터 예측에 있어서, 참조 픽처를 지시하는 참조 픽처 인덱스(또는, refIdx) 및 후술될 움직임 벡터(motion vector) 등을 이용함으로써 참조 픽처 내의 영역이 특정될 수 있다. 여기에서, 참조 픽처 내의 특정된 영역은 참조 블록을 나타낼 수 있다.In inter prediction, an area within a reference picture can be specified by using a reference picture index (or refIdx) indicating the reference picture and a motion vector to be described later. Here, a specified area within the reference picture may represent a reference block.

인터 예측은 참조 픽처를 선택할 수 있고, 참조 픽처 내에서 대상 블록에 대응하는 참조 블록을 선택할 수 있다. 또한, 인터 예측은 선택된 참조 블록을 사용하여 대상 블록에 대한 예측 블록을 생성할 수 있다.Inter prediction can select a reference picture and select a reference block corresponding to the target block within the reference picture. Additionally, inter prediction can generate a prediction block for the target block using the selected reference block.

움직임 정보는 부호화 장치(100) 및 복호화 장치(200)의 각각에 의해 인터 예측 중 도출될 수 있다.Motion information may be derived during inter prediction by each of the encoding device 100 and the decoding device 200.

공간적 후보는, 1) 대상 픽처 내의 존재하며, 2) 이미 부호화 및/또는 복호화를 통해 재구축되었고, 3) 대상 블록에 인접하거나, 대상 블록의 코너에 위치한 블록일 수 있다. 여기에서, 대상 블록의 코너에 위치한 블록이란, 대상 블록에 가로로 인접한 이웃 블록에 세로로 인접한 블록 또는 대상 블록에 세로로 인접한 이웃 블록에 가로로 인접한 블록일 수 있다. "대상 블록의 코너에 위치한 블록"은 "대상 블록의 코너에 인접한 블록"과 동일한 의미일 수 있다. "대상 블록의 코너에 위치한 블록"은 "대상 블록에 인접한 블록"에 포함될 수 있다.The spatial candidate may be a block that 1) exists in the target picture, 2) has already been reconstructed through encoding and/or decoding, and 3) is adjacent to the target block or located at a corner of the target block. Here, the block located at the corner of the target block may be a block vertically adjacent to a neighboring block horizontally adjacent to the target block, or a block horizontally adjacent to a neighboring block vertically adjacent to the target block. “Block located at the corner of the target block” may have the same meaning as “block adjacent to the corner of the target block.” “Blocks located at the corners of the target block” may be included in “blocks adjacent to the target block.”

예를 들면, 공간적 후보는 대상 블록의 좌측에 위치한 재구축된 블록, 대상 블록의 상단에 위치한 재구축된 블록, 대상 블록의 좌측 하단 코너에 위치한 재구축된 블록, 대상 블록의 우측 상단 코너에 위치한 재구축된 블록 또는 대상 블록의 좌측 상단 코너에 위치한 재구축된 블록일 수 있다.For example, spatial candidates include a reconstructed block located to the left of the target block, a reconstructed block located at the top of the target block, a reconstructed block located at the lower left corner of the target block, and a reconstructed block located at the upper right corner of the target block. It may be a reconstructed block or a reconstructed block located in the upper left corner of the target block.

부호화 장치(100) 및 복호화 장치(200)의 각각은 콜(col) 픽처 내에서 대상 블록에 공간적으로 대응하는 위치에 존재하는 블록을 식별할 수 있다. 대상 픽처 내의 대상 블록의 위치 및 콜 픽처 내의 식별된 블록의 위치는 서로 대응할 수 있다.Each of the encoding device 100 and the decoding device 200 can identify a block that exists at a location spatially corresponding to the target block within a coll picture. The location of the target block in the target picture and the location of the identified block in the call picture may correspond to each other.

부호화 장치(100) 및 복호화 장치(200)의 각각은 식별된 블록에 대하여 기정의된 상대적인 위치에 존재하는 콜(col) 블록을 시간적 후보로서 결정할 수 있다. 기정의된 상대적인 위치는 식별된 블록의 내부의 위치 및/또는 외부의 위치일 수 있다.Each of the encoding device 100 and the decoding device 200 may determine a col block existing at a predefined relative position with respect to the identified block as a temporal candidate. The predefined relative position may be a position inside and/or outside the identified block.

예를 들면, 콜 블록은 제1 콜 블록 및 제2 콜 블록을 포함할 수 있다. 식별된 블록의 좌표들이 (xP, yP)이고, 식별된 블록의 크기가 (nPSW, nPSH)일 때, 제1 콜 블록은 좌표들 (xP + nPSW, yP + nPSH)에 위치한 블록일 수 있다. 제2 콜 블록은 좌표들 (xP + (nPSW >> 1), yP + (nPSH >> 1))에 위치한 블록일 수 있다. 제2 콜 블록은 제1 콜 블록이 가용하지 않을(unavailable) 경우 선택적으로 사용될 수 있다.For example, a call block may include a first call block and a second call block. When the coordinates of the identified block are (xP, yP) and the size of the identified block is (nPSW, nPSH), the first call block may be a block located at the coordinates (xP + nPSW, yP + nPSH). The second call block may be a block located at the coordinates (xP + (nPSW >> 1), yP + (nPSH >> 1)). The second call block can be selectively used when the first call block is unavailable.

대상 블록의 움직임 벡터는 콜 블록의 움직임 벡터에 기반하여 결정될 수 있다. 부호화 장치(100) 및 복호화 장치(200)의 각각은 콜 블록의 움직임 벡터를 스케일(scale)할 수 있다. 콜 블록의 스케일된(scale) 움직임 벡터가 대상 블록의 움직임 벡터로서 이용될 수 있다. 또한, 리스트에 저장되는 시간적 후보의 움직임 정보의 움직임 벡터는 스케일된 움직임 벡터일 수 있다.The motion vector of the target block may be determined based on the motion vector of the call block. Each of the encoding device 100 and the decoding device 200 can scale the motion vector of a call block. The scaled motion vector of the call block can be used as the motion vector of the target block. Additionally, the motion vector of the motion information of the temporal candidate stored in the list may be a scaled motion vector.

대상 블록의 움직임 벡터 및 콜 블록의 움직임 벡터의 비율(ratio)은 제1 시간적 거리 및 제2 시간적 거리의 비율과 같을 수 있다. 제1 시간적 거리는 대상 블록의 참조 픽처 및 대상 픽처 간의 거리일 수 있다. 제2 시간적 거리는 콜 블록의 참조 픽처 및 콜 픽처 간의 거리일 수 있다.The ratio of the motion vector of the target block and the motion vector of the call block may be equal to the ratio of the first temporal distance and the second temporal distance. The first temporal distance may be the distance between the reference picture of the target block and the target picture. The second temporal distance may be the distance between the reference picture and the call picture of the call block.

움직임 정보의 도출 방식은 대상 블록의 인터 예측 모드에 따라 변할 수 있다. 예를 들면, 인터 예측을 위해 적용되는 인터 예측 모드로서, 향상된 움직임 벡터 예측자(Advanced Motion Vector Predictor; AMVP) 모드, 머지(merge) 모드 및 스킵(skip) 모드, 움직임 벡터 차분을 갖는 머지 모드, 서브 블록 머지 모드, 삼각 분할 모드, 인터-인트라 결합 예측 모드, 어파인 인터 모드 및 현재 픽처 참조 모드 등이 있을 수 있다. 머지 모드는 움직임 머지 모드(motion merge mode)로 칭해질 수도 있다. 아래에서는, 모드들의 각각에 대해서 상세하게 설명된다.The method of deriving motion information may vary depending on the inter prediction mode of the target block. For example, inter prediction modes applied for inter prediction include Advanced Motion Vector Predictor (AMVP) mode, merge mode and skip mode, merge mode with motion vector difference, There may be subblock merge mode, triangulation mode, inter-intra combined prediction mode, affine inter mode, and current picture reference mode. Merge mode may also be referred to as motion merge mode. Below, each of the modes is explained in detail.

1) AMVP 모드1) AMVP mode

AMVP 모드가 사용되는 경우, 부호화 장치(100)는 대상 블록의 이웃에서 유사한 블록을 검색할 수 있다. 부호화 장치(100)는 검색된 유사한 블록의 움직임 정보를 이용하여 대상 블록에 대한 예측을 수행함으로써 예측 블록을 획득할 수 있다. 부호화 장치(100)는 대상 블록 및 예측 블록 간의 차이인 잔차 블록을 부호화할 수 있다.When AMVP mode is used, the encoding device 100 can search for similar blocks in the neighbors of the target block. The encoding device 100 may obtain a prediction block by performing prediction on the target block using motion information of the searched similar block. The encoding device 100 may encode a residual block that is the difference between the target block and the prediction block.

1-1) 예측 움직임 벡터 후보 리스트의 작성1-1) Creation of a predicted motion vector candidate list

예측 모드로서 AMVP 모드가 사용되는 경우, 부호화 장치(100) 및 복호화 장치(200)의 각각은 공간적 후보의 움직임 벡터, 시간적 후보의 움직임 벡터 및 제로 벡터를 이용하여 예측 움직임 벡터 후보 리스트를 생성할 수 있다. 예측 움직임 벡터 후보 리스트는 하나 이상의 예측 움직임 벡터 후보들을 포함할 수 있다. 공간적 후보의 움직임 벡터, 시간적 후보의 움직임 벡터 및 제로 벡터 중 적어도 하나가 예측 움직임 벡터 후보로서 결정 및 사용될 수 있다. When the AMVP mode is used as the prediction mode, each of the encoding device 100 and the decoding device 200 can generate a prediction motion vector candidate list using the motion vector of the spatial candidate, the motion vector of the temporal candidate, and the zero vector. there is. The predicted motion vector candidate list may include one or more predicted motion vector candidates. At least one of the motion vector of the spatial candidate, the motion vector of the temporal candidate, and the zero vector may be determined and used as the predicted motion vector candidate.

이하에서, 용어들 "예측 움직임 벡터 (후보)" 및 "움직임 벡터 (후보)"는 동일한 의미로 사용될 수 있으며, 서로 교체되어 사용될 수 있다. Hereinafter, the terms “predicted motion vector (candidate)” and “motion vector (candidate)” may be used with the same meaning and may be used interchangeably.

이하에서, 용어들 "예측 움직임 벡터 후보" 및 "AMVP 후보"는 동일한 의미로 사용될 수 있으며, 서로 교체되어 사용될 수 있다.Hereinafter, the terms “predicted motion vector candidate” and “AMVP candidate” may be used with the same meaning and may be used interchangeably.

이하에서, 용어들 "예측 움직임 벡터 후보 리스트" 및 "AMVP 후보 리스트"는 동일한 의미로 사용될 수 있으며, 서로 교체되어 사용될 수 있다.Hereinafter, the terms “predictive motion vector candidate list” and “AMVP candidate list” may be used with the same meaning and may be used interchangeably.

공간적 후보는 재구축된 공간적 이웃 블록을 포함할 수 있다. 말하자면, 재구축된 이웃 블록의 움직임 벡터는 공간적 예측 움직임 벡터 후보(spatial prediction motion vector candidate)라 칭해질 수 있다.Spatial candidates may include reconstructed spatial neighboring blocks. In other words, the motion vector of the reconstructed neighboring block may be referred to as a spatial prediction motion vector candidate.

시간적 후보는 콜 블록 및 콜 블록에 인접한 블록을 포함할 수 있다. 말하자면, 콜 블록의 움직임 벡터 또는 콜 블록에 인접한 블록의 움직임 벡터는 시간적 예측 움직임 벡터 후보(temporal prediction motion vector candidate)로 칭해질 수 있다.Temporal candidates may include call blocks and blocks adjacent to call blocks. That is, the motion vector of a call block or a motion vector of a block adjacent to a call block may be referred to as a temporal prediction motion vector candidate.

제로 벡터는 (0, 0) 움직임 벡터일 수 있다.The zero vector may be a (0, 0) motion vector.

예측 움직임 벡터 후보는 움직임 벡터의 예측을 위한 움직임 벡터 예측자(motion vector predictor)일 수 있다. 또한, 부호화 장치(100)에 있어서 예측 움직임 벡터 후보는 움직임 벡터 초기 검색 위치일 수 있다.The predicted motion vector candidate may be a motion vector predictor for predicting a motion vector. Additionally, in the encoding device 100, a predicted motion vector candidate may be a motion vector initial search position.

1-2) 예측 움직임 벡터 후보 리스트를 사용하는 움직임 벡터의 검색1-2) Search for motion vector using predicted motion vector candidate list

부호화 장치(100)는 예측 움직임 벡터 후보 리스트를 사용하여 검색 범위 내에서 대상 블록의 부호화를 위해 사용될 움직임 벡터를 결정할 수 있다. 또한, 부호화 장치(100)는 예측 움직임 벡터 후보 리스트의 예측 움직임 벡터 후보들 중 대상 블록의 예측 움직임 벡터로 사용할 예측 움직임 벡터 후보를 결정할 수 있다.The encoding device 100 may use the predicted motion vector candidate list to determine a motion vector to be used for encoding the target block within the search range. Additionally, the encoding device 100 may determine a prediction motion vector candidate to be used as the prediction motion vector of the target block among the prediction motion vector candidates in the prediction motion vector candidate list.

대상 블록의 부호화를 위해 사용될 움직임 벡터는 최소의 비용으로 부호화될 수 있는 움직임 벡터일 수 있다.The motion vector to be used for encoding the target block may be a motion vector that can be encoded at minimal cost.

또한, 부호화 장치(100)는 대상 블록의 부호화에 있어서 AMVP 모드를 사용할지 여부를 결정할 수 있다.Additionally, the encoding device 100 may determine whether to use the AMVP mode when encoding the target block.

1-3) 인터 예측 정보의 전송1-3) Transmission of inter prediction information

부호화 장치(100)는 인터 예측을 위해 요구되는 인터 예측 정보를 포함하는 비트스트림을 생성할 수 있다. 복호화 장치(200)는 비트스트림의 인터 예측 정보를 사용하여 대상 블록에 대한 인터 예측을 수행할 수 있다.The encoding device 100 may generate a bitstream including inter prediction information required for inter prediction. The decoding device 200 may perform inter prediction on the target block using inter prediction information of the bitstream.

인터 예측 정보는, 1) AMVP 모드를 사용하는지 여부를 나타내는 모드 정보, 2) 예측 움직임 벡터 인덱스, 3) 움직임 벡터 차분(Motion Vector Difference; MVD), 4) 참조 방향 및 5) 참조 픽처 인덱스를 포함할 수 있다.Inter prediction information includes 1) mode information indicating whether AMVP mode is used, 2) prediction motion vector index, 3) motion vector difference (MVD), 4) reference direction, and 5) reference picture index. can do.

이하에서, 용어들 "예측 움직임 벡터 인덱스" 및 "AMVP 인덱스"는 동일한 의미로 사용될 수 있으며, 서로 교체되어 사용될 수 있다.Hereinafter, the terms “predicted motion vector index” and “AMVP index” may be used with the same meaning and may be used interchangeably.

또한, 인터 예측 정보는 잔차 신호를 포함할 수 있다.Additionally, inter prediction information may include a residual signal.

복호화 장치(200)는 모드 정보가 AMVP 모드를 사용하는 것을 나타낼 경우 엔트로피 복호화를 통해 예측 움직임 벡터 인덱스, 움직임 벡터 차분, 참조 방향 및 참조 픽처 인덱스를 비트스트림으로부터 획득할 수 있다.When the mode information indicates that AMVP mode is used, the decoding device 200 may obtain a predicted motion vector index, motion vector difference, reference direction, and reference picture index from the bitstream through entropy decoding.

예측 움직임 벡터 인덱스는 예측 움직임 벡터 후보 리스트에 포함된 예측 움직임 벡터 후보들 중에서 대상 블록의 예측을 위해 사용되는 예측 움직임 벡터 후보를 가리킬 수 있다.The prediction motion vector index may indicate a prediction motion vector candidate used for prediction of the target block among prediction motion vector candidates included in the prediction motion vector candidate list.

1-4) 인터 예측 정보를 사용하는 AMVP 모드의 인터 예측1-4) Inter prediction in AMVP mode using inter prediction information

복호화 장치(200)는 예측 움직임 벡터 후보 리스트를 이용하여 예측 움직임 벡터 후보를 유도할 수 있고, 유도된 예측 움직임 벡터 후보에 기반하여 대상 블록의 움직임 정보를 결정할 수 있다.The decoding apparatus 200 may derive a predicted motion vector candidate using the predicted motion vector candidate list and determine motion information of the target block based on the derived predicted motion vector candidate.

복호화 장치(200)는 예측 움직임 벡터 인덱스를 사용하여 예측 움직임 벡터 후보 리스트에 포함된 예측 움직임 벡터 후보 중에서 대상 블록에 대한 움직임 벡터 후보를 결정할 수 있다. 복호화 장치(200)는 예측 움직임 벡터 후보 리스트에 포함된 예측 움직임 벡터 후보들 중에서 예측 움직임 벡터 인덱스가 가리키는 예측 움직임 벡터 후보를 대상 블록의 예측 움직임 벡터로서 선택할 수 있다.The decoding apparatus 200 may use the predicted motion vector index to determine a motion vector candidate for the target block among the predicted motion vector candidates included in the predicted motion vector candidate list. The decoding apparatus 200 may select the prediction motion vector candidate indicated by the prediction motion vector index from among the prediction motion vector candidates included in the prediction motion vector candidate list as the prediction motion vector of the target block.

부호화 장치(100)는 예측 움직임 벡터 인덱스에 엔트로피 부호화를 적용함으로써 엔트로피 부호화된 예측 움직임 벡터 인덱스를 생성할 수 있고, 엔트로피 부호화된 예측 움직임 벡터 인덱스를 포함하는 비트스트림을 생성할 수 있다. 엔트로피 부호화된 예측 움직임 벡터 인덱스는 비트스트림을 통해 부호화 장치(100)로부터 복호화 장치(200)로 시그널링될 수 있다. 복호화 장치(200)는 비트스트림으로부터 엔트로피 부호화된 예측 움직임 벡터 인덱스를 추출할 수 있고, 엔트로피 부호화된 예측 움직임 벡터 인덱스에 대해 엔트로피 복호화를 적용함으로써 예측 움직임 벡터 인덱스를 획득할 수 있다.The encoding device 100 may generate an entropy-encoded predicted motion vector index by applying entropy coding to the predicted motion vector index, and generate a bitstream including the entropy-encoded predicted motion vector index. The entropy-encoded predicted motion vector index may be signaled from the encoding device 100 to the decoding device 200 through a bitstream. The decoding device 200 can extract an entropy-encoded predicted motion vector index from a bitstream, and obtain the predicted motion vector index by applying entropy decoding to the entropy-encoded predicted motion vector index.

대상 블록의 인터 예측을 위해 실제로 사용될 움직임 벡터는 예측 움직임 벡터와 일치하지 않을 수 있다. 대상 블록의 인터 예측을 위해 실제로 사용될 움직임 벡터는 및 예측 움직임 벡터 간의 차분을 나타내기 위해 MVD가 사용될 수 있다. 부호화 장치(100)는 가능한 작은 크기의 MVD를 사용하기 위해 대상 블록의 인터 예측을 위해 실제로 사용될 움직임 벡터와 유사한 예측 움직임 벡터를 도출할 수 있다.The motion vector actually used for inter prediction of the target block may not match the prediction motion vector. MVD may be used to represent the motion vector that will actually be used for inter prediction of the target block and the difference between the prediction motion vectors. The encoding device 100 may derive a prediction motion vector similar to the motion vector that will actually be used for inter prediction of the target block in order to use the MVD of the smallest size possible.

MVD는 대상 블록의 움직임 벡터 및 예측 움직임 벡터 간의 차분일 수 있다. 부호화 장치(100)는 MVD를 계산할 수 있고, MVD에 엔트로피 부호화를 적용함으로써 엔트로피 부호화된 MVD를 생성할 수 있다. 부호화 장치(100)는 엔트로피 부호화된 MDV를 포함하는 비트스트림을 생성할 수 있다.MVD may be the difference between the motion vector of the target block and the predicted motion vector. The encoding device 100 can calculate the MVD and generate an entropy-encoded MVD by applying entropy encoding to the MVD. The encoding device 100 may generate a bitstream including entropy-encoded MDV.

MVD는 비트스트림을 통해 부호화 장치(100)로부터 복호화 장치(200)로 전송될 수 있다. 복호화 장치(200)는 비트스트림으로부터 엔트로피 부호화된 MVD를 추출할 수 있고, 엔트로피 부호화된 MVD에 엔트로피 복호화를 적용함으로써 MVD를 획득할 수 있다.MVD may be transmitted from the encoding device 100 to the decoding device 200 through a bitstream. The decoding device 200 can extract the entropy-encoded MVD from the bitstream and obtain the MVD by applying entropy decoding to the entropy-encoded MVD.

복호화 장치(200)는 MVD 및 예측 움직임 벡터를 합함으로써 대상 블록의 움직임 벡터를 유도(derive)할 수 있다. 말하자면, 복호화 장치(200)에서 도출되는 대상 블록의 움직임 벡터는 MVD 및 움직임 벡터 후보의 합일 수 있다.The decoding device 200 can derive the motion vector of the target block by combining the MVD and the predicted motion vector. In other words, the motion vector of the target block derived from the decoding device 200 may be the sum of the MVD and the motion vector candidate.

또한, 부호화 장치(100)는 계산된 MVD 해상도 정보에 엔트로피 부호화를 적용함으로써 엔트로피 부호화된 MVD 해상도 정보를 생성할 수 있고, 엔트로피 부호화된 MVD 해상도 정보를 포함하는 비트스트림을 생성할 수 있다. 복호화 장치(200)는 비트스트림으로부터 엔트로피 부호화된 MVD 해상도 정보를 추출할 수 있고, 엔트로피 부호화된 MVD 해상도 정보에 엔트로피 복호화를 적용함으로써 MVD 해상도 정보를 획득할 수 있다. 복호화 장치(200)는 MVD 해상도 정보를 사용하여 MVD의 해상도를 조정할 수 있다.Additionally, the encoding device 100 can generate entropy-encoded MVD resolution information by applying entropy encoding to the calculated MVD resolution information, and can generate a bitstream including the entropy-encoded MVD resolution information. The decoding device 200 can extract entropy-encoded MVD resolution information from the bitstream and obtain MVD resolution information by applying entropy decoding to the entropy-encoded MVD resolution information. The decoding device 200 can adjust the resolution of the MVD using the MVD resolution information.

한편, 부호화 장치(100)는 어파인 모델에 기반하여 MVD를 계산할 수 있다. 복호화 장치(200)는 MVD 및 어파인 제어 움직임 벡터 후보의 합을 통해 대상 블록의 어파인 제어 움직임 벡터를 도출할 수 있고, 어파인 제어 움직임 벡터를 사용하여 서브 블록에 대한 움직임 벡터를 유도할 수 있다.Meanwhile, the encoding device 100 may calculate the MVD based on the affine model. The decoding device 200 may derive an affine control motion vector of the target block through the sum of the MVD and affine control motion vector candidates, and may derive a motion vector for the sub-block using the affine control motion vector. there is.

참조 방향은 대상 블록의 예측을 위해 사용되는 참조 픽처 리스트를 가리킬 수 있다. 예를 들면, 참조 방향은 참조 픽처 리스트 L0 및 참조 픽처 리스트 L1 중 하나를 가리킬 수 있다.The reference direction may indicate a reference picture list used for prediction of the target block. For example, the reference direction may point to one of the reference picture list L0 and the reference picture list L1.

참조 방향은 대상 블록의 예측을 위해 사용되는 참조 픽처 리스트를 가리킬 뿐, 참조 픽처들의 방향들이 순방향(forward direction) 또는 역방향(backward direction)으로 제한된다는 것을 나타내는 것을 아닐 수 있다. 말하자면, 참조 픽처 리스트 L0 및 참조 픽처 리스트 L1의 각각은 순방향 및/또는 역방향의 픽처들을 포함할 수 있다.The reference direction only indicates a reference picture list used for prediction of the target block, and may not indicate that the directions of reference pictures are limited to the forward direction or backward direction. That is, each of the reference picture list L0 and the reference picture list L1 may include forward and/or reverse pictures.

참조 방향이 단방향(uni-direction)이란 것은 하나의 참조 픽처 리스트가 사용된다는 것을 의미할 수 있다. 참조 방향이 양방향(bi-direction)이란 것은 2 개의 참조 픽처 리스트들이 사용된다는 것을 의미할 수 있다. 말하자면, 참조 방향은, 참조 픽처 리스트 L0만이 사용된다는 것, 참조 픽처 리스트 L1만이 사용된다는 것 및 2 개의 참조 픽처 리스트들 것 중 하나를 가리킬 수 있다.A uni-direction reference direction may mean that one reference picture list is used. Bi-directional reference direction may mean that two reference picture lists are used. That is, the reference direction may indicate that only the reference picture list L0 is used, that only the reference picture list L1 is used, and one of the two reference picture lists.

참조 픽처 인덱스는 참조 픽처 리스트의 참조 픽처들 중 대상 블록의 예측을 위해 사용되는 참조 픽처를 가리킬 수 있다. 부호화 장치(100)는 참조 픽처 인덱스에 엔트로피 부호화를 적용함으로써 엔트로피 부호화된 참조 픽처 인덱스를 생성할 수 있고, 엔트로피 부호화된 참조 픽처 인덱스를 포함하는 비트스트림을 생성할 수 있다. 엔트로피 부호화된 참조 픽처 인덱스는 비트스트림을 통해 부호화 장치(100)로부터 복호화 장치(200)로 시그널링될 수 있다. 복호화 장치(200)는 비트스트림으로부터 엔트로피 부호화된 참조 픽처 인덱스를 추출할 수 있고, 엔트로피 부호화된 참조 픽처 인덱스에 엔트로피 복호화를 적용함으로써 참조 픽처 인덱스를 획득할 수 있다.The reference picture index may indicate a reference picture used for prediction of the target block among reference pictures in the reference picture list. The encoding device 100 can generate an entropy-coded reference picture index by applying entropy coding to the reference picture index and generate a bitstream including the entropy-coded reference picture index. The entropy-coded reference picture index may be signaled from the encoding device 100 to the decoding device 200 through a bitstream. The decoding device 200 can extract an entropy-coded reference picture index from a bitstream and obtain the reference picture index by applying entropy decoding to the entropy-coded reference picture index.

대상 블록의 예측을 위해 2 개의 참조 픽처 리스트가 사용될 경우. 각 참조 픽처 리스트에 대해 하나의 참조 픽처 인덱스 및 하나의 움직임 벡터가 사용될 수 있다. 또한, 대상 블록의 예측을 위해 2 개의 참조 픽처 리스트가 사용될 경우, 대상 블록에 대해 2 개의 예측 블록들이 특정될 수 있다. 예를 들면, 대상 블록에 대한 2 개의 예측 블록들의 평균 또는 가중치가 부여된 합(weighed-sum)을 통해 대상 블록의 (최종적인) 예측 블록이 생성될 수 있다.When two reference picture lists are used for prediction of the target block. One reference picture index and one motion vector can be used for each reference picture list. Additionally, when two reference picture lists are used for prediction of the target block, two prediction blocks may be specified for the target block. For example, a (final) prediction block of the target block may be generated through an average or weighted sum of two prediction blocks for the target block.

예측 움직임 벡터 인덱스, MVD, 참조 방향 및 참조 픽처 인덱스에 의해 대상 블록의 움직임 벡터가 유도될 수 있다.The motion vector of the target block can be derived by the predicted motion vector index, MVD, reference direction, and reference picture index.

복호화 장치(200)는 유도된 움직임 벡터 및 참조 픽처 인덱스에 기반하여 대상 블록에 대한 예측 블록을 생성할 수 있다. 예를 들면, 예측 블록은 참조 픽처 인덱스가 가리키는 참조 픽처 내의 유도된 움직임 벡터가 가리키는 참조 블록일 수 있다.The decoding device 200 may generate a prediction block for the target block based on the derived motion vector and reference picture index. For example, the prediction block may be a reference block pointed to by the derived motion vector in the reference picture indicated by the reference picture index.

대상 블록의 움직임 벡터 자체를 부호화하지 않고, 예측 움직임 벡터 인덱스 및 MVD를 부호화함에 따라 부호화 장치(100)로부터 복호화 장치(200)로 전송되는 비트량이 감소될 수 있고, 부호화 효율이 향상될 수 있다.By encoding the predicted motion vector index and MVD rather than encoding the motion vector of the target block itself, the amount of bits transmitted from the encoding device 100 to the decoding device 200 can be reduced and coding efficiency can be improved.

대상 블록에 대해서 재구축된 이웃 블록의 움직임 정보가 사용될 수 있다. 특정한 인터 예측 모드에서는, 부호화 장치(100)가 대상 블록에 대한 움직임 정보 자체는 별도로 부호화하지 않을 수도 있다. 대상 블록의 움직임 정보가 부호화되지 않고, 재구축된 이웃 블록의 움직임 정보를 통해 대상 블록의 움직임 정보를 유도할 수 있는 다른 정보가 대신 부호화될 수 있다. 다른 정보가 대신 부호화됨에 따라, 복호화 장치(200)로 전송되는 비트량이 감소될 수 있고, 부호화 효율이 향상될 수 있다.The motion information of the reconstructed neighboring block may be used for the target block. In a specific inter prediction mode, the encoding device 100 may not separately encode the motion information itself for the target block. The motion information of the target block is not encoded, and other information that can derive the motion information of the target block through the motion information of the reconstructed neighboring block may be encoded instead. As other information is encoded instead, the amount of bits transmitted to the decoding device 200 can be reduced and coding efficiency can be improved.

예를 들면, 이러한 대상 블록의 움직임 정보가 직접적으로 부호화되지 않는 인터 예측 모드로서, 스킵 모드(skip mode) 및/또는 머지 모드(merge mode) 등이 있을 수 있다. 이때, 부호화 장치(100) 및 복호화 장치(200)는 재구축된 이웃 유닛들 중 어떤 유닛의 움직임 정보가 대상 유닛의 움직임 정보로서 사용되는지를 지시하는 식별자 및/또는 인덱스를 사용할 수 있다.For example, as an inter prediction mode in which the motion information of the target block is not directly encoded, there may be a skip mode and/or a merge mode. At this time, the encoding device 100 and the decoding device 200 may use an identifier and/or index that indicates which unit's motion information among the reconstructed neighboring units is used as the motion information of the target unit.

2) 머지 모드2) Merge Mode

대상 블록의 움직임 정보를 도출하는 방식으로서, 머지(merge)가 있다. 머지는 복수의 블록들에 대한 움직임들의 병합을 의미할 수 있다. 머지는 하나의 블록의 움직임 정보를 다른 블록에도 함께 적용시키는 것을 의미할 수 있다. 말하자면, 머지 모드는 대상 블록의 움직임 정보가 이웃 블록의 움직임 정보로부터 유도되는 모드를 의미할 수 있다.As a method of deriving the movement information of the target block, there is a merge. Merge may mean merging movements of multiple blocks. Merging may mean applying the movement information of one block to other blocks as well. In other words, the merge mode may mean a mode in which the motion information of the target block is derived from the motion information of the neighboring block.

머지 모드가 사용되는 경우, 부호화 장치(100)는 공간적 후보의 움직임 정보 및/또는 시간적 후보의 움직임 정보를 이용하여 대상 블록의 움직임 정보에 대한 예측을 수행할 수 있다. 공간적 후보는 대상 블록에 공간적으로 인접한 재구축된 공간적 이웃 블록을 포함할 수 있다. 공간적 이웃 블록은 좌측 이웃 블록 및 상단 이웃 블록을 포함할 수 있다. 시간적 후보는 콜 블록을 포함할 수 있다. 용어들 "공간적 후보" 및 "공간적 머지 후보"는 동일한 의미로 사용될 수 있으며, 서로 교체되어 사용될 수 있다. 용어들 "시간적 후보" 및 "시간적 머지 후보"은 동일한 의미로 사용될 수 있으며, 서로 교체되어 사용될 수 있다.When the merge mode is used, the encoding device 100 may perform prediction on the motion information of the target block using motion information of the spatial candidate and/or motion information of the temporal candidate. Spatial candidates may include reconstructed spatial neighboring blocks that are spatially adjacent to the target block. Spatial neighboring blocks may include left neighboring blocks and top neighboring blocks. Temporal candidates may include call blocks. The terms “spatial candidate” and “spatial merge candidate” may be used interchangeably and may be used interchangeably. The terms “temporal candidate” and “temporal merge candidate” may be used interchangeably and may be used interchangeably.

부호화 장치(100)는 예측을 통해 예측 블록을 획득할 수 있다. 부호화 장치(100)는 대상 블록 및 예측 블록의 차이인 잔차 블록을 부호화할 수 있다.The encoding device 100 may obtain a prediction block through prediction. The encoding device 100 may encode a residual block that is the difference between the target block and the prediction block.

2-1) 머지 후보 리스트(merge candidate list)의 작성2-1) Creation of merge candidate list

머지 모드가 사용되는 경우, 부호화 장치(100) 및 복호화 장치(200)의 각각은 공간적 후보의 움직임 정보 및/또는 시간적 후보의 움직임 정보를 이용하여 머지 후보 리스트를 생성할 수 있다. 움직임 정보는 1) 움직임 벡터, 2) 참조 픽처 인덱스, 및 3) 참조 방향을 포함할 수 있다. 참조 방향은 단방향 또는 양방향일 수 있다. 참조 방향은 인터 예측 지시자를 의미할 수 있다.When the merge mode is used, each of the encoding device 100 and the decoding device 200 may generate a merge candidate list using motion information of the spatial candidate and/or motion information of the temporal candidate. Motion information may include 1) a motion vector, 2) a reference picture index, and 3) a reference direction. The reference direction can be unidirectional or bidirectional. The reference direction may mean an inter prediction indicator.

머지 후보 리스트는 머지 후보들을 포함할 수 있다. 머지 후보는 움직임 정보일 수 있다. 말하자면, 머지 후보 리스트는 움직임 정보들이 저장된 리스트일 수 있다.The merge candidate list may include merge candidates. The merge candidate may be motion information. In other words, the merge candidate list may be a list in which motion information is stored.

머지 후보들은 시간적 후보 및/또는 공간적 후보 등의 움직임 정보들일 수 있다. 말하자면, 머지 후보 리스트는 시간적 후보 및/또는 공간적 후보 등의 움직임 정보들을 포함할 수 있다.Merge candidates may be motion information such as temporal candidates and/or spatial candidates. In other words, the merge candidate list may include motion information such as temporal candidates and/or spatial candidates.

또한, 머지 후보 리스트는 머지 후보 리스트에 이미 존재하는 머지 후보들의 조합에 의해 생성된 새로운 머지 후보를 포함할 수 있다. 말하자면, 머지 후보 리스트는 머지 후보 리스트에 이미 존재하는 움직임 정보들의 조합에 의해 생성된 새로운 움직임 정보를 포함할 수 있다.Additionally, the merge candidate list may include a new merge candidate created by combining merge candidates that already exist in the merge candidate list. In other words, the merge candidate list may include new motion information generated by combining motion information that already exists in the merge candidate list.

또한, 머지 후보 리스트는 히스토리 기반 머지 후보(history-based merge candidate)를 포함할 수 있다. 히스토리 기반 머지 후보는 대상 블록보다 먼저 부호화 및/또는 복호화된 블록의 움직임 정보일 수 있다.Additionally, the merge candidate list may include history-based merge candidates. A history-based merge candidate may be motion information of a block that was encoded and/or decoded before the target block.

또한, 머지 후보 리스트는 2 개의 머지 후보들의 평균에 기반한 머지 후보를 포함할 수 있다.Additionally, the merge candidate list may include a merge candidate based on the average of two merge candidates.

머지 후보들은 인터 예측 정보를 유도하는 특정된 모드들일 수 있다. 머지 후보는 인터 예측 정보를 유도하는 특정된 모드를 가리키는 정보일 수 있다. 머지 후보가 가리키는 특정된 모드에 따라 대상 블록의 인터 예측 정보가 유도될 수 있다. 이 때, 특정된 모드는 일련의 인터 예측 정보를 유도하는 과정을 포함할 수 있다. 이러한 특정된 모드는 인터 예측 정보 유도 모드 또는 움직임 정보 유도 모드일 수 있다.Merge candidates may be specified modes that derive inter prediction information. A merge candidate may be information indicating a specified mode that derives inter prediction information. Inter prediction information of the target block can be derived according to the specified mode indicated by the merge candidate. At this time, the specified mode may include a process of deriving a series of inter prediction information. This specified mode may be an inter prediction information derivation mode or a motion information derivation mode.

머지 후보 리스트 내의 머지 후보들 중 머지 인덱스에 의해 선택된 머지 후보가 가리키는 모드에 따라서 대상 블록의 인터 예측 정보가 유도될 수 있다.Inter prediction information of the target block may be derived according to the mode indicated by the merge candidate selected by the merge index among the merge candidates in the merge candidate list.

예를 들면, 머지 후보 리스트 내의 움직임 정보 유도 모드들은, 1) 서브 블록 단위의 움직임 정보 유도 모드 및 2) 어파인 움직임 정보 유도 모드 중 적어도 하나일 수 있다.For example, the motion information derivation modes in the merge candidate list may be at least one of 1) a motion information derivation mode on a sub-block basis and 2) an affine motion information derivation mode.

또한, 머지 후보 리스트는 제로 벡터의 움직임 정보를 포함할 수 있다. 제로 벡터는 제로 머지 후보로 칭해질 수도 있다.Additionally, the merge candidate list may include motion information of the zero vector. Zero vectors may also be referred to as zero merge candidates.

말하자면, 머지 후보 리스트 내의 움직임 정보들은, 1) 공간적 후보의 움직임 정보, 2) 시간적 후보의 움직임 정보, 3) 이미 머지 후보 리스트에 존재하는 움직임 정보들의 조합에 의해 생성된 움직임 정보, 4) 제로 벡터 중 적어도 하나일 수 있다.In other words, the motion information in the merge candidate list is: 1) motion information of the spatial candidate, 2) motion information of the temporal candidate, 3) motion information generated by a combination of motion information already existing in the merge candidate list, and 4) zero vector. It can be at least one of:

움직임 정보는 1) 움직임 벡터, 2) 참조 픽처 인덱스 및 3) 참조 방향을 포함할 수 있다. 참조 방향은 인터 예측 지시자로 칭해질 수도 있다. 참조 방향은 단방향 또는 양방향일 수 있다. 단방향의 참조 방향은 L0 예측 또는 L1 예측을 나타낼 수 있다.Motion information may include 1) a motion vector, 2) a reference picture index, and 3) a reference direction. The reference direction may also be referred to as an inter prediction indicator. The reference direction can be unidirectional or bidirectional. A unidirectional reference direction may represent L0 prediction or L1 prediction.

머지 후보 리스트는 머지 모드에 의한 예측이 수행되기 전에 생성될 수 있다.The merge candidate list can be created before prediction by merge mode is performed.

머지 후보 리스트의 머지 후보들의 개수는 기정의될 수 있다. 머지 후보 리스트가 기정의된 개수의 머지 후보들을 갖도록 부호화 장치(100) 및 복호화 장치(200)는 기정의된 방식 및 기정의된 순위에 따라서 머지 후보 리스트에 머지 후보를 추가할 수 있다. 기정의된 방식 및 기정의된 순위를 통해 부호화 장치(100)의 머지 후보 리스트 및 복호화 장치(200)의 머지 후보 리스트는 동일하게 될 수 있다. The number of merge candidates in the merge candidate list may be predefined. The encoding device 100 and the decoding device 200 may add merge candidates to the merge candidate list according to a predefined method and a predefined rank so that the merge candidate list has a predefined number of merge candidates. Through a predefined method and a predefined ranking, the merge candidate list of the encoding device 100 and the merge candidate list of the decoding device 200 may be the same.

머지는 CU 단위 또는 PU 단위로 적용될 수 있다. CU 단위 또는 PU 단위로 머지가 수행되는 경우, 부호화 장치(100)는 기정의된 정보를 포함하는 비트스트림을 복호화 장치(200)로 전송할 수 있다. 예를 들면, 기정의된 정보는, 1) 블록 파티션(partition) 별로 머지를 수행할지 여부를 나타내는 정보, 2) 대상 블록에 대하여 공간적 후보 및/또는 시간적 후보인 블록들 중 어떤 블록과 머지를 할 것인가에 대한 정보를 포함할 수 있다.Merge can be applied on a CU or PU basis. When merging is performed on a CU or PU basis, the encoding device 100 may transmit a bitstream containing predefined information to the decoding device 200. For example, predefined information includes 1) information indicating whether to perform a merge for each block partition, 2) which block among blocks that are spatial candidates and/or temporal candidates for the target block and which block to merge with. It may include information about whether

2-2) 머지 후보 리스트를 사용하는 움직임 벡터의 검색2-2) Search for motion vector using merge candidate list

부호화 장치(100)는 대상 블록의 부호화를 위해 사용될 머지 후보를 결정할 수 있다. 예를 들면, 부호화 장치(100)는 머지 후보 리스트의 머지 후보들을 사용하여 대상 블록에 대한 예측들을 수행하고, 머지 후보들에 대한 잔차 블록들을 생성할 수 있다. 부호화 장치(100)는 예측과 잔차 블록의 부호화에 있어서 최소의 비용을 요구하는 머지 후보를 대상 블록의 부호화를 위해 사용할 수 있다.The encoding device 100 may determine a merge candidate to be used for encoding the target block. For example, the encoding device 100 may perform predictions on a target block using merge candidates from a merge candidate list and generate residual blocks for the merge candidates. The encoding device 100 may use a merge candidate that requires the minimum cost in encoding the prediction and residual blocks to encode the target block.

또한, 부호화 장치(100)는 대상 블록의 부호화에 있어서 머지 모드를 사용할지 여부를 결정할 수 있다.Additionally, the encoding device 100 may determine whether to use merge mode when encoding the target block.

2-3) 인터 예측 정보의 전송2-3) Transmission of inter prediction information

부호화 장치(100)는 인터 예측을 위해 요구되는 인터 예측 정보를 포함하는 비트스트림을 생성할 수 있다. 부호화 장치(100)는 인터 예측 정보에 대한 엔트로피 부호화를 수행하여 엔트로피 부호화된 인터 예측 정보를 생성할 수 있고, 엔트로피 부호화된 인터 예측 정보를 포함하는 비트스트림을 복호화 장치(200)로 전송할 수 있다. 비트스트림을 통해, 엔트로피 부호화된 인터 예측 정보가 부호화 장치(100)로부터 복호화 장치(200)로 시그널링될 수 있다. 복호화 장치(200)는 비트스트림으로부터 엔트로피 부호화된 인터 예측 정보를 추출할 수 있고, 엔트로피 부호화된 인터 예측 정보에 대한 엔트로피 복호화를 수행함으로써 인터 예측 정보를 획득할 수 있다.The encoding device 100 may generate a bitstream including inter prediction information required for inter prediction. The encoding device 100 may generate entropy-encoded inter prediction information by performing entropy encoding on the inter prediction information, and may transmit a bitstream including the entropy-encoded inter prediction information to the decoding device 200. Entropy-encoded inter prediction information may be signaled from the encoding device 100 to the decoding device 200 through the bitstream. The decoding device 200 can extract entropy-encoded inter prediction information from a bitstream and obtain inter-prediction information by performing entropy decoding on the entropy-encoded inter prediction information.

복호화 장치(200)는 비트스트림의 인터 예측 정보를 사용하여 대상 블록에 대한 인터 예측을 수행할 수 있다.The decoding device 200 may perform inter prediction on the target block using inter prediction information of the bitstream.

인터 예측 정보는, 1) 머지 모드를 사용하는지 여부를 나타내는 모드 정보, 2) 머지 인덱스 및 3) 보정 정보를 포함할 수 있다.Inter prediction information may include 1) mode information indicating whether to use merge mode, 2) merge index, and 3) correction information.

또한, 인터 예측 정보는 잔차 신호를 포함할 수 있다.Additionally, inter prediction information may include a residual signal.

복호화 장치(200)는 모드 정보가 머지 모드를 사용하는 것을 나타낼 경우에만 머지 인덱스를 비트스트림으로부터 획득할 수 있다.The decoding device 200 can obtain a merge index from the bitstream only when the mode information indicates that the merge mode is used.

모드 정보는 머지 플래그일 수 있다. 모드 정보의 단위는 블록일 수 있다. 블록에 대한 정보는 모드 정보를 포함할 수 있고, 모드 정보는 블록에 대하여 머지 모드가 적용되는지 여부를 나타낼 수 있다.Mode information may be a merge flag. The unit of mode information may be a block. Information about the block may include mode information, and the mode information may indicate whether merge mode is applied to the block.

머지 인덱스는 머지 후보 리스트에 포함된 머지 후보들 중에서 대상 블록의 예측을 위해 사용되는 머지 후보를 가리킬 수 있다. 또는, 머지 인덱스는 대상 블록에 공간적 또는 시간적으로 인접한 이웃 블록들 중 어떤 블록과의 머지가 수행되는가를 가리킬 수 있다.The merge index may indicate a merge candidate used to predict the target block among the merge candidates included in the merge candidate list. Alternatively, the merge index may indicate with which block among neighboring blocks spatially or temporally adjacent to the target block the merge is performed.

부호화 장치(100)는 머지 후보 리스트에 포함된 머지 후보들 중 가장 높은 부호화 성능을 갖는 머지 후보를 선택할 수 있고, 선택된 머지 후보를 가리키도록 머지 인덱스의 값을 설정할 수 있다.The encoding device 100 may select a merge candidate with the highest coding performance among the merge candidates included in the merge candidate list, and set the value of the merge index to indicate the selected merge candidate.

보정 정보는 움직임 벡터의 보정을 위해 사용되는 정보일 수 있다. 부호화 장치(100)는 보정 정보를 생성할 수 있다. 복호화 장치(200)는 보정 정보에 기반하여 머지 인덱스에 의해 선택된 머지 후보의 움직임 벡터를 보정할 수 있다.Correction information may be information used to correct a motion vector. The encoding device 100 can generate correction information. The decoding device 200 may correct the motion vector of the merge candidate selected by the merge index based on the correction information.

보정 정보는 보정 여부를 나타내는 정보, 보정 방향 정보 및 보정 크기 정보 중 적어도 하나를 포함할 수 있다. 시그널링되는 보정 정보에 기반하여 움직임 벡터를 보정하는 예측 모드가 움직임 벡터 차분을 가진 머지 모드로 칭해질 수 있다.Correction information may include at least one of information indicating whether correction is made, correction direction information, and correction size information. The prediction mode that corrects the motion vector based on the signaled correction information may be called a merge mode with motion vector difference.

2-4) 인터 예측 정보를 사용하는 머지 모드의 인터 예측2-4) Inter prediction in merge mode using inter prediction information

복호화 장치(200)는 머지 후보 리스트에 포함된 머지 후보들 중에서 머지 인덱스가 가리키는 머지 후보를 사용하여 대상 블록에 대한 예측을 수행할 수 있다.The decoding device 200 may perform prediction on the target block using the merge candidate indicated by the merge index among the merge candidates included in the merge candidate list.

머지 인덱스가 가리키는 머지 후보의 움직임 벡터, 참조 픽처 인덱스 및 참조 방향에 의해 대상 블록의 움직임 벡터가 특정될 수 있다.The motion vector of the target block can be specified by the motion vector of the merge candidate indicated by the merge index, the reference picture index, and the reference direction.

3) 스킵 모드3) Skip mode

스킵 모드는 공간적 후보의 움직임 정보 또는 시간적 후보의 움직임 정보를 그대로 대상 블록에 적용하는 모드일 수 있다. 또한, 스킵 모드는 잔차 신호를 사용하지 않는 모드일 수 있다. 말하자면, 스킵 모드가 사용될 때, 재구축된 블록은 예측 블록과 동일할 수 있다.Skip mode may be a mode in which motion information of a spatial candidate or motion information of a temporal candidate is applied to the target block as is. Additionally, the skip mode may be a mode that does not use a residual signal. That is, when skip mode is used, the reconstructed block may be identical to the prediction block.

머지 모드 및 스킵 모드의 차이는 잔차 신호의 전송 또는 사용의 여부일 수 있다. 말하자면, 스킵 모드는 잔차 신호가 전송 또는 사용되지 않는다는 점을 제외하고는 머지 모드와 유사할 수 있다.The difference between merge mode and skip mode may be whether or not residual signals are transmitted or used. That is to say, skip mode may be similar to merge mode except that residual signals are not transmitted or used.

스킵 모드가 사용되는 경우, 부호화 장치(100)는 공간적 후보 또는 시간적 후보인 블록들 중 어떤 블록의 움직임 정보가 대상 블록의 움직임 정보로서 이용되는 지를 나타내는 정보를 비트스트림을 통해 복호화 장치(200)에 전송할 수 있다. 부호화 장치(100)는 이러한 정보에 대한 엔트로피 부호화를 수행하여 엔트로피 부호화된 정보를 생성할 수 있고, 비트스트림을 통해 엔트로피 부호화된 정보를 복호화 장치(200)로 시그널링할 수 있다. 복호화 장치(200)는 비트스트림으로부터 엔트로피 부호화된 정보를 추출할 수 있고, 엔트로피 부호화된 정보에 대한 엔트로피 복호화를 수행함으로써 정보를 획득할 수 있다.When skip mode is used, the encoding device 100 sends information indicating which block's motion information among spatial candidate or temporal candidate blocks is used as motion information of the target block to the decoding device 200 through a bitstream. Can be transmitted. The encoding device 100 can generate entropy-coded information by performing entropy encoding on such information, and can signal the entropy-coded information to the decoding device 200 through a bitstream. The decoding device 200 can extract entropy-encoded information from a bitstream and obtain information by performing entropy decoding on the entropy-encoded information.

또한, 스킵 모드가 사용되는 경우 부호화 장치(100)는 MVD와 같은 다른 신택스 요소 정보는 복호화 장치(200)에 전송하지 않을 수 있다. 예를 들면, 스킵 모드가 사용되는 경우, 부호화 장치(100)는 MVD, 코드된 블록 플래그 및 변환 계수 레벨 중 적어도 하나에 관한 신택스 요소를 복호화 장치(200)에 시그널링하지 않을 수 있다.Additionally, when skip mode is used, the encoding device 100 may not transmit other syntax element information, such as MVD, to the decoding device 200. For example, when skip mode is used, the encoding device 100 may not signal syntax elements related to at least one of the MVD, the coded block flag, and the transform coefficient level to the decoding device 200.

3-1) 머지 후보 리스트의 작성3-1) Creation of merge candidate list

스킵 모드 또한 머지 후보 리스트를 사용할 수 있다. 말하자면, 머지 후보 리스트는 머지 모드 및 스킵 모드의 양자에서 사용될 수 있다. 이러한 측면에서, 머지 후보 리스트는 "스킵 후보 리스트" 또는 "머지/스킵 후보 리스트"로 명명될 수도 있다.Skip mode can also use the merge candidate list. That is, the merge candidate list can be used in both merge mode and skip mode. In this respect, the merge candidate list may be named “skip candidate list” or “merge/skip candidate list.”

또는, 스킵 모드는 머지 모드와는 다른 별개의 후보 리스트를 사용할 수도 있다. 이러한 경우, 아래의 설명에서 머지 후보 리스트 및 머지 후보는 스킵 후보 리스트 및 스킵 후보로 각각 대체될 수 있다.Alternatively, skip mode may use a separate candidate list than merge mode. In this case, in the description below, the merge candidate list and merge candidate may be replaced with the skip candidate list and skip candidate, respectively.

머지 후보 리스트는 스킵 모드에 의한 예측이 수행되기 전에 생성될 수 있다.The merge candidate list can be created before prediction by skip mode is performed.

3-2) 머지 후보 리스트를 사용하는 움직임 벡터의 검색3-2) Search for motion vector using merge candidate list

부호화 장치(100)는 대상 블록의 부호화를 위해 사용될 머지 후보를 결정할 수 있다. 예를 들면, 부호화 장치(100)는 머지 후보 리스트의 머지 후보들을 사용하여 대상 블록에 대한 예측들을 수행할 수 있다. 부호화 장치(100)는 예측에 있어서 최소의 비용을 요구하는 머지 후보를 대상 블록의 부호화를 위해 사용할 수 있다.The encoding device 100 may determine a merge candidate to be used for encoding the target block. For example, the encoding device 100 may perform predictions on the target block using merge candidates from the merge candidate list. The encoding device 100 may use a merge candidate that requires the minimum cost in prediction to encode the target block.

또한, 부호화 장치(100)는 대상 블록의 부호화에 있어서 스킵 모드를 사용할지 여부를 결정할 수 있다.Additionally, the encoding device 100 may determine whether to use skip mode when encoding the target block.

3-3) 인터 예측 정보의 전송3-3) Transmission of inter prediction information

부호화 장치(100)는 인터 예측을 위해 요구되는 인터 예측 정보를 포함하는 비트스트림을 생성할 수 있다. 복호화 장치(200)는 비트스트림의 인터 예측 정보를 사용하여 대상 블록에 대한 인터 예측을 수행할 수 있다.The encoding device 100 may generate a bitstream including inter prediction information required for inter prediction. The decoding device 200 may perform inter prediction on the target block using inter prediction information of the bitstream.

인터 예측 정보는, 1) 스킵 모드를 사용하는지 여부를 나타내는 모드 정보 및 2) 스킵 인덱스를 포함할 수 있다.Inter prediction information may include 1) mode information indicating whether skip mode is used, and 2) skip index.

스킵 인덱스는 전술된 머지 인덱스와 동일할 수 있다.The skip index may be the same as the merge index described above.

스킵 모드가 사용될 경우, 대상 블록은 잔차 신호 없이 부호화될 수 있다. 인터 예측 정보는 잔차 신호를 포함하지 않을 수 있다. 또는, 비트스트림은 잔차 신호를 포함하지 않을 수 있다.When skip mode is used, the target block can be encoded without a residual signal. Inter prediction information may not include residual signals. Alternatively, the bitstream may not include a residual signal.

복호화 장치(200)는 모드 정보가 스킵 모드를 사용하는 것을 나타낼 경우에만 스킵 인덱스를 비트스트림으로부터 획득할 수 있다. 전술된 것과 같이, 머지 인덱스 및 스킵 인덱스는 동일한 것일 수 있다. 복호화 장치(200)는 모드 정보가 머지 모드 또는 스킵 모드를 사용하는 것을 나타낼 경우에만 스킵 인덱스를 비트스트림으로부터 획득할 수 있다.The decoding device 200 can obtain a skip index from the bitstream only when the mode information indicates that skip mode is used. As described above, the merge index and skip index may be the same. The decoding device 200 can obtain a skip index from the bitstream only when the mode information indicates that merge mode or skip mode is used.

스킵 인덱스는 머지 후보 리스트에 포함된 머지 후보들 중에서 대상 블록의 예측을 위해 사용되는 머지 후보를 가리킬 수 있다.The skip index may indicate a merge candidate used to predict the target block among the merge candidates included in the merge candidate list.

3-4) 인터 예측 정보를 사용하는 스킵 모드의 인터 예측3-4) Inter prediction in skip mode using inter prediction information

복호화 장치(200)는 머지 후보 리스트에 포함된 머지 후보들 중에서 스킵 인덱스가 가리키는 머지 후보를 사용하여 대상 블록에 대한 예측을 수행할 수 있다.The decoding device 200 may perform prediction on the target block using the merge candidate indicated by the skip index among the merge candidates included in the merge candidate list.

스킵 인덱스가 가리키는 머지 후보의 움직임 벡터, 참조 픽처 인덱스 및 참조 방향에 의해 대상 블록의 움직임 벡터가 특정될 수 있다.The motion vector of the target block can be specified by the motion vector of the merge candidate indicated by the skip index, the reference picture index, and the reference direction.

4) 현재 픽처 참조 모드4) Current picture reference mode

현재 픽처 참조 모드는 대상 블록이 속한 대상 픽처 내의 기-재구축된 영역을 이용하는 예측 모드를 의미할 수 있다.The current picture reference mode may refer to a prediction mode that uses a pre-reconstructed area within the target picture to which the target block belongs.

기-재구축된 영역을 특정하기 위한 움직임 벡터가 이용될 수 있다. 대상 블록이 현재 픽처 참조 모드로 부호화되는지 여부는 대상 블록의 참조 픽처 인덱스를 이용하여 판단될 수 있다.A motion vector may be used to specify a pre-reconstructed area. Whether the target block is encoded in the current picture reference mode can be determined using the reference picture index of the target block.

대상 블록이 현재 픽처 참조 모드로 부호화된 블록인지 여부를 나타내는 플래그 또는 인덱스가 부호화 장치(100)로부터 복호화 장치(200)로 시그널링될 수도 있다. 또는, 대상 블록이 현재 픽처 참조 모드로 부호화된 블록인지 여부는 대상 블록의 참조 픽처 인덱스를 통해 유추될 수도 있다.A flag or index indicating whether the target block is a block encoded in the current picture reference mode may be signaled from the encoding device 100 to the decoding device 200. Alternatively, whether the target block is a block encoded in the current picture reference mode may be inferred through the reference picture index of the target block.

대상 블록이 현재 픽처 참조 모드로 부호화된 경우, 대상 픽처는 대상 블록을 위한 참조 픽처 리스트 내에서 고정된 위치 또는 임의의 위치에 존재할 수 있다.When the target block is encoded in the current picture reference mode, the target picture may exist at a fixed position or a random position within the reference picture list for the target block.

예를 들면, 고정된 위치는 참조 픽처 인덱스의 값이 0인 위치 또는 가장 마지막의 위치일 수 있다.For example, the fixed position may be a position where the reference picture index value is 0 or the very last position.

대상 픽처가 참조 픽처 리스트 내의 임의의 위치에 존재하는 경우, 이러한 임의의 위치를 나타내는 별도의 참조 픽처 인덱스가 부호화 장치(100)로부터 복호화 장치(200)로 시그널링될 수도 있다.If the target picture exists at a random position in the reference picture list, a separate reference picture index indicating this random position may be signaled from the coding device 100 to the decoding device 200.

5) 서브 블록 머지 모드(subblock merge mode)5) Subblock merge mode

서브 블록 머지 모드는, CU의 서브 블록에 대하여 움직임 정보를 유도하는 모드를 의미할 수 있다.Subblock merge mode may refer to a mode that derives motion information for a subblock of a CU.

서브 블록 머지 모드가 적용되는 경우, 참조 영상에서 대상 서브 블록의 콜 서브 블록의 움직임 정보(말하자면, 서브 블록 기반 시간적 머지 후보(Sub-block based temporal merge candidate)) 및/또는 어파인 제어 포인트 움직임 벡터 머지 후보(affine control point motion vector merge candidate)를 사용하여 서브 블록 머지 후보 리스트(subblock merge candidate list)가 생성될 수 있다.When the sub-block merge mode is applied, the motion information of the call sub-block of the target sub-block in the reference image (i.e., sub-block based temporal merge candidate) and/or the affine control point motion vector A subblock merge candidate list may be created using a merge candidate (affine control point motion vector merge candidate).

6) 삼각 분할 모드(triangle partition mode)6) Triangle partition mode

삼각 분할 모드에서, 대상 블록을 대각선 방향으로 분할함으로써 분할된 대상 블록들이 생성될 수 있다. 각 분할된 대상 블록에 대하여, 각 분할된 대상 블록의 움직임 정보가 유도될 수 있고, 유도된 움직임 정보를 이용하여 각 분할된 대상 블록에 대한 예측 샘플이 유도될 수 있다. 분할된 대상 블록들의 예측 샘플들의 가중치가 부여된 합을 통해 대상 블록의 예측 샘플이 유도될 수 있다.In the triangulation mode, divided target blocks can be created by dividing the target block diagonally. For each divided target block, motion information of each divided target block may be derived, and prediction samples for each divided target block may be derived using the derived motion information. The prediction sample of the target block may be derived through a weighted sum of the prediction samples of the divided target blocks.

7) 인터 인트라 결합 예측 모드7) Inter-intra combined prediction mode

인터 인트라 결합 예측 모드는, 인터 예측에 의해 생성된 예측 샘플 및 인트라 예측에 의해 생성된 예측 샘플의 가중치가 부여된 합을 사용하여 대상 블록의 예측 샘플을 유도하는 모드일 수 있다.The inter-intra combined prediction mode may be a mode in which a prediction sample of the target block is derived using a weighted sum of prediction samples generated by inter prediction and prediction samples generated by intra prediction.

전술된 모드들에 있어서, 복호화 장치(200)는 도출된 움직임 정보에 대한 자체적인 보정을 수행할 수 있다. 예를 들면, 복호화 장치(200)는 도출된 움직임 정보가 지시하는 참조 블록을 기준으로 특정된 구역을 탐색하여 최소의 절대 차이들의 합(Sum of Absolute Differences; SAD)를 갖는 움직임 정보를 검색할 수 있고, 검색된 움직임 정보를 보정된 움직임 정보로서 유도할 수 있다.In the above-described modes, the decoding device 200 may perform its own correction on the derived motion information. For example, the decoding device 200 may search a specified area based on the reference block indicated by the derived motion information and search for motion information with the minimum Sum of Absolute Differences (SAD). And, the searched motion information can be derived as corrected motion information.

전술된 모드들에 있어서, 복호화 장치(200)는 광학적 흐름(optical flow)을 사용하여 인터 예측을 통해 유도된 예측 샘플에 대한 보상을 수행할 수 있다.In the above-described modes, the decoding device 200 may perform compensation for prediction samples derived through inter prediction using optical flow.

전술된 AMVP 모드, 머지 모드 및 스킵 모드 등에서는 리스트에 대한 인덱스를 통해 리스트 내의 움직임 정보들 중 대상 블록의 예측을 위해 사용될 움직임 정보가 특정될 수 있다.In the above-described AMVP mode, merge mode, and skip mode, etc., motion information to be used for prediction of the target block among motion information in the list can be specified through an index to the list.

부호화 효율의 향상을 위해서, 부호화 장치(100)는 리스트의 요소들 중 대상 블록의 인터 예측에 있어서 최소의 비용을 유발하는 요소의 인덱스만을 시그널링할 수 있다. 부호화 장치(100)는 인덱스를 부호화할 수 있으며, 부호화된 인덱스를 시그널링할 수 있다.To improve coding efficiency, the encoding device 100 may signal only the index of the element that causes the minimum cost in inter prediction of the target block among the elements of the list. The encoding device 100 can encode an index and signal the encoded index.

따라서, 전술된 리스트들(즉, 예측 움직임 벡터 후보 리스트 및 머지 후보 리스트)은 부호화 장치(100) 및 복호화 장치(200)에서 동일한 데이터에 기반하여 동일한 방식으로 유도되어야 할 수 있다. 여기에서, 동일한 데이터는 재구축된 픽처 및 재구축된 블록을 포함할 수 있다. 또한, 인덱스로 요소를 특정하기 위해, 리스트 내에서 요소들의 순서는 일정해야 할 수 있다.Accordingly, the above-described lists (i.e., the predicted motion vector candidate list and the merge candidate list) may have to be derived in the same way based on the same data in the encoding device 100 and the decoding device 200. Here, the same data may include a reconstructed picture and a reconstructed block. Additionally, in order to specify elements by index, the order of elements within the list may need to be constant.

도 10은 일 예에 따른 공간적 후보들을 나타낸다.Figure 10 shows spatial candidates according to an example.

도 10에서는, 공간적 후보들의 위치가 도시되었다.In Figure 10, the locations of spatial candidates are shown.

가운데의 큰 블록은 대상 블록을 나타낼 수 있다. 5 개의 작은 블록들은 공간적 후보들을 나타낼 수 있다.The large block in the middle may represent the target block. Five small blocks may represent spatial candidates.

대상 블록의 좌표들은 (xP, yP)일 수 있고, 대상 블록의 크기는 (nPSW, nPSH)일 수 있다.The coordinates of the target block may be (xP, yP), and the size of the target block may be (nPSW, nPSH).

공간적 후보 A0은 대상 블록의 좌측 하단의 코너에 인접한 블록일 수 있다. A0은 좌표들 (xP - 1, yP + nPSH)의 픽셀을 차지하는 블록일 수 있다.Spatial candidate A 0 may be a block adjacent to the lower left corner of the target block. A 0 may be a block occupying a pixel with coordinates (xP - 1, yP + nPSH).

공간적 후보 A1은 대상 블록의 좌측에 인접한 블록일 수 있다. A1은 대상 블록의 좌측에 인접한 블록들 중 최 하단의 블록일 수 있다. 또는, A1은 A0의 상단에 인접한 블록일 수 있다. A1은 좌표들 (xP - 1, yP + nPSH - 1)의 픽셀을 차지하는 블록일 수 있다.Spatial candidate A 1 may be a block adjacent to the left of the target block. A 1 may be the lowest block among blocks adjacent to the left of the target block. Alternatively, A 1 may be a block adjacent to the top of A 0 . A 1 may be a block occupying a pixel with coordinates (xP - 1, yP + nPSH - 1).

공간적 후보 B0은 대상 블록의 우측 상단의 코너에 인접한 블록일 수 있다. B0은 좌표들 (xP + nPSW, yP - 1)의 픽셀을 차지하는 블록일 수 있다.Spatial candidate B 0 may be a block adjacent to the upper right corner of the target block. B 0 may be a block occupying a pixel with coordinates (xP + nPSW, yP - 1).

공간적 후보 B1은 대상 블록의 상단에 인접한 블록일 수 있다. B1은 대상 블록의 상단에 인접한 블록들 중 최 우측의 블록일 수 있다. 또는, B1은 B0의 좌측에 인접한 블록일 수 있다. B1은 좌표들 (xP + nPSW - 1, yP - 1)의 픽셀을 차지하는 블록일 수 있다.Spatial candidate B 1 may be a block adjacent to the top of the target block. B 1 may be the rightmost block among blocks adjacent to the top of the target block. Alternatively, B 1 may be a block adjacent to the left of B 0 . B 1 may be a block occupying a pixel with coordinates (xP + nPSW - 1, yP - 1).

공간적 후보 B2는 대상 블록의 좌측 상단의 코너에 인접한 블록일 수 있다. B2는 좌표들 (xP - 1, yP - 1)의 픽셀을 차지하는 블록일 수 있다.Spatial candidate B 2 may be a block adjacent to the upper left corner of the target block. B 2 may be a block occupying a pixel with coordinates (xP - 1, yP - 1).

공간적 후보 및 시간적 후보의 가용성(availability)의 판단Determination of availability of spatial and temporal candidates

공간적 후보의 움직임 정보 또는 시간적 후보의 움직임 정보를 리스트에 포함시키기 위해서는, 공간적 후보의 움직임 정보 또는 시간적 후보의 움직임 정보가 가용한지 여부가 판단되어야 한다.In order to include the motion information of the spatial candidate or the motion information of the temporal candidate in the list, it must be determined whether the motion information of the spatial candidate or the motion information of the temporal candidate is available.

이하에서, 후보 블록은 공간적 후보 및 시간적 후보를 포함할 수 있다.Hereinafter, candidate blocks may include spatial candidates and temporal candidates.

예를 들면, 상기의 판단은 아래의 단계 1) 내지 단계 4)를 순차적으로 적용함으로써 이루어질 수 있다.For example, the above determination can be made by sequentially applying steps 1) to 4) below.

단계 1) 후보 블록을 포함하는 PU가 픽처의 경계의 밖에 있으면 후보 블록의 가용성은 거짓(false)으로 설정될 수 있다. "가용성이 거짓으로 설정된다"는 것은 "비가용한 것으로 설정된다"는 것과 동일한 의미일 수 있다. Step 1) If the PU containing the candidate block is outside the boundary of the picture, the availability of the candidate block may be set to false. “Availability is set to false” may mean the same as “set to unavailable.”

단계 2) 후보 블록을 포함하는 PU가 슬라이스의 경계의 밖에 있으면 후보 블록의 가용성은 거짓으로 설정될 수 있다. 대상 블록 및 후보 블록이 서로 다른 슬라이스들 내에 위치하면, 후보 블록의 가용성은 거짓으로 설정될 수 있다. Step 2) If the PU containing the candidate block is outside the boundary of the slice, the availability of the candidate block may be set to false. If the target block and the candidate block are located in different slices, the availability of the candidate block may be set to false.

단계 3) 후보 블록을 포함하는 PU가 타일의 경계의 밖에 있으면 후보 블록의 가용성은 거짓으로 설정될 수 있다. 대상 블록 및 후보 블록이 서로 다른 타일들 내에 위치하면, 후보 블록의 가용성은 거짓으로 설정될 수 있다. Step 3) If the PU containing the candidate block is outside the boundary of the tile, the availability of the candidate block may be set to false. If the target block and the candidate block are located within different tiles, the availability of the candidate block may be set to false.

단계 4) 후보 블록을 포함하는 PU의 예측 모드가 인트라 예측 모드이면 후보 블록의 가용성은 거짓으로 설정될 수 있다. 후보 블록을 포함하는 PU가 인터 예측을 사용하지 않으면 후보 블록의 가용성은 거짓으로 설정될 수 있다. Step 4) If the prediction mode of the PU including the candidate block is intra prediction mode, the availability of the candidate block may be set to false. If the PU containing the candidate block does not use inter prediction, the availability of the candidate block may be set to false.

도 11은 일 예에 따른 공간적 후보들의 움직임 정보들의 머지 리스트로의 추가 순서를 나타낸다.Figure 11 shows the order of adding motion information of spatial candidates to a merge list according to an example.

도 11에서 도시된 것처럼, 공간적 후보들의 움직임 정보들을 머지 리스트에 추가함에 있어서, A1, B1, B0, A0 및 B2의 순서가 사용될 수 있다. 즉, A1, B1, B0, A0 및 B2의 순서로, 가용한 공간적 후보의 움직임 정보가 머지 리스트에 추가될 수 있다.As shown in FIG. 11, when adding motion information of spatial candidates to the merge list, the order of A 1 , B 1 , B 0 , A 0 and B 2 may be used. That is, motion information of available spatial candidates may be added to the merge list in the following order: A 1 , B 1 , B 0 , A 0 , and B 2 .

머지 모드 및 스킵 모드에서의 머지 리스트의 유도 방법Merge list derivation method in merge mode and skip mode

전술된 것과 같이, 머지 리스트 내의 머지 후보들의 최대 개수는 설정될 수 있다. 설정된 최대 개수를 N으로 표시한다. 설정된 개수는 부호화 장치(100)로부터 복호화 장치(200)로 전송될 수 있다. 슬라이스의 슬라이스 헤더는 N을 포함할 수 있다. 말하자면, 슬라이스 헤더에 의해 슬라이스의 대상 블록에 대한 머지 리스트의 머지 후보들의 최대 개수가 설정될 수 있다. 예를 들면, 기본적으로 N의 값은 5일 수 있다.As described above, the maximum number of merge candidates in the merge list can be set. The set maximum number is indicated as N. The set number may be transmitted from the encoding device 100 to the decoding device 200. The slice header of a slice may include N. In other words, the maximum number of merge candidates in the merge list for the target block of the slice can be set by the slice header. For example, by default, the value of N may be 5.

움직임 정보(즉, 머지 후보)는 아래의 단계 1) 내지 단계 4)의 순서로 머지 리스트에 추가될 수 있다.Motion information (i.e., merge candidate) can be added to the merge list in the order of steps 1) to 4) below.

단계 1) 공간적 후보들 중 가용한 공간적 후보들이 머지 리스트에 추가될 수 있다. 가용한 공간적 후보들의 움직임 정보들은 도 11에서 도시된 순서대로 머지 리스트에 추가될 수 있다. 이 때, 가용한 공간적 후보의 움직임 정보가 이미 머지 리스트 내에 존재하는 다른 움직임 정보와 중복되는 경우 상기의 움직임 정보는 머지 리스트에 추가되지 않을 수 있다. 리스트 내에 존재하는 다른 움직임 정보와 중복되는지 여부를 검사하는 것은 "중복성 검사"로 약술될 수 있다. Step 1) Among the spatial candidates, available spatial candidates can be added to the merge list. Motion information of available spatial candidates can be added to the merge list in the order shown in FIG. 11. At this time, if the motion information of the available spatial candidate overlaps with other motion information that already exists in the merge list, the motion information may not be added to the merge list. Checking whether there is overlap with other motion information present in the list can be outlined as a “redundancy check.”

추가되는 움직임 정보들은 최대 N 개일 수 있다.There may be a maximum of N pieces of added motion information.

단계 2) 머지 리스트 내의 움직임 정보들의 개수가 N 보다 더 작고, 시간적 후보가 가용하면, 시간적 후보의 움직임 정보가 머지 리스트에 추가될 수 있다. 이 때, 가용한 시간적 후보의 움직임 정보가 이미 머지 리스트 내에 존재하는 다른 움직임 정보와 중복되는 경우 상기의 움직임 정보는 머지 리스트에 추가되지 않을 수 있다. Step 2) If the number of motion information items in the merge list is smaller than N and a temporal candidate is available, the motion information of the temporal candidate may be added to the merge list. At this time, if the motion information of the available temporal candidate overlaps with other motion information that already exists in the merge list, the motion information may not be added to the merge list.

단계 3) 머지 리스트 내의 움직임 정보들의 개수가 N 보다 더 작고, 대상 슬라이스의 타입이 "B"이면, 조합된 양방향 예측(combined bi-prediction)에 의해 생성된 조합된 움직임 정보가 머지 리스트에 추가될 수 있다. Step 3) If the number of motion information in the merge list is smaller than N and the type of target slice is "B", the combined motion information generated by combined bi-prediction will be added to the merge list. You can.

대상 슬라이스는 대상 블록을 포함하는 슬라이스일 수 있다.The target slice may be a slice containing the target block.

조합된 움직임 정보는 L0 움직임 정보 및 L1 움직임 정보의 조합일 수 있다. L0 움직임 정보는 참조 픽처 리스트 L0만을 참조하는 움직임 정보일 수 있다. L1 움직임 정보는 참조 픽처 리스트 L1만을 참조하는 움직임 정보일 수 있다.The combined motion information may be a combination of L0 motion information and L1 motion information. L0 motion information may be motion information that refers only to the reference picture list L0. L1 motion information may be motion information that refers only to the reference picture list L1.

머지 리스트 내에서, L0 움직임 정보는 하나 이상일 수 있다. 또한, 머지 리스트 내에서, L1 움직임 정보는 하나 이상일 수 있다.Within the merge list, there may be more than one L0 motion information. Additionally, within the merge list, there may be more than one L1 motion information.

조합된 움직임 정보는 하나 이상일 수 있다. 조합된 움직임 정보를 생성함에 있어서 하나 이상의 L0 움직임 정보들 및 하나 이상의 L1 움직임 정보들 중 어떤 L0 움직임 정보 및 어떤 L1 움직임 정보를 사용할 것인가는 기정의될 수 있다. 하나 이상의 조합된 움직임 정보는 머지 리스트 내의 서로 다른 움직임 정보들의 쌍(pair)을 사용하는 조합된 양방향 예측에 의해 기정의된 순서로 생성될 수 있다. 서로 다른 움직임 정보들의 쌍 중 하나는 L0 움직임 정보이고 다른 하나는 L1 움직임 정보일 수 있다.There may be more than one piece of combined motion information. In generating the combined motion information, which L0 motion information and which L1 motion information to use among one or more L0 motion information and one or more L1 motion information may be predefined. One or more combined motion information may be generated in a predefined order by combined bidirectional prediction using pairs of different motion information in the merge list. One of the pairs of different motion information may be L0 motion information and the other may be L1 motion information.

예를 들면, 최우선적으로 추가되는 조합된 움직임 정보는 머지 인덱스가 0인 L0 움직임 정보 및 머지 인덱스가 1인 L1 움직임 정보의 조합일 수 있다. 머지 인덱스가 0인 움직임 정보가 L0 움직임 정보가 아니거나, 머지 인덱스가 1인 움직임 정보가 L1 움직임 정보가 아니면 상기의 조합된 움직임 정보는 생성 및 추가되지 않을 수 있다. 다음으로 추가되는 움직임 정보는 머지 인덱스가 1인 L0 움직임 정보 및 머지 인덱스가 0인 L1 움직임 정보의 조합일 수 있다. 이하의 구체적인 조합은 비디오의 부호화/복호화 분야의 다른 조합을 따를 수 있다.For example, the combined motion information added with highest priority may be a combination of L0 motion information with a merge index of 0 and L1 motion information with a merge index of 1. If motion information with a merge index of 0 is not L0 motion information, or motion information with a merge index of 1 is not L1 motion information, the above combined motion information may not be generated and added. The motion information added next may be a combination of L0 motion information with a merge index of 1 and L1 motion information with a merge index of 0. The specific combination below may follow other combinations in the video encoding/decoding field.

이 때, 조합된 움직임 정보가 이미 머지 리스트 내에 존재하는 다른 움직임 정보와 중복되는 경우 상기의 조합된 움직임 정보는 머지 리스트에 추가되지 않을 수 있다.At this time, if the combined motion information overlaps with other motion information that already exists in the merge list, the combined motion information may not be added to the merge list.

단계 4) 머지 리스트 내의 움직임 정보들의 개수가 N 보다 더 작으면, 제로 벡터 움직임 정보가 머지 리스트에 추가될 수 있다. Step 4) If the number of motion information items in the merge list is smaller than N, zero vector motion information may be added to the merge list.

제로 벡터 움직임 정보는 움직임 벡터가 제로 벡터인 움직임 정보일 수 있다.Zero vector motion information may be motion information in which the motion vector is a zero vector.

제로 벡터 움직임 정보는 하나 이상일 수 있다. 하나 이상의 제로 벡터 움직임 정보들의 참조 픽처 인덱스들은 서로 상이할 수 있다. 예를 들면, 첫 번째의 제로 벡터 움직임 정보의 참조 픽처 인덱스의 값은 0일 수 있다. 두 번째의 제로 벡터 움직임 정보의 참조 픽처 인덱스의 값은 1일 수 있다.There may be one or more zero vector motion information. Reference picture indices of one or more pieces of zero vector motion information may be different from each other. For example, the value of the reference picture index of the first zero vector motion information may be 0. The value of the reference picture index of the second zero vector motion information may be 1.

제로 벡터 움직임 정보들의 개수는 참조 픽처 리스트 내의 참조 픽처들의 개수와 동일할 수 있다.The number of zero vector motion information may be equal to the number of reference pictures in the reference picture list.

제로 벡터 움직임 정보의 참조 방향은 양방향일 수 있다. 2 개의 움직임 벡터들은 모두 제로 벡터들일 수 있다. 제로 벡터 움직임 정보들의 개수는 참조 픽처 리스트 L0 내의 참조 픽처들의 개수 및 참조 픽처 리스트 L1 내의 참조 픽처들의 개수 중 더 작은 것일 수 있다. 또는, 참조 픽처 리스트 L0 내의 참조 픽처들의 개수 및 참조 픽처 리스트 L1 내의 참조 픽처들의 개수가 서로 다를 경우, 하나의 참조 픽처 리스트에만 적용될 수 있는 참조 픽처 인덱스에 대해서는 단방향의 참조 방향이 사용될 수 있다.The reference direction of zero vector motion information may be bidirectional. Both motion vectors may be zero vectors. The number of zero vector motion information may be the smaller of the number of reference pictures in the reference picture list L0 and the number of reference pictures in the reference picture list L1. Alternatively, if the number of reference pictures in the reference picture list L0 and the number of reference pictures in the reference picture list L1 are different from each other, a unidirectional reference direction may be used for a reference picture index that can be applied to only one reference picture list.

부호화 장치(100) 및/또는 복호화 장치(200)는 참조 픽처 인덱스를 변경하면서 순차적으로 제로 벡터 움직임 정보를 머지 리스트에 추가할 수 있다.The encoding device 100 and/or the decoding device 200 may sequentially add zero vector motion information to the merge list while changing the reference picture index.

제로 벡터 움직임 정보가 이미 머지 리스트 내에 존재하는 다른 움직임 정보와 중복되는 경우 상기의 제로 벡터 움직임 정보는 머지 리스트에 추가되지 않을 수 있다.If the zero vector motion information overlaps with other motion information that already exists in the merge list, the zero vector motion information may not be added to the merge list.

전술된 단계 1) 내지 단계 4)의 순서는 단지 예시적인 것으로, 단계들 간의 순서는 서로 바뀔 수 있다. 또한, 단계들 중 일부는 기정의된 조건에 따라 생략될 수 있다.The order of steps 1) to 4) described above is merely exemplary, and the order between steps may be changed. Additionally, some of the steps may be omitted depending on predefined conditions.

AMVP 모드에서의 예측 움직임 벡터 후보 리스트의 유도 방법Method for deriving a predicted motion vector candidate list in AMVP mode

예측 움직임 벡터 후보 리스트 내의 예측 움직임 벡터 후보들의 최대 개수는 기정의될 수 있다. 기정의된 최대 개수를 N으로 표시한다. 예를 들면, 기정의된 최대 개수는 2일 수 있다.The maximum number of prediction motion vector candidates in the prediction motion vector candidate list may be predefined. The predefined maximum number is denoted by N. For example, the predefined maximum number may be 2.

움직임 정보(즉, 예측 움직임 벡터 후보)는 아래의 단계 1) 내지 단계 3)의 순서로 예측 움직임 벡터 후보 리스트에 추가될 수 있다.Motion information (i.e., predicted motion vector candidate) may be added to the predicted motion vector candidate list in the order of steps 1) to 3) below.

단계 1) 공간적 후보들 중 가용한 공간적 후보들이 예측 움직임 벡터 후보 리스트에 추가될 수 있다. 공간적 후보들은 제1 공간적 후보 및 제2 공간적 후보를 포함할 수 있다. Step 1) Available spatial candidates among spatial candidates may be added to the predicted motion vector candidate list. Spatial candidates may include a first spatial candidate and a second spatial candidate.

제1 공간적 후보는 A0, A1, 스케일된(scaled) A0 및 스케일된 A1 중 하나일 수 있다. 제2 공간적 후보는 B0, B1, B2, 스케일된 B0, 스케일된 B1 및 스케일된 B2 중 하나일 수 있다.The first spatial candidate may be one of A 0 , A 1 , scaled A 0 and scaled A 1 . The second spatial candidate may be one of B 0 , B 1 , B 2 , scaled B 0 , scaled B 1 and scaled B 2 .

가용한 공간적 후보들의 움직임 정보들은 제1 공간적 후보 및 제2 공간적 후보의 순서로 예측 움직임 벡터 후보 리스트에 추가될 수 있다. 이 때, 가용한 공간적 후보의 움직임 정보가 이미 예측 움직임 벡터 후보 리스트 내에 존재하는 다른 움직임 정보와 중복되는 경우 상기의 움직임 정보는 예측 움직임 벡터 후보 리스트에 추가되지 않을 수 있다. 말하자면, N의 값이 2인 경우, 제2 공간적 후보의 움직임 정보가 제1 공간적 후보의 움직임 정보와 동일하면 제2 공간적 후보의 움직임 정보는 예측 움직임 벡터 후보 리스트에 추가되지 않을 수 있다.Motion information of available spatial candidates may be added to the predicted motion vector candidate list in the order of the first spatial candidate and the second spatial candidate. At this time, if the motion information of the available spatial candidate overlaps with other motion information that already exists in the prediction motion vector candidate list, the motion information may not be added to the prediction motion vector candidate list. In other words, when the value of N is 2, if the motion information of the second spatial candidate is the same as the motion information of the first spatial candidate, the motion information of the second spatial candidate may not be added to the prediction motion vector candidate list.

추가되는 움직임 정보들은 최대 N 개일 수 있다.There may be a maximum of N pieces of added motion information.

단계 2) 예측 움직임 벡터 후보 리스트 내의 움직임 정보들의 개수가 N 보다 더 작고, 시간적 후보가 가용하면, 시간적 후보의 움직임 정보가 예측 움직임 벡터 후보 리스트에 추가될 수 있다. 이 때, 가용한 시간적 후보의 움직임 정보가 이미 예측 움직임 벡터 후보 리스트 내에 존재하는 다른 움직임 정보와 중복되는 경우 상기의 움직임 정보는 예측 움직임 벡터 후보 리스트에 추가되지 않을 수 있다. Step 2) If the number of motion information items in the predicted motion vector candidate list is smaller than N and a temporal candidate is available, the motion information of the temporal candidate may be added to the predicted motion vector candidate list. At this time, if the motion information of the available temporal candidate overlaps with other motion information that already exists in the predicted motion vector candidate list, the motion information may not be added to the predicted motion vector candidate list.

단계 3) 예측 움직임 벡터 후보 리스트 내의 움직임 정보들의 개수가 N 보다 더 작으면, 제로 벡터 움직임 정보가 예측 움직임 벡터 후보 리스트에 추가될 수 있다. Step 3) If the number of motion information pieces in the predicted motion vector candidate list is smaller than N, zero vector motion information may be added to the predicted motion vector candidate list.

제로 벡터 움직임 정보는 하나 이상일 수 있다. 하나 이상의 제로 벡터 움직임 정보들의 참조 픽처 인덱스들은 서로 상이할 수 있다.There may be one or more zero vector motion information. Reference picture indices of one or more pieces of zero vector motion information may be different from each other.

부호화 장치(100) 및/또는 복호화 장치(200)는 참조 픽처 인덱스를 변경하면서 순차적으로 제로 벡터 움직임 정보를 예측 움직임 벡터 후보 리스트에 추가할 수 있다.The encoding device 100 and/or the decoding device 200 may sequentially add zero vector motion information to the prediction motion vector candidate list while changing the reference picture index.

제로 벡터 움직임 정보가 이미 예측 움직임 벡터 후보 리스트 내에 존재하는 다른 움직임 정보와 중복되는 경우 상기의 제로 벡터 움직임 정보는 예측 움직임 벡터 후보 리스트에 추가되지 않을 수 있다.If the zero vector motion information overlaps with other motion information that already exists in the prediction motion vector candidate list, the zero vector motion information may not be added to the prediction motion vector candidate list.

머지 리스트에 대해 전술된 제로 벡터 움직임 정보에 대한 설명은 제로 벡터 움직임 정보에도 적용될 수 있다. 중복되는 설명은 생략된다.The description of the zero vector motion information described above for the merge list can also be applied to the zero vector motion information. Redundant descriptions are omitted.

전술된 단계 1) 내지 단계 3)의 순서는 단지 예시적인 것으로, 단계들 간의 순서는 서로 바뀔 수 있다. 또한, 단계들 중 일부는 기정의된 조건에 따라 생략될 수 있다.The order of steps 1) to 3) described above is merely exemplary, and the order between steps may be changed. Additionally, some of the steps may be omitted depending on predefined conditions.

도 12는 일 예에 따른 변환 및 양자화의 과정을 설명한다.Figure 12 explains the process of conversion and quantization according to an example.

도 12에 도시된 바와 같이 잔차 신호에 변환 및/또는 양자화 과정을 수행하여 양자화된 레벨이 생성될 수 있다.As shown in FIG. 12, a quantized level can be generated by performing a conversion and/or quantization process on the residual signal.

잔차 신호는 원본 블록과 예측 블록 간의 차분으로 생성될 수 있다. 여기에서, 예측 블록은 인트라 예측 또는 인터 예측에 의해 생성된 블록일 수 있다.The residual signal can be generated as the difference between the original block and the prediction block. Here, the prediction block may be a block generated by intra prediction or inter prediction.

잔차 신호는 양자화 과정의 일부인 변환 과정을 통해 주파수 도메인으로 변환될 수 있다.The residual signal can be converted to the frequency domain through a transformation process that is part of the quantization process.

변환을 위해 사용되는 변환 커널은 이산 코사인 변환(Discrete Cosine Transform; DCT) 타입(type) 2 (DCT-II) 등과 같은 다양한 DCT 커널 및 이산 사인 변환(Discrete Sine Transform; DST) 커널을 포함할 수 있다.Transformation kernels used for transformation may include various DCT kernels such as Discrete Cosine Transform (DCT) type 2 (DCT-II) and Discrete Sine Transform (DST) kernels. .

이러한 변환 커널들은 잔차 신호에 대해 분리가능 변환(separable transform) 또는 2차원(2Dimensional; 2D) 비-분리가능 변환(non-separable transform)을 수행할 수 있다. 분리가능 변환은 잔차 신호에 대해 1차원(1Dimensional; 1D) 변환을 수평 방향 및 수직 방향의 각각에 수행하는 변환일 수 있다.These transform kernels can perform a separable transform or a 2Dimensional (2D) non-separable transform on the residual signal. The separable transformation may be a transformation that performs one-dimensional (1D) transformation on the residual signal in each of the horizontal and vertical directions.

1D 변환을 위해 적응적으로 사용되는 DCT 타입 및 DST 타입은 아래의 표 3 및 표 4에서 각각 표시된 것과 같이 DCT-II 외에도 DCT-V, DCT-VIII, DST-I 및 DST-VII를 포함할 수 있다.DCT types and DST types adaptively used for 1D conversion may include DCT-V, DCT-VIII, DST-I, and DST-VII in addition to DCT-II, as shown in Table 3 and Table 4 below, respectively. there is.

[표 3][Table 3]

Figure pat00003
Figure pat00003

[표 4][Table 4]

Figure pat00004
Figure pat00004

표 3 및 표 4에서 표시된 것과 같이, 변환에 사용될 DCT 타입 또는 DST 타입을 유도함에 있어서 변환 세트(transform set)가 사용될 수 있다. 각 변환 세트는 복수의 변환 후보들을 포함할 수 있다. 각 변환 후보는 DCT 타입 또는 DST 타입 등일 수 있다.As shown in Tables 3 and 4, a transform set can be used to derive the DCT type or DST type to be used for transformation. Each transformation set may include multiple transformation candidates. Each transformation candidate may be a DCT type or a DST type.

아래의 표 5는 인트라 예측 모드에 따라 수평 방향에 적용되는 변환 세트 및 수직 방향에 적용되는 변환 세트의 일 예를 나타낸다.Table 5 below shows an example of a transform set applied to the horizontal direction and a transform set applied to the vertical direction according to the intra prediction mode.

[표 5][Table 5]

Figure pat00005
Figure pat00005

표 5에서는, 대상 블록의 인트라 예측 모드에 따라서 잔차 신호의 수평 방향에 적용되는 수직 방향 변환 세트의 번호 및 수평 방향 변환 세트의 번호가 표시되었다.In Table 5, the number of the vertical transformation set and the number of the horizontal transformation set applied to the horizontal direction of the residual signal according to the intra prediction mode of the target block are displayed.

표 5에서 예시된 것과 같이, 대상 블록의 인트라 예측 모드에 따라 수평 방향 및 수직 방향에 적용되는 변환 세트들이 기정의될 수 있다. 부호화 장치(100)는 대상 블록의 인트라 예측 모드에 대응하는 변환 세트에 포함된 변환을 이용하여 잔차 신호에 대한 변환 및 역변환을 수행할 수 있다. 또한, 복호화 장치(200)는 대상 블록의 인트라 예측 모드에 대응하는 변환 세트에 포함된 변환을 이용하여 잔차 신호에 대한 역변환을 수행할 수 있다.As illustrated in Table 5, transformation sets applied to the horizontal and vertical directions may be predefined according to the intra prediction mode of the target block. The encoding device 100 may perform transformation and inverse transformation on the residual signal using the transformation included in the transformation set corresponding to the intra prediction mode of the target block. Additionally, the decoding apparatus 200 may perform inverse transformation on the residual signal using a transformation included in a transformation set corresponding to the intra prediction mode of the target block.

이러한 변환 및 역변환에 있어서, 잔차 신호에 적용되는 변환 세트는 표 3, 표 4 및 표 5에서 예시된 것과 같이 결정될 수 있고, 시그널링되지 않을 수 있다. 변환 지시 정보는 부호화 장치(100)로부터 복호화 장치(200)로 시그널링될 수 있다. 변환 지시 정보는 잔차 신호에 적용되는 변환 세트가 포함하는 복수의 변환 후보들 중 어떤 변환 후보가 사용되는가를 지시하는 정보일 수 있다.For these transformations and inverse transformations, the set of transformations applied to the residual signal may be determined as illustrated in Tables 3, 4, and 5, and may be unsignaled. Transformation instruction information may be signaled from the encoding device 100 to the decoding device 200. Transformation instruction information may be information indicating which transform candidate is used among a plurality of transform candidates included in a transform set applied to the residual signal.

예를 들어, 대상 블록의 크기가 64x64 이하인 경우, 인트라 예측 모드에 따라 각각 3 개의 변환들을 갖는 변환 세트들이 구성될 수 있다. 수평 방향의 3 개의 변환들 및 수직 방향의 3 개의 변환들의 조합으로 인한 모두 9 개의 다중 변환 방법들 중에서 최적의 변환 방법이 선택될 수 있다. 이러한 최적의 변환 방법으로 잔차 신호를 부호화 및/또는 복호화함으로써 부호화 효율이 향상될 수 있다.For example, when the size of the target block is 64x64 or less, transform sets each having three transforms may be configured according to the intra prediction mode. The optimal transformation method can be selected among a total of 9 multiple transformation methods resulting from a combination of three transformations in the horizontal direction and three transformations in the vertical direction. Coding efficiency can be improved by encoding and/or decoding the residual signal using this optimal conversion method.

이 때, 수직 변환 및 수평 변환 중 적어도 하나 이상에 대해, 변환 세트에 속한 변환들 중 어떤 변환이 사용되었는지에 대한 정보가 엔트로피 부호화 및/또는 복호화될 수 있다. 이러한 정보의 부호화 및/또는 복호화를 위해 절삭된 단항(truncated unary) 이진화(binarization)가 사용될 수 있다.At this time, for at least one of the vertical transformation and the horizontal transformation, information about which transformation among the transformations belonging to the transformation set was used may be entropy encoded and/or decoded. Truncated unary binarization may be used to encode and/or decode this information.

전술된 것과 같이 다양한 변환들을 사용하는 방법은 인트라 예측 또는 인터 예측에 의해 생성된 잔차 신호에 적용될 수 있다.The method using various transforms as described above can be applied to a residual signal generated by intra prediction or inter prediction.

변환은 1차 변환 및 2차 변환 중 적어도 하나를 포함할 수 있다. 잔차 신호에 대해서 1차 변환을 수행함으로써 변환 계수가 생성될 수 있고, 변환 계수에 2차 변환을 수행함으로써 2차 변환 계수가 생성될 수 있다.Transformation may include at least one of primary transformation and secondary transformation. A transform coefficient can be generated by performing a first-order transform on the residual signal, and a second-order transform coefficient can be generated by performing a second-order transform on the transform coefficient.

1차 변환은 주 변환(primary)으로 명명될 수 있다. 또한, 1차 변환은 적응적 다중 변환(Adaptive Multiple Transform; AMT)로 명명될 수 있다. AMT는 전술된 것과 같이 1D 방향들(즉, 수직 방향 및 수평 방향)의 각각에 대해 서로 다른 변환이 적용되는 것을 의미할 수 있다.A primary transformation may be named primary. Additionally, the first-order transform may be named Adaptive Multiple Transform (AMT). AMT may mean that different transformations are applied to each of the 1D directions (i.e., vertical and horizontal directions) as described above.

2차 변환은 1차 변환에 의해 생성된 변환 계수의 에너지 집중도를 향상시키기 위한 변환일 수 있다. 2차 변환도 1차 변환과 마찬가지로 분리가능 변환 또는 비-분리가능 변환일 수 있다. 비-분리가능 변환은 비-분리가능 2차 변환(Non-Separable Secondary Transform; NSST)일 수 있다.The secondary transformation may be a transformation to improve the energy concentration of the transformation coefficient generated by the primary transformation. Secondary transformations, like primary transformations, can be either separable transformations or non-separable transformations. The non-separable transform may be a Non-Separable Secondary Transform (NSST).

1차 변환은 기정의된 복수의 변환 방법들 중 적어도 하나를 이용하여 수행될 수 있다. 일 예로, 기정의된 복수의 변환 방법들은 이산 코사인 변환(Discrete Cosine Transform; DCT), 이산 사인 변환(Discrete Sine Transform; DST) 및 카루넨-루베 변환(Karhunen-Loeve Transform; KLT) 기반 변환 등을 포함할 수 있다.Primary transformation may be performed using at least one of a plurality of predefined transformation methods. For example, a plurality of predefined transformation methods include Discrete Cosine Transform (DCT), Discrete Sine Transform (DST), and Karhunen-Loeve Transform (KLT)-based transformation, etc. It can be included.

또한, 1차 변환은 DCT 또는 DST를 정의하는 커널 함수에 따라서 다양한 변환 타입을 갖는 변환일 수 있다.Additionally, the first-order transformation may be a transformation with various transformation types depending on the kernel function that defines DCT or DST.

예를 들면, 변환 타입은 1) 대상 블록의 예측 모드(예를 들면, 인트라 예측 및 인터 예측 중 하나), 2) 대상 블록의 크기, 3) 대상 블록의 형태, 4) 대상 블록의 인트라 예측 모드, 5) 대상 블록의 성분(예를 들면, 루마 성분 및 크로마 성분 중 하나) 및 6) 대상 블록에 적용된 분할 타입(예를 들면, 쿼드 트리(Quad Tree: QT), 이진 트리(Binary Tree; BT) 및 삼진 트리(Ternary Tree; TT) 중 하나) 중 적어도 하나에 기반하여 결정될 수 있다.For example, the transformation type is 1) prediction mode of the target block (e.g., one of intra prediction and inter prediction), 2) size of the target block, 3) shape of the target block, 4) intra prediction mode of the target block. , 5) a component of the target block (e.g., one of the luma component and a chroma component), and 6) the partition type applied to the target block (e.g., Quad Tree (QT), Binary Tree (BT) ) and one of a Ternary Tree (TT).

예를 들면, 1차 변환은 아래의 표 6에서 제시된 변환 커널에 따른 DCT-2, DCT-5, DCT-7, DST-7, DST-1, DST-8 및 DCT-8과 같은 변환들을 포함할 수 있다. 표 6에서는 복수 변환 선택(Multiple Transform Selection; MTS)에 대한 다양한 변환 타입들 및 변환 커널 함수들이 예시되었다.For example, the first-order transformation includes transformations such as DCT-2, DCT-5, DCT-7, DST-7, DST-1, DST-8, and DCT-8 according to the transformation kernels shown in Table 6 below. can do. Table 6 illustrates various transform types and transform kernel functions for multiple transform selection (MTS).

MTS는 잔차 신호의 수평 및/또는 수직방향에 대한 변환을 위해 하나 이상의 DCT 및/또는 DST 변환 커널의 조합이 선택되는 것을 의미할 수 있다.MTS may mean that a combination of one or more DCT and/or DST transformation kernels is selected to transform the residual signal in the horizontal and/or vertical directions.

[표 6][Table 6]

Figure pat00006
Figure pat00006

표 6에서, i 및 j는 0 이상 N-1 이하의 정수 값일 수 있다.In Table 6, i and j may be integer values between 0 and N-1.

1차 변환의 수행에 의해 생성된 변환 계수에 2차 변환(secondary transform)이 수행될 수 있다.A secondary transform may be performed on the transformation coefficient generated by performing the primary transformation.

1차 변환에서와 같이, 2차 변환에서도 변환 세트가 정의될 수 있다. 전술된 것과 같은 변환 세트를 유도 및/또는 결정하기 위한 방법들은 1차 변환뿐만 아니라 2차 변환에도 적용될 수 있다.As with first-order transformations, a set of transformations can be defined for second-order transformations. Methods for deriving and/or determining a set of transformations such as those described above can be applied to secondary transformations as well as primary transformations.

1차 변환 및 2차 변환은 특정된 대상에 대해서 결정될 수 있다.Primary transformation and secondary transformation can be determined for a specified target.

예를 들면, 1차 변환 및 2차 변환은 루마 성분 및 크로마 성분 중 하나 이상의 신호 성분에 적용될 수 있다. 1차 변환 및/또는 2차 변환의 적용 여부는 대상 블록 및/또는 이웃 블록에 대한 코딩 파라미터들 중 적어도 하나에 따라 결정될 수 있다. 예를 들면, 1차 변환 및/또는 2차 변환의 적용 여부는 대상 블록의 크기 및/또는 형태에 의해 결정될 수 있다.For example, a first-order transform and a second-order transform may be applied to one or more signal components of a luma component and a chroma component. Whether to apply the first transform and/or the second transform may be determined according to at least one of coding parameters for the target block and/or the neighboring block. For example, whether to apply primary transformation and/or secondary transformation may be determined by the size and/or shape of the target block.

부호화 장치(100) 및 복호화 장치(200)에서, 대상에게 사용되는 변환 방법을 지시하는 변환 정보는 특정된 정보를 사용함으로써 유도될 수 있다.In the encoding device 100 and the decoding device 200, conversion information indicating the conversion method to be used for the target can be derived by using specified information.

예를 들면, 변환 정보는 1차 변환 및/또는 2차 변환을 위해 사용될 변환의 인덱스를 포함할 수 있다. 또는, 변환 정보는 1차 변환 및/또는 2차 변환이 사용되지 않음을 나타낼 수도 있다.For example, the transformation information may include an index of the transformation to be used for primary transformation and/or secondary transformation. Alternatively, the transformation information may indicate that the primary transformation and/or secondary transformation is not used.

예를 들면, 1차 변환 및 2차 변환의 대상이 대상 블록일 때, 변환 정보가 지시하는 1차 변환 및/또는 2차 변환에 적용되는 변환 방법(들)은 대상 블록 및/또는 이웃 블록에 대한 코딩 파라미터들 중 적어도 하나에 따라 결정될 수 있다.For example, when the target of the primary transformation and secondary transformation is the target block, the transformation method(s) applied to the primary transformation and/or secondary transformation indicated by the transformation information is applied to the target block and/or neighboring blocks. It may be determined according to at least one of the coding parameters for.

또는, 특정된 대상에 대한 변환 방법을 지시하는 변환 정보는 부호화 장치(100)로부터 복호화 장치(200)로 시그널링될 수도 있다.Alternatively, conversion information indicating a conversion method for a specified target may be signaled from the encoding device 100 to the decoding device 200.

예를 들면, 하나의 CU에 대하여 1차 변환의 사용 여부, 1차 변환을 가리키는 인덱스, 2차 변환의 사용 여부 및 2차 변환을 가리키는 인덱스 등이 복호화 장치(200)에서 변환 정보로서 유도될 수 있다. 또는, 하나의 CU에 대하여 1차 변환의 사용 여부, 1차 변환을 가리키는 인덱스, 2차 변환의 사용 여부 및 2차 변환을 가리키는 인덱스 등을 나타내는 변환 정보가 시그널링될 수 있다.For example, for one CU, whether the primary transform is used, an index indicating the primary transform, whether the secondary transform is used, and an index indicating the secondary transform, etc. can be derived as transformation information in the decoding device 200. there is. Alternatively, for one CU, transformation information indicating whether to use the primary transformation, an index indicating the primary transformation, whether to use the secondary transformation, and an index indicating the secondary transformation may be signaled.

1차 변환 및/또는 2차 변환의 수행에 의해 생성된 결과 또는 잔차 신호에 양자화를 수행함으로써 양자화된 변환 계수(즉, 양자화된 레벨)이 생성될 수 있다.A quantized transform coefficient (i.e., a quantized level) may be generated by performing quantization on a result or a residual signal generated by performing a first-order transform and/or a second-order transform.

도 13은 일 예에 따른 대각선 스캐닝을 나타낸다.13 shows diagonal scanning according to an example.

도 14는 일 예에 따른 수평 스캐닝을 나타낸다.14 shows horizontal scanning according to an example.

도 15는 일 예에 따른 수직 스캐닝을 나타낸다.15 shows vertical scanning according to one example.

양자화된 변환 계수들은 인트라 예측 모드, 블록 크기 및 블록 형태 중 적어도 하나에 따라서, (우상단(up-right)) 대각선 스캐닝, 수직 스캐닝 및 수평 스캐닝 중 적어도 하나에 따라서 스캐닝(scanning) 될 수 있다. 블록은 변환 유닛일 수 있다.The quantized transform coefficients may be scanned according to at least one of (up-right) diagonal scanning, vertical scanning, and horizontal scanning, according to at least one of intra prediction mode, block size, and block type. A block may be a transformation unit.

각 스캐닝은 특정된 시작 점에서 시작할 수 있고 특정된 종료 점에서 종료될 수 있다.Each scanning can start at a specified starting point and end at a specified ending point.

예를 들면, 도 13의 대각선 스캐닝을 이용하여 블록의 계수들을 스캔함으로써 양자화된 변환 계수들이 1차원 벡터 형태로 변경될 수 있다. 또는, 블록의 크기 및/또는 인트라 예측 모드에 따라 대각선 스캐닝 대신 도 14의 수평 스캐닝이나, 도 15의 수직 스캐닝이 사용될 수 있다.For example, by scanning the coefficients of a block using the diagonal scanning of FIG. 13, the quantized transform coefficients can be changed into a one-dimensional vector form. Alternatively, the horizontal scanning of FIG. 14 or the vertical scanning of FIG. 15 may be used instead of diagonal scanning, depending on the size of the block and/or the intra prediction mode.

수직 스캐닝은 2차원의 블록 형태 계수를 열 방향으로 스캔하는 것일 수 있다. 수평 스캐닝은 2차원의 블록 형태 계수를 행 방향으로 스캔하는 것일 수 있다.Vertical scanning may be scanning two-dimensional block-shaped coefficients in a column direction. Horizontal scanning may be scanning two-dimensional block-shaped coefficients in the row direction.

말하자면, 블록의 크기 및/또는 인터 예측 모드에 따라 대각선 스캐닝, 수직 스캐닝 및 수평 스캐닝 중 어떤 스캐닝이 사용될 것인지가 결정될 수 있다.That is, depending on the size of the block and/or the inter prediction mode, it may be determined which scanning among diagonal scanning, vertical scanning, and horizontal scanning will be used.

도 13, 도 14 및 도 15에서 도시된 것과 같이, 양자화된 변환 계수들은 대각선 방향, 수평 방향 또는 수직 방향에 따라 스캔될 수 있다.As shown in FIGS. 13, 14, and 15, the quantized transform coefficients can be scanned along the diagonal, horizontal, or vertical directions.

양자화된 변환 계수들은 블록 형태로 표현될 수 있다. 블록은 복수의 서브 블록들을 포함할 수 있다. 각 서브 블록은 최소 블록 크기 또는 최소 블록 형태에 따라 정의될 수 있다.Quantized transform coefficients can be expressed in block form. A block may include multiple sub-blocks. Each subblock can be defined according to the minimum block size or minimum block type.

스캐닝에 있어서, 스캐닝의 타입 또는 방향에 따른 스캐닝 순서는 우선 서브 블록들에 적용될 수 있다. 또한, 서브 블록 내의 양자화된 변환 계수들에 대해 스캐닝의 방향에 따른 스캐닝 순서가 적용될 수 있다.In scanning, the scanning order according to the type or direction of scanning can first be applied to sub-blocks. Additionally, a scanning order according to the direction of scanning may be applied to the quantized transform coefficients within the sub-block.

예를 들면, 도 13, 도 14 및 도 15에서 도시된 것과 같이, 대상 블록의 크기가 8x8일 때, 대상 블록의 잔차 신호에 대한 1차 변환, 2차 변환 및 양자화에 의해 양자화된 변환 계수들이 생성될 수 있다. 이후, 4 개의 4x4 서브 블록들에 대해 3 가지의 스캐닝 순서들 중 하나의 스캐닝 순서가 적용될 수 있으며, 각 4x4 서브 블록에 대해서도 스캐닝 순서에 따라 양자화된 변환 계수들이 스캔될 수 있다.For example, as shown in FIGS. 13, 14, and 15, when the size of the target block is 8x8, the transform coefficients quantized by the first transform, second transform, and quantization of the residual signal of the target block are can be created. Thereafter, one of three scanning orders may be applied to the four 4x4 sub-blocks, and quantized transform coefficients may be scanned for each 4x4 sub-block according to the scanning order.

부호화 장치(100)는 스캔된 양자화된 변환 계수들에 대한 엔트로피 부호화를 수행함으로써 엔트로피 부호화된 양자화된 변환 계수를 생성할 수 있고, 엔트로피 부호화된 양자화된 변환 계수들을 포함하는 비트스트림을 생성할 수 있다.The encoding device 100 can generate entropy-encoded quantized transform coefficients by performing entropy encoding on the scanned quantized transform coefficients, and can generate a bitstream including the entropy-encoded quantized transform coefficients. .

복호화 장치(200)는 비트스트림으로부터 엔트로피 부호화된 양자화된 변환 계수들을 추출할 수 있고, 엔트로피 부호화된 양자화된 변환 계수들에 대한 엔트로피 복호화를 수행함으로써 양자화된 변환 계수들을 생성할 수 있다. 양자화된 변환 계수들은 역 스캐닝(inverse scanning)을 통해 2차원의 블록 형태로 정렬될 수 있다. 이때, 역 스캐닝의 방법으로서, (우상단) 대각 스캔, 수직 스캔 및 수평 스캔 중 적어도 하나가 수행될 수 있다.The decoding device 200 can extract entropy-encoded quantized transform coefficients from a bitstream and generate quantized transform coefficients by performing entropy decoding on the entropy-encoded quantized transform coefficients. Quantized transformation coefficients can be arranged in a two-dimensional block form through inverse scanning. At this time, as a reverse scanning method, at least one of (upper right) diagonal scan, vertical scan, and horizontal scan may be performed.

복호화 장치(200)에서는, 양자화된 변환 계수들에 역양자화가 수행될 수 있다. 2차 역변환의 수행 여부에 따라서, 역양자화의 수행에 의해 생성된 결과에 대하여 2차 역변환이 수행될 수 있다. 또한, 1차 역변환의 수행 여부에 따라서, 2차 역변환의 수행에 의해 생성된 결과에 대하여 1차 역변환이 수행될 수 있다. 2차 역변환의 수행에 의해 생성된 결과에 대하여 1차 역변환을 수행함으로써 재구축된 잔차 신호가 생성될 수 있다.In the decoding device 200, dequantization may be performed on the quantized transform coefficients. Depending on whether the secondary inverse transformation is performed, the secondary inverse transformation may be performed on the result generated by performing the inverse quantization. Additionally, depending on whether the first inversion is performed, the first inversion may be performed on the result generated by performing the second inversion. A reconstructed residual signal can be generated by performing a first-order inversion on the result generated by performing a second-order inversion.

인트라 예측 또는 인터 예측을 통해 재구축된 루마 성분에 대해, 인-루프(in-loop) 필터링 전에 동적 범위(dynamic range)의 역매핑(inverse mapping)이 수행될 수 있다.For luma components reconstructed through intra prediction or inter prediction, inverse mapping of the dynamic range may be performed before in-loop filtering.

동적 범위는 16 개의 균등한 조각(piece)들로 분할될 수 있고, 각 조각에 대한 매핑 함수가 시그널링될 수 있다. 매핑 함수는 슬라이스 레벨 또는 타일 그룹 레벨에서 시그널링될 수 있다.The dynamic range can be divided into 16 equal pieces, and a mapping function for each piece can be signaled. The mapping function can be signaled at the slice level or tile group level.

역매핑을 수행하기 위한 역매핑 함수는 매핑 함수에 기초하여 유도될 수 있다.A reverse mapping function for performing reverse mapping may be derived based on the mapping function.

인-루프 필터링, 참조 픽처의 저장 및 움직임 보상은 역매핑된 영역에서 수행될 수 있다.In-loop filtering, storage of reference pictures, and motion compensation can be performed in the demapped region.

인터 예측을 통해 생성된 예측 블록은 매핑 함수를 이용한 매핑에 의해 매핑된 영역으로 전환될 수 있고, 전환된 예측 블록이 재구축된 블록의 생성에 이용될 수 있다. 그러나, 인트라 예측은 매핑된 영역에서 수행되므로, 인트라 예측에 의해 생성된 예측 블록은 매핑 및/또는 역매핑 없이, 재구축된 블록의 생성에 이용될 수 있다.A prediction block generated through inter prediction can be converted into a mapped area by mapping using a mapping function, and the converted prediction block can be used to generate a reconstructed block. However, since intra prediction is performed in a mapped region, the prediction block generated by intra prediction can be used to generate a reconstructed block without mapping and/or demapping.

예를 들면, 대상 블록이 크로마 성분의 잔차 블록인 경우, 매핑된 영역의 크로마 성분에 대해 스케일링을 수행함으로써 잔차 블록이 역매핑된 영역으로 전환될 수 있다.For example, if the target block is a residual block of a chroma component, the residual block can be converted to a demapped region by performing scaling on the chroma component of the mapped area.

스케일링이 가용한지 여부는 슬라이스 레벨 또는 타일 그룹 레벨에서 시그널링될 수 있다.Whether scaling is available can be signaled at the slice level or tile group level.

예를 들면, 스케일링은 루마 성분에 대한 매핑이 가용하고, 루마 성분의 분할 및 크로마 성분의 분할이 동일한 트리 구조를 따르는 경우에만 적용될 수 있다.For example, scaling can only be applied if mapping for the luma component is available and the splitting of the luma component and the splitting of the chroma component follow the same tree structure.

스케일링은 크로마 예측 블록에 대응하는 루마 예측 블록의 샘플들의 값들의 평균에 기초하여 수행될 수 있다. 이 때, 대상 블록이 인터 예측을 사용하는 경우, 루마 예측 블록은 매핑된 루마 예측 블록을 의미할 수 있다. Scaling may be performed based on the average of the values of samples of the luma prediction block corresponding to the chroma prediction block. At this time, if the target block uses inter prediction, the luma prediction block may mean a mapped luma prediction block.

루마 예측 블록의 샘플들의 값의 평균이 속하는 조각(piece)의 인덱스를 이용하여 룩-업 테이블을 참조함으로써, 스케일링에 필요한 값이 유도될 수 있다. The value required for scaling can be derived by referring to the look-up table using the index of the piece to which the average value of the samples of the luma prediction block belongs.

최종적으로 유도된 값을 이용하여 잔차 블록에 대한 스케일링을 수행함으로써, 잔차 블록은 역매핑된 영역으로 전환될 수 있다. 이후, 크로마 성분 블록에 대하여, 재구축, 인트라 예측, 인터 예측, 인-루프 필터링 및 참조 픽처의 저장은 역매핑된 영역에서 수행될 수 있다. By performing scaling on the residual block using the finally derived value, the residual block can be converted into a demapped area. Thereafter, for the chroma component block, reconstruction, intra prediction, inter prediction, in-loop filtering, and storage of the reference picture can be performed in the demapped region.

예를 들면, 이러한 루마 성분 및 크로마 성분의 매핑 및/또는 역매핑이 가용한지 여부를 나타내는 정보는 시퀀스 파라미터 셋을 통해 시그널링될 수 있다.For example, information indicating whether mapping and/or de-mapping of such luma components and chroma components is available may be signaled through a sequence parameter set.

대상 블록의 예측 블록은 블록 벡터에 기초하여 생성될 수 있다. 블록 벡터는 대상 블록 및 참조 블록 간의 위치 이동(displacement)을 나타낼 수 있다. 참조 블록은 대상 영상 내의 블록일 수 있다.The prediction block of the target block may be generated based on the block vector. A block vector may indicate displacement between a target block and a reference block. The reference block may be a block in the target image.

이와 같이, 대상 영상을 참조하여 예측 블록을 생성하는 예측 모드를 인트라 블록 카피(Intra Block Copy; IBC) 모드라고 칭할 수 있다.In this way, the prediction mode that generates a prediction block with reference to the target image may be called an intra block copy (IBC) mode.

IBC 모드는 특정된 크기의 CU에 적용될 수 있다. 예를 들면, IBC 모드는 MxN CU에 적용될 수 있다. 여기에서, M 및 N은 64의 이하일 수 있다.IBC mode can be applied to CUs of a specified size. For example, IBC mode can be applied to MxN CU. Here, M and N may be less than or equal to 64.

IBC 모드는 스킵 모드, 머지 모드 및 AMVP 모드 등을 포함할 수 있다. 스킵 모드 또는 머지 모드의 경우, 머지 후보 리스트가 구성될 수 있고, 머지 인덱스가 시그널링됨으로써 머지 후보 리스트의 머지 후보들 중에서 하나의 머지 후보가 특정될 수 있다. 특정된 머지 후보의 블록 벡터가 대상 블록의 블록 벡터로서 이용될 수 있다.IBC mode may include skip mode, merge mode, and AMVP mode. In the case of skip mode or merge mode, a merge candidate list may be constructed, and a merge index may be signaled, thereby specifying one merge candidate among the merge candidates in the merge candidate list. The block vector of the specified merge candidate can be used as the block vector of the target block.

AMVP 모드의 경우, 차분 블록 벡터가 시그널링될 수 있다. 또한, 예측 블록 벡터는 대상 블록의 좌측 이웃 블록 및 상단 이웃 블록으로부터 유도될 수 있다. 또한, 어느 이웃 블록이 사용될지에 관한 인덱스가 시그널링될 수 있다.For AMVP mode, differential block vectors can be signaled. Additionally, the prediction block vector may be derived from the left neighboring block and the top neighboring block of the target block. Additionally, an index regarding which neighboring block will be used may be signaled.

IBC 모드의 예측 블록은 대상 CTU 또는 좌측 CTU에 포함될 수 있고, 기 재구축된 영역내의 블록으로 한정될 수 있다. 예를 들면, 블록 벡터의 값은 대상 블록의 예측 블록이 특정된 영역 내에 위치하도록 제한될 수 있다. 특정된 영역은 대상 블록이 포함된 64x64 블록보다 먼저 부호화 및/또는 복호화되는 3 개의 64x64 블록들의 영역일 수 있다. 이와 같이 블록 벡터의 값이 제한됨으로써, IBC 모드의 구현에 따른 메모리 소비 및 장치의 복잡도가 경감될 수 있다.The prediction block in IBC mode may be included in the target CTU or the left CTU, and may be limited to blocks within the previously reconstructed area. For example, the value of the block vector may be limited so that the prediction block of the target block is located within a specified area. The specified area may be an area of three 64x64 blocks that are encoded and/or decoded before the 64x64 block containing the target block. By limiting the value of the block vector in this way, memory consumption and device complexity according to the implementation of IBC mode can be reduced.

도 16은 일 실시예에 따른 부호화 장치의 구조도이다.Figure 16 is a structural diagram of an encoding device according to an embodiment.

부호화 장치(1600)는 전술된 부호화 장치(100)에 대응할 수 있다.The encoding device 1600 may correspond to the encoding device 100 described above.

부호화 장치(1600)는 버스(1690)를 통하여 서로 통신하는 처리부(1610), 메모리(1630), 사용자 인터페이스(User Interface; UI) 입력 디바이스(1650), UI 출력 디바이스(1660) 및 저장소(storage)(1640)를 포함할 수 있다. 또한, 부호화 장치(1600)는 네트워크(1699)에 연결되는 통신부(1620)를 더 포함할 수 있다.The encoding device 1600 includes a processing unit 1610, a memory 1630, a user interface (UI) input device 1650, a UI output device 1660, and storage that communicate with each other through a bus 1690. (1640) may be included. Additionally, the encoding device 1600 may further include a communication unit 1620 connected to the network 1699.

처리부(1610)는 중앙 처리 장치(Central Processing Unit; CPU), 메모리(1630) 또는 저장소(1640)에 저장된 프로세싱(processing) 명령어(instruction)들을 실행하는 반도체 장치일 수 있다. 처리부(1610)는 적어도 하나의 하드웨어 프로세서일 수 있다.The processing unit 1610 may be a semiconductor device that executes processing instructions stored in a central processing unit (CPU), memory 1630, or storage 1640. The processing unit 1610 may be at least one hardware processor.

처리부(1610)는 부호화 장치(1600)로 입력되거나, 부호화 장치(1600)에서 출력되거나, 부호화 장치(1600)의 내부에서 사용되는 신호, 데이터 또는 정보의 생성 및 처리를 수행할 수 있고, 신호, 데이터 또는 정보에 관련된 검사, 비교 및 판단 등을 수행할 수 있다. 말하자면, 실시예에서 데이터 또는 정보의 생성 및 처리와, 데이터 또는 정보에 관련된 검사, 비교 및 판단은 처리부(1610)에 의해 수행될 수 있다.The processing unit 1610 may generate and process signals, data, or information that are input to the encoding device 1600, output from the encoding device 1600, or used inside the encoding device 1600. Inspection, comparison, and judgment related to data or information can be performed. That is, in an embodiment, generation and processing of data or information, and inspection, comparison, and judgment related to the data or information may be performed by the processing unit 1610.

처리부(1610)는 인터 예측부(110), 인트라 예측부(120), 스위치(115), 감산기(125), 변환부(130), 양자화부(140), 엔트로피 부호화부(150), 역양자화부(160), 역변환부(170), 가산기(175), 필터부(180) 및 참조 픽처 버퍼(190)를 포함할 수 있다.The processing unit 1610 includes an inter prediction unit 110, an intra prediction unit 120, a switch 115, a subtractor 125, a transform unit 130, a quantization unit 140, an entropy encoding unit 150, and an inverse quantization unit. It may include a unit 160, an inverse transform unit 170, an adder 175, a filter unit 180, and a reference picture buffer 190.

인터 예측부(110), 인트라 예측부(120), 스위치(115), 감산기(125), 변환부(130), 양자화부(140), 엔트로피 부호화부(150), 역양자화부(160), 역변환부(170), 가산기(175), 필터부(180) 및 참조 픽처 버퍼(190) 중 적어도 일부는 프로그램 모듈들일 수 있으며, 외부의 장치 또는 시스템과 통신할 수 있다. 프로그램 모듈들은 운영 체제, 응용 프로그램 모듈 및 기타 프로그램 모듈의 형태로 부호화 장치(1600)에 포함될 수 있다.Inter prediction unit 110, intra prediction unit 120, switch 115, subtractor 125, transform unit 130, quantization unit 140, entropy encoding unit 150, inverse quantization unit 160, At least some of the inverse transform unit 170, the adder 175, the filter unit 180, and the reference picture buffer 190 may be program modules and may communicate with an external device or system. Program modules may be included in the encoding device 1600 in the form of an operating system, application program module, and other program modules.

프로그램 모듈들은 물리적으로는 여러 가지 공지의 기억 장치 상에 저장될 수 있다. 또한, 이러한 프로그램 모듈 중 적어도 일부는 부호화 장치(1600)와 통신 가능한 원격 기억 장치에 저장될 수도 있다.Program modules may be physically stored on various known storage devices. Additionally, at least some of these program modules may be stored in a remote memory device capable of communicating with the encoding device 1600.

프로그램 모듈들은 일 실시예에 따른 기능 또는 동작을 수행하거나, 일 실시예에 따른 추상 데이터 유형을 구현하는 루틴(routine), 서브루틴(subroutine), 프로그램, 오브젝트(object), 컴포넌트(component) 및 데이터 구조(data structure) 등을 포괄할 수 있지만, 이에 제한되지는 않는다.Program modules are routines, subroutines, programs, objects, components, and data that perform a function or operation according to an embodiment or implement an abstract data type according to an embodiment. It may include data structures, etc., but is not limited thereto.

프로그램 모듈들은 부호화 장치(1600)의 적어도 하나의 프로세서(processor)에 의해 수행되는 명령어(instruction) 또는 코드(code)로 구성될 수 있다.Program modules may be composed of instructions or codes that are executed by at least one processor of the encoding device 1600.

처리부(1610)는 인터 예측부(110), 인트라 예측부(120), 스위치(115), 감산기(125), 변환부(130), 양자화부(140), 엔트로피 부호화부(150), 역양자화부(160), 역변환부(170), 가산기(175), 필터부(180) 및 참조 픽처 버퍼(190)의 명령어 또는 코드를 실행할 수 있다.The processing unit 1610 includes an inter prediction unit 110, an intra prediction unit 120, a switch 115, a subtractor 125, a transform unit 130, a quantization unit 140, an entropy encoding unit 150, and an inverse quantization unit. Commands or codes of the unit 160, the inverse transform unit 170, the adder 175, the filter unit 180, and the reference picture buffer 190 can be executed.

저장부는 메모리(1630) 및/또는 저장소(1640)를 나타낼 수 있다. 메모리(1630) 및 저장소(1640)는 다양한 형태의 휘발성 또는 비휘발성 저장 매체일 수 있다. 예를 들면, 메모리(1630)는 롬(ROM)(1631) 및 램(RAM)(1632) 중 적어도 하나를 포함할 수 있다.The storage unit may represent memory 1630 and/or storage 1640. Memory 1630 and storage 1640 may be various types of volatile or non-volatile storage media. For example, the memory 1630 may include at least one of ROM 1631 and RAM 1632.

저장부는 부호화 장치(1600)의 동작을 위해 사용되는 데이터 또는 정보를 저장할 수 있다. 실시예에서, 부호화 장치(1600)가 갖는 데이터 또는 정보는 저장부 내에 저장될 수 있다.The storage unit may store data or information used for the operation of the encoding device 1600. In an embodiment, data or information held by the encoding device 1600 may be stored in the storage unit.

예를 들면, 저장부는 픽처, 블록, 리스트, 움직임 정보, 인터 예측 정보 및 비트스트림 등을 저장할 수 있다.For example, the storage unit can store pictures, blocks, lists, motion information, inter prediction information, and bitstreams.

부호화 장치(1600)는 컴퓨터에 의해 독출(read)될 수 있는 기록 매체를 포함하는 컴퓨터 시스템에서 구현될 수 있다.The encoding device 1600 may be implemented in a computer system that includes a recording medium that can be read by a computer.

기록 매체는 부호화 장치(1600)가 동작하기 위해 요구되는 적어도 하나의 모듈을 저장할 수 있다. 메모리(1630)는 적어도 하나의 모듈을 저장할 수 있고, 적어도 하나의 모듈이 처리부(1610)에 의하여 실행되도록 구성될 수 있다.The recording medium may store at least one module required for the encoding device 1600 to operate. The memory 1630 may store at least one module, and the at least one module may be configured to be executed by the processing unit 1610.

부호화 장치(1600)의 데이터 또는 정보의 통신과 관련된 기능은 통신부(1620)를 통해 수행될 수 있다.Functions related to communication of data or information of the encoding device 1600 may be performed through the communication unit 1620.

예를 들면, 통신부(1620)는 비트스트림을 후술될 복호화 장치(1700)로 전송할 수 있다.For example, the communication unit 1620 may transmit a bitstream to the decoding device 1700, which will be described later.

도 17은 일 실시예에 따른 복호화 장치의 구조도이다.Figure 17 is a structural diagram of a decoding device according to an embodiment.

복호화 장치(1700)는 전술된 복호화 장치(200)에 대응할 수 있다.The decoding device 1700 may correspond to the decoding device 200 described above.

복호화 장치(1700)는 버스(1790)를 통하여 서로 통신하는 처리부(1710), 메모리(1730), 사용자 인터페이스(User Interface; UI) 입력 디바이스(1750), UI 출력 디바이스(1760) 및 저장소(storage)(1740)를 포함할 수 있다. 또한, 복호화 장치(1700)는 네트워크(1799)에 연결되는 통신부(1720)를 더 포함할 수 있다.The decryption device 1700 includes a processing unit 1710, a memory 1730, a user interface (UI) input device 1750, a UI output device 1760, and storage that communicate with each other through a bus 1790. (1740). Additionally, the decryption device 1700 may further include a communication unit 1720 connected to the network 1799.

처리부(1710)는 중앙 처리 장치(Central Processing Unit; CPU), 메모리(1730) 또는 저장소(1740)에 저장된 프로세싱(processing) 명령어(instruction)들을 실행하는 반도체 장치일 수 있다. 처리부(1710)는 적어도 하나의 하드웨어 프로세서일 수 있다.The processing unit 1710 may be a semiconductor device that executes processing instructions stored in a central processing unit (CPU), memory 1730, or storage 1740. The processing unit 1710 may be at least one hardware processor.

처리부(1710)는 복호화 장치(1700)로 입력되거나, 복호화 장치(1700)에서 출력되거나, 복호화 장치(1700)의 내부에서 사용되는 신호, 데이터 또는 정보의 생성 및 처리를 수행할 수 있고, 신호, 데이터 또는 정보에 관련된 검사, 비교 및 판단 등을 수행할 수 있다. 말하자면, 실시예에서 데이터 또는 정보의 생성 및 처리와, 데이터 또는 정보에 관련된 검사, 비교 및 판단은 처리부(1710)에 의해 수행될 수 있다.The processing unit 1710 may generate and process signals, data, or information that are input to the decoding device 1700, output from the decoding device 1700, or used inside the decoding device 1700. Inspection, comparison, and judgment related to data or information can be performed. That is, in an embodiment, generation and processing of data or information, and inspection, comparison, and judgment related to the data or information may be performed by the processing unit 1710.

처리부(1710)는 엔트로피 복호화부(210), 역양자화부(220), 역변환부(230), 인트라 예측부(240), 인터 예측부(250), 스위치(245), 가산기(255), 필터부(260) 및 참조 픽처 버퍼(270)를 포함할 수 있다.The processing unit 1710 includes an entropy decoding unit 210, an inverse quantization unit 220, an inverse transform unit 230, an intra prediction unit 240, an inter prediction unit 250, a switch 245, an adder 255, and a filter. It may include a unit 260 and a reference picture buffer 270.

엔트로피 복호화부(210), 역양자화부(220), 역변환부(230), 인트라 예측부(240), 인터 예측부(250), 스위치(245), 가산기(255), 필터부(260) 및 참조 픽처 버퍼(270) 중 적어도 일부는 프로그램 모듈들일 수 있으며, 외부의 장치 또는 시스템과 통신할 수 있다. 프로그램 모듈들은 운영 체제, 응용 프로그램 모듈 및 기타 프로그램 모듈의 형태로 복호화 장치(1700)에 포함될 수 있다.Entropy decoding unit 210, inverse quantization unit 220, inverse transform unit 230, intra prediction unit 240, inter prediction unit 250, switch 245, adder 255, filter unit 260, and At least some of the reference picture buffers 270 may be program modules and may communicate with an external device or system. Program modules may be included in the decryption device 1700 in the form of an operating system, application program module, and other program modules.

프로그램 모듈들은 물리적으로는 여러 가지 공지의 기억 장치 상에 저장될 수 있다. 또한, 이러한 프로그램 모듈 중 적어도 일부는 복호화 장치(1700)와 통신 가능한 원격 기억 장치에 저장될 수도 있다.Program modules may be physically stored on various known storage devices. Additionally, at least some of these program modules may be stored in a remote memory device capable of communicating with the decoding device 1700.

프로그램 모듈들은 일 실시예에 따른 기능 또는 동작을 수행하거나, 일 실시예에 따른 추상 데이터 유형을 구현하는 루틴(routine), 서브루틴(subroutine), 프로그램, 오브젝트(object), 컴포넌트(component) 및 데이터 구조(data structure) 등을 포괄할 수 있지만, 이에 제한되지는 않는다.Program modules are routines, subroutines, programs, objects, components, and data that perform a function or operation according to an embodiment or implement an abstract data type according to an embodiment. It may include data structures, etc., but is not limited thereto.

프로그램 모듈들은 복호화 장치(1700)의 적어도 하나의 프로세서(processor)에 의해 수행되는 명령어(instruction) 또는 코드(code)로 구성될 수 있다.Program modules may be composed of instructions or codes that are executed by at least one processor of the decoding device 1700.

처리부(1710)는 엔트로피 복호화부(210), 역양자화부(220), 역변환부(230), 인트라 예측부(240), 인터 예측부(250), 스위치(245), 가산기(255), 필터부(260) 및 참조 픽처 버퍼(270)의 명령어 또는 코드를 실행할 수 있다.The processing unit 1710 includes an entropy decoding unit 210, an inverse quantization unit 220, an inverse transform unit 230, an intra prediction unit 240, an inter prediction unit 250, a switch 245, an adder 255, and a filter. Instructions or codes of the unit 260 and the reference picture buffer 270 may be executed.

저장부는 메모리(1730) 및/또는 저장소(1740)를 나타낼 수 있다. 메모리(1730) 및 저장소(1740)는 다양한 형태의 휘발성 또는 비휘발성 저장 매체일 수 있다. 예를 들면, 메모리(1730)는 롬(ROM)(1731) 및 램(RAM)(1732) 중 적어도 하나를 포함할 수 있다.The storage unit may represent memory 1730 and/or storage 1740. Memory 1730 and storage 1740 may be various types of volatile or non-volatile storage media. For example, the memory 1730 may include at least one of ROM 1731 and RAM 1732.

저장부는 복호화 장치(1700)의 동작을 위해 사용되는 데이터 또는 정보를 저장할 수 있다. 실시예에서, 복호화 장치(1700)가 갖는 데이터 또는 정보는 저장부 내에 저장될 수 있다.The storage unit may store data or information used for the operation of the decoding device 1700. In an embodiment, data or information held by the decoding device 1700 may be stored in the storage unit.

예를 들면, 저장부는 픽처, 블록, 리스트, 움직임 정보, 인터 예측 정보 및 비트스트림 등을 저장할 수 있다.For example, the storage unit can store pictures, blocks, lists, motion information, inter prediction information, and bitstreams.

복호화 장치(1700)는 컴퓨터에 의해 독출(read)될 수 있는 기록 매체를 포함하는 컴퓨터 시스템에서 구현될 수 있다.The decryption device 1700 may be implemented in a computer system that includes a recording medium that can be read by a computer.

기록 매체는 복호화 장치(1700)가 동작하기 위해 요구되는 적어도 하나의 모듈을 저장할 수 있다. 메모리(1730)는 적어도 하나의 모듈을 저장할 수 있고, 적어도 하나의 모듈이 처리부(1710)에 의하여 실행되도록 구성될 수 있다.The recording medium may store at least one module required for the decoding device 1700 to operate. The memory 1730 may store at least one module, and the at least one module may be configured to be executed by the processing unit 1710.

복호화 장치(1700)의 데이터 또는 정보의 통신과 관련된 기능은 통신부(1720)를 통해 수행될 수 있다.Functions related to communication of data or information of the decryption device 1700 may be performed through the communication unit 1720.

예를 들면, 통신부(1720)는 부호화 장치(1600)로부터 비트스트림을 수신할 수 있다.For example, the communication unit 1720 may receive a bitstream from the encoding device 1600.

이하에서, 처리부는 부호화 장치(1600)의 처리부(1610) 및/또는 복호화 장치(1700)의 처리부(1710)를 나타낼 수 있다. 예를 들면, 예측에 관한 기능에 있어서, 처리부는 스위치(115) 및/또는 스위치(245)를 나타낼 수 있다. 인터 예측에 관한 기능에 있어서, 처리부는 인터 예측부(110), 감산기(125) 및 가산기(175)를 나타낼 수 있으며, 인터 예측부(250) 및 가산기(255)를 나타낼 수 있다. 인트라 예측에 관한 기능에 있어서, 처리부는 인트라 예측부(120), 감산기(125) 및 가산기(175)를 나타낼 수 있으며, 인트라 예측부(240) 및 가산기(255)를 나타낼 수 있다. 변환에 관한 기능에 있어서, 처리부는 변환부(130) 및 역변환부(170)를 나타낼 수 있으며, 역변환부(230)를 나타낼 수 있다. 양자화에 관한 기능에 있어서, 처리부는 양자화부(140) 및 역양자화부(160)를 나타낼 수 있으며, 역양자화부(220)를 나타낼 수 있다. 엔트로피 부호화 및/또는 복호화에 관한 기능에 있어서, 처리부는 엔트로피 부호화부(150) 및/또는 엔트로피 복호화부(210)를 나타낼 수 있다. 필터링에 관한 기능에 있어서, 처리부는 필터부(180) 및/또는 필터부(260)를 나타낼 수 있다. 참조 픽처에 관한 기능에 있어서, 처리부는 참조 픽처 버퍼(190) 및/또는 참조 픽처 버퍼(270)를 나타낼 수 있다.Hereinafter, the processing unit may refer to the processing unit 1610 of the encoding device 1600 and/or the processing unit 1710 of the decoding device 1700. For example, for functions related to prediction, the processing unit may represent switch 115 and/or switch 245. In functions related to inter prediction, the processing unit may represent an inter prediction unit 110, a subtractor 125, and an adder 175, and may represent an inter prediction unit 250 and an adder 255. In the function related to intra prediction, the processing unit may represent an intra prediction unit 120, a subtractor 125, and an adder 175, and may represent an intra prediction unit 240 and an adder 255. In functions related to transformation, the processing unit may represent a transformation unit 130 and an inverse transformation unit 170, and may indicate an inverse transformation unit 230. In functions related to quantization, the processing unit may represent a quantization unit 140 and an inverse quantization unit 160, and may represent an inverse quantization unit 220. In functions related to entropy encoding and/or decoding, the processing unit may represent an entropy encoding unit 150 and/or an entropy decoding unit 210. In functions related to filtering, the processing unit may represent a filter unit 180 and/or a filter unit 260. For functions related to reference pictures, the processing unit may represent a reference picture buffer 190 and/or a reference picture buffer 270.

도 18은 일 실시예에 따른 부호화 방법 및 비트스트림 생성 방법의 흐름도이다.Figure 18 is a flowchart of an encoding method and a bitstream generation method according to an embodiment.

실시예의 부호화 방법 및 비트스트림 생성 방법은 부호화 장치(1600)에 의해 수행될 수 있다. 실시예는 부호화 방법의 일부일 수 있다.The encoding method and bitstream generation method of the embodiment may be performed by the encoding device 1600. An embodiment may be part of an encoding method.

단계(1810)에서, 처리부(1610)는 대상 블록에 대한 부호화를 수행할 수 있다.In step 1810, the processor 1610 may perform encoding on the target block.

처리부(1610)는 대상 블록의 부호화를 위해 사용될 코딩 정보를 결정할 수 있다.The processing unit 1610 may determine coding information to be used for encoding the target block.

코딩 정보는 실시예들에서 설명되는 정보를 포함할 수 있다. 예를 들면, 코딩 정보는 예측 정보를 포함할 수 있다. 예측 정보는 실시예들에서 설명된 예측과 관련된 정보를 포함할 수 있다. 예측 정보는 인터 예측 정보 및 인트라 예측 정보를 포함할 수 있다.Coding information may include information described in embodiments. For example, coding information may include prediction information. Prediction information may include information related to predictions described in embodiments. Prediction information may include inter prediction information and intra prediction information.

코딩 정보는 실시예들에서 설명되는 시그널링/부호화/복호화되는 정보를 포함할 수 있다. 말하자면, 코딩 정보는 부호화 장치(1600)에서 수행되는 부호화에 대응하는 복호화를 복호화 장치(1700)에서 수행하기 위해 사용되는 정보일 수 있다. 여기에서, 부호화 및 복호화는 예측을 포함할 수 있다. Coding information may include signaling/encoding/decoding information described in embodiments. In other words, the coding information may be information used to perform decoding in the decoding device 1700 corresponding to the encoding performed in the encoding device 1600. Here, encoding and decoding may include prediction.

코딩 정보는 실시예들에서 설명되는 구문 요소를 포함할 수 있다.Coding information may include syntax elements described in the embodiments.

코딩 정보는 대상 블록에 관련된 코딩 파라미터를 포함할 수 있다.Coding information may include coding parameters related to the target block.

처리부(1610)는 대상 블록의 부호화에 있어서 코딩 정보를 사용할 수 있다. 또는, 대상 블록의 부호화에서 사용된 정보에 대응하도록 코딩 정보가 생성될 수 있다.The processing unit 1610 may use coding information when encoding the target block. Alternatively, coding information may be generated to correspond to information used in encoding the target block.

단계(1820)에서, 처리부(1610)는 코딩 정보에 대한 부호화를 수행하여 부호화된 코딩 정보를 생성할 수 있다.In step 1820, the processing unit 1610 may perform encoding on the coding information to generate encoded coding information.

단계(1830)에서, 처리부(1610)는 비트스트림을 생성할 수 있다.In step 1830, processing unit 1610 may generate a bitstream.

비트스트림에 포함되는 정보는 단계(1820)에서 생성될 수 있고, 또는 단계들(1810 및 1820)에서 적어도 부분적으로 생성될 수 있다.Information included in the bitstream may be generated in step 1820, or may be at least partially generated in steps 1810 and 1820.

처리부(1610)는 생성된 비트스트림을 저장소(1640)에 저장할 수 있다. 또는, 통신부(1620)는 비트스트림을 복호화 장치(1700)로 전송할 수 있다.The processing unit 1610 may store the generated bitstream in the storage 1640. Alternatively, the communication unit 1620 may transmit the bitstream to the decoding device 1700.

비트스트림은 대상 블록에 대한 부호화된 정보를 포함할 수 있다. 처리부(1610)는 대상 블록에 대한 정보에 대한 엔트로피 부호화를 수행함으로써 대상 블록에 대한 부호화된 정보를 생성할 수 있다.The bitstream may include encoded information about the target block. The processing unit 1610 may generate encoded information about the target block by performing entropy encoding on the information about the target block.

대상 블록에 대한 정보는 변환 및 양자화된 계수를 포함할 수 있다. 대상 블록에 대한 부호화된 정보는 부호화된 변환 및 양자화된 계수를 포함할 수 있다.Information about the target block may include transformed and quantized coefficients. Encoded information about the target block may include an encoded transform and quantized coefficients.

도 19는 일 실시예에 따른 비트스트림을 사용하는 복호화 방법의 흐름도이다.Figure 19 is a flowchart of a decoding method using a bitstream according to an embodiment.

실시예의 비트스트림을 사용하는 복호화 방법은 복호화 장치(1700)에 의해 수행될 수 있다. 실시예는 복호화 방법의 일부일 수 있다.The decoding method using the bitstream of the embodiment may be performed by the decoding device 1700. The embodiment may be part of a decryption method.

컴퓨터 판독 가능한 기록 매체는 비트스트림을 포함할 수 있다.단계(1910)에서, 통신부(1720)는 비트스트림을 획득할 수 있다. 통신부(1720)는 부호화 장치(1600)로부터 비트스트림을 수신할 수 있다. 처리부(1710)는 획득된 비트스트림을 저장소(1740)에 저장할 수 있다.A computer-readable recording medium may include a bitstream. In step 1910, the communication unit 1720 may obtain a bitstream. The communication unit 1720 may receive a bitstream from the encoding device 1600. The processing unit 1710 may store the obtained bitstream in the storage 1740.

처리부(1710)는 저장부(1740)로부터 비트스트림을 독출(read)할 수 있다.The processing unit 1710 can read a bitstream from the storage unit 1740.

비트스트림은 대상 블록에 대한 부호화된 정보를 포함할 수 있다. 처리부(1710)는 대상 블록에 대한 부호화된 정보에 대해 엔트로피 복호화를 수행함으로써 대상 블록에 대한 정보를 생성할 수 있다.The bitstream may include encoded information about the target block. The processing unit 1710 may generate information about the target block by performing entropy decoding on the encoded information about the target block.

대상 블록에 대한 부호화된 정보는 부호화된 변환 및 양자화된 계수를 포함할 수 있다. 대상 블록에 대한 정보는 변환 및 양자화된 계수를 포함할 수 있다.Encoded information about the target block may include an encoded transform and quantized coefficients. Information about the target block may include transformed and quantized coefficients.

비트스트림은 부호화된 코딩 정보 또는 코딩 정보를 포함할 수 있다.The bitstream may include encoded coding information or coding information.

단계(1920)에서, 처리부(1710)는 비트스트림으로부터 코딩 정보를 획득할 수 있다.In step 1920, the processor 1710 may obtain coding information from the bitstream.

처리부(1710)는 비트스트림 내의 부호화된 코딩 정보에 대한 복호화를 수행하여 코딩 정보를 생성할 수 있다.The processing unit 1710 may generate coding information by performing decoding on the encoded coding information in the bitstream.

코딩 정보는 실시예들에서 설명되는 시그널링/부호화/복호화되는 정보를 포함할 수 있다. 말하자면, 코딩 정보는 부호화 장치(1600)에서 수행되는 예측에 대응하는 예측을 복호화 장치(1700)에서 수행하기 위해 사용되는 정보일 수 있다.Coding information may include signaling/encoding/decoding information described in embodiments. In other words, coding information may be information used to perform prediction in the decoding device 1700 corresponding to prediction performed in the encoding device 1600.

코딩 정보는 실시예들에서 설명되는 구문 요소를 포함할 수 있다.Coding information may include syntax elements described in the embodiments.

코딩 정보는 대상 블록에 관련된 코딩 파라미터를 포함할 수 있다.Coding information may include coding parameters related to the target block.

단계(1930)에서, 처리부(1710)는 대상 블록에 대한 복호화를 수행할 수 있다.In step 1930, the processing unit 1710 may perform decoding on the target block.

처리부(1710)는 대상 블록의 복호화를 위해 사용될 코딩 정보를 결정할 수 있다.The processing unit 1710 may determine coding information to be used for decoding the target block.

코딩 정보는 실시예들에서 설명되는 정보를 포함할 수 있다. 예를 들면, 코딩 정보는 예측 정보를 포함할 수 있다. 예측 정보는 실시예들에서 설명된 예측과 관련된 정보를 포함할 수 있다. 예측 정보는 인터 예측 정보 및 인트라 예측 정보를 포함할 수 있다.Coding information may include information described in embodiments. For example, coding information may include prediction information. Prediction information may include information related to predictions described in embodiments. Prediction information may include inter prediction information and intra prediction information.

처리부(1710)는 대상 블록의 복호화에 있어서 코딩 정보를 사용할 수 있다. 또는, 대상 블록의 부호화를 위해 부호화 장치(1600)에서 사용된 코딩 정보에 대응하도록 복호화 장치(1700)에서의 코딩 정보가 생성될 수 있다. 복호화 장치(1700)에서의 코딩 정보는 부호화 장치(1600)에서의 코딩 정보와 같을 수 있다. 말하자면, 처리부(1710)는 단계(1810)에서 수행된 부호화에 대응하는 복호화를 수행하기 위해, 단계(1810)에서 사용된 코딩 정보와 동일한 코딩 정보를 생성할 수 있다.The processing unit 1710 may use coding information when decoding the target block. Alternatively, coding information in the decoding device 1700 may be generated to correspond to coding information used in the encoding device 1600 to encode the target block. Coding information in the decoding device 1700 may be the same as coding information in the encoding device 1600. In other words, the processing unit 1710 may generate coding information that is the same as the coding information used in step 1810 in order to perform decoding corresponding to the encoding performed in step 1810.

처리부(1710)는 실시예들에서 설명되는 방법들을 사용하여 코딩 정보를 결정할 수 있다.Processing unit 1710 may determine coding information using methods described in embodiments.

처리부(1710)는 대상 블록에 대한 정보 및 코딩 정보를 사용하여 대상 블록의 복호화를 수행함으로써 재구축된 블록을 생성할 수 있다.The processing unit 1710 may generate a reconstructed block by decoding the target block using information about the target block and coding information.

도 20은 일 예에 따른 예측 방법의 흐름도이다.20 is a flowchart of a prediction method according to an example.

실시예는 부호화 장치(1600) 및 복호화 장치(1700)에서 수행될 수 있다.The embodiment may be performed in the encoding device 1600 and the decoding device 1700.

실시예들의 예측은 단계들(2010, 2020, 2030 및 2040)을 포함할 수 있다. 예를 들면, 단계(1810)는 단계들(2010, 2020, 2030 및 2040)을 포함할 수 있다. 또한, 단계(1930)는 단계들(2010, 2020, 2030 및 2040)을 포함할 수 있다.The forecast of embodiments may include stages 2010, 2020, 2030 and 2040. For example, step 1810 may include steps 2010, 2020, 2030, and 2040. Additionally, step 1930 may include steps 2010, 2020, 2030, and 2040.

실시예에서, 처리부는 부호화 장치(1600)의 처리부(1610) 및/또는 복호화 장치(1700)의 처리부(1710)를 나타낼 수 있다.In an embodiment, the processing unit may represent the processing unit 1610 of the encoding device 1600 and/or the processing unit 1710 of the decoding device 1700.

단계(2010)에서, 처리부는 대상 블록에 대한 템플릿을 생성할 수 있다.In step 2010, the processing unit may generate a template for the target block.

처리부는 코딩 정보를 사용하여 템플릿을 생성할 수 있다.The processing unit can create a template using coding information.

예를 들면, 처리부는 1) 대상 블록의 가로 크기, 2) 대상 블록의 세로 크기, 3) 상측 템플릿의 세로 크기, 4) 좌측 템플릿의 가로 크기, 5) 상측 템플릿 영역 내의 픽셀들의 개수(= ntop), 6) 좌측 템플릿 영역 내의 픽셀들의 개수(= nleft), 7) 상좌측 템플릿 영역 내의 픽셀들의 개수(= ntop_left), 8) 상측 템플릿 영역 내의 위치가 α의 배수인 픽셀, 9) 좌측 템플릿 영역 내의 위치가 β의 배수인 픽셀, 10) 상좌측 템플릿 영역의 위치가 γ의 배수인 픽셀, 11) 상좌측 템플릿 영역 내의 사선(diagonal line) 상에 위치하는 픽셀, 12) 상측 템플릿 영역 내의 i 번째 인접한(adjacent) 수평 라인 상의 픽셀들(예를 들면, 시작 위치 픽셀 및 위치가 αi의 배수인 픽셀), 13) 좌측 템플릿 영역 내의 i 번째 인접한 수직 라인 상의 픽셀들(예를 들면, 시작 위치 픽셀 및 위치가 βi의 배수인 픽셀), 14) 상좌측 템플릿 영역 내의 i 번째 인접한 수평 라인 상의 픽셀들(예를 들면, 시작 위치 픽셀 및 위치가 γi의 배수인 픽셀), 15) 상좌측 템플릿 영역 내의 i 번째 인접한 수직 라인 상의 픽셀들(예를 들면, 시작 위치 픽셀 및 위치가 γi의 배수인 픽셀), 16) template_idx, 17) 템플릿 패딩, 18) template_vertical_flipping, 19) template_horizontal_flipping, 20) template_flipping_flag 및 21) template_flipping_vertical_flag 중 적어도 하나를 사용하여 템플릿을 생성할 수 있다.For example, the processing unit: 1) horizontal size of the target block, 2) vertical size of the target block, 3) vertical size of the upper template, 4) horizontal size of the left template, 5) number of pixels in the upper template area (= n top ), 6) Number of pixels in the left template area (= n left ), 7) Number of pixels in the top left template area (= n top_left ), 8) Pixels whose positions in the top template area are multiples of α, 9) pixel whose position in the left template area is a multiple of β, 10) pixel whose position in the upper left template area is a multiple of γ, 11) pixel located on the diagonal line in the upper left template area, 12) upper template area 13) pixels on the ith adjacent horizontal line in the left template area (e.g., a starting position pixel and a pixel whose position is a multiple of α i ), 13) pixels on the ith adjacent vertical line in the left template area (e.g., starting position pixel and pixels whose positions are multiples of β i ), 14) pixels on the ith adjacent horizontal line in the upper left template area (e.g., starting position pixels and pixels whose positions are multiples of γ i ), 15) Pixels on the ith adjacent vertical line in the upper left template area (e.g., a starting position pixel and a pixel whose position is a multiple of γ i ), 16) template_idx, 17) template padding, 18) template_vertical_flipping, 19) template_horizontal_flipping, 20 A template can be created using at least one of ) template_flipping_flag and 21) template_flipping_vertical_flag.

템플릿의 생성에 있어서, 특정 유닛의 경계의 밖의 상측 픽셀은 템플릿으로 사용되지 않을 수 있다. 특정 유닛은 코딩 트리 유닛(Coding Tree Unit; CTU)와 같은 실시예들에서 설명된 유닛일 수 있다.In creating a template, upper pixels outside the boundary of a specific unit may not be used as a template. The specific unit may be a unit described in embodiments such as a Coding Tree Unit (CTU).

단계(2020)에서, 처리부는 템플릿 매칭(Template Matching; TM) 참조 영상을 선택할 수 있다.In step 2020, the processing unit may select a template matching (TM) reference image.

처리부는 코딩 정보를 사용하여 TM 참조 영상을 선택할 수 있다.The processing unit may select a TM reference image using coding information.

예를 들면, 처리부는 1) 템플릿 매칭 참조 영상 리스트(= template_matching_ref_list), 2) 템플릿 매칭 참조 영상 인덱스(= template_matching_ref_idx), 3) 템플릿 매칭 참조 영상 리스트 L0(= template_matching_ref_l0), 4) 템플릿 매칭 참조 영상 리스트 L1(= template_matching_ref_l1), 5) L0 템플릿 매칭 참조 영상 인덱스(= template_matching_ref_idx_l0), 6) L1 템플릿 매칭 참조 영상 인덱스(= template_matching_ref_idx_l1), 7) 슬라이스 타입(= slice_type) 및 8) 대상 블록의 코딩 모드 중 적어도 하나를 사용하여 TM 참조 영상을 선택할 수 있다.For example, the processing unit includes 1) template matching reference image list (= template_matching_ref_list), 2) template matching reference image index (= template_matching_ref_idx), 3) template matching reference image list L0 (= template_matching_ref_l0), 4) template matching reference image list. At least one of L1 (= template_matching_ref_l1), 5) L0 template matching reference image index (= template_matching_ref_idx_l0), 6) L1 template matching reference image index (= template_matching_ref_idx_l1), 7) slice type (= slice_type), and 8) coding mode of the target block. You can use one to select a TM reference image.

예를 들면, 템플릿 매칭 참조 영상의 선택을 위해, 처리부는 복수의 템플릿 매칭 참조 영상 구성 방법들 중 하나의 템플릿 매칭 참조 영상 구성 방법을 선택할 수 있다. 여기에서, 템플릿 매칭 참조 영상 구성 방법은 템플릿 매칭 참조 영상 리스트를 구성하는 방법을 포함할 수 있다.For example, to select a template matching reference image, the processor may select one template matching reference image configuring method among a plurality of template matching reference image configuring methods. Here, the method of configuring a template matching reference image may include a method of configuring a template matching reference image list.

단계(2030)에서, 처리부는 TM 탐색을 수행할 수 있다.At step 2030, the processing unit may perform TM search.

처리부는 템플릿을 사용하여 템플릿 매칭 참조 영상 내에서 TM 탐색을 수행함으로써 템플릿 매칭 최적 블록을 도출할 수 있다.The processing unit can derive the optimal template matching block by performing TM search within the template matching reference image using the template.

TM 탐색은 TM 최적 블록의 탐색을 의미할 수 있다.TM search may mean search for a TM optimal block.

처리부는 코딩 정보를 사용하여 TM 최적 블록을 탐색할 수 있다.The processing unit can search for the TM optimal block using coding information.

예를 들면, 처리부는 1) TM 움직임 벡터(= MVtm), 2) TM 탐색 영역(region), 3) 사각형 TM 탐색 영역, 4) 마름모 TM 탐색 영역, 5) 사각형 TM 탐색 영역의 크기(사각형 TM 탐색 영역의 가로 크기(= rec_template_width) 및/또는 사각형 TM 탐색 영역의 세로 크기(= rec_template_height)), 6) 템플릿 매칭 탐색 시작 점으로부터의 양쪽 방향(템플릿 매칭 탐색 시작 점으로부터의 양쪽 수평 방향(= del_width) 및/또는 템플릿 매칭 탐색 시작 점으로부터의 양쪽 수직 방향(= del_height)), 7) 사각형 TM 탐색 영역의 크기(사각형 TM 탐색 영역의 가로 크기(= dia_template_width) 및/또는 10) 사각형 TM 탐색 영역의 세로 크기(= dia_template_height)), 8) 템플릿 매칭 탐색 영역의 모양(= template_matching_shape_idx), 9) 대상 블록의 대응 위치, 10) 대상 블록의 템플릿의 대응 위치 (= (xtm, ytm)), 11) 대상 블록에 인접한 블록들 중 TM을 사용하여 부호화된 블록의 TM 움직임 벡터(= (MVtm_x, MVtm_y), 12) 머지 리스트, 13) 머지 인덱스(= merge_idx), 14) TM 탐색 시작 점 인덱스(= template_matching_init_idx), 15) TM 탐색 방법, 16) TM 탐색 방법 인덱스(= template_matching_search_idx), 17) 템플릿 매칭 상관 관계 척도(예를 들면, 최소의 절대 차이들의 합(Sum of Absolute Differences; SAD), 제곱된 차이들의 합(Sum of Squared Differences; SSD) 및 절대 변환된 차이들의 합(Sum of Absolute Transformed Differences; SATD) 등), 18) 템플릿 매칭 상관 관계 척도 인덱스(= template_matching_criteria_idx), 19) 템플릿 매칭 탐색이 조기 종료되는지 여부(= template_matching_early_termination_flag) 및 20) 템플릿 매칭 탐색 조기 종료 임계치(= template_matching_early_termination_threshold) 중 적어도 하나를 사용하여 TM 최적 블록을 탐색할 수 있다.For example, the processing unit 1) TM motion vector (= MV tm ), 2) TM search area (region), 3) rectangular TM search area, 4) diamond TM search area, 5) size of the rectangular TM search area (square Horizontal size of the TM search area (= rec_template_width) and/or vertical size of the rectangular TM search area (= rec_template_height)), 6) both directions from the template matching search start point (both horizontal directions from the template matching search start point (= del_width) and/or both vertical directions from the template matching search start point (= del_height)), 7) the size of the rectangular TM search area (horizontal size of the rectangular TM search area (= dia_template_width) and/or 10) the rectangular TM search area vertical size (= dia_template_height)), 8) shape of template matching search area (= template_matching_shape_idx), 9) corresponding position of target block, 10) corresponding position of template of target block (= (x tm , y tm )), 11) TM motion vector of a block encoded using TM among blocks adjacent to the target block (= (MV tm_x , MV tm_y ), 12) merge list, 13) merge index (= merge_idx), 14) TM search start point Index (= template_matching_init_idx), 15) TM search method, 16) TM search method index (= template_matching_search_idx), 17) Template matching correlation measure (e.g., Sum of Absolute Differences (SAD), Sum of Squared Differences (SSD) and Sum of Absolute Transformed Differences (SATD), etc.), 18) Template matching correlation scale index (= template_matching_criteria_idx), 19) Template matching search The TM optimal block can be searched using at least one of 20) whether it terminates early (= template_matching_early_termination_flag) and 20) the template matching search early termination threshold (= template_matching_early_termination_threshold).

예를 들면, 처리부는 서로 다른 형태를 갖는 탐색 영역들 중 하나의 탐색 영역을 탬플릿 매칭 최적 블록을 도출하기 위한 탐색 영역으로서 선택할 수 있다.For example, the processor may select one of search areas having different shapes as a search area for deriving the optimal template matching block.

예를 들면, 처리부는 매칭 최적 블록을 도출하기 위한 탐색 영역의 템플릿 매칭 탐색 시작 점을 설정할 수 있다.For example, the processing unit can set the template matching search starting point of the search area to derive the optimal matching block.

실시예들에서, 특정 유닛의 크기는 특정 유닛의 면적을 의미할 수 있다. 또는 특정 유닛의 크기는 특정 유닛의 가로 크기 및 세로 크기 중 하나 이상을 의미할 수 있다.In embodiments, the size of a specific unit may refer to the area of the specific unit. Alternatively, the size of a specific unit may mean one or more of the horizontal size and vertical size of the specific unit.

TM 탐색 방법은 전역 탐색(full search), 2D 대수적(logarithmic) 탐색, N-스탭(step) 탐색, 다이아몬드(diamond) 탐색, 육각형(hexagonal) 탐색 및 테스트 존(test zone) 탐색을 포함할 수 있다.TM search methods may include full search, 2D logarithmic search, N-step search, diamond search, hexagonal search, and test zone search. .

단계(2040)에서, 처리부는 TM 최적 블록을 이용하는 부호화/복호화를 수행할 수 있다.In step 2040, the processing unit may perform encoding/decoding using the TM optimal block.

처리부는 코딩 정보를 사용하여 TM 최적 블록을 이용하는 부호화/복호화를 수행할 수 있다.The processing unit can use coding information to perform encoding/decoding using the TM optimal block.

예를 들면, 처리부는 템플릿, TM 참조 영상, TM 움직임 벡터, TM 최적 블록 중 적어도 하나를 사용하여 부호화/복호화를 수행할 수 있다.For example, the processing unit may perform encoding/decoding using at least one of a template, a TM reference image, a TM motion vector, and a TM optimal block.

단계(2040)는 단계들(2041, 2041, 2043, 2044 및 2045) 중 하나 이상을 포함할 수 있다.Step 2040 may include one or more of steps 2041, 2041, 2043, 2044, and 2045.

단계(2041)에서, 처리부는 TM 기반 인트라 잔차 신호 예측을 수행할 수 있다.In step 2041, the processor may perform TM-based intra residual signal prediction.

처리부는 코딩 정보를 사용하여 TM 매칭에 의해 탐색된 TM 매칭 최적 블록을 이용하는 대상 블록의 부호화를 수행할 수 있다.The processing unit may use the coding information to perform encoding of the target block using the TM matching optimal block discovered by TM matching.

예를 들면, 처리부는 1) 대상 블록의 인트라 예측 잔차 신호, 2) 인트라 예측 모드, 3) TM 최적 블록의 인트라 예측 잔차 신호 및 대상 블록의 예측 오차(= 잔차 신호), 4) 대상 블록의 잔차 신호 및 TM 최적 블록의 잔차 신호 간의 차이 값, 5) 대상 블록의 인트라 예측 잔차 신호 및 TM 최적 블록의 인트라 예측 잔차 신호 간의 차이 값 및 6) tm_intra_residual_pred 중 적어도 하나를 사용하여 TM 매칭에 의해 탐색된 TM 매칭 최적 블록을 이용하는 대상 블록의 부호화를 수행할 수 있다.For example, the processing unit processes 1) the intra prediction residual signal of the target block, 2) the intra prediction mode, 3) the intra prediction residual signal of the TM optimal block and the prediction error (= residual signal) of the target block, 4) the residual of the target block. The difference value between the signal and the residual signal of the TM optimal block, 5) the difference value between the intra prediction residual signal of the target block and the intra prediction residual signal of the TM optimal block, and 6) the TM explored by TM matching using at least one of tm_intra_residual_pred. Encoding of the target block using the matching optimal block can be performed.

단계(2042)에서, 처리부는 제한적 TM 기반 인트라 잔차 신호 예측을 수행할 수 있다.In step 2042, the processor may perform limited TM-based intra residual signal prediction.

처리부는 코딩 정보를 사용하여 제한적 TM 기반 인트라 잔차 신호 예측을 수행할 수 있다.The processing unit may perform limited TM-based intra residual signal prediction using coding information.

예를 들면, 처리부는 1) 대상 블록의 일부 영역(예를 들면, 우하단 사각형, 우하단 삼각형, 하단 일부 블록 또는 우측 일부 블록), 2) 템플릿(또는, 대상 블록의 좌단)과의 x 축 방향으로의 거리(= dx,th), 3) 템플릿(또는, 대상 블록의 상단)과의 y 축 방향으로의 거리(= dy,th), 4) restrict_tm_intra_residual_pred 및 5) restrict_tm_intra_residual_flag 중 적어도 하나를 이용하여 제한적 TM 기반 인트라 잔차 신호 예측을 수행할 수 있다.For example, the processing unit 1) some area of the target block (e.g., lower right square, lower right triangle, lower partial block, or right partial block), 2) x-axis with the template (or left end of the target block) At least one of the following: distance in direction (= d Using this, limited TM-based intra residual signal prediction can be performed.

단계(2043)에서, 처리부는 지역적 조도 보상(Local Illumination Compensation; LIC) 기반 TM 예측을 수행할 수 있다.In step 2043, the processing unit may perform Local Illumination Compensation (LIC)-based TM prediction.

처리부는 코딩 정보를 사용하여 LIC 기반 TM 예측을 수행할 수 있다.The processing unit may perform LIC-based TM prediction using coding information.

예를 들면, 처리부는 1) LIC, 2) TM 최적 블록의 선형 모델, 3) 선형 모델의 α 및 β, 4) 템플릿의 일부 픽셀, 5) 템플릿 픽셀에 대한 서브샘플링의 대표 값, 6) 대상 블록 템플릿의 큰 대표 값들의 평균(= T1 A), 7) 대상 블록 템플릿의 작은 대표 값들의 평균(= T2 A), 8) TM 최적 블록 템플릿의 큰 대표 값들의 평균(= T2 A), 9) TM 최적 블록 템플릿의 작은 대표 값들의 평균(= T2 B) 및 10) lic_template_matching_mode 중 적어도 하나를 이용하여 LIC 기반 TM 예측을 수행할 수 있다.For example, the processing unit can: 1) LIC, 2) linear model of TM optimal block, 3) α and β of linear model, 4) some pixels of template, 5) representative values of subsampling for template pixels, 6) target Average of large representative values of block template (= T 1 A ), 7) Average of small representative values of target block template (= T 2 A ), 8) Average of large representative values of TM optimal block template (= T 2 A ), 9) the average of small representative values of the TM optimal block template (= T 2 B ), and 10) lic_template_matching_mode. LIC-based TM prediction can be performed.

단계(2044)에서, 처리부는 인트라 및 TM의 블랜딩 예측을 사용할 수 있다.At step 2044, the processor may use blending prediction of intra and TM.

처리부는 코딩 정보를 사용하여 인트라 및 TM의 블랜딩 예측을 수행할 수 있다.The processing unit can perform intra and TM blending prediction using coding information.

예를 들면, 처리부는 1) 인트라 예측 신호, 2) 인트라 예측의 가중치, 3) TM 최적 블록의 가중치, 4) intra_template_matching_blending_mode 및 5) 인트라 예측 모드 중 적어도 하나를 이용하여 인트라 및 TM의 블랜딩 예측을 수행할 수 있다.For example, the processing unit performs blending prediction of intra and TM using at least one of 1) intra prediction signal, 2) weight of intra prediction, 3) weight of TM optimal block, 4) intra_template_matching_blending_mode, and 5) intra prediction mode. can do.

단계(2045)에서, 처리부는 인터 및 TM의 블랜딩 예측을 사용할 수 있다.At step 2045, the processor may use blending prediction of Inter and TM.

처리부는 코딩 정보를 사용하여 인터 및 TM의 블랜딩 예측을 수행할 수 있다.The processing unit can perform inter and TM blending prediction using coding information.

예를 들면, 처리부는 1) 인터 예측의 가중치, 2) TM 최적 블록의 가중치, 3) 인터 예측 신호, 4) 제1 인터 예측 움직임 벡터, 5) 제2 인터 예측 움직임 벡터, 6) 제1 인터 예측 참조 영상, 7) 제2 인터 예측 참조 영상, 8) 제1 참조 영상 리스트, 9) 제2 참조 영상 리스트, 10) 제1 인터 예측 참조 영상의 가중치, 11) 제2 인터 예측 참조 영상의 가중치, 12) 제1 TM 참조 영상, 13) 제2 TM 참조 영상, 14) 제1 TM 움직임 벡터, 15) 제2 TM 움직임 벡터, 16) 제1 TM 최적 블록, 17) 제2 TM 최적 블록, 18) 제1 TM 참조 영상의 가중치, 19) 제2 TM 참조 영상의 가중치, 20) inter_tm_sharing_ref_flag, 21) p_inter_template_matching_blending_mode, 22) b_inter_template_matching_blending_mode 및 23) b_inter_bi_template_matching_blending_mode 중 하나 이상을 사용하여 인터 및 TM의 블랜딩 예측을 수행할 수 있다.For example, the processing unit 1) inter prediction weight, 2) weight of TM optimal block, 3) inter prediction signal, 4) first inter prediction motion vector, 5) second inter prediction motion vector, 6) first inter prediction motion vector. Prediction reference image, 7) second inter prediction reference image, 8) first reference image list, 9) second reference image list, 10) weight of first inter prediction reference image, 11) weight of second inter prediction reference image , 12) first TM reference image, 13) second TM reference image, 14) first TM motion vector, 15) second TM motion vector, 16) first TM optimal block, 17) second TM optimal block, 18 ) Blending prediction of inter and TM can be performed using one or more of the weight of the first TM reference image, 19) the weight of the second TM reference image, 20) inter_tm_sharing_ref_flag, 21) p_inter_template_matching_blending_mode, 22) b_inter_template_matching_blending_mode, and 23) b_inter_bi_template_matching_blending_mode. there is.

단계(2045)는 단계들(2046, 2047 및 2048) 중 하나 이상을 포함할 수 있다.Step 2045 may include one or more of steps 2046, 2047, and 2048.

단계(2046)에서, 처리부는 P 인터 및 TM의 블랜딩 예측을 사용할 수 있다.At step 2046, the processor may use blending prediction of P inter and TM.

단계(2047)에서, 처리부는 B 인터 및 TM의 블랜딩 예측을 사용할 수 있다.At step 2047, the processor may use blending prediction of B inter and TM.

단계(2048)에서, 처리부는 B 인터 및 B-TM의 블랜딩 예측을 사용할 수 있다.At step 2048, the processor may use blending prediction of B-inter and B-TM.

단계들(2010, 2020, 2030 및 2040)의 적어도 일부의 수행의 여부는 코딩 정보에 기반하여 결정될 수 있다.Whether to perform at least some of steps 2010, 2020, 2030, and 2040 may be determined based on coding information.

예를 들면, 단계들(2010, 2020, 2030 및 2040)의 적어도 일부의 수행의 여부는 1) 픽처에 대한 정보, 2) 슬라이스에 대한 정보, 3) 타일에 대한 정보, 4) 양자화 파라미터(Quantization Parameter; QP), 5) 코드된 블록 플래그(Coded Block Flag; CBF), 6) 블록의 크기, 7) 블록의 깊이, 8) 블록의 형태, 9) 엔트로피 부호화/복호화 방법, 10) 블록의 모양(예를 들면, 블록이 정사각형인지 여부 또는 블록이 직사각형인지 여부) 및 11) 시간적(temporal) 레이어(layer) 레벨(level) 중 적어도 하나에 기반하여 결정될 수 있다.For example, whether to perform at least part of steps 2010, 2020, 2030, and 2040 depends on 1) information about the picture, 2) information about the slice, 3) information about the tile, 4) quantization parameters. Parameter; QP), 5) Coded Block Flag (CBF), 6) Block size, 7) Block depth, 8) Block shape, 9) Entropy encoding/decoding method, 10) Block shape (For example, whether the block is square or whether the block is rectangular) and 11) the temporal layer level.

실시예들에서 대상 블록은 코딩 트리 블록(Coding Tree Block; CTB), 매크로 블록(Macro Block; MB), 코딩 블록(Coding Block; CB), 예측 블록(Prediction Block; PB), 변환 블록(Transform Block; TB), 가상 파이프라인 데이터 유닛(Virtual Pipeline Data Unit; VPDU) 및 소정(predetermined) 크기를 갖는 블록 중 하나일 수 있다.In embodiments, the target block is a Coding Tree Block (CTB), a Macro Block (MB), a Coding Block (CB), a Prediction Block (PB), and a Transform Block. ; TB), a Virtual Pipeline Data Unit (VPDU), and a block with a predetermined size.

템플릿 생성Create template

아래에서는 단계(2010)에서의 템플릿 생성이 설명된다.Below, template creation in step 2010 is described.

도 21은 일 예에 따른 대상 블록의 영역들을 나타낸다.Figure 21 shows areas of a target block according to an example.

대상 블록의 주변(surrounding) 복호화된 픽셀들의 픽셀 값들을 사용하여 특정 크기 및 특정 모양을 갖는 템플릿이 생성될 수 있다.A template with a specific size and specific shape can be created using pixel values of decoded pixels surrounding the target block.

실시예들에서, 대상 블록의 주변 픽셀은 대상 블록에 관련된 특정 조건을 충족시키는 위치의 픽셀일 수 있다. 예를 들면, 대상 블록의 주변 픽셀은 대상 블록에 인접한 상좌측 영역, 상측 영역 및/또는 좌측 영역 내의 픽셀일 수 있다. 예를 들면, 대상 블록의 주변의 픽셀은 대상 블록으로부터의 x 축 거리 및/또는 y 축 거리가 특정 값의 이하인 픽셀일 수 있다. 대상 블록의 주변 픽셀은 대상 블록에 인접한 픽셀로 한정될 수도 있다.In embodiments, the surrounding pixels of the target block may be pixels located at a location that satisfies a specific condition related to the target block. For example, the surrounding pixels of the target block may be pixels in the upper left area, upper area, and/or left area adjacent to the target block. For example, pixels surrounding the target block may be pixels whose x-axis distance and/or y-axis distance from the target block are less than or equal to a specific value. The surrounding pixels of the target block may be limited to pixels adjacent to the target block.

실시예들에서, "제1 개체의 주변의 제2 개체"는 "제1 개체에 관련된 특정 조건을 충족시키는 영역 내의 제2 개체"를 예를 들면, 특정 조건을 충족시키는 영역은 대상 블록에 대하여 특정된 영역을 의미할 수 있다. 예를 들면, 특정 영역은 실시예에서 설명된 영역을 나타낼 수 있다. 예를 들면, 특정 영역은 특정 가로 길이 및 특정 세로 길이를 갖는 영역일 수 있다. 예를 들면, 특정 영역은 제1 개체를 포함하는 하나의 유닛의 영역일 수 있다.In embodiments, “a second object surrounding a first object” means “a second object within an area that satisfies a specific condition related to the first object,” for example, the area that satisfies the specific condition is relative to the target block. It may mean a specific area. For example, a specific area may represent an area described in an embodiment. For example, a specific area may be an area with a specific horizontal length and a specific vertical length. For example, the specific area may be the area of one unit including the first object.

대상 블록의 상좌측 주변 픽셀은 대상 블록의 상좌측에 (대각선으로) 인접한 상좌측 영역 내의 픽셀을 의미할 수 있다. 대상 블록의 상측 주변 픽셀은 대상 블록의 상측에 인접한 상측 영역 내의 픽셀을 의미할 수 있다. 대상 블록의 좌측 주변 픽셀은 대상 블록의 좌측에 인접한 좌측 영역 내의 픽셀을 의미할 수 있다.The upper-left peripheral pixels of the target block may refer to pixels in the upper-left area adjacent (diagonally) to the upper-left side of the target block. The upper peripheral pixels of the target block may refer to pixels in the upper area adjacent to the upper side of the target block. The left peripheral pixels of the target block may refer to pixels in the left area adjacent to the left side of the target block.

또한, 템플릿은 대상 블록의 주변 코딩 정보를 사용하여 생성될 수 있다.Additionally, a template can be created using surrounding coding information of the target block.

실시예에서, 대상 블록의 주변 코딩 정보는 대상 블록의 주변 픽셀의 코딩 파라미터일 수 있다.In an embodiment, the surrounding coding information of the target block may be coding parameters of surrounding pixels of the target block.

예를 들어, 템플릿의 생성에 있어서, 픽셀 대신, 움직임 벡터 및 인트라 예측 모드(또는, 인트라 예측 방향) 등과 같은 코딩 정보들 중 적어도 하나가 사용될 수 있다. 말하자면, 실시예들에서 픽셀이 템플릿의 생성을 위해 사용된다는 것은 픽셀의 정보가 템플릿의 생성을 위하여 사용된다는 것을 의미할 수 있다. 픽셀의 정보는 픽셀의 픽셀 값 및 픽셀에 대한 코딩 파라미터를 포함할 수 있다. 코딩 정보는 움직임 벡터 및 인트라 예측 모드(또는, 인트라 예측 방향)을 포함할 수 있다. 픽셀에 대한 코딩 파라미터는 픽셀의 위치 또는 픽셀을 포함하는 블록에 대해 설정된 코딩 파라미터를 의미할 수 있다.For example, in generating a template, at least one of coding information such as a motion vector and an intra prediction mode (or intra prediction direction) may be used instead of a pixel. In other words, in embodiments, using a pixel to create a template may mean that information about the pixel is used to create a template. Pixel information may include a pixel value of the pixel and a coding parameter for the pixel. Coding information may include a motion vector and an intra prediction mode (or intra prediction direction). The coding parameter for a pixel may mean the location of the pixel or a coding parameter set for a block including the pixel.

도 21에서 도시된 것과 같이, 대상 블록에 인접한 상측 영역, 좌측 영역 및 상좌측 영역 중 적어도 하나의 영역 내의 복호화된 픽셀들을 사용하여 템플릿이 생성될 수 있다.As shown in FIG. 21, a template may be created using decoded pixels in at least one of the upper area, left area, and upper left area adjacent to the target block.

대상 블록에 인접한 상측 영역은 대상 블록의 상단 면에 인접한 사각형의 영역일 수 있다. 대상 블록에 인접한 좌측 영역은 대상 블록의 좌단 면에 인접한 사각형의 영역일 수 있다. 대상 블록에 인접한 상좌측 영역은 대상 블록의 상좌단 모서리에 (대각으로) 인접한 사각형의 영역일 수 있다.The upper area adjacent to the target block may be a rectangular area adjacent to the top surface of the target block. The left area adjacent to the target block may be a rectangular area adjacent to the left end face of the target block. The upper left area adjacent to the target block may be a rectangular area (diagonally) adjacent to the upper left corner of the target block.

도 21에서 도시된 것 같이 대상 블록의 가로 크기(= W), 대상 블록의 세로 크기(= H), 대상 블록에 인접한 상측 영역의 세로 크기(= HL), 대상 블록에 인접한 좌측 영역의 가로 크기(= WL) 중 적어도 하나에 의해 템플릿의 크기가 결정될 수 있다.As shown in Figure 21, the horizontal size of the target block (= W), the vertical size of the target block (= H), the vertical size of the upper area adjacent to the target block (= HL), and the horizontal size of the left area adjacent to the target block. The size of the template may be determined by at least one of (= WL).

템플릿의 영역은 상측 영역, 좌측 영역 및 상좌측 영역을 포함할 수 있다.The area of the template may include an upper area, a left area, and an upper left area.

상측 영역은 상측 템플릿에 대응할 수 있다. 상측 템플릿은 대상 블록의 상단 면에 인접한 템플릿일 수 있다. 상측 템플릿은 상측 인접 템플릿으로 명명될 수 있다. 상측 템플릿 영역 또는 상측 인접 템플릿 영역은 상측 템플릿의 영역을 의미할 수 있다.The upper area may correspond to the upper template. The upper template may be a template adjacent to the top surface of the target block. The upper template may be named the upper adjacent template. The upper template area or the upper adjacent template area may refer to the area of the upper template.

상측 영역, 좌측 영역 및 상좌측 영역으로 구성된 템플릿을 L-형태(shape) 템플릿으로 칭할 수 있다.A template consisting of an upper area, a left area, and an upper left area may be referred to as an L-shape template.

좌측 영역은 좌측 템플릿에 대응할 수 있다. 좌측 템플릿은 대상 블록의 좌단 면에 인접한 템플릿일 수 있다. 좌측 템플릿은 좌측 인접 템플릿으로 명명될 수 있다. 좌측 템플릿 영역 또는 좌측 인접 템플릿 영역은 좌측 템플릿의 영역을 의미할 수 있다.The left area may correspond to the left template. The left template may be a template adjacent to the left end face of the target block. The left template may be named the left adjacent template. The left template area or the left adjacent template area may mean the area of the left template.

상좌측 영역은 상좌측 템플릿에 대응할 수 있다. 상좌측 템플릿은 대상 블록의 상좌단 모서리에 (대각으로) 인접한 템플릿일 수 있다. 상좌측 템플릿은 상좌측 인접 템플릿으로 명명될 수 있다. 상좌측 템플릿 영역 또는 상좌측 인접 템플릿 영역은 상좌측 템플릿의 영역을 의미할 수 있다.The top left area may correspond to the top left template. The top left template may be a template adjacent (diagonally) to the top left corner of the target block. The top left template may be named the top left adjacent template. The upper left template area or the upper left adjacent template area may refer to the area of the upper left template.

여기에서, 특정 영역 및 특정 템플릿이 대응한다는 것은 특정 영역 내의 픽셀(들)이 특정 템플릿을 생성하기 위해 사용된다는 것을 나타낼 수 있다.Here, that a specific area and a specific template correspond may indicate that pixel(s) within the specific area are used to generate a specific template.

픽셀이 템플릿을 생성하기 위해 사용된다는 것은 픽셀이 템플릿의 일부로서 사용된다는 것을 의미할 수 있다.Using a pixel to create a template may mean that the pixel is used as part of a template.

도 21에서 도시된 것과 같이, 가로 크기가 W이고, 세로 크기가 H인 W×H 대상 블록에 인접하는 상측 영역, 좌측 영역, 상좌측 영역 내의 복호화된 픽셀을 사용하여 템플릿이 생성될 수 있다.As shown in FIG. 21, a template can be created using decoded pixels in the upper area, left area, and upper left area adjacent to a W×H target block with a horizontal size of W and a vertical size of H.

실시예들에서, "W×H 대상 블록"은 가로 크기가 W이고, 세로 크기가 H인 대상 블록을 나타낼 수 있다.In embodiments, “W×H target block” may represent a target block with a horizontal size of W and a vertical size of H.

상측 영역의 가로 크기는 W이고, 세로 크기는 HL일 수 있다.The horizontal size of the upper area may be W, and the vertical size may be HL.

좌측 영역의 가로 크기는 WL이고, 세로 크기는 H일 수 있다.The horizontal size of the left area may be WL, and the vertical size may be H.

상좌측 영역의 가로 크기는 WL이고, 세로 크기는 HL일 수 있다.The horizontal size of the upper left area may be WL, and the vertical size may be HL.

일부의 픽셀들을 사용하는 템플릿 생성Create a template using some pixels

도 22는 일 예에 따른 일부의 픽셀들을 사용하는 템플릿 생성을 나타낸다.Figure 22 shows template creation using some pixels according to an example.

대상 블록에 인접한 상측 영역, 좌측 영역 및 상좌측 영역 중 적어도 하나의 영역 내의 복호화된 픽셀들 중 일부의 픽셀들을 사용하여 템플릿이 생성될 수 있다.A template may be generated using some of the pixels among the decoded pixels in at least one of the upper area, left area, and upper left area adjacent to the target block.

도 22에서 도시된 것과 같이, 가로 크기가 W이고, 세로 크기가 H인 W×H 대상 블록에 인접하는 1) 상측 영역의 W×HL 개의 픽셀들 중 ntop 개의 픽셀들 (여기에서, ntop < W×HL), 2) 좌측 영역의 WL×H 개의 픽셀 중 nleft 개의 픽셀들 (여기에서, nleft < WL×H), 상좌측 영역의 HL×WL 개의 픽셀 중 ntop_left개의 픽셀들 (여기에서, ntop_left < WL×HL) 중 적어도 하나를 포함하여 템플릿을 생성 할 수 있다.As shown in FIG. 22, n top pixels among the W×HL pixels in the upper area 1) adjacent to a W×H target block with a horizontal size of W and a vertical size of H (here, n top < W Here, a template can be created including at least one of n top_left < WL×HL).

템플릿으로 사용되는 일부의 픽셀들의 개수 및 위치들은 대상 블록의 가로 크기 W, 대상 블록의 세로 크기 H, 템플릿의 가로 두께 WL 및 템플릿의 세로 두께 HL 중 적어도 하나에 기반하여 결정될 수 있다. The number and positions of some pixels used as a template may be determined based on at least one of the horizontal size W of the target block, the vertical size H of the target block, the horizontal thickness WL of the template, and the vertical thickness HL of the template.

일부의 픽셀들을 사용하는 템플릿 생성 : 배수의 픽셀Creating a template using a fraction of pixels: multiples of pixels

도 23은 일 예에 따른 배수의 픽셀들을 사용하는 템플릿 생성을 나타낸다.Figure 23 shows template creation using multiple pixels according to an example.

도면에서 지지된 "템플릿 픽셀"은 템플릿을 생성하기 위해 사용되는 픽셀들을 나타낼 수 있다.“Template pixels” supported in the figures may represent pixels used to create a template.

W×H 대상 블록에 인접한 특정 영역 내의 픽셀들 중 특정 픽셀들을 사용하여 템플릿이 생성될 수 있다.A template may be created using specific pixels among pixels in a specific area adjacent to the W×H target block.

특정 픽셀들은 1) 상측 영역 내의 W×HL개 픽셀들 중 가로 방향의 위치가 α의 배수인 픽셀, 2) 좌측 영역 내의 WL×H 개의 픽셀들 중 세로 방향의 위치가 β의 배수인 픽셀, 3) 상좌측 영역의 WL×HL 개의 픽셀들 중 위치가 γ의 배수인 픽셀 중 적어도 하나를 포함할 수 있다. 여기에서, 위치는 가로 방향의 위치 및/또는 세로 방향의 위치를 의미할 수 있다.Specific pixels are 1) a pixel whose horizontal position is a multiple of α among the W ) Among the WL×HL pixels in the upper left area, it may include at least one pixel whose position is a multiple of γ. Here, the location may mean a horizontal location and/or a vertical location.

α, β 및 γ는 W, H, WL 및 HL 중 적어도 하나에 의해 결정될 수 있다.α, β and γ may be determined by at least one of W, H, WL and HL.

도 23에서 도시된 것과 같이, 8×8 대상 블록에 인접한 상측 영역 내의 8×2개의 픽셀들 중 가로 방향의 위치가 3의 배수인 4 개의 픽셀들, 좌측 영역 내의 2×8 개의 픽셀들 중 세로 방향의 위치가 3의 배수인 4 개의 픽셀들 및 상좌측 영역 내의 2×2 개의 픽셀들 중 위치가 2의 배수인 2 개의 픽셀들 중 적어도 하나를 사용하여 템플릿이 생성될 수 있다.As shown in FIG. 23, among the 8×2 pixels in the upper area adjacent to the 8×8 target block, 4 pixels whose horizontal positions are multiples of 3, and among the 2×8 pixels in the left area, the vertical pixels A template may be created using at least one of four pixels whose directional positions are a multiple of 3 and two pixels whose positions are a multiple of 2 among the 2×2 pixels in the upper left area.

예를 들면, α는 [W/3]일수 있다.For example, α could be [W/3].

예를 들면, β는 [H/3]일 수 있다.For example, β may be [H/3].

예를 들면, γ는 [WL/2]일 수 있다.For example, γ may be [WL/2].

도 24는 일 예에 따른 배수의 픽셀들을 사용하는 템플릿 생성을 나타낸다.Figure 24 illustrates template creation using multiple pixels according to an example.

도 24에서 도시된 것과 같이, 8×8 대상 블록에 인접한 상측 영역 내의 8×2개의 픽셀들 중 가로 방향의 위치가 2의 배수인 4 개의 픽셀들(말하자면, 가로 방향의 위치가 짝수인 4 개의 픽셀들), 좌측 영역 내의 2×8 개의 픽셀들 중 세로 방향의 위치가 2의 배수인 4 개의 픽셀들(말하자면, 세로 방향의 위치가 짝수인 4 개의 픽셀들) 및 상좌측 영역 내의 2×2 개의 픽셀들 중 위치가 2의 배수인 2 개의 픽셀들(말하자면, 위치가 짝수인 2 개의 픽셀들) 중 적어도 하나를 사용하여 템플릿이 생성될 수 있다.As shown in FIG. 24, among the 8×2 pixels in the upper area adjacent to the 8×8 target block, 4 pixels whose horizontal positions are multiples of 2 (that is, 4 pixels whose horizontal positions are even numbers) pixels), among the 2×8 pixels in the left area, 4 pixels whose vertical positions are multiples of 2 (that is, 4 pixels whose vertical positions are even numbers) and 2×2 in the upper left area A template may be created using at least one of the two pixels whose positions are a multiple of 2 (that is, two pixels whose positions are even numbers).

도 25는 일 예에 따른 배수의 픽셀들을 사용하는 템플릿 생성을 나타낸다.Figure 25 shows template creation using multiple pixels according to one example.

도 25에서 도시된 것과 같이, 8×8 대상 블록에 인접한 상측 영역 내의 8×2개의 픽셀들 중 가로 방향의 위치가 2의 배수인 4 개의 픽셀들(말하자면, 가로 방향의 위치가 짝수인 4 개의 픽셀들), 좌측 영역 내의 2×8 개의 픽셀들 중 세로 방향의 위치가 2의 배수인 4 개의 픽셀들(말하자면, 세로 방향의 위치가 짝수인 4 개의 픽셀들) 및 상좌측 영역 내의 2×2 개의 픽셀들 중 사선 상에 위치한 픽셀들(말하자면, 수평 위치 및 수직 위치가 같은 2 개의 픽셀들) 중 적어도 하나를 사용하여 템플릿이 생성될 수 있다.As shown in FIG. 25, among the 8×2 pixels in the upper area adjacent to the 8×8 target block, 4 pixels whose horizontal positions are multiples of 2 (that is, 4 pixels whose horizontal positions are even numbers) pixels), among the 2×8 pixels in the left area, 4 pixels whose vertical positions are multiples of 2 (that is, 4 pixels whose vertical positions are even numbers) and 2×2 in the upper left area A template may be created using at least one of the pixels located on a diagonal line (that is, two pixels whose horizontal and vertical positions are the same).

라인들에 대하여 서로 다른 시작 위치 픽셀들 및 서브샘플링들이 사용되는 템플릿 생성Create a template where different starting position pixels and subsampling are used for the lines

템플릿을 생성하기 위해 사용되는 시작 위치 픽셀 및 서브샘플링은 라인의 위치에 따라서 결정될 수 있다.The starting position pixel and subsampling used to create the template may be determined depending on the position of the line.

실시예들에서, 대상 블록으로 1 번째 근접한(closest) (가로/세로) 라인은 대상 블록에 인접한 (가로/세로) 라인을 나타낼 수 있다. 대상 블록으로 n 번째 근접한 가로 라인은 n-1 번째 근접한 가로 라인의 상측에 인접한 라인을 나타낼 수 있다. 대상 블록으로 n 번째 근접한 세로 라인은 n-1 번째 근접한 세로 라인의 좌측에 인접한 라인을 나타낼 수 있다. n은 2 이상의 정수일 수 있다.In embodiments, the first closest (horizontal/vertical) line to the target block may represent the (horizontal/vertical) line adjacent to the target block. The n-th adjacent horizontal line to the target block may represent a line adjacent to the upper side of the n-1-th adjacent horizontal line. The n-th adjacent vertical line to the target block may represent a line adjacent to the left of the n-1-th adjacent vertical line. n may be an integer of 2 or more.

예를 들면, W×H 대상 블록에 인접한 상측 영역 내의 W×HL 개의 픽셀 중 1) 대상 블록으로부터 1 번째 근접한 가로 라인 내의 시작 위치 픽셀 및 시작 위치 픽셀로부터의 가로 방향의 위치가 α1의 배수인 픽셀들, 2) 대상 블록으로부터 2 번째 근접한 가로 라인 내의 시작 위치 픽셀 및 시작 위치 픽셀로부터의 가로 방향의 위치가 α2의 배수인 픽셀들 및 3) 대상 블록으로부터 i 번째 근접한 가로 라인 내의 시작 위치 픽셀 및 시작 위치 픽셀로부터의 가로 방향의 위치가 αi의 배수인 픽셀들 중 적어도 하나를 포함하여 템플릿이 생성될 수 있다. i는 1 이상 HL 이하의 정수일 수 있다.For example, among the W pixels, 2) a starting position pixel in the horizontal line 2nd closest from the target block and pixels whose horizontal positions from the starting position pixel are multiples of α 2 , and 3) a starting position pixel in the horizontal line i th adjacent to the target block A template may be generated including at least one of pixels whose horizontal position from the start position pixel is a multiple of α i . i may be an integer greater than or equal to 1 and less than or equal to HL.

예를 들면, W×H 대상 블록에 인접한 좌측 영역 내의 WL×H 개의 픽셀 중 1) 대상 블록으로부터 1 번째 근접한 세로 라인 내의 시작 위치 픽셀 및 시작 위치 픽셀로부터의 세로 방향의 위치가 β1의 배수인 픽셀들, 2) 대상 블록으로부터 2 번째 근접한 세로 라인 내의 시작 위치 픽셀 및 시작 위치 픽셀로부터의 세로 방향의 위치가 α2의 배수인 픽셀들 및 3) 대상 블록으로부터 i 번째 근접한 세로 라인 내의 시작 위치 픽셀 및 시작 위치 픽셀로부터의 세로 방향의 위치가 βi의 배수인 픽셀들 중 적어도 하나를 포함하여 템플릿이 생성될 수 있다. i는 1 이상 WL 이하의 정수일 수 있다.For example, among the WL pixels, 2) a starting position pixel in the vertical line 2nd closest from the target block and pixels whose vertical positions from the starting position pixel are multiples of α 2 , and 3) a starting position pixel in the vertical line i th adjacent to the target block A template may be generated including at least one of pixels whose vertical position from the start position pixel is a multiple of β i . i may be an integer greater than or equal to 1 and less than or equal to WL.

예를 들면, W×H 대상 블록에 인접한 상좌측 영역 내의 WL×HL 개의 픽셀들 중 1) 대상 블록으로부터 1 번째 근접한 가로 라인 내의 시작 위치 픽셀 및 시작 위치 픽셀로부터의 가로 방향의 위치가 γ1의 배수인 픽셀들, 2) 대상 블록으로부터 2 번째 근접한 가로 라인 내의 시작 위치 픽셀 및 시작 위치 픽셀로부터의 가로 방향의 위치가 γ2의 배수인 픽셀들 및 3) 대상 블록으로부터 i 번째 근접한 주변 가로 라인 내의 시작 위치 픽셀 및 시작 위치 픽셀로부터의 가로 방향의 위치가 γi의 배수인 픽셀들 중 적어도 하나를 포함하여 템플릿이 생성될 수 있다. i는 1 이상 HL 이하의 정수일 수 있다.For example, among the WL pixels that are multiples, 2) pixels in the starting position pixel in the horizontal line 2nd adjacent to the target block and pixels whose horizontal position from the starting position pixel is a multiple of γ 2 , and 3) in the surrounding horizontal line i th adjacent to the target block. A template may be generated including at least one of a start position pixel and pixels whose horizontal positions from the start position pixel are multiples of γ i . i may be an integer greater than or equal to 1 and less than or equal to HL.

예를 들면, W×H 대상 블록 주변에 인접한 영역 내의 WL×HL 개의 픽셀들 중 1) 대상 블록으로부터 1 번째 근접한 세로 라인 내의 시작 위치 픽셀 및 시작 위치 픽셀로부터의 세로 방향의 위치가 δ1의 배수인 픽셀들, 2) 대상 블록으로부터 2 번째 근접한 주변 세로 라인 내의 시작 위치 픽셀 및 시작 위치 픽셀로부터의 세로 방향으로의 위치가 δ2의 배수인 픽셀들 및 3) 대상 블록으로부터 i 번째 근접한 세로 라인 내의 시작 위치 픽셀 및 시작 위치 픽셀로부터의 세로 방향의 위치가 δ의 배수인 픽셀들 중 적어도 하나를 포함하여 템플릿이 생성될 수 있다. i는 1 이상 HL 이하의 정수일 수 있다.For example, among the WL pixels, 2) pixels in the starting position pixel in the 2nd adjacent peripheral vertical line from the target block and pixels whose positions in the vertical direction from the starting position pixel are multiples of δ 2 , and 3) in the vertical line i th adjacent to the target block. A template may be generated including at least one of a start position pixel and pixels whose vertical positions from the start position pixel are multiples of δ. i may be an integer greater than or equal to 1 and less than or equal to HL.

여기에서, αi, βi, γi 및 δi는 H, L, WL 및 HL 중 적어도 하나에 기반하여 결정될 수 있다.Here, α i , β i , γ i and δ i may be determined based on at least one of H, L, WL and HL.

실시예들에서, 라인 내의 시작 위치 픽셀은 라인 내의 픽셀들 중 템플릿의 생성을 위해 사용되는 첫 번째의 픽셀일 수 있다. 라인 내의 시작 위치 픽셀은 라인 내의 템플릿의 생성을 위해 사용되는 픽셀들 중 첫 번째의 픽셀일 수 있다. 라인 내의 시작 위치 픽셀은 라인 내의 템플릿의 생성을 위해 사용되는 픽셀들 중 가장 작은 인덱스를 갖는 픽셀일 수 있다. 인덱스는 가로 위치 또는 세로 위치일 수 있다.In embodiments, the starting position pixel within the line may be the first pixel among the pixels within the line used for creation of the template. The starting position pixel within the line may be the first pixel among pixels used to create the template within the line. The starting position pixel within the line may be the pixel with the smallest index among the pixels used to create the template within the line. The index can be a horizontal or vertical position.

실시예들에서, 라인 내의 첫 번째 위치의 픽셀은 라인 내의 픽셀들 중 첫 번째 픽셀일 수 있다. 수평 라인 내의 첫 번째 위치의 픽셀은 수평 라인 내의 픽셀들 중 최좌측 픽셀일 수 있다. 수평 라인 내의 n 번째 위치의 픽셀은 n-1 n 번째 위치의 픽셀의 우측에 인접한 픽셀일 수 있다. 수직 라인 내의 첫 번째 위치의 픽셀은 수직 라인 내의 픽셀들 중 최상측 픽셀일 수 있다. 수직 라인 내의 n 번째 위치의 픽셀은 n-1 번째 위치의 픽셀의 하측에 인접한 픽셀일 수 있다. n은 2 이상의 정수일 수 있다. 말하자면, 라인 내의 픽셀의 위치는 라인 내에서의 픽셀의 인덱스를 나타낼 수 있다.In embodiments, the pixel at the first position within a line may be the first pixel among the pixels within the line. The pixel at the first position within the horizontal line may be the leftmost pixel among the pixels within the horizontal line. The pixel at the nth position within the horizontal line may be a pixel adjacent to the right of the pixel at the n-1 nth position. The pixel at the first position within the vertical line may be the uppermost pixel among the pixels within the vertical line. The pixel at the nth position within the vertical line may be a pixel adjacent to the lower side of the pixel at the n-1th position. n may be an integer of 2 or more. That is, the position of a pixel within a line may indicate the index of the pixel within the line.

도 26은 일 예에 따른 라인들에 대하여 서로 다른 시작 위치 픽셀들 및 서브샘플링들이 사용되는 템플릿 생성을 나타낸다.Figure 26 shows template creation in which different starting position pixels and subsampling are used for lines according to an example.

예를 들면, 도 26에서 도시된 것과 같이, 8×8 대상 블록에 인접한 상측 영역 내의 8×2 개의 픽셀들 중 1) 대상 블록으로부터 1 번째 근접한 가로 라인 내의 첫 번째 위치의 픽셀 및 첫 번째 위치의 픽셀로부터의 가로 방향의 위치가 2의 배수인 픽셀들, 2) 대상 블록으로부터 2 번째 근접한 주변 가로 라인 내의 두 번째 위치의 픽셀 및 두 번째 위치의 픽셀로부터의 가로 방향의 위치가 2의 배수인 픽셀들 중 적어도 하나를 포함하여 템플릿이 생성될 수 있다.For example, as shown in FIG. 26, among the 8×2 pixels in the upper area adjacent to the 8×8 target block, 1) the pixel at the first position within the horizontal line 1st adjacent to the target block and the pixel at the first position pixels whose horizontal positions from the pixel are multiples of 2, 2) pixels at the second position within the surrounding horizontal line second closest to the target block, and pixels whose horizontal positions from the pixel at the second position are multiples of 2 A template may be created including at least one of the following.

예를 들면, 도 26에서 도시된 것과 같이, 8×8 대상 블록에 인접한 좌측 영역 내의 2×8 개의 픽셀들 중 1) 대상 블록으로부터 1 번째 근접한 세로 라인 내의 첫 번째 위치의 픽셀 및 첫 번째 위치의 픽셀로부터의 세로 방향의 위치가 2의 배수인 픽셀들, 2) 대상 블록으로부터 2 번째 근접한 세로 라인 내의 두 번째 위치의 픽셀 및 두 번째 위치의 픽셀로부터의 세로 방향의 위치가 2의 배수인 픽셀들 중 적어도 하나를 포함하여 템플릿이 생성될 수 있다.For example, as shown in FIG. 26, among the 2×8 pixels in the left area adjacent to the 8×8 target block, 1) the pixel at the first position within the vertical line 1st adjacent to the target block and the pixel at the first position pixels whose vertical positions from the pixel are multiples of 2, 2) pixels at the second position within the vertical line second closest to the target block, and pixels whose vertical positions from the pixel at the second position are multiples of 2 A template may be created including at least one of:

예를 들면, 도 26에서 도시된 것과 같이, 8×8 대상 블록에 인접한 상좌측 영역 내의 2×2 개의 픽셀들 중 1) 대상 블록으로부터 1 번째 근접한 가로 라인 내의 두 번째 위치의 픽셀 및 2) 대상 블록으로부터 2 번째 근접한 가로 라인 내의 첫 번째 위치의 픽셀 중 적어도 하나를 포함하여 템플릿이 생성될 수 있다.For example, as shown in FIG. 26, among the 2×2 pixels in the upper left area adjacent to the 8×8 target block, 1) the pixel at the second position within the horizontal line 1st adjacent to the target block, and 2) the target A template may be generated including at least one of the pixels at the first position within the second adjacent horizontal line from the block.

템플릿의 생성에 있어서의 특정 픽셀의 제외Exclusion of specific pixels from template creation

도 27은 일 예에 따른 대상 블록, 영역들 및 CTU 경계를 나타낸다.Figure 27 shows target blocks, regions, and CTU boundaries according to an example.

대상 블록에 인접한 특정 영역이 특정 경계의 밖에 위치한 경우, 특정 영역 내의 픽셀들은 템플릿을 생성하기 위해 사용되지 않을 수 있다.If a specific area adjacent to the target block is located outside a specific boundary, pixels within the specific area may not be used to generate the template.

예를 들면, 특정 영역은 상좌측 영역 및 상측 영역을 포함할 수 있다.For example, the specific area may include an upper left area and an upper left area.

특정 경계는 실시예들에서 설명된 특정 유닛의 경계일 수 있다. 예를 들면, 특정 유닛은 픽처, 슬라이스, 타일 및 CTU 중 적어도 하나일 수 있다.The specific boundary may be the boundary of a specific unit described in the embodiments. For example, a specific unit may be at least one of a picture, slice, tile, and CTU.

다른 영역은 대상 블록에 인접한 영역들 중 특정 영역 외의 나머지의 영역일 수 있다. 대상 블록에 인접한 다른 영역이 특정 경계의 밖에 위치하더라도, 다른 영역 내의 픽셀들은 템플릿을 생성하기 위해 사용될 수 있다.The other area may be an area other than a specific area among areas adjacent to the target block. Even if other areas adjacent to the target block are located outside the specific boundary, pixels within the other areas can be used to generate the template.

도 27에서 도시된 것과 같이, 대상 블록이 픽처 경계, 슬라이스 경계, 타일 경계 및 CTU 경계 중 적어도 하나에 인접한 경우 경계의 밖의 픽셀은 템플릿으로 활용하지 않을 수 있다.As shown in FIG. 27, when the target block is adjacent to at least one of a picture boundary, a slice boundary, a tile boundary, and a CTU boundary, pixels outside the boundary may not be used as a template.

일 실시예에서, 대상 블록의 상측 주변 픽셀 및 상좌측 주변 픽셀이 CTU의 상측 경계의 밖에 있는 경우 상측 주변 픽셀 및 상좌측 주변 픽셀은 템플릿을 생성하기 위해 사용되지 않을 수 있다. 이 때, 대상 블록의 좌측 주변 픽셀만이 템플릿을 생성하기 위해 사용될 수 있다.In one embodiment, if the top surrounding pixel and top left surrounding pixel of the target block are outside the top border of the CTU, the top surrounding pixel and top left surrounding pixel may not be used to generate the template. At this time, only the left peripheral pixels of the target block can be used to create the template.

대상 블록의 좌측 주변 픽셀이 CTU의 좌측 경계의 밖에 있더라도, 좌측 주변 픽셀을 사용하여 템플릿이 생성될 수 있다.Even if the left peripheral pixel of the target block is outside the left boundary of the CTU, a template can be created using the left peripheral pixel.

예를 들면, 특정 영역은 상좌측 영역, 상측 영역 및 좌측 영역을 포함할 수 있다.For example, the specific area may include an upper left area, an upper area, and a left area.

대상 블록의 상측 주변 픽셀이 CTU의 상측 경계의 밖에 있는 경우의 대상 블록의 상측 인접 템플릿 영역의 세로 크기는 HL_OUTCTU로 정의될 수 있다. 그리고, 대상 블록의 상측 주변 픽셀이 CTU의 상측 경계의 밖에 있지 않은 경우의 대상 블록의 상측 인접 템플릿 영역의 세로 크기는 HL_INCTU로 정의될 수 있다. 이 때, HL_OUTCTU는 HL_INCTU보다 더 작을 수 있다. HL_OUTCTU 및 HL_INCTU의 각각은 0 이상의 정수일 수 있다.When the upper neighboring pixels of the target block are outside the upper boundary of the CTU, the vertical size of the upper adjacent template area of the target block may be defined as HL_OUTCTU. In addition, when the upper neighboring pixels of the target block are not outside the upper border of the CTU, the vertical size of the upper adjacent template area of the target block may be defined as HL_INCTU. At this time, HL_OUTCTU may be smaller than HL_INCTU. Each of HL_OUTCTU and HL_INCTU may be an integer greater than or equal to 0.

템플릿의 상측 영역 내의 HL_OUTCTU에 포함되는 픽셀은 템플릿을 생성함에 있어서 제외될 수 있다. 템플릿의 상측 영역 내의 HL_INCTU에 포함되는 픽셀은 템플릿을 생성함에 있어서 포함될 수 있다. 여기에서, 픽셀은 움직임 벡터, 인트라 에측 모드 및 코딩 파라미터와 같은 픽셀의 정보를 의미할 수 있다.Pixels included in HL_OUTCTU in the upper area of the template may be excluded when creating the template. Pixels included in HL_INCTU in the upper area of the template may be included when creating the template. Here, pixel may mean pixel information such as motion vector, intra prediction mode, and coding parameters.

대상 블록의 좌측 주변 픽셀이 CTU의 좌측 경계의 밖에 있는 경우의 대상 블록의 좌측 인접 템플릿 영역의 가로 크기는 WL_OUTCTU로 정의될 수 있다. 그리고, 대상 블록의 좌측 주변 픽셀이 CTU의 좌측 경계의 밖에 있지 않은 경우의 대상 블록의 좌측 인접 템플릿 영역의 가로 크기는 WL_INCTU로 정의될 수 있다. 이 때, WL_OUTCTU는 WL_INCTU보다 더 작을 수 있다. WL_OUTCTU 및 WL_INCTU의 각각은 0 이상의 정수일 수 있다.When the left peripheral pixel of the target block is outside the left border of the CTU, the horizontal size of the left adjacent template area of the target block can be defined as WL_OUTCTU. In addition, when the left peripheral pixel of the target block is not outside the left boundary of the CTU, the horizontal size of the left adjacent template area of the target block can be defined as WL_INCTU. At this time, WL_OUTCTU may be smaller than WL_INCTU. Each of WL_OUTCTU and WL_INCTU may be an integer greater than or equal to 0.

템플릿의 좌측 영역 내의 WL_OUTCTU에 포함되는 픽셀은 템플릿을 생성함에 있어서 제외될 수 있다. 템플릿의 좌측 영역 내의 WL_INCTU에 포함되는 픽셀은 템플릿을 생성함에 있어서 포함될 수 있다. 여기에서, 픽셀은 움직임 벡터, 인트라 에측 모드 및 코딩 파라미터와 같은 픽셀의 정보를 의미할 수 있다.Pixels included in WL_OUTCTU in the left area of the template may be excluded when creating the template. Pixels included in WL_INCTU in the left area of the template may be included when creating the template. Here, pixel may mean pixel information such as motion vector, intra prediction mode, and coding parameters.

복수의 템플릿 모양들Multiple template shapes

도 28은 일 예에 따른 대상 블록의 영역들을 나타낸다.Figure 28 shows areas of a target block according to an example.

도 29a 내지 도 29g는 일 예에 다른 대상 블록의 복수의 템플릿들을 나타낸다.FIGS. 29A to 29G show a plurality of templates of different target blocks as an example.

도 29a는 일 예에 따른 제1 템플릿의 구성을 나타낸다.Figure 29a shows the configuration of a first template according to an example.

도 29b는 일 예에 따른 제2 템플릿의 구성을 나타낸다.Figure 29b shows the configuration of a second template according to an example.

도 29c는 일 예에 따른 제3 템플릿의 구성을 나타낸다.Figure 29c shows the configuration of a third template according to an example.

도 29d는 일 예에 따른 제4 템플릿의 구성을 나타낸다.Figure 29D shows the configuration of a fourth template according to an example.

도 29e는 일 예에 따른 제5 템플릿의 구성을 나타낸다.Figure 29e shows the configuration of a fifth template according to an example.

도 29f는 일 예에 따른 제6 템플릿의 구성을 나타낸다.Figure 29f shows the configuration of a sixth template according to an example.

도 29g는 일 예에 따른 제7 템플릿의 구성을 나타낸다.Figure 29g shows the configuration of a seventh template according to an example.

대상 블록의 주변 픽셀을 이용하여 복수의 템플릿들이 생성될 수 있다. 가용한 복수의 템플릿들 중 어떤 템플릿을 사용되었는지를 나타내는 템플릿 식별 정보가 코딩 정보로서 시그널링될 수 있다. 처리부는 템플릿 식별 정보를 사용하여 복수의 템플릿들 중 부호화/복호화에 사용되는 템플릿을 식별할 수 있다.A plurality of templates may be created using surrounding pixels of the target block. Template identification information indicating which template is used among a plurality of available templates may be signaled as coding information. The processing unit may use template identification information to identify a template used for encoding/decoding among a plurality of templates.

대상 블록의 주변 픽셀을 이용하여, 템플릿의 모양에 따라, 복수의 템플릿들이 생성될 수 있다. 가용한 모양들 중 어떤 모양을 갖는 템플릿을 사용되는지를 나타내는 템플릿 모양 식별 정보가 코딩 정보로서 시그널링될 수 있다. 처리부는 템플릿 모양 식별 정보를 사용하여 서로 다른 모양들을 각각 갖는 복수의 템플릿들 중 부호화/복호화에 사용되는 템플릿을 식별할 수 있다.A plurality of templates may be created according to the shape of the template using surrounding pixels of the target block. Template shape identification information indicating which template shape among available shapes is used may be signaled as coding information. The processing unit may use the template shape identification information to identify a template used for encoding/decoding among a plurality of templates each having different shapes.

도 28에 도시된 것과 같은, 대상 블록에 인접한 상좌측 영역, 상측 영역 및 좌측 영역 중 적어도 하나를 이용하여 복수의 템플릿들이 각각 생성될 수 있다. 상좌측 영역, 상측 영역 및 좌측 영역의 각각은 특정 크기를 가질 수 있다.As shown in FIG. 28, a plurality of templates may each be created using at least one of the upper left area, upper area, and left area adjacent to the target block. Each of the upper left area, top area, and left area may have a specific size.

가용한 복수의 템플릿들은 제1 템플릿, 제2 템플릿, 제3 템플릿, 제4 템플릿, 제5 템플릿, 제6 템플릿 및 제7 템플릿 중 하나 이상을 포함할 수 있다.The plurality of available templates may include one or more of a first template, a second template, a third template, a fourth template, a fifth template, a sixth template, and a seventh template.

도 29a에서 도시된 것과 같이, 제1 템플릿은 상좌측 영역, 상측 영역 및 좌측 영역을 이용하여 생성될 수 있다.As shown in FIG. 29A, the first template can be created using the upper left area, upper area, and left area.

도 29b에서 도시된 것과 같이, 제2 템플릿은 상좌측 영역을 이용하여 생성될 수 있다.As shown in FIG. 29B, the second template can be created using the upper left area.

도 29c에서 도시된 것과 같이, 제3 템플릿은 상좌측 영역 및 상층 영역을 이용하여 생성될 수 있다.As shown in FIG. 29C, the third template can be created using the upper left area and the upper layer area.

도 29d에서 도시된 것과 같이, 제4 템플릿은 상좌측 영역 및 좌측 영역을 이용하여 생성될 수 있다.As shown in FIG. 29D, the fourth template can be created using the upper left area and the left area.

도 29e에서 도시된 것과 같이, 제5 템플릿은 상측 영역을 이용하여 생성될 수 있다.As shown in FIG. 29E, the fifth template can be created using the upper area.

도 29f에서 도시된 것과 같이, 제6 템플릿은 좌측 영역을 이용하여 생성될 수 있다.As shown in FIG. 29f, the sixth template can be created using the left area.

도 29g에서 도시된 것과 같이, 제7 템플릿은 상측 영역 및 좌측 영역을 이용하여 생성될 수 있다.As shown in FIG. 29g, the seventh template can be created using the upper area and the left area.

템플릿에 대한 복수의 서브샘플링들Multiple subsamplings for a template

도 30은 일 예에 따른 대상 블록의 영역들의 샘플들을 나타낸다.Figure 30 shows samples of areas of a target block according to an example.

도 31a는 일 예에 따른 제1 템플릿을 위한 샘플들을 나타낸다.31A shows samples for a first template according to an example.

도 31b는 일 예에 따른 제2 템플릿을 위한 샘플들을 나타낸다.31B shows samples for a second template according to one example.

도 31c는 일 예에 따른 제3 템플릿을 위한 샘플들을 나타낸다.Figure 31C shows samples for a third template according to an example.

및 대상 블록의 주변 픽셀을 이용하는 서브샘플링에 의해 복수의 템플릿들이 생성될 수 있다. 가용한 서브샘플링들 중 어떤 서브샘플링이 적용된 템플릿을 사용되는지를 나타내는 템플릿 서브샘플링 식별 정보가 코딩 정보로서 시그널링될 수 있다. 처리부는 템플릿 서브샘플링 식별 정보를 사용하여 서로 다른 서브샘플링들이 각각 적용된 복수의 템플릿들 중 부호화/복호화에 사용되는 템플릿을 식별할 수 있다. And a plurality of templates may be generated by subsampling using surrounding pixels of the target block. Template subsampling identification information indicating which template to which subsampling is applied among available subsamplings is used may be signaled as coding information. The processing unit may use template subsampling identification information to identify a template used for encoding/decoding among a plurality of templates to which different subsamplings are applied.

템플릿은 대상 블록에 인접한 상좌측 영역, 상측 영역 및 좌측 영역 중 적어도 하나를 포함하도록 구성된 모양을 가질 수 있다.The template may have a shape configured to include at least one of an upper left area, an upper area, and a left area adjacent to the target block.

실시예들에서, 템플릿의 모양은 템플릿의 영역을 의미할 수 있다.In embodiments, the shape of the template may refer to the area of the template.

템플릿의 모양에 속하는 모든 픽셀들 이용하여 제1 템플릿이 생성될 수 있다.A first template can be created using all pixels belonging to the shape of the template.

템플릿의 모양에 속하는 픽셀들 중 제1 부분 픽셀들을 이용하여 제2 템플릿이 생성될 수 있다. 제1 부분 픽셀들은 전체의 픽셀들 중 일부일 수 있다.A second template may be created using first partial pixels among pixels belonging to the shape of the template. The first partial pixels may be some of the total pixels.

템플릿의 모양에 속하는 픽셀들 중 제2 부분 픽셀들을 이용하여 제3 템플릿이 생성될 수 있다. 제2 부분 픽셀들은 전체의 픽셀들 중 일부일 수 있다.A third template may be created using second partial pixels among pixels belonging to the shape of the template. The second partial pixels may be some of the total pixels.

제1 부분 픽셀들 및 제2 부분 픽셀들은 다를 수 있다.The first partial pixels and second partial pixels may be different.

도 30에서 도시된 것과 같이, 템플릿은 대상 블록에 인접한 상좌측 영역, 상측 영역 및 좌측 영역 중 적어도 하나를 포함하도록 구성된 모양을 가질 수 있다.As shown in FIG. 30, the template may have a shape configured to include at least one of an upper left area, an upper area, and a left area adjacent to the target block.

도 31a에서 도시된 것과 같이, 템플릿의 모양에 속하는 모든 픽셀들 이용하여 제1 템플릿이 생성될 수 있다. 제1 템플릿은 템플릿의 모양에 속하는 모든 픽셀들을 포함할 수 있다.As shown in FIG. 31A, a first template can be created using all pixels belonging to the shape of the template. The first template may include all pixels belonging to the shape of the template.

도 31b에서 도시된 것과 같이, 템플릿의 모양에 속하는 픽셀들 중 제1 부분 픽셀들을 이용하여 제2 템플릿이 생성될 수 있다. 제2 템플릿은 제1 부분 픽셀들을 포함할 수 있다.As shown in FIG. 31B, a second template may be created using first partial pixels among pixels belonging to the shape of the template. The second template may include first partial pixels.

제1 부분 픽셀들은 픽셀들-쌍(pixels-pair)들로부터 선택된 픽셀들일 수 있다.The first partial pixels may be pixels selected from pixels-pairs.

실시예들에서, 픽셀들-쌍은 인접한 2 개의 픽셀들일 수 있다. 픽셀들-쌍은 상좌측 영역 내의 가로 라인 또는 세로 라인 내의 2n-1 번째 픽셀 및 2n 번째 픽셀일 수 있다. 픽셀들-쌍은 상측 영역 내의 가로 라인 내의 2n-1 번째 픽셀 및 2n 번째 픽셀일 수 있다. 픽셀들-쌍은 좌측 영역 내의 세로 라인 내의 2n-1 번째 픽셀 및 2n 번째 픽셀일 수 있다. n은 1 이상의 정수일 수 있다.In embodiments, a pixel-pair may be two adjacent pixels. The pixel-pair may be the 2n-1th pixel and the 2nth pixel in the horizontal line or vertical line in the upper left area. The pixel-pair may be the 2n-1th pixel and the 2nth pixel in the horizontal line in the upper region. The pixel-pair may be the 2n-1th pixel and the 2nth pixel in the vertical line in the left area. n may be an integer greater than or equal to 1.

예를 들면, 제1 부분 픽셀들은 1) 상좌측 영역 내의 가로 라인 내의 2n 번째 픽셀들, 2) 상측 영역 내의 가로 라인 내의 2n-1 번째 픽셀들 및 3) 좌측 영역 내의 세로 라인 내의 2n-1 번째 픽셀들을 포함할 수 있다. n은 1 이상의 정수일 수 있다.For example, the first partial pixels are 1) the 2nth pixels in the horizontal line in the upper left area, 2) the 2n-1th pixels in the horizontal line in the upper left area, and 3) the 2n-1th pixels in the vertical line in the upper left area. May contain pixels. n may be an integer greater than or equal to 1.

도 31c에서 도시된 것과 같이, 템플릿의 모양에 속하는 픽셀들 중 제2 부분 픽셀들을 이용하여 제3 템플릿이 생성될 수 있다. 제3 템플릿은 제2 부분 픽셀들을 포함할 수 있다.As shown in FIG. 31C, a third template may be created using second partial pixels among pixels belonging to the shape of the template. The third template may include second partial pixels.

제2 부분 픽셀들은 픽셀들-쌍(pixels-pair)들로부터 선택된 픽셀들일 수 있다.The second partial pixels may be pixels selected from pixels-pairs.

예를 들면, 제2 부분 픽셀들은 1) 상좌측 영역 내의 대상 블록으로 2m-1 번째 근접한 가로 라인 내의 2n 번째 픽셀들, 2) 상좌측 영역 내의 대상 블록으로 2m 번째 근접한 가로 라인 내의 2n-1 번째 픽셀들, 3) 상측 영역 내의 대상 블록으로 2m-1 번째 근접한 가로 라인 내의 2n-1 번째 픽셀들, 4) 상측 영역 내의 대상 블록으로 2m 번째 근접한 가로 라인 내의 2n 번째 픽셀들, 5) 좌측 영역 내의 대상 블록으로 2m-1 번째 근접한 세로 라인 내의 2n-1 번째 픽셀들 및 6) 좌측 영역 내의 대상 블록으로 2m 번째 근접한 세로 라인 내의 2n 번째 픽셀들을 포함할 수 있다. m은 1 이상의 정수일 수 있다. n은 1 이상의 정수일 수 있다.For example, the second partial pixels are 1) the 2n-th pixels in the horizontal line 2m-1th adjacent to the target block in the upper left area, 2) the 2n-1th pixels in the horizontal line 2m-th adjacent to the target block in the upper left area. pixels, 3) 2n-1th pixels in the horizontal line 2m-1th adjacent to the target block in the upper area, 4) 2nth pixels in the horizontal line 2m-th adjacent to the target block in the upper area, 5) in the left area It may include 2n-1th pixels in a vertical line 2m-1th adjacent to the target block, and 6) 2nth pixels in a vertical line 2m-th adjacent to the target block in the left area. m may be an integer of 1 or more. n may be an integer greater than or equal to 1.

도 28을 참조하여 설명된 실시예 및 도 29를 참조하여 설명된 실시예는 결합될 수 있다.The embodiment described with reference to FIG. 28 and the embodiment described with reference to FIG. 29 may be combined.

대상 블록의 주변 픽셀들을 이용하여, 템플릿의 모양들 및 템플릿에 적용되는 서브샘플링들에 따라서, 복수의 템플릿들이 생성될 수 있다. 말하자면, 가용한 복수의 템플릿들의 모양들 및 서브샘플링들은 서로 다를 수 있다.Using surrounding pixels of the target block, a plurality of templates may be created according to the shapes of the template and subsampling applied to the template. That is, the shapes and subsamplings of the plurality of available templates may be different.

템플릿 식별 정보는 실시예들의 모양들 및 실시예들의 서브샘플링들 중에서 템플릿을 위해 사용되는 모양 및 서브샘플링을 나타낼 수 있다.The template identification information may indicate the shape and subsampling used for the template among the shapes of the embodiments and the subsamplings of the embodiments.

복수의 템플릿들 중 하나를 지시하는 인덱스의 시그널링Signaling of an index indicating one of multiple templates

도 32는 일 예에 따른 템플릿을 가리키는 인덱스를 나타내는 표이다.Figure 32 is a table showing indices indicating templates according to an example.

템플릿 식별 정보, 템플릿 모양 식별 정보 및 템플릿 서브샘플링 식별 정보는 인덱스로서 시그널링될 수 있다.Template identification information, template shape identification information, and template subsampling identification information may be signaled as an index.

도 32에서 도시된 것과 같이, 대상 블록의 주변 픽셀을 이용하여 N 개의 템플릿들이 생성될 수 있으며, N 개의 템플릿들 중 어떤 템플릿이 사용되는지를 나타내는 인덱스인 template_idx가 시그널링될 수 있다.As shown in FIG. 32, N templates can be created using surrounding pixels of the target block, and template_idx, an index indicating which template among the N templates is used, can be signaled.

예를 들면, template_idx가 0인 경우, 제1 템플릿을 이용하여 부호화/복호화된다는 것이 시그널링될 수 있다.For example, if template_idx is 0, it may be signaled that encoding/decoding is performed using the first template.

예를 들면, template_idx가 1인 경우, 제2 템플릿을 이용하여 부호화/복호화된다는 것이 시그널링될 수 있다.For example, if template_idx is 1, it may be signaled that encoding/decoding is performed using the second template.

예를 들면, template_idx가 i인 경우, 제i+1 템플릿을 이용하여 부호화/복호화된다는 것이 시그널링될 수 있다. i는 0 이상 N-1 이하의 정수일 수 있다.For example, if template_idx is i, it may be signaled that encoding/decoding is performed using the i+1th template. i may be an integer between 0 and N-1.

예를 들면, template_idx가 N-1인 경우, 제N 템플릿을 이용하여 부호화/복호화된다는 것이 시그널링될 수 있다.For example, if template_idx is N-1, it may be signaled that encoding/decoding is performed using the N-th template.

일 실시예에서, 특정 상위 구문 요소(high-level syntax element)에 허용되는 총 템플릿들의 개수(말하자면, 도 32의 표의 N)를 나타내는 정보인 num_of_templates가 시그널링될 수 있다. 특정 상위 구문 요소는 실시예들에서 설명된 구문 요소, 유닛 및 코딩 정보를 포함할 수 있다. 예를 들면, 특정 상위 구문 요소는 시퀀스 파라미터(sequence parameter), 픽처(picture parameter) 및 슬라이스 헤더(slice header) 등 중 적어도 하나를 포함할 수 있다.In one embodiment, num_of_templates, which is information indicating the total number of templates allowed for a specific high-level syntax element (i.e., N in the table of FIG. 32), may be signaled. Specific high-level syntax elements may include syntax elements, units, and coding information described in the embodiments. For example, a specific high-level syntax element may include at least one of a sequence parameter, a picture parameter, and a slice header.

또는, num_of_templates는 "특정 상위 구문 요소(high-level syntax element)에 허용되는 총 템플릿들의 개수 - 1"(말하자면, 도 32의 표의 N-1)를 나타낼 수도 있다.Alternatively, num_of_templates may represent “the total number of templates allowed for a specific high-level syntax element - 1” (i.e., N-1 in the table of FIG. 32).

패딩을 사용하는 템플릿의 생성Creating a template with padding

도 33은 일 예에 따른 패딩을 사용하는 템플릿의 생성을 나타낸다.Figure 33 shows the creation of a template using padding according to an example.

대상 블록의 템플릿에 속한 픽셀이 특정 경계의 밖에 위치하거나 특정 모드로 부호화/복호화된 경우 템플릿에 속한 픽셀이 활용가능하지 않을 수 있다.If a pixel belonging to the template of the target block is located outside a specific boundary or is encoded/decoded in a specific mode, the pixel belonging to the template may not be usable.

특정 경계는 실시예들에서 설명된 특정 유닛의 경계일 수 있다. 예를 들면, 특정 유닛은 픽처, 슬라이스, 타일 및 CTU 중 적어도 하나일 수 있다.The specific boundary may be the boundary of a specific unit described in the embodiments. For example, a specific unit may be at least one of a picture, slice, tile, and CTU.

특정 모드는 인트라 모드 및 인터 모드 중 적어도 하나일 수 있다.The specific mode may be at least one of intra mode and inter mode.

이러한 활용가능하지 않은 픽셀을 비유효(invalid) 픽셀로 칭할 수 있다.These unusable pixels may be referred to as invalid pixels.

템플릿에 속한 픽셀이 활용가능하지 않은 경우 패딩을 사용하여 템플릿을 생성할 수 있다.If the pixels belonging to the template are not available, you can create a template using padding.

실시예들에서, 패딩은 패딩을 위해 사용되는 참조 픽셀이, 비유효 픽셀을 대체하여, 템플릿을 생성하기 위해 사용되는 것을 의미할 수 있다. 패딩에 의해 참조 픽셀의 정보가 비유효 픽셀의 정보로서 사용될 수 있다.In embodiments, padding may mean that reference pixels used for padding are used to create a template, replacing invalid pixels. By padding, information on reference pixels can be used as information on invalid pixels.

템플릿 내에 비유효 픽셀이 존재하는 경우, 도 33에서 도시된 것과 같이, 비유효 픽셀에 대한 패딩이 수행될 수 있다.If invalid pixels exist in the template, padding may be performed on the invalid pixels, as shown in FIG. 33.

(1) 대상 블록으로 첫 번째 근접한 대상 라인 내의 비유효 픽셀에 대하여, 대상 블록으로 첫 번째 근접한 참조 라인 내의 상기의 비유효 픽셀에 가장 가까운 참조 픽셀을 사용하는 패딩이 수행될 수 있다. 예를 들면, 상기의 비유효 픽셀에 가장 가까운 참조 픽셀은 도 33의 R1일 수 있다.(1) For an invalid pixel in the target line that is first adjacent to the target block, padding may be performed using the reference pixel closest to the invalid pixel in the reference line that is first adjacent to the target block. For example, the reference pixel closest to the invalid pixel may be R 1 in FIG. 33 .

대상 라인은 패딩이 적용되는 비유효 픽셀을 포함하는 라인을 나타낼 수 있다. 대상 라인은 상좌측 영역, 상측 영역 또는 좌측 영역 내의 라인일 수 있다.The target line may represent a line containing invalid pixels to which padding is applied. The target line may be a line in the upper left area, upper area, or left area.

예를 들면, 참조 라인은 패딩을 위해 사용되는 참조 픽셀을 포함하는 라인을 나타낼 수 있다. 참조 라인은 상좌측 영역 내의 수평/수직 라인, 상측 영역 내의 수평 라인 및 좌측 영역 내의 수직 라인을 포함할 수 있다. i 번째 근접한 참조 라인은 상좌측 영역 내의 i 번째 근접한 수평/수직 라인, 상측 영역 내의 i 번째 근접한 수평 라인 및 좌측 영역 내의 i 번째 근접한 수적 라인을 포함할 수 있다.For example, a reference line may represent a line containing reference pixels used for padding. The reference line may include a horizontal/vertical line in the upper left area, a horizontal line in the upper left area, and a vertical line in the left area. The i th proximate reference line may include the i th proximate horizontal/vertical line in the upper left area, the i th proximate horizontal line in the upper left area, and the i th proximate numerical line in the left area.

예를 들면, i 번째 근접한 대상 라인은 대상 블록으로부터의 거리가 i인 픽셀들을 나타낼 수 있다.For example, the i-th adjacent target line may represent pixels whose distance from the target block is i.

예를 들면, i 번째 근접한 참조 라인은 대상 블록으로부터의 거리가 i인 픽셀들을 나타낼 수 있다.For example, the i-th adjacent reference line may represent pixels whose distance from the target block is i.

실시예들에서, 픽셀 및 대상 블록 간의 거리는 1) 픽셀 및 대상 블록 간의 가로 거리 및 2) 픽셀 및 대상 블록 간의 세로 거리 중 더 큰 값일 수 있다. 또는, 픽셀 및 대상 블록 간의 거리는 픽셀 및 대상 블록 간의 최단 직선의 가로 길이 및 세로 길이 중 더 큰 값일 수 있다.In embodiments, the distance between a pixel and the target block may be the larger of 1) the horizontal distance between the pixel and the target block and 2) the vertical distance between the pixel and the target block. Alternatively, the distance between the pixel and the target block may be the larger of the horizontal length and vertical length of the shortest straight line between the pixel and the target block.

(1) 대상 블록으로 i 번째 근접한 대상 라인 내의 비유효 픽셀에 대하여, 대상 블록으로 i 번째 근접한 참조 라인 내의 상기의 비유효 픽셀에 가장 가까운 참조 픽셀을 사용하는 패딩이 수행될 수 있다. 예를 들면, i가 2일 때, 상기의 비유효 픽셀에 가장 가까운 참조 픽셀은 도 33의 R2일 수 있다.(1) For an invalid pixel in the i-th adjacent target line to the target block, padding may be performed using the reference pixel closest to the invalid pixel in the i-th adjacent reference line to the target block. For example, when i is 2, the reference pixel closest to the invalid pixel may be R 2 in FIG. 33.

템플릿에 대한 플리핑(flipping)Flipping templates

도 34a는 일 예에 따른 플리핑이 적용되기 전의 템플릿을 나타낸다.Figure 34a shows a template before flipping is applied according to an example.

도 34b는 일 예에 따른 플리핑이 적용된 후의 템플릿을 나타낸다.Figure 34b shows a template after flipping is applied according to an example.

템플릿의 특정 영역에 대하여 특정 플리핑이 적용될 수 있다. 특정 플리핑은 좌우 대칭의 플리핑 및 상하 대칭의 플리핑을 포함할 수 있다.Specific flipping may be applied to specific areas of the template. Specific flipping may include left-right symmetrical flipping and vertically symmetrical flipping.

예를 들면, 대상 블록의 템플릿의 상측 영역에 대하여 좌우 대칭의 플리핑을 적용함으로써 템플릿이 생성될 수 있다.For example, a template can be created by applying left-right symmetrical flipping to the upper area of the template of the target block.

예를 들면, 대상 블록의 템플릿의 좌측 영역에 대하여 상하 대칭의 플리핑을 적용함으로써 템플릿이 생성될 수 있다.For example, a template can be created by applying vertically symmetrical flipping to the left area of the template of the target block.

도 34a에서 도시된 것과 같이, 대상 블록, 템플릿의 상측 영역, 템플릿의 좌측 영역이 존재할 때, 상측 영역의 샘플들에 대한 좌우 대칭의 플리핑 및 좌측 영역의 샘플들에 대한 상하 대칭의 플리핑을 적용함으로써 도 34b에서 도시된 것과 같은 플리핑이 적용된 템플릿이 생성될 수 있다.As shown in Figure 34a, when there is a target block, an upper area of the template, and an area to the left of the template, left-right symmetrical flipping of the samples in the upper area and vertically symmetrical flipping of the samples in the left area are performed. By applying this, a template to which flipping is applied as shown in FIG. 34B can be created.

구문 요소 template_vertical_flipping는 대상 블록의 상측 영역에 대하여 좌우 대칭의 플리핑이 적용되는지 여부를 나타낼 수 있다. 대상 블록의 상측 영역에 대하여 좌우 대칭의 플리핑을 사용하여 템플릿을 생성되는지 여부를 알리기 위해 template_vertical_flipping이 시그널링될 수 있다.The syntax element template_vertical_flipping may indicate whether left-right symmetrical flipping is applied to the upper area of the target block. template_vertical_flipping may be signaled to indicate whether a template is created using left-right symmetrical flipping for the upper area of the target block.

예를 들면, template_vertical_flipping이 제1 값인 경우, 대상 블록의 상측 영역에 대하여 좌우 대칭의 플리핑을 적용함으로써 템플릿이 생성될 수 있다. template_vertical_flipping이 제2 값인 경우 대상 블록의 상측 영역을 그대로 사용하여 템플릿이 생성될 수 있다.(즉, 상측 영역에 대하여 플리핑이 적용되지 않을 수 있다.)For example, when template_vertical_flipping is the first value, a template can be created by applying left-right symmetrical flipping to the upper area of the target block. If template_vertical_flipping is the second value, a template can be created using the upper area of the target block as is (that is, flipping may not be applied to the upper area).

구문 요소 template_horizontal_flipping는 대상 블록의 좌측 영역에 대하여 상하 대칭의 플리핑이 적용되는지 여부를 나타낼 수 있다. 대상 블록의 좌측 영역에 대하여 상하 대칭의 플리핑을 사용하여 템플릿이 생성되는지 여부를 알리기 위해 template_horizontal_flipping이 시그널링될 수 있다.The syntax element template_horizontal_flipping may indicate whether vertically symmetrical flipping is applied to the left area of the target block. template_horizontal_flipping may be signaled to indicate whether a template is created using vertically symmetrical flipping for the left area of the target block.

예를 들면, template_horizontal_flipping이 제1 값인 경우, 대상 블록의 좌측 영역에 대하여 상하 대칭의 플리핑을 적용함으로써 템플릿이 생성될 수 있다. template_horizontal_flipping이 제2 값인 경우 대상 블록의 좌측 영역을 그대로 사용하여 템플릿이 생성될 수 있다.(즉, 좌측 영역에 대하여 플리핑이 적용되지 않을 수 있다.)For example, when template_horizontal_flipping is the first value, a template can be created by applying vertically symmetrical flipping to the left area of the target block. If template_horizontal_flipping is the second value, a template can be created using the left area of the target block as is (i.e., flipping may not be applied to the left area).

구문 요소 template_flipping_flag는 대상 블록의 주변 샘플들에 대하여 플리핑이 적용되는지 여부를 나타낼 수 있다. 대상 블록의 주변 샘플들에 대하여 플리핑을 사용하여 템플릿을 생성되는지 여부를 알리기 위해 template_flipping_flag이 시그널링될 수 있다.The syntax element template_flipping_flag may indicate whether flipping is applied to surrounding samples of the target block. template_flipping_flag may be signaled to indicate whether a template is generated using flipping for surrounding samples of the target block.

예를 들면, template_flipping_flag이 제1 값인 경우, 대상 블록의 주변 샘플들에 대하여 플리핑을 적용함으로써 템플릿이 생성될 수 있다. template_flipping_flag이 제2 값인 경우 대상 블록의 주변 샘플들을 그대로 사용하여 템플릿이 생성될 수 있다.(즉, 주변 샘플들에 대하여 플리핑이 적용되지 않을 수 있다.)For example, when template_flipping_flag is the first value, a template can be created by applying flipping to samples surrounding the target block. If template_flipping_flag is the second value, a template can be created using the surrounding samples of the target block as is (that is, flipping may not be applied to the surrounding samples).

template_flipping_flag이 제1 값인 경우, 수평 대칭의 플리핑 및 수직 대칭의 플리핑 중 하나를 가리키는 구문 요소 template_flipping_vertical_flag가 시그널링될 수 있다.When template_flipping_flag is the first value, a syntax element template_flipping_vertical_flag indicating one of horizontally symmetric flipping and vertically symmetrical flipping may be signaled.

예를 들면, template_flipping_flag이 제1 값인 경우, template_flipping_vertical_flag가 시그널링될 수 있다. template_flipping_vertical_flag이 제1 값인 것은 상측 영역에 대한 좌우 대칭의 플리핑이 적용됨을 지시할 수 있다. template_flipping_vertical_flag이 제2 값인 것은 좌측 영역에 대한 상하 대칭의 플리핑이 적용됨을 지시할 수 있다.For example, if template_flipping_flag is the first value, template_flipping_vertical_flag may be signaled. The fact that template_flipping_vertical_flag is the first value may indicate that left-right symmetrical flipping is applied to the upper area. The second value of template_flipping_vertical_flag may indicate that vertically symmetrical flipping is applied to the left area.

템플릿 매칭 참조 영상 선택Template matching reference image selection

아래에서는 단계(2020)에서의 템플릿 매칭 참조 영상의 선택이 설명된다.Below, the selection of the template matching reference image in step 2020 is described.

템플릿 매칭 참조 영상 리스트 및 인덱스Template matching reference video list and index

템플릿 매칭 참조 영상은 템플릿 매칭을 이용하는 예측에서 참조되는 영상일 수 있다.The template matching reference image may be an image referenced in prediction using template matching.

템플릿 매칭 참조 영상은 묵시적 또는 명시적으로 결정 및 시그널링될 수 있다.The template matching reference image can be determined and signaled implicitly or explicitly.

템플릿 매칭 참조 영상을 포함하는 리스트를 구성될 수 있다. 템플릿 매칭 참조 영상 리스트(= template_matching_ref_list)는 템플릿 매칭 참조 영상을 포함하는 리스트일 수 있다.A list containing template matching reference images may be constructed. The template matching reference video list (= template_matching_ref_list) may be a list containing template matching reference videos.

템플릿 매칭 참조 영상 리스트는 대상 영상, 복호화된 시간적(temporal) 과거 영상, 복호화된 시간적 미래 영상 중 적어도 하나를 포함할 수 있다.The template matching reference image list may include at least one of a target image, a decoded temporal past image, and a decoded temporal future image.

실시예들에서, 대상 영상은 대상 블록을 포함하는 영상일 수 있다. 복호화된 시간적 과거 영상은 대상 영상의 시각(time)보다 더 앞선 시각의 복호화된 영상일 수 있다. 복호화된 시간적 미래 영상은 대상 영상의 시각보다 더 이후의 시각의 복호화된 영상일 수 있다.In embodiments, the target image may be an image including the target block. The decrypted temporally past image may be a decoded image of a time earlier than the time of the target image. The decoded temporal future image may be a decoded image of a later time than the time of the target image.

템플릿 매칭 참조 영상 리스트는 복수의 템플릿 매칭 참조 영상들을 포함할 수 있다. 템플릿 매칭 참조 영상 리스트의 복수의 템플릿 매칭 참조 영상의 각 템플릿 매칭 참조 영상은 고유의 인덱스를 가질 수 있다. 템플릿 매칭 참조 인덱스(= template_matching_ref_idx)는 템플릿 매칭 참조 영상 리스트의 복수의 템플릿 매칭 참조 영상에 대한 인덱스일 수 있다.The template matching reference image list may include a plurality of template matching reference images. Each template matching reference image of the plurality of template matching reference images in the template matching reference image list may have a unique index. The template matching reference index (= template_matching_ref_idx) may be an index for a plurality of template matching reference images in the template matching reference image list.

템플릿 매칭 참조 영상 리스트의 복수의 템플릿 매칭 참조 영상들 중 특정 템플릿 매칭 참조 영상을 지시하기 위해 template_matching_ref_idx가 시그널링될 수 있다.template_matching_ref_idx may be signaled to indicate a specific template matching reference image among a plurality of template matching reference images in the template matching reference image list.

template_matching_ref_idx는 템플릿 매칭 참조 영상 리스트에 속한 템플릿 매칭 참조 영상들 중 대상 블록을 위해 사용되는 템플릿 매칭 참조 영상의 인덱스를 특정할 수 있다.template_matching_ref_idx can specify the index of the template matching reference image used for the target block among the template matching reference images belonging to the template matching reference image list.

복수의 템플릿 매칭 참조 영상 리스트들이 구성될 수 있다. 예를 들면, 복수의 템플릿 매칭 참조 영상 리스트들은 템플릿 매칭 참조 영상 리스트 L0(= template_matching_ref_l0) 및 템플릿 매칭 참조 영상 리스트 L1(= template_matching_ref_l1)를 포함할 수 있다.A plurality of template matching reference image lists may be configured. For example, the plurality of template matching reference image lists may include a template matching reference image list L0 (= template_matching_ref_l0) and a template matching reference image list L1 (= template_matching_ref_l1).

템플릿 매칭 참조 영상 리스트 L0은 대상 영상, 복호화된 시간적 과거 영상, 복호화된 시간적 미래 영상 중 적어도 하나를 포함할 수 있다.The template matching reference image list L0 may include at least one of a target image, a decoded temporal past image, and a decoded temporal future image.

템플릿 매칭 참조 영상 리스트 L0은 복수의 템플릿 매칭 참조 영상들을 포함할 수 있다. 템플릿 매칭 참조 영상 리스트 L0의 복수의 템플릿 매칭 참조 영상의 각 템플릿 매칭 참조 영상은 고유의 인덱스를 가질 수 있다. 템플릿 매칭 참조 인덱스 L0(= template_matching_ref_idx_l0)은 템플릿 매칭 참조 영상 리스트 L0의 복수의 템플릿 매칭 참조 영상에 대한 인덱스일 수 있다.The template matching reference image list L0 may include a plurality of template matching reference images. Each template matching reference image of the plurality of template matching reference images in the template matching reference image list L0 may have a unique index. The template matching reference index L0 (= template_matching_ref_idx_l0) may be an index for a plurality of template matching reference images in the template matching reference image list L0.

템플릿 매칭 참조 영상 리스트 L1은 대상 영상, 복호화된 시간적 과거 영상, 복호화된 시간적 미래 영상 중 적어도 하나를 포함할 수 있다.The template matching reference image list L1 may include at least one of a target image, a decoded temporal past image, and a decoded temporal future image.

템플릿 매칭 참조 영상 리스트 L1은 복수의 템플릿 매칭 참조 영상들을 포함할 수 있다. 템플릿 매칭 참조 영상 리스트 L1의 복수의 템플릿 매칭 참조 영상의 각 템플릿 매칭 참조 영상은 고유의 인덱스를 가질 수 있다. 템플릿 매칭 참조 인덱스 L1(= template_matching_ref_idx_l1)은 템플릿 매칭 참조 영상 리스트 L1의 복수의 템플릿 매칭 참조 영상에 대한 인덱스일 수 있다.The template matching reference image list L1 may include a plurality of template matching reference images. Each template matching reference image of the plurality of template matching reference images in the template matching reference image list L1 may have a unique index. The template matching reference index L1 (= template_matching_ref_idx_l1) may be an index for a plurality of template matching reference images in the template matching reference image list L1.

template_matching_ref_idx_l0 및 template_matching_ref_idx_l1 중 적어도 하나가 시그널링될 수 있다. template_matching_ref_idx_l0는 템플릿 매칭 참조 영상 리스트 L0에 속한 템플릿 매칭 참조 영상들 중 대상 블록을 위해 사용되는 템플릿 매칭 참조 영상의 인덱스를 특정할 수 있다. template_matching_ref_idx_l1은 템플릿 매칭 참조 영상 리스트 L1에 속한 템플릿 매칭 참조 영상들 중 대상 블록을 위해 사용되는 템플릿 매칭 참조 영상의 인덱스를 특정할 수 있다.At least one of template_matching_ref_idx_l0 and template_matching_ref_idx_l1 may be signaled. template_matching_ref_idx_l0 may specify the index of the template matching reference image used for the target block among the template matching reference images belonging to the template matching reference image list L0. template_matching_ref_idx_l1 may specify the index of the template matching reference image used for the target block among the template matching reference images belonging to the template matching reference image list L1.

템플릿 매칭 참조 영상의 선택Selection of template matching reference image

템플릿 매칭 참조 영상을 지시하는 정보가 별도로 시그널링 되지 않은 경우, 특정 방식에 의해 결정되는 영상이 템플릿 매칭 참조 영상으로서 사용될 수 있다. 말하자면, 템플릿 매칭 참조 영상이 특정 방식에 의해 결정되는 영상과 동일할 때, 템플릿 매칭 참조 영상을 지시하는 정보의 시그널링이 생략될 수 있다.If information indicating a template matching reference image is not signaled separately, an image determined by a specific method may be used as a template matching reference image. In other words, when the template matching reference image is the same as the image determined by a specific method, signaling of information indicating the template matching reference image may be omitted.

예를 들면, 템플릿 매칭 참조 영상을 지시하는 정보가 별도로 시그널링 되지 않은 경우, 대상 영상이 템플릿 매칭 참조 영상으로서 사용될 수 있다.For example, if information indicating a template matching reference image is not signaled separately, the target image may be used as a template matching reference image.

예를 들면, 템플릿 매칭 참조 영상을 지시하는 정보가 별도로 시그널링 되지 않은 경우, 템플릿 매칭 참조 영상은 복호화된 영상들 중 대상 영상에 시간적으로 가장 근접한 영상일 수 있다.For example, if information indicating the template matching reference image is not signaled separately, the template matching reference image may be the image that is temporally closest to the target image among the decoded images.

예를 들면, 템플릿 매칭 참조 영상을 지시하는 정보가 별도로 시그널링 되지 않은 경우, 템플릿 매칭 참조 영상은 복호화된 영상들 중 대상 블록에 시간적으로 가장 근접한 과거 영상 및 복호화된 영상들 중 대상 블록에 시간적으로 가장 근접한 미래 영상 중 적어도 하나일 수 있다.For example, if information indicating a template matching reference image is not signaled separately, the template matching reference image is the past image temporally closest to the target block among the decoded images and the past image temporally closest to the target block among the decoded images. This could be at least one of the near-future images.

일 실시예에서, 템플릿 매칭 참조 영상은 코딩 정보에 기반하여 부호화 장치(1600) 및 복호화 장치(1700)에서 기정의된 방식에 의해 결정될 수 있다.In one embodiment, the template matching reference image may be determined by a predefined method in the encoding device 1600 and the decoding device 1700 based on coding information.

예를 들면, 템플릿 매칭 참조 영상은 대상 블록의 코딩 모드에 기반하여 결정될 수 있다.For example, a template matching reference image may be determined based on the coding mode of the target block.

예를 들면, 템플릿 매칭 참조 영상은 대상 블록을 포함하는 슬라이스의 슬라이스 타입에 기반하여 결정될 수 있다.For example, a template matching reference image may be determined based on the slice type of the slice containing the target block.

대상 영상을 포함하는 템플릿 매칭 참조 영상 리스트에 대한 인덱스의 시그널링Signaling of the index to the template matching reference image list containing the target image

도 35는 일 예에 따른 템플릿 매칭 참조 영상 리스트에 속하는 각 후보 템플릿 매칭 참조 영상의 고유 인덱스를 나타낼 수 있다.FIG. 35 may show a unique index of each candidate template matching reference image belonging to a template matching reference image list according to an example.

실시예들에서, P(t)는 t 시점(time point)의 대상 영상을 나타낼 수 있다.In embodiments, P(t) may represent the target image at time point t.

실시예들에서, P(t-n1), P(t-n2) 및 P(t-n3)는 t 시점의 대상 영상에 대한 복호화된 과거 영상들을 나타낼 수 있다. n1, n2 및 n3의 각각은 1 이상의 정수일 수 있다. n1, n2 및 n3는 서로 다를 수 있다. t 시점의 대상 영상에 대한 복호화된 과거 영상은 복호화된 과거 영상으로 약술될 수 있다.In embodiments, P(tn 1 ), P(tn 2 ), and P(tn 3 ) may represent decoded past images for the target image at time t. Each of n 1 , n 2 and n 3 may be an integer of 1 or more. n 1 , n 2 and n 3 may be different from each other. The decoded past image for the target image at time t can be summarized as the decoded past image.

실시예들에서, P(t+n4), P(t+n5) 및 P(t+n6)는 t 시점의 대상 영상에 대한 복호화된 미래 영상들을 나타낼 수 있다. n4, n5 및 n6의 각각은 1 이상의 정수일 수 있다. n4, n5 및 n6는 서로 다를 수 있다. t 시점의 대상 영상에 대한 복호화된 미래 영상은 복호화된 미래 영상으로 약술될 수 있다.In embodiments, P(t+n 4 ), P(t+n 5 ), and P(t+n 6 ) may represent decoded future images of the target image at time t. Each of n 4 , n 5 and n 6 may be an integer of 1 or more. n 4 , n 5 and n 6 may be different from each other. The decrypted future image for the target image at time t can be outlined as the decoded future image.

템플릿 매칭 참조 영상 리스트(= template_matching_ref_list)는 t 시점의 대상 영상, 하나 이상의 복호화된 과거 영상들 및 하나 이상의 복호화된 미래 영상들을 포함하도록 구성될 수 있다.The template matching reference image list (= template_matching_ref_list) may be configured to include a target image at time t, one or more decoded past images, and one or more decoded future images.

여기에서, n1, n2, n3, n4, n5 및 n6의 각각은 기정의된 값을 가질 수 있다. 예를 들면, 아래의 수식 1과 같이 값들이 결정될 수 있다.Here, each of n 1 , n 2 , n 3 , n 4 , n 5 and n 6 may have a predefined value. For example, values can be determined as in Equation 1 below.

[수식 1][Formula 1]

n1 = 1, n2 = 2, n3 = 3, n4 = 1, n5 = 2, n6 = 3n 1 = 1, n 2 = 2, n 3 = 3, n 4 = 1, n 5 = 2, n 6 = 3

템플릿 매칭 참조 영상 리스트(= template_matching_ref_list)는 아래의 수식 2와 같이 구성될 수 있다.The template matching reference video list (= template_matching_ref_list) can be configured as shown in Equation 2 below.

[수식 2][Formula 2]

template_matching_ref_list = {P(t), P(t-n1), P(t+n4), P(t-n2), P(t+n6)}template_matching_ref_list = {P(t), P(tn 1 ), P(t+n 4 ), P(tn 2 ), P(t+n 6 )}

도 35에서 도시된 것과 같이, 템플릿 매칭 참조 영상 리스트에 속하는 각 후보 템플릿 매칭 참조 영상은 고유 인덱스를 가질 수 있다.As shown in FIG. 35, each candidate template matching reference image belonging to the template matching reference image list may have a unique index.

대상 블록의 템플릿 매칭 참조 영상을 지시하는 template_matching_ref_idx가 시그널링될 수 있다.template_matching_ref_idx indicating the template matching reference image of the target block may be signaled.

대상 영상을 포함하지 않는 템플릿 매칭 참조 영상 리스트에 대한 인덱스의 시그널링Signaling of index for template matching reference image list that does not contain target image

도 36은 일 예에 따른 대상 영상을 포함하지 않는 템플릿 매칭 참조 영상 리스트에 속하는 각 후보 템플릿 매칭 참조 영상의 고유 인덱스를 나타낼 수 있다.FIG. 36 may show a unique index of each candidate template matching reference image belonging to a template matching reference image list that does not include the target image according to an example.

템플릿 매칭 참조 영상 리스트(= template_matching_ref_list)는 하나 이상의 복호화된 과거 영상들 및 하나 이상의 복호화된 미래 영상들을 포함하도록 구성될 수 있다. 말하자면, t 시점의 대상 영상은 템플릿 매칭 참조 영상 리스트에 포함되지 않을 수 있다.A template matching reference image list (= template_matching_ref_list) may be configured to include one or more decoded past images and one or more decoded future images. In other words, the target image at time t may not be included in the template matching reference image list.

여기에서, n1, n2, n3, n4, n5 및 n6의 각각은 기정의된 값을 가질 수 있다. 예를 들면, 아래의 수식 3과 같이 값들이 결정될 수 있다.Here, each of n 1 , n 2 , n 3 , n 4 , n 5 and n 6 may have a predefined value. For example, values can be determined as in Equation 3 below.

[수식 3][Formula 3]

n1 = 1, n2 = 2, n3 = 3, n4 = 1, n5 = 2, n6 = 3n 1 = 1, n 2 = 2, n 3 = 3, n 4 = 1, n 5 = 2, n 6 = 3

템플릿 매칭 참조 영상 리스트(= template_matching_ref_list)는 아래의 수식 4와 같이 구성될 수 있다.The template matching reference video list (= template_matching_ref_list) can be configured as shown in Equation 4 below.

[수식 4][Formula 4]

template_matching_ref_list = {P(t-n1), P(t+n4), P(t-n2), P(t+n6)}template_matching_ref_list = {P(tn 1 ), P(t+n 4 ), P(tn 2 ), P(t+n 6 )}

도 36에서 도시된 것과 같이, 템플릿 매칭 참조 영상 리스트에 속하는 각 후보 템플릿 매칭 참조 영상은 고유 인덱스를 가질 수 있다.As shown in FIG. 36, each candidate template matching reference image belonging to the template matching reference image list may have a unique index.

대상 블록의 템플릿 매칭 참조 영상을 지시하는 template_matching_ref_idx가 시그널링될 수 있다.template_matching_ref_idx indicating the template matching reference image of the target block may be signaled.

대상 영상을 포함하는 복수의 템플릿 매칭 참조 영상 리스트들에 대한 인덱스들의 시그널링Signaling of indices for a plurality of template matching reference image lists including the target image

도 37a은 일 예에 따른 템플릿 매칭 참조 영상 리스트 L0에 속하는 각 후보 템플릿 매칭 참조 영상의 고유 인덱스를 나타낼 수 있다.FIG. 37A may represent a unique index of each candidate template matching reference image belonging to the template matching reference image list L0 according to an example.

도 37b는 일 예에 따른 템플릿 매칭 참조 영상 리스트 L1에 속하는 각 후보 템플릿 매칭 참조 영상의 고유 인덱스를 나타낼 수 있다.FIG. 37B may show a unique index of each candidate template matching reference image belonging to the template matching reference image list L1 according to an example.

실시예들에서, 대상 영상을 포함하는 복수의 템플릿 매칭 참조 영상 리스트들은 복수의 템플릿 매칭 참조 영상 리스트들 중 적어도 하나가 대상 영상을 포함한다는 것을 의미할 수 있다.In embodiments, the plurality of template matching reference image lists including the target image may mean that at least one of the plurality of template matching reference image lists includes the target image.

템플릿 매칭 참조 영상 리스트 L0(= template_matching_ref_list_l0) 및 템플릿 매칭 참조 영상 리스트 L1(= template_matching_ref_list_l1)의 각각은 t 시점의 대상 영상, 하나 이상의 복호화된 과거 영상들 및 하나 이상의 복호화된 미래 영상들을 포함하도록 구성될 수 있다.Each of the template matching reference image list L0 (= template_matching_ref_list_l0) and the template matching reference image list L1 (= template_matching_ref_list_l1) may be configured to include a target image at time t, one or more decoded past images, and one or more decoded future images. there is.

여기에서, n1, n2, n3, n4, n5 및 n6의 각각은 기정의된 값을 가질 수 있다. 예를 들면, 아래의 수식 5와 같이 값들이 결정될 수 있다.Here, each of n 1 , n 2 , n 3 , n 4 , n 5 and n 6 may have a predefined value. For example, values can be determined as in Equation 5 below.

[수식 5][Formula 5]

n1 = 1, n2 = 2, n3 = 3, n4 = 1, n5 = 2, n6 = 3n 1 = 1, n 2 = 2, n 3 = 3, n 4 = 1, n 5 = 2, n 6 = 3

템플릿 매칭 참조 영상 리스트 L0(= template_matching_ref_list_l0)은 아래의 수식 6와 같이 구성될 수 있다.The template matching reference video list L0 (= template_matching_ref_list_l0) can be configured as shown in Equation 6 below.

[수식 6][Formula 6]

template_matching_ref_list_l0 = {P(t), P(t-n1), P(t-n2), P(t-n3)}template_matching_ref_list_l0 = {P(t), P(tn 1 ), P(tn 2 ), P(tn 3 )}

템플릿 매칭 참조 영상 리스트 L1(= template_matching_ref_list_l1)은 아래의 수식 7과 같이 구성될 수 있다.The template matching reference video list L1 (= template_matching_ref_list_l1) can be configured as shown in Equation 7 below.

[수식 7][Formula 7]

template_matching_ref_list_l1 = {P(t+n4), P(t+n5), P(t+n6), P(t-n1)}template_matching_ref_list_l1 = {P(t+n 4 ), P(t+n 5 ), P(t+n 6 ), P(tn 1 )}

도 37a 및 도 37b에서 도시된 것과 같이, 템플릿 매칭 참조 영상 리스트 L0 또는 템플릿 매칭 참조 영상 리스트 L1에 속하는 각 후보 템플릿 매칭 참조 영상은 고유 인덱스를 가질 수 있다.As shown in FIGS. 37A and 37B, each candidate template matching reference image belonging to the template matching reference image list L0 or the template matching reference image list L1 may have a unique index.

대상 블록의 템플릿 매칭 참조 영상을 지시하도록, template_matching_ref_idx_l0 및 template_matching_ref_idx_l1 중 적어도 하나가 시그널링될 수 있다.At least one of template_matching_ref_idx_l0 and template_matching_ref_idx_l1 may be signaled to indicate the template matching reference image of the target block.

대상 영상을 포함하지 않는 복수의 템플릿 매칭 참조 영상 리스트들에 대한 인덱스들의 시그널링Signaling of indices for multiple template matching reference image lists that do not include the target image

도 38a은 일 예에 따른 대상 영상을 포함하지 않는 템플릿 매칭 참조 영상 리스트 L0에 속하는 각 후보 템플릿 매칭 참조 영상의 고유 인덱스를 나타낼 수 있다.FIG. 38A may represent a unique index of each candidate template matching reference image belonging to the template matching reference image list L0 that does not include the target image according to an example.

도 38b는 일 예에 따른 대상 영상을 포함하지 않는 템플릿 매칭 참조 영상 리스트 L1에 속하는 각 후보 템플릿 매칭 참조 영상의 고유 인덱스를 나타낼 수 있다.FIG. 38B may represent a unique index of each candidate template matching reference image belonging to the template matching reference image list L1 that does not include the target image according to an example.

실시예들에서, 대상 영상을 포함하지 안는 복수의 템플릿 매칭 참조 영상 리스트들은 복수의 템플릿 매칭 참조 영상 리스트들 중 어떤 템플릿 매칭 참조 영상 리스트에도 대상 영상이 포함되지 않는다는 것을 의미할 수 있다.In embodiments, a plurality of template matching reference image lists that do not include the target image may mean that the target image is not included in any template matching reference image list among the plurality of template matching reference image lists.

템플릿 매칭 참조 영상 리스트 L0(= template_matching_ref_list_l0) 및 템플릿 매칭 참조 영상 리스트 L1(= template_matching_ref_list_l1)의 각각은 하나 이상의 복호화된 과거 영상들 및 하나 이상의 복호화된 미래 영상들을 포함하도록 구성될 수 있다. 말하자면, t 시점의 대상 영상은 템플릿 매칭 참조 영상 리스트 L0에 포함되지 않고, 템플릿 매칭 참조 영상 리스트 L1에 포함되지 않을 수 있다.Each of the template matching reference video list L0 (= template_matching_ref_list_l0) and the template matching reference video list L1 (= template_matching_ref_list_l1) may be configured to include one or more decoded past videos and one or more decoded future videos. In other words, the target image at time t may not be included in the template matching reference image list L0 and may not be included in the template matching reference image list L1.

여기에서, n1, n2, n3, n4, n5 및 n6의 각각은 기정의된 값을 가질 수 있다. 예를 들면, 아래의 수식 8과 같이 값들이 결정될 수 있다.Here, each of n 1 , n 2 , n 3 , n 4 , n 5 and n 6 may have a predefined value. For example, values can be determined as in Equation 8 below.

[수식 8][Formula 8]

n1 = 1, n2 = 2, n3 = 3, n4 = 1, n5 = 2, n6 = 3n 1 = 1, n 2 = 2, n 3 = 3, n 4 = 1, n 5 = 2, n 6 = 3

템플릿 매칭 참조 영상 리스트 L0(= template_matching_ref_list_l0)은 아래의 수식 9와 같이 구성될 수 있다.The template matching reference video list L0 (= template_matching_ref_list_l0) can be configured as shown in Equation 9 below.

[수식 9][Formula 9]

template_matching_ref_list_l0 = {P(t-n1), P(t-n2), P(t-n3), P(t+n4)}template_matching_ref_list_l0 = {P(tn 1 ), P(tn 2 ), P(tn 3 ), P(t+n 4 )}

템플릿 매칭 참조 영상 리스트 L1(= template_matching_ref_list_l1)은 아래의 수식 10과 같이 구성될 수 있다.The template matching reference video list L1 (= template_matching_ref_list_l1) can be configured as in Equation 10 below.

[수식 10][Formula 10]

template_matching_ref_list_l1 = {P(t+n4), P(t+n5), P(t+n6), P(t-n1)}template_matching_ref_list_l1 = {P(t+n 4 ), P(t+n 5 ), P(t+n 6 ), P(tn 1 )}

도 38a 및 도 38b에서 도시된 것과 같이, 템플릿 매칭 참조 영상 리스트 L0 또는 템플릿 매칭 참조 영상 리스트 L1에 속하는 각 후보 템플릿 매칭 참조 영상은 고유 인덱스를 가질 수 있다.As shown in FIGS. 38A and 38B, each candidate template matching reference image belonging to the template matching reference image list L0 or the template matching reference image list L1 may have a unique index.

대상 블록의 템플릿 매칭 참조 영상을 지시하도록, template_matching_ref_idx_l0 및 template_matching_ref_idx_l1 중 적어도 하나가 시그널링될 수 있다.At least one of template_matching_ref_idx_l0 and template_matching_ref_idx_l1 may be signaled to indicate the template matching reference image of the target block.

템플릿 매칭 참조 영상의 디폴트 결정Default determination of template matching reference image

일 실시예에서, 대상 블록의 코딩 모드가 대상 영상의 복호화된 영역을 참조하는 모드인 경우, 대상 영상이 템플릿 매칭 참조 영상으로서 추론될 수 있다.In one embodiment, when the coding mode of the target block is a mode that refers to the decoded area of the target image, the target image may be inferred as a template matching reference image.

일 실시예에서, 템플릿 매칭 참조 영상으로서 추론되는 영상은 대상 영상 또는 대상 블록에 대한 코딩 정보에 의해 결정될 수 있다.In one embodiment, an image inferred as a template matching reference image may be determined by coding information about the target image or target block.

템플릿 매칭 참조 영상으로서 추론되는 영상은 대상 영상 또는 대상 블록의 슬라이스 타입에 기반하여 결정될 수 있다.The image inferred as the template matching reference image may be determined based on the slice type of the target image or target block.

예를 들면, 대상 영상 또는 대상 블록이 I 슬라이스에 해당하는 경우, 대상 영상이 템플릿 매칭 참조 영상으로서 추론될 수 있다.For example, if the target image or target block corresponds to an I slice, the target image may be inferred as a template matching reference image.

예를 들면, 대상 영상 또는 대상 블록이 P 슬라이스 또는 B 슬라이스에 해당하는 경우, 복호화된 영상들 중 대상 영상에 가장 근접한 영상이 템플릿 매칭 참조 영상으로서 추론될 수 있다.For example, if the target image or target block corresponds to a P slice or B slice, the image closest to the target image among the decoded images can be inferred as the template matching reference image.

예를 들면, 대상 영상 또는 대상 블록이 P 슬라이스 또는 B 슬라이스에 해당하는 경우, 복호화된 영상들 중 대상 영상에 가장 근접한 과거 영상과 대상 영상에 가장 근접한 미래 영상이 템플릿 매칭 참조 영상들로서 추론될 수 있다.For example, if the target image or target block corresponds to a P slice or B slice, the past image closest to the target image and the future image closest to the target image among the decoded images can be inferred as template matching reference images. .

예를 들면, 대상 영상 또는 대상 블록이 P 슬라이스 또는 B 슬라이스에 해당하는 경우, 템플릿 매칭 참조 영상은 인터 예측의 제1 참조 영상 리스트의 첫 번째 참조 영상일 수 있다.For example, if the target image or target block corresponds to a P slice or B slice, the template matching reference image may be the first reference image in the first reference image list of inter prediction.

예를 들면, 대상 영상 또는 대상 블록이 P 슬라이스 또는 B 슬라이스에 해당하는 경우, 템플릿 매칭 참조 영상은 인터 예측의 제2 참조 영상 리스트의 첫 번째 참조 영상일 수 있다.For example, if the target image or target block corresponds to a P slice or B slice, the template matching reference image may be the first reference image in the second reference image list of inter prediction.

예를 들면, 대상 영상 또는 대상 블록이 P 슬라이스 또는 B 슬라이스에 해당하는 경우, 템플릿 매칭 참조 영상들은 인터 예측의 제1 참조 영상 리스트의 첫 번째 참조 영상 및 제2 참조 영상 리스트의 첫 번째 참조 영상일 수 있다.For example, if the target image or target block corresponds to a P slice or B slice, the template matching reference images are the first reference image in the first reference image list and the first reference image in the second reference image list of inter prediction. You can.

템플릿 매칭 탐색Template matching exploration

아래에서는 단계(2030)에서의 템플릿 매칭 탐색의 선택이 설명된다.Below, the selection of a template matching search in step 2030 is described.

템플릿 매칭 탐색, 상관관계, 템플릿 매칭 최적 블록 및 템플릿 매칭 움직임 벡터의 정의Template matching search, correlation, definition of template matching optimal blocks and template matching motion vectors.

도 39는 일 예에 따른 템플릿 매칭 최적 블록의 도출을 나타낸다.Figure 39 shows derivation of an optimal template matching block according to an example.

실시예들에서, 대상 템플릿은 대상 블록의 템플릿을 의미할 수 있다. 말하자면, 대상 템플릿은 대상 블록을 위해 구성된 대상 블록에 인접한 템플릿을 의미할 수 있다.In embodiments, the target template may refer to the template of the target block. In other words, the target template may mean a template adjacent to the target block configured for the target block.

대상 템플릿 및 템플릿 매칭 참조 영상이 주어지면, 템플릿 매칭 참조 영상 내에서 대상 블록의 대상 템플릿과 가장 유사한 템플릿을 갖는 최적 블록(또는, 최적 픽셀)을 찾는 탐색이 수행될 수 있다.Given a target template and a template matching reference image, a search may be performed to find the optimal block (or optimal pixel) having a template most similar to the target template of the target block within the template matching reference image.

대상 템플릿 및 템플릿 매칭 참조 영상이 주어지면, 템플릿 매칭 참조 영상 내의 탐색 영역 내에서 대상 블록의 대상 템플릿과 가장 유사한 템플릿을 갖는 최적 블록(또는, 최적 픽셀)을 찾는 탐색이 수행될 수 있다.Given a target template and a template matching reference image, a search may be performed to find the optimal block (or optimal pixel) having a template most similar to the target template of the target block within the search area within the template matching reference image.

실시예들에서, 탐색 영역은 템플릿 매칭 참조 영상 내의 복호화된 영역일 수 있다.In embodiments, the search area may be a decoded area within a template matching reference image.

여기에서, 최적 블록의 템플릿은 대상 템플릿과의 최고 상관관계(correlation)를 가질 수 있다. 말하자면, 최적 블록의 템플릿의 대상 템플릿과의 상관관계는 탐색된 템플릿들의 대상 템플릿과의 상관관계들 중에서 가장 클 수 있다.Here, the template of the optimal block may have the highest correlation with the target template. In other words, the correlation of the template of the optimal block with the target template may be the largest among the correlations with the target template of the searched templates.

실시예들에서, 탐색 영역 내의 탐색된 블록들에 대하여, 대상 블록의 대상 템플릿 및 탐색된 템플릿 간의 상관관계가 계산될 수 있다. 탐색된 템플릿들 중 대상 템플릿과의 최고 상관관계를 갖는 템플릿이 최적 템플릿으로서 선택될 수 있다. 최적 탬플릿에 대응하는 블록이 최적 블록으로서 선택될 수 있다. 최적 템플릿의 위치 및 최적 블록의 위치 간의 관계는 대상 템플릿의 위치 및 대상 블록의 위치 간의 관계에 대응할 수 있다.In embodiments, for searched blocks within a search area, a correlation between the searched template and the target template of the target block may be calculated. Among the searched templates, the template with the highest correlation with the target template may be selected as the optimal template. A block corresponding to the optimal template may be selected as the optimal block. The relationship between the location of the optimal template and the location of the optimal block may correspond to the relationship between the location of the target template and the location of the target block.

이러한 선택된 최적 블록은 템플릿 매칭 최적 블록으로 명명될 수 있다.This selected optimal block may be named a template matching optimal block.

실시예들에서, 최적 템플릿은 대상 템플릿과의 최고 상관관계를 갖는 템플릿일 수 있다. 또한, 최적 템플릿은 템플릿 매칭 최적 블록의 템플릿일 수 있다.In embodiments, the optimal template may be the template with the highest correlation with the target template. Additionally, the optimal template may be a template of the template matching optimal block.

말하자면, 대상 블록의 대상 템플릿과의 매칭을 통해, 최고 상관관계를 갖는 최적 템플릿이 탐색될 수 있고, 최적 템플릿에 인접한 블록이 대상 블록의 부호화/복호화를 위한 템플릿 매칭 최적 블록으로서 설정될 수 있다. In other words, through matching the target block with the target template, the optimal template with the highest correlation can be searched, and the block adjacent to the optimal template can be set as the template matching optimal block for encoding/decoding of the target block.

템플릿 매칭 움직임 벡터의 도출Derivation of template matching motion vector

템플릿 매칭 움직임 벡터(= MVtm)는 대상 템플릿의 위치 및 최적 템플릿 간의 위치 간의 차이를 나타낼 수 있다.The template matching motion vector (= MV tm ) may represent the difference between the position of the target template and the position between the optimal templates.

또는, 템플릿 매칭 움직임 벡터는 대상 블록의 간의 및 템플릿 매칭 최적 블록의 위치 간의 차이를 나타낼 수 있다.Alternatively, the template matching motion vector may indicate the difference between the positions of the target blocks and the positions of the optimal template matching blocks.

또는, 템플릿 매칭 움직임 벡터는 대상 블록 내의 최좌상단(leftmost and uppermost) 픽셀의 위치 및 최적 픽셀의 위치 간의 차이를 나타낼 수 있다. 최적 픽셀은 템플릿 매칭 최적 블록의 최좌상단 픽셀일 수 있다.Alternatively, the template matching motion vector may indicate the difference between the position of the leftmost and uppermost pixel in the target block and the position of the optimal pixel. The optimal pixel may be the top left pixel of the template matching optimal block.

실시예들에서, 최적 픽셀은 대상 템플릿과의 최고 상관관계를 갖는 픽셀일 수 있다.In embodiments, the optimal pixel may be the pixel with the highest correlation with the target template.

도 40은 일 예에 따른 템플릿 매칭 움직임 벡터를 도출하는 제1 방법을 나타낸다.Figure 40 shows a first method of deriving a template matching motion vector according to an example.

대상 블록 내의 최좌상단 픽셀의 위치는 (xt, yt)일 수 있다.The position of the top left pixel within the target block may be (x t , y t ).

템플릿 매칭 최적 블록 내의 최좌상단 픽셀의 위치는 (xtm, ytm)일 수 있다.The position of the top left pixel in the template matching optimal block may be (x tm , y tm ).

이러한 경우, 템플릿 매칭 움직임 벡터(= MVtm)는 대상 블록 내의 최좌상단 픽셀의 위치 및 템플릿 매칭 최적 블록 내의 최좌상단 픽셀의 위치 간의 차이를 나타낼 수 있다.In this case, the template matching motion vector (= MV tm ) may represent the difference between the position of the top left pixel in the target block and the position of the top left pixel in the template matching optimal block.

예를 들면, 템플릿 매칭 움직임 벡터(= MVtm)는 아래의 수식 11의 값 및 수식 12의 값 중 적어도 하나일 수 있다.For example, the template matching motion vector (= MV tm ) may be at least one of the values of Equation 11 and Equation 12 below.

[수식 11][Formula 11]

(xt - xtm, yt - ytm)(x t - x tm , y t - y tm )

[수식 12][Formula 12]

(xtm - xt, ytm - yt)(x tm - x t , y tm - y t )

도 41은 일 예에 따른 템플릿 매칭 움직임 벡터를 도출하는 제2 방법을 나타낸다.Figure 41 shows a second method of deriving a template matching motion vector according to an example.

대상 블록의 대상 템플릿 내의 최좌상단 픽셀의 위치는 (xt, yt)일 수 있다.The position of the top left pixel within the target template of the target block may be (x t , y t ).

최적 템플릿 내의 최좌상단 픽셀의 위치는 (xtm, ytm)일 수 있다.The position of the top left pixel in the optimal template may be (x tm , y tm ).

이러한 경우, 템플릿 매칭 움직임 벡터(= MVtm)는 대상 템플릿 내의 최좌상단 픽셀의 위치 및 최적 템플릿 내의 최좌상단 픽셀의 위치 간의 차이를 나타낼 수 있다.In this case, the template matching motion vector (= MV tm ) may represent the difference between the position of the top-left pixel in the target template and the position of the top-left pixel in the optimal template.

예를 들면, 템플릿 매칭 움직임 벡터(= MVtm)는 아래의 수식 13의 값 및 수식 14의 값 중 적어도 하나일 수 있다.For example, the template matching motion vector (= MV tm ) may be at least one of the values of Equation 13 and Equation 14 below.

[수식 13][Formula 13]

(xt - xtm, yt - ytm)(x t - x tm , y t - y tm )

[수식 14][Formula 14]

(xtm - xt, ytm - yt)(x tm - x t , y tm - y t )

도 42는 일 예에 따른 템플릿 매칭 참조 영상 및 대상 영상이 서로 다른 경우의 움직임 벡터를 도출하는 제1 방법을 나타낸다.Figure 42 shows a first method of deriving a motion vector when a template matching reference image and a target image are different from each other, according to an example.

템플릿 매칭 참조 영상 및 대상 영상은 서로 다를 수 있다. 템플릿 매칭 참조 영상 및 대상 영상이 서로 다른 경우, 템플릿 매칭 참조 영상 내에서의 대상 블록에 대응하는 위치가 설정될 수 있다. 예를 들면, 대상 영상 내에서의 대상 블록이 차지하는 영역 및 템플릿 매칭 참조 영상 내에서의 대응하는 위치에 의해 특정되는 영역은 같을 수 있다.Template matching reference image and target image may be different from each other. If the template matching reference image and the target image are different from each other, a position corresponding to the target block in the template matching reference image may be set. For example, the area occupied by the target block in the target image and the area specified by the corresponding position in the template matching reference image may be the same.

대상 영상 내에서의 대상 블록의 최좌상단 픽셀의 위치가 (xt, yt)일 때, 템플릿 매칭 참조 영상 내에서의 대응하는 위치 또한 (xt, yt)일 수 있다.When the position of the top left pixel of the target block in the target image is (x t , y t ), the corresponding position in the template matching reference image may also be (x t , y t ).

템플릿 매칭 최적 블록 내의 최좌상단 픽셀의 위치는 (xtm, ytm)일 수 있다.The position of the top left pixel in the template matching optimal block may be (x tm , y tm ).

이러한 경우, 템플릿 매칭 움직임 벡터(= MVtm)는 템플릿 매칭 최적 블록 내의 대응하는 위치 및 템플릿 매칭 최적 블록 내의 최좌상단 픽셀의 위치 간의 차이를 나타낼 수 있다.In this case, the template matching motion vector (= MV tm ) may represent the difference between the position of the top left pixel in the template matching optimal block and the corresponding position within the template matching optimal block.

예를 들면, 템플릿 매칭 움직임 벡터(= MVtm)는 아래의 수식 15의 값 및 수식 16의 값 중 적어도 하나일 수 있다.For example, the template matching motion vector (= MV tm ) may be at least one of the values of Equation 15 and Equation 16 below.

[수식 15][Formula 15]

(xt - xtm, yt - ytm)(x t - x tm , y t - y tm )

[수식 16][Formula 16]

(xtm - xt, ytm - yt)(x tm - x t , y tm - y t )

도 43은 일 예에 따른 템플릿 매칭 참조 영상 및 대상 영상이 서로 다른 경우의 움직임 벡터를 도출하는 제1 방법을 나타낸다.Figure 43 shows a first method of deriving a motion vector when a template matching reference image and a target image are different from each other, according to an example.

템플릿 매칭 참조 영상 및 대상 영상은 서로 다를 수 있다. 템플릿 매칭 참조 영상 및 대상 영상이 서로 다른 경우, 템플릿 매칭 참조 영상 내에서의 대상 블록에 대응하는 위치가 설정될 수 있다. 예를 들면, 대상 영상 내에서의 대상 템플릿이 차지하는 영역 및 템플릿 매칭 참조 영상 내에서의 대응하는 위치에 의해 특정되는 영역은 같을 수 있다.Template matching reference image and target image may be different from each other. If the template matching reference image and the target image are different from each other, a position corresponding to the target block in the template matching reference image may be set. For example, the area occupied by the target template in the target image and the area specified by the corresponding position in the template matching reference image may be the same.

대상 영상 내에서의 대상 템플릿의 최좌상단 픽셀의 위치가 (xt, yt)일 때, 템플릿 매칭 참조 영상 내의 대응하는 위치 또한 (xt, yt)일 수 있다.When the position of the top left pixel of the target template in the target image is (x t , y t ), the corresponding position in the template matching reference image may also be (x t , y t ).

템플릿 매칭 참조 영상 내에서의 최적 템플릿의 최좌상단 픽셀의 위치는 (xtm, ytm)일 수 있다.The position of the top left pixel of the optimal template in the template matching reference image may be (x tm , y tm ).

이러한 경우, 템플릿 매칭 움직임 벡터(= MVtm)는 대상 템플릿 내의 최좌상단 픽셀의 위치 및 최적 템플릿 내의 최좌상단 픽셀의 위치 간의 차이를 나타낼 수 있다.In this case, the template matching motion vector (= MV tm ) may represent the difference between the position of the top-left pixel in the target template and the position of the top-left pixel in the optimal template.

예를 들면, 템플릿 매칭 움직임 벡터(= MVtm)는 아래의 수식 17의 값 및 수식 18의 값 중 적어도 하나일 수 있다.For example, the template matching motion vector (= MV tm ) may be at least one of the values of Equation 17 and Equation 18 below.

[수식 17][Formula 17]

(xt - xtm, yt - ytm)(x t - x tm , y t - y tm )

[수식 18][Formula 18]

(xtm - xt, ytm - yt)(x tm - x t , y tm - y t )

템플릿 매칭 탐색 영역의 특정Template matching navigation area specific

템플릿 및 템플릿 매칭 참조 영상이 주어진 경우, 템플릿 매칭 참조 영상 내에서 템플릿 매칭 최적 블록을 탐색하기 위한 템플릿 매칭 탐색 영역이 특정될 수 있다.When a template and a template matching reference image are given, a template matching search area for searching for an optimal template matching block within the template matching reference image may be specified.

템플릿 매칭 탐색 영역은 1) 템플릿 매칭 참조 영상의 전체의 영역 또는 2) 템플릿 매칭 참조 영상의 특정 일부 영역일 수 있다.The template matching search area may be 1) the entire area of the template matching reference image or 2) a specific partial area of the template matching reference image.

템플릿 매칭 탐색 영역은 템플릿 매칭 참조 영상 내의 특정 개수의 블록들로 구성되는 영역일 수 있다. 말하자면, 상기의 특정 개수의 블록들의 영역 외의 영역은 템플릿 매칭 탐색 영역이 아닐 수 있다. 따라서, 대상 블록의 주변의 특정 개수의 블록들의 영역이 제외된 나머지의 영역에 대해서는 템플릿 매칭을 이용하는 부호화/복호화가 허용되지 않을 수 있다.The template matching search area may be an area composed of a specific number of blocks in the template matching reference image. In other words, an area other than the area of the above-mentioned specific number of blocks may not be a template matching search area. Accordingly, encoding/decoding using template matching may not be allowed for the remaining area where the area of a specific number of blocks surrounding the target block is excluded.

블록은 실시예들에서 설명된 블록들 중 하나일 수 있다. 예를 들면, 블록은 코딩 트리 블록(Coding Tree Block; CTB), 매크로 블록(Macro Block; MB), 코딩 블록(Coding Block; CB), 예측 블록(Prediction Block; PB), 변환 블록(Transform Block; TB), 가상 파이프라인 데이터 유닛(Virtual Pipeline Data Unit; VPDU) 및 소정(predetermined) 크기를 갖는 블록 중 하나일 수 있다.The block may be one of the blocks described in the embodiments. For example, blocks include Coding Tree Block (CTB), Macro Block (MB), Coding Block (CB), Prediction Block (PB), Transform Block; TB), a Virtual Pipeline Data Unit (VPDU), and a block with a predetermined size.

복호화되지 않은 영역, 대상 블록 및 대상 블록의 템플릿의 영역은 템플릿 매칭 탐색 영역으로부터 제외될 수 있다.The undecrypted area, the target block, and the area of the target block's template may be excluded from the template matching search area.

템플릿 매칭 탐색 영역의 모양은 실시예들에서 설명된 모양들 중 하나일 수 있다. 예를 들면, 템플릿 매칭 탐색 영역의 모양은 정사각형 형태, 직사각형 형태 및 마름모 형태 중 적어도 하나일 수 있다.The shape of the template matching search area may be one of the shapes described in the embodiments. For example, the shape of the template matching search area may be at least one of a square shape, a rectangular shape, and a diamond shape.

예를 들면, 직사각형 모양의 템플릿 매칭 탐색 영역의 크기는 가로 크기 및 세로 크기에 의해 정의될 수 있다.For example, the size of the rectangular template matching search area may be defined by the horizontal size and vertical size.

예를 들면, 마름모 모양의 템플릿 매칭 탐색 영역의 크기는 2 개의 대각선 크기들에 의해 정의될 수 있다.For example, the size of a diamond-shaped template matching search area can be defined by two diagonal sizes.

예를 들면, 템플릿 매칭 탐색 영역의 크기는 템플릿 매칭 탐색 시작 점으로부터의 수평 크기 및 수직 크기에 의해 정의될 수 있다.For example, the size of the template matching search area can be defined by the horizontal size and vertical size from the template matching search starting point.

템플릿 매칭 탐색 영역의 모양 및 크기 중 적어도 하나는 코딩 정보에 기반하여 결정될 수 있다. 코딩 정보에 대한 시그널링에 의해 템플릿 매칭 탐색 영역의 모양 및 크기 중 적어도 하나가 특정될 수 있다. 예를 들면, 코딩 정보는 시퀀스 파라미터(sequence parameter), 픽처 파라미터(picture parameter) 및 슬라이스 헤더(slice header) 등과 같은 상위 구문 요소(high-level syntax element)를 포함할 수 있다. 템플릿 매칭 탐색 영역의 모양 및/크기를 나타내는 정보는 상위 구문 요소 내에서 시그널링될 수 있다.At least one of the shape and size of the template matching search area may be determined based on coding information. At least one of the shape and size of the template matching search area may be specified by signaling about coding information. For example, coding information may include high-level syntax elements such as sequence parameters, picture parameters, and slice headers. Information indicating the shape and/or size of the template matching search area may be signaled within the parent syntax element.

템플릿 매칭 탐색 영역의 모양 및/크기를 나타내는 정보 및 코딩 정보의 각각은 특정 단위에 대하여 시그널링될 수 있다. 예를 들면, 특정 단위는, 코딩 트리 블록(Coding Tree Block; CTB), 매크로 블록(Macro Block; MB), 코딩 블록(Coding Block; CB), 예측 블록(Prediction Block; PB), 변환 블록(Transform Block; TB), 가상 파이프라인 데이터 유닛(Virtual Pipeline Data Unit; VPDU) 및 소정(predetermined) 크기를 갖는 블록 중 하나일 수 있다.Each of the information indicating the shape and/or size of the template matching search area and the coding information may be signaled for a specific unit. For example, specific units include Coding Tree Block (CTB), Macro Block (MB), Coding Block (CB), Prediction Block (PB), and Transform block (Transform). It may be one of Block (TB), Virtual Pipeline Data Unit (VPDU), and a block with a predetermined size.

특정 유닛을 사용하는 템플릿 매칭 탐색 영역의 특정Specific of template matching navigation area using specific units

일 실시예에서, 템플릿 매칭 탐색 영역의 특정을 위해 VPDU가 사용될 수 있다.In one embodiment, a VPDU may be used to specify a template matching search area.

템플릿 매칭 탐색 영역은 템플릿 매칭 참조 영상 내의 대상 블록의 주변의 1 개의 VPDU의 영역 일 수 있다. 말하자면, 상기의 1 개의 VPDU의 영역의 이외의 영역은 템플릿 매칭 탐색 영역이 아닐 수 있다. 따라서, 대상 블록의 주변의 1 개의 VPDU의 영역이 제외된 나머지의 영역에서는 템플릿 매칭을 이용하는 부호화/복호화가 허용되지 않을 수 있다.The template matching search area may be an area of one VPDU surrounding the target block in the template matching reference image. In other words, an area other than the area of one VPDU above may not be a template matching search area. Accordingly, encoding/decoding using template matching may not be allowed in the remaining area excluding the area of one VPDU surrounding the target block.

일 실시예에서, 템플릿 매칭 탐색 영역의 특정을 위해 CTB가 사용될 수 있다.In one embodiment, CTB may be used to specify a template matching search area.

템플릿 매칭 탐색 영역은 템플릿 매칭 참조 영상 내의 대상 블록의 주변의 1 개의 CTB의 영역 일 수 있다. 말하자면, 상기의 1 개의 CTB의 영역의 이외의 영역은 템플릿 매칭 탐색 영역이 아닐 수 있다. 따라서, 대상 블록의 주변의 1 개의 CTB의 영역이 제외된 나머지의 영역에서는 템플릿 매칭을 이용하는 부호화/복호화가 허용되지 않을 수 있다.The template matching search area may be an area of one CTB around the target block in the template matching reference image. In other words, areas other than the area of one CTB above may not be a template matching search area. Therefore, encoding/decoding using template matching may not be allowed in the remaining area excluding the area of one CTB surrounding the target block.

템플릿 매칭 탐색 영역은 템플릿 매칭 참조 영상 내의 대상 블록이 속하는 1 개의 CTB의 영역 일 수 있다. 말하자면, 상기의 1 개의 CTB의 영역의 이외의 영역은 템플릿 매칭 탐색 영역이 아닐 수 있다. 따라서, 대상 블록의 주변의 1 개의 CTB의 영역이 제외된 나머지의 영역에서는 템플릿 매칭을 이용하는 부호화/복호화가 허용되지 않을 수 있다.The template matching search area may be an area of one CTB to which the target block in the template matching reference image belongs. In other words, areas other than the area of one CTB above may not be a template matching search area. Therefore, encoding/decoding using template matching may not be allowed in the remaining area excluding the area of one CTB surrounding the target block.

사각형의 템플릿 매칭 탐색 영역Rectangular template matching navigation area

도 44는 일 예에 따른 대상 영상 내의 템플릿 매칭 탐색 영역의 모양이 직사각형인 경우를 나타낸다.Figure 44 shows a case where the shape of the template matching search area in the target image is rectangular, according to an example.

일 실시예에서, 템플릿 매칭 참조 영상이 대상 영상인 경우, 템플릿 매칭 탐색 영역의 모양은 직사각형일 수 있다.In one embodiment, when the template matching reference image is the target image, the shape of the template matching search area may be rectangular.

템플릿 매칭 탐색 영역은 템플릿 매칭 참조 영상 내의 복호화된 영역의 전체 영역 또는 일부 영역일 수 있다.The template matching search area may be the entire area or a partial area of the decoded area in the template matching reference image.

도 45는 일 예에 따른 복호화된 과거 영상 또는 복호화된 미래 영상 내의 템플릿 매칭 탐색 영역의 모양이 직사각형인 경우를 나타낸다.Figure 45 shows a case where the shape of the template matching search area in a decoded past image or a decoded future image according to an example is rectangular.

일 실시예에서, 템플릿 매칭 참조 영상이 복호화된 과거 영상 또는 복호화된 미래 영상인 경우, 템플릿 매칭 탐색 영역의 모양은 직사각형일 수 있다.In one embodiment, when the template matching reference image is a decoded past image or a decoded future image, the shape of the template matching search area may be rectangular.

템플릿 매칭 탐색 영역은 템플릿 매칭 참조 영상 내의 복호화된 영역의 전체 영역 또는 일부 영역일 수 있다.The template matching search area may be the entire area or a partial area of the decoded area in the template matching reference image.

도 46은 일 예에 따른 템플릿 매칭 참조 영상이 대상 영상인 경우 템플릿 매칭 참조 영상 내의 템플릿 매칭 탐색 영역 내의 일부의 영역이 탐색에서 제외된 것을 나타낸다.Figure 46 shows that when a template matching reference image according to an example is the target image, some areas within the template matching search area within the template matching reference image are excluded from the search.

일 실시예에서, 템플릿 매칭 참조 영상이 대상 영상인 경우, 템플릿 매칭 탐색 영역 내의 일부의 영역은 탐색에서 제외될 수 있다.In one embodiment, when the template matching reference image is the target image, some areas within the template matching search area may be excluded from the search.

일부의 영역은 대상 블록, 복호화되지 않은 영역 및 대상 블록의 템플릿 영역을 포함할 수 있다.Some areas may include a target block, an undecoded area, and a template area of the target block.

도 47은 일 예에 따른 템플릿 매칭 참조 영상이 복호화된 과거 영상 또는 복호화된 미래 영상인 경우 템플릿 매칭 참조 영상 내의 템플릿 매칭 탐색 영역 내의 일부의 영역이 탐색에서 제외된 것을 나타낸다.FIG. 47 illustrates that when the template matching reference image according to an example is a decoded past image or a decoded future image, a portion of an area within the template matching search area within the template matching reference image is excluded from the search.

일 실시예에서, 템플릿 매칭 참조 영상이 복호화된 과거 영상 또는 복호화된 미래 영상인 경우, 템플릿 매칭 탐색 영역 내의 일부의 영역은 탐색에서 제외될 수 있다.In one embodiment, when the template matching reference image is a decoded past image or a decoded future image, some areas within the template matching search area may be excluded from the search.

일부의 영역은 영상의 경계의 밖의 영역을 포함할 수 있다. 경계는 상측 경계 및 좌측 경계 중 하나 이상을 포함할 수 있다.Some areas may include areas outside the boundaries of the image. The border may include one or more of an upper border and a left border.

템플릿 매칭 탐색 영역의 모양이 직사각형인 경우의 템플릿 매칭 탐색 영역의 크기에 대한 시그널링Signaling of the size of the template matching search area when the shape of the template matching search area is rectangular.

도 48은 일 예에 따른 템플릿 매칭 탐색 영역의 모양이 직사각형인 경우의 템플릿 매칭 탐색 영역의 크기를 정의하는 제1 방법을 나타낸다.Figure 48 shows a first method of defining the size of a template matching search area when the shape of the template matching search area is rectangular according to an example.

템플릿 매칭 탐색 영역의 모양이 직사각형인 경우, 템플릿 매칭 탐색 영역의 크기는 템플릿 매칭 탐색 영역의 가로 크기(= rec_template_width) 및 템플릿 매칭 탐색 영역의 세로 크기(= rec_template_height)에 의해 정의될 수 있다.When the shape of the template matching search area is rectangular, the size of the template matching search area can be defined by the horizontal size (=rec_template_width) of the template matching search area and the vertical size (=rec_template_height) of the template matching search area.

rec_template_width 및 rec_template_height 중 적어도 하나는 코딩 정보에 기반하여 결정될 수 있다. 코딩 정보에 대한 시그널링에 의해 rec_template_width 및 rec_template_height 중 적어도 하나가 특정될 수 있다. 예를 들면, 코딩 정보는 시퀀스 파라미터, 픽처 파라미터 및 슬라이스 헤더 등과 같은 상위 구문 요소를 포함할 수 있다. rec_template_width 및 rec_template_height는 상위 구문 요소 내에서 시그널링될 수 있다.At least one of rec_template_width and rec_template_height may be determined based on coding information. At least one of rec_template_width and rec_template_height may be specified by signaling about coding information. For example, coding information may include high-level syntax elements such as sequence parameters, picture parameters, and slice headers. rec_template_width and rec_template_height can be signaled within the parent syntax element.

rec_template_width, rec_template_height 및 코딩 정보의 각각은 특정 단위에 대하여 시그널링될 수 있다. 예를 들면, 특정 단위는, CTB, MB, CB, PB, TB, VPDU 및 소정 크기를 갖는 블록 중 하나일 수 있다.Each of rec_template_width, rec_template_height, and coding information may be signaled for a specific unit. For example, a specific unit may be one of CTB, MB, CB, PB, TB, VPDU, and a block with a predetermined size.

도 49는 일 예에 따른 템플릿 매칭 탐색 영역의 모양이 직사각형인 경우의 템플릿 매칭 탐색 영역의 크기를 정의하는 제2 방법을 나타낸다.Figure 49 shows a second method of defining the size of the template matching search area when the shape of the template matching search area is rectangular, according to an example.

템플릿 매칭 탐색 영역의 모양이 직사각형인 경우, 템플릿 매칭 탐색 영역의 크기는 가로 크기(= del_width) 및 세로 크기(= del_height)에 의해 정의될 수 있다. 가로 크기(= del_width)는 템플릿 매칭 탐색 시작 점으로부터 템플릿 매칭 탐색 영역의 좌측 경계까지의 거리 및 템플릿 매칭 탐색 시작 점으로부터 템플릿 매칭 탐색 영역의 우측 경계까지의 거리를 나타낼 수 있다. 세로 크기(= del_height)는 템플릿 매칭 탐색 시작 점으로부터 템플릿 매칭 탐색 영역의 상측 경계까지의 거리 및 템플릿 매칭 탐색 시작 점으로부터 템플릿 매칭 탐색 영역의 하측 경계까지의 거리를 나타낼 수 있다.When the shape of the template matching search area is rectangular, the size of the template matching search area can be defined by the horizontal size (= del_width) and the vertical size (= del_height). The horizontal size (= del_width) may represent the distance from the template matching search start point to the left border of the template matching search area and the distance from the template matching search start point to the right border of the template matching search area. The vertical size (= del_height) may represent the distance from the template matching search start point to the upper border of the template matching search area and the distance from the template matching search start point to the lower border of the template matching search area.

템플릿 매칭 탐색 시작 점은 템플릿 매칭 탐색 영역의 중심에 위치할 수 있다. 또는, 템플릿 매칭 탐색 시작 점이 중심이 되도록 가로 크기(= del_width) 및 세로 크기(= del_height)에 의해 템플릿 매칭 탐색 영역이 정의될 수 있다.The template matching search start point may be located at the center of the template matching search area. Alternatively, the template matching search area can be defined by the horizontal size (= del_width) and vertical size (= del_height) so that the template matching search start point is the center.

이 때, 템플릿 매칭 탐색 영역 크기는 아래의 수식 19와 같을 수 있다.At this time, the size of the template matching search area may be equal to Equation 19 below.

[수식 19][Formula 19]

(1 + 2 * del_width) * (1 + 2 * del_height)(1 + 2 * del_width) * (1 + 2 * del_height)

del_width 및 del_height 중 적어도 하나는 코딩 정보에 기반하여 결정될 수 있다. 코딩 정보에 대한 시그널링에 의해 del_width 및 del_height 중 적어도 하나가 특정될 수 있다. 예를 들면, 코딩 정보는 시퀀스 파라미터, 픽처 파라미터 및 슬라이스 헤더 등과 같은 상위 구문 요소를 포함할 수 있다. del_width 및 del_height는 상위 구문 요소 내에서 시그널링될 수 있다.At least one of del_width and del_height may be determined based on coding information. At least one of del_width and del_height may be specified by signaling about coding information. For example, coding information may include high-level syntax elements such as sequence parameters, picture parameters, and slice headers. del_width and del_height can be signaled within the parent syntax element.

del_width, del_height 및 코딩 정보의 각각은 특정 단위에 대하여 시그널링될 수 있다. 예를 들면, 특정 단위는, CTB, MB, CB, PB, TB, VPDU 및 소정 크기를 갖는 블록 중 하나일 수 있다.Each of del_width, del_height, and coding information may be signaled for a specific unit. For example, a specific unit may be one of CTB, MB, CB, PB, TB, VPDU, and a block with a predetermined size.

마름모의 템플릿 매칭 탐색 영역Rhombus template matching navigation area

도 50은 일 예에 따른 대상 영상 내의 템플릿 매칭 탐색 영역의 모양이 마름모인 경우를 나타낸다.Figure 50 shows a case where the shape of the template matching search area in the target image according to an example is a diamond.

일 실시예에서, 템플릿 매칭 참조 영상이 대상 영상인 경우, 템플릿 매칭 탐색 영역의 모양은 마름모일 수 있다.In one embodiment, when the template matching reference image is the target image, the shape of the template matching search area may be a diamond.

템플릿 매칭 탐색 영역은 템플릿 매칭 참조 영상 내의 복호화된 영역의 전체 영역 또는 일부 영역일 수 있다.The template matching search area may be the entire area or a partial area of the decoded area in the template matching reference image.

도 51은 일 예에 따른 복호화된 과거 영상 또는 복호화된 미래 영상 내의 템플릿 매칭 탐색 영역의 모양이 마름모인 경우를 나타낸다.Figure 51 shows a case where the shape of the template matching search area in a decoded past image or a decoded future image according to an example is a diamond.

일 실시예에서, 템플릿 매칭 참조 영상이 복호화된 과거 영상 또는 복호화된 미래 영상인 경우, 템플릿 매칭 탐색 영역의 모양은 마름모일 수 있다.In one embodiment, when the template matching reference image is a decoded past image or a decoded future image, the shape of the template matching search area may be a diamond.

템플릿 매칭 탐색 영역은 템플릿 매칭 참조 영상 내의 복호화된 영역의 전체 영역 또는 일부 영역일 수 있다.The template matching search area may be the entire area or a partial area of the decoded area in the template matching reference image.

도 52는 일 예에 따른 템플릿 매칭 참조 영상이 대상 영상인 경우 템플릿 매칭 참조 영상 내의 템플릿 매칭 탐색 영역 내의 일부의 영역이 탐색에서 제외된 것을 나타낸다.Figure 52 illustrates that when a template matching reference image according to an example is the target image, some areas within the template matching search area within the template matching reference image are excluded from the search.

일 실시예에서, 템플릿 매칭 참조 영상이 대상 영상인 경우, 템플릿 매칭 탐색 영역 내의 일부의 영역은 탐색에서 제외될 수 있다.In one embodiment, when the template matching reference image is the target image, some areas within the template matching search area may be excluded from the search.

일부의 영역은 대상 블록, 복호화되지 않은 영역 및 대상 블록의 템플릿 영역을 포함할 수 있다.Some areas may include a target block, an undecoded area, and a template area of the target block.

도 53은 일 예에 따른 템플릿 매칭 참조 영상이 복호화된 과거 영상 또는 복호화된 미래 영상인 경우 템플릿 매칭 참조 영상 내의 템플릿 매칭 탐색 영역 내의 일부의 영역이 탐색에서 제외된 것을 나타낸다.FIG. 53 illustrates that when the template matching reference image according to an example is a decoded past image or a decoded future image, a portion of an area within the template matching search area within the template matching reference image is excluded from the search.

일 실시예에서, 템플릿 매칭 참조 영상이 복호화된 과거 영상 또는 복호화된 미래 영상인 경우, 템플릿 매칭 탐색 영역 내의 일부의 영역은 탐색에서 제외될 수 있다.In one embodiment, when the template matching reference image is a decoded past image or a decoded future image, some areas within the template matching search area may be excluded from the search.

일부의 영역은 영상의 경계의 밖의 영역을 포함할 수 있다. 경계는 상측 경계 및 좌측 경계 중 하나 이상을 포함할 수 있다.Some areas may include areas outside the boundaries of the image. The border may include one or more of an upper border and a left border.

템플릿 매칭 탐색 영역의 모양이 마름모인 경우의 템플릿 매칭 탐색 영역의 크기에 대한 시그널링Signaling of the size of the template matching search area when the shape of the template matching search area is a diamond.

도 54는 일 예에 따른 템플릿 매칭 탐색 영역의 모양이 마름모인 경우의 템플릿 매칭 탐색 영역의 크기를 정의하는 제1 방법을 나타낸다.Figure 54 illustrates a first method of defining the size of a template matching search area when the shape of the template matching search area is a diamond according to an example.

템플릿 매칭 탐색 영역의 모양이 마름모인 경우, 템플릿 매칭 탐색 영역의 크기는 템플릿 매칭 탐색 영역의 가로 크기(= dia_template_width) 및 템플릿 매칭 탐색 영역의 세로 크기(= dia_template_height)에 의해 정의될 수 있다. 여기에서, 가로 크기는 마름모의 좌단 꼭지점 및 우단 꼭지점 간의 거리일 수 있다. 세로 크기는 마름모의 상단 꼭지점 및 하단 꼭지점 간의 거리일 수 있다.When the shape of the template matching search area is a diamond, the size of the template matching search area can be defined by the horizontal size (=dia_template_width) of the template matching search area and the vertical size (=dia_template_height) of the template matching search area. Here, the horizontal size may be the distance between the left and right vertices of the rhombus. The vertical size may be the distance between the top and bottom vertices of the rhombus.

dia_template_width 및 dia_template_height 중 적어도 하나는 코딩 정보에 기반하여 결정될 수 있다. 코딩 정보에 대한 시그널링에 의해 dia_template_width 및 dia_template_height 중 적어도 하나가 특정될 수 있다. 예를 들면, 코딩 정보는 시퀀스 파라미터, 픽처 파라미터 및 슬라이스 헤더 등과 같은 상위 구문 요소를 포함할 수 있다. dia_template_width 및 dia_template_height는 상위 구문 요소 내에서 시그널닝될 수 있다.At least one of dia_template_width and dia_template_height may be determined based on coding information. At least one of dia_template_width and dia_template_height may be specified by signaling about coding information. For example, coding information may include high-level syntax elements such as sequence parameters, picture parameters, and slice headers. dia_template_width and dia_template_height can be signaled within the parent syntax element.

dia_template_width, dia_template_height 및 코딩 정보의 각각은 특정 단위에 대하여 시그널링될 수 있다. 예를 들면, 특정 단위는, CTB, MB, CB, PB, TB, VPDU 및 소정 크기를 갖는 블록 중 하나일 수 있다.Each of dia_template_width, dia_template_height, and coding information may be signaled for a specific unit. For example, a specific unit may be one of CTB, MB, CB, PB, TB, VPDU, and a block with a predetermined size.

도 55는 일 예에 따른 템플릿 매칭 탐색 영역의 모양이 마름모인 경우의 템플릿 매칭 탐색 영역의 크기를 정의하는 제2 방법을 나타낸다.Figure 55 shows a second method of defining the size of a template matching search area when the shape of the template matching search area is a diamond according to an example.

템플릿 매칭 탐색 영역의 모양이 마름모인 경우, 템플릿 매칭 탐색 영역의 크기는 가로 크기(= del_width) 및 세로 크기(= del_height)에 의해 정의될 수 있다. 가로 크기(= del_width)는 템플릿 매칭 탐색 시작 점으로부터 템플릿 매칭 탐색 영역의 좌단 꼭지점까지의 거리 및 템플릿 매칭 탐색 시작 점으로부터 템플릿 매칭 탐색 영역의 우단 꼭지점까지의 거리를 나타낼 수 있다. 세로 크기(= del_height)는 템플릿 매칭 탐색 시작 점으로부터 템플릿 매칭 탐색 영역의 상단 꼭지점까지의 거리 및 템플릿 매칭 탐색 시작 점으로부터 템플릿 매칭 탐색 영역의 하단 꼭지점까지의 거리를 나타낼 수 있다.When the shape of the template matching search area is a diamond, the size of the template matching search area can be defined by the horizontal size (= del_width) and the vertical size (= del_height). The horizontal size (= del_width) may represent the distance from the template matching search start point to the left vertex of the template matching search area and the distance from the template matching search start point to the right vertex of the template matching search area. The vertical size (= del_height) may represent the distance from the template matching search start point to the upper vertex of the template matching search area and the distance from the template matching search start point to the lower vertex of the template matching search area.

템플릿 매칭 탐색 시작 점은 템플릿 매칭 탐색 영역의 중심에 위치할 수 있다. 또는, 템플릿 매칭 탐색 시작 점이 중심이 되도록 가로 크기(= del_width) 및 세로 크기(= del_height)에 의해 템플릿 매칭 탐색 영역이 정의될 수 있다.The template matching search start point may be located at the center of the template matching search area. Alternatively, the template matching search area can be defined by the horizontal size (= del_width) and vertical size (= del_height) so that the template matching search start point is the center.

이 때, 템플릿 매칭 탐색 영역 크기는 아래의 수식 20과 같을 수 있다.At this time, the size of the template matching search area may be equal to Equation 20 below.

[수식 20][Formula 20]

1/2 * (1 + 2 * del_width) * (1 + 2 * del_height)1/2 * (1 + 2 * del_width) * (1 + 2 * del_height)

del_width 및 del_height 중 적어도 하나는 코딩 정보에 기반하여 결정될 수 있다. 코딩 정보에 대한 시그널링에 의해 del_width 및 del_height 중 적어도 하나가 특정될 수 있다. 예를 들면, 코딩 정보는 시퀀스 파라미터, 픽처 파라미터 및 슬라이스 헤더 등과 같은 상위 구문 요소를 포함할 수 있다. del_width 및 del_height는 상위 구문 요소 내에서 시그널링될 수 있다.At least one of del_width and del_height may be determined based on coding information. At least one of del_width and del_height may be specified by signaling about coding information. For example, coding information may include high-level syntax elements such as sequence parameters, picture parameters, and slice headers. del_width and del_height can be signaled within the parent syntax element.

del_width, del_height 및 코딩 정보의 각각은 특정 단위에 대하여 시그널링될 수 있다. 예를 들면, 특정 단위는, CTB, MB, CB, PB, TB, VPDU 및 소정 크기를 갖는 블록 중 하나일 수 있다. Each of del_width, del_height, and coding information may be signaled for a specific unit. For example, a specific unit may be one of CTB, MB, CB, PB, TB, VPDU, and a block with a predetermined size.

템플릿 매칭 탐색 영역의 모양을 나타내는 인덱스의 시그널링Signaling of the index that indicates the shape of the template matching search area

템플릿 매칭 탐색 영역의 모양은 복수의 모양들 중 하나일 수 있다. 복수의 모양들은 직사각형 및 마름모 형태를 포함할 수 있다.The shape of the template matching search area may be one of a plurality of shapes. The plurality of shapes may include rectangular and diamond shapes.

템플릿 매칭 탐색 영역의 모양을 특정하는 인덱스(= template_matching_shape_idx)가 시그널링될 수 있다.An index (= template_matching_shape_idx) that specifies the shape of the template matching search area may be signaled.

예를 들면, template_matching_shape_idx가 제1 값인 것은 템플릿 매칭 탐색 영역의 모양이 사각형임을 나타낼 수 있다. template_matching_shape_idx가 제2 값인 것은 템플릿 매칭 탐색 영역의 모양이 마름모임을 나타낼 수 있다.For example, template_matching_shape_idx being the first value may indicate that the shape of the template matching search area is a square. The fact that template_matching_shape_idx is the second value may indicate that the shape of the template matching search area is a diamond.

template_matching_shape_idx는 코딩 정보에 기반하여 결정될 수 있다. 코딩 정보에 대한 시그널링에 의해 template_matching_shape_idx가 특정될 수 있다. 예를 들면, 코딩 정보는 시퀀스 파라미터, 픽처 파라미터 및 슬라이스 헤더 등과 같은 상위 구문 요소를 포함할 수 있다. template_matching_shape_idx는 상위 구문 요소 내에서 시그널링될 수 있다.template_matching_shape_idx can be determined based on coding information. template_matching_shape_idx can be specified by signaling about coding information. For example, coding information may include high-level syntax elements such as sequence parameters, picture parameters, and slice headers. template_matching_shape_idx can be signaled within the parent syntax element.

template_matching_shape_idx 및 코딩 정보의 각각은 특정 단위에 대하여 시그널링될 수 있다. 예를 들면, 특정 단위는, CTB, MB, CB, PB, TB, VPDU 및 소정 크기를 갖는 블록 중 하나일 수 있다.Each of template_matching_shape_idx and coding information may be signaled for a specific unit. For example, a specific unit may be one of CTB, MB, CB, PB, TB, VPDU, and a block with a predetermined size.

대상 블록의 템플릿의 대응 좌표들을 이용하는 템플릿 매칭 탐색 시작 픽셀의 결정Determination of template matching search start pixel using corresponding coordinates of template of target block

도 56은 일 예에 따른 대상 블록의 템플릿의 대응 좌표들을 이용하는 템플릿 매칭 탐색 시작 픽셀의 결정을 나타낸다.Figure 56 illustrates determination of a template matching search start pixel using corresponding coordinates of a template of a target block according to an example.

템플릿 및 템플릿 매칭 참조 영상이 주어진 경우, 템플릿 매칭 참조 영상 내에서의 템플릿 매칭 탐색 시작 픽셀이 특정될 수 있다. 템플릿 매칭 탐색 시작 픽셀은 대상 블록을 부호화/복호화하기 위해 사용될 수 있다.Given a template and a template matching reference image, a template matching search start pixel within the template matching reference image can be specified. The template matching search start pixel can be used to encode/decode the target block.

여기에서, 최적 픽셀은 최적 블록, 템플릿 매칭 최적 픽셀 및 템플릿 매칭 최적 블록을 나타낼 수도 있다.Here, the optimal pixel may represent an optimal block, a template matching optimal pixel, and a template matching optimal block.

대상 블록의 템플릿의 좌표들의 정보를 이용하여 템플릿 매칭 탐색 시작점이 결정될 수 있다.The template matching search starting point may be determined using information on the coordinates of the template of the target block.

실시예들에서, 템플릿의 최좌상단 좌표들은 템플릿 내의 최좌상단 픽셀의 좌표들을 의미할 수 있다.In embodiments, the top-left coordinates of a template may refer to the coordinates of the top-left pixel within the template.

대상 블록의 템플릿 내의 최좌상단 좌표들이 (xtm, ytm)일 때, 템플릿 매칭 참조 영상 내에서의 대응 위치도 (xtm, ytm)일 수 있다.When the top left coordinates in the template of the target block are (x tm , y tm ), the corresponding position in the template matching reference image may also be (x tm , y tm ).

실시예들에서, 대응 위치는 대상 블록의 템플릿에 대응하는 템플릿 매칭 참조 영상 내의 위치일 수 있다. 또는, 대응 위치는 대상 블록의 템플릿의 최좌상단 픽셀에 대응하는 템플릿 매칭 참조 영상 내의 위치일 수 있다.In embodiments, the corresponding location may be a location in the template matching reference image that corresponds to the template of the target block. Alternatively, the corresponding position may be a position in the template matching reference image corresponding to the top left pixel of the template of the target block.

대응 위치가 템플릿 매칭 탐색 시작 점으로서 사용됨에 따라, 대상 블록의 템플릿 매칭 탐색 시작 점도 (xtm, ytm)으로 설정될 수 있다.As the corresponding position is used as the template matching search start point, the template matching search start point of the target block can also be set to (x tm , y tm ).

템플릿 매칭 코딩 블록을 이용하는 템플릿 매칭 탐색 시작 픽셀의 결정Determination of template matching search start pixel using template matching coding block

일 실시예에서, 템플릿 매칭 탐색 시작 픽셀을 결정하기 위해 대상 블록의 주변 블록들 중 템플릿 매칭 코딩 블록이 이용될 수 있다. 템플릿 매칭 코딩 블록은 템플릿 매칭을 이용하여 부호화/복호화된 블록을 의미할 수 있다.In one embodiment, a template matching coding block among neighboring blocks of the target block may be used to determine the template matching search start pixel. A template matching coding block may refer to a block encoded/decoded using template matching.

대상 블록에 인접하는 블록들 중 템플릿 매칭 코딩 블록이 존재하는 경우, 템플릿 매칭 코딩 블록의 템플릿 매칭 움직임 벡터로부터 템플릿 매칭 탐색 시작점이 획득될 수 있다.If a template matching coding block exists among blocks adjacent to the target block, a template matching search starting point can be obtained from the template matching motion vector of the template matching coding block.

예를 들면, 대상 블록에 인접하는 블록들 중 템플릿 매칭 코딩 블록이 존재하며, 템플릿 매칭 코딩 블록의 템플릿 매칭 움직임 벡터가 (MVtm_x, MVtm_y)인 경우, 대상 블록의 템플릿 매칭 탐색 시작 점은 (MVtm_x, MVtm_y)로 설정될 수 있다. 즉, 대상 블록의 템플릿 매칭 탐색 시작 점은 템플릿 매칭 코딩 블록의 템플릿 매칭 움직임 벡터와 동일하도록 설정될 수 있다.For example, if there is a template matching coding block among blocks adjacent to the target block, and the template matching motion vector of the template matching coding block is (MV tm_x , MV tm_y ), the template matching search starting point for the target block is ( It can be set as MV tm_x , MV tm_y ). That is, the template matching search start point of the target block may be set to be the same as the template matching motion vector of the template matching coding block.

예를 들면, 대상 블록의 템플릿이 (xtm, ytm)에 위치할 때, 대상 블록의 템플릿에 대응하는 템플릿 매칭 참조 영상 내의 대응 위치는 (xtm, ytm)일 수 있다. 예를 들면, 대상 블록에 인접하는 블록들 중 템플릿 매칭 코딩 블록이 존재하며, 템플릿 매칭 코딩 블록의 템플릿 매칭 움직임 벡터가 (MVtm_x, MVtm_y)인 경우, 대상 블록의 템플릿 매칭 탐색 시작 점은 (xtm + MVtm_x, ytm + MVtm_y)로 설정될 수 있다.For example, when the template of the target block is located at (x tm , y tm ), the corresponding position in the template matching reference image corresponding to the template of the target block may be (x tm , y tm ). For example, if there is a template matching coding block among blocks adjacent to the target block, and the template matching motion vector of the template matching coding block is (MV tm_x , MV tm_y ), the template matching search starting point for the target block is ( It can be set as x tm + MV tm_x , y tm + MV tm_y ).

머지를 이용하는 템플릿 매칭 탐색 시작 픽셀의 결정Determination of template matching search start pixel using merge

대상 블록의 머지 리스트에 속하는 움직임 정보를 이용하여 템플릿 매칭 탐색 시작 점이 결정될 수 있다.The template matching search starting point can be determined using motion information belonging to the merge list of the target block.

대상 블록의 머지 리스트 내의 특정 요소의 움직임 벡터가 템플릿 매칭 탐색 시작 점으로서 사용될 수 있다. 특정 요소는 첫 번째 요소일 수 있다.The motion vector of a specific element in the merge list of the target block can be used as a template matching search starting point. A specific element may be the first element.

실시예들에서, 머지 리스트의 요소는 머지 리스트의 후보(candidate)를 의미할 수 있다.In embodiments, an element of the merge list may refer to a candidate for the merge list.

대상 블록의 템플릿이 (xtm, ytm)에 위치할 때, 대상 블록의 템플릿에 대응하는 템플릿 매칭 참조 영상 내의 대응 위치는 (xtm, ytm)일 수 있다. 대상 블록의 머지 리스트 내의 첫 번째 요소의 움직임 벡터가 (xm1, ym1)인 경우, 대상 블록의 템플릿 매칭 탐색 시작 점은 (xtm + xm1, ytm + ym1)로 설정될 수 있다.When the template of the target block is located at (x tm , y tm ), the corresponding position in the template matching reference image corresponding to the template of the target block may be (x tm , y tm ). If the motion vector of the first element in the merge list of the target block is (x m1 , y m1 ), the template matching search start point of the target block can be set to (x tm + x m1 , y tm + y m1 ). .

대상 블록의 머지 리스트를 사용하여 템플릿 매칭 탐색 시작 점이 선택될 수 있다. 실시예들에서 설명된 머지 리스트를 사용하여 움직임 정보를 결정하는 방법이 템플릿 매칭 탐색 시작 점을 결정하기 위해 사용될 수 있다. 예를 들면, 머지 리스트를 사용하여 결정된 움직임 정보가 템플릿 매칭 탐색 시작 점으로서 사용될 수 있다.The template matching search starting point can be selected using the merge list of the target block. The method of determining motion information using a merge list described in the embodiments may be used to determine a template matching search starting point. For example, motion information determined using a merge list can be used as a template matching search starting point.

템플릿 매칭 시작점을 특정하기 위해 머지 인덱스(= merge_index)가 시그널링될 수 있다. merge_index는 머지 인덱스의 후보들 중에서 하나를 특정할 수 있다. 시그널링된 merge_index에 의해 특정되는 후보의 움직임 벡터를 이용하여 템플릿 매칭 탐색 시작 픽셀이 설정될 수 있다.A merge index (= merge_index) may be signaled to specify the template matching starting point. merge_index can specify one of the merge index candidates. A template matching search start pixel may be set using the motion vector of the candidate specified by the signaled merge_index.

대상 블록의 템플릿이 (xtm, ytm)에 위치할 때, 대상 블록의 템플릿에 대응하는 템플릿 매칭 참조 영상 내의 대응 위치는 (xtm, ytm)일 수 있다. 시그널링된 merge_index가 특정하는 움직임 벡터가 (xmi, ymi)인 경우, 대상 블록의 템플릿 매칭 탐색 시작 점은 (xtm + xmi, ytm + ymi)로 설정될 수 있다.When the template of the target block is located at (x tm , y tm ), the corresponding position in the template matching reference image corresponding to the template of the target block may be (x tm , y tm ). If the motion vector specified by the signaled merge_index is (x mi , y mi ), the template matching search start point of the target block may be set to (x tm + x mi , y tm + y mi ).

템플릿 매칭 탐색 시작 점을 선택하기 위한 정보의 시그널링Signaling of information to select template matching search starting point

도 57은 일 예에 따른 템플릿 매칭 탐색 시작 화소를 초기화하는 방법을 가리키는 인덱스를 나타내는 표이다.Figure 57 is a table showing indices indicating a method of initializing a template matching search start pixel according to an example.

템플릿 매칭 탐색 시작 정보는 템플릿 매칭 탐색 시작 점을 선택하기 위해 사용되는 정보일 수 있다. 말하자면, 템플릿 매칭 탐색 시작 정보는 템플릿 매칭 탐색 시작 점을 나타낼 수 있다.Template matching search start information may be information used to select a template matching search start point. In other words, the template matching search start information may indicate the template matching search starting point.

템플릿 매칭 탐색 시작 정보는 코딩 정보에 기반하여 결정될 수 있다. 코딩 정보에 대한 시그널링에 의해 템플릿 매칭 탐색 시작 정보가 특정될 수 있다. 예를 들면, 코딩 정보는 시퀀스 파라미터, 픽처 파라미터 및 슬라이스 헤더 등과 같은 상위 구문 요소를 포함할 수 있다. 템플릿 매칭 탐색 시작 정보는 상위 구문 요소 내에서 시그널링될 수 있다.Template matching search start information may be determined based on coding information. Template matching search start information can be specified by signaling about coding information. For example, coding information may include high-level syntax elements such as sequence parameters, picture parameters, and slice headers. Template matching search start information may be signaled within the parent syntax element.

템플릿 매칭 탐색 시작 정보 및 코딩 정보의 각각은 특정 단위에 대하여 시그널링될 수 있다. 예를 들면, 특정 단위는, CTB, MB, CB, PB, TB, VPDU 및 소정 크기를 갖는 블록 중 하나일 수 있다.Each of the template matching search start information and coding information may be signaled for a specific unit. For example, a specific unit may be one of CTB, MB, CB, PB, TB, VPDU, and a block with a predetermined size.

대상 블록의 템플릿 매칭 탐색 시작 점을 획득하기 위해, 대상 블록의 좌표들, 머지 리스트 및 주변 블록(또는, 인접 블록)의 코딩 정보 중 적어도 하나를 이용할지 여부를 나타내는 사용 정보가 결정될 수 있다.To obtain the template matching search starting point of the target block, usage information indicating whether to use at least one of the coordinates of the target block, the merge list, and the coding information of the surrounding block (or adjacent block) may be determined.

사용 정보는 코딩 정보에 기반하여 결정될 수 있다. 코딩 정보에 대한 시그널링에 의해 템플릿 매칭 탐색 시작 정보가 특정될 수 있다. 예를 들면, 코딩 정보는 시퀀스 파라미터, 픽처 파라미터 및 슬라이스 헤더 등과 같은 상위 구문 요소를 포함할 수 있다. 사용 정보는 상위 구문 요소 내에서 시그널링될 수 있다.Usage information may be determined based on coding information. Template matching search start information can be specified by signaling about coding information. For example, coding information may include high-level syntax elements such as sequence parameters, picture parameters, and slice headers. Usage information may be signaled within the parent syntax element.

사용 정보 및 코딩 정보의 각각은 특정 단위에 대하여 시그널링될 수 있다. 예를 들면, 특정 단위는, CTB, MB, CB, PB, TB, VPDU 및 소정 크기를 갖는 블록 중 하나일 수 있다.Each of the usage information and coding information may be signaled for a specific unit. For example, a specific unit may be one of CTB, MB, CB, PB, TB, VPDU, and a block with a predetermined size.

템플릿 매칭 초기화 인덱스(= template_matching_init_idx)는 템플릿 매칭 탐색 시작 점을 초기화하는 복수의 방법들 중 하나의 방법을 지시할 수 있다. 템플릿 매칭 초기화 인덱스가 지시하는 방법에 의해 템플릿 매칭 탐색 시작 점이 초기화될 수 있다.The template matching initialization index (= template_matching_init_idx) may indicate one of a plurality of methods for initializing the template matching search start point. The template matching search start point can be initialized by the method indicated by the template matching initialization index.

template_matching_init_idx는 도 57의 표에서 설명된 것과 같이 템플릿 매칭 탐색 시작 점을 초기화하는 방법을 나타낼 수 있다.template_matching_init_idx may indicate a method of initializing the template matching search start point as described in the table of FIG. 57.

예를 들면, template_matching_init_idx가 제1 값인 경우, 대상 블록의 템플릿에 대응하는 템플릿 매칭 참조 영상 내의 대응 위치가 템플릿 매칭 탐색 시작 점으로서 사용될 수 있다. template_matching_init_idx가 제2 값인 경우, 머지 리스트의 움직임 벡터를 이용하여 템플릿 매칭 탐색 시작 점이 획득될 수 있다. template_matching_init_idx가 제3 값인 경우, 대상 블록의 인접 블록들 중 템플릿 매칭 코딩된 블록의 코딩 정보를 이용하여 템플릿 매칭 탐색 시작 점이 획득될 수 있다.For example, when template_matching_init_idx is the first value, the corresponding position in the template matching reference image corresponding to the template of the target block can be used as the template matching search starting point. If template_matching_init_idx is the second value, the template matching search start point can be obtained using the motion vector of the merge list. When template_matching_init_idx is the third value, the template matching search starting point can be obtained using coding information of a template matching coded block among adjacent blocks of the target block.

템플릿 매칭 탐색 방법의 시그널링Signaling of template matching search method

템플릿, 템플릿 매칭 참조 영상, 템플릿 매칭 탐색 영역 및 템플릿 매칭 탐색 시작 점이 주어지면, 이러한 템플릿, 템플릿 매칭 참조 영상, 템플릿 매칭 탐색 영역 및 템플릿 매칭 탐색 시작 점에 기반하는 템플릿 매칭 탐색 방법이 결정될 수 있다.Given a template, a template matching reference image, a template matching search area, and a template matching search start point, a template matching search method based on these templates, a template matching reference image, a template matching search area, and a template matching search start point may be determined.

예를 들면, 템플릿 매칭 탐색 방법은 템플릿 매칭 탐색 영역 내의 픽셀들 중 어떤 픽셀들을 어떻게 탐색하는가를 나타내는 정보일 수 있다.For example, the template matching search method may be information indicating which pixels in the template matching search area and how to search.

템플릿 매칭 탐색 방법은 전역 탐색(full search), 2D 대수적(logarithmic) 탐색, N-스탭(step) 탐색, 다이아몬드(diamond) 탐색, 육각형(hexagonal) 탐색 및 테스트 존(test zone) 탐색을 포함할 수 있다.Template matching search methods may include full search, 2D logarithmic search, N-step search, diamond search, hexagonal search, and test zone search. there is.

실시예에서, 전역 탐색은 템플릿 매칭 탐색 영역 내의 모든 픽셀들을 탐색하는 것을 의미할 수 있다.In an embodiment, global search may mean searching all pixels within the template matching search area.

템플릿 매칭 탐색 방법을 특정하는 구문 요소(= template_matching_search_idx)를 시그널링될 수 있다.A syntax element (= template_matching_search_idx) that specifies the template matching search method may be signaled.

예를 들면, template_matching_search_idx가 제1 값인 경우, 전역 탐색이 수행될 수 있다. template_matching_search_idx가 제2 값인 경우, 2D 대수적 탐색이 수행될 수 있다. template_matching_search_idx가 제3 값인 경우, N-스탭 탐색이 수행될 수 있다. template_matching_search_idx가 제4 값인 경우, 다이아몬드 탐색이 수행될 수 있다. template_matching_search_idx가 제5 값인 경우, 육각형 탐색이 수행될 수 있다. template_matching_search_idx가 제6 값인 경우, 테스트 존 탐색이 수행될 수 있다.For example, if template_matching_search_idx is the first value, global search may be performed. If template_matching_search_idx is the second value, 2D algebraic search may be performed. If template_matching_search_idx is the third value, N-step search may be performed. If template_matching_search_idx is the fourth value, a diamond search may be performed. If template_matching_search_idx is the fifth value, hexagon search may be performed. If template_matching_search_idx is the sixth value, test zone search may be performed.

템플릿 매칭 상관관계 척도(correlation criteria)Template matching correlation criteria

실시예들에서 설명되는 상관관계는 비용 함수에 기반하여 계산될 수 있다.The correlation described in the embodiments may be calculated based on a cost function.

예를 들면, 상관관계가 더 높을 수록 비용 함수의 결과 값이 더 작을 수 있다.For example, the higher the correlation, the smaller the resulting cost function may be.

예를 들어, 비용 함수는 SAD, SATD, 중간-제거된 절대 차이들의 합(Mean Removed Sum of Absolute Differences; MR-SAD), 중간 제곱된 오차(Mean Squared Error; MSE) 및 제곱된 오차들의 합(Sum of Squared Errors; SSE) 중 하나 이상일 수 있다. 비용 함수의 타입이 앞서 열거된 항목들로 한정되지는 않는다.For example, cost functions include SAD, SATD, Mean Removed Sum of Absolute Differences (MR-SAD), Mean Squared Error (MSE), and Sum of Squared Errors ( Sum of Squared Errors; SSE). The type of cost function is not limited to the items listed above.

실시예들에서, "비용 함수"는 "상관관계 척도"로 명명될 수 있다.In embodiments, the “cost function” may be named “correlation measure.”

실시예들에서, "최고 상관관계"는 상관관계에 관련된 값이 가장 크다는 것을 의미할 수 있다. 최고 상관관계는 비용 함수(또는, 상관관계 척도)의 결과 값이 가장 작다는 것을 의미할 수 있다.In embodiments, “highest correlation” may mean that the value associated with the correlation is the largest. The highest correlation may mean that the resulting cost function (or correlation measure) has the smallest value.

실시예들에서는, 템플릿 및 픽셀과 같은 객체가 상관관계를 가질 수 있음이 설명되었다.In embodiments, it has been described that objects such as templates and pixels can be correlated.

실시예들에서, 최고 상관관계를 갖는 객체는 가장 큰 상관관계에 관련된 값을 갖는 객체는 의미할 수 있다. 그러나, 최고의 상관관계를 갖는 객체는 하나의 객체로 한정되지 않을 수 있다.In embodiments, the object with the highest correlation may mean the object with the value associated with the greatest correlation. However, the object with the best correlation may not be limited to one object.

실시예들에서, 객체들의 상관관계에 관련된 값들의 내림차순으로 객체들이 소트될 수 있다. 소트된 객체들 중 앞에 위치한 복수의 객체들이 최고 상관관계를 갖는 객체로 간주될 수 있다. 여기에서, 복수의 객체들은 N 개일 수 있다. N은 선택되어야 할 객체들의 개수를 나타낼 수 있다.In embodiments, objects may be sorted in descending order of values related to their correlation. Among the sorted objects, a plurality of objects located at the front may be considered as the objects with the highest correlation. Here, there may be N plural objects. N may represent the number of objects to be selected.

또는, 객체들의 비용 함수(또는, 상관관계 척도)의 결과 값들의 오름차순으로 객체들이 소트될 수 있고, 소트된 객체들 중 앞에 위치한 복수의 객체들이 최고 상관관계를 갖는 객체로 간주될 수 있다. 여기에서, 복수의 객체들은 N 개일 수 있다. N은 선택되어야 할 객체들의 개수를 나타낼 수 있다.Alternatively, the objects may be sorted in ascending order of the result values of the cost function (or correlation measure) of the objects, and a plurality of objects located in front among the sorted objects may be considered as the object with the highest correlation. Here, there may be N plural objects. N may represent the number of objects to be selected.

예를 들면, N은 2일 수 있다. 또는, N은 3일 수 있다.For example, N may be 2. Alternatively, N may be 3.

말하자면, 최고 상관관계는 비용함수(또는 상관관계 척도)의 결과값이 가장 작다는 것을 의미할 수 있다.In other words, the highest correlation may mean that the resulting cost function (or correlation measure) is the smallest.

템플릿 매칭을 통해 최고 상관관계를 갖는 템플릿이 검색될 때, 상관관계 척도는 SAD, SSD 및 SATD) 중 적어도 하나일 수 있다.When a template with the highest correlation is searched for through template matching, the correlation measure may be at least one of SAD, SSD, and SATD).

가장 낮은 상관관계 척도 값을 갖는 템플릿이 대상 블록의 템플릿과 최고 상관관계를 갖는 것으로 판단될 수 있다.The template with the lowest correlation measure value may be determined to have the highest correlation with the template of the target block.

실시예에서, 상관관계, 비용함수 및 상관관계 척도 중 적어도 하나를 계산함에 있어서, 픽셀 대신, 움직임 벡터 및 인트라 예측 모드(또는, 인트라 예측 방향) 등과 같은 코딩 파라미터가 사용될 수 있다. 말하자면, 실시예에서, 픽셀이 사용된다는 것은 픽셀의 픽셀 값이 사용된다는 것 뿐만 아니라, 픽셀의 위치 또는 픽셀을 포함하는 블록에 대해 설정된 정보가 사용된다는 것을 의미할 수도 있다. 여기에서, 정보는 코딩 정보를 포함할 수 있다.In an embodiment, when calculating at least one of correlation, cost function, and correlation measure, coding parameters such as motion vector and intra prediction mode (or intra prediction direction) may be used instead of pixels. That is, in an embodiment, using a pixel may mean that not only the pixel value of the pixel is used, but also that information set about the location of the pixel or the block containing the pixel is used. Here, the information may include coding information.

예를 들면, 움직임 벡터, 화면내 예측 모드(방향) 등의 코딩 파라미터 중 적어도 하나를 이용하여, 상관관계, 비용함수(또는, 상관관계 척도) 중 적어도 하나가 계산될 수 있다.For example, at least one of a correlation and a cost function (or correlation measure) may be calculated using at least one of coding parameters such as a motion vector and an intra-screen prediction mode (direction).

또한, 템플릿 매칭에 의해 결정된, 최고 상관관계를 갖는 코딩 파라미터, 최저 비용함수를 갖는 코딩 파라미터 및 최저 상관관계 척도를 갖는 코딩 파라미터 중 적어도 하나는 후보 리스트에 포함될 수 있다.Additionally, at least one of the coding parameter with the highest correlation, the coding parameter with the lowest cost function, and the coding parameter with the lowest correlation measure determined by template matching may be included in the candidate list.

예를 들면, 후보 리스트는 인트라 예측 모드의 부호화/복호화를 위한 리스트일 수 있다. 후보 리스트는 가장 개연성있는 모드(Most Probable Mode; MPM) 리스트일 수 있다.For example, the candidate list may be a list for encoding/decoding in intra prediction mode. The candidate list may be a Most Probable Mode (MPM) list.

예를 들면, 후보 리스트는 움직임 정보의 부호화/복호화를 위한 리스트일 수 있다. 후보 리스트는 향상된 움직임 벡터 예측(Advanced Motion Vector Prediction; AMVP) 및 머지 리스트 중 적어도 하나일 수 있다.For example, the candidate list may be a list for encoding/decoding motion information. The candidate list may be at least one of an advanced motion vector prediction (AMVP) and a merge list.

템플릿 매칭 탐색에서 사용되는 상관관계 척도(또는, 비용함수)를 특정하는 구문 요소(= template_matching_criteria_idx)가 시그널링될 수 있다. A syntax element (= template_matching_criteria_idx) that specifies the correlation measure (or cost function) used in template matching search may be signaled.

template_matching_criteria_idx는 복수의 상관관계 척도들 중 템플릿 매칭 탐색에서 사용되는 상관관계 척도를 지시할 수 있다. 복수의 상관관계 척도들은 SAD, SSD, SATD, MR_SAD 및 SSE 등을 포함할 수 있다.template_matching_criteria_idx may indicate a correlation measure used in a template matching search among a plurality of correlation measures. The plurality of correlation measures may include SAD, SSD, SATD, MR_SAD, and SSE.

예를 들면, template_matching_criteria_idx가 제1 값인 경우, 상관관계 척도(또는, 비용 함수는) SAD일 수 있다. template_matching_criteria_idx가 제2 값인 경우, 상관관계 척도(또는, 비용 함수는) SSD일 수 있다. template_matching_criteria_idx가 제5 값인 경우, 상관관계 척도(또는, 비용 함수는) SATD일 수 있다. template_matching_criteria_idx가 제4 값인 경우, 상관관계 척도(또는, 비용 함수는) MR_SAD일 수 있다. template_matching_criteria_idx가 제5 값인 경우, 상관관계 척도(또는, 비용 함수는) SSE일 수 있다.For example, if template_matching_criteria_idx is the first value, the correlation measure (or cost function) may be SAD. If template_matching_criteria_idx is the second value, the correlation measure (or cost function) may be SSD. If template_matching_criteria_idx is the fifth value, the correlation measure (or cost function) may be SATD. If template_matching_criteria_idx is the fourth value, the correlation measure (or cost function) may be MR_SAD. If template_matching_criteria_idx is the fifth value, the correlation measure (or cost function) may be SSE.

탬플릿 매칭 탐색의 조기 종료Early termination of template matching search

템플릿 매칭 탐색 영역의 모두가 조사되지 안았더라도, 특정 조건이 충족되는 경우 템플릿 매칭 탐색을 조기 종료될 수 있다. 이러한 조기 종료를 "템플릿 매칭 탐색 조기 종료"로 명명할 수 있다.Even if not all of the template matching search area has been searched, the template matching search may be terminated early if a specific condition is met. This early termination can be named “early termination of template matching search.”

일 실시예에서, 특정 조건은 1) 상관관계 척도의 값이 특정 임계치보다 더 작은 경우 및 2) 탐색에 의해 도출된 상관관계 척도의 값 및 이전의 상관관계 척도의 값 간의 차이가 특정 임계치 보다 더 작은 경우 중 적어도 하나일 수 있다. In one embodiment, certain conditions are 1) the value of the correlation measure is less than a certain threshold and 2) the difference between the value of the correlation measure derived by the search and the value of the previous correlation measure is more than a certain threshold. It may be at least one of the small cases.

템플릿 매칭 탐색 조기 종료가 허용되는지 여부를 나타내는 구문 요소(= template_matching_early_termination_flag)가 시그널링될 수 있다.A syntax element (= template_matching_early_termination_flag) indicating whether early termination of the template matching search is allowed may be signaled.

예를 들면, template_matching_early_termination_flag가 제1 값인 경우, 템플릿 매칭 탐색 조기 종료가 허용되지 않을 수 있다. template_matching_early_termination_flag가 제2 값인 경우, 템플릿 매칭 탐색 조기 종료가 허용될 수 있다.For example, if template_matching_early_termination_flag is the first value, early termination of template matching search may not be allowed. If template_matching_early_termination_flag is the second value, early termination of template matching search may be allowed.

조기 종료를 판단하기 위한 조건에서 사용되는 임계치 정보(= template_matching_early_termination_threshold)가 시그널링될 수 있다. 임계치로서 상관관계 척도의 값을 사용하는 template_matching_early_termination_threshold1 및 임계치로서 상관관계 척도들의 값들 간의 차이를 사용하는 template_matching_early_termination_threshold2가 사용될 수 있다.Threshold information (= template_matching_early_termination_threshold) used in conditions for determining early termination may be signaled. template_matching_early_termination_threshold1, which uses the value of the correlation measure as the threshold, and template_matching_early_termination_threshold2, which uses the difference between the values of the correlation measures as the threshold, can be used.

예를 들면, template_matching_early_termination_threshold1이 Th1tm인 경우, 특정 픽셀의 상관관계 척도의 값이 Th1tm보다 더 작으면 템플릿 매칭 탐색 조기 종료가 진행될 수 있고, 상기의 특정 픽셀이 최고 상관 관계를 갖는 최적 픽셀로 판단될 수 있다. 이 때, 상기의 특정 픽셀을 포함하는 템플릿에 대응하는 인접 블록이 대상 블록의 부호화/복호화를 위한 템플릿 매칭 최적 블록이 될 수 있다.For example, when template_matching_early_termination_threshold1 is Th1 tm , if the value of the correlation scale of a specific pixel is smaller than Th1 tm , early termination of the template matching search may proceed, and the specific pixel is determined to be the optimal pixel with the highest correlation. It can be. At this time, the adjacent block corresponding to the template containing the specific pixel may be the optimal template matching block for encoding/decoding the target block.

예를 들면, template_matching_early_termination_threshold2이 Th2tm인 경우, 특정 픽셀의 상관관계 척도의 값 및 이전의 탐색에서의 상관관계 척도의 값 간의 차이가 Th2tm보다 더 작으면 템플릿 매칭 탐색 조기 종료가 진행될 수 있고, 상기의 특정 픽셀이 최고 상관 관계를 갖는 최적 픽셀로 판단될 수 있다. 이 때, 상기의 특정 픽셀을 포함하는 템플릿에 대응하는 인접 블록이 대상 블록의 부호화/복호화를 위한 템플릿 매칭 최적 블록이 될 수 있다.For example, when template_matching_early_termination_threshold2 is Th2 tm , if the difference between the value of the correlation measure of a specific pixel and the value of the correlation measure in the previous search is smaller than Th2 tm , early termination of the template matching search may proceed, and A specific pixel in can be determined to be the optimal pixel with the highest correlation. At this time, the adjacent block corresponding to the template containing the specific pixel may be the optimal template matching block for encoding/decoding the target block.

템플릿, 템플릿 매칭 참조 영상, 템플릿 매칭 최적 블록 및 템플릿 매칭 움직임 벡터 중 적어도 하나를 이용하여 대상 블록의 부호화/복호화가 수행될 수 있다.Encoding/decoding of the target block may be performed using at least one of a template, a template matching reference image, a template matching optimal block, and a template matching motion vector.

템플릿 매칭 최적 블록을 이용하는 부호화/복호화Encoding/decoding using template matching optimal blocks

아래에서는 단계(2040)에서의 템플릿 매칭 최적 블록을 이용하는 부호화/복호화가 설명된다.Below, encoding/decoding using the template matching optimal block in step 2040 is described.

템플릿 매칭 기반 인트라 잔차 신호 예측Intra residual signal prediction based on template matching

아래에서는 단계(2041)에서의 템플릿 매칭 기반 인트라 잔차 신호 예측이 설명된다.Below, template matching based intra residual signal prediction in step 2041 is described.

도 58a는 일 예에 따른 대상 영상이 템플릿 매칭 참조 영상인 경우의 대상 블록, 템플릿 매칭 최적 블록 및 인트라 예측 모드들을 나타낸다.FIG. 58A shows a target block, template matching optimal block, and intra prediction modes when the target image is a template matching reference image according to an example.

도 58b는 일 예에 따른 대상 영상 및 템플릿 매칭 참조 영상이 서로 다른 경우의 대상 블록, 템플릿 매칭 최적 블록 및 인트라 예측 모드들을 나타낸다.Figure 58b shows a target block, template matching optimal block, and intra prediction modes when the target image and the template matching reference image are different according to an example.

템플릿 매칭 최적 블록을 이용하여 대상 블록의 예측 오차(또는, 잔차 신호)에 대한 예측이 수행될 수 있다. 이러한 예측을 통해 예측된 잔차 신호가 생성될 수 있다.Prediction of the prediction error (or residual signal) of the target block may be performed using the template matching optimal block. Through this prediction, a predicted residual signal can be generated.

템플릿 매칭 최적 블록을 사용하여 대상 블록의 잔차 신호를 예측함으로써 잔차 신호 및 예측된 잔차 신호 간의 차이 값이 도출될 수 있다. 도출된 차이 값은 부호화/복호화/시그널링될 수 있다. 차이 값 및 예측된 잔차 신호를 합함으로써 재구축된 잔차 신호가 획득될 수 있다.By predicting the residual signal of the target block using the template matching optimal block, the difference value between the residual signal and the predicted residual signal can be derived. The derived difference value may be encoded/decoded/signaled. A reconstructed residual signal can be obtained by summing the difference value and the predicted residual signal.

대상 블록에 대해 인트라 예측 또는 인트라 예측 모드에 따른 잔차 신호가 획득되었을 때, 템플릿 매칭에 의해 도출된 템플릿 매칭 최적 블록에 대하여 동일한 인트라 예측 모드를 적용함으로써 템플릿 매칭 최적 블록의 잔차 신호가 획득될 수 있다. 말하자면, 대상 블록 및 최적 블록에 대해 동일한 인트라 예측 모드를 사용하는 인트라 예측들이 각각 수행될 수 있다. 인트라 예측들에 의해 대상 블록에 대한 잔차 신호 및 템플릿 매칭 최적 블록에 대한 잔차 신호가 생성될 수 있다.When a residual signal according to intra prediction or intra prediction mode is obtained for the target block, the residual signal of the template matching optimal block can be obtained by applying the same intra prediction mode to the template matching optimal block derived by template matching. . In other words, intra predictions using the same intra prediction mode can be performed on the target block and the optimal block, respectively. A residual signal for the target block and a residual signal for the template matching optimal block may be generated through intra predictions.

템플릿 매칭 최적 블록의 잔차 신호가 대상 블록의 잔차 신호에 대한 예측을 위해 사용될 수 있다. 말하자면, 템플릿 매칭 최적 블록의 잔차 신호가 대상 블록에 대한 예측된 잔차 신호로 간주될 수 있다. 이러한 예측된 잔차 신호 및 대상 블록의 잔차 신호 간의 차이 값이 부호화/복호화/시그널링될 수 있다. 이러한 잔차 신호에 대한 예측 및/또는 차이 값의 시그널링을 TM 기반 인트라 잔차 신호 예측으로 칭할 수 있다.The residual signal of the template matching optimal block can be used to predict the residual signal of the target block. In other words, the residual signal of the template matching optimal block can be regarded as the predicted residual signal for the target block. The difference value between this predicted residual signal and the residual signal of the target block may be encoded/decoded/signaled. Prediction of this residual signal and/or signaling of the difference value may be referred to as TM-based intra residual signal prediction.

실시예들에서, 인트라 잔차 신호는 인트라 예측에 의해 생성된 잔차 신호를 의미할 수 있다. 신호는 블록을 의미할 수 있으며, 특정 위치에서의 신호는 상기의 특정 위치에서의 픽셀 또는 픽셀 값을 의미할 수 있다.In embodiments, an intra residual signal may refer to a residual signal generated by intra prediction. A signal may refer to a block, and a signal at a specific location may refer to a pixel or pixel value at the specific location.

특정 위치 (x, y)에 대해, ot(x, y)는 대상 블록의 신호를 나타낼 수 있다. m_i는 제i 인트라 예측 모드를 나타낼 수 있다. Pt,m_i(x, y)는 제i 인트라 예측 모드를 사용하는 대상 블록에 대한 예측을 수행함으로써 생성된 신호일 수 있다. 이 때, 대상 블록의 인트라 예측 잔차 신호 Rt,m_i(x, y)는 아래의 수식 21과 같이 결정될 수 있다.For a specific location (x, y), o t (x, y) may represent the signal of the target block. m_i may indicate the i-th intra prediction mode. P t,m_i (x, y) may be a signal generated by performing prediction on the target block using the i-th intra prediction mode. At this time, the intra prediction residual signal R t,m_i (x, y) of the target block can be determined as in Equation 21 below.

[수식 21][Formula 21]

Rt,m_i(x, y) = ot(x, y) - Pt,m_i(x, y)R t,m_i (x, y) = o t (x, y) - P t,m_i (x, y)

특정 위치 (x, y)에 대해, Recs(x, y)는 템플릿 매칭 최적 블록의 신호를 나타낼 수 있다. Ps,m_i(x, y)는 제i 인트라 예측 모드를 사용하는 템플릿 매칭 최적 블록에 대한 예측을 수행함으로써 생성된 신호일 수 있다. 이 때, 제i 인트라 예측 모드를 사용하는 템플릿 매칭 최적 블록을 예측을 수행함으로써 생성된 템플릿 매칭 최적 블록의 인트라 예측 잔차 신호 Rs,m_i(x, y)는 아래의 수식 22과 같이 결정될 수 있다.For a specific location (x, y), Rec s (x, y) may represent the signal of the template matching optimal block. P s,m_i (x, y) may be a signal generated by performing prediction on the template matching optimal block using the ith intra prediction mode. At this time, the intra prediction residual signal R s,m_i (x, y) of the template matching optimal block generated by predicting the template matching optimal block using the i th intra prediction mode can be determined as in Equation 22 below. .

[수식 22][Formula 22]

Rs,m_i(x, y) = Recs(x, y) - Ps,m_i(x, y)R s,m_i (x, y) = Rec s (x, y) - P s,m_i (x, y)

템플릿 매칭 움직임 벡터 MVtm는 아래의 수식 23과 같을 수 있다.The template matching motion vector MV tm may be expressed as Equation 23 below.

[수식 23][Formula 23]

MVtm = (xtm, ytm)MV tm = (x tm , y tm )

특정 위치 (x, y)에 대하여, 템플릿 매칭 최적 블록의 잔차 신호 Rs,m_i(x + xtm, y + ytm)가 대상 블록의 잔차 신호 Rt,m_i(x, y)에 대한 예측을 위해 사용될 수 있다. 말하자면, 템플릿 매칭 최적 블록의 잔차 신호 Rs,m_i(x + xtm, y + ytm)가 대상 블록의 잔차 신호 예측 값으로 간주될 수 있다.For a specific location (x, y), the residual signal R s,m_i (x + x tm , y + y tm ) of the template matching optimal block is a prediction of the residual signal R t,m_i (x, y) of the target block. It can be used for. In other words, the residual signal R s,m_i (x + x tm , y + y tm ) of the template matching optimal block can be regarded as the residual signal prediction value of the target block.

DTMRP(x, y)는 대상 블록의 잔차 신호 Rt,m_i(x, y) 및 대상 블록의 잔차 신호 예측 값(즉, 템플릿 매칭 최적 블록의 잔차 신호) Rs,m_i(x + xtm, y + ytm) 간의 차이 값일 수 있다. DTMRP(x, y)는 아래의 수식 24와 같이 정의될 수 있다.D TMRP (x, y) is the residual signal of the target block R t,m_i (x, y) and the predicted value of the residual signal of the target block (i.e., the residual signal of the template matching optimal block) R s,m_i (x + x tm , y + y tm ). D TMRP (x, y) can be defined as Equation 24 below.

[수식 24][Formula 24]

DTMRP(x, y) = Rt,m_i(x, y) - Rs,m_i(x + xtm, y + ytm)D TMRP (x, y) = R t,m_i (x, y) - R s,m_i (x + x tm , y + y tm )

특정 위치 (x, y)에 대하여 DTMRP(x, y)가 주어지면, 1) 템플릿 매칭 참조 영상, 2) 템플릿 매칭 움직임 벡터 MVtm(= (xtm, ytm)), 3) 템플릿 매칭 최적 블록, 4) 제i 인트라 예측 모드를 사용하는 대상 블록에 대한 예측을 수행함으로써 생성된 신호 Pt,m_i(x, y), 5) 템플릿 매칭 최적 블록의 신호 Recs(x, y), 6) 제i 인트라 예측 모드를 사용하는 템플릿 매칭 최적 블록에 대한 예측을 수행함으로써 생성된 신호 Ps,m_i(x, y) 및 7) 제i 인트라 예측 모드를 사용하는 템플릿 매칭 최적 블록을 예측을 수행함으로써 생성된 템플릿 매칭 최적 블록의 인트라 예측 잔차 신호 Rs,m_i(x, y) 중 적어도 하나를 사용하여 대상 블록의 재구축된 신호를 획득할 수 있다.Given D TMRP (x, y) for a specific position (x, y), 1) template matching reference image, 2) template matching motion vector MV tm (= (x tm , y tm )), 3) template matching optimal block, 4) signal P t,m_i (x, y) generated by performing prediction on the target block using the i-th intra prediction mode, 5) signal Rec s (x, y) of template matching optimal block, 6) Signal P s,m_i (x, y) generated by performing prediction for the template matching optimal block using the i-th intra prediction mode and 7) predicting the template matching optimal block using the i-th intra prediction mode. The reconstructed signal of the target block can be obtained using at least one of the intra prediction residual signals R s,m_i (x, y) of the template matching optimal block generated by performing the process.

Rect(x, y)는 대상 블록의 재구축된 신호일 수 있다. Rect(x, y)는 아래의 수식 25에 따라서 획득될 수 있다.Rec t (x, y) may be the reconstructed signal of the target block. Rec t (x, y) can be obtained according to Equation 25 below.

[수식 25][Formula 25]

Rect(x, y) = Pt,m_i(x, y) + DTMRP(x, y) + Rs,m_i(x + xtm, y + ytm) = Pt,m_i(x, y) + DTMRP(x, y) + Recs(x + xtm, y + ytm) - Ps,m_i(x + xtm, y + ytm)Rec t (x, y) = P t,m_i (x, y) + D TMRP (x, y) + R s,m_i (x + x tm , y + y tm ) = P t,m_i (x, y ) + D TMRP (x, y) + Rec s (x + x tm , y + y tm ) - P s,m_i (x + x tm , y + y tm )

도 58a에서 도시된 것과 같이, 템플릿 매칭 참조 영상은 대상 블록이 포함되는 대상 영상일 수 있다.As shown in FIG. 58A, the template matching reference image may be a target image including a target block.

도 58b에서 도시된 것과 같이, 템플릿 매칭 참조 영상은 대상 블록이 포함되는 대상 영상이 아닐 수 있다. 예를 들면, 템플릿 매칭 참조 영상은 참조 영상 리스트 L0 또는 참조 영상 리스트 L1 내의 참조 영상일 수 있다.As shown in FIG. 58B, the template matching reference image may not be the target image including the target block. For example, the template matching reference image may be a reference image in the reference image list L0 or the reference image list L1.

인트라 예측 모드가 플래너(Planar) 모드인 경우의 예측Forecast when intra prediction mode is Planar mode

특정 위치 (x, y)에 대해, ot(x, y)는 대상 블록의 신호를 나타낼 수 있다. 대상 블록에 대한 (최적의) 인트라 예측 모드는 플래너 모드일 수 있다. 이 때, Pt,Planar(x, y)는 플래너 모드를 사용하는 대상 블록에 대한 예측을 수행함으로써 생성된 신호일 수 있다. 이 때, 플래너 모드를 사용하는 예측을 수행함으로써 생성되는 대상 블록의 인트라 예측 잔차 신호 Rt,Planar(x, y)는 아래의 수식 26과 같이 결정될 수 있다.For a specific location (x, y), o t (x, y) may represent the signal of the target block. The (optimal) intra prediction mode for the target block may be planner mode. At this time, P t,Planar (x, y) may be a signal generated by performing prediction on the target block using planar mode. At this time, the intra prediction residual signal R t,Planar (x, y) of the target block generated by performing prediction using the planar mode can be determined as in Equation 26 below.

[수식 26][Formula 26]

Rt,Planar(x, y) = ot(x, y) - Pt,Planar(x, y)R t,Planar (x, y) = o t (x, y) - P t,Planar (x, y)

특정 위치 (x, y)에 대해, Recs(x, y)는 템플릿 매칭 최적 블록의 신호를 나타낼 수 있다. Ps,Planar(x, y)는 플래너 모드를 사용하는 템플릿 매칭 최적 블록에 대한 예측을 수행함으로써 생성된 신호일 수 있다. 이 때, 플래너 모드를 사용하는 템플릿 매칭 최적 블록을 예측을 수행함으로써 생성된 템플릿 매칭 최적 블록의 인트라 예측 잔차 신호 Rs,Planar(x, y)는 아래의 수식 27과 같이 결정될 수 있다.For a specific location (x, y), Rec s (x, y) may represent the signal of the template matching optimal block. P s,Planar (x, y) may be a signal generated by performing prediction on the template matching optimal block using planar mode. At this time, the intra prediction residual signal R s,Planar (x, y) of the template matching optimal block generated by performing prediction on the template matching optimal block using the planner mode can be determined as in Equation 27 below.

[수식 27][Formula 27]

Rs,Planar(x, y) = Recs(x, y) - Ps,Planar(x, y)R s,Planar (x, y) = Rec s (x, y) - P s,Planar (x, y)

템플릿 매칭 움직임 벡터 MVtm는 아래의 수식 28과 같을 수 있다.The template matching motion vector MV tm may be expressed as Equation 28 below.

[수식 28][Formula 28]

MVtm = (xtm, ytm)MV tm = (x tm , y tm )

특정 위치 (x, y)에 대하여, 템플릿 매칭 최적 블록의 잔차 신호 Rs,Planar(x + xtm, y + ytm)가 대상 블록의 잔차 신호 Rt,Planar(x, y)에 대한 예측을 위해 사용될 수 있다. 말하자면, 템플릿 매칭 최적 블록의 잔차 신호 Rs,Planar(x + xtm, y + ytm)가 대상 블록의 잔차 신호 예측 값으로 간주될 수 있다.For a specific location (x, y), the residual signal R s,Planar (x + x tm , y + y tm ) of the template matching optimal block is a prediction of the residual signal R t,Planar (x, y) of the target block. It can be used for. In other words, the residual signal R s,Planar (x + x tm , y + y tm ) of the template matching optimal block can be regarded as the residual signal prediction value of the target block.

DTMRP(x, y)는 대상 블록의 잔차 신호 Rt,Planar(x, y) 및 대상 블록의 잔차 신호 예측 값(즉, 템플릿 매칭 최적 블록의 잔차 신호) Rs,Planar(x + xtm, y + ytm) 간의 차이 값일 수 있다. DTMRP(x, y)는 아래의 수식 29와 같이 정의될 수 있다.D TMRP (x, y) is the residual signal of the target block R t,Planar (x, y) and the predicted value of the residual signal of the target block (i.e., the residual signal of the template matching optimal block) R s,Planar (x + x tm , y + y tm ). D TMRP (x, y) can be defined as Equation 29 below.

[수식 29][Formula 29]

DTMRP(x, y) = Rt,Planar(x, y) - Rs,Planar(x + xtm, y + ytm)D TMRP (x, y) = R t,Planar (x, y) - R s,Planar (x + x tm , y + y tm )

특정 위치 (x, y)에 대하여 DTMRP(x, y)가 주어지면, 1) 템플릿 매칭 참조 영상, 2) 템플릿 매칭 움직임 벡터 MVtm(= (xtm, ytm)), 3) 템플릿 매칭 최적 블록, 4) 플래너 모드를 사용하는 대상 블록에 대한 예측을 수행함으로써 생성된 신호 Pt,Planar(x, y), 5) 템플릿 매칭 최적 블록의 신호 Recs(x, y), 6) 플래너 모드를 사용하는 템플릿 매칭 최적 블록에 대한 예측을 수행함으로써 생성된 신호 Ps,Planar(x, y) 및 7) 플래너 모드를 사용하는 템플릿 매칭 최적 블록을 예측을 수행함으로써 생성된 템플릿 매칭 최적 블록의 인트라 예측 잔차 신호 Rs,Planar(x, y) 중 적어도 하나를 사용하여 대상 블록의 재구축된 신호를 획득할 수 있다.Given D TMRP (x, y) for a specific position (x, y), 1) template matching reference image, 2) template matching motion vector MV tm (= (x tm , y tm )), 3) template matching Optimal block, 4) Signal P t,Planar (x, y), generated by performing prediction on target block using Planar mode, 5) Signal of template matching optimal block Rec s (x, y), 6) Planar The signal P s,Planar (x,y) generated by performing prediction on the template matching optimal block using mode 7) and 7) the signal of the template matching optimal block generated by performing prediction on the template matching optimal block using planar mode. The reconstructed signal of the target block can be obtained using at least one of the intra prediction residual signals R s, Planar (x, y).

Rect(x, y)는 대상 블록의 재구축된 신호일 수 있다. Rect(x, y)는 아래의 수식 30에 따라서 획득될 수 있다.Rec t (x, y) may be the reconstructed signal of the target block. Rec t (x, y) can be obtained according to Equation 30 below.

[수식 30][Formula 30]

Rect(x, y) = Pt,Planar(x, y) + DTMRP(x, y) + Rs,Planar(x + xtm, y + ytm) = Pt,Planar(x, y) + DTMRP(x, y) + Recs(x + xtm, y + ytm) - Ps,Planar(x + xtm, y + ytm)Rec t (x, y) = P t,Planar (x, y) + D TMRP (x, y) + R s,Planar (x + x tm , y + y tm ) = P t,Planar (x, y ) + D TMRP (x, y) + Rec s (x + x tm , y + y tm ) - P s,Planar (x + x tm , y + y tm )

템플릿 매칭 기반 인트라 잔차 신호 예측을 위한 구문 요소의 시그널링Signaling of syntactic elements for intra residual signal prediction based on template matching.

대상 블록이 TM 기반 인트라 잔차 신호 예측을 사용하여 부호화/복호화되는지 여부를 지시하는 구문 요소(= tm_intra_residual_pred)가 시그널링될 수 있다.A syntax element (=tm_intra_residual_pred) indicating whether the target block is encoded/decoded using TM-based intra residual signal prediction may be signaled.

예를 들면, tm_intra_residual_pred이 제1 값인 것은 대상 블록이 TM 기반 인트라 잔차 신호 예측 방법을 사용하여 부호화/복호화된 것을 지시할 수 있다. tm_intra_residual_pred이 제2 값인 것은 대상 블록이 TM 기반 인트라 잔차 신호 예측 방법을 사용하여 부호화/복호화되지 않은 것을 지시할 수 있다.For example, tm_intra_residual_pred being the first value may indicate that the target block has been encoded/decoded using a TM-based intra residual signal prediction method. The second value of tm_intra_residual_pred may indicate that the target block has not been encoded/decoded using the TM-based intra residual signal prediction method.

예를 들면, tm_intra_residual_pred이 제1 값인 것은 차이 값 DTMRP(x, y)이 시그널링됨을 지시할 수 있다. tm_intra_residual_pred이 제2 값인 것은 DTMRP(x, y)이 시그널링되지 않음을 지시할 수 있다. DTMRP(x, y)는 대상 블록의 인트라 예측 잔차 신호 Rt,m_i(x, y) 및 대상 블록의 인트라 예측 잔차 신호 예측 값(즉, 템플릿 매칭 최적 블록의 잔차 신호) Rs,m_i(x + xtm, y + ytm) 간의 차이 값일 수 있다.For example, tm_intra_residual_pred being the first value may indicate that the difference value D TMRP (x, y) is signaled. tm_intra_residual_pred being the second value may indicate that D TMRP (x, y) is not signaled. D TMRP (x, y) is the intra prediction residual signal R t,m_i (x, y) of the target block and the predicted value of the intra prediction residual signal of the target block (i.e. the residual signal of the template matching optimal block) R s,m_i ( It may be the difference value between x + x tm , y + y tm ).

DTMRP(x, y)는 실시예의 다른 인트라 예측 잔차 신호를 부호화/복호화/시그널링하는 방법과 동일하게 부호화/복호화/시그널링될 수 있다. 예를 들면, DTMRP(x, y)는 실시예의 변환, 양자화, 엔트로피 부호화, 엔트로피 부호화, 역양자화 및 역변환에 의해 부호화/복호화/시그널링될 수 있다.D TMRP (x, y) may be encoded/decoded/signaled in the same manner as the method of encoding/decoding/signaling other intra prediction residual signals in the embodiment. For example, D TMRP (x, y) can be encoded/decoded/signaled by transformation, quantization, entropy encoding, entropy encoding, inverse quantization, and inverse transformation of the embodiment.

제한적 템플릿 기반 인트라 잔차 신호 예측Constrained template-based intra residual signal prediction

아래에서는 단계(2042)에서의 제한적 TM 기반 인트라 잔차 신호 예측이 설명된다.Constrained TM-based intra residual signal prediction in step 2042 is described below.

대상 블록에 대해 인트라 예측 또는 인트라 예측 모드에 따른 잔차 신호가 획득되었을 때, 템플릿 매칭에 의해 도출된 템플릿 매칭 최적 블록에 대하여 동일한 인트라 예측 모드를 적용함으로써 템플릿 매칭 최적 블록의 잔차 신호가 획득될 수 있다.When a residual signal according to intra prediction or intra prediction mode is obtained for the target block, the residual signal of the template matching optimal block can be obtained by applying the same intra prediction mode to the template matching optimal block derived by template matching. .

템플릿 매칭 최적 블록의 잔차 신호의 일부가 대상 블록의 잔차 신호의 일부에 대한 예측을 위해 사용될 수 있다. 말하자면, 템플릿 매칭 최적 블록의 잔차 신호의 일부가 대상 블록에 대한 예측된 잔차 신호로 간주될 수 있다. 이러한 예측된 잔차 신호 및 대상 블록의 잔차 신호의 일부 간의 차이 값이 부호화/복호화/시그널링될 수 있다. 이러한 잔차 신호에 대한 예측 및/또는 차이 값의 시그널링을 제한적 TM 기반 인트라 잔차 신호 예측으로 칭할 수 있다. 말하자면, 제한적 TM 기반 인트라 잔차 신호 예측은 대상 블록의 일부에 대해 적용되는 TM 기반 인트라 잔차 신호 예측일 수 있다.A part of the residual signal of the template matching optimal block may be used to predict a part of the residual signal of the target block. In other words, a part of the residual signal of the template matching optimal block can be regarded as the predicted residual signal for the target block. The difference value between this predicted residual signal and a portion of the residual signal of the target block may be encoded/decoded/signaled. This prediction of the residual signal and/or signaling of the difference value may be referred to as limited TM-based intra residual signal prediction. In other words, limited TM-based intra residual signal prediction may be TM-based intra residual signal prediction applied to a portion of the target block.

대상 블록의 영역의 일부에 속하는 특정 위치 (x, y) 상의 픽셀에 대하여, 아래의 수식 31에 따라서 DTMRP(x, y)가 도출될 수 있다.For a pixel at a specific location (x, y) belonging to part of the area of the target block, D TMRP (x, y) can be derived according to Equation 31 below.

[수식 31][Formula 31]

DTMRP(x, y) = Rt,m_i(x, y) - Rs,m_i(x + xtm, y + ytm) where (x, y) ∈ a regionD TMRP (x, y) = R t,m_i (x, y) - R s,m_i (x + x tm , y + y tm ) where (x, y) ∈ a region

대상 블록의 영역의 일부에 속하는 특정 위치 (x, y) 상의 픽셀에 대하여, 아래의 수식 32을 사용하는 부호화/복호화/시그널링이 수행될 수 있다.Encoding/decoding/signaling using Equation 32 below may be performed on pixels at specific positions (x, y) that belong to part of the area of the target block.

[수식 32][Formula 32]

Rect(x, y) = Pt,m_i(x, y) + DTMRP(x, y) + Rs,m_i(x + xtm, y + ytm) = Pt,m_i(x, y) + DTMRP(x, y) + Recs(x + xtm, y + ytm) - Ps,m_i(x + xtm, y + ytm) where (x, y) ∈ a regionRec t (x, y) = P t,m_i (x, y) + D TMRP (x, y) + R s,m_i (x + x tm , y + y tm ) = P t,m_i (x, y ) + D TMRP (x, y) + Rec s (x + x tm , y + y tm ) - P s,m_i (x + x tm , y + y tm ) where (x, y) ∈ a region

제한적 TM 기반 인트라 잔차 신호 예측에서도, 도 58a에서 도시된 것과 같이, 템플릿 매칭 참조 영상은 대상 블록이 포함되는 대상 영상일 수 있다.Even in limited TM-based intra residual signal prediction, as shown in FIG. 58A, the template matching reference image may be a target image including the target block.

제한적 TM 기반 인트라 잔차 신호 예측에서도, 도 58b에서 도시된 것과 같이, 템플릿 매칭 참조 영상은 대상 블록이 포함되는 대상 영상이 아닐 수 있다. 예를 들면, 템플릿 매칭 참조 영상은 참조 영상 리스트 L0 또는 참조 영상 리스트 L1 내의 참조 영상일 수 있다.Even in limited TM-based intra residual signal prediction, as shown in FIG. 58B, the template matching reference image may not be the target image including the target block. For example, the template matching reference image may be a reference image in the reference image list L0 or the reference image list L1.

도 59는 일 예에 따른 제1 특정 영역에 대한 제한적 템플릿 매칭 기반 인트라 잔차 신호 예측을 나타낸다.Figure 59 shows intra residual signal prediction based on limited template matching for a first specific region according to an example.

대상 블록의 픽셀들 중 특정 영역에 속하는 픽셀들에 대해서만 TM 기반 인트라 잔차 신호 예측을 사용하는 부호화/복호화/시그널링이 적용될 수 있다.Encoding/decoding/signaling using TM-based intra residual signal prediction may be applied only to pixels belonging to a specific region among the pixels of the target block.

도 59에서, R1은 특정 영역을 나타낸다.In Figure 59, R1 represents a specific region.

특정 영역은 대상 블록 내의 우하단에 인접한 블록일 수 있다.The specific area may be a block adjacent to the lower right corner of the target block.

특정 영역은 1) 대상 블록의 좌측(또는, 템플릿)으로부터의 가로 거리가 dx,th의 이상이고, 2) 대상 블록의 상측(또는, 템플릿)으로부터의 세로 거리가 dy,th의 이상인 픽셀들의 영역일 수 있다.A specific area is a pixel whose 1) horizontal distance from the left side (or template) of the target block is more than d x,th , and 2) the vertical distance from the top of the target block (or template) is more than d y,th It could be their territory.

예를 들면, dx,th는 w/2일 수 있다. w는 대상 블록의 가로 크기일 수 있다.For example, d x,th may be w/2. w may be the horizontal size of the target block.

예를 들면, dy,th는 h/2일 수 있다. h는 대상 블록의 세로 크기일 수 있다.For example, d y,th may be h/2. h may be the vertical size of the target block.

말하자면, 1) 대상 블록(또는, 템플릿)으로부터의 가로 거리가 dx,th의 이상이고, 2) 대상 블록(또는, 템플릿)으로부터의 세로 거리가 dy,th의 이상인 픽셀에 대해서만 TM 기반 인트라 잔차 신호 예측을 사용하는 부호화/복호화/시그널링이 적용될 수 있다.In other words, TM-based intra only for pixels that 1) have a horizontal distance from the target block (or template) of d x,th or more, and 2) have a vertical distance from the target block (or template) of d y,th or more. Encoding/decoding/signaling using residual signal prediction may be applied.

특정 영역 R1 내에 속하는 위치 (x, y) 상의 픽셀에 대하여, 아래의 수식 33에 따라서 DTMRP(x, y)가 도출될 수 있다.For a pixel at a position (x, y) belonging to a specific area R1, D TMRP (x, y) can be derived according to Equation 33 below.

[수식 33][Formula 33]

DTMRP(x, y) = Rt,m_i(x, y) - Rs,m_i(x + xtm, y + ytm) where (x, y) ∈ R1D TMRP (x, y) = R t,m_i (x, y) - R s,m_i (x + x tm , y + y tm ) where (x, y) ∈ R1

특정 영역 R1 내에 속하는 위치 (x, y) 상의 픽셀에 대해 아래의 수식 34에 따른 부호화/복호화가 수행될 수 있다.Encoding/decoding according to Equation 34 below may be performed on pixels at positions (x, y) belonging to a specific area R1.

[수식 34][Formula 34]

Rect(x, y) = Pt,m_i(x, y) + DTMRP(x, y) + Rs,m_i(x + xtm, y + ytm) = Pt,m_i(x, y) + DTMRP(x, y) + Recs(x + xtm, y + ytm) - Ps,m_i(x + xtm, y + ytm) where (x, y) ∈ R1Rec t (x, y) = P t,m_i (x, y) + D TMRP (x, y) + R s,m_i (x + x tm , y + y tm ) = P t,m_i (x, y ) + D TMRP (x, y) + Rec s (x + x tm , y + y tm ) - P s,m_i (x + x tm , y + y tm ) where (x, y) ∈ R1

대상 블록에 대한 (최적의) 인트라 예측 모드는 플래너 모드일 수 있다.The (optimal) intra prediction mode for the target block may be planner mode.

대상 블록의 픽셀 (x, y)에 대하여, 픽셀 및 대상 블록의 좌측(또는, 템플릿) 간의 가로 거리가 w/2의 이상이고, 픽셀 및 대상 블록의 상측(또는, 템플릿) 간의 세로 거리가 h/2의 이상이면, TM 기반 인트라 잔차 신호 예측을 사용하여 DTMRP(x, y)가 도출될 수 있다. DTMRP(x, y)는 아래의 수식 35에 따라서 도출될 수 있다.For a pixel (x, y) of the target block, the horizontal distance between the pixel and the left side (or template) of the target block is greater than or equal to w/2, and the vertical distance between the pixel and the top side (or template) of the target block is h If it is greater than /2, D TMRP (x, y) can be derived using TM-based intra residual signal prediction. D TMRP (x, y) can be derived according to Equation 35 below.

[수식 35][Formula 35]

DTMRP(x, y) = Rt,Planar(x, y) - Rs,Planar(x + xtm, y + ytm) where x ≥ xleft_top + w/2 and y ≥ yleft_top + h/2D TMRP (x, y) = R t,Planar (x, y) - R s,Planar (x + x tm , y + y tm ) where x ≥ x left_top + w/2 and y ≥ y left_top + h/ 2

여기에서, (xleft_top, yleft_top)는 대상 블록의 좌상단 좌표들일 수 있다.Here, (x left_top , y left_top ) may be the upper left coordinates of the target block.

대상 블록의 픽셀 (x, y)에 대하여, 픽셀 및 대상 블록의 좌측(또는, 템플릿) 간의 가로 거리가 w/2의 이상이고, 픽셀 및 대상 블록의 상측(또는, 템플릿) 간의 세로 거리가 h/2의 이상이면, 픽셀은 아래의 수식 36에 따라서 부호화/복호화될 수 있다.For a pixel (x, y) of the target block, the horizontal distance between the pixel and the left side (or template) of the target block is greater than or equal to w/2, and the vertical distance between the pixel and the top side (or template) of the target block is h If it is more than /2, the pixel can be encoded/decoded according to Equation 36 below.

[수식 36][Formula 36]

Rect(x, y) = Pt,Planar(x, y) + DTMRP(x, y) + Rs,Planar(x + xtm, y + ytm) = Pt,Planar(x, y) + DTMRP(x, y) + Recs(x + xtm, y + ytm) - Ps,Planar(x + xtm, y + ytm) where x ≥ xleft_top + w/2 and y ≥ yleft_top + h/2Rec t (x, y) = P t,Planar (x, y) + D TMRP (x, y) + R s,Planar (x + x tm , y + y tm ) = P t,Planar (x, y ) + D TMRP (x, y) + Rec s (x + x tm , y + y tm ) - P s,Planar (x + x tm , y + y tm ) where x ≥ x left_top + w/2 and y ≥ y left_top + h/2

도 60은 일 예에 따른 제2 특정 영역에 대한 제한적 템플릿 매칭 기반 인트라 잔차 신호 예측을 나타낸다.Figure 60 shows intra residual signal prediction based on limited template matching for a second specific region according to an example.

도 60에서, R2은 특정 영역을 나타낼 수 있다.In Figure 60, R2 may represent a specific area.

특정 영역은 대상 블록 내의 우하단에 인접한 삼각형의 영역일 수 있다.The specific area may be a triangular area adjacent to the lower right corner of the target block.

특정 영역은 대상 블록 내의 대각선을 기준으로 결정될 수 있다.A specific area may be determined based on a diagonal line within the target block.

특정 영역은 1) 대상 블록의 좌측(또는, 템플릿)으로부터의 가로 거리 및 2) 대상 블록의 상측(또는, 템플릿)으로부터의 세로 거리의 합이 기준 값의 이상인 픽셀들의 영역일 수 있다.The specific area may be an area of pixels in which the sum of 1) the horizontal distance from the left side (or template) of the target block and 2) the vertical distance from the top (or template) of the target block is greater than or equal to the reference value.

예를 들면, 기준 값은 대상 블록의 폭 또는 높이일 수 있다.For example, the reference value may be the width or height of the target block.

특정 영역 R2 내에 속하는 위치 (x, y) 상의 픽셀에 대하여, 아래의 수식 37에 따라서 DTMRP(x, y)가 도출될 수 있다.For a pixel at a position (x, y) belonging to a specific area R2, D TMRP (x, y) can be derived according to Equation 37 below.

[수식 37][Formula 37]

DTMRP(x, y) = Rt,m_i(x, y) - Rs,m_i(x + xtm, y + ytm) where (x, y) ∈ R2D TMRP (x, y) = R t,m_i (x, y) - R s,m_i (x + x tm , y + y tm ) where (x, y) ∈ R2

특정 영역 R2 내에 속하는 위치 (x, y) 상의 픽셀에 대하여, 아래의 수식 38에 따라서 DTMRP(x, y)가 도출될 수 있다.For a pixel at a position (x, y) belonging to a specific area R2, D TMRP (x, y) can be derived according to Equation 38 below.

[수식 38][Formula 38]

Rect(x, y) = Pt,m_i(x, y) + DTMRP(x, y) + Rs,m_i(x + xtm, y + ytm) = Pt,m_i(x, y) + DTMRP(x, y) + Recs(x + xtm, y + ytm) - Ps,m_i(x + xtm, y + ytm) where (x, y) ∈ R2Rec t (x, y) = P t,m_i (x, y) + D TMRP (x, y) + R s,m_i (x + x tm , y + y tm ) = P t,m_i (x, y ) + D TMRP (x, y) + Rec s (x + x tm , y + y tm ) - P s,m_i (x + x tm , y + y tm ) where (x, y) ∈ R2

도 61은 일 예에 따른 제3 특정 영역에 대한 제한적 템플릿 매칭 기반 인트라 잔차 신호 예측을 나타낸다.Figure 61 shows intra residual signal prediction based on limited template matching for a third specific region according to an example.

대상 블록의 픽셀들 중 특정 영역에 속하는 픽셀들에 대해서만 TM 기반 인트라 잔차 신호 예측을 사용하는 부호화/복호화/시그널링이 적용될 수 있다.Encoding/decoding/signaling using TM-based intra residual signal prediction may be applied only to pixels belonging to a specific region among the pixels of the target block.

도 61에서, R3은 특정 영역을 나타낼 수 있다.In Figure 61, R3 may represent a specific area.

특정 영역은 대상 블록 내의 하단에 인접한 블록일 수 있다.The specific area may be a block adjacent to the bottom of the target block.

특정 영역은 대상 블록의 상측(또는, 템플릿)으로부터의 세로 거리가 dy,th의 이상인 픽셀들의 영역일 수 있다.The specific area may be an area of pixels whose vertical distance from the top (or template) of the target block is d y,th or more.

예를 들면, dy,th는 h/2일 수 있다. h는 대상 블록의 세로 크기일 수 있다.For example, d y,th may be h/2. h may be the vertical size of the target block.

말하자면, 대상 블록(또는, 템플릿)으로부터의 세로 거리가 dy,th의 이상인 픽셀에 대해서만 TM 기반 인트라 잔차 신호 예측을 사용하는 부호화/복호화/시그널링이 적용될 수 있다.In other words, encoding/decoding/signaling using TM-based intra residual signal prediction can be applied only to pixels whose vertical distance from the target block (or template) is d y,th or more.

특정 영역 R3 내에 속하는 위치 (x, y) 상의 픽셀에 대하여, 아래의 수식 39에 따라서 DTMRP(x, y)가 도출될 수 있다.For a pixel at a position (x, y) belonging to a specific area R3, D TMRP (x, y) can be derived according to Equation 39 below.

[수식 39][Formula 39]

DTMRP(x, y) = Rt,m_i(x, y) - Rs,m_i(x + xtm, y + ytm) where (x, y) ∈ R3D TMRP (x, y) = R t,m_i (x, y) - R s,m_i (x + x tm , y + y tm ) where (x, y) ∈ R3

특정 영역 R3 내에 속하는 위치 (x, y) 상의 픽셀에 대해 아래의 수식 40에 따른 부호화/복호화가 수행될 수 있다.Encoding/decoding according to Equation 40 below may be performed on pixels at positions (x, y) belonging to a specific area R3.

[수식 40][Formula 40]

Rect(x, y) = Pt,m_i(x, y) + DTMRP(x, y) + Rs,m_i(x + xtm, y + ytm) = Pt,m_i(x, y) + DTMRP(x, y) + Recs(x + xtm, y + ytm) - Ps,m_i(x + xtm, y + ytm) where (x, y) ∈ R3Rec t (x, y) = P t,m_i (x, y) + D TMRP (x, y) + R s,m_i (x + x tm , y + y tm ) = P t,m_i (x, y ) + D TMRP (x, y) + Rec s (x + x tm , y + y tm ) - P s,m_i (x + x tm , y + y tm ) where (x, y) ∈ R3

대상 블록에 대한 (최적의) 인트라 예측 모드는 플래너 모드일 수 있다.The (optimal) intra prediction mode for the target block may be planner mode.

대상 블록의 픽셀 (x, y)에 대하여, 픽셀 및 대상 블록의 상측(또는, 템플릿) 간의 세로 거리가 h/2의 이상이면, TM 기반 인트라 잔차 신호 예측을 사용하여 DTMRP(x, y)가 도출될 수 있다. DTMRP(x, y)는 아래의 수식 41에 따라서 도출될 수 있다.For a pixel (x, y) of the target block, if the vertical distance between the pixel and the upper side (or template) of the target block is greater than or equal to h/2, D TMRP (x, y) is obtained using TM-based intra residual signal prediction. can be derived. D TMRP (x, y) can be derived according to Equation 41 below.

[수식 41][Formula 41]

DTMRP(x, y) = Rt,Planar(x, y) - Rs,Planar(x + xtm, y + ytm) where y ≥ yleft_top + h/2D TMRP (x, y) = R t,Planar (x, y) - R s,Planar (x + x tm , y + y tm ) where y ≥ y left_top + h/2

여기에서, yleft_top는 대상 블록의 상단 y 좌표일 수 있다.Here, y left_top may be the top y coordinate of the target block.

대상 블록의 픽셀 (x, y)에 대하여, 픽셀 및 대상 블록의 상측(또는, 템플릿) 간의 세로 거리가 h/2의 이상이면, 픽셀은 아래의 수식 42에 따라서 부호화/복호화될 수 있다.For the pixel (x, y) of the target block, if the vertical distance between the pixel and the upper side (or template) of the target block is more than h/2, the pixel can be encoded/decoded according to Equation 42 below.

[수식 42][Formula 42]

Rect(x, y) = Pt,Planar(x, y) + DTMRP(x, y) + Rs,Planar(x + xtm, y + ytm) = Pt,Planar(x, y) + DTMRP(x, y) + Recs(x + xtm, y + ytm) - Ps,Planar(x + xtm, y + ytm) where y ≥ yleft_top + h/2Rec t (x, y) = P t,Planar (x, y) + D TMRP (x, y) + R s,Planar (x + x tm , y + y tm ) = P t,Planar (x, y ) + D TMRP (x, y) + Rec s (x + x tm , y + y tm ) - P s,Planar (x + x tm , y + y tm ) where y ≥ y left_top + h/2

도 62는 일 예에 따른 제4 특정 영역에 대한 제한적 템플릿 매칭 기반 인트라 잔차 신호 예측을 나타낸다.Figure 62 shows intra residual signal prediction based on limited template matching for a fourth specific region according to an example.

대상 블록의 픽셀들 중 특정 영역에 속하는 픽셀들에 대해서만 TM 기반 인트라 잔차 신호 예측을 사용하는 부호화/복호화/시그널링이 적용될 수 있다.Encoding/decoding/signaling using TM-based intra residual signal prediction may be applied only to pixels belonging to a specific region among the pixels of the target block.

도 62에서, R4는 특정 영역을 나타낸다.In Figure 62, R4 represents a specific region.

특정 영역은 대상 블록 내의 하단에 인접한 블록일 수 있다.The specific area may be a block adjacent to the bottom of the target block.

특정 영역은 대상 블록의 좌측(또는, 템플릿)으로부터의 가로 거리가 dx,th의 이상인 픽셀들의 영역일 수 있다.The specific area may be an area of pixels whose horizontal distance from the left side (or template) of the target block is d x,th or more.

예를 들면, dx,th는 w/2일 수 있다. w는 대상 블록의 가로 크기일 수 있다.For example, d x,th may be w/2. w may be the horizontal size of the target block.

말하자면, 대상 블록(또는, 템플릿)으로부터의 가로 거리가 dx,th의 이상인 픽셀에 대해서만 TM 기반 인트라 잔차 신호 예측을 사용하는 부호화/복호화/시그널링이 적용될 수 있다.In other words, encoding/decoding/signaling using TM-based intra residual signal prediction can be applied only to pixels whose horizontal distance from the target block (or template) is d x,th or more.

특정 영역 R4 내에 속하는 위치 (x, y) 상의 픽셀에 대하여, 아래의 수식 43에 따라서 DTMRP(x, y)가 도출될 수 있다.For a pixel at a position (x, y) belonging to a specific area R4, D TMRP (x, y) can be derived according to Equation 43 below.

[수식 43][Formula 43]

DTMRP(x, y) = Rt,m_i(x, y) - Rs,m_i(x + xtm, y + ytm) where (x, y) ∈ R4D TMRP (x, y) = R t,m_i (x, y) - R s,m_i (x + x tm , y + y tm ) where (x, y) ∈ R4

특정 영역 R4 내에 속하는 위치 (x, y) 상의 픽셀에 대해 아래의 수식 44에 따른 부호화/복호화가 수행될 수 있다.Encoding/decoding according to Equation 44 below may be performed on pixels at positions (x, y) belonging to a specific area R4.

[수식 44][Formula 44]

Rect(x, y) = Pt,m_i(x, y) + DTMRP(x, y) + Rs,m_i(x + xtm, y + ytm) = Pt,m_i(x, y) + DTMRP(x, y) + Recs(x + xtm, y + ytm) - Ps,m_i(x + xtm, y + ytm) where (x, y) ∈ R4Rec t (x, y) = P t,m_i (x, y) + D TMRP (x, y) + R s,m_i (x + x tm , y + y tm ) = P t,m_i (x, y ) + D TMRP (x, y) + Rec s (x + x tm , y + y tm ) - P s,m_i (x + x tm , y + y tm ) where (x, y) ∈ R4

대상 블록에 대한 (최적의) 인트라 예측 모드는 플래너 모드일 수 있다.The (optimal) intra prediction mode for the target block may be planner mode.

대상 블록의 픽셀 (x, y)에 대하여, 픽셀 및 대상 블록의 좌측(또는, 템플릿) 간의 가로 거리가 w/2의 이상이면, TM 기반 인트라 잔차 신호 예측을 사용하여 DTMRP(x, y)가 도출될 수 있다. DTMRP(x, y)는 아래의 수식 45에 따라서 도출될 수 있다.For a pixel (x, y) of the target block, if the horizontal distance between the pixel and the left side (or template) of the target block is greater than or equal to w/2, D TMRP (x, y) is obtained using TM-based intra residual signal prediction. can be derived. D TMRP (x, y) can be derived according to Equation 45 below.

[수식 45][Formula 45]

DTMRP(x, y) = Rt,Planar(x, y) - Rs,Planar(x + xtm, y + ytm) where x ≥ xleft_top + w/2D TMRP (x, y) = R t,Planar (x, y) - R s,Planar (x + x tm , y + y tm ) where x ≥ x left_top + w/2

여기에서, xleft_top는 대상 블록의 좌단 x 좌표일 수 있다.Here, x left_top may be the left x coordinate of the target block.

대상 블록의 픽셀 (x, y)에 대하여, 픽셀 및 대상 블록의 좌측(또는, 템플릿) 간의 가로 거리가 w/2의 이상이면, 픽셀은 아래의 수식 46에 따라서 부호화/복호화될 수 있다.For the pixel (x, y) of the target block, if the horizontal distance between the pixel and the left side (or template) of the target block is greater than or equal to w/2, the pixel can be encoded/decoded according to Equation 46 below.

[수식 46][Formula 46]

Rect(x, y) = Pt,Planar(x, y) + DTMRP(x, y) + Rs,Planar(x + xtm, y + ytm) = Pt,Planar(x, y) + DTMRP(x, y) + Recs(x + xtm, y + ytm) - Ps,Planar(x + xtm, y + ytm) where x ≥ xleft_top + w/2Rec t (x, y) = P t,Planar (x, y) + D TMRP (x, y) + R s,Planar (x + x tm , y + y tm ) = P t,Planar (x, y ) + D TMRP (x, y) + Rec s (x + x tm , y + y tm ) - P s,Planar (x + x tm , y + y tm ) where x ≥ x left_top + w/2

제한적 TM기반 인트라 잔차 신호 예측을 위한 구문 요소의 시그널링Signaling of syntactic elements for restricted TM-based intra residual signal prediction.

일 실시예에서, 대상 블록이 제한적 TM 기반 인트라 잔차 신호 예측을 사용하여 부호화/복호화되는지 여부를 지시하는 구문 요소(= restrict_tm_intra_residual_pred)가 시그널링될 수 있다.In one embodiment, a syntax element (= restrict_tm_intra_residual_pred) indicating whether the target block is encoded/decoded using restricted TM-based intra residual signal prediction may be signaled.

예를 들면, restrict_tm_intra_residual_pred이 제1 값인 것은 대상 블록이 제한적 TM 기반 인트라 잔차 신호 예측 방법을 사용하여 부호화/복호화된 것을 지시할 수 있다. restrict_tm_intra_residual_pred이 제2 값인 것은 대상 블록이 제한적 TM 기반 인트라 잔차 신호 예측 방법을 사용하여 부호화/복호화되지 않은 것을 지시할 수 있다.For example, restrict_tm_intra_residual_pred being the first value may indicate that the target block has been encoded/decoded using a restricted TM-based intra residual signal prediction method. restrict_tm_intra_residual_pred being the second value may indicate that the target block is not encoded/decoded using the restricted TM-based intra residual signal prediction method.

예를 들면, restrict_tm_intra_residual_pred이 제1 값인 것은 대상 블록의 특정 영역에 대하여 차이 값 DTMRP(x, y)이 시그널링됨을 지시할 수 있다. tm_intra_residual_pred이 제2 값인 것은 대상 블록의 특정 영역에 대하여 DTMRP(x, y)이 시그널링되지 않음을 지시할 수 있다. DTMRP(x, y)는 대상 블록의 인트라 예측 잔차 신호 Rt,m_i(x, y) 및 대상 블록의 인트라 예측 잔차 신호 예측 값(즉, 템플릿 매칭 최적 블록의 잔차 신호) Rs,m_i(x + xtm, y + ytm) 간의 차이 값일 수 있다.For example, restrict_tm_intra_residual_pred being the first value may indicate that the difference value D TMRP (x, y) is signaled for a specific area of the target block. The fact that tm_intra_residual_pred is the second value may indicate that D TMRP (x, y) is not signaled for a specific area of the target block. D TMRP (x, y) is the intra prediction residual signal R t,m_i (x, y) of the target block and the predicted value of the intra prediction residual signal of the target block (i.e. the residual signal of the template matching optimal block) R s,m_i ( It may be the difference value between x + x tm , y + y tm ).

DTMRP(x, y)는 실시예의 다른 인트라 예측 잔차 신호를 부호화/복호화/시그널링하는 방법과 동일하게 부호화/복호화/시그널링될 수 있다. 예를 들면, DTMRP(x, y)는 실시예의 변환, 양자화, 엔트로피 부호화, 엔트로피 부호화, 역양자화 및 역변환에 의해 부호화/복호화/시그널링될 수 있다.D TMRP (x, y) may be encoded/decoded/signaled in the same manner as the method of encoding/decoding/signaling other intra prediction residual signals in the embodiment. For example, D TMRP (x, y) can be encoded/decoded/signaled by transformation, quantization, entropy encoding, entropy encoding, inverse quantization, and inverse transformation of the embodiment.

일 실시예에서, 대상 블록이 TM 기반 인트라 잔차 신호 예측을 사용하여 부호화/복호화된 경우, TM 기반 인트라 잔차 신호 예측의 타입을 지시하는 구문 요소(= restrict_tm_intra_residual_flag)가 시그널링될 수 있다.In one embodiment, when the target block is encoded/decoded using TM-based intra residual signal prediction, a syntax element (= restrict_tm_intra_residual_flag) indicating the type of TM-based intra residual signal prediction may be signaled.

예를 들면, restrict_tm_intra_residual_flag가 제1 값인 것은 대상 블록의 특정 영역에 대해서만 TM 기반 인트라 잔차 신호 예측 방법을 사용된 것을 나타낼 수 있다. restrict_tm_intra_residual_flag가 제2 값인 것은 대상 블록의 전체 영역에 대해서 TM 기반 인트라 잔차 신호 예측 방법이 사용된 것을 나타낼 수 있다. restrict_tm_intra_residual_flag가 제3 값인 것은 대상 블록에 대하여 TM 기반 인트라 잔차 신호 예측 방법이 사용되지 않은 것을 나타낼 수 있다.For example, restrict_tm_intra_residual_flag being the first value may indicate that the TM-based intra residual signal prediction method is used only for a specific area of the target block. The fact that restrict_tm_intra_residual_flag is the second value may indicate that the TM-based intra residual signal prediction method is used for the entire area of the target block. The fact that restrict_tm_intra_residual_flag is the third value may indicate that the TM-based intra residual signal prediction method is not used for the target block.

예를 들면, restrict_tm_intra_residual_flag가 제1 값인 것은 대상 블록의 특정 영역에 대해서만 차이 값 DTMRP(x, y)이 시그널링됨을 지시할 수 있다. restrict_tm_intra_residual_flag가 제2 값인 것은 대상 블록의 전체 영역에 대해서 차이 값 DTMRP(x, y)이 시그널링됨을 지시할 수 있다. restrict_tm_intra_residual_flag가 제3 값인 것은 대상 블록에 대하여 DTMRP(x, y)이 시그널링되지 않음을 지시할 수 있다. DTMRP(x, y)는 대상 블록의 인트라 예측 잔차 신호 Rt,m_i(x, y) 및 대상 블록의 인트라 예측 잔차 신호 예측 값(즉, 템플릿 매칭 최적 블록의 잔차 신호) Rs,m_i(x + xtm, y + ytm) 간의 차이 값일 수 있다.For example, restrict_tm_intra_residual_flag being the first value may indicate that the difference value D TMRP (x, y) is signaled only for a specific area of the target block. The second value of restrict_tm_intra_residual_flag may indicate that the difference value D TMRP (x, y) is signaled for the entire area of the target block. The third value of restrict_tm_intra_residual_flag may indicate that D TMRP (x, y) is not signaled for the target block. D TMRP (x, y) is the intra prediction residual signal R t,m_i (x, y) of the target block and the predicted value of the intra prediction residual signal of the target block (i.e. the residual signal of the template matching optimal block) R s,m_i ( It may be the difference value between x + x tm , y + y tm ).

일 실시예에서, 대상 블록에 대하여 TM 기반 인트라 잔차 신호 예측 방법이 사용된 경우에만 restrict_tm_intra_residual_flag가 시그널닝될 수 있다.In one embodiment, restrict_tm_intra_residual_flag may be signaled only when a TM-based intra residual signal prediction method is used for the target block.

예를 들면 tm_intra_residual_pred가 제1 값인 경우에만 restrict_tm_intra_residual_flag가 시그널링될 수 있다.For example, restrict_tm_intra_residual_flag can be signaled only when tm_intra_residual_pred is the first value.

LIC 기반 템플릿 매칭 예측LIC-based template matching prediction

아래에서는 단계(2043)에서의 LIC 기반 템플릿 매칭 예측이 설명된다.Below, LIC-based template matching prediction in step 2043 is described.

도 63a는 일 예에 따른 대상 블록, 대상 블록의 템플릿 및 템플릿의 픽셀들을 도시한다.FIG. 63A shows a target block, a template of the target block, and pixels of the template according to an example.

도 63b는 일 예에 템플릿 매칭 최적 블록, 대상 블록의 템플릿 및 템플릿의 픽셀들을 도시한다.FIG. 63B shows a template matching optimal block, a template of a target block, and pixels of the template in an example.

LIC 기반 TM 예측은 템플릿 매칭 최적 블록을 대상 블록의 예측 신호로서 이용할 때 LIC를 적용함으로써 예측 신호의 보정하는 것일 수 있다. 말하자면, LIC 기반 TM 예측이 사용될 때, 예측 신호에 대하여 LIC를 사용하는 보정이 적용될 수 있다.LIC-based TM prediction may correct the prediction signal by applying LIC when using the template matching optimal block as the prediction signal of the target block. That is, when LIC-based TM prediction is used, correction using LIC can be applied to the prediction signal.

도 63a에서 도시된 것과 같이, Ot는 대상 블록의 신호를 나타낼 수 있다. Ot는 대상 블록의 예측 신호일 수 있다. 템플릿 A는 대상 블록에 인접한 대상 블록의 템플릿일 수 있다.As shown in FIG. 63A, O t may represent the signal of the target block. O t may be the prediction signal of the target block. Template A may be a template of a target block adjacent to the target block.

도 63b에서 도시된 것과 같이, 템플릿 B는 템플릿 A와의 최고 상관관계를 갖는 템플릿일 수 있다. PTM은 템플릿 B에 인접하는 템플릿 매칭 최적 블록의 신호를 나타낼 수 있다. PTM은 템플릿 매칭 최적 블록의 예측 신호일 수 있다.As shown in FIG. 63B, template B may be the template with the highest correlation with template A. P TM may represent the signal of the template matching optimal block adjacent to template B. P TM may be a prediction signal of the template matching optimal block.

실시예들에서, 특정 템플릿에 인접하는 템플릿 매칭 최적 블록은 특정 템플릿에 대응하는 템플릿 매칭 최적 블록을 의미할 수 있다.In embodiments, a template matching optimal block adjacent to a specific template may mean a template matching optimal block corresponding to a specific template.

템플릿 매칭 움직임 벡터 MVtm는 아래의 수식 47과 같을 수 있다.The template matching motion vector MV tm may be expressed as Equation 47 below.

[수식 47][Formula 47]

MVtm = (xtm, ytm)MV tm = (x tm , y tm )

이 때, 아래의 수식 48과 같이, 대상 블록의 위치 (x, y) 상에서의 신호 O(x, y)는 템플릿 매칭 최적 블록의 신호 PTM(x, y)를 사용하는 선형 모델에 의해 예측될 수 있다.At this time, as shown in Equation 48 below, the signal O(x, y) on the position (x, y) of the target block is predicted by a linear model using the signal P TM (x, y) of the template matching optimal block. It can be.

[수식 48][Formula 48]

ResLIC_TM(x, y) = Ot(x, y) - (α·PTM(x + xtm, y + ytm) +β)Res LIC_TM (x, y) = O t (x, y) - (α·P TM (x + x tm , y + y tm ) +β)

여기에서, ResLIC_TM(x, y)는 위치 (x, y)의 예측 오차(또는, 잔차 신호)일 수 있다.Here, Res LIC_TM (x, y) may be the prediction error (or residual signal) of location (x, y).

α 및 β 는 선형 모델의 계수일 수 있다.α and β may be coefficients of a linear model.

예측 오차 ResLIC_TM(x, y), α 및 β 중 적어도 하나가 부호화/복호화/시그널링될 수 있다.Prediction error Res LIC_TM (x, y), at least one of α and β may be encoded/decoded/signaled.

예측 오차 ResLIC_TM(x, y), α, β, 템플릿 매칭 참조 영상, 템플릿 매칭 최적 블록의 신호 PTM(x, y) 및 템플릿 매칭 움직임 벡터 MVtm(= (xtm, ytm)) 중 적어도 하나를 이용하여 대상 블록의 재구축된 신호 Rect(x, y)가 획득될 수 있다. Rect(x, y)는 아래의 수식 49에 따라서 획득될 수 있다.Among the prediction error Res LIC_TM (x, y), α, β, template matching reference image, signal P TM (x, y) of template matching optimal block, and template matching motion vector MV tm (= (x tm , y tm )) The reconstructed signal Rec t (x, y) of the target block can be obtained using at least one. Rec t (x, y) can be obtained according to Equation 49 below.

[수식 49][Formula 49]

Rest(x, y) = (α·PTM(x + xtm, y + ytm) +β) + ResLIC_TM(x, y)Res t (x, y) = (α·P TM (x + x tm , y + y tm ) +β) + Res LIC_TM (x, y)

LIC 기반 TM 예측의 선형 모델 계수 계산Calculation of linear model coefficients for LIC-based TM predictions

도 63a 및 도 63b를 참조하면, YA(i)는 템플릿 A에 속하는 i 픽셀의 픽셀 값일 수 있다. YB(i)는 템플릿 B에 속하는 i 픽셀의 픽셀 값일 수 있다.Referring to FIGS. 63A and 63B, Y A (i) may be the pixel value of pixel i belonging to template A. Y B (i) may be the pixel value of i pixel belonging to template B.

실시예들에서, 픽셀 값은 루마 값 또는 크로마 값일 수 있다. 크로마 값은 Cb 값 또는 Cr 값일 수 있다.In embodiments, the pixel value may be a luma value or a chroma value. The chroma value may be a Cb value or a Cr value.

여기에서, 템플릿 A 및 템플릿 B의 각각은 모두 N 개의 픽셀들을 포함할 수 있다. 말하자면, i는 1 이상 N 이하의 값들 중 하나일 수 있다.Here, each of template A and template B may include a total of N pixels. In other words, i may be one of values between 1 and N.

이 때, LIC 기반 TM 예측의 선형 모델 계수 α 및 β는 아래의 수식 50 및 수식 51에 의해 각각 획득될 수 있다.At this time, the linear model coefficients α and β of LIC-based TM prediction can be obtained by Equation 50 and Equation 51 below, respectively.

[수식 50][Formula 50]

Figure pat00007
Figure pat00007

[수식 51][Formula 51]

Figure pat00008
Figure pat00008

LIC 기반 TM 예측의 선형 모델 계수 계산의 서브샘플링Subsampling of linear model coefficient calculations for LIC-based TM predictions

도 64a는 일 예에 따른 대상 블록, 대상 블록의 템플릿 및 템플릿의 서브샘플링된 픽셀들을 도시한다.Figure 64A shows a target block, a template of the target block, and subsampled pixels of the template, according to an example.

도 64b는 일 예에 템플릿 매칭 최적 블록, 대상 블록의 템플릿 및 템플릿의 서브샘플링된 픽셀들을 도시한다.Figure 64B shows an example template matching optimal block, a template of a target block, and subsampled pixels of the template.

템플릿 A는 대상 블록의 템플릿일 수 있다. YA(i)는 템플릿 A에 속하는 i 픽셀의 픽셀 값일 수 있다.Template A may be the template of the target block. Y A (i) may be the pixel value of pixel i belonging to template A.

템플릿 B는 템플릿 A와 최고 상관관계를 갖는 템플릿일 수 있다. YB(i)는 템플릿 B에 속하는 i 픽셀의 픽셀 값일 수 있다.Template B may be the template with the highest correlation with template A. Y B (i) may be the pixel value of i pixel belonging to template B.

실시예들에서, 픽셀 값은 루마 값 또는 크로마 값일 수 있다. 크로마 값은 Cb 값 또는 Cr 값일 수 있다. In embodiments, the pixel value may be a luma value or a chroma value. The chroma value may be a Cb value or a Cr value.

여기에서, 템플릿 A 및 템플릿 B의 각각은 모두 N 개의 픽셀들을 포함할 수 있다. 말하자면, i는 1 이상 N 이하의 값들 중 하나일 수 있다.Here, each of template A and template B may include a total of N pixels. In other words, i may be one of values between 1 and N.

이 때, 템플릿 A에 속하는 일부 픽셀들 및 이러한 템플릿 A의 일부 픽셀들에 대응하는 템플릿 B에 속하는 일부 픽셀들을 사용하여, 아래의 수식 52 및 수식 53과 같이, LIC 기반 TM 예측의 선형 모델 계수 α 및 β가 각각 획득될 수 있다.At this time, using some pixels belonging to template A and some pixels belonging to template B corresponding to some pixels of template A, the linear model coefficient α of LIC-based TM prediction is calculated as Equation 52 and Equation 53 below: and β can be obtained respectively.

[수식 52][Formula 52]

Figure pat00009
Figure pat00009

[수식 53][Formula 53]

Figure pat00010
Figure pat00010

여기에서, M은 N의 이하의 값일 수 있다.Here, M may be a value equal to or less than N.

템플릿 A에 속하는 일부의 픽셀들은, 도 64a에서 도시된 것과 같이, 템플릿 A의 픽셀들을 한 개씩 건너뛰면서 구성될 수 있다. 이 때 M은 N/2일 수 있다.Some pixels belonging to template A may be configured by skipping pixels of template A one by one, as shown in FIG. 64A. At this time, M may be N/2.

템플릿 A에 대응하는 템플릿 B에 속하는 일부 픽셀들도, 도 64b에서 도시된 것과 같이, 템플릿 B의 픽셀들을 한 개씩 건너뛰면서 구성될 수 있다.Some pixels belonging to template B corresponding to template A may also be configured by skipping pixels of template B one by one, as shown in FIG. 64B.

LIC 기반 템플릿 매칭 예측의 선형 모델 계수 계산Calculation of linear model coefficients for LIC-based template matching predictions

도 65는 일 예에 따른 대상 블록의 템플릿에 대한 대표 값들을 나타낸다.Figure 65 shows representative values for a template of a target block according to an example.

LIC 기반 템플릿 매칭 예측의 선형 모델 계수를 계산함에 있어서, 서브샘플링이 사용될 수 있고, 크로스-컴퍼넌트 선형 모델(Cross-Component Linear Model; CCLM)에서와 같이 α 및 β가 도출될 수 있다.In calculating the linear model coefficients of LIC-based template matching prediction, subsampling can be used, and α and β can be derived as in a Cross-Component Linear Model (CCLM).

템플릿 A는 대상 블록의 템플릿일 수 있다. YA(i)는 템플릿 A에 속하는 i 픽셀의 픽셀 값일 수 있다.Template A may be the template of the target block. Y A (i) may be the pixel value of pixel i belonging to template A.

템플릿 B는 템플릿 A와 최고 상관관계를 갖는 템플릿일 수 있다. YB(i)는 템플릿 B에 속하는 i 픽셀의 픽셀 값일 수 있다.Template B may be the template with the highest correlation with template A. Y B (i) may be the pixel value of i pixel belonging to template B.

여기에서, 템플릿 A 및 템플릿 B의 각각은 모두 N 개의 픽셀들을 포함할 수 있다. 말하자면, i는 1 이상 N 이하의 값들 중 하나일 수 있다.Here, each of template A and template B may include a total of N pixels. In other words, i may be one of values between 1 and N.

대상 블록의 좌상단 좌표들 (x0, y0), 대상 블록의 가로 크기 W, 대상 블록의 세로 크기 H 및 대상 블록의 템플릿 A 중 적어도 하나를 이용하는 템플릿 A에 대한 다운샘플링을 수행함으로써 복수의 대표 값들이 획득될 수 있다. 대표 값들은 Nsub 개일 수 있다. Nsub는 N 이하의 정수일 수 있다.By performing downsampling on template A using at least one of the upper left coordinates of the target block (x 0 , y 0 ), the horizontal size W of the target block, the vertical size H of the target block, and the template A of the target block, a plurality of representative Values can be obtained. There may be N sub representative values. N sub may be an integer less than or equal to N.

예를 들면, 도 65에서 도시된 것과 같이, 복수의 대표 값들은 t1, t2, t3 및 t4를 포함할 수 있다.For example, as shown in FIG. 65, the plurality of representative values may include t 1 , t 2 , t 3 and t 4 .

복수의 대표 값들은 t1, t2, t3 및 t4의 각각은 대상 블록의 좌상단 좌표들 (x0, y0), 대상 블록의 가로 크기 W, 대상 블록의 세로 크기 H 및 대상 블록의 템플릿 A 중 적어도 하나를 이용하여 각각 획득될 수 있다.A plurality of representative values are t 1 , t 2 , t 3 and t 4 , each of which is the upper left coordinates of the target block (x 0 , y 0 ), the horizontal size W of the target block, the vertical size H of the target block, and the Each can be obtained using at least one of template A.

t1는 아래의 수식 54가 나타내는 위치들의 샘플들의 평균 값일 수 있다.t 1 may be the average value of samples at positions indicated by Equation 54 below.

[수식 54][Formula 54]

(x0 + w/4 - 1, y0 - 1), (x0 + W/4 - 1, y0 - 2), (x0 + W/4, y0 - 1), (x0 + W/4, y0 - 2), (x0 + W/4 + 1, y0 - 1), (x0 + W/4 + 1, y0 - 2)(x 0 + w/4 - 1, y 0 - 1), (x 0 + W/4 - 1, y 0 - 2), (x 0 + W/4, y 0 - 1), (x 0 + W/4, y 0 - 2), (x 0 + W/4 + 1, y 0 - 1), (x 0 + W/4 + 1, y 0 - 2)

t2는 아래의 수식 55가 나타내는 위치들의 샘플들의 평균 값일 수 있다.t 2 may be the average value of samples at positions indicated by Equation 55 below.

[수식 55][Formula 55]

(x0 + 3w/4 - 1, y0 - 1), (x0 + 3W/4 - 1, y0 - 2), (x0 + 3W/4, y0 - 1), (x0 + 3W/4, y0 - 2), (x0 + 3W/4 + 1, y0 - 1), (x0 + 3W/4 + 1, y0 - 2)(x 0 + 3w/4 - 1, y 0 - 1), (x 0 + 3W/4 - 1, y 0 - 2), (x 0 + 3W/4, y 0 - 1), (x 0 + 3W/4, y 0 - 2), (x 0 + 3W/4 + 1, y 0 - 1), (x 0 + 3W/4 + 1, y 0 - 2)

t3은 아래의 수식 56이 나타내는 위치들의 샘플들의 평균 값일 수 있다.t 3 may be the average value of samples at positions indicated by Equation 56 below.

[수식 56][Formula 56]

(x0 - 1, y0 + H/4 - 1), (x0 - 2, y0 + H/4 - 1), (x0 - 1, y0 + H/4), (x0 - 2, y0 + H/4), (x0 - 1, y0 + H/4 + 1), (x0 - 2, y0 + H/4 + 1)(x 0 - 1, y 0 + H/4 - 1), (x 0 - 2, y 0 + H/4 - 1), (x 0 - 1, y 0 + H/4), (x 0 - 2, y 0 + H/4), (x 0 - 1, y 0 + H/4 + 1), (x 0 - 2, y 0 + H/4 + 1)

t4는 아래의 수식 57이 나타내는 위치들의 샘플들의 평균 값일 수 있다.t 4 may be the average value of samples at positions indicated by Equation 57 below.

[수식 57][Formula 57]

(x0 - 1, y0 + 3H/4 - 1), (x0 - 2, y0 + 3H/4 - 1), (x0 - 1, y0 + 3H/4), (x0 - 2, y0 + 3H/4), (x0 - 1, y0 + 3H/4 + 1), (x0 - 2, y0 + 3H/4 + 1)(x 0 - 1, y 0 + 3H/4 - 1), (x 0 - 2, y 0 + 3H/4 - 1), (x 0 - 1, y 0 + 3H/4), (x 0 - 2, y 0 + 3H/4), (x 0 - 1, y 0 + 3H/4 + 1), (x 0 - 2, y 0 + 3H/4 + 1)

Nsub 개의 대표 값들은 대표 값들의 크기들에 따라서 분류될 수 있다. Nsub 개의 대표 값들은 대표 값들의 크기들에 따라, 더 큰 값들을 갖는 Nsub/2 개의 대표 값들 및 더 작은 값들을 갖는 Nsub/2 개의 대표 값들로 분류될 수 있다.N sub representative values can be classified according to the sizes of the representative values. The N sub representative values can be classified into N sub /2 representative values with larger values and N sub /2 representative values with smaller values, depending on the sizes of the representative values.

예를 들면, t1, t2, t3 및 t4의 크기가 아래의 수식 58과 같은 경우, 더 큰 2 개의 대표 값들(= t1 및 t3) 및 더 작은 2 개의 대표 값들(= t2 및 t4)로 분류될 수 있다.For example, if the sizes of t 1 , t 2 , t 3 and t 4 are as in Equation 58 below, the two larger representative values (= t 1 and t 3 ) and the two smaller representative values (= t 2 and t 4 ).

[수식 58][Formula 58]

t1 ≥ t2 ≥ t3 ≥ t4 t 1 ≥ t 2 ≥ t 3 ≥ t 4

더 큰 값들을 갖는 Nsub/2 개의 대표 값들의 평균 T1 A 및 더 작은 값들을 갖는 Nsub/2 개의 대표 값들의 평균 T2 A가 획득될 수 있다.The average T 1 A of N sub /2 representative values with larger values and the average T 2 A of N sub /2 representative values with smaller values can be obtained.

예를 들면, T1 A 및 T2 A 는 각각 아래의 수식 59 및 수식 60에 따라서 획득될 수 있다.For example, T 1 A and T 2 A can be obtained according to Equation 59 and Equation 60 below, respectively.

[수식 59][Formula 59]

T1 A = (t1 + t3 + 1) >> 1T 1 A = (t 1 + t 3 + 1) >> 1

[수식 60][Formula 60]

T2 A = (t2 + t4 + 1) >> 1T 2 A = (t 2 + t 4 + 1) >> 1

전술된 것과 같인 방법에 의해, 템플릿 매칭 최적 블록 및 탬플릿 매칭 최적 블록에 인접하는 템플릿 B로부터 더 큰 값들을 갖는 Nsub/2 개의 대표 값들의 평균 T1 B 및 더 작은 값들을 갖는 Nsub/2 개의 대표 값들의 평균 T2 B가 획득될 수 있다.By the same method as described above, the average T 1 B of N sub /2 representative values with larger values and N sub /2 with smaller values from the template matching optimal block and the template B adjacent to the template matching optimal block are obtained. The average T 2 B of the representative values can be obtained.

T1 A, T2 A T1 B 및 T2 B 중 적어도 하나를 이용하여, 아래의 수식 61 및 수식 62에 따라서, LIC 기반 TM 예측의 선형 모델 계수 α 및 β가 각각 획득될 수 있다.Using at least one of T 1 A , T 2 A T 1 B and T 2 B , the linear model coefficients α and β of LIC-based TM prediction can be obtained, respectively, according to Equations 61 and 62 below.

[수식 61][Formula 61]

α = (T1 A - T2 A) / (T1 B - T2 B)α = (T 1 A - T 2 A ) / (T 1 B - T 2 B )

[수식 62][Formula 62]

β = T2 A - α·T2 B β = T 2 A - α·T 2 B

LIC 기반 TM 예측에서의 시그널링Signaling in LIC-based TM prediction

대상 블록이 LIC 기반 TM 예측을 사용하여 부호화/복호화되었는지 여부를 지시하는 구문 요소(= lic_template_matching_mode)가 시그널링될 수 있다.A syntax element (= lic_template_matching_mode) indicating whether the target block has been encoded/decoded using LIC-based TM prediction may be signaled.

lic_template_matching_mode가 제1 값인 것은 대상 블록이 LIC 기반 TM 예측을 사용하여 부호화/복호화되었음을 지시할 수 있다. lic_template_matching_mode가 제2 값인 것은, 대상 블록이 LIC 기반 TM 예측을 사용하여 부호화/복호화되지 않았음을 지시할 수 있다.The fact that lic_template_matching_mode is the first value may indicate that the target block has been encoded/decoded using LIC-based TM prediction. The fact that lic_template_matching_mode is the second value may indicate that the target block has not been encoded/decoded using LIC-based TM prediction.

인트라 및 템플릿 매칭의 블랜딩 예측Blending prediction for intra and template matching

아래에서는 단계(2044)에서의 인트라 및 템플릿 매칭의 블랜딩 예측이 설명된다.Below, the blending prediction of intra and template matching in step 2044 is described.

도 66은 일 예에 따른 인트라 및 TM의 블랜딩 예측을 위한 정보를 개시한다.Figure 66 discloses information for predicting intra and TM blending according to an example.

인트라 모드의 예측 신호 및 템플릿 매칭 최적 블록을 함께 이용함으로써 대상 블록에 대한 부호화/복호화가 수행될 수 있다.Encoding/decoding of the target block can be performed by using the intra-mode prediction signal and the template matching optimal block together.

인트라 및 TM의 블랜딩 예측은 이러한 인트라 모드의 예측 신호 및 템플릿 매칭 최적 블록을 함께 이용하는 예측을 의미할 수 있다. 이 때, 대상 블록의 예측 블록은 인트라 모드의 예측 신호 및 템플릿 매칭 최적 블록의 가중치가 부여된 조합(weighted combination) 또는 가중치가 부여된 합(weighted summation)에 의해 산출될 수 있다.Intra and TM blending prediction may mean prediction using the intra mode prediction signal and template matching optimal block together. At this time, the prediction block of the target block may be calculated by a weighted combination or weighted summation of the intra-mode prediction signal and the template matching optimal block.

Ot는 대상 블록을 나타낼 수 있다. 템플릿 A는 대상 블록에 인접한 대상 블록의 템플릿일 수 있다. 템플릿 B는 템플릿 A와의 최고 상관관계를 갖는 템플릿일 수 있다. PTM은 템플릿 B에 인접하는 템플릿 매칭 최적 블록을 나타낼 수 있다.O t may represent the target block. Template A may be a template of a target block adjacent to the target block. Template B may be the template with the highest correlation with template A. P TM may represent a template matching optimal block adjacent to template B.

템플릿 매칭 움직임 벡터 MVtm는 아래의 수식 63과 같을 수 있다.The template matching motion vector MV tm may be expressed as Equation 63 below.

[수식 63][Formula 63]

MVtm = (xtm, ytm)MV tm = (x tm , y tm )

상기와 같은 정보들이 주어졌을 때, 위치 (x, y)에서의 대상 블록의 신호 Ot(x, y)는 PTM(x + xtm, y + ytm) 및 Pt,m_i(x, y)를 사용하여 예측될 수 있다.Given the above information, the signal O t (x, y) of the target block at position (x, y) is P TM (x + x tm , y + y tm ) and P t,m_i (x, y) can be predicted using

PTM(x + xtm, y + ytm)는 템플릿 매칭 최적 블록의 재구축된 신호일 수 있다.P TM (x + x tm , y + y tm ) may be the reconstructed signal of the template matching optimal block.

Pt,m_i(x, y)는 제i 인트라 예측 모드를 사용하는 대상 블록에 대한 예측을 수행함으로써 생성된 신호일 수 있다.P t,m_i (x, y) may be a signal generated by performing prediction on the target block using the i-th intra prediction mode.

아래의 수식 64에 따라서, 대상 블록의 신호 Ot(x, y)가 예측될 수 있다.According to Equation 64 below, the signal O t (x, y) of the target block can be predicted.

[수식 64][Formula 64]

ResTM_Intra(x, y) = Ot(x, y) - (w1·PTM(x + xtm, y + ytm) + w2·Pt,m_i(x, y))Res TM_Intra (x, y) = O t (x, y) - (w 1 ·P TM (x + x tm , y + y tm ) + w 2 ·P t,m_i (x, y))

여기에서, w1는 템플릿 매칭 최적 블록의 가중치일 수 있다. w2는 인트라 예측 신호의 가중치일 수 있다.Here, w 1 may be the weight of the template matching optimal block. w 2 may be the weight of the intra prediction signal.

대상 블록의 예측 신호는 아래의 수식 65와 같을 수 있다.The prediction signal of the target block may be as in Equation 65 below.

[수식 65][Formula 65]

w1·PTM(x + xtm, y + ytm) + w2·Pt,m_i(x, y)w 1 ·P TM (x + x tm , y + y tm ) + w 2 ·P t,m_i (x, y)

ResTM_Intra(x, y)는 대상 블록의 예측 신호 및 대상 블록 간의 차이(즉, 잔차 신호)일 수 있다.Res TM_Intra (x, y) may be the difference (i.e., residual signal) between the prediction signal of the target block and the target block.

대상 블록의 잔차 신호 ResTM_Intra(x, y)가 부호화/복호화/시그널링될 수 있다.The residual signal Res TM_Intra (x, y) of the target block may be encoded/decoded/signaled.

대상 블록의 잔차 신호 ResTM_Intra(x, y)가 주어진 경우, 템플릿 매칭 참조 영상, 템플릿 매칭 움직임 벡터 MVtm, 템플릿 매칭 최적 블록의 재구축된 신호 PTM(x + xtm, y + ytm), 제i 인트라 예측 모드, 제i 인트라 예측 모드를 사용하는 대상 블록에 대한 예측을 수행함으로써 생성된 신호 Pt,m_i(x, y), 템플릿 매칭 최적 블록의 가중치 w1 및 인트라 예측 신호의 가중치 w2 중 적어도 하나를 사용하여 재구축된 대상 블록의 신호 Rect(x, y)가 획득될 수 있다.Given the residual signal Res TM_Intra (x, y) of the target block, the template matching reference image, the template matching motion vector MV tm , and the reconstructed signal P TM (x + x tm , y + y tm ) of the template matching optimal block. , the i th intra prediction mode, the signal P t,m_i (x, y) generated by performing prediction on the target block using the i th intra prediction mode, the weight w 1 of the template matching optimal block, and the weight of the intra prediction signal. The signal Rec t (x, y) of the target block reconstructed using at least one of w 2 may be obtained.

Rect(x, y)는 아래의 수식 66에 따라서 획득될 수 있다.Rec t (x, y) can be obtained according to Equation 66 below.

[수식 66][Formula 66]

Rect(x, y) = (w1·PTM(x + xtm, y + ytm) + w2·Pt,m_i(x, y)) + ResTM_Intra(x, y)Rec t (x, y) = (w 1 ·P TM (x + x tm , y + y tm ) + w 2 ·P t,m_i (x, y)) + Res TM_Intra (x, y)

인트라 및 템플릿 매칭의 블랜딩 예측의 실시예Example of blending prediction of intra and template matching

일 실시예에서, 템플릿 매칭 움직임 벡터 MVtm는 (5, 5)일 수 있다. Pt,Planar(x, y)는 플래너 모드를 사용하는 대상 블록에 대한 예측을 수행함으로써 생성된 신호일 수 있다. 가중치 w1은 1/2일 수 있다. 가중치 w2는 1/2일 수 있다.In one embodiment, the template matching motion vector MV tm may be (5, 5). P t,Planar (x, y) may be a signal generated by performing prediction on the target block using planar mode. Weight w 1 may be 1/2. Weight w 2 may be 1/2.

이러한 경우, 아래의 수식 67에 따라서, 대상 블록의 신호 Ot(x, y)가 예측될 수 있다.In this case, the signal O t (x, y) of the target block can be predicted according to Equation 67 below.

[수식 67][Formula 67]

ResTM_Intra(x, y) = Ot(x, y) - (PTM(x + 5, y + 5) + Pt,m_i(x, y) + offset) >> 1Res TM_Intra (x, y) = O t (x, y) - (P TM (x + 5, y + 5) + P t,m_i (x, y) + offset) >> 1

대상 블록의 예측 신호는 아래의 수식 68과 같을 수 있다.The prediction signal of the target block may be as in Equation 68 below.

[수식 68][Formula 68]

(PTM(x + 5, y + 5) + Pt,m_i(x, y) + offset) >> 1(P TM (x + 5, y + 5) + P t,m_i (x, y) + offset) >> 1

ResTM_Intra(x, y)는 대상 블록의 예측 신호 및 대상 블록 간의 차이(즉, 잔차 신호)일 수 있다.Res TM_Intra (x, y) may be the difference (i.e., residual signal) between the prediction signal of the target block and the target block.

offset는 반올림을 위한 값일 수 있다. 예를 들면, 10 비트 영상에 대한 부호화/복호화가 수행되는 경우 offset는 512일 수 있다. 예를 들면, 8 비트 영상에 대한 부호화/복호화가 수행되는 경우 offset는 128일 수 있다. 반올림이 적용되지 않는 경우 offset는 0일 수 있다.offset may be a value for rounding. For example, when encoding/decoding is performed on a 10-bit image, the offset may be 512. For example, when encoding/decoding is performed on an 8-bit video, the offset may be 128. If rounding is not applied, offset can be 0.

대상 블록의 잔차 신호 ResTM_Intra(x, y)가 부호화/복호화/시그널링될 수 있다.The residual signal Res TM_Intra (x, y) of the target block may be encoded/decoded/signaled.

ResTM_Intra(x, y)가 주어지면, 재구축된 대상 블록의 Rect(x, y)는 아래의 수식 69에 따라서 획득될 수 있다.Given Res TM_Intra (x, y), Rec t (x, y) of the reconstructed target block can be obtained according to Equation 69 below.

[수식 69][Formula 69]

Rect(x, y) = (PTM(x + 5, y + 5) + Pt,m_i(x, y)) >> 1 + ResTM_Intra(x, y)Rec t (x, y) = (P TM (x + 5, y + 5) + P t,m_i (x, y)) >> 1 + Res TM_Intra (x, y)

인트라 및 템플릿 매칭의 블랜딩 예측에서의 시그널링Signaling in blending prediction of intra and template matching

대상 블록이 인트라 및 템플릿 매칭의 블랜딩 예측을 사용하여 부호화/복호화되었는지 여부를 지시하는 구문 요소(= intra_template_matching_blending_mode)가 시그널링될 수 있다.A syntax element (= intra_template_matching_blending_mode) indicating whether the target block has been encoded/decoded using blending prediction of intra and template matching may be signaled.

예를 들면, intra_template_matching_blending_mode가 제1 값인 것은, 대상 블록이 인트라 및 템플릿 매칭의 블랜딩 예측을 사용하여 부호화/복호화되었음을 지시할 수 있다. intra_template_matching_blending_mode가 제2 값인 것은, 대상 블록이 인트라 및 템플릿 매칭의 블랜딩 예측을 사용하여 부호화/복호화되지 않았음을 지시할 수 있다.For example, intra_template_matching_blending_mode being the first value may indicate that the target block was encoded/decoded using blending prediction of intra and template matching. The fact that intra_template_matching_blending_mode is the second value may indicate that the target block has not been encoded/decoded using blending prediction of intra and template matching.

인터 및 템플릿 매칭의 블랜딩 예측Blending prediction of inter and template matching

아래에서는 단계(2045)에서의 인터 및 템플릿 매칭의 블랜딩 예측이 설명된다.Below, the blending prediction of inter and template matching in step 2045 is described.

인터 모드의 예측 신호 및 템플릿 매칭 최적 블록을 함께 이용함으로써 대상 블록에 대한 부호화/복호화가 수행될 수 있다.Encoding/decoding of the target block can be performed by using the inter-mode prediction signal and the template matching optimal block together.

인터 및 TM의 블랜딩 예측은 이러한 인터 모드의 예측 신호 및 템플릿 매칭 최적 블록을 함께 이용하는 예측을 의미할 수 있다. 이 때, 대상 블록의 예측 블록은 인터 모드의 예측 신호 및 템플릿 매칭 최적 블록의 가중치가 부여된 조합(weighted combination) 또는 가중치가 부여된 합(weighted summation)에 의해 산출될 수 있다.Blended prediction of inter and TM may mean prediction using the inter mode prediction signal and template matching optimal block together. At this time, the prediction block of the target block may be calculated by a weighted combination or weighted summation of the inter-mode prediction signal and the template matching optimal block.

도 67은 일 예에 따른 인터 및 템플릿 매칭의 블랜딩 예측을 위한 템플릿 매칭 참조 영상, 대상 영상 및 인터 예측 참조 영상을 도시한다.Figure 67 illustrates a template matching reference image, a target image, and an inter prediction reference image for blending prediction of inter and template matching according to an example.

인터 및 템플릿 매칭의 블랜딩 예측은 아래와 같이 구분될 수 있다:Blending prediction of inter and template matching can be divided as follows:

단계(2046)에서의, P 인터 및 TM의 블랜딩 예측 At step 2046, predict the blending of P inter and TM.

단계(2047)에서의, B 인터 및 TM의 블랜딩 예측Blending prediction of B inter and TM at step 2047

단계(2048)에서의, B 인터 및 B-TM의 블랜딩 예측Blending prediction of B-inter and B-TM at step 2048

아래에서, 도 67을 참조하여 1) P 인터 및 TM의 블랜딩 예측, 2) B 인터 및 TM의 블랜딩 예측 및 3) B 인터 및 B-TM의 블랜딩 예측이 각각 설명된다.Below, with reference to FIG. 67, 1) blending prediction of P-inter and TM, 2) blending prediction of B-inter and TM, and 3) blending prediction of B-inter and B-TM are described, respectively.

아래에서 설명되는 실시예들에서, "신호"는 "예측 신호" 및 "인터 예측 신호"를 의미할 수 있다.In the embodiments described below, “signal” may mean “prediction signal” and “inter prediction signal.”

실시예들에서, 가중치를 갖는 블록들은 서로 다른 영상들 내에 각각 포함될 수 있다. 이러한 측면에서, 특정 영상의 가중치는 특정 영상에 포함되는 가중치로 이해될 수 있다.In embodiments, blocks with weights may each be included in different images. In this respect, the weight of a specific image can be understood as the weight included in the specific image.

P 인터 및 템플릿 매칭의 블랜딩 예측Blending prediction of P inter and template matching

아래에서는 단계(2046)에서의 P 인터 및 템플릿 매칭의 블랜딩 예측이 설명된다.Below, the blending prediction of P inter and template matching in step 2046 is described.

단-예측의(uni-predictive) 인터 모드의 예측 신호 및 템플릿 매칭 최적 블록을 함께 이용함으로써 대상 블록에 대한 부호화/복호화가 수행될 수 있다.Encoding/decoding of the target block can be performed by using the prediction signal of uni-predictive inter mode and the template matching optimal block together.

P 인터 및 TM의 블랜딩 예측은 이러한 단-예측의 인터 모드의 예측 신호 및 템플릿 매칭 최적 블록을 함께 이용하는 예측을 의미할 수 있다.Blending prediction of P inter and TM may mean prediction using the prediction signal of the inter mode of this single prediction and the template matching optimal block together.

도 67에서 도시된 것과 같이, Ot는 대상 블록을 나타낼 수 있다. 템플릿 A는 대상 블록에 인접한 대상 블록의 템플릿일 수 있다. 템플릿 B는 템플릿 A와의 최고 상관관계를 갖는 템플릿일 수 있다. PTM은 템플릿 B에 인접하는 템플릿 매칭 최적 블록을 나타낼 수 있다. MVtm은 템플릿 매칭 움직임 벡터일 수 있다. PInter는 대상 블록에 대한 인터 예측에 의해 생성된 인터 예측 블록일 수 있다. MVInter는 인터 예측을 위해 사용되는 움직임 벡터인 인터 예측 움직임 벡터일 수 있다.As shown in FIG. 67, O t may represent a target block. Template A may be a template of a target block adjacent to the target block. Template B may be the template with the highest correlation with template A. P TM may represent a template matching optimal block adjacent to template B. MV tm may be a template matching motion vector. P Inter may be an inter prediction block generated by inter prediction for the target block. MV Inter may be an inter prediction motion vector, which is a motion vector used for inter prediction.

템플릿 매칭 움직임 벡터 MVtm는 아래의 수식 70과 같을 수 있다.The template matching motion vector MV tm may be expressed as Equation 70 below.

[수식 70][Formula 70]

MVtm = (xtm, ytm)MV tm = (x tm , y tm )

인터 예측 움직임 벡터 MVInter는 아래의 수식 71과 같을 수 있다.The inter prediction motion vector MV Inter may be expressed as Equation 71 below.

[수식 71][Formula 71]

MVInter = (xinter, yinter)MV Inter = (x inter , y inter )

상기와 같은 정보들이 주어졌을 때, 위치 (x, y)에서의 대상 블록의 신호 Ot(x, y)는 PTM(x + xtm, y + ytm) 및 PInter(x + xinter, y + yinter)를 사용하여 예측될 수 있다.Given the above information, the signal O t (x, y) of the target block at position (x, y) is P TM (x + x tm , y + y tm ) and P Inter (x + x inter , y + y inter ) can be predicted using.

PTM(x + xtm, y + ytm)는 템플릿 매칭 최적 블록의 재구축된 신호일 수 있다.P TM (x + x tm , y + y tm ) may be the reconstructed signal of the template matching optimal block.

PInter(x + xinter, y + yinter)는 인터 예측 모드를 사용하는 대상 블록에 대한 예측을 수행함으로써 생성된 신호일 수 있다.P Inter (x + x inter , y + y inter ) may be a signal generated by performing prediction on the target block using the inter prediction mode.

아래의 수식 72에 따라서, 대상 블록의 신호 Ot(x, y)가 예측될 수 있다.According to Equation 72 below, the signal O t (x, y) of the target block can be predicted.

[수식 72][Formula 72]

ResTM_Inter(x, y) = Ot(x, y) - (w1·PTM(x + xtm, y + ytm) + w2·PInter(x + xinter, y + yinter))Res TM_Inter (x, y) = O t (x, y) - (w 1 ·P TM (x + x tm , y + y tm ) + w 2 ·P Inter (x + x inter , y + y inter ) )

여기에서, w1는 템플릿 매칭 최적 블록의 가중치일 수 있다. w2는 인터 예측 신호의 가중치일 수 있다.Here, w 1 may be the weight of the template matching optimal block. w 2 may be the weight of the inter prediction signal.

대상 블록의 예측 신호는 아래의 수식 73와 같을 수 있다.The prediction signal of the target block may be as in Equation 73 below.

[수식 73][Formula 73]

w1·PTM(x + xtm, y + ytm) + w2·PInter(x + xinter, y + yinter)w 1 ·P TM (x + x tm , y + y tm ) + w 2 ·P Inter (x + x inter , y + y inter )

ResTM_Inter(x, y)는 대상 블록의 예측 신호 및 대상 블록 간의 차이(즉, 잔차 신호)일 수 있다.Res TM_Inter (x, y) may be the difference (i.e., residual signal) between the prediction signal of the target block and the target block.

대상 블록의 잔차 신호 ResTM_Inter(x, y)가 부호화/복호화/시그널링될 수 있다.The residual signal Res TM_Inter (x, y) of the target block may be encoded/decoded/signaled.

대상 블록의 잔차 신호 ResTM_Inter(x, y)가 주어진 경우, 템플릿 매칭 참조 영상, 템플릿 매칭 움직임 벡터 MVtm, 템플릿 매칭 최적 블록의 재구축된 신호 PTM(x + xtm, y + ytm), 인터 예측 참조 영상, 인터 예측 블록 Pinter, 인터 예측 움직임 벡터 MVInter, 템플릿 매칭 최적 블록의 가중치 w1 및 인터 예측 신호의 가중치 w2 중 적어도 하나를 사용하여 재구축된 대상 블록의 신호 Rect(x, y)가 획득될 수 있다.Given the residual signal Res TM_Inter (x, y) of the target block, the template matching reference image, the template matching motion vector MV tm , and the reconstructed signal P TM (x + x tm , y + y tm ) of the template matching optimal block. , inter prediction reference image, inter prediction block P inter , inter prediction motion vector MV Inter , template matching signal of target block reconstructed using at least one of the optimal block weight w 1 and the weight w 2 of inter prediction signal Rec t (x, y) can be obtained.

Rect(x, y)는 아래의 수식 74에 따라서 획득될 수 있다.Rec t (x, y) can be obtained according to Equation 74 below.

[수식 74][Formula 74]

Rect(x, y) = (w1·PTM(x + xtm, y + ytm) + w2·PInter(x + xinter, y + yinter)) + ResTM_Inter(x, y)Rec t (x, y) = (w 1 ·P TM (x + x tm , y + y tm ) + w 2 ·P Inter (x + x inter , y + y inter )) + Res TM_Inter (x, y )

P 인터 및 템플릿 매칭의 블랜딩 예측의 실시예Example of blending prediction of P inter and template matching

일 실시예에서, 템플릿 매칭 움직임 벡터 MVtm는 (5, 5)일 수 있다. 인터 예측 움직임 벡터 MVInter는 (1, 2)일 수 있다. 가중치 w1은 1/2일 수 있다. 가중치 w2는 1/2일 수 있다.In one embodiment, the template matching motion vector MV tm may be (5, 5). The inter prediction motion vector MV Inter may be (1, 2). Weight w 1 may be 1/2. Weight w 2 may be 1/2.

이러한 경우, 아래의 수식 75에 따라서, 대상 블록의 신호 Ot(x, y)가 예측될 수 있다.In this case, the signal O t (x, y) of the target block can be predicted according to Equation 75 below.

[수식 75][Formula 75]

ResTM_Inter(x, y) = Ot(x, y) - (PTM(x + 5, y + 5) + PInter(x + 1, y + 2) + offset) >> 1Res TM_Inter (x, y) = O t (x, y) - (P TM (x + 5, y + 5) + P Inter (x + 1, y + 2) + offset) >> 1

대상 블록의 예측 신호는 아래의 수식 76와 같을 수 있다.The prediction signal of the target block may be as in Equation 76 below.

[수식 76][Formula 76]

(PTM(x + 5, y + 5) + PInter(x + 1, y + 2) + offset) >> 1(P TM (x + 5, y + 5) + P Inter (x + 1, y + 2) + offset) >> 1

ResTM_Inter(x, y)는 대상 블록의 예측 신호 및 대상 블록 간의 차이(즉, 잔차 신호)일 수 있다.Res TM_Inter (x, y) may be the difference (i.e., residual signal) between the prediction signal of the target block and the target block.

offset는 반올림을 위한 값일 수 있다. 예를 들면, 10 비트 영상에 대한 부호화/복호화가 수행되는 경우 offset는 512일 수 있다. 예를 들면, 8 비트 영상에 대한 부호화/복호화가 수행되는 경우 offset는 128일 수 있다. 반올림이 적용되지 않는 경우 offset는 0일 수 있다.offset may be a value for rounding. For example, when encoding/decoding is performed on a 10-bit image, the offset may be 512. For example, when encoding/decoding is performed on an 8-bit video, the offset may be 128. If rounding is not applied, offset can be 0.

대상 블록의 잔차 신호 ResTM_Inter(x, y)가 부호화/복호화/시그널링될 수 있다.The residual signal Res TM_Inter (x, y) of the target block may be encoded/decoded/signaled.

ResTM_Inter(x, y)가 주어지면, 재구축된 대상 블록의 Rect(x, y)는 아래의 수식 77에 따라서 획득될 수 있다.Given Res TM_Inter (x, y), Rec t (x, y) of the reconstructed target block can be obtained according to Equation 77 below.

[수식 77][Formula 77]

Rect(x, y) = (PTM(x + 5, y + 5) + PInter(x + 1, y + 2)) >> 1 + ResTM_Inter(x, y)Rec t (x, y) = (P TM (x + 5, y + 5) + P Inter (x + 1, y + 2)) >> 1 + Res TM_Inter (x, y)

템플릿 매칭 참조 영상의 추론Inference from template matching reference images

인터 예측 참조 영상이 구성되면, 인터 예측 참조 영상으로부터 템플릿 매칭 참조 영상이 추론될 수 있다.Once the inter prediction reference image is constructed, a template matching reference image can be inferred from the inter prediction reference image.

일 실시예에서, 템플릿 매칭 참조 영상 및 인터 예측 참조 영상은 동일할 수 있다. 말하자면, 대상 블록의 인터 예측을 위해 사용된 참조 영상이 템플릿 매칭 참조 영상으로 간주될 수 있다.In one embodiment, the template matching reference image and the inter prediction reference image may be the same. In other words, the reference image used for inter prediction of the target block can be considered a template matching reference image.

예를 들면, 대상 블록이 제1 참조 영상 리스트 내의 제1 참조 영상을 사용하여 부호화/복호화된 경우, 제1 참조 영상 리스트의 제1 참조 영상이 템플릿 매칭 참조 영상으로서 추론될 수 있다.For example, when the target block is encoded/decoded using the first reference image in the first reference image list, the first reference image in the first reference image list may be inferred as the template matching reference image.

예를 들면, 대상 블록이 제1 참조 영상 리스트 내의 제2 참조 영상을 사용하여 부호화/복호화된 경우, 제1 참조 영상 리스트의 제2 참조 영상이 템플릿 매칭 참조 영상으로서 추론될 수 있다.For example, when the target block is encoded/decoded using the second reference image in the first reference image list, the second reference image in the first reference image list may be inferred as the template matching reference image.

일 실시예에서, 템플릿 매칭 참조 영상 및 인터 예측 참조영상은 서로 다를 수 있다.In one embodiment, the template matching reference image and the inter prediction reference image may be different from each other.

예를 들면, 인터 예측 참조 영상이 포함되지 않는 참조 영상 리스트 내의 특정 참조 영상이 템플릿 매칭 참조 영상으로서 추론될 수 있다. 특정 참조 영상은 첫 번째 참조 영상일 수 있다.For example, a specific reference image in a reference image list that does not include an inter-prediction reference image may be inferred as a template matching reference image. A specific reference image may be the first reference image.

예를 들면, 인터 예측 참조 영상이 제1 참조 영상 리스트 내의 참조 영상이면, 제2 참조 영상 리스트의 첫 번째 참조 영상이 템플릿 매칭 참조 영상으로서 추론될 수 있다.For example, if the inter prediction reference image is a reference image in the first reference image list, the first reference image in the second reference image list may be inferred as the template matching reference image.

예를 들면, 인터 예측 참조 영상이 제2 참조 영상 리스트 내의 참조 영상이면, 제1 참조 영상 리스트의 첫 번째 참조 영상이 템플릿 매칭 참조 영상으로서 추론될 수 있다.For example, if the inter-prediction reference image is a reference image in the second reference image list, the first reference image in the first reference image list may be inferred as the template matching reference image.

일 실시예에서, 인터 예측의 제2 참조 영상 리스트의 첫 번째 참조 영상이 템플릿 매칭 참조 영상으로서 설정될 수 있다.In one embodiment, the first reference image in the second reference image list of inter prediction may be set as the template matching reference image.

P 인터 및 템플릿 매칭의 블랜딩 예측에서의 시그널링Signaling in blending prediction of P-inter and template matching

대상 블록이 P 인터 및 템플릿 매칭의 블랜딩 예측을 사용하여 부호화/복호화되었는지 여부를 지시하는 구문 요소(= p_inter_template_matching_blending_mode)가 시그널링될 수 있다.A syntax element (= p_inter_template_matching_blending_mode) indicating whether the target block has been encoded/decoded using blending prediction of P inter and template matching may be signaled.

예를 들면, p_inter_template_matching_blending_mode가 제1 값인 것은, 대상 블록이 P 인터 및 템플릿 매칭의 블랜딩 예측을 사용하여 부호화/복호화되었음을 지시할 수 있다. p_inter_template_matching_blending_mode가 제2 값인 것은, 대상 블록이 P 인터 및 템플릿 매칭의 블랜딩 예측을 사용하여 부호화/복호화되지 않았음을 지시할 수 있다.For example, p_inter_template_matching_blending_mode being the first value may indicate that the target block was encoded/decoded using blending prediction of P inter and template matching. The fact that p_inter_template_matching_blending_mode is the second value may indicate that the target block has not been encoded/decoded using blending prediction of P inter and template matching.

대상 블록의 인터 예측 참조 영상 및 템플릿 매칭 참조 영상이 동일한지 여부를 지시하는 구문 요소(= inter_tm_sharing_ref_flag)가 시그널링될 수 있다.A syntax element (=inter_tm_sharing_ref_flag) indicating whether the inter prediction reference image and the template matching reference image of the target block are the same may be signaled.

예를 들면, inter_tm_sharing_ref_flag가 제1 값인 것은, 대상 블록의 인터 예측 참조 영상 및 템플릿 매칭 참조 영상이 동일함을 지시할 수 있다. inter_tm_sharing_ref_flag가 제2 값인 것은, 대상 블록의 인터 예측 참조 영상 및 템플릿 매칭 참조 영상이 동일하지 않음을 지시할 수 있다. inter_tm_sharing_ref_flag가 제3 값인 것은, 템플릿 매칭 참조 영상은 인터 예측의 제2 참조 영상 리스트의 첫 번째 참조 영상일 수 있다.For example, inter_tm_sharing_ref_flag being the first value may indicate that the inter prediction reference image and template matching reference image of the target block are the same. The fact that inter_tm_sharing_ref_flag is the second value may indicate that the inter prediction reference image and template matching reference image of the target block are not the same. Since inter_tm_sharing_ref_flag is the third value, the template matching reference image may be the first reference image in the second reference image list of inter prediction.

대상 블록의 인터 예측 참조 영상 및 템플릿 매칭 참조 영상이 동일한 경우, 템플릿 매칭 참조 영상을 지시하는 구문 요소의 시그널링이 생략될 수 있다.If the inter-prediction reference image and the template matching reference image of the target block are the same, signaling of the syntax element indicating the template matching reference image may be omitted.

예를 들면, inter_tm_sharing_ref_flag가 제1 값인 경우, 대상 블록의 템플릿 매칭 참조 영상을 지시하는 구문 요소가 시그널링되지 않을 수 있다.For example, when inter_tm_sharing_ref_flag is the first value, a syntax element indicating the template matching reference image of the target block may not be signaled.

B 인터 및 템플릿 매칭의 블랜딩 예측Blending prediction of inter and template matching

아래에서는 단계(2047)에서의 B 인터 및 템플릿 매칭의 블랜딩 예측이 설명된다.Below, the blending prediction of B inter and template matching in step 2047 is described.

양-예측의(bi-predictive) 인터 모드의 예측 신호 및 템플릿 매칭 최적 블록을 함께 이용함으로써 대상 블록에 대한 부호화/복호화가 수행될 수 있다.Encoding/decoding of the target block can be performed by using the prediction signal of the bi-predictive inter mode and the template matching optimal block together.

B 인터 및 TM의 블랜딩 예측은 이러한 양-예측의 인터 모드의 예측 신호 및 템플릿 매칭 최적 블록을 함께 이용하는 예측을 의미할 수 있다.Blended prediction of B inter and TM may refer to prediction using the prediction signal of the inter mode of this bi-prediction and the template matching optimal block together.

도 67에서 도시된 것과 같이, Ot는 대상 블록을 나타낼 수 있다. 템플릿 A는 대상 블록에 인접한 대상 블록의 템플릿일 수 있다. 템플릿 B는 템플릿 A와의 최고 상관관계를 갖는 템플릿일 수 있다. PTM은 템플릿 B에 인접하는 템플릿 매칭 최적 블록을 나타낼 수 있다. MVtm은 템플릿 매칭 움직임 벡터일 수 있다. PInter_l0는 대상 블록에 대한 인터 예측에 의해 생성된 제1 인터 예측 참조 영상의 제1 인터 예측 블록일 수 있다. PInter_l1는 대상 블록에 대한 인터 예측에 의해 생성된 제2 인터 예측 참조 영상의 제2 인터 예측 블록일 수 있다. MVInter_l0는 제1 인터 예측 참조 영상의 제1 인터 예측 움직임 벡터일 수 있다. MVInter_l1는 제2 인터 예측 참조 영상의 제2 인터 예측 움직임 벡터일 수 있다.As shown in FIG. 67, O t may represent a target block. Template A may be a template of a target block adjacent to the target block. Template B may be the template with the highest correlation with template A. P TM may represent a template matching optimal block adjacent to template B. MV tm may be a template matching motion vector. P Inter_l0 may be the first inter prediction block of the first inter prediction reference image generated by inter prediction for the target block. P Inter_l1 may be a second inter prediction block of the second inter prediction reference image generated by inter prediction for the target block. MV Inter_l0 may be the first inter prediction motion vector of the first inter prediction reference image. MV Inter_l1 may be a second inter prediction motion vector of the second inter prediction reference image.

템플릿 매칭 움직임 벡터 MVtm는 아래의 수식 78과 같을 수 있다.The template matching motion vector MV tm may be expressed as Equation 78 below.

[수식 78][Formula 78]

MVtm = (xtm, ytm)MV tm = (x tm , y tm )

제1 인터 예측 움직임 벡터 MVInter_l0는 아래의 수식 79와 같을 수 있다.The first inter prediction motion vector MV Inter_l0 may be expressed as Equation 79 below.

[수식 79][Formula 79]

MVInter_l0 = (xinter_l0, yinter_l0)MV Inter_l0 = (x inter_l0 , y inter_l0 )

제2 인터 예측 움직임 벡터 MVInter_l1은 아래의 수식 80과 같을 수 있다.The second inter prediction motion vector MV Inter_l1 may be expressed as Equation 80 below.

[수식 80][Formula 80]

MVInter_l1 = (xinter_l1, yinter_l1)MV Inter_l1 = (x inter_l1 , y inter_l1 )

상기와 같은 정보들이 주어졌을 때, 위치 (x, y)에서의 대상 블록의 신호 Ot(x, y)는 PTM(x + xtm, y + ytm), PInter_l0(x + xinter_l0, y + yinter_l0) 및 PInter_l1(x + xinter_l1, y + yinter_l1)를 사용하여 예측될 수 있다.Given the above information, the signal O t (x, y) of the target block at position (x, y) is P TM (x + x tm , y + y tm ), P Inter_l0 (x + x inter_l0 , y + y inter_l0 ) and P Inter_l1 (x + x inter_l1 , y + y inter_l1 ).

PTM(x + xtm, y + ytm)는 템플릿 매칭 최적 블록의 재구축된 신호일 수 있다.P TM (x + x tm , y + y tm ) may be the reconstructed signal of the template matching optimal block.

PInter_l0(x + xinter_l0, y + yinter_l0)는 대상 블록에 대한 L0 방향의 인터 예측을 수행함으로써 생성된 L0 신호일 수 있다.P Inter_l0 (x + x inter_l0 , y + y inter_l0 ) may be an L0 signal generated by performing inter prediction in the L0 direction for the target block.

PInter_l1(x + xinter_l1, y + yinter_l1)는 대상 블록에 대한 L1 방향의 인터 예측을 수행함으로써 생성된 L1 신호일 수 있다.P Inter_l1 (x + x inter_l1 , y + y inter_l1 ) may be an L1 signal generated by performing inter prediction in the L1 direction for the target block.

아래의 수식 81에 따라서, 대상 블록의 신호 Ot(x, y)가 예측될 수 있다.According to Equation 81 below, the signal O t (x, y) of the target block can be predicted.

[수식 81][Formula 81]

ResTM_Inter_B(x, y) = Ot(x, y) - (w1·PTM(x + xtm, y + ytm) + w2·PInter_l0(x + xinter_l0, y + yinter_l0) + w3·PInter_l1(x + xinter_l1, y + yinter_l1))Res TM_Inter_B (x, y) = O t (x, y) - (w 1 ·P TM (x + x tm , y + y tm ) + w 2 ·P Inter_l0 (x + x inter_l0 , y + y inter_l0 ) + w 3 ·P Inter_l1 (x + x inter_l1 , y + y inter_l1 ))

여기에서, w1는 템플릿 매칭 최적 블록의 가중치일 수 있다. w2는 제1 인터 예측 참조 영상(또는, L0 인터 예측 신호)의 가중치일 수 있다. w3은 제2 인터 예측 참조 영상(또는, L1 인터 예측 신호)의 가중치일 수 있다.Here, w 1 may be the weight of the template matching optimal block. w 2 may be the weight of the first inter prediction reference image (or L0 inter prediction signal). w 3 may be the weight of the second inter prediction reference image (or L1 inter prediction signal).

대상 블록의 예측 신호는 아래의 수식 82와 같을 수 있다.The prediction signal of the target block may be as shown in Equation 82 below.

[수식 82][Formula 82]

w1·PTM(x + xtm, y + ytm) + w2·PInter_l0(x + xinter_l0, y + yinter_l0) + w3·PInter_l1(x + xinter_l1, y + yinter_l1)w 1 ·P TM (x + x tm , y + y tm ) + w 2 ·P Inter_l0 (x + x inter_l0 , y + y inter_l0 ) + w 3 ·P Inter_l1 ( x +

ResTM_Inter_B(x, y)는 대상 블록의 예측 신호 및 대상 블록 간의 차이(즉, 잔차 신호)일 수 있다.Res TM_Inter_B (x, y) may be the difference (i.e., residual signal) between the prediction signal of the target block and the target block.

대상 블록의 잔차 신호 ResTM_Inter_B(x, y)가 부호화/복호화/시그널링될 수 있다.The residual signal Res TM_Inter_B (x, y) of the target block may be encoded/decoded/signaled.

대상 블록의 잔차 신호 ResTM_Inter_B(x, y)가 주어진 경우, 템플릿 매칭 참조 영상, 템플릿 매칭 최적 블록 PTM, 템플릿 매칭 움직임 벡터 MVtm, 제1 인터 예측 참조 영상의 인터 예측 블록 Pinter_l0, 제2 인터 예측 참조 영상의 인터 예측 블록 Pinter_l1, 제1 인터 예측 참조 영상의 인터 예측 움직임 벡터 MVInter_l0, 제2 인터 예측 참조 영상의 인터 예측 움직임 벡터 MVInter_l1, 템플릿 매칭 참조 영상(또는, 템플릿 매칭 최적 블록)의 가중치 w1, 제1 인터 예측 참조 영상의 인터 예측 신호의 가중치 w2 및 제2 인터 예측 참조 영상의 인터 예측 신호의 가중치 w3 중 적어도 하나를 사용하여 재구축된 대상 블록의 신호 Rect(x, y)가 획득될 수 있다.Given the residual signal Res TM_Inter_B (x, y) of the target block, the template matching reference image, the template matching optimal block P TM , the template matching motion vector MV tm , the inter prediction block P inter_l0 of the first inter prediction reference image, the second Inter prediction block P inter_l1 of the inter prediction reference image, inter prediction motion vector MV Inter_l0 of the first inter prediction reference image, inter prediction motion vector MV Inter_l1 of the second inter prediction reference image, template matching reference image (or template matching optimal block) ) of the weight w 1 , the weight w 2 of the inter prediction signal of the first inter prediction reference image, and the weight w 3 of the inter prediction signal of the second inter prediction reference image Rec t of the target block reconstructed using at least one of (x, y) can be obtained.

Rect(x, y)는 아래의 수식 83에 따라서 획득될 수 있다.Rec t (x, y) can be obtained according to Equation 83 below.

[수식 83][Formula 83]

Rect(x, y) = (w1·PTM(x + xtm, y + ytm) + w2·PInter_l0(x + xinter_l0, y + yinter_l0) + w3·PInter_l1(x + xinter_l1, y + yinter_l1)) + ResTM_Inter_B(x, y)Rec t (x, y) = (w 1 ·P TM (x + x tm , y + y tm ) + w 2 ·P Inter_l0 (x + x inter_l0 , y + y inter_l0 ) + w 3 ·P Inter_l1 (x + x inter_l1 , y + y inter_l1 )) + Res TM_Inter_B (x, y)

B 인터 및 템플릿 매칭의 블랜딩 예측의 실시예Example of blending prediction of B-inter and template matching

일 실시예에서, 템플릿 매칭 움직임 벡터 MVtm는 (5, 5)일 수 있다. 제1 참조 영상의 인터 예측 움직임 벡터 MVInter_l0는 (1, 2)일 수 있다. 제2 참조 영상의 인터 예측 움직임 벡터 MVInter_l1는 (2, 3)일 수 있다. 가중치 w1은 1/3일 수 있다. 가중치 w2는 1/3일 수 있다. 가중치 w3은 1/3일 수 있다.In one embodiment, the template matching motion vector MV tm may be (5, 5). The inter prediction motion vector MV Inter_l0 of the first reference image may be (1, 2). The inter prediction motion vector MV Inter_l1 of the second reference image may be (2, 3). Weight w 1 may be 1/3. Weight w 2 may be 1/3. Weight w 3 may be 1/3.

이러한 경우, 아래의 수식 84에 따라서, 대상 블록의 신호 Ot(x, y)가 예측될 수 있다.In this case, the signal O t (x, y) of the target block can be predicted according to Equation 84 below.

[수식 84][Formula 84]

ResTM_Inter_B(x, y) = Ot(x, y) - ((1/3)·PTM(x + 5, y + 5) + (1/3)·PInter_l0(x + 1, y + 2) + (1/3)·PInter_l1(x + 2, y + 3))Res TM_Inter_B (x, y) = O t (x, y) - ((1/3)·P TM (x + 5, y + 5) + (1/3)·P Inter_l0 (x + 1, y + 2) + (1/3)·P Inter_l1 (x + 2, y + 3))

대상 블록의 예측 신호는 아래의 수식 85와 같을 수 있다.The prediction signal of the target block may be as shown in Equation 85 below.

[수식 85][Formula 85]

(1/3)·PTM(x + 5, y + 5) + (1/3)·PInter_l0(x + 1, y + 2) + (1/3)·PInter_l1(x + 2, y + 3)(1/3)·P TM (x + 5, y + 5) + (1/3)·P Inter_l0 (x + 1, y + 2) + (1/3)·P Inter_l1 (x + 2, y + 3)

ResTM_Inter_B(x, y)는 대상 블록의 예측 신호 및 대상 블록 간의 차이(즉, 잔차 신호)일 수 있다.Res TM_Inter_B (x, y) may be the difference (i.e., residual signal) between the prediction signal of the target block and the target block.

대상 블록의 잔차 신호 ResTM_Inter_B(x, y)가 부호화/복호화/시그널링될 수 있다.The residual signal Res TM_Inter_B (x, y) of the target block may be encoded/decoded/signaled.

ResTM_Inter_B(x, y)가 주어지면, 재구축된 대상 블록의 Rect(x, y)는 아래의 수식 86에 따라서 획득될 수 있다.Given Res TM_Inter_B (x, y), Rec t (x, y) of the reconstructed target block can be obtained according to Equation 86 below.

[수식 86][Formula 86]

Rect(x, y) = ((1/3)·PTM(x + 5, y + 5) + (1/3)·PInter_l0(x + 1, y + 2) + (1/3)·PInter_l1(x + 2, y + 3)) + ResTM_Inter_B(x, y)Rec t (x, y) = ((1/3)·P TM (x + 5, y + 5) + (1/3)·P Inter_l0 (x + 1, y + 2) + (1/3) ·P Inter_l1 (x + 2, y + 3)) + Res TM_Inter_B (x, y)

B 인터 및 템플릿 매칭의 블랜딩에서의 템플릿 매칭 참조 영상의 추론B Inference of template matching reference images in blending of inter and template matching.

인터 예측 참조 영상이 구성되면, 인터 예측 참조 영상으로부터 템플릿 매칭 참조 영상이 추론될 수 있다.Once the inter prediction reference image is constructed, a template matching reference image can be inferred from the inter prediction reference image.

일 실시예에서, 대상 블록의 제1 참조 영상 리스트의 참조 영상이 템플릿 매칭 참조 영상으로서 추론될 수 있다. 말하자면, 특정 참조 영상 리스트 내의 특정 참조 영상이 대상 블록의 부호화/복호화를 위해 사용된 경우, 특정 참조 영상이 템플릿 매칭 참조 영상으로서 추론될 수 있다.In one embodiment, a reference image in the first reference image list of the target block may be inferred as a template matching reference image. In other words, when a specific reference image in the specific reference image list is used for encoding/decoding the target block, the specific reference image can be inferred as a template matching reference image.

예를 들면, 대상 블록이 제1 참조 영상 리스트 내의 제1 참조 영상을 사용하여 부호화/복호화된 경우, 제1 참조 영상 리스트의 제1 참조 영상이 템플릿 매칭 참조 영상으로서 추론될 수 있다.For example, when the target block is encoded/decoded using the first reference image in the first reference image list, the first reference image in the first reference image list may be inferred as the template matching reference image.

예를 들면, 대상 블록이 제2 참조 영상 리스트 내의 제1 참조 영상을 사용하여 부호화/복호화된 경우, 제2 참조 영상 리스트의 제1 참조 영상이 템플릿 매칭 참조 영상으로서 추론될 수 있다.For example, when the target block is encoded/decoded using the first reference image in the second reference image list, the first reference image in the second reference image list may be inferred as the template matching reference image.

B 인터 및 템플릿 매칭의 블랜딩 예측에서의 시그널링Signaling in blending prediction of B-inter and template matching

대상 블록이 B 인터 및 템플릿 매칭의 블랜딩 예측을 사용하여 부호화/복호화되었는지 여부를 지시하는 구문 요소(= b_inter_template_matching_blending_mode)가 시그널링될 수 있다.A syntax element (=b_inter_template_matching_blending_mode) indicating whether the target block has been encoded/decoded using blending prediction of B inter and template matching may be signaled.

예를 들면, b_inter_template_matching_blending_mode가 제1 값인 것은, 대상 블록이 B 인터 및 템플릿 매칭의 블랜딩 예측을 사용하여 부호화/복호화되었음을 지시할 수 있다. b_inter_template_matching_blending_mode가 제2 값인 것은, 대상 블록이 B 인터 및 템플릿 매칭의 블랜딩 예측을 사용하여 부호화/복호화되지 않았음을 지시할 수 있다.For example, b_inter_template_matching_blending_mode being the first value may indicate that the target block was encoded/decoded using blending prediction of B inter and template matching. The fact that b_inter_template_matching_blending_mode is the second value may indicate that the target block has not been encoded/decoded using blending prediction of B inter and template matching.

B 인터 및 B-TM의 블랜딩 예측Blending prediction of B-Inter and B-TM

아래에서는 단계(2048)에서의 B 인터 및 B-TM의 블랜딩 예측이 설명된다.Below, the blending prediction of B-Inter and B-TM in step 2048 is described.

양-예측의(bi-predictive) 인터 모드의 예측 신호 및 2 개의 템플릿 매칭 최적 블록들을 함께 이용함으로써 대상 블록에 대한 부호화/복호화가 수행될 수 있다.Encoding/decoding on the target block can be performed by using the prediction signal of the bi-predictive inter mode and the two template matching optimal blocks together.

B 인터 및 양방향의 TM(Bidirectional-TM; B-TM)의 블랜딩 예측은 이러한 양-예측의 인터 모드의 예측 신호 및 템플릿 복수의 매칭 최적 블록들을 함께 이용하는 예측을 의미할 수 있다.Blending prediction of B-inter and bidirectional-TM (B-TM) may mean prediction using the prediction signal and template of the bi-prediction inter mode together with a plurality of matching optimal blocks.

Ot는 대상 블록을 나타낼 수 있다. 템플릿 A는 대상 블록에 인접한 대상 블록의 템플릿일 수 있다. 템플릿 매칭 참조 영상으로서, 제1 템플릿 매칭 참조 영상 및 제2 템플릿 매칭 참조 영상이 사용될 수 있다. 템플릿 B는 제1 템플릿 매칭 참조 영상 내의 템플릿 A와의 최고 상관관계를 갖는 템플릿일 수 있다. PTM_l0은 제1 템플릿 매칭 참조 영상 내의 템플릿 B에 인접하는 제1 템플릿 매칭 최적 블록을 나타낼 수 있다. 템플릿 C는 제2 템플릿 매칭 참조 영상 내의 템플릿 A와의 최고 상관관계를 갖는 템플릿일 수 있다. PTM_l1은 제2 템플릿 매칭 참조 영상 내의 템플릿 C에 인접하는 제2 템플릿 매칭 최적 블록을 나타낼 수 있다. MVtm_l0은 PTM_l1 및 대상 블록 간의 제1 템플릿 매칭 움직임 벡터일 수 있다. MVtm_l0은 PTM_l2 및 대상 블록 간의 제2 템플릿 매칭 움직임 벡터일 수 있다. PInter_l0는 대상 블록에 대한 인터 예측에 의해 생성된 제1 인터 예측 참조 영상의 제1 인터 예측 블록일 수 있다. PInter_l1는 대상 블록에 대한 인터 예측에 의해 생성된 제2 인터 예측 참조 영상의 제2 인터 예측 블록일 수 있다. MVInter_l0는 제1 인터 예측 참조 영상의 제1 인터 예측 움직임 벡터일 수 있다. MVInter_l1는 제2 인터 예측 참조 영상의 제2 인터 예측 움직임 벡터일 수 있다.O t may represent the target block. Template A may be a template of a target block adjacent to the target block. As the template matching reference image, a first template matching reference image and a second template matching reference image may be used. Template B may be the template with the highest correlation with template A in the first template matching reference image. P TM_l0 may indicate the first template matching optimal block adjacent to template B in the first template matching reference image. Template C may be the template with the highest correlation with template A in the second template matching reference image. P TM_l1 may indicate a second template matching optimal block adjacent to template C in the second template matching reference image. MV tm_l0 may be the first template matching motion vector between P TM_l1 and the target block. MV tm_l0 may be a second template matching motion vector between P TM_l2 and the target block. P Inter_l0 may be the first inter prediction block of the first inter prediction reference image generated by inter prediction for the target block. P Inter_l1 may be a second inter prediction block of the second inter prediction reference image generated by inter prediction for the target block. MV Inter_l0 may be the first inter prediction motion vector of the first inter prediction reference image. MV Inter_l1 may be a second inter prediction motion vector of the second inter prediction reference image.

제1 템플릿 매칭 움직임 벡터 MVtm_l0는 아래의 수식 87과 같을 수 있다.The first template matching motion vector MV tm_l0 may be expressed as Equation 87 below.

[수식 87][Formula 87]

MVtm_l0 = (xtm_l0, ytm_l0)MV tm_l0 = (x tm_l0 , y tm_l0 )

제2 템플릿 매칭 움직임 벡터 MVtm_l1는 아래의 수식 88과 같을 수 있다.The second template matching motion vector MV tm_l1 may be expressed as Equation 88 below.

[수식 88][Formula 88]

MVtm_l1 = (xtm_l1, ytm_l1)MV tm_l1 = (x tm_l1 , y tm_l1 )

제1 인터 예측 움직임 벡터 MVInter는 아래의 수식 89와 같을 수 있다.The first inter prediction motion vector MV Inter may be expressed as Equation 89 below.

[수식 89][Formula 89]

MVInter_l0 = (xinter_l0, yinter_l0)MV Inter_l0 = (x inter_l0 , y inter_l0 )

제2 인터 예측 움직임 벡터 MVInter는 아래의 수식 90과 같을 수 있다.The second inter prediction motion vector MV Inter may be expressed as Equation 90 below.

[수식 90][Formula 90]

MVInter_l1 = (xinter_l1, yinter_l1)MV Inter_l1 = (x inter_l1 , y inter_l1 )

상기와 같은 정보들이 주어졌을 때, 위치 (x, y)에서의 대상 블록의 신호 Ot(x, y)는 템플릿 매칭 최적 블록의 재구축된 신호들(즉, PTM_l0(x + xtm_l0, y + ytm_l0) 및 PTM_l1(x + xtm_l1, y + ytm_l1)) 및 인터 예측 모드를 사용하여 대상 블록에 대한 예측을 수행함으로써 생성된 신호들(즉, PInter_l0(x + xinter_l0, y + yinter_l0) 및 PInter_l1(x + xinter_l1, y + yinter_l1))를 사용하여 예측될 수 있다.Given the above information, the signal O t (x, y) of the target block at position (x, y) is the reconstructed signal of the template matching optimal block (i.e., P TM_l0 (x + x tm_l0 , y + y tm_l0 ) and P TM_l1 (x + x tm_l1 , y + y tm_l1 )) and signals generated by performing prediction on the target block using the inter prediction mode (i.e., P Inter_l0 (x + y + y inter_l0 ) and P Inter_l1 (x + x inter_l1 , y + y inter_l1 )).

PTM_l0(x + xtm_l0, y + ytm_l0)는 제1 템플릿 매칭 최적 블록의 재구축된 신호일 수 있다.P TM_l0 (x + x tm_l0 , y + y tm_l0 ) may be a reconstructed signal of the first template matching optimal block.

PTM_l1(x + xtm_l1, y + ytm_l1)는 제2 템플릿 매칭 최적 블록의 재구축된 신호일 수 있다.P TM_l1 (x + x tm_l1 , y + y tm_l1 ) may be a reconstructed signal of the second template matching optimal block.

PInter_l0(x + xinter_l0, y + yinter_l0)는 대상 블록에 대한 L0 방향의 인터 예측을 수행함으로써 생성된 L0 신호일 수 있다.P Inter_l0 (x + x inter_l0 , y + y inter_l0 ) may be an L0 signal generated by performing inter prediction in the L0 direction for the target block.

PInter_l1(x + xinter_l1, y + yinter_l1)는 대상 블록에 대한 L1 방향의 인터 예측을 수행함으로써 생성된 L1 신호일 수 있다.P Inter_l1 (x + x inter_l1 , y + y inter_l1 ) may be an L1 signal generated by performing inter prediction in the L1 direction for the target block.

아래의 수식 91에 따라서, 대상 블록의 신호 Ot(x, y)가 예측될 수 있다.According to Equation 91 below, the signal O t (x, y) of the target block can be predicted.

[수식 91][Formula 91]

ResS-TM_Inter_B(x, y) = Ot(x, y) - (w1·PTM_l0(x + xtm_l0, y + ytm_l0) + w2·PTM_l1(x + xtm_l1, y + ytm_l1) + w3·PInter_l0(x + xinter_l0, y + yinter_l0) + w4·PInter_l1(x + xinter_l1, y + yinter_l1))Res S-TM_Inter_B (x, y) = O t (x, y) - (w 1 ·P TM_l0 (x + x tm_l0 , y + y tm_l0 ) + w 2 ·P TM_l1 (x + x tm_l1 , y + y tm_l1 ) + w 3 ·P Inter_l0 (x + x inter_l0 , y + y inter_l0 ) + w 4 ·P Inter_l1 (x + x inter_l1 , y + y inter_l1 ))

여기에서, w1는 제1 템플릿 매칭 최적 블록의 가중치일 수 있다. w2는 제2 템플릿 매칭 최적 블록의 가중치일 수 있다. w3은 제1 인터 예측 참조 영상(또는, L0 인터 예측 신호)의 가중치일 수 있다. w4는 제2 인터 예측 참조 영상(또는, L1 인터 예측 신호)의 가중치일 수 있다.Here, w 1 may be the weight of the first template matching optimal block. w 2 may be the weight of the second template matching optimal block. w 3 may be the weight of the first inter prediction reference image (or L0 inter prediction signal). w 4 may be the weight of the second inter prediction reference image (or L1 inter prediction signal).

대상 블록의 예측 신호는 아래의 수식 92와 같을 수 있다.The prediction signal of the target block may be as in Equation 92 below.

[수식 92][Formula 92]

w1·PTM_l0(x + xtm_l0, y + ytm_l0) + w2·PTM_l1(x + xtm_l1, y + ytm_l1) + w3·PInter_l0(x + xinter_l0, y + yinter_l0) + w4·PInter_l1(x + xinter_l1, y + yinter_l1)w 1 ·P TM_l0 (x + x tm_l0 , y + y tm_l0 ) + w 2 ·P TM_l1 (x + x tm_l1 , y + y tm_l1 ) + w 3 ·P Inter_l0 (x + + w 4 ·P Inter_l1 (x + x inter_l1 , y + y inter_l1 )

ResS-TM_Inter_B(x, y)는 대상 블록의 예측 신호 및 대상 블록 간의 차이(즉, 잔차 신호)일 수 있다.Res S-TM_Inter_B (x, y) may be the difference (i.e., residual signal) between the prediction signal of the target block and the target block.

대상 블록의 잔차 신호 ResS-TM_Inter_B(x, y)가 부호화/복호화/시그널링될 수 있다.The residual signal Res S-TM_Inter_B (x, y) of the target block may be encoded/decoded/signaled.

대상 블록의 잔차 신호 ResB-TM_Inter_B(x, y)가 주어진 경우, 제1 템플릿 매칭 참조 영상, 제1 템플릿 매칭 최적 블록 PTM_l0, 제1 템플릿 매칭 움직임 벡터 MVtm_l0, 제2 템플릿 매칭 참조 영상, 제2 템플릿 매칭 최적 블록 PTM_l1, 제2 템플릿 매칭 움직임 벡터 MVtm_l1, 제1 인터 예측 참조 영상의 인터 예측 블록 Pinter_l0, 제2 인터 예측 참조 영상의 인터 예측 블록 Pinter_l1, 제1 인터 예측 참조 영상의 인터 예측 움직임 벡터 MVInter_l0, 제2 인터 예측 참조 영상의 인터 예측 움직임 벡터 MVInter_l1, 제1 템플릿 매칭 참조 영상(또는, 제1 템플릿 매칭 최적 블록)의 가중치 w1, 제2 템플릿 매칭 참조 영상(또는, 제2 템플릿 매칭 최적 블록)의 가중치 w2, 제1 인터 예측 참조 영상의 인터 예측 신호의 가중치 w3 및 제2 인터 예측 참조 영상의 인터 예측 신호의 가중치 w4 중 적어도 하나를 사용하여 재구축된 대상 블록의 신호 Rect(x, y)가 획득될 수 있다.Given the residual signal Res B-TM_Inter_B (x, y) of the target block, the first template matching reference image, the first template matching optimal block P TM_l0 , the first template matching motion vector MV tm_l0 , the second template matching reference image, Second template matching optimal block P TM_l1 , second template matching motion vector MV tm_l1 , inter prediction block P inter_l0 of the first inter prediction reference image, inter prediction block P inter_l1 of the second inter prediction reference image, first inter prediction reference image inter prediction motion vector MV Inter_l0 , inter prediction motion vector MV Inter_l1 of the second inter prediction reference image, weight w 1 of the first template matching reference image (or, first template matching optimal block), second template matching reference image ( Or, re-processing using at least one of the weight w 2 of the second template matching optimal block, the weight w 3 of the inter prediction signal of the first inter prediction reference image, and the weight w 4 of the inter prediction signal of the second inter prediction reference image. The signal Rec t (x, y) of the constructed target block can be obtained.

Rect(x, y)는 아래의 수식 93에 따라서 획득될 수 있다.Rec t (x, y) can be obtained according to Equation 93 below.

[수식 93][Formula 93]

Rect(x, y) = (w1·PTM_l0(x + xtm_l0, y + ytm_l0) + w2·PTM_l1(x + xtm_l1, y + ytm_l1) + w3·PInter_l0(x + xinter_l0, y + yinter_l0) + w4·PInter_l1(x + xinter_l1, y + yinter_l1)) + ResB-TM_Inter_B(x, y)Rec t (x, y) = (w 1 ·P TM_l0 (x + x tm_l0 , y + y tm_l0 ) + w 2 ·P TM_l1 (x + x tm_l1 , y + y tm_l1 ) + w 3 ·P Inter_l0 (x + x inter_l0 , y + y inter_l0 ) + w 4 ·P Inter_l1 (x + x inter_l1 , y + y inter_l1 )) + Res B-TM_Inter_B (x, y)

B 인터 및 B-TM의 블랜딩 예측의 실시예Example of blending prediction of B-Inter and B-TM

일 실시예에서, 제1 템플릿 매칭 참조 영상의 템플릿 매칭 움직임 벡터 MVtm_l0은 (5, 5)일 수 있다. 제2 템플릿 매칭 참조 영상의 템플릿 매칭 움직임 벡터 MVtm_l1은 (4, 3)일 수 있다. 제1 참조 영상의 인터 예측 움직임 벡터 MVInter_l0는 (1, 2)일 수 있다. 제2 참조 영상의 인터 예측 움직임 벡터 MVInter_l1는 (2, 3)일 수 있다. 가중치 w1은 1/4일 수 있다. 가중치 w2는 1/4일 수 있다. 가중치 w3은 1/4일 수 있다. 가중치 w4는 1/4일 수 있다.In one embodiment, the template matching motion vector MV tm_l0 of the first template matching reference image may be (5, 5). The template matching motion vector MV tm_l1 of the second template matching reference image may be (4, 3). The inter prediction motion vector MV Inter_l0 of the first reference image may be (1, 2). The inter prediction motion vector MV Inter_l1 of the second reference image may be (2, 3). Weight w 1 may be 1/4. Weight w 2 may be 1/4. Weight w 3 may be 1/4. Weight w 4 may be 1/4.

이러한 경우, 아래의 수식 94에 따라서, 대상 블록의 신호 Ot(x, y)가 예측될 수 있다.In this case, the signal O t (x, y) of the target block can be predicted according to Equation 94 below.

[수식 94][Formula 94]

ResTM_Inter_B(x, y) = Ot(x, y) - (PTM_l0(x + 5, y + 5) + PTM_l1(x + 4, y + 3) + PInter_l0(x + 1, y + 2) + PInter_l1(x + 2, y + 3) + offset) >> 2Res TM_Inter_B (x, y) = O t (x, y) - (P TM_l0 (x + 5, y + 5) + P TM_l1 (x + 4, y + 3) + P Inter_l0 (x + 1, y + 2) + P Inter_l1 (x + 2, y + 3) + offset) >> 2

대상 블록의 예측 신호는 아래의 수식 95와 같을 수 있다.The prediction signal of the target block may be as shown in Equation 95 below.

[수식 95][Formula 95]

(PTM_l0(x + 5, y + 5) + PTM_l1(x + 4, y + 3) + PInter_l0(x + 1, y + 2) + PInter_l1(x + 2, y + 3) + offset) >> 2(P TM_l0 (x + 5, y + 5) + P TM_l1 (x + 4, y + 3) + P Inter_l0 (x + 1, y + 2) + P Inter_l1 (x + 2, y + 3) + offset ) >> 2

ResB-TM_Inter_B(x, y)는 대상 블록의 예측 신호 및 대상 블록 간의 차이(즉, 잔차 신호)일 수 있다.Res B-TM_Inter_B (x, y) may be the difference (i.e., residual signal) between the prediction signal of the target block and the target block.

offset는 반올림을 위한 값일 수 있다. 예를 들면, 10 비트 영상에 대한 부호화/복호화가 수행되는 경우 offset는 512일 수 있다. 예를 들면, 8 비트 영상에 대한 부호화/복호화가 수행되는 경우 offset는 128일 수 있다. 반올림이 적용되지 않는 경우 offset는 0일 수 있다.offset may be a value for rounding. For example, when encoding/decoding is performed on a 10-bit image, the offset may be 512. For example, when encoding/decoding is performed on an 8-bit video, the offset may be 128. If rounding is not applied, offset can be 0.

대상 블록의 잔차 신호 ResB-TM_Inter_B(x, y)가 부호화/복호화/시그널링될 수 있다.The residual signal Res B-TM_Inter_B (x, y) of the target block may be encoded/decoded/signaled.

ResB-TM_Inter_B(x, y)가 주어지면, 재구축된 대상 블록의 Rect(x, y)는 아래의 수식 96에 따라서 획득될 수 있다.Given Res B-TM_Inter_B (x, y), Rec t (x, y) of the reconstructed target block can be obtained according to Equation 96 below.

[수식 96][Formula 96]

Rect(x, y) = (PTM_l0(x + 5, y + 5) + PTM_l1(x + 4, y + 3) + PInter_l0(x + 1, y + 2) + PInter_l1(x + 2, y + 3) + offset) >> 2 + ResB-TM_Inter_B(x, y)Rec t (x, y) = (P TM_l0 (x + 5, y + 5) + P TM_l1 (x + 4, y + 3) + P Inter_l0 (x + 1, y + 2) + P Inter_l1 (x + 2, y + 3) + offset) >> 2 + Res B-TM_Inter_B (x, y)

B 인터 및 B-TM의 블랜딩에서의 템플릿 매칭 참조 영상의 추론Inference of template matching reference images in blending of B-inter and B-TM

제1 인터 예측 참조 영상이 구성되면, 제1 인터 예측 참조 영상으로부터 제1 템플릿 매칭 참조 영상이 추론될 수 있다.When the first inter prediction reference image is constructed, the first template matching reference image can be inferred from the first inter prediction reference image.

제2 인터 예측 참조 영상이 구성되면, 제2 인터 예측 참조 영상으로부터 제2 템플릿 매칭 참조 영상이 추론될 수 있다.When the second inter prediction reference image is constructed, the second template matching reference image can be inferred from the second inter prediction reference image.

일 실시예에서, 대상 블록의 인터 예측을 위해 사용된 인터 예측 참조 영상 및 템플릿 매칭 참조 영상은 동일할 수 있다.In one embodiment, the inter prediction reference image and the template matching reference image used for inter prediction of the target block may be the same.

예를 들면, 대상 블록이 제1 참조 영상 리스트 내의 제1 참조 영상 및 제2 참조 영상 리스트 내의 제2 참조 영상을 이용하여 부호화/복호화된 경우, 제1 참조 영상 리스트의 제1 참조 영상이 제1 템플릿 매칭 참조 영상으로서 추론될 수 있고, 제2 참조 영상 리스트의 제2 참조 영상이 제2 템플릿 매칭 참조 영상으로서 추론될 수 있고,For example, when the target block is encoded/decoded using the first reference image in the first reference image list and the second reference image in the second reference image list, the first reference image in the first reference image list is the first reference image. may be inferred as a template matching reference image, and a second reference image in the second reference image list may be inferred as a second template matching reference image,

B 인터 및 B-TM의 블랜딩 예측에서의 시그널링Signaling in blending prediction of B-inter and B-TM

대상 블록이 B 인터 및 B-TM의 블랜딩 예측을 사용하여 부호화/복호화되었는지 여부를 지시하는 구문 요소(= b_inter_bi_template_matching_blending_mode)가 시그널링될 수 있다.A syntax element (=b_inter_bi_template_matching_blending_mode) indicating whether the target block has been encoded/decoded using blending prediction of B-inter and B-TM may be signaled.

예를 들면, b_inter_bi_template_matching_blending_mode가 제1 값인 것은, 대상 블록이 B 인터 및 B-TM의 블랜딩 예측을 사용하여 부호화/복호화되었음을 지시할 수 있다. b_inter_bi_template_matching_blending_mode가 제2 값인 것은, 대상 블록이 B 인터 및 B-TM의 블랜딩 예측을 사용하여 부호화/복호화되지 않았음을 지시할 수 있다.For example, b_inter_bi_template_matching_blending_mode being the first value may indicate that the target block has been encoded/decoded using blending prediction of B-inter and B-TM. The fact that b_inter_bi_template_matching_blending_mode is the second value may indicate that the target block has not been encoded/decoded using blending prediction of B-inter and B-TM.

템플릿 매칭 기반 부호화/복호화 방법에 대한 제안 사항Suggestions for template matching-based encoding/decoding methods

이하에서, 템플릿 매칭 기반 부호화/복호화 방법의 단계는 단계들(2010, 2020, 2030, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047 및 2048) 중 하나 이상의 단계들을 템플릿 매칭 기반 부호화/복호화 방법의 단계로 약술한다.Hereinafter, the steps of the template matching-based encoding/decoding method include one or more of the steps (2010, 2020, 2030, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047, and 2048). The steps of the decryption method are outlined.

템플릿 매칭 기반 부호화/복호화 방법의 단계의 수행이 허용되는지 여부는 코딩 정보에 기반하여 결정될 수 있다. 예를 들면, 템플릿 매칭 기반 부호화/복호화 방법의 단계의 수행이 허용되는지 여부는 대상 블록의 크기에 따라서 결정될 수 있다.Whether performance of the steps of the template matching-based encoding/decoding method is permitted may be determined based on coding information. For example, whether performance of the steps of the template matching-based encoding/decoding method is permitted may be determined depending on the size of the target block.

말하자면, 템플릿 매칭 기반 부호화/복호화 방법의 단계의 수행은 대상 블록의 크기에 따라서 허용되지 않을 수 있다.In other words, performance of the steps of the template matching-based encoding/decoding method may not be permitted depending on the size of the target block.

예를 들면, 템플릿 매칭 기반 부호화/부호화 방법은 대상 블록의 크기에 따라서 허용될 수 있고, 허용되지 않을 수 있다.For example, a template matching-based encoding/encoding method may or may not be allowed depending on the size of the target block.

대상 블록은 CTB, MB, CB, PB, TB, VPDU 및 소정 크기를 갖는 블록 중 적어도 하나일 수 있다.The target block may be at least one of CTB, MB, CB, PB, TB, VPDU, and a block of a predetermined size.

이 때, 소정 크기를 갖는 블록의 크기가 MxN이면, 템플릿 매칭 기반 부호화/복호화 방법의 단계는 대상 블록 크기가 MxN인 경우에만 수행될 수 있다. 여기서, M 및 N의 각각은 양의 정수일 수 있다.At this time, if the size of the block having the predetermined size is MxN, the steps of the template matching-based encoding/decoding method can be performed only when the target block size is MxN. Here, each of M and N may be a positive integer.

또한, 대상 블록의 크기는 부호화 장치(1600) 및 복호화 장치(1700)에서 허용되는 최대 변환 크기 및 최대 변환 블록 크기 중 적어도 하나일 수 있다.Additionally, the size of the target block may be at least one of the maximum transform size and the maximum transform block size allowed by the encoding device 1600 and the decoding device 1700.

템플릿 매칭 기반 부호화/복호화 방법의 단계가 소정 크기를 갖는 블록에서만 허용될 경우, 예측 블록은 소정 크기를 갖는 블록과 동일할 수 있으나 변환 블록은 소정 크기를 갖는 블록보다 작은 크기를 갖도록 분할된 블록일 수 있다. 이 때, 어떠한 형태의 분할이 변환 블록을 위해 적용되었는가를 나타내는 변환 블록 분할 정보가 엔트로피 부호화/복호화될 수 있다. 또한, 변환 블록 분할 정보는 코딩 블록(coding block)의 분할 정보에 의해 지시될 수 있다.If the steps of the template matching-based encoding/decoding method are allowed only in blocks with a predetermined size, the prediction block may be the same as the block with the predetermined size, but the transform block may be a block divided to have a smaller size than the block with the predetermined size. You can. At this time, transform block partition information indicating what type of partition was applied for the transform block may be entropy encoded/decoded. Additionally, transform block partition information may be indicated by partition information of a coding block.

템플릿 매칭 기반 부호화/복호화 방법의 단계가 소정 크기를 갖는 블록에서만 허용될 경우, 예측 블록은 소정 크기를 갖는 블록보다 작은 크기를 갖도록 분할된 블록일 수 있으나, 변환 블록은 소정 크기를 갖는 블록과 동일할 수 있다. 이 때, 어떠한 형태의 분할이 예측 블록을 위해 적용되었는가를 나타내는 예측 블록 분할 정보가 엔트로피 부호화/복호화될 수 있다. 또한, 예측 블록 분할 정보는 코딩 블록(coding block)의 분할 정보에 의해 지시될 수 있다.If the steps of the template matching-based encoding/decoding method are allowed only in blocks with a predetermined size, the prediction block may be a block divided to have a smaller size than the block with the predetermined size, but the transform block is the same as the block with the predetermined size. can do. At this time, prediction block division information indicating what type of division was applied for the prediction block may be entropy encoded/decoded. Additionally, prediction block partition information may be indicated by partition information of a coding block.

템플릿 매칭 기반 부호화/복호화 방법의 단계의 수행은 대상 블록의 크기가 소정의 크기보다 더 큰 경우에 허용될 수 있다.Performance of the steps of the template matching-based encoding/decoding method may be permitted when the size of the target block is larger than a predetermined size.

말하자면, 템플릿 매칭 기반 부호화/복호화 방법의 단계의 수행은 대상 블록의 크기가 소정의 크기보다 더 작은 경우에는 허용되지 않을 수 있다.In other words, performance of the steps of the template matching-based encoding/decoding method may not be permitted if the size of the target block is smaller than a predetermined size.

템플릿 매칭 기반 부호화/복호화 방법은 대상 블록의 크기가 소정의 크기보다 더 큰 경우 허용될 수 있다. 템플릿 매칭 기반 부호화/복호화 방법은 대상 블록의 크기가 소정의 크기보다 더 작은 경우 허용되지 않을 수 있다.A template matching-based encoding/decoding method can be accepted when the size of the target block is larger than a predetermined size. Template matching-based encoding/decoding methods may not be allowed if the size of the target block is smaller than a predetermined size.

대상 블록은 CTB, MB, CB, PB, TB, VPDU 및 소정 크기를 갖는 블록 중 적어도 하나일 수 있다.The target block may be at least one of CTB, MB, CB, PB, TB, VPDU, and a block of a predetermined size.

예를 들면, 소정의 크기는 최대 CTU 크기일 수 있다.For example, the predetermined size may be the maximum CTU size.

예를 들면, 소정의 크기는 "최대 CTU 크기 >> 1" (= 최대 CTU 크기 / 2"일 수 있다.For example, the predetermined size may be "maximum CTU size >> 1" (=maximum CTU size / 2".

예를 들면, 소정의 크기는 1 VPDU일 수 있다.For example, the predetermined size may be 1 VPDU.

예를 들면, 소정의 크기는 "VPDU 크기 >> 2" ( = VPDU 크기 / 4)일 수 있다.For example, the predetermined size may be “VPDU size >> 2” (=VPDU size / 4).

예를 들면, 소정의 크기는 MxN일 수 있다. M 및 N의 각각은 양의 정수일 수 있다.For example, the predetermined size may be MxN. Each of M and N may be a positive integer.

템플릿 매칭 기반 부호화/복호화 방법의 단계의 수행은 대상 블록의 크기가 소정의 크기보다 더 작은 경우에 허용될 수 있다.Performance of the steps of the template matching-based encoding/decoding method may be permitted when the size of the target block is smaller than a predetermined size.

말하자면, 템플릿 매칭 기반 부호화/복호화 방법의 단계의 수행은 대상 블록의 크기가 소정의 크기보다 더 큰 경우에는 허용되지 않을 수 있다.In other words, performance of the steps of the template matching-based encoding/decoding method may not be permitted if the size of the target block is larger than a predetermined size.

템플릿 매칭 기반 부호화/복호화 방법은 대상 블록의 크기가 소정의 크기보다 더 작은 경우 허용될 수 있다. 템플릿 매칭 기반 부호화/복호화 방법은 대상 블록의 크기가 소정의 크기보다 더 큰 경우 허용되지 않을 수 있다.The template matching-based encoding/decoding method can be accepted when the size of the target block is smaller than a predetermined size. Template matching-based encoding/decoding methods may not be allowed if the size of the target block is larger than a predetermined size.

대상 블록은 CTB, MB, CB, PB, TB, VPDU 및 소정 크기를 갖는 블록 중 적어도 하나일 수 있다.The target block may be at least one of CTB, MB, CB, PB, TB, VPDU, and a block of a predetermined size.

예를 들면, 소정의 크기는 최대 CTU 크기일 수 있다.For example, the predetermined size may be the maximum CTU size.

예를 들면, 소정의 크기는 "최대 CTU 크기 >> 1" (= 최대 CTU 크기 / 2"일 수 있다.For example, the predetermined size may be "maximum CTU size >> 1" (=maximum CTU size / 2".

예를 들면, 소정의 크기는 1 VPDU일 수 있다.For example, the predetermined size may be 1 VPDU.

예를 들면, 소정의 크기는 "VPDU 크기 >> 2" ( = VPDU 크기 / 4)일 수 있다.For example, the predetermined size may be “VPDU size >> 2” (=VPDU size / 4).

예를 들면, 상기 소정의 크기는 MxN일 수 있다. M 및 N의 각각은 양의 정수일 수 있다.For example, the predetermined size may be MxN. Each of M and N may be a positive integer.

템플릿 매칭 기반 부호화/복호화 방법의 단계의 수행이 허용되는지 여부는 대상 블록의 주변 블록의 코딩 모드에 따라 결정될 수 있다. 코딩 모드는 예측 모드를 포함할 수 있다. 코딩 모드는 코딩 정보를 포함할 수 있다.Whether performance of the steps of the template matching-based encoding/decoding method is permitted may be determined depending on the coding mode of the block surrounding the target block. Coding mode may include prediction mode. Coding mode may include coding information.

말하자면, 템플릿 매칭 기반 부호화/복호화 방법의 단계의 수행은 주변 블록의 코딩 모드에 따라서 허용될 수 있다. 템플릿 매칭 기반 부호화/복호화 방법의 단계의 수행은 주변 블록의 코딩 모드에 따라서 허용되지 않을 수 있다.In other words, performance of the steps of the template matching-based encoding/decoding method may be permitted depending on the coding mode of the surrounding block. Performance of the steps of the template matching-based encoding/decoding method may not be permitted depending on the coding mode of the neighboring block.

템플릿 매칭 기반 부호화/복호화 방법은 대상 블록의 주변 블록의 코딩 모드에 따라서 허용될 수 있다. 템플릿 매칭 기반 부호화/복호화 방법은 주변 블록의 부호화 모드에 따라 허용되지 않을 수 있다.A template matching-based encoding/decoding method may be allowed depending on the coding mode of the block surrounding the target block. Template matching-based encoding/decoding methods may not be allowed depending on the encoding mode of the surrounding block.

주변 블록은 CTB, MB, CB, PB, TB, VPDU 및 소정 크기를 갖는 블록 중 적어도 하나일 수 있다.The surrounding block may be at least one of CTB, MB, CB, PB, TB, VPDU, and a block of a predetermined size.

일 실시예에서, 템플릿 매칭 기반 부호화/복호화 방법의 단계의 수행은 대상 블록의 템플릿 내에 포함된 블록이 인트라 예측을 사용하여 부호화/복호화된 경우에만 허용될 수 있다.In one embodiment, performance of the steps of the template matching-based encoding/decoding method may be permitted only when a block included in the template of the target block has been encoded/decoded using intra prediction.

템플릿 매칭 기반 부호화/복호화 방법의 단계의 수행은 대상 블록의 템플릿 내에 포함된 블록이 인트라 예측을 사용하여 부호화/복호화되지 않은 경우 허용되지 않을 수 있다.Performance of the steps of the template matching-based encoding/decoding method may not be permitted if the block included in the template of the target block is not encoded/decoded using intra prediction.

템플릿 매칭 기반 부호화/복호화 방법은 대상 블록의 템플릿 내에 포함된 블록이 인트라 예측을 사용하여 부호화/복호화된 경우 허용될 수 있다.A template matching-based encoding/decoding method can be accepted when a block included in the template of the target block is encoded/decoded using intra prediction.

템플릿 매칭 기반 부호화/복호화 방법은 대상 블록의 템플릿 내에 포함된 블록이 인트라 예측을 사용하여 부호화/복호화되지 않은 경우 허용되지 않을 수 있다.Template matching-based encoding/decoding methods may not be allowed if blocks included in the template of the target block are not encoded/decoded using intra prediction.

예를 들면, 템플릿 매칭 기반 부호화/복호화 방법의 단계에서, 대상 블록의 템플릿 내에 포함된 블록이 인트라 예측을 사용하여 부호화/복호화되지 않은 경우, 대상 블록의 템플릿을 구성함에 있어서 인트라 예측을 사용하여 부호화/복호화되지 않은 픽셀은 제외될 수 있다.For example, in the step of the template matching-based encoding/decoding method, if a block included in the template of the target block is not encoded/decoded using intra prediction, encoding is performed using intra prediction when constructing the template of the target block. /Undecoded pixels may be excluded.

일 실시예에서, 템플릿 매칭 기반 부호화/복호화 방법의 단계의 수행은 대상 블록의 템플릿 내에 포함된 블록이 인터 예측을 사용하여 부호화/복호화된 경우에만 허용될 수 있다.In one embodiment, performance of the steps of the template matching-based encoding/decoding method may be permitted only when a block included in the template of the target block has been encoded/decoded using inter prediction.

템플릿 매칭 기반 부호화/복호화 방법의 단계의 수행은 대상 블록의 템플릿 내에 포함된 블록이 인터 예측을 사용하여 부호화/복호화되지 않은 경우 허용되지 않을 수 있다.Performance of the steps of the template matching-based encoding/decoding method may not be permitted if the block included in the template of the target block is not encoded/decoded using inter prediction.

템플릿 매칭 기반 부호화/복호화 방법은 대상 블록의 템플릿 내에 포함된 블록이 인터 예측을 사용하여 부호화/복호화된 경우 허용될 수 있다.The template matching-based encoding/decoding method can be allowed when a block included in the template of the target block is encoded/decoded using inter prediction.

템플릿 매칭 기반 부호화/복호화 방법은 대상 블록의 템플릿 내에 포함된 블록이 인터 예측을 사용하여 부호화/복호화되지 않은 경우 허용되지 않을 수 있다.Template matching-based encoding/decoding methods may not be allowed if blocks included in the template of the target block are not encoded/decoded using inter prediction.

예를 들면, 템플릿 매칭 기반 부호화/복호화 방법의 단계에서, 대상 블록의 템플릿 내에 포함된 블록이 인터 예측을 사용하여 부호화/복호화되지 않은 경우, 대상 블록의 템플릿을 구성함에 있어서 인터 예측을 사용하여 부호화/복호화되지 않은 픽셀은 제외될 수 있다.For example, in the step of the template matching-based encoding/decoding method, if a block included in the template of the target block is not encoded/decoded using inter prediction, it is encoded using inter prediction when constructing the template of the target block. /Undecoded pixels may be excluded.

일 실시예에서, 템플릿 매칭 기반 부호화/복호화 방법의 단계의 수행은 대상 블록의 템플릿 내에 포함된 블록이 인트라 블록 카피(Intra Block Copy; IBC) 모드를 사용하여 부호화/복호화된 경우에만 허용될 수 있다.In one embodiment, performance of the steps of the template matching-based encoding/decoding method may be permitted only when the block included in the template of the target block has been encoded/decoded using the intra block copy (IBC) mode. .

템플릿 매칭 기반 부호화/복호화 방법의 단계의 수행은 대상 블록의 템플릿 내에 포함된 블록이 IBC 모드를 사용하여 부호화/복호화되지 않은 경우 허용되지 않을 수 있다.Performance of the steps of the template matching-based encoding/decoding method may not be permitted if the block included in the template of the target block is not encoded/decoded using the IBC mode.

템플릿 매칭 기반 부호화/복호화 방법은 대상 블록의 템플릿 내에 포함된 블록이 IBC 모드를 사용하여 부호화/복호화된 경우 허용될 수 있다.The template matching-based encoding/decoding method can be allowed if the block included in the template of the target block is encoded/decoded using IBC mode.

템플릿 매칭 기반 부호화/복호화 방법은 대상 블록의 템플릿 내에 포함된 블록이 IBC 모드를 사용하여 부호화/복호화되지 않은 경우 허용되지 않을 수 있다.Template matching-based encoding/decoding methods may not be allowed if blocks included in the template of the target block are not encoded/decoded using IBC mode.

예를 들면, 템플릿 매칭 기반 부호화/복호화 방법의 단계에서, 대상 블록의 템플릿 내에 포함된 블록이 IBC 모드를 사용하여 부호화/복호화되지 않은 경우, 대상 블록의 템플릿을 구성함에 있어서 IBC 모드를 사용하여 부호화/복호화되지 않은 픽셀은 제외될 수 있다.For example, in the step of the template matching-based encoding/decoding method, if the block included in the template of the target block is not encoded/decoded using the IBC mode, the IBC mode is used to construct the template of the target block. /Undecoded pixels may be excluded.

전술된 실시예들 중 2 개 이상이 조합될 수 있다. 여기에서 조합은 인터 예측, 인트라 예측 및 IBC 모드 중 2 개 이상의 조합을 포함할 수 있다.Two or more of the above-described embodiments may be combined. Here, the combination may include a combination of two or more of inter prediction, intra prediction, and IBC modes.

일 실시예에서, 템플릿 매칭 기반 부호화/복호화 방법의 단계의 수행은 대상 블록의 템플릿 내에 포함된 블록이 인트라 예측 및 IBC 모드 중 하나를 사용하여 부호화/복호화된 경우에만 허용될 수 있다.In one embodiment, performance of the steps of the template matching-based encoding/decoding method may be permitted only when the block included in the template of the target block has been encoded/decoded using one of intra prediction and IBC modes.

템플릿 매칭 기반 부호화/복호화 방법의 단계의 수행은 대상 블록의 템플릿 내에 포함된 블록이 인트라 예측 및 IBC 모드 중 하나 중 하나를 사용하여 부호화/복호화되지 않은 경우 허용되지 않을 수 있다.Performance of the steps of the template matching-based encoding/decoding method may not be permitted if the block included in the template of the target block has not been encoded/decoded using one of the intra prediction and IBC modes.

템플릿 매칭 기반 부호화/복호화 방법은 대상 블록의 템플릿 내에 포함된 블록이 인트라 예측 및 IBC 모드 중 하나를 사용하여 부호화/복호화된 경우 허용될 수 있다.A template matching-based encoding/decoding method may be allowed if a block included in the template of the target block is encoded/decoded using one of intra prediction and IBC modes.

템플릿 매칭 기반 부호화/복호화 방법은 대상 블록의 템플릿 내에 포함된 블록이 인트라 예측 및 IBC 모드 중 하나를 사용하여 부호화/복호화되지 않은 경우 허용되지 않을 수 있다.Template matching-based encoding/decoding methods may not be allowed if blocks included in the template of the target block are not encoded/decoded using one of intra prediction and IBC modes.

예를 들면, 템플릿 매칭 기반 부호화/복호화 방법의 단계에서, 대상 블록의 템플릿 내에 포함된 블록이 인트라 예측 및 IBC 모드 중 하나를 사용하여 부호화/복호화되지 않은 경우, 대상 블록의 템플릿을 구성함에 있어서 인트라 예측 및 IBC 모드 중 하나를 사용하여 부호화/복호화되지 않은 픽셀은 제외될 수 있다.For example, in the step of the template matching-based encoding/decoding method, if a block included in the template of the target block is not encoded/decoded using one of the intra prediction and IBC modes, the intra prediction and IBC modes are not used to configure the template of the target block. Pixels that are not encoded/decoded using either prediction or IBC modes may be excluded.

실시예의 서브샘플링Subsampling of Examples

실시예들에서, 서브샘플링을 사용하여 템플릿이 생성된다는 것은 대상 블록의 주변 픽셀들 중 적어도 하나의 픽셀을 사용하여 템플릿이 구성된다는 것을 의미할 수 있다.In embodiments, generating a template using subsampling may mean that the template is constructed using at least one pixel among surrounding pixels of the target block.

실시예들에서, 서브샘플링에 의해 템플릿이 생성될 때, 대상 블록의 주변 픽셀에 대해 필터가 적용될 수 있다. 필터가 적용된 주변 픽셀을 사용하여 템플릿이 구성될 수 있다.In embodiments, when a template is created by subsampling, a filter may be applied to surrounding pixels of the target block. A template can be constructed using surrounding pixels with a filter applied.

예를 들면, 1/2 배의 서브샘플링이 적용될 때, 주변 픽셀들의 쌍(pair)에 대하여 바이리니어(bilinear) 필터를 적용함으로써 하나의 필터된 값이 획득될 수 있다. 필터된 값을 사용하여 템플릿이 구성될 수 있다.For example, when 1/2 times subsampling is applied, one filtered value can be obtained by applying a bilinear filter to a pair of surrounding pixels. A template can be constructed using the filtered values.

예를 들면, 실시예들에서 설명된 2 개 값들에 바이리니어 필터를 적용함으로써 1 개의 값이 획득될 수 있다. 획득된 값이 템플릿에 포함될 수 있다.For example, one value can be obtained by applying a bilinear filter to the two values described in the embodiments. The obtained value may be included in the template.

복수의 템플릿 타입Multiple template types

실시예들의 템플릿은 복수일 수 있다. 복수의 템플릿들은 L-형태 템플릿, 좌측 템플릿 및 상측 템플릿을 포함할 수 있다. 말하자면, 좌측 템플릿만을 사용하는 탬플릿 매칭이 수행될 수 있다. 상측 템플릿만을 사용하는 템플릿 매칭이 수행될 수 있다.There may be multiple templates in the embodiments. The plurality of templates may include an L-shaped template, a left template, and an upper template. That is, template matching can be performed using only the left template. Template matching can be performed using only the upper template.

실시예들의 템플릿 매칭에 있어서 복수의 모드들이 사용될 수 있다. 복수의 모드들은 1) 후보들을 도출하기 위해 좌측 템플릿만을 사용하는 템플릿 매칭 모드, 2) 후보들을 도출하기 위해 상단 템플릿만을 사용하는 템플릿 매칭 모드 및 3) 선형 조합을 사용하여 복수의 후보들을 합성하는 템플릿 매칭 모드를 포함할 수 있다.Multiple modes may be used in template matching in embodiments. The plurality of modes are 1) a template matching mode that uses only the left template to derive candidates, 2) a template matching mode that uses only the top template to derive candidates, and 3) a template that synthesizes multiple candidates using linear combination. May include matching mode.

복수의 템플릿들의 각 템플릿에 대하여, 실시예의 템플릿 매칭을 사용하여 복수의 후보들이 도출될 수 있다. 예를 들면, SAD 비용에 따라서 선택된 4 개의 최적 후보들이 도출될 수 있다.For each template of the plurality of templates, a plurality of candidates may be derived using the template matching of the embodiment. For example, four optimal candidates selected according to SAD cost can be derived.

말하자면, 복수의 템플릿 타입들에 대하여 복수의 후보들이 유도될 수 있다.That is, multiple candidates can be derived for multiple template types.

후보의 선택을 위해서는 템플릿 타입 및 후보의 인덱스가 시그널링되어야 할 수 있다. 템플릿 타입은 복수의 템플릿들 중 템플릿 매칭을 위해 사용되는 템플릿을 가리킬 수 있다.To select a candidate, the template type and the index of the candidate may need to be signaled. The template type may indicate a template used for template matching among a plurality of templates.

선택된 후보를 시그널링하기 위해, 템플릿의 타입을 나타내는 플래그가 시그널링될 수 있다. 다음으로, 후보의 인덱스가 시그널링될 수 있다.To signal the selected candidate, a flag indicating the type of template may be signaled. Next, the candidate's index may be signaled.

템플릿의 타입을 나타내는 플래그 및 후보의 인덱스를 통해 템플릿이 특정될 수 있다.A template can be specified through a flag indicating the type of the template and an index of the candidate.

일 실시예에서, 복수의 후보들이 조합될 수 있다. 조합을 위한 복수의 후보들에 대한 가중치들은, 1) 복수의 후보들의 템플릿 매칭 비용들에 의해 유도될 수 있고, 2) 크로스-컴퍼넌트 콘볼루셔널 모델(Cross-Component Convolutional Model; CCCM)에서의 MSE 최소화의 유도 방법을 사용하여 유도될 수 있다.In one embodiment, multiple candidates may be combined. Weights for multiple candidates for combination may be: 1) derived by the template matching costs of the multiple candidates, and 2) MSE minimization in a Cross-Component Convolutional Model (CCCM) It can be derived using the derivation method of

융합될 후보들은 최적의 복수의 L-형태의 후보들일 수 있다. 복수의 L-형태의 후보들은 2 개 또는 5 개일 수 있다. 융합될 후보들의 개수를 나타내는 플래그가 시그널링될 수 있다. 플래그는 2 및 5 중 하나를 가리킬 수 있다.Candidates to be fused may be candidates of an optimal plurality of L-forms. The plurality of L-form candidates can be 2 or 5. A flag indicating the number of candidates to be fused may be signaled. The flag can point to either 2 or 5.

후보에 대한 시그널링Signaling for Candidates

템플릿 매칭을 위해 사용되는 템플릿을 특정하기 위해 후보 리스트가 사용될 수 있다. 후보 리스트 내에서 후보 BV들은 후보 BV들의 템플릿 매칭 비용들의 오름차순으로 소트될 수 있다.A candidate list can be used to specify the template used for template matching. Candidate BVs within the candidate list may be sorted in ascending order of template matching costs of the candidate BVs.

블록 벡터(Block Vector; BV)는 인트라 템플릿 매칭 예측(Intra Template matching prediction; IntraTMP)에서 사용되는 움직임 벡터를 의미할 수 있다.A block vector (BV) may refer to a motion vector used in intra template matching prediction (IntraTMP).

IntraTMP는 대상 영상 내의 매칭 블록(또는, 매치된 블록)의 특정 값들을 복사함으로써 대상 블록의 예측 값들을 생성할 수 있다. 예를 들면, 특정 값들은 재구축된 값들일 수 있다. 여기에서, 매칭 블록의 매칭은 실시예들의 템플릿 매칭에 의해 결정될 수 있다. 템플릿 매칭은 대상 블록의 L-형태의 템플릿에 기반하여 수행될 수 있다.IntraTMP can generate prediction values of the target block by copying specific values of the matching block (or matched block) in the target image. For example, certain values may be reconstructed values. Here, the matching of the matching block may be determined by template matching in the embodiments. Template matching can be performed based on the L-shaped template of the target block.

후보 리스트의 후보 BV들 중 어떤 후보 BV가 대상 블록을 위해 실제로 사용되는지를 나타내기 위해 비트스트림 내에서 인덱스가 시그널링될 수 있다. 이러한 방법은 템플릿 매칭을 사용하여 다수의 가용한 BV들 중에서 유망한 후보들의 최종 후보 리스트를 선택할 수 있다. 이러한 방법은 부호화 장치(1600)는 원래의 대상 블록에 접근하여 최종적인 BM를 후보로서 선택할 수 있게 한다.An index may be signaled within the bitstream to indicate which candidate BV among the candidate BVs in the candidate list is actually used for the target block. This method can use template matching to select a shortlist of promising candidates from a number of available BVs. This method allows the encoding device 1600 to access the original target block and select the final BM as a candidate.

크기가 N인 후보 리스트를 구축하기 위해 희소(sparse) 검색과 정제(refinement) 검색이 수행될 수 있다. 먼저, 희소 검색에서는 서브샘플링 팩터가 특정 값으로 설정될 수 있다. 특정 값은 2 또는 3일 수 있다. 희소 검색에서는 가장 작은 템플릿 매칭 비용들을 갖는 상위의 2N 개의 BV들이 유지될 수 있다. 다음으로, 정제 탐색에서는 2N 개의 BV들의 각 BV에 대하여, BV의 주변의 3×3 블록들이 각각 체크될 수 있다. 이러한 체크에 따라, 상위 N 개의 BV들이 후보 리스트를 구성하도록 선택될 수 있다. 예를 들면, N은 15 또는 19일 수 있다.Sparse search and refinement search can be performed to build a candidate list of size N. First, in sparse search, the subsampling factor can be set to a specific value. The specific value can be 2 or 3. In sparse search, the top 2N BVs with the smallest template matching costs can be maintained. Next, in refinement search, for each BV of 2N BVs, 3×3 blocks surrounding the BV can be checked. According to this check, the top N BVs can be selected to form the candidate list. For example, N may be 15 or 19.

도 68은 일 예에 따른 템플릿 매칭을 위한 신택스를 나타낸다.Figure 68 shows syntax for template matching according to an example.

intra_tmp_flag는 대상 블록에 대한 인트라 예측 타입이 IntraTMP인지 여부를 지시한다. IntraTMP는 실시예들에서 설명된 대상 픽처 내에서 탬플릿 매칭 최적 블록을 도출하는 방법일 수 있다.intra_tmp_flag indicates whether the intra prediction type for the target block is IntraTMP. IntraTMP may be a method of deriving an optimal template matching block within the target picture described in the embodiments.

intra_tmp_flag의 값이 1인 것은 대상 블록이 IntraTMP를 사용한다는 것을 가리킬 수 있다.A value of intra_tmp_flag of 1 may indicate that the target block uses IntraTMP.

intra_tmp_fusion_flag는 대상 블록에 대해서 합성이 사용되는지 여부를 지시할 수 있다.intra_tmp_fusion_flag can indicate whether fusion is used for the target block.

intra_tmp_fusion_idx는 IntraTMP 합성을 위해 사용되는 후보들의 집합을 명세할 수 있다.intra_tmp_fusion_idx는 0 이상 2 이하의 정수일 수 있다. intra_tmp_fusion_idx는 3 개의 집합들 중 하나를 가리키기 위해 사용될 수 있다. 3 개의 집합들은 {BV0 to BV4}, {BV5 to BV9} 및 {BV10 to BV14}일 수 있다.intra_tmp_fusion_idx can specify a set of candidates used for IntraTMP synthesis. intra_tmp_fusion_idx can be an integer between 0 and 2. intra_tmp_fusion_idx can be used to indicate one of three sets. The three sets can be {BV0 to BV4}, {BV5 to BV9}, and {BV10 to BV14}.

intra_tmp_fusion_weight_type는 SAD 기반 가중치 유도 방법 또는 와이너(Wiener)-필터 기반 유도 방법이 사용되는지 여부를 가리킬 수 있다.intra_tmp_fusion_weight_type may indicate whether a SAD-based weight derivation method or a Wiener-filter-based derivation method is used.

intra_tmp_idx는 후보 리스트 내의 BV들 중 대상 블록을 위해 (실제로) 사용되는 BV를 명세할 수 있다. intra_tmp_idx는 0 이상 18 이하의 정수일 수 있다. L-형태의 템플릿, 상측 템플릿 및 좌측 템플릿으로부터 유도된 후보들은 동일한 후보 리스트 내에 포함될 수 있다.intra_tmp_idx can specify the BV that is (actually) used for the target block among the BVs in the candidate list. intra_tmp_idx can be an integer between 0 and 18. Candidates derived from the L-shaped template, upper template, and left template may be included in the same candidate list.

말하자면, intra_tmp_idx를 통해 복수의 템플릿들에 의해 유도된 후보들 중 하나의 후보가 선택될 수 있다.In other words, one candidate among candidates derived by a plurality of templates can be selected through intra_tmp_idx.

intra_tmp_sub_pel_precision_idx는 대상 블록에 대한 정밀도 인덱스(precision index)를 명세할 수 있다. intra_tmp_sub_pel_precision_idx는 0 이상 3 이하의 정수일 수 있다. 값 0은 정수-펠(pel) 정밀도를 가리킬 수 있다. 값 1은 1/2-펠 정밀도를 가리킬 수 있다. 값 2는 1/4-펠 정밀도를 가리킬 수 있다. 값 3은 3/4-펠 정밀도를 가리킬 수 있다.intra_tmp_sub_pel_precision_idx can specify the precision index for the target block. intra_tmp_sub_pel_precision_idx may be an integer between 0 and 3. A value of 0 may indicate integer-pel precision. A value of 1 may indicate 1/2-pel precision. A value of 2 may indicate 1/4-pel precision. A value of 3 may indicate 3/4-pel precision.

intra_tmp_sub_pel_direction_idx는 대상 블록에 대한 서브-펠 방향 인덱스를 명세할 수 있다. intra_tmp_sub_pel_direction_idx은 0 이상 7 이하의 정수일 수 있다.intra_tmp_sub_pel_direction_idx can specify the sub-pel direction index for the target block. intra_tmp_sub_pel_direction_idx can be an integer between 0 and 7.

인트라 템플릿 매칭 예측 합성Intra-template matching prediction synthesis

아래와 같은 특징을 포함하는 인트라 템플릿 매칭 예측 합성이 사용될 수 있다.Intra template matching prediction synthesis including the following features can be used.

1) IntraTMP 탐색 동안의 복수의 매치된 블록들의 생성1) Generation of multiple matched blocks during IntraTMP search

서브샘플된 IntraTMP 탐색 프로세스가 수행되는 동안, 후보 리스트가 초기적으로 생성될 수 있다. 후보 리스트는 가장 작은 템플릿 SAD를 갖는 30 개의 매치된 블록들을 나타낼 수 있다.While the subsampled IntraTMP search process is performed, a candidate list may be initially created. The candidate list may represent the 30 matched blocks with the smallest template SAD.

30 개의 매치된 블록들의 각각에 대하여, 풀 픽셀 개선(refinement) 탐색이 작은 범위 내에서 수행될 수 있다. 서브샘플된 탐색 프로세서의 샘플링 팩터는 3일 수 있다. 개선 영역은 30 개의 매치된 블록들의 각각의 주변의 3×3 블록일 수 있다.For each of the 30 matched blocks, a full pixel refinement search can be performed within a small range. The sampling factor of the subsampled search processor may be 3. The improvement area may be a 3×3 block around each of the 30 matched blocks.

다음으로, 모든 개선 영역들에 걸쳐(around) 템플릿 SAD에 의해 측정된 최적의 3 개의 후보 매치된 블록이 선택될 수 있다.Next, the optimal three candidate matched blocks as measured by the template SAD around all improvement areas can be selected.

2) 합성을 위한 후보 매치된 블록들의 선택2) Selection of candidate matched blocks for synthesis

최적의 3 개의 후보 매치된 블록들의 각각에 대하여, 아래의 수식 97과 같이, 임계치가 후보 매치된 블록이 합성을 위해 사용되는지 여부를 판단하기 위해 사용될 수 있다.For each of the three optimal candidate matched blocks, a threshold can be used to determine whether the candidate matched block is used for synthesis, as shown in Equation 97 below.

[수식 97][Formula 97]

Threshold = SAD1 << 1Threshold = SAD 1 << 1

여기에서, SAD1은 3 개의 후보 매치된 블록들의 최소 템플릿 SAD일 수 있다. 후보 매치된 블록의 SAD가 Threshold의 이하이면, 후보 매치된 블록은 합성을 위해 사용될 수 있다. 따라서, 후보 매치된 블록들의 개수가 결정될 수 있다.Here, SAD 1 may be the minimum template SAD of 3 candidate matched blocks. If the SAD of the candidate matched block is less than or equal to the Threshold, the candidate matched block can be used for synthesis. Accordingly, the number of candidate matched blocks can be determined.

3) 선택된 매치된 블록들의 각각의 합성 가중치의 계산3) Calculation of each composite weight of selected matched blocks

블록들이 합성되기로 결정되면, 블록들은 합성 가중치들을 갖고 합성될 수 있다. 합성 가중치들은 블록들의 SAD에 의해 계산될 수 있다. 합성 가중치들은 아래의 수식 98 및 수식 99와 같이 계산될 수 있다.Once the blocks are determined to be composited, the blocks can be composited with composite weights. Composite weights can be calculated by the SAD of the blocks. Composite weights can be calculated as Equation 98 and Equation 99 below.

[수식 98][Formula 98]

Figure pat00011
Figure pat00011

[수식 99][Formula 99]

Figure pat00012
Figure pat00012

구현 비용을 감소시키기 위해, 나눗셈 연산자들은 정수 룩-업 테이블(Look-Up Table: LUT)로 대체될 수 있다.To reduce implementation cost, division operators can be replaced with an integer look-up table (LUT).

4) 최종적인 합성된 예측자는 아래의 수식 100에 따라서 결정될 수 있다. 예측자는 예측 블록일 수 있다.4) The final synthesized predictor can be determined according to Equation 100 below. A predictor may be a prediction block.

[수식 100][Formula 100]

Figure pat00013
Figure pat00013

여기에서, pi는 i 번째 매치된 블록일 수 있다. n은 합성에 의해 선택된 블록들의 개수일 수 있다.Here, p i may be the i-th matched block. n may be the number of blocks selected by synthesis.

앞서 설명된 2)의 단계에서, 오직 하나의 매치된 블록만이 남은 경우, 최종적인 예측자는 아래의 수식 101에 따라서 계산될 수 있다.In step 2) described above, if only one matched block remains, the final predictor can be calculated according to Equation 101 below.

[수식 101][Formula 101]

Figure pat00014
Figure pat00014

Ptmp는 하나의 매치된 블록일 수 있다. Pintra는 플래너 모드에 의해 유도된 예측자일 수 있다. w1 및 w2는 가중치들일 수 있다. 예를 들면, w1는 7/8일 수 있다. w2는 1/8일 수 있다.P tmp may be one matched block. P intra may be a predictor derived by planner mode. w 1 and w 2 may be weights. For example, w 1 may be 7/8. w 2 may be 1/8.

전술된 합성 방법 또는 기존의 방법 중 어떤 방법으로 대상 블록이 예측되는가를 나타내기 위해 대상 블록에 대한 플래그가 시그널링될 수 있다. 대상 블록은 CU일 수 있다.A flag for the target block may be signaled to indicate whether the target block is predicted using the above-described synthesis method or the existing method. The target block may be a CU.

IntraTMP에서의 서브-펠(sub-pel) 정밀도의 사용Use of sub-pel precision in IntraTMP

도 69는 일 예에 따른 8 개 방향으로의 인접한 하프-펠 위치들을 나타낸다.Figure 69 shows adjacent half-pel positions in eight directions according to one example.

도 70은 일 예에 따른 정밀도 인덱스의 제1 이진화를 나타낸다.Figure 70 shows a first binarization of a precision index according to an example.

도 71은 일 예에 따른 정밀도 인덱스의 제2 이진화를 나타낸다.Figure 71 shows a second binarization of a precision index according to an example.

도 69에서 도시된 것과같이, IntraTMP에서 복수의 서브-펠 정밀도들이 사용될 수 있다. 복수의 서브-펠 정밀도들은 3 개일 수 있다. 복수의 서브-펠 정밀도들은 하프-펠, 쿼터-펠 및 3-퀘터-펠을 포함할 수 있다. 정수-펠 위치의 주변으로 8 개의 방향들이 지원될 수 있다. 즉, 정수-펠 위치들 중심으로 갖는 8 개의 방향들의 각 방향으로의, 쿼터-펠 위치, 하프-펠 위치, 3-퀘터-펠 위치 및 정수-펠 위치가 사용될 수 있다.As shown in Figure 69, multiple sub-pel precisions may be used in IntraTMP. The plurality of sub-pel precisions may be three. The plurality of sub-pel precisions may include half-pel, quarter-pel, and 3-quarter-pel. Eight directions around the integer-pel position can be supported. That is, a quarter-pel position, a half-pel position, a 3-quarter-pel position, and an integer-pel position in each of the eight directions with the integer-pel positions as the center can be used.

8 개의 방향들은 각 대상 블록에 대한 하프-펠 정밀도를 갖는 템플릿 비용에 의해 소트될 수 있다. 대상 블록은 CU일 수 있다. 8 개의 방향들 중 가장 낮은 템플릿 비용들을 갖는 4 개의 방향들이 각 서브-펠 정밀도를 위해 사용될 수 있다.The eight directions can be sorted by template cost with half-pel precision for each target block. The target block may be a CU. Among the eight directions, four directions with the lowest template costs can be used for each sub-pel precision.

만약, IntraTMP 모드가 대상 블록에 대하여 선택된 경우, 정수-펠 및 3 개의 서브-펠 정밀도들 중 어느 것이 사용되는가를 지시하기 위해 정밀도 인덱스가 시그널링될 수 있다. 도 70은 정밀도 인덱스의 시그널링을 나타낼 수 있다.If IntraTMP mode is selected for the target block, a precision index may be signaled to indicate which of the integer-pel and three sub-pel precisions is used. Figure 70 may illustrate signaling of precision index.

만약, 3 개의 서브-펠 정밀도들 중 하나가 사용되면, 4 개의 방향들 중 어떤 것이 사용되는가를 나타내기 위해 방향 인덱스가 시그널링될 수 있다. 도 71은 정밀도 인덱스의 시그널링을 나타낼 수 있다.If one of the three sub-pel precisions is used, a direction index may be signaled to indicate which of the four directions is used. Figure 71 may illustrate signaling of a precision index.

4-탭 이산 코사인 변환-보간 필터(Discrete Cosine Transform-Interpolation Filter; DCT-IF)가 IntraTMP 내에서의 서브-펠 보간을 위해 사용될 수 있다.A 4-tap Discrete Cosine Transform-Interpolation Filter (DCT-IF) can be used for sub-pel interpolation within IntraTMP.

선형 필터를 사용하는 템플릿 매칭Template matching using linear filters

도 72는 일 예에 따른 필터의 공간적 부분을 나타낸다.Figure 72 shows the spatial portion of a filter according to one example.

도 73은 일 예에 따른 필터 계수들을 유도하기 위해 사용되는 탐색 영역들을 나타낸다.Figure 73 shows search areas used to derive filter coefficients according to an example.

IntraTMP의 예측에 대하여 선형 필터 모델이 적용될 수 있다.A linear filter model can be applied to the prediction of IntraTMP.

일 실시예에서, 필터는 6 탭일 수 있다. 필터는 5-탭 구성요소(component)를 포함할 수 있다. 5-탭 구성요소는 5-탭 플러스 기호(plus sign) 형태를 갖는 공간적(spatial) 구성 요소일 수 있다. 필터는 바이어스 항(bias term)을 포함할 수 있다.In one embodiment, the filter may be 6 taps. The filter may contain a 5-tab component. The 5-tap component may be a spatial component that has the form of a 5-tap plus sign. The filter may include a bias term.

필터의 공간적 5-탭 구성요소로의 입력은, 참조 블록 내의 중심 샘플 C, 중심 샘플의 위의/북쪽의 이웃 샘플 N, 중심 샘플의 아래의/남쪽의 이웃 샘플 S, 중심 샘플의 좌측의/서쪽의 이웃 샘플 W 및 중심 샘플의 우측의/동쪽의 이웃 샘플 E를 포함할 수 있다.The inputs to the spatial 5-tap component of the filter are: the center sample C within the reference block, the neighbor sample N above/north of the center sample, the neighbor sample S below/south of the center sample, and the neighbor sample S to the left/of the center sample. It may include a neighbor sample W to the west and a neighbor sample E to the right/east of the central sample.

참조 블록은 예측의 대상인 대상 블록 내의 샘플들과 대응하는 위치들에 위치할 수 있다. 말하자면, 참조 블록은 실시예들에서 설명된 템플릿 매칭 최적 블록일 수 있다. 참조 템플릿은 템플릿 매칭 최적 블록의 템플릿일 수 있다.The reference block may be located at positions corresponding to samples within the target block that is the target of prediction. That is, the reference block may be a template matching optimal block described in the embodiments. The reference template may be a template of the template matching optimal block.

바이어스 항 B는 입력 및 출력 간의 스칼라 오프셋을 나타낼 수 있다. 바이어스 항 B는 중간(middle) 루마 값으로 설정될 수 있다. 예를 들면, 10-비트 영상에 대한 바이어스 항 B는 512일 수 있다.The bias term B may represent a scalar offset between the input and output. The bias term B can be set to a middle luma value. For example, the bias term B for a 10-bit image may be 512.

필터의 출력은 아래의 수식 102에 따라서 계산될 수 있다.The output of the filter can be calculated according to Equation 102 below.

[수식 102][Formula 102]

predLumaVal = c0C + c1N + c2S + c3E + c4W + c5BpredLumaVal = c0C + c1N + c2S + c3E + c4W + c5B

필터 계수들 ci는 참조 템플릿 및 대상 템플릿 간의 MSE를 최소화함으로써 계산될 수 있다.Filter coefficients ci can be calculated by minimizing the MSE between the reference template and target template.

템플릿의 크기 및 모양은 실시예들에서 설명된 것과 동일할 수 있다.The size and shape of the template may be the same as those described in the embodiments.

예를 들면, 훈련을 위해 사용되는 템플릿의 크기는 대상 블록의 상단에 인접한 4 개의 라인들 및 대상 블록의 좌단에 인접한 4 개의 라인들을 포함하도록 결정될 수 있다. 이 때, 라인이 템플릿에 포함되는지 여부는 라인의 가용성에 기반하여 결정될 수 있다.For example, the size of the template used for training may be determined to include four lines adjacent to the top of the target block and four lines adjacent to the left end of the target block. At this time, whether the line is included in the template may be determined based on the availability of the line.

플러스 기호 모양의 공간적 필터의 사이드 샘플들을 지원하기 위해 도 73에서 도시된 영역으로의 확장들이 요구된다. 사이드 샘플들은 이웃 샘플 N, 이웃 샘플 S, 이웃 샘플 W 및 이웃 샘플 E 중 하나 이상일 수 있다. 말하자면, 사이드 샘플은 참조 템플릿의 원래의 영역 내에 존재하지 않는 샘플일 수 있다.Extensions to the area shown in Figure 73 are required to support side samples of the plus sign shaped spatial filter. The side samples may be one or more of neighboring sample N, neighboring sample S, neighboring sample W, and neighboring sample E. In other words, a side sample may be a sample that does not exist within the original region of the reference template.

사이드 샘플이 가용하지 않은 영역 내에 있는 경우, 사이드 샘플에 대한 패딩이 수행될 수 있다. 패딩에 의해 결정된 값이 사이드 샘플의 값으로서 사용될 수 있다.If the side sample is within an unavailable area, padding for the side sample may be performed. The value determined by padding can be used as the value of the side sample.

필터 파라미터들은 MSE 최소화(예를 들면, 가우시안 해법(gaussian solver))에 기반하는 회귀(regression)을 사용하여 유도될 수 있다. 필터 파라미터들은 CCCM과 같은 다른 방법을 위해 사용될 수 있다.Filter parameters may be derived using regression based MSE minimization (e.g., a Gaussian solver). Filter parameters can be used for other methods such as CCCM.

전술된 선형 필터 모델을 IntraTMP의 예측에 적용되는지 여부를 나타내는 정보가 시그널링될 수 있다. 예를 들면, 상기의 정보는 CU 레벨의 플래그일 수 있다.Information indicating whether the above-described linear filter model is applied to prediction of IntraTMP may be signaled. For example, the above information may be a CU level flag.

선형 필터 모델을 사용하는 모드는 IntraTMP의 서브-모드일 수 있다. 말하자면, 전술된 선형 필터 모델을 IntraTMP의 예측에 적용되는지 여부를 나타내는 정보는 IntraTMP 플래그의 값이 참인 경우에만 시그널링될 수 있다.The mode using the linear filter model may be a sub-mode of IntraTMP. In other words, information indicating whether the above-described linear filter model is applied to the prediction of IntraTMP can be signaled only when the value of the IntraTMP flag is true.

참조 블록들의 합성Composition of reference blocks

도 74는 일 예에 따른 IntraTMP 합성의 절차를 나타낸다.Figure 74 shows the procedure of IntraTMP synthesis according to one example.

최적 매칭 템플릿은 스탭 크기 2를 갖는 기정의된 탐색 영역 내에서 획득될 수 있다.The optimal matching template can be obtained within a predefined search area with a step size of 2.

스탭 크기 1을 갖는 개선된(refined) 탐색이 상기의 최적 매칭 템플릿의 주변에서 수행될 수 있고, 개선된 탐색에 의해 최종 최적 매칭 템플릿이 획득될 수 있다.A refined search with a step size of 1 can be performed around the optimal matching template, and the final optimal matching template can be obtained by the refined search.

블록 벡터는 최종 최적 매칭 템플릿 및 대상 템플릿 간의 오프셋일 수 있다.The block vector may be an offset between the final optimal matching template and the target template.

IntraTMP 합성 방법을 위해 N 개의 매칭 템플릿들에 대응하는 BV들이 스탭 크기 2를 가지고 탐색될 수 잇다.For the IntraTMP synthesis method, BVs corresponding to N matching templates can be searched with a step size of 2.

다음으로, 탐색에 의해 결정된 BV들을 통해 N 개의 후보 매칭 템플릿들에 대응하는 N 개의 후보 참조 블록들이 획득될 수 있다.Next, N candidate reference blocks corresponding to N candidate matching templates can be obtained through BVs determined by search.

다음으로, 대상 블록에 대한 예측을 위해, 후보 참조 블록들이 가중치들에 따라서 합성될 수 있다. Next, to predict the target block, candidate reference blocks may be synthesized according to weights.

최종 후보들의 수량 N은 실제로 발견된 유효한 후보들의 개수에 의해 결정될 수 있다. N은 1의 이상일 수 있고, 3의 이하일 수 있다.The quantity N of final candidates can be determined by the number of valid candidates actually found. N may be 1 or more and 3 or less.

합성 방법은 아래의 수식 103과 같을 수 있다.The synthesis method may be as shown in Equation 103 below.

[수식 103][Formula 103]

Figure pat00015
Figure pat00015

여기에서, predSamples는 최종 예측 블록을 나타낼 수 있다.Here, predSamples may represent the final prediction block.

refBlockn은 N 개의 후보 참조 블록들 중 하나일 수 있다.refBlock n may be one of N candidate reference blocks.

midValue는 오프셋일 수 있다. 대상 영상이 10-비트 영상일 때, midValue는 512일 수 있다.midValue may be an offset. When the target image is a 10-bit image, midValue may be 512.

가중치들 Wn는 후보 매칭 템플릿들 및 대상 템플릿으로부터 가우시안 해법을 사용하여 유도될 수 있다. 가우시안 해법은 CCCM에서 사용될 수 있다.Weights W n can be derived from the candidate matching templates and the target template using a Gaussian solution. Gaussian solution can be used in CCCM.

IntraTMP가 사용되는지 여부를 나타내는 IntraTMP 사용 정보(= intra_tmp_flag)가 시그널링될 수 있다.IntraTMP usage information (= intra_tmp_flag) indicating whether IntraTMP is used may be signaled.

실시예의 IntraTMP 합성이 사용되는지 여부를 나타내는 IntraTMP 합성 사용 정보가 시그널링될 수 있다. IntraTMP 사용 정보 및 IntraTMP 합성 사용 정보의 각각은 플래그일 수 있고, CU 레벨에서 시그널링될 수 있다. 실시예의 IntraTMP 합성 방법은 IntraTMP의 서브-모드일 수 있다.IntraTMP synthesis usage information indicating whether IntraTMP synthesis of the embodiment is used may be signaled. Each of the IntraTMP usage information and IntraTMP composite usage information may be a flag and may be signaled at the CU level. The IntraTMP synthesis method of the embodiment may be a sub-mode of IntraTMP.

IntraTMP 사용 정보와 함께 IntraTMP 합성 사용 정보가 시그널링될 수 있다. 시그널링된 IntraTMP 사용 정보가 IntraTMP가 사용됨을 나타내면, 다음으로 IntraTMP 합성 사용 정보가 시그널링될 수 있다.IntraTMP composite usage information may be signaled along with IntraTMP usage information. If the signaled IntraTMP usage information indicates that IntraTMP is used, IntraTMP composite usage information may be signaled next.

탐색 영역의 조정Adjustment of navigation area

실시예들에서 설명된 탐색 영역은 조정될 수 있다.The search area described in the embodiments may be adjusted.

예를 들면, 탐색 영역의 크기는 (5W, 5H)일 수 있다. W는 대상 블록의 가로 크기일 수 있다. H는 대상 블록의 세로 크기일 수 있다. 이러한 탐색 영역은 5 개의 영역들을 포함할 수 있다. 탐색 영역은 대상 블록을 포함하는 대상 CTU의 복호화된 영역을 포함할 수 있다.For example, the size of the search area may be (5W, 5H). W may be the horizontal size of the target block. H may be the vertical size of the target block. This search area may include five areas. The search area may include the decrypted area of the target CTU including the target block.

이러한 탐색 영역의 크기는 제한될 수 있다. 탐색 영역의 크기는 (min(aW, n), min(bHW, m))일 수 있다. a, b, n, m의 각각은 1 이상의 정수일 수 있다. 예를 들면, a는 5일 수 있다. b는 5일 수 있다. c는 64일 수 있다. d는 64일 수 있다. 말하자면, 탐색 영역의 크기는 대상 블록의 크기에 비례하도록 커지면서, 특정 사각 영역을 넘지 않도록 조정될 수 있다.The size of this search area may be limited. The size of the search area may be (min(aW, n), min(bHW, m)). Each of a, b, n, and m may be an integer of 1 or more. For example, a may be 5. b may be 5. c may be 64. d may be 64. In other words, the size of the search area can be adjusted to increase in proportion to the size of the target block and not exceed a specific rectangular area.

도 75는 일 예에 따른 IntraTMP의 탐색 영역을 나타낸다.Figure 75 shows a search area of IntraTMP according to an example.

IntraTMP는 기정의된 대상 블록의 템플릿을 사용하여 기결정된 탐색 영역 내에서 대상 블록의 템플릿과 최적으로 매치하는 같은 모양을 갖는 후보 템플릿을 검색할 수 있다.IntraTMP can use the template of a predefined target block to search for a candidate template with the same shape that optimally matches the template of the target block within a predetermined search area.

최적 템플릿을 검색하기 위해 SAD와 같은 비용 함수가 정의될 수 있다. 부호화 장치(1600) 및 복호화 장치(1700)의 양자가 최적으로 매치되는 블록을 획득하기 위해 동일한 검색 전략을 사용할 수 있다. 일단, 최적으로 매치되는 블록이 발견되면, 대응하는 참조 블록이 대상 블록의 코딩을 위한 예측 블록으로서 선택될 수 있다.A cost function such as SAD can be defined to search for the optimal template. Both the encoding device 1600 and the decoding device 1700 may use the same search strategy to obtain an optimally matched block. Once the optimally matching block is found, the corresponding reference block can be selected as a prediction block for coding of the target block.

도 75에서 도시된 것과 같이, IntraTMP의 탐색 영역은 4 개의 영역들 R1, R2, R3 및 R4를 포함할 수 있다. 4 개의 영역들은 상측 및/또는 좌측 CTU들로부터의 재구축된 샘플들을 포함할 수 있다. 4 개의 영역들은 대상 블록의 상측 및 좌측에 위치하는 대상 CTU 내의 재구축된 샘플들을 포함할 수 있다.As shown in FIG. 75, the search area of IntraTMP may include four areas R1, R2, R3, and R4. The four regions may contain reconstructed samples from the top and/or left CTUs. The four regions may include reconstructed samples in the target CTU located above and to the left of the target block.

4 개의 영역들의 탐색 순서는 R4, R1, R2 및 R3일 수 있다.The search order of the four regions may be R4, R1, R2, and R3.

도 75에서는, 가로 길이가 W이고, 세로 길이가 H인 대상 블록이 도시되었다. 회색 부분은 재구축된 영역 내의 모든 참조 블록들의 좌상측 모서리들의 영역들을 나타낼 수 있다.In Figure 75, a target block with a horizontal length of W and a vertical length of H is shown. The gray portion may represent areas of the upper left corners of all reference blocks within the reconstructed area.

searchRangeWidth는 최대 수평 크기일 수 있다. searchRangeHeight는 최대 수직 크기일 수 있다.searchRangeWidth can be the maximum horizontal size. searchRangeHeight can be the maximum vertical size.

searchRangeWidth는 max(5W, 64)로 설정될 수 있다. searchRangeHeight는 max(5W, 64)로 설정될 수 있다.searchRangeWidth can be set to max(5W, 64). searchRangeHeight can be set to max(5W, 64).

도 76은 일 예에 따른 IntraTMP의 확장된 탐색 영역을 나타낸다.Figure 76 shows an expanded search area of IntraTMP according to an example.

대상 블록에 대해 상대적으로 하좌측 영역 및 상우측 영역 또한 가용할 수 있으며, 대상 블록에 매우 가까울 수 있다.The lower left area and upper right area relative to the target block may also be available and may be very close to the target block.

IntraTMP의 탐색 영역은 6 개의 영역들 R1, R2, R3, R4, R5 및 R6을 포함할 수 있다. IntraTMP의 탐색 영역이 영역들 R5 및 R6을 더 포함함에 따라 탐색 영역이 확장될 수 있다.The search area of IntraTMP may include six areas R1, R2, R3, R4, R5, and R6. The search area of IntraTMP may be expanded as the search area further includes areas R5 and R6.

6 개의 영역들의 탐색 순서는 R4, R5, R6, R1, R2 및 R3일 수 있다.The search order of the six regions may be R4, R5, R6, R1, R2, and R3.

도 77은 일 예에 따른 IntraTMP의 제한된 탐색 영역을 나타낸다.Figure 77 shows a limited search area of IntraTMP according to an example.

일 실시예에서, 특정 대상의 모든 가용한 위치들에 대해서 탐색이 수행될 수 있다. 예를 들면, 특정 대상은 대상 CTU일 수 있다. 이러한 탐색은 특정 탐색 범위 또는 폭/높이를 넘어설 수 있다.In one embodiment, a search may be performed across all available locations for a particular object. For example, a specific target may be a target CTU. This navigation can go beyond a certain navigation range or width/height.

모든 탐색 영역은 특정 탐색 범위로 제한될 수 있다. 또는, 모든 탐색 영역은 특정 폭 및/또는 특정 높이로 제한될 수 있다.Any search area can be limited to a specific search range. Alternatively, all search areas may be limited to a certain width and/or a certain height.

도 77에서 도시된 것과 같이, searchRangeHeight 및 searchRangeHeight에 의해 탐색 범위가 제한될 수 있다.As shown in FIG. 77, the search range may be limited by searchRangeHeight and searchRangeHeight.

searchRangeHeight는 대상 블록의 좌상단으로부터 제한된 탐색 범위의 상단까지의 세로 거리일 수 있다. searchRangeHeight는 대상 블록의 좌하단으로부터 제한된 탐색 범위의 하단까지의 세로 거리일 수 있다. searchRangeWidth는 대상 블록의 좌상단으로부터 제한된 탐색 범위의 좌단까지의 가로 거리일 수 있다. searchRangeWidth는 대상 블록의 우상단으로부터 제한된 탐색 범위의 우단까지의 가로 거리일 수 있다.searchRangeHeight may be the vertical distance from the top left of the target block to the top of the limited search range. searchRangeHeight may be the vertical distance from the bottom left of the target block to the bottom of the limited search range. searchRangeWidth may be the horizontal distance from the upper left corner of the target block to the left end of the limited search range. searchRangeWidth may be the horizontal distance from the upper right corner of the target block to the right end of the limited search range.

말하자면, 탐색 범위의 크기는 (2·searchRangeWidth + H, 2·searchRangeHeight + W)로 제한될 수 있다.That is, the size of the search range can be limited to (2·searchRangeWidth + H, 2·searchRangeHeight + W).

대상 블록의 최좌상단 픽셀의 좌표가 (xtop-left, ytop-left)일 때, x 좌표가 xtop-left의 이상이고, y 좌표가 ytop-left의 이상인 픽셀들은 탐색 범위에서 제외될 수 있다. 말하자면, 탐색 범위는 x 좌표가 xtop-left 보다 더 작거나 y 좌표가 ytop-left 보다 더 작은 픽셀들로 구성될 수 있다.When the coordinates of the top left pixel of the target block are (x top-left , y top-left ), pixels with x coordinates greater than x top-left and y coordinates greater than y top-left will be excluded from the search range. You can. That is, the search range may consist of pixels whose x-coordinate is smaller than x top-left or whose y-coordinate is smaller than y top-left .

블록 벡터 해상도의 조정Adjustment of block vector resolution

블록 벡터는 IntraTMP 모드의 코딩을 위해 사용될 수 있다. 이러한 사용의 이후에, IntraTMP의 블록 벡터는 IBC 블록들에 대한 코딩을 위해서 저장될 수 있다.Block vectors can be used for coding in IntraTMP mode. After this use, the block vector of IntraTMP can be stored for coding for IBC blocks.

일 실시예에서, 저장되는 IntraTMP의 블록 벡터의 해상도(resolution)는 풀-펠 해상도일 수 있다. 말하자면, 풀-펠 해상도를 갖는 블록 벡터만이 선택적으로 저장될 수 있다.In one embodiment, the resolution of the block vector of the stored IntraTMP may be full-pel resolution. That is, only block vectors with full-pel resolution can be selectively stored.

일 실시예에서, 저장되는 IntraTMP의 블록 벡터의 해상도는 1/2-펠 해상도 및 1/4-펠 해상도를 포함할 수 있다. 말하자면, 풀-펠 해상도를 갖는 블록 벡터, 1/2-펠 해상도를 갖는 블록 벡터 및 1/4-펠 해상도를 갖는 블록 벡터가 저장될 수 있다. 따라서, 1/2-펠 해상도 또는 1/4-펠 해상도를 사용하여 블록 벡터의 탐색 및 저장이 수행될 수 있다.In one embodiment, the resolution of the block vector of the stored IntraTMP may include 1/2-pel resolution and 1/4-pel resolution. That is, block vectors with full-pel resolution, block vectors with 1/2-pel resolution, and block vectors with 1/4-pel resolution can be stored. Accordingly, search and storage of block vectors can be performed using either 1/2-pel resolution or 1/4-pel resolution.

저장된 블록 벡터는 연혁-기반 움직임 벡터 예측(History-based Motion Vector Prediction; HMVP)을 위해 사용될 수 있다.The stored block vectors can be used for history-based motion vector prediction (HMVP).

IBC 참조 영역을 사용하는 탐색 영역에 대한 제한Restrictions on navigation areas using IBC reference areas

도 78a는 일 예에 따른 CTU 크기가 128인 경우의 IBC 탐색 영역을 나타낸다.Figure 78a shows an IBC search area when the CTU size is 128 according to an example.

도 78b는 일 예에 따른 CTU 크기가 256인 경우의 IBC 탐색 영역을 나타낸다.Figure 78b shows an IBC search area when the CTU size is 256 according to an example.

CTU 크기가 128 또는 256인지와는 무관하게, IBC 참조 영역은 대상 CTU의 위의 245 개의 샘플들을 포함할 수 있다. 또한, IBC 참조 영역은 대상 CTU가 포함되는 행 내의 모든 좌측 이웃 CTU들을 포함할 수 있다. 또한, CTU 크기가 128인 경우 IBC 참조 영역은 대상 CTU의 위의 2 개의 CTU 행들을 포함할 수 있다. CTU 크기가 256인 경우 IBC 참조 영역은 대상 CTU의 위의 1 개의 CTU 행을 포함할 수 있다.Regardless of whether the CTU size is 128 or 256, the IBC reference region may contain 245 samples above the target CTU. Additionally, the IBC reference area may include all left neighboring CTUs within the row containing the target CTU. Additionally, when the CTU size is 128, the IBC reference area may include two CTU rows above the target CTU. If the CTU size is 256, the IBC reference area may include one CTU row above the target CTU.

이러한 경우들에서, CTU 들의 가장 상단의 행은 대상 CTU보다 더 좌측에 있는 1 개 또는 2 개의 CTU를 갖도록 제한될 수 있다.In these cases, the top row of CTUs may be constrained to have one or two CTUs further to the left than the target CTU.

IBC 참조 영역의 좌상단 코너는 대상 CTU의 좌단으로부터 256 개의 샘플들 만큼 좌측에 위치할 수 있다. IBC 참조 영역의 좌상단 코너는 대상 CTU의 상단으로부터 256 개의 샘플들 만큼 상측에 위치할 수 있다.The upper left corner of the IBC reference area may be located 256 samples to the left of the left end of the target CTU. The upper left corner of the IBC reference area may be located 256 samples above the top of the target CTU.

도 79는 일 예에 따른 블록 크기가 64×64인 경우의 IntraTMP 탐색 영역을 나타낸다.Figure 79 shows an IntraTMP search area when the block size is 64×64 according to an example.

도 79에서 CTU 크기는 128일 수 있다.In Figure 79, the CTU size may be 128.

IntraTMP 탐색 영역은 복수의 서브-영역들(= R1, R2 및 R3)을 포함할 수 있다.The IntraTMP search area may include multiple sub-areas (=R1, R2, and R3).

IntraTMP 탐색 영역은 블록 크기(CbWidth, CbHeight)에 비례하도록 설정될 수 있다. 이러한 설정에서 5의 팩터(factor)가 사용될 수 있다.The IntraTMP search area can be set to be proportional to the block size (CbWidth, CbHeight). In this setting, a factor of 5 can be used.

말하자면, IntraTMP 탐색 영역은 아래의 수식 104와 같이 설정될 수 있다.In other words, the IntraTMP search area can be set as shown in Equation 104 below.

[수식 104][Formula 104]

(SearchRange_w= 5 * CbWidth, SearchRange_h = 5 * CbHeight)(SearchRange_w=5*CbWidth, SearchRange_h=5*CbHeight)

도 79에서 도시된 것과 같이, 블록 크기는 64×64일 수 있다. 상단 서브-영역 R1은 IBC 탐색 영역의 좌단 경계 및 상단 경계를 초과할 수 있다. 이러한 초과는 IBC 재구축된 버퍼에 비해 더 큰 메모리를 요구할 수 있다.As shown in Figure 79, the block size may be 64×64. The top sub-area R1 may exceed the left and top boundaries of the IBC search area. These excesses may require larger memory compared to the IBC rebuilt buffer.

도 80은 일 예에 따른 탐색 범위를 제한하기 위한 코드를 나타낸다.Figure 80 shows code for limiting the search range according to an example.

IntraTMP 탐색 영역 및 IBC 탐색 영역은 조화(harmonize)될 수 있다. IntraTMP 탐색 영역 및 IBC 탐색 영역의 양자를 위해 사용되는 재구축된 샘플들을 위한 동일한 메모리 크기가 사용될 수 있다.IntraTMP search area and IBC search area can be harmonized. The same memory size for reconstructed samples that is used for both the IntraTMP search area and the IBC search area can be used.

도 81은 일 예에 따른 2 개의 서로 다른 샘플링 레이트들을 갖는 TMP 탐색 영역 및 IBC 탐색 영역을 나타낸다.Figure 81 shows a TMP search area and an IBC search area with two different sampling rates according to an example.

일 실시예에서, IntraTMP 서브-영역들의 크기가 제한될 수 있다. 제한을 통해, IntraTMP 서브-영역들이 탐색 영역의 IBC 경계들 내에 포함되는지 여부가 확인될 수 있다. 결과적으로, 64×64의 블록 크기에 대하여, 서브-영역 R1의 상단 경계 및 좌단 경계는 IBC 탐색 영역의 경계들 내로 제한될 수 있다.In one embodiment, the size of IntraTMP sub-regions may be limited. Through constraints, it can be confirmed whether IntraTMP sub-regions are included within the IBC boundaries of the search area. As a result, for a block size of 64×64, the top and left boundaries of sub-area R1 can be constrained within the boundaries of the IBC search area.

일 실시예에서, 겹쳐지는 R1 및 R3 사이의 경계들이 변경될 수 있다. 이러한 겹쳐짐(overlap)은 모든 블록 크기에 대하여 템플릿 매칭 계산들의 개수를 증가시킬 수 있다. 이러한 수정은 R3의 상단 경계(iVerMin)에서 하나의 샘플을 증가시킬 수 있다.In one embodiment, the boundaries between overlapping R1 and R3 may be changed. This overlap can increase the number of template matching calculations for all block sizes. This modification can increase the upper boundary (iVerMin) of R3 by one sample.

도 80은 R3의 상단 경계에서 하나의 샘플을 증가시키는 코드를 개시한다.Figure 80 discloses code to increment one sample from the upper boundary of R3.

도 81은 일 예에 따른 2 개의 서로 다른 샘플링 레이트들을 갖는 IntraTMP 탐색 영역 및 IBC 탐색 영역들을 나타낸다.Figure 81 shows IntraTMP search area and IBC search area with two different sampling rates according to an example.

대상 블록의 크기가 큰 경우, IntraTMP 탐색 영역이 IBC 탐색 영역을 벗어날 수 있다. 이러한 경우, IBC 탐색 영역에 의해 IntraTMP 탐색 영역이 제한될 수 있다.If the size of the target block is large, the IntraTMP search area may exceed the IBC search area. In this case, the IntraTMP search area may be limited by the IBC search area.

일 실시예에서, IntraTMP 서브-영역들은 IBC 탐색 영역의 특정 모양에 맞게 조정될 수 있다. 이러한 조정을 통해 IntraTMP 탐색 영역이 더 확장될 수 있다. 도 81은 새로운 IntraTMP 서브-영역들의 배치를 도시한다.In one embodiment, IntraTMP sub-regions can be tailored to the specific shape of the IBC search area. Through these adjustments, the IntraTMP search area can be further expanded. Figure 81 shows the placement of new IntraTMP sub-regions.

서브-영역들에 대하여 서로 다른 서브샘플링이 적용될 수 있다. 서브샘플링들의 샘플링 레이트들은 서로 다를 수 있다.Different subsampling may be applied to sub-regions. The sampling rates of subsamplings may be different.

예를 들면, IntraTMP 탐색 영역 중 특정 영역에 대하여 SR1의 샘플링 레이트가 사용될 수 있다. 예를 들면, SR1은 3일 수 있다. 특정 영역은 대상 블록의 크기의 5 배의 크기를 갖는 영역일 수 있다. IntraTMP 탐색 영역 중 특정 영역 외의 다른 영역에 대하여 SR2의 샘플링 레이트가 사용될 수 있다. 예를 들면, SR2는 8의 거듭제곱(power)일 수 있다.For example, a sampling rate of SR 1 may be used for a specific area of the IntraTMP search area. For example, SR 1 may be 3. The specific area may be an area whose size is 5 times the size of the target block. A sampling rate of SR 2 may be used for areas other than the specific area among the IntraTMP search areas. For example, SR 2 may be the power of 8.

일 실시예에서, IntraTMP 탐색 영역은 IBC 탐색 영역으로 확장될 수 있다. 이 때, IntraTMP 탐색을 수행함에 있어서, (확장 전의) IntraTMP 탐색 영역 내에서는 3의 샘플링 레이트가 사용될 수 있다. (확장에 의해 IntraTMP 탐색 영역으로서 추가된) IBC 탐색 영역 내에서는 5의 샘플링 레이트가 사용될 수 있다.In one embodiment, the IntraTMP search area may be extended to the IBC search area. At this time, when performing IntraTMP search, a sampling rate of 3 can be used within the IntraTMP search area (before expansion). A sampling rate of 5 can be used within the IBC search area (added as the IntraTMP search area by extension).

상기의 실시예들은 부호화 장치(1600) 및 복호화 장치(1700)에서 동일한 방법 및/또는 상응하는 방법으로 수행될 수 있다. 또한, 영상의 부호화 및/또는 복호화에 있어서 상기의 실시예들 중 하나 이상의 조합이 사용될 수 있다.The above embodiments may be performed in the encoding device 1600 and the decoding device 1700 using the same method and/or corresponding method. Additionally, a combination of one or more of the above embodiments may be used in encoding and/or decoding an image.

상기의 실시예들이 적용되는 순서는 부호화 장치(1600) 및 복호화 장치(1700)에서 서로 상이할 수 있다. 또는, 상기의 실시예들이 적용되는 순서는 부호화 장치(1600) 및 복호화 장치(1700)에서 (적어도 부분적으로) 동일할 수 있다.The order in which the above embodiments are applied may be different in the encoding device 1600 and the decoding device 1700. Alternatively, the order in which the above embodiments are applied may be (at least partially) the same in the encoding device 1600 and the decoding device 1700.

상기의 실시예들은 루마 신호 및 크로마 신호의 각각에 대하여 수행될 수 있다. 루마 신호 및 크로마 신호에 대하여 상기의 실시예들이 동일하게 수행할 수 있다.The above embodiments can be performed for each of the luma signal and the chroma signal. The above embodiments can be performed in the same way for luma signals and chroma signals.

상기의 실시예들이 적용되는 블록의 형태는 정방형(square) 형태 또는 비정방형(non-square) 형태를 가질 수 있다.The shape of the block to which the above embodiments are applied may have a square shape or a non-square shape.

상기의 실시예들 중 적어도 하나의 실시예의 적용 및/또는 수행 여부는 블록의 크기에 대한 조건에 기반하여 결정될 수 있다. 말하자면, 상기의 실시예들 중 적어도 하나의 실시예는 블록의 크기에 대한 조건이 충족되는 경우 적용 및/또는 수행될 수 있다. 조건은 최소 블록 크기 및 최대 블록 크기를 포함할 수 있다. 블록은 실시예들에서 전술된 블록들 및 실시예에서 전술된 유닛들 중 하나일 수 있다. 최소 블록 크기가 적용되는 블록 및 최대 블록 크기가 적용되는 블록은 서로 다를 수 있다.Whether to apply and/or perform at least one of the above embodiments may be determined based on conditions regarding the size of the block. That is, at least one of the above embodiments can be applied and/or performed when the conditions for the size of the block are met. Conditions may include minimum block size and maximum block size. The block may be one of the blocks described above in the embodiments and the units described above in the embodiments. The block to which the minimum block size is applied and the block to which the maximum block size is applied may be different.

예를 들면, 블록의 크기가 최소 크기의 이상인 경우 및/또는 블록의 크기가 최대 크기의 이하인 경우에, 전술된 실시예가 적용 및/또는 수행될 수 있다. 블록의 크기가 최소 크기보다 더 큰 경우 및/또는 블록의 크기가 최대 크기의 이하인 경우에, 전술된 실시예가 적용 및/또는 수행될 수 있다.For example, when the size of a block is greater than or equal to the minimum size and/or when the size of the block is less than or equal to the maximum size, the above-described embodiments may be applied and/or performed. If the size of the block is larger than the minimum size and/or if the size of the block is less than or equal to the maximum size, the above-described embodiments may be applied and/or performed.

예를 들어, 블록의 크기가 기정의된 블록 크기인 경우에만 전술된 실시예가 적용될 수 있다. 기정의된 블록 크기는 2x2, 4x4, 8x8, 16x16, 32x32, 64x64 또는 128x128일 수 있다. 기정의된 블록 크기는 (2*SIZEX)x(2*SIZEY)일 수 있다. SIZEX는 1 이상의 정수들 중 하나일 수 있다. SIZEY는 1 이상의 정수들 중 하나일 수 있다.For example, the above-described embodiment can be applied only when the block size is a predefined block size. Predefined block sizes can be 2x2, 4x4, 8x8, 16x16, 32x32, 64x64 or 128x128. The predefined block size may be ( 2 * SIZE SIZE SIZE Y may be one of integers greater than or equal to 1.

예를 들어, 블록의 크기가 블록 최소 크기의 이상일 경우에만 전술된 실시예가 적용될 수 있다. 블록의 크기가 블록 최소 크기보다 더 큰 경우에만 전술된 실시예가 적용될 수 있다. 블록 최소 크기는 2x2, 4x4, 8x8, 16x16, 32x32, 64x64 또는 128x128일 수 있다. 또는, 블록 최소 크기는 (2*SIZEMIN_X)x(2*SIZEMIN_Y)일 수 있다. SIZEMIN_X는 1 이상의 정수들 중 하나일 수 있다. SIZEMIN_Y는 1 이상의 정수들 중 하나일 수 있다.For example, the above-described embodiment can be applied only when the block size is greater than or equal to the minimum block size. The above-described embodiment can be applied only when the size of the block is larger than the minimum block size. Block minimum sizes can be 2x2, 4x4, 8x8, 16x16, 32x32, 64x64 or 128x128. Alternatively, the minimum block size may be (2*SIZE MIN_X )x(2*SIZE MIN_Y ). SIZE MIN_X can be one of integers greater than 1. SIZE MIN_Y can be one of integers greater than 1.

예를 들어, 블록의 크기가 최대 블록 크기의 이하인 경우에만 전술된 실시예가 적용될 수 있다. 블록의 크기가 최대 블록 크기보다 더 작은 경우에만 전술된 실시예가 적용될 수 있다. 최대 블록 크기는 2x2, 4x4, 8x8, 16x16, 32x32, 64x64 또는 128x128일 수 있다. 또는, 블록 최대 크기는 (2*SIZEMAX_X)x(2*SIZEMAX_Y)일 수 있다. SIZEMAX_X는 1 이상의 정수들 중 하나일 수 있다. SIZEMAX_Y는 1 이상의 정수들 중 하나일 수 있다.For example, the above-described embodiment can be applied only when the block size is less than or equal to the maximum block size. The above-described embodiment can be applied only when the block size is smaller than the maximum block size. The maximum block size can be 2x2, 4x4, 8x8, 16x16, 32x32, 64x64 or 128x128. Alternatively, the maximum block size may be (2*SIZE MAX_X )x(2*SIZE MAX_Y ). SIZE MAX_X can be one of integers greater than 1. SIZE MAX_Y can be one of integers greater than 1.

예를 들어, 블록의 크기가 최소 블록 크기의 이상이고 최대 블록 크기의 이하인 경우에만 전술된 실시예가 적용될 수 있다. 블록의 크기가 최소 블록 크기보다 더 크고 최대 블록 크기의 이하인 경우에만 전술된 실시예가 적용될 수 있다. 블록의 크기가 최소 블록 크기의 이상이고 최대 블록 크기보다 더 작은 경우에만 전술된 실시예가 적용될 수 있다. 블록의 크기가 최소 블록 크기보다 더 크고 최대 블록 크기보다 더 작은 경우에만 전술된 실시예가 적용될 수 있다. For example, the above-described embodiment can be applied only when the block size is greater than or equal to the minimum block size and less than or equal to the maximum block size. The above-described embodiment can be applied only when the block size is greater than the minimum block size and less than or equal to the maximum block size. The above-described embodiment can be applied only when the block size is greater than or equal to the minimum block size and smaller than the maximum block size. The above-described embodiment can be applied only when the block size is larger than the minimum block size and smaller than the maximum block size.

전술된 실시예들에서, 블록의 크기는 블록의 가로 크기 또는 블록의 세로 크기를 의미할 수 있다. 블록의 크기는 블록의 가로 크기 및 블록의 세로 크기의 양자를 의미할 수 있다. 또한, 블록의 크기는 블록의 면적을 의미할 수 있다. 면적, 최소 블록 크기 및 최대 블록 크기의 각각은 1 이상의 정수들 중 하나일 수 있다. 또한, 블록의 크기는 블록의 가로 크기 및 세로 크기를 사용하는 알려진 수식의 결과(또는, 값) 또는 실시예의 수식의 결과(또는, 값)를 의미할 수 있다.In the above-described embodiments, the size of the block may mean the horizontal size of the block or the vertical size of the block. The size of the block may refer to both the horizontal size of the block and the vertical size of the block. Additionally, the size of the block may mean the area of the block. Each of the area, minimum block size, and maximum block size can be one of integers greater than or equal to 1. Additionally, the size of the block may mean the result (or value) of a known formula using the horizontal and vertical sizes of the block or the result (or value) of a formula in an embodiment.

또한, 상기의 실시예들에 있어서, 제1 크기에 대해서는 제1의 실시예가 적용될 수도 있고, 제2 크기에 대해서는 제2의 실시예가 적용될 수도 있다. Additionally, in the above embodiments, the first embodiment may be applied to the first size, and the second embodiment may be applied to the second size.

상기의 실시예들은 시간적 계층(temporal layer)에 따라 적용될 수 있다. 상기의 실시예들이 적용 가능한 시간적 계층을 식별하기 위해 별도의 식별자(identifier)가 시그널링될 수 있고, 해당 식별자에 의해 특정되는 시간적 계층에 대해서 상기의 실시예들이 적용될 수 있다. 여기서의 식별자는 상기의 실시예가 적용 가능한 최하위 계층 및/또는 최상위 계층으로서 정의될 수도 있고, 상기의 실시예가 적용되는 특정 계층을 지시하도록 정의될 수도 있다. 또한, 상기의 실시예가 적용되는 고정된 시간적 계층이 정의될 수도 있다.The above embodiments can be applied according to the temporal layer. A separate identifier may be signaled to identify the temporal layer to which the above embodiments can be applied, and the above embodiments may be applied to the temporal layer specified by the identifier. The identifier here may be defined as the lowest layer and/or highest layer to which the above embodiment is applicable, or may be defined to indicate a specific layer to which the above embodiment is applicable. Additionally, a fixed temporal hierarchy to which the above embodiments are applied may be defined.

예를 들어, 대상 영상의 시간적 계층이 최하위 계층일 경우에만 상기의 실시예들이 적용될 수 있다. 예를 들어, 대상 영상의 시간적 계층 식별자가 1 이상인 경우에만 상기의 실시예들이 적용될 수 있다. 예를 들어, 대상 영상의 시간적 계층이 최상위 계층일 경우에만 상기의 실시예들이 적용될 수 있다.For example, the above embodiments can be applied only when the temporal layer of the target image is the lowest layer. For example, the above embodiments can be applied only when the temporal layer identifier of the target image is 1 or more. For example, the above embodiments can be applied only when the temporal layer of the target image is the highest layer.

상기의 실시예들이 적용되는 슬라이스 타입(slice type) 또는 타일 그룹 타입이 정의될 수 있고, 해당 슬라이스 타입 또는 타일 그룹 타입에 따라 상기의 실시예들이 적용될 수 있다.A slice type or tile group type to which the above embodiments are applied may be defined, and the above embodiments may be applied depending on the corresponding slice type or tile group type.

상술된 실시예들에서, 특정된 대상에 특정된 처리를 적용함에 있어서, 특정된 조건이 요구될 수 있으며, 특정된 결정 하에 상기의 특정된 처리가 처리되는 것으로 설명된 경우, 특정된 코딩 파라미터에 기반하여 특정된 조건이 충족되는지 여부가 결정되거나, 특정된 코딩 파라미터에 기반하여 특정된 결정이 이루어지는 것으로 설명되었으면, 상기의 특정된 코딩 파라미터는 다른 코딩 파라미터로 대체될 수 있는 것으로 해석될 수 있다. 말하자면, 특정된 조건 또는 특정된 결정에 영향을 미치는 코딩 파라미터는 단지 예시적인 것으로 간주될 수 있으며, 명시된 코딩 파라미터 외에도 하나 이상의 다른 코딩 파라미터들의 결합이 상기의 명시된 코딩 파라미터의 역할을 수행하는 것으로 이해될 수 있다.In the above-described embodiments, in applying a specified process to a specified object, specified conditions may be required, and when it is described that the specified processing is processed under a specified decision, the specified coding parameters If it has been described that it is determined whether a specified condition is satisfied or that a specified decision is made based on a specified coding parameter, the specified coding parameter may be interpreted as being replaceable with another coding parameter. That is, coding parameters affecting specified conditions or specified decisions may be considered merely exemplary, and combinations of one or more other coding parameters in addition to the specified coding parameters will be understood to play the role of the specified coding parameters. You can.

상술된 실시예들에서, 방법들은 일련의 단계 또는 유닛으로서 순서도를 기초로 설명되고 있으나, 본 발명은 단계들의 순서에 한정되는 것은 아니며, 어떤 단계는 상술한 바와 다른 단계와 다른 순서로 또는 동시에 발생할 수 있다. 또한, 당해 기술 분야에서 통상의 지식을 가진 자라면 순서도에 나타난 단계들이 배타적이지 않고, 다른 단계가 포함되거나, 순서도의 하나 또는 그 이상의 단계가 본 발명의 범위에 영향을 미치지 않고 삭제될 수 있음을 이해할 수 있을 것이다.In the above-described embodiments, the methods are described based on flowcharts as a series of steps or units, but the present invention is not limited to the order of steps, and some steps may occur in a different order or simultaneously with other steps as described above. You can. Additionally, a person of ordinary skill in the art will recognize that the steps shown in the flowchart are not exclusive and that other steps may be included or one or more steps in the flowchart may be deleted without affecting the scope of the present invention. You will understand.

상술된 실시예들은 다양한 양태의 예시들을 포함한다. 다양한 양태들을 나타내기 위한 모든 가능한 조합이 기술될 수는 없지만, 해당 기술 분야의 통상의 지식을 가진 자는 명시적으로 기술된 조합 외에도 다른 조합이 가능함을 인식할 수 있을 것이다. 따라서, 본 발명은 이하의 특허청구범위 내에 속하는 모든 다른 교체, 수정 및 변경을 포함한다고 할 것이다.The above-described embodiments include examples of various aspects. Although not all possible combinations for representing various aspects can be described, those skilled in the art will recognize that other combinations are possible in addition to those explicitly described. Accordingly, the present invention is intended to include all other substitutions, modifications and changes falling within the scope of the following claims.

이상 설명된 본 발명에 따른 실시예들은 다양한 컴퓨터 구성요소를 통하여 수행될 수 있는 프로그램 명령어의 형태로 구현되어 컴퓨터 판독 가능한 기록 매체에 기록될 수 있다. 상기 컴퓨터 판독 가능한 기록 매체는 프로그램 명령어, 데이터 파일, 데이터 구조 등을 단독으로 또는 조합하여 포함할 수 있다. 상기 컴퓨터 판독 가능한 기록 매체에 기록되는 프로그램 명령어는 본 발명을 위하여 특별히 설계되고 구성된 것들이거나 컴퓨터 소프트웨어 분야의 당업자에게 공지되어 사용 가능한 것일 수도 있다.Embodiments according to the present invention described above can be implemented in the form of program instructions that can be executed through various computer components and recorded on a computer-readable recording medium. The computer-readable recording medium may include program instructions, data files, data structures, etc., singly or in combination. Program instructions recorded on the computer-readable recording medium may be specially designed and configured for the present invention, or may be known and usable by those skilled in the computer software field.

컴퓨터 판독 가능한 기록 매체는 본 발명에 따른 실시예들에서 사용되는 정보를 포함할 수 있다. 예를 들면, 컴퓨터 판독 가능한 기록 매체는 비트스트림을 포함할 수 있고, 비트스트림은 본 발명에 따른 실시예들에서 설명된 정보를 포함할 수 있다.A computer-readable recording medium may contain information used in embodiments according to the present invention. For example, a computer-readable recording medium may include a bitstream, and the bitstream may include information described in embodiments according to the present invention.

비트스트림은 컴퓨터 실행 가능한(computer-executable) 코드 및/또는 프로그램을 포함할 수 있다. 컴퓨터 실행 가능한(computer-executable) 코드 및/또는 프로그램은 실시예들에서 설명된 정보들을 포함할 수 있으며, 실시예들에서 설명된 구문 요소들(syntax elements)을 포함할 수 있다. 말하자면, 실사예에서 설명된 정보들 및 구문 요소들은 비트스트림 내의 컴퓨터 실행 가능한 코드로 간주될 수 있으며, 비트스트림으로 표현된 컴퓨터 실행 가능한 코드 및/또는 프로그램의 적어도 일부로 간주될 수 있다.A bitstream may contain computer-executable code and/or programs. Computer-executable code and/or program may include information described in the embodiments and may include syntax elements described in the embodiments. That is, the information and syntax elements described in the actual example may be considered computer-executable code within the bitstream, and may be considered at least part of the computer-executable code and/or program represented by the bitstream.

컴퓨터 판독 가능한 기록 매체는 비-일시적 컴퓨터 판독 가능한 매체(non-transitory computer-readable medium)를 포함할 수 있다.Computer-readable recording media may include non-transitory computer-readable medium.

컴퓨터 판독 가능한 기록 매체의 예에는, 하드 디스크, 플로피 디스크 및 자기 테이프와 같은 자기 매체, CD-ROM, DVD와 같은 광기록 매체, 플롭티컬 디스크(floptical disk)와 같은 자기-광 매체(magneto-optical media) 및 ROM, RAM, 플래시 메모리 등과 같은 프로그램 명령어를 저장하고 수행하도록 특별히 구성된 하드웨어 장치가 포함된다. 프로그램 명령어의 예에는, 컴파일러에 의해 만들어지는 것과 같은 기계어 코드뿐만 아니라 인터프리터 등을 사용해서 컴퓨터에 의해서 실행될 수 있는 고급 언어 코드도 포함된다. 상기의 하드웨어 장치는 본 발명에 따른 처리를 수행하기 위해 하나 이상의 소프트웨어 모듈로서 작동하도록 구성될 수 있으며, 그 역도 마찬가지이다.Examples of computer-readable recording media include magnetic media such as hard disks, floppy disks and magnetic tapes, optical recording media such as CD-ROMs and DVDs, and magneto-optical media such as floptical disks. media) and specially configured hardware devices such as ROM, RAM, flash memory, etc. to store and execute program instructions. Examples of program instructions include not only machine language code such as that created by a compiler, but also high-level language code that can be executed by a computer using an interpreter or the like. The above hardware devices may be configured to operate as one or more software modules to perform processing according to the invention and vice versa.

이상에서 본 발명이 구체적인 구성요소 등과 같은 특정 사항들과 한정된 실시예 및 도면에 의해 설명되었으나, 이는 본 발명의 보다 전반적인 이해를 돕기 위해서 제공된 것일 뿐, 본 발명이 상기의 실시예들에 한정되는 것은 아니며, 본 발명이 속하는 기술분야에서 통상적인 지식을 가진 자라면 이러한 기재로부터 다양한 수정 및 변형을 꾀할 수 있다.In the above, the present invention has been described with specific details such as specific components and limited embodiments and drawings, but this is only provided to facilitate a more general understanding of the present invention, and the present invention is not limited to the above embodiments. No, those skilled in the art can make various modifications and changes based on this description.

따라서, 본 발명의 사상은 상기의 설명된 실시예에 국한되어 정해져서는 아니 되며, 후술하는 특허청구범위뿐만 아니라 이 특허청구범위와 균등하게 또는 등가적으로 변형된 모든 것들은 본 발명의 사상의 범주에 속한다고 할 것이다.Accordingly, the spirit of the present invention should not be limited to the above-described embodiments, and the scope of the patent claims described later as well as all modifications equivalent to or equivalent to the scope of the claims shall fall within the scope of the spirit of the present invention. It will be said that it belongs.

Claims (20)

대상 블록에 대한 템플릿을 결정하는 단계;
템플릿 매칭 참조 영상을 선택하는 단계;
상기 템플릿을 사용하여 상기 템플릿 매칭 참조 영상 내에서 템플릿 매칭 최적 블록을 탐색하는 단계; 및
상기 탬플릿 매칭 최적 블록을 사용하는 복호화를 수행하는 단계
를 포함하는 영상 복호화 방법.
determining a template for a target block;
selecting a template matching reference image;
Searching for an optimal template matching block within the template matching reference image using the template; and
Performing decoding using the template matching optimal block
A video decoding method including.
제1항에 있어서,
상기 템플릿을 생성함에 있어서 서브샘플링이 사용되는 영상 복호화 방법.
According to paragraph 1,
A video decoding method in which subsampling is used in generating the template.
제1항에 있어서,
복수의 템플릿 매칭 참조 영상 구성 방법들 중 복수의 템플릿 매칭 참조 영상 구성 방법이 상기 템플릿 매칭 참조 영상의 선택을 위해 선택되는 영상 복호화 방법.
According to paragraph 1,
An image decoding method in which a plurality of template matching reference image construction methods among a plurality of template matching reference image construction methods are selected to select the template matching reference image.
제1항에 있어서,
서로 다른 형태를 갖는 탐색 영역들 중 하나의 탐색 영역이 상기 탬플릿 매칭 최적 블록을 도출하기 위한 탐색 영역으로서 선택되는 영상 복호화 방법.
According to paragraph 1,
A video decoding method in which one search area among search areas having different shapes is selected as a search area for deriving the optimal template matching block.
제1항에 있어서,
상기 탬플릿 매칭 최적 블록을 도출하기 위한 탐색 영역의 템플릿 매칭 탐색 시작 점이 설정되는 영상 복호화 방법.
According to paragraph 1,
A video decoding method in which a template matching search starting point in a search area for deriving the template matching optimal block is set.
제1항에 있어서,
상기 복호화에 대하여 템플릿 매칭 기반 인트라 잔차 신호 예측이 수행되는 영상 복호화 방법.
According to paragraph 1,
A video decoding method in which template matching-based intra residual signal prediction is performed for the decoding.
제1항에 있어서,
상기 복호화에 대하여 인터 및 템플릿 매칭의 블랜딩 예측이 사용되는 영상 복호화 방법.
According to paragraph 1,
A video decoding method in which blending prediction of inter and template matching is used for the decoding.
대상 블록에 대한 템플릿을 결정하는 단계;
템플릿 매칭 참조 영상을 선택하는 단계;
상기 템플릿을 사용하여 상기 템플릿 매칭 참조 영상 내에서 템플릿 매칭 최적 블록을 탐색하는 단계; 및
상기 탬플릿 매칭 최적 블록을 사용하는 부호화를 수행하는 단계
를 포함하는 영상 부호화 방법.
determining a template for a target block;
selecting a template matching reference image;
Searching for an optimal template matching block within the template matching reference image using the template; and
Performing encoding using the template matching optimal block
A video encoding method including.
제8항에 있어서,
상기 템플릿을 생성함에 있어서 서브샘플링이 사용되는 영상 부호화 방법.
According to clause 8,
A video encoding method in which subsampling is used in generating the template.
제8항에 있어서,
복수의 템플릿 매칭 참조 영상 구성 방법들 중 복수의 템플릿 매칭 참조 영상 구성 방법이 상기 템플릿 매칭 참조 영상의 선택을 위해 선택되는 영상 부호화 방법.
According to clause 8,
An image encoding method in which a plurality of template matching reference image construction methods among a plurality of template matching reference image construction methods are selected to select the template matching reference image.
제8항에 있어서,
서로 다른 형태를 갖는 탐색 영역들 중 하나의 탐색 영역이 상기 탬플릿 매칭 최적 블록을 도출하기 위한 탐색 영역으로서 선택되는 영상 부호화 방법.
According to clause 8,
A video encoding method in which one search area among search areas having different shapes is selected as a search area for deriving the template matching optimal block.
제8항에 있어서,
상기 탬플릿 매칭 최적 블록을 도출하기 위한 탐색 영역의 템플릿 매칭 탐색 시작 점이 설정되는 영상 부호화 방법.
According to clause 8,
A video encoding method in which a template matching search starting point in a search area for deriving the template matching optimal block is set.
제8항에 있어서,
상기 복호화에 대하여 템플릿 매칭 기반 인트라 잔차 신호 예측이 수행되는 영상 부호화 방법.
According to clause 8,
A video encoding method in which template matching-based intra residual signal prediction is performed for the decoding.
제8항에 있어서,
상기 부호화에 대하여 인터 및 템플릿 매칭의 블랜딩 예측이 사용되는 영상 복호화 방법.
According to clause 8,
A video decoding method in which blending prediction of inter and template matching is used for the encoding.
제8항의 영상 부호화 방법에 의해 생성된 비트스트림을 저장하는 컴퓨터 판독 가능한 기록 매체.A computer-readable recording medium storing a bitstream generated by the video encoding method of claim 8. 영상 복호화를 위한 비트스트림을 저장하는 컴퓨터 판독 가능한 기록 매체에 있어서, 상기 비트스트림은,
코딩 정보
를 포함하고,
대상 블록에 대한 템플릿이 결정되고,
템플릿 매칭 참조 영상이 선택되고,
상기 템플릿을 사용하여 상기 템플릿 매칭 참조 영상 내에서 템플릿 매칭 최적 블록을 탐색되고,
상기 탬플릿 매칭 최적 블록을 사용하는 복호화가 수행되고,
상기 코딩 정보는 상기 템플릿의 결정, 상기 참조 영상의 선택, 상기 템플릿 매칭 최적 블록의 도출 및 상기 복호화 중 적어도 하나에 대하여 사용되는 컴퓨터 판독 가능한 기록 매체.
In the computer-readable recording medium storing a bitstream for video decoding, the bitstream includes:
coding information
Including,
The template for the target block is determined,
A template matching reference image is selected,
Using the template, an optimal template matching block is searched within the template matching reference image,
Decryption using the template matching optimal block is performed,
The coding information is used for at least one of determining the template, selecting the reference image, deriving the optimal block matching the template, and decoding.
제16항에 있어서,
상기 템플릿을 생성함에 있어서 서브샘플링이 사용되는 컴퓨터 판독 가능한 기록 매체.
According to clause 16,
A computer-readable recording medium in which subsampling is used in generating the template.
제16항에 있어서,
복수의 템플릿 매칭 참조 영상 구성 방법들 중 복수의 템플릿 매칭 참조 영상 구성 방법이 상기 템플릿 매칭 참조 영상의 선택을 위해 선택되는 컴퓨터 판독 가능한 기록 매체.
According to clause 16,
A computer-readable recording medium in which a plurality of template matching reference image construction methods are selected among a plurality of template matching reference image construction methods to select the template matching reference image.
제16항에 있어서,
서로 다른 형태를 갖는 탐색 영역들 중 하나의 탐색 영역이 상기 탬플릿 매칭 최적 블록을 도출하기 위한 탐색 영역으로서 선택되는 컴퓨터 판독 가능한 기록 매체.
According to clause 16,
A computer-readable recording medium in which one search area among search areas having different shapes is selected as a search area for deriving the optimal template matching block.
제16항에 있어서,
상기 탬플릿 매칭 최적 블록을 도출하기 위한 탐색 영역의 템플릿 매칭 탐색 시작 점이 설정되는 컴퓨터 판독 가능한 기록 매체.
According to clause 16,
A computer-readable recording medium in which a template matching search starting point of a search area for deriving the template matching optimal block is set.
KR1020230133679A 2022-10-07 2023-10-06 Method, apparatus and recording medium for encoding/decoding image KR20240049203A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/KR2023/015465 WO2024076220A1 (en) 2022-10-07 2023-10-06 Method, device, and recording medium for image encoding/decoding

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
KR1020220128597 2022-10-07
KR20220128597 2022-10-07

Publications (1)

Publication Number Publication Date
KR20240049203A true KR20240049203A (en) 2024-04-16

Family

ID=90882537

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020230133679A KR20240049203A (en) 2022-10-07 2023-10-06 Method, apparatus and recording medium for encoding/decoding image

Country Status (1)

Country Link
KR (1) KR20240049203A (en)

Similar Documents

Publication Publication Date Title
KR102668840B1 (en) Method and apparatus for using inter prediction information
KR102643116B1 (en) Method and apparatus for encoding/decoding image, recording medium for stroing bitstream
KR102504643B1 (en) Method and apparatus for prediction based on block shape
KR102262554B1 (en) Method and apparatus for encoding and decoding image using prediction network
KR20180107761A (en) Method and apparatus for prediction using reference block
KR102549488B1 (en) Method and apparatus for using inter prediction information
KR102402539B1 (en) Method and apparatus for bi-directional intra prediction
KR20220136316A (en) Method and apparatus for prediction using reference block
KR20220082791A (en) Method and apparatus for derivation of motion prediction information
KR20210011898A (en) Method, apparatus and recording medium for encoding/decoding image using geometric partitioning
KR20230035288A (en) Method, apparatus and recording medium for encoding/decoding image using palette mode
KR20220089685A (en) Method, apparatus and recording medium for encoding/decoding image using partitioning
KR20220040406A (en) Method, apparatus and recording medium for encoding/decoding image
KR20190091217A (en) Method and apparatus for image encoding and image decoding based on temporal motion information
KR20210125944A (en) Method, apparatus and recording medium for encoding/decoding image using merge mode
KR20210154760A (en) Method, apparatus and recording medium for encoding/decoding image
KR20210125920A (en) Method, apparatus and recording medium for encoding/decoding image using geometrical partitioning
KR20200145780A (en) Method and apparatus for image encoding and image decoding using prediction based on block shape
KR20210063276A (en) Method, apparatus and recoding medium for video processing using motion prediction model
KR20200145778A (en) Method, apparatus and recording medium for encoding/decoding image using affine transform
KR20240049203A (en) Method, apparatus and recording medium for encoding/decoding image
KR102505301B1 (en) Method, apparatus and recording medium for encoding/decoding image using palette mode
KR20230047038A (en) Method, apparatus and recording medium for encoding/decoding image
KR20240051878A (en) Method, apparatus and recording medium for encoding/decoding image
KR20230144972A (en) Method, apparatus and recording medium for encoding/decoding image