KR20130124920A - Method and apparatus for image encoding/decoding - Google Patents

Method and apparatus for image encoding/decoding Download PDF

Info

Publication number
KR20130124920A
KR20130124920A KR1020130051518A KR20130051518A KR20130124920A KR 20130124920 A KR20130124920 A KR 20130124920A KR 1020130051518 A KR1020130051518 A KR 1020130051518A KR 20130051518 A KR20130051518 A KR 20130051518A KR 20130124920 A KR20130124920 A KR 20130124920A
Authority
KR
South Korea
Prior art keywords
block
mode
intra prediction
prediction mode
signal
Prior art date
Application number
KR1020130051518A
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 한국전자통신연구원
Publication of KR20130124920A publication Critical patent/KR20130124920A/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • H04N19/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/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/157Assigned coding mode, i.e. the coding mode being predefined or preselected to be further used for selection of another element or parameter
    • H04N19/159Prediction type, e.g. intra-frame, inter-frame or bidirectional frame prediction

Landscapes

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

Abstract

The present invention discloses an image coding/decoding method and a device. An image coding device (100) comprises a movement prediction part (111), a movement compensation part (112), an intra prediction part (120), a switch (115), a subtractor (125), a conversion part (130), quantization part (140), an entropy coding part. [Reference numerals] (AA) Start;(S1200) Intra && is the present block 4�4 size?;(S1210) Brightness?;(S1220) Mode = an intra prediction mode for a brightness signal;(S1240) Horizontal direction = DST, Vertical direction = DST;(S1250) Horizontal direction = DCT, Vertical direction = DCT

Description

영상 부호화/복호화 방법 및 장치{METHOD AND APPARATUS FOR IMAGE ENCODING/DECODING}METHOD AND APPARATUS FOR IMAGE ENCODING / DECODING [0002]

본 발명은 영상의 부호화/복호화에 관한 것으로, 보다 상세하게는 잔여 신호에 대한 변환/스캔 방법에 관한 것이다. The present invention relates to encoding / decoding of an image, and more particularly, to a transform / scan method for a residual signal.

최근 HD(High Definition) 해상도(1280x1024 혹은 1920x1080)를 가지는 방송 서비스가 국내뿐만 아니라 세계적으로 확대되고 있다. 이에 따라 많은 사용자들이 고해상도, 고화질의 영상에 많이 익숙해지고 있으며 그에 발맞춰서 많은 기관에서는 차세대 영상기기에 대한 개발에 박차를 가하고 있다. 또한 HDTV와 더불어 HDTV의 4배 이상의 해상도를 갖는 UHD(Ultra High Definition)에 대한 관심이 증대되면서 동영상 표준화 단체들은 보다 높은 해상도, 고화질의 영상에 대한 압축기술의 필요성을 인식하게 되었다. 또한 현재 HDTV, 휴대전화, 블루레이 플레이어에 사용되는 H.264/AVC보다 높은 압축 효율을 통해 동일한 화질을 유지하면서도 주파수 대역이나 저장 측면에서 많은 이득을 얻을 수 있는 새로운 표준이 절실한 실정이다. Recently, a broadcast service having a high definition (HD) resolution (1280x1024 or 1920x1080) has been expanding worldwide as well as in Korea. As a result, many users are getting used to high resolution and high quality video, and many institutions are accelerating the development of next generation video equipment. In addition, as interest in UHD (Ultra High Definition) with resolution more than four times that of HDTV with HDTV increased, video standardization organizations became aware of the necessity of compression technology for higher resolution, high image quality. In addition, there is a need for a new standard that can achieve the same picture quality through the compression efficiency higher than H.264 / AVC used in HDTV, cell phone, and Blu-ray player,

현재 MPEG(Moving Picture Experts Group)과 VCEG(Video Coding Experts Group)는 공동으로 차세대 비디오 코덱인 HEVC(High Efficiency Video Coding)를 표준화하고 있으며, UHD 영상까지 포함한 영상을 H.264/AVC 대비 2배의 압축효율로 부호화를 하는 것을 목표로 하고 있다. 이는 HD, UHD 영상뿐만 아니라 3D 방송 및 이동통신망에서도 현재보다 낮은 주파수로 고화질의 영상을 제공할 수 있다.Currently, Moving Picture Experts Group (MPEG) and Video Coding Experts Group (VCEG) jointly standardize High Efficiency Video Coding (HEVC), the next generation video codec. The video including UHD video is twice as high as H.264 / AVC And aims at encoding with compression efficiency. In addition to HD and UHD images, 3D broadcasting and mobile communication networks can provide high-quality images at lower frequencies.

본 발명은 부호화/복호화 효율을 향상시킬 수 있는 영상 부호화/복호화 방법 및 장치를 제공한다.The present invention provides an image encoding / decoding method and apparatus capable of improving encoding / decoding efficiency.

본 발명은 부호화/복호화 효율을 향상시킬 수 있는 잔여 신호의 변환 방법 및 장치를 제공한다.The present invention provides a method and apparatus for converting a residual signal capable of improving encoding / decoding efficiency.

본 발명은 부호화/복호화 효율을 향상시킬 수 있는 잔여 신호의 스캔 방법 및 장치를 제공한다. The present invention provides a method and apparatus for scanning a residual signal capable of improving encoding / decoding efficiency.

본 발명의 일 양태에 따르면, 영상 복호화 방법이 제공된다. 상기 방법은 인트라 예측 모드의 방향성을 기반으로 소정의 그룹으로 분류하는 단계 및 상기 분류된 소정의 그룹 각각에 대해 주파수 변환 방식을 결정하는 단계를 포함한다. According to one aspect of the present invention, an image decoding method is provided. The method includes classifying into a predetermined group based on the directionality of the intra prediction mode and determining a frequency conversion scheme for each of the classified predetermined groups.

잔여 신호의 인트라 예측 모드에 따라 그룹핑을 수행하고, 각 그룹에 대해 서로 다른 주파수 변환 방식 및/또는 스캔 방향을 유도함으로써, 잔여 신호에 대한 부호화 효율을 높일 수 있다.By performing grouping according to the intra prediction mode of the residual signal and inducing different frequency conversion schemes and / or scan directions for each group, encoding efficiency of the residual signal may be increased.

도 1은 본 발명이 적용되는 영상 부호화 장치의 일 실시예에 따른 구성을 나타내는 블록도이다.
도 2는 본 발명이 적용되는 영상 복호화 장치의 일 실시예에 따른 구성을 나타내는 블록도이다.
도 3은 영상을 부호화할 때 영상의 분할 구조를 개략적으로 나타내는 도면이다.
도 4는 코딩 유닛(CU)이 포함할 수 있는 예측 유닛(PU)의 형태를 도시한 도면이다.
도 5는 코딩 유닛(CU)이 포함할 수 있는 변환 유닛(TU)의 형태를 도시한 도면이다.
도 6은 인트라 예측 모드의 일예를 도시한 도면이다.
도 7은 색차 신호를 예측하여 부호화하는 방법을 설명하기 위한 도면이다.
도 8은 변환 계수에 대한 상단 우측(Up-right) 스캔 방법의 일예를 나타내는 도면이다.
도 9는 인트라 에측 모드에 따른 스캔 방향을 결정하는 방법의 일 실시예를 나타내는 순서도이다.
도 10은 인트라 예측 모드에 따른 스캔 방향을 결정하는 방법의 다른 실시예를 나타내는 순서도이다.
도 11은 잔여 신호(잔여 영상)에 대한 주파수 변환 방식을 선택하는 방법의 일예를 나타내는 순서도이다.
도 12는 본 발명의 일 실시예에 따른 인트라 예측 모드에 따라 변환 방식을 결정하는 과정을 나타내는 순서도이다.
도 13은 본 발명의 다른 실시예에 따른 인트라 예측 모드에 따라 변환 방식을 결정하는 과정을 나타내는 순서도이다.
도 14는 본 발명의 실시예에 따라 주파수 변환 방식의 적용 범위를 결정하는 방법을 설명하기 위한 휘도 블록과 색차 블록 간의 해상도 차이의 일예를 도시한 도면이다.
도 15는 본 발명의 실시예에 따라 주파수 변환 방식의 적용 범위를 결정하는 방법을 설명하기 위한 휘도 블록과 색차 블록 간의 해상도 차이의 다른 예를 도시한 도면이다.
도 16은 본 발명의 일 실시예에 따른 인트라 예측 모드에 따라 스캔 방식을 결정하는 과정을 나타내는 순서도이다.
1 is a block diagram illustrating a configuration of an image encoding apparatus according to an embodiment of the present invention.
2 is a block diagram illustrating a configuration of an image decoding apparatus according to an embodiment of the present invention.
3 is a diagram schematically illustrating a segmentation structure of an image when an image is encoded.
4 is a diagram illustrating a form of a prediction unit PU that a coding unit CU may include.
FIG. 5 is a diagram illustrating a form of a transform unit (TU) that a coding unit CU may include.
6 is a diagram illustrating an example of an intra prediction mode.
7 is a diagram for describing a method of predicting and encoding a color difference signal.
8 is a diagram illustrating an example of an up-right scan method for transform coefficients.
9 is a flowchart illustrating an embodiment of a method of determining a scan direction according to an intra side mode.
10 is a flowchart illustrating another embodiment of a method of determining a scan direction according to an intra prediction mode.
11 is a flowchart illustrating an example of a method of selecting a frequency conversion method for a residual signal (residual image).
12 is a flowchart illustrating a process of determining a transformation scheme according to an intra prediction mode according to an embodiment of the present invention.
13 is a flowchart illustrating a process of determining a transformation scheme according to an intra prediction mode according to another embodiment of the present invention.
14 is a diagram illustrating an example of a resolution difference between a luminance block and a chrominance block for explaining a method of determining an application range of a frequency conversion method according to an embodiment of the present invention.
FIG. 15 is a diagram illustrating another example of a resolution difference between a luminance block and a chrominance block for explaining a method of determining an application range of a frequency conversion method according to an embodiment of the present invention.
16 is a flowchart illustrating a process of determining a scan method according to an intra prediction mode according to an embodiment of the present invention.

이하, 도면을 참조하여 본 발명의 실시 형태에 대하여 구체적으로 설명한다. 본 명세서의 실시예를 설명함에 있어, 관련된 공지 구성 또는 기능에 대한 구체적인 설명이 본 명세서의 요지를 흐릴 수 있다고 판단되는 경우에는 해당 설명을 생략할 수도 있다.Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. In describing the embodiments of the present specification, when it is determined that a detailed description of a related well-known configuration or function may obscure the gist of the present specification, the description may be omitted.

본 명세서에서 어떤 구성 요소가 다른 구성 요소에 연결되어 있다거나 접속되어 있다고 언급된 때에는, 그 다른 구성 요소에 직접적으로 연결되어 있거나 또는 접속되어 있는 것을 의미할 수도 있고, 중간에 다른 구성 요소가 존재하는 것을 의미할 수도 있다. 아울러, 본 명세서에서 특정 구성을 포함한다고 기술하는 내용은 해당 구성 이외의 구성을 배제하는 것이 아니며, 추가적인 구성이 본 발명의 실시 또는 본 발명의 기술적 사상의 범위에 포함될 수 있음을 의미한다.When an element is referred to herein as being connected or connected to another element, it may mean directly connected or connected to the other element, It may mean something. In addition, the content described as including a specific configuration in this specification does not exclude a configuration other than the configuration, it means that additional configuration may be included in the scope of the technical idea of the present invention or the present invention.

제1, 제2 등의 용어는 다양한 구성들을 설명하는데 사용될 수 있지만, 상기 구성들은 상기 용어에 의해 한정되지 않는다. 상기 용어들은 하나의 구성을 다른 구성으로부터 구별하는 목적으로 사용된다. 예를 들어, 본 발명의 권리 범위를 벗어나지 않으면서 제1 구성은 제2 구성으로 명명될 수 있고, 유사하게 제2 구성도 제1 구성으로 명명될 수 있다.Terms such as first and second may be used to describe various configurations, but the configurations are not limited by the terms. The terms are used to distinguish one configuration from another. For example, without departing from the scope of the present invention, the first configuration may be referred to as the second configuration, and similarly, the second configuration may also be referred to as the first configuration.

또한 본 발명의 실시예에 나타나는 구성부들은 서로 다른 특징적인 기능을 나타내기 위해 독립적으로 도시되는 것으로, 각 구성부들이 분리된 하드웨어나 하나의 소프트웨어 구성 단위로 이루어짐을 의미하지 않는다. 즉, 각 구성부는 설명의 편의상 각각의 구성부로 나열하여 포함한 것으로 각 구성부 중 적어도 두 개의 구성부가 하나의 구성부를 이루거나, 하나의 구성부가 복수 개의 구성부로 나뉘어져 기능을 수행할 수 있다. 각 구성부의 통합된 실시예 및 분리된 실시예도 본 발명의 본질에서 벗어나지 않는 한 본 발명의 권리 범위에 포함된다.In addition, the components shown in the embodiments of the present invention are independently shown to represent different characteristic functions, and do not mean that each component is made of separate hardware or one software component unit. In other words, each component is listed as a component for convenience of description, and at least two of the components may form one component, or one component may be divided into a plurality of components to perform a function. The integrated and separated embodiments of each component are also included in the scope of the present invention without departing from the spirit of the present invention.

또한, 일부의 구성 요소는 본 발명에서 본질적인 기능을 수행하는 필수적인 구성 요소는 아니고 단지 성능을 향상시키기 위한 선택적 구성 요소일 수 있다. 본 발명은 단지 성능 향상을 위해 사용되는 구성 요소를 제외한 본 발명의 본질을 구현하는데 필수적인 구성부만을 포함하여 구현될 수 있고, 단지 성능 향상을 위해 사용되는 선택적 구성 요소를 제외한 필수 구성 요소만을 포함한 구조도 본 발명의 권리범위에 포함된다.
In addition, some of the components are not essential components to perform essential functions in the present invention, but may be optional components only to improve performance. The present invention can be implemented only with components essential for realizing the essence of the present invention, except for the components used for the performance improvement, and can be implemented by only including the essential components except the optional components used for performance improvement Are also included in the scope of the present invention.

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

도 1을 참조하면, 영상 부호화 장치(100)는 움직임 예측부(111), 움직임 보상부(112), 인트라 예측부(120), 스위치(115), 감산기(125), 변환부(130), 양자화부(140), 엔트로피 부호화부(150), 역양자화부(160), 역변환부(170), 가산기(175), 필터부(180) 및 참조 영상 버퍼(190)를 포함한다.1, the image encoding apparatus 100 includes a motion prediction unit 111, a motion compensation unit 112, an intra prediction unit 120, a switch 115, a subtractor 125, a transform unit 130, A quantization unit 140, an entropy encoding unit 150, an inverse quantization unit 160, an inverse transformation unit 170, an adder 175, a filter unit 180, and a reference image buffer 190.

영상 부호화 장치(100)는 입력 영상에 대해 인트라(intra) 모드 또는 인터(inter) 모드로 부호화를 수행하고 비트스트림을 출력할 수 있다. 인트라 모드인 경우 스위치(115)가 인트라로 전환되고, 인터 모드인 경우 스위치(115)가 인터로 전환될 수 있다. 인트라 예측은 화면 내 예측, 인터 예측은 화면 간 예측을 의미한다. 영상 부호화 장치(100)는 입력 영상의 입력 블록에 대한 예측 블록을 생성한 후, 입력 블록과 예측 블록의 차분(residual)을 부호화할 수 있다. 이때, 입력 영상은 원 영상(original picture)를 의미할 수 있다. The image encoding apparatus 100 may encode an input image in an intra mode or an inter mode and output a bit stream. In the intra mode, the switch 115 is switched to the intra mode, and in the inter mode, the switch 115 can be switched to the inter mode. Intra prediction is intra prediction, and inter prediction is inter prediction. The image encoding apparatus 100 may generate a prediction block for an input block of an input image, and then may code a residual between the input block and the prediction block. At this time, the input image may mean an original picture.

인트라 모드인 경우, 인트라 예측부(120)는 현재 블록 주변의 이미 부호화/복호화된 블록의 픽셀값을 이용하여 공간적 예측을 수행하여 예측 블록을 생성할 수 있다.In the intra mode, the intra predictor 120 may generate a prediction block by performing spatial prediction using pixel values of blocks that are already encoded / decoded around the current block.

인터 모드인 경우, 움직임 예측부(111)는, 움직임 예측 과정에서 참조 픽처 버퍼(190)에 저장되어 있는 참조 영상에서 입력 블록과 가장 매치가 잘 되는 영역을 찾아 움직임 벡터를 구할 수 있다. 움직임 보상부(112)는 움직임 벡터를 이용하여 움직임 보상을 수행함으로써 예측 블록을 생성할 수 있다. 여기서, 움직임 벡터는 인터 예측에 사용되는 2차원 벡터이며, 현재 부호화/복호화 대상 영상과 참조 영상 사이의 오프셋을 나타낼 수 있다.In the inter mode, the motion predicting unit 111 can obtain a motion vector by searching an area of the reference picture stored in the reference picture buffer 190 that is best matched with the input block. The motion compensation unit 112 may generate a prediction block by performing motion compensation using a motion vector. Here, the motion vector is a two-dimensional vector used for inter prediction, and can represent an offset between the current image to be encoded / decoded and the reference image.

감산기(125)는 입력 블록과 생성된 예측 블록의 차분에 의해 잔차 블록(residual block)을 생성할 수 있다. The subtractor 125 may generate a residual block by a difference between the input block and the generated prediction block.

변환부(130)는 잔차 블록에 대해 변환(transform)을 수행하여 변환 계수(transform coefficient)를 출력할 수 있다. 그리고 양자화부(140)는 입력된 변환 계수를 양자화 파라미터(quantization parameter, 또는 양자화 매개변수)에 따라 양자화하여 양자화된 계수(quantized coefficient)를 출력할 수 있다.The transforming unit 130 may perform a transform on the residual block to output a transform coefficient. The quantization unit 140 may quantize the input transform coefficients according to a quantization parameter (or a quantization parameter) to output a quantized coefficient.

엔트로피 부호화부(150)는, 양자화부(140)에서 산출된 값들 또는 부호화 과정에서 산출된 부호화 파라미터 값 등을 기초로 엔트로피 부호화를 수행하여 비트스트림(bit stream)을 출력할 수 있다. 엔트로피 부호화가 적용되는 경우, 높은 발생 확률을 갖는 심볼(symbol)에 적은 수의 비트가 할당되고 낮은 발생 확률을 갖는 심볼에 많은 수의 비트가 할당되어 심볼이 표현됨으로써, 부호화 대상 심볼들에 대한 비트열의 크기가 감소될 수 있다. 따라서 엔트로피 부호화를 통해서 영상 부호화의 압축 성능이 높아질 수 있다. 엔트로피 부호화부(150)는 엔트로피 부호화를 위해 지수-골롬(Exponential-Golomb), CAVLC(Context-Adaptive Variable Length Coding), CABAC(Context-Adaptive Binary Arithmetic Coding)과 같은 부호화 방법을 사용할 수 있다.The entropy encoding unit 150 may output a bit stream by performing entropy encoding based on the values calculated by the quantization unit 140 or the encoding parameter values calculated in the encoding process. When entropy encoding is applied, a small number of bits are allocated to a symbol having a high probability of occurrence, and a large number of bits are allocated to a symbol having a low probability of occurrence, thereby expressing symbols, The size of the column can be reduced. Therefore, the compression performance of the image encoding can be enhanced through the entropy encoding. The entropy encoding unit 150 may use an encoding method such as Exponential-Golomb, Context-Adaptive Variable Length Coding (CAVLC), and Context-Adaptive Binary Arithmetic Coding (CABAC) for entropy encoding.

도 1의 실시예에 따른 영상 부호화 장치(100)는 인터 예측 부호화, 즉 화면 간 예측 부호화를 수행하므로, 현재 부호화된 영상은 참조 영상으로 사용되기 위해 복호화되어 저장될 필요가 있다. 따라서 양자화된 계수는 역양자화부(160)에서 역양자화되고 역변환부(170)에서 역변환된다. 역양자화, 역변환된 계수는 가산기(175)를 통해 예측 블록과 더해지고 복원 블록이 생성된다.Since the image encoding apparatus 100 according to the embodiment of FIG. 1 performs inter-prediction encoding, that is, inter-view prediction encoding, the currently encoded image needs to be decoded and stored for use as a reference image. Accordingly, the quantized coefficients are inversely quantized in the inverse quantization unit 160 and inversely transformed in the inverse transformation unit 170. The inverse quantized and inverse transformed coefficients are added to the prediction block through the adder 175 and a reconstruction block is generated.

복원 블록은 필터부(180)를 거치고, 필터부(180)는 디블록킹 필터(deblocking filter), SAO(Sample Adaptive Offset), ALF(Adaptive Loop Filter) 중 적어도 하나 이상을 복원 블록 또는 복원 픽처에 적용할 수 있다. 필터부(180)는 적응적 인루프(in-loop) 필터로 불릴 수도 있다. 디블록킹 필터는 블록 간의 경계에 생긴 블록 왜곡을 제거할 수 있다. SAO는 코딩 에러를 보상하기 위해 픽셀값에 적정 오프셋(offset) 값을 더해줄 수 있다. ALF는 복원된 영상과 원래의 영상을 비교한 값을 기초로 필터링을 수행할 수 있다. 필터부(180)를 거친 복원 블록은 참조 픽처 버퍼(190)에 저장될 수 있다.
The restoration block passes through the filter unit 180 and the filter unit 180 applies at least one of a deblocking filter, a sample adaptive offset (SAO), and an adaptive loop filter (ALF) can do. The filter unit 180 may be referred to as an adaptive in-loop filter. The deblocking filter can remove block distortion occurring at the boundary between the blocks. The SAO may add a proper offset value to the pixel value to compensate for coding errors. ALF can perform filtering based on the comparison between the reconstructed image and the original image. The reconstruction block having passed through the filter unit 180 can be stored in the reference picture buffer 190.

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

도 2를 참조하면, 영상 복호화 장치(200)는 엔트로피 복호화부(210), 역양자화부(220), 역변환부(230), 인트라 예측부(240), 움직임 보상부(250), 가산기(255), 필터부(260) 및 참조 픽처 버퍼(270)를 포함한다.2, the image decoding apparatus 200 includes an entropy decoding unit 210, an inverse quantization unit 220, an inverse transform unit 230, an intra prediction unit 240, a motion compensation unit 250, an adder 255 A filter unit 260, and a reference picture buffer 270.

영상 복호화 장치(200)는 부호화기에서 출력된 비트스트림을 입력 받아 인트라 모드 또는 인터 모드로 복호화를 수행하고 재구성된 영상, 즉 복원 영상을 출력할 수 있다. 인트라 모드인 경우 스위치가 인트라로 전환되고, 인터 모드인 경우 스위치가 인터로 전환될 수 있다. The video decoding apparatus 200 receives the bit stream output from the encoder and decodes the video stream into the intra mode or the inter mode, and outputs the reconstructed video, that is, the reconstructed video. In the intra mode, the switch is switched to the intra mode, and in the inter mode, the switch can be switched to the inter mode.

영상 복호화 장치(200)는 입력 받은 비트스트림으로부터 복원된 잔차 블록(reconstructed residual block)을 얻고 예측 블록을 생성한 후 복원된 잔차 블록과 예측 블록을 더하여 재구성된 블록, 즉 복원 블록을 생성할 수 있다.The image decoding apparatus 200 may obtain a reconstructed residual block from the input bitstream, generate a prediction block, and add the reconstructed residual block and the prediction block to generate a reconstructed block, i.e., a reconstructed block .

엔트로피 복호화부(210)는, 입력된 비트스트림을 확률 분포에 따라 엔트로피 복호화하여, 양자화된 계수(quantized coefficient) 형태의 심볼을 포함한 심볼들을 생성할 수 있다.The entropy decoding unit 210 may entropy-decode the input bitstream according to a probability distribution to generate symbols including a symbol of a quantized coefficient type.

엔트로피 복호화 방법이 적용되는 경우, 높은 발생 확률을 갖는 심볼에 적은 수의 비트가 할당되고 낮은 발생 확률을 갖는 심볼에 많은 수의 비트가 할당되어 심볼이 표현됨으로써, 각 심볼들에 대한 비트열의 크기가 감소될 수 있다.When the entropy decoding method is applied, a small number of bits are assigned to a symbol having a high probability of occurrence, and a large number of bits are assigned to a symbol having a low probability of occurrence, so that the size of a bit string for each symbol is Can be reduced.

양자화된 계수는 역양자화부(220)에서 역양자화되고 역변환부(230)에서 역변환되며, 양자화된 계수가 역양자화/역변환 된 결과, 복원된 잔차 블록이 생성될 수 있다.The quantized coefficients are inversely quantized in the inverse quantization unit 220 and inversely transformed in the inverse transformation unit 230. The reconstructed residual block can be generated as a result of inverse quantization / inverse transformation of the quantized coefficients.

인트라 모드인 경우, 인트라 예측부(240)는 현재 블록 주변의 이미 복호화된 블록의 픽셀값을 이용하여 공간적 예측을 수행하여 예측 블록을 생성할 수 있다. 인터 모드인 경우, 움직임 보상부(250)는 움직임 벡터 및 참조 픽처 버퍼(270)에 저장되어 있는 참조 영상을 이용하여 움직임 보상을 수행함으로써 예측 블록을 생성할 수 있다.In the intra mode, the intraprediction unit 240 may generate a prediction block by performing spatial prediction using the pixel value of the already decoded block around the current block. In the inter mode, the motion compensation unit 250 may generate a prediction block by performing motion compensation using a motion vector and a reference image stored in the reference picture buffer 270. [

잔차 블록과 예측 블록은 가산기(255)를 통해 더해지고, 더해진 블록은 필터부(260)를 거칠 수 있다. 필터부(260)는 디블록킹 필터, SAO, ALF 중 적어도 하나 이상을 복원 블록 또는 복원 픽쳐에 적용할 수 있다. 필터부(260)는 재구성된 영상, 즉 복원 영상을 출력할 수 있다. 복원 영상은 참조 픽처 버퍼(270)에 저장되어 인터 예측에 사용될 수 있다.
The residual block and the prediction block are added through the adder 255, and the added block can be passed through the filter unit 260. [ The filter unit 260 may apply at least one of a deblocking filter, SAO, and ALF to a restoration block or a restored picture. The filter unit 260 may output a reconstructed image, that is, a reconstructed image. The reconstructed image is stored in the reference picture buffer 270 and can be used for inter prediction.

도 3은 영상을 부호화할 때 영상의 분할 구조를 개략적으로 나타내는 도면이다. 3 is a diagram schematically illustrating a segmentation structure of an image when an image is encoded.

HEVC(High Efficiency Video Coding)에서는 영상을 효율적으로 분할하기 위해 코딩 유닛(Coding Unit; CU)으로 부호화를 수행한다. In High Efficiency Video Coding (HEVC), coding is performed by a coding unit (CU) in order to efficiently divide an image.

도 3을 참조하면, HEVC에서는 영상(300)을 최대 코딩 유닛(Largest Coding Unit; LCU)(이하, LCU라 함) 단위로 순차적으로 분할한 후, LCU 단위로 분할 구조를 결정한다. 분할 구조는 LCU(310) 내에서 영상을 효율적으로 부호화하기 위한 코딩 유닛(이하, CU라 함)의 분포를 의미하며, 이러한 분포는 하나의 CU를 그 가로 크기 및 세로 크기의 절반으로 감소된 4개의 CU로 분할할지 여부에 따라 결정될 수 있다. 분할된 CU는 동일한 방식으로 분할된 CU에 대해서 그 가로 크기 및 세로 크기가 절반씩 감소된 4개의 CU로 재귀적으로 분할될 수 있다. Referring to FIG. 3, in HEVC, an image 300 is sequentially divided into units of a largest coding unit (LCU) (hereinafter referred to as an LCU), and then a division structure is determined by an LCU unit. The partition structure refers to a distribution of coding units (hereinafter, referred to as CUs) for efficiently encoding an image in the LCU 310, which is reduced to one CU by half of its horizontal and vertical sizes. It may be determined according to whether to split into CUs. The partitioned CU may be recursively divided into four CUs whose horizontal size and vertical size are reduced by half with respect to the CU partitioned in the same manner.

이때, CU의 분할은 미리 정의된 깊이까지 재귀적으로 분할될 수 있다. 깊이 정보는 CU의 크기를 나타내는 정보로써, 각 CU마다 저장되어 있다. 예컨대, LCU의 깊이는 0이고, SCU의 깊이는 미리 정의된 최대 깊이일 수 있다. 여기서, LCU는 상술한 바와 같이 최대 코딩 유닛 크기를 가지는 코딩 유닛이며, SCU(Smallest Coding Unit)는 최소 코딩 유닛 크기를 가지는 코딩 유닛이다. At this time, the division of the CU can be recursively divided to a predetermined depth. The depth information is information indicating the size of the CU, and is stored for each CU. For example, the depth of the LCU may be zero, and the depth of the SCU may be a predefined maximum depth. Here, the LCU is a coding unit having a maximum coding unit size as described above, and the Smallest Coding Unit (SCU) is a coding unit having a minimum coding unit size.

LCU(310)로부터 가로 및 세로 크기의 절반으로 분할을 수행할 때마다 CU의 깊이는 1씩 증가한다. 각각의 깊이 별로, 분할을 수행하지 않는 CU의 경우에는 2Nx2N 크기로, 분할을 수행하는 CU의 경우에는 분할되어 4개의 NxN 크기 CU가 된다. N의 크기는 깊이가 1씩 증가할 때마다 절반으로 감소한다. Each time the division from the LCU 310 to half of the horizontal and vertical sizes increases the depth of the CU by one. For each depth, the size of the CU that does not perform the division is 2Nx2N, and the size of the CU that performs the division is divided into 4 NxN size CUs. The size of N decreases by half every time the depth increases by one.

도 3을 참조하면, 최소 깊이가 0인 LCU의 크기는 64x64 화소이고, 최대 깊이가 3인 SCU의 크기는 8x8 화소일 수 있다. 이때, 64x64 화소의 CU(LCU)는 깊이 0으로, 32x32 화소의 CU는 깊이 1로, 16x16 화소의 CU는 깊이 2로, 8x8 화소의 CU(SCU)는 깊이 3으로 표현될 수 있다. Referring to FIG. 3, an LCU having a minimum depth of 0 may be 64x64 pixels, and an SCU having a maximum depth of 3 may be 8x8 pixels. At this time, the CU (LCU) of 64x64 pixels can be represented by depth 0, the CU of 32x32 pixels by depth 1, the CU of 16x16 pixels by depth 2, and the CU (SCU) of 8x8 pixel by depth 3. [

또한, 특정 CU를 분할할지에 대한 정보는 CU마다 1비트의 분할 정보를 통해 표현될 수 있다. 이 분할 정보는 SCU를 제외한 모든 CU에 포함될 수 있으며, 예컨대 CU를 분할하지 않을 경우에는 분할 정보에 0을 저장할 수 있고, CU를 분할할 경우에는 분할 정보에 1을 저장할 수 있다.
In addition, information on whether to divide a specific CU can be expressed through division information of 1 bit for each CU. This division information can be included in all the CUs except for the SCU. For example, when the CU is not divided, 0 can be stored in the division information, and when the CU is divided, 1 can be stored in the division information.

한편, LCU로부터 분할된 CU는 예측을 위한 기본 단위인 예측 유닛(Prediction Unit; PU 또는 Prediction Block; PB)과 변환을 위한 기본 단위인 변환 유닛(Transform Unit; TU 또는 Transform Block; TB)으로 구성될 수 있다.
The CU divided from the LCU includes a prediction unit (PU) or a prediction unit (PB), which is a basic unit for prediction, and a transform unit (TU or Transform Block; TB) .

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

LCU로부터 분할된 CU 중 더 이상 분할되지 않는 CU는 하나 이상의 예측 유닛으로 분할되며 이 행위 자체 역시 분할(partition)(혹은 파티션)이라고 일컫는다. 예측 유닛(이하, PU라 함)은 예측을 수행하는 기본 단위로써, 스킵(skip) 모드, 인터(inter) 모드, 인트라(intra) 모드 중 어느 하나로 부호화되며, 각 모드에 따라서 다양한 형태로 파티션될 수 있다. A CU that is no longer subdivided among the CUs segmented from the LCU is divided into one or more prediction units, and this action itself is also referred to as a partition (or partition). The prediction unit (hereinafter referred to as PU) is a basic unit for performing prediction, and is encoded in any one of a skip mode, an inter mode, and an intra mode, and is divided into various forms according to each mode .

도 4를 참조하면, 스킵 모드의 경우, CU 내에서 파티션 없이, CU와 동일한 크기를 갖는 2Nx2N 모드(410)를 지원할 수 있다. Referring to FIG. 4, in the skip mode, the 2N × 2N mode 410 having the same size as the CU may be supported without a partition in the CU.

인터 모드의 경우, CU 내에서 8가지의 파티션된 형태, 예컨대 2Nx2N 모드(410), 2NxN 모드(415), Nx2N 모드(420), NxN 모드(425), 2NxnU 모드(430), 2NxnD 모드(435), nLx2N 모드(440), nRx2N 모드(445)를 지원할 수 있다. In the inter mode, eight partitioned forms within a CU, such as 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.

인트라 모드의 경우, CU 내에서 2Nx2N 모드(410), NxN 모드(425)를 지원할 수 있다.
In the intra mode, the 2Nx2N mode 410 and the NxN mode 425 can be supported in the CU.

도 5는 코딩 유닛(CU)이 포함할 수 있는 변환 유닛(TU)의 형태를 도시한 도면이다. FIG. 5 is a diagram illustrating a form of a transform unit (TU) that a coding unit CU may include.

변환 유닛(이하, TU라 함)은 CU 내에서 공간 변환과 양자화 과정을 위해 사용되는 기본 단위이다. TU는 정사각형 또는 직사각형 형태를 가질 수 있다. LCU로부터 분할된 CU 중 더 이상 분할되지 않는 CU는 하나 혹은 그 이상의 TU로 분할될 수 있다. 이때, TU의 분할 구조는 도 5에 도시된 바와 같이 쿼드트리(quad-tree) 형태일 수 있다.
A conversion unit (hereinafter referred to as a TU) is a basic unit used for a space conversion and a quantization process in a CU. The TU may have a square or rectangular shape. A CU that is not further divided among the CUs segmented from the LCU may be divided into one or more TUs. In this case, the partition structure of the TU may have a quad-tree shape as shown in FIG. 5.

한편, HEVC에서는 H.264/AVC와 같이 화면 내 예측(인트라 예측) 부호화를 수행하며, 이때 현재 블록의 인트라 예측 모드에 따라 현재 블록의 주변에 위치한 주변 블록을 이용하여 예측 부호화를 수행한다. H.264/AVC는 9가지 방향성을 가지는 예측 모드를 가지는 반면, HEVC는 33 가지의 방향성 예측 모드와 3가지의 비방향성 예측 모드를 포함하는 총 36가지의 예측 모드를 가지고 부호화를 수행한다.
On the other hand, the HEVC performs intraprediction (intra prediction) coding as in H.264 / AVC, and predictive coding is performed using neighboring blocks located around the current block according to the intra prediction mode of the current block. H.264 / AVC has 9 directional prediction modes, while HEVC performs 36 types of prediction modes including 33 directional prediction modes and 3 non-directional prediction modes.

도 6은 인트라 예측 모드의 일예를 도시한 도면이다. 각 인트라 예측 모드에는 서로 다른 모드 번호가 할당될 수 있다. 6 is a diagram illustrating an example of an intra prediction mode. Different intra mode prediction modes may be assigned different mode numbers.

도 6을 참조하면, 인트라 예측 모드는 총 36개의 예측 모드가 존재하며, 현재 블록의 픽셀 값을 예측하는데 사용되는 참조 픽셀들이 위치한 방향 및/또는 예측 방식에 따라 33가지의 방향성 모드와 3가지의 비방향성 모드를 포함할 수 있다.Referring to FIG. 6, there are a total of 36 prediction modes, and 33 directional modes and three types according to a direction and / or a prediction method in which reference pixels used to predict pixel values of a current block are located. It may include a non-directional mode.

3가지의 비방향성 모드에는 평면(Planar; Intra_Planar) 모드, 평균(DC; Intra_DC) 모드, 그리고 복원된 휘도 신호로부터 색차 신호를 예측하는 LM 모드(Intra_FromLuma)가 존재한다. Three non-directional modes are Planar (Intra_Planar) mode, DC (Intra_DC) mode, and LM mode (Intra_FromLuma) for predicting the color difference signal from the reconstructed luminance signal.

도 6에 도시된 바와 같은 36가지의 인트라 예측 모드에 대한 부호화는 휘도 신호 및 색차 신호 각각에 적용될 수 있다. 이때, 휘도 신호의 경우, LM 모드는 제외된다. 색차 신호에 대한 인트라 예측 모드의 부호화는 아래 표 1과 같이 3가지 방법으로 수행될 수 있다. The encoding for the 36 intra prediction modes as shown in FIG. 6 may be applied to each of the luminance signal and the chrominance signal. At this time, in the case of the luminance signal, the LM mode is excluded. The encoding of the intra prediction mode for the color difference signal can be performed by the following three methods as shown in Table 1 below.

표 1은 색차 신호에 대한 인트라 예측 모드의 부호화 방법을 나타내는 일예이다. Table 1 shows an example of a method of encoding an intra prediction mode for a color difference signal.

Figure pat00001
Figure pat00001

표 1을 참조하여 3가지 색차 신호에 대한 인트라 예측 모드의 부호화 방법을 설명한다. 첫 번째 방법은, 휘도 신호의 인트라 예측 모드를 색차 신호의 인트라 예측 모드로 그대로 적용하는 유도된 모드(DM; Derived Mode)를 이용하는 방법이다. 두 번째 방법은, 실제 인트라 예측 모드를 적용하는 부호화 모드(EM; Explict Mode)를 이용하는 방법이다. 부호화되는 색차 신호의 인트라 예측 모드인 EM 모드는 평면 모드(Planar), 평균 모드(DC), 수평모드(Hor), 수직 모드(Ver), 수직 방향에서 8번째 위치한 모드(Ver+8 혹은 34 번 모드)를 포함한다. 세 번째 방법은, 복원된 휘도 신호로부터 색차 신호를 예측하는 LM 모드를 이용하는 방법이다. 상술한 세 가지 모드의 부호화 방법 중에서 가장 효율이 좋은 것이 선택될 수 있다.
The encoding method of the intra-prediction mode for three color-difference signals will be described with reference to Table 1. The first method uses a derived mode (DM) in which an intraprediction mode of a luminance signal is directly applied to an intraprediction mode of a color difference signal. The second method is a method using an encoding mode (EM (Explicit Mode) applying an actual intra prediction mode. The EM mode, which is an intra prediction mode of the color difference signal to be encoded, has a plane mode (Planar), an average mode (DC), a horizontal mode (Hor), a vertical mode (Ver), and the eighth position in the vertical direction (Ver + 8 or 34). Mode). The third method is a method using an LM mode for predicting a color difference signal from a restored luminance signal. The most efficient encoding method of the three modes described above can be selected.

도 7은 색차 신호를 예측하여 부호화하는 방법을 설명하기 위한 도면이다.7 is a diagram for describing a method of predicting and encoding a color difference signal.

색차 신호를 예측 부호화하는 방법으로, 복원된 휘도 신호 샘플로부터 색차 신호를 예측하는 방법(Intra_FromLuma)을 사용할 수 있다. 이 방법은 색차 신호와 휘도 신호의 선형적 상관 관계를 이용할 수 있으며, 수학식 1과 같이 나타낼 수 있다. As a method of predicting and encoding a color difference signal, a method (Intra_FromLuma) for predicting a color difference signal from a reconstructed luminance signal sample may be used. This method may use a linear correlation between the color difference signal and the luminance signal, and may be represented by Equation 1.

Figure pat00002
Figure pat00002

여기서, Predc[x,y]는 색차 신호(710)의 예측 값이고, RecL'[x,y]는 색차 신호의 4:2:0 샘플링 비율을 맞추기 위한 휘도 신호를 이용하여 계산된 값이다. 이때, RecL'[x,y]는 수학식 2를 통해 계산될 수 있다. Here, Pred c [x, y] is a predicted value of the chrominance signal 710, and Rec L '[x, y] is a value calculated by using a luminance signal for matching the 4: 2: 0 sampling ratio of the chrominance signal. to be. At this time, Rec L '[x, y] may be calculated through Equation 2.

Figure pat00003
Figure pat00003

상기 수학식 1에서, α는 다운 샘플링된 휘도 신호와 색차 신호 간의 가중치이고, β는 보상값을 나타낸다. In Equation 1, α is a weight between the down-sampled luminance signal and the color difference signal, and β represents a compensation value.

상기 수학식 1 및 수학식 2를 통해 획득된 색차 신호에 대한 예측 영상은 원본 영상과의 차분 값을 가질 수 있으며, 그 차분 값은 주파수 영역 변환과 양자화를 거쳐 엔트로피 부호화된다. 이때, 주파수 영역 변환에는 정수 변환, 정수 이산 여현 변환(Discrete Cosine Transform; DCT), 정수 이산 정현 변환(Discrete Sine Transform; DST), 또는 인트라 예측 모드 종속적인 DCT/DST 등이 있을 수 있다. The prediction image for the color difference signal obtained through Equations 1 and 2 may have a difference value from the original image, and the difference value is entropy encoded through frequency domain transformation and quantization. In this case, the frequency domain transform may include an integer transform, a discrete cosine transform (DCT), an integer discrete sine transform (DST), or an intra prediction mode dependent DCT / DST.

상술한 바와 같이, 원본 영상과 예측 영상 간의 차분 값이 주파수 영역 변환과 양자화를 거친 후 엔트로피 부호화될 때, 엔트로피 부호화의 효율은 높이고자 2차원 형태의 양자화된 계수를 1차원 형태로 재정렬하게 된다. 이러한 양자화 계수의 재정렬 시, 기존의 H.264/AVC 와 같은 비디오 부호화 방법에서는 지그재그 스캔 방법을 사용하였으나, HEVC에서는 상단 우측 방향(Up-right) 스캔을 기본적으로 사용한다. 또한, HEVC에서 주파수 영역 변환 시에는 정수 변환, DCT, DST, 또는 인트라 예측 모드에 종속적인 DCT/DST 등을 사용한다.
As described above, when the difference value between the original image and the predicted image is entropy coded after undergoing frequency domain transformation and quantization, the efficiency of entropy coding is rearranged into a 1-dimensional form to increase the efficiency of entropy coding. In order to reorder the quantization coefficients, a zigzag scan method is used in a conventional video coding method such as H.264 / AVC, but an upper-right scan is basically used in HEVC. In addition, the frequency domain transform in HEVC uses integer transform, DCT, DST, or DCT / DST dependent on intra prediction mode.

도 8은 변환 계수에 대한 상단 우측(Up-right) 스캔 방법의 일예를 나타내는 도면이다. 8 is a diagram illustrating an example of an up-right scan method for transform coefficients.

임의의 크기를 가지는 블록에 대한 양자화 계수의 부호화 시, 임의의 크기를 가지는 블록은 4x4 크기의 서브 블록으로 나누어져 부호화를 수행한다. When encoding quantization coefficients for a block having a random size, a block having a random size is divided into 4 × 4 subblocks to perform encoding.

도 8을 참조하면, 16x16 크기의 블록은 16개의 4x4 크기의 서브 블록으로 분할되어 부호화될 수 있다. 복호화 시, 각 서브 블록에 변환 계수가 존재하는지 여부는 비트스트림으로부터 파싱된 플래그 정보를 통해 확인할 수 있다. 예컨대, 상기 플래그는 significant_coeff_group_flag(sigGrpFlag)일 수 있다. significant_coeff_group_flag 값이 1이면, 4x4 서브 블록에 양자화된 변환 계수가 하나라도 존재하는 것을 의미하며, 반대로 significant_coeff_group_flag 값이 0이면, 4x4 서브 블록에 양자화된 변환 계수가 존재하지 않는다는 것을 의미할 수 있다. Referring to FIG. 8, a 16x16 sized block may be divided into 16 4x4 sized subblocks and encoded. At the time of decoding, whether or not a transform coefficient exists in each subblock may be confirmed through flag information parsed from a bitstream. For example, the flag may be significant_coeff_group_flag (sigGrpFlag). If the significant_coeff_group_flag value is 1, it means that there is at least one quantized transform coefficient in the 4x4 subblock. On the contrary, if the significant_coeff_group_flag value is 0, it may mean that there is no quantized transform coefficient in the 4x4 subblock.

도 8에 도시된 4x4 서브 블록에 대한 스캔 방향 및 significant_coeff_group_flag에 대한 스캔 방향은 모두 기본적으로 상단 우측 스캔 방향을 사용하였다. The scan direction for the 4x4 subblock and the scan direction for the significant_coeff_group_flag shown in FIG. 8 basically used the upper right scan direction.

HEVC에서 사용하는 양자화 계수에 대한 스캔 방법에는 상단 우측 방향(Up-right), 수평 방향(Horizontal), 수직 방향(Vertical) 스캔이 있다. 인터 예측에서는 상단 우측 방향(Up-right) 스캔 방법을 기본적으로 사용하며, 인트라 예측에서는 상단 우측 방향(Up-right), 수평 방향(Horizontal), 수직 방향(Vertical) 스캔을 선택적으로 사용할 수 있다.Scanning methods for the quantization coefficients used in HEVC include upper-right, horizontal, and vertical scans. In the inter prediction, an up-right scan method is basically used, and in the intra prediction, an up-right, horizontal and vertical scan can be selectively used.

인트라 예측에서의 스캔 방향은 인트라 예측 모드에 따라 다르게 선택될 수 있으며, 이는 휘도 신호 및 색차 신호에 모두 적용될 수 있다. 아래 표 2는 인트라 예측 모드에 따른 스캔 방향을 나타내는 일예이다. The scan direction in the intra prediction may be selected differently according to the intra prediction mode, which may be applied to both the luminance signal and the chrominance signal. Table 2 below shows an example of a scan direction according to an intra prediction mode.

Figure pat00004
Figure pat00004

표 2에서, IntraPredModeValue는 인트라 예측 모드를 의미한다. 이때, 휘도 신호의 경우는 IntraPredMode 값에 해당하고, 색차 신호의 경우는 IntraPredModeC 값에 해당한다. log2TrafoSize는 현재 변환 블록의 크기를 log를 이용하여 나타낸 것을 의미한다. 예를 들어, IntraPredModeValue 값이 1이라는 것은 평균(DC; Intra_DC) 모드를 뜻하며, log2TrafoSize-2의 값이 1이라는 것은 8x8 크기의 블록을 의미한다. In Table 2, IntraPredModeValue means intra prediction mode. In this case, the luminance signal corresponds to the IntraPredMode value, and the color difference signal corresponds to the IntraPredModeC value. log2TrafoSize means that the size of the current transform block is expressed using the log. For example, an IntraPredModeValue value of 1 means an average (DC; Intra_DC) mode, and a value of log2TrafoSize-2 of 1 means an 8x8 block.

또한, 표 2에서, 인트라 예측 모드(IntraPredModeValue)와 현재 변환 블록 크기(log2TrafoSize-2)에 따른 스캔 방향은 숫자 0, 1, 2로 표기되어 있다. 예컨대, 상단 우측 스캔 방향(Up-right)은 0, 수평 스캔 방향(Horizontal)은 1, 수직 스캔 방향(Vertical)은 2로 표기할 수 있다.
In addition, in Table 2, scan directions according to the intra prediction mode (IntraPredModeValue) and the current transform block size (log2TrafoSize-2) are indicated by numbers 0, 1, and 2. For example, an upper right scan direction (Up-right) may be represented by 0, a horizontal scan direction (Horizontal) is 1, and a vertical scan direction (Vertical) is represented by 2.

도 9는 인트라 에측 모드에 따른 스캔 방향을 결정하는 방법의 일 실시예를 나타내는 순서도이다. 도 9의 방법은 상술한 도 1의 부호화 장치 또는 상술한 도 2의 복호화 장치에서 수행될 수 있다. 도 9의 실시예에서는 설명의 편의를 위해 도 9의 방법이 부호화 장치에서 수행되는 것으로 설명하나, 이는 복호화 장치에서도 동일하게 적용될 수 있다. 9 is a flowchart illustrating an embodiment of a method of determining a scan direction according to an intra side mode. The method of FIG. 9 may be performed by the encoding apparatus of FIG. 1 or the decoding apparatus of FIG. 2 described above. In the embodiment of FIG. 9, the method of FIG. 9 is described as being performed by the encoding apparatus for the sake of convenience of explanation, but it can also be applied to the decoding apparatus as well.

도 9를 참조하면, 부호화 장치는 인트라 예측 모드인지 판단한다(S900).Referring to FIG. 9, the encoding apparatus determines whether the intra prediction mode is present (S900).

인트라 예측 모드가 아니면, 부호화 장치는 양자화 계수에 대한 스캔으로 상단 우측 방향 스캔을 사용하도록 결정한다(S960).If not in the intra prediction mode, the encoding apparatus determines to use the upper right direction scan as a scan for the quantization coefficients (S960).

인트라 예측 모드이면, 부호화 장치는 색차 신호에 대한 인트라 예측 모드(IntraPredModeC)가 LM 모드인지 여부를 판단한다(S910).In the intra prediction mode, the encoding apparatus determines whether the intra prediction mode IntraPredModeC for the color difference signal is the LM mode (S910).

색차 신호에 대한 인트라 예측 모드(IntraPredModeC)가 LM 모드이면, 부호화 장치는 양자화 계수에 대한 스캔으로 상단 우측 방향 스캔을 사용하도록 결정한다(S960).If the intra prediction mode (IntraPredModeC) for the chrominance signal is the LM mode, the encoding apparatus determines to use the upper right direction scan as a scan for the quantization coefficients (S960).

색차 신호에 대한 인트라 예측 모드(IntraPredModeC)가 LM 모드가 아니면, 부호화 장치는 인트라 예측 모드(IntraPredMode(C))의 값이 6 이상이고 14 이하인지 판단한다(S920). 여기서, 인트라 예측 모드(IntraPredMode(C))는 신호의 성분에 따라 휘도 신호도 될 수 있으며, 색차 신호도 될 수 있다. If the intra prediction mode (IntraPredModeC) for the color difference signal is not the LM mode, the encoding apparatus determines whether the value of the intra prediction mode (IntraPredMode (C)) is 6 or more and 14 or less (S920). In this case, the intra prediction mode IntraPredMode (C) may be a luminance signal or a chrominance signal according to a signal component.

인트라 예측 모드(IntraPredMode(C))의 값이 6 이상이고 14 이하이면, 부호화 장치는 양자화 계수에 대한 스캔으로 수직 방향 스캔을 사용하도록 결정한다(S940).If the value of the intra prediction mode IntraPredMode (C) is 6 or more and 14 or less, the encoding apparatus determines to use the vertical scan as a scan for the quantization coefficients (S940).

인트라 예측 모드(IntraPredMode(C))의 값이 6 이상이고 14 이하인 경우가 아니면, 부호화 장치는 인트라 예측 모드(IntraPredMode(C))의 값이 22 이상이고 30 이하인지 판단한다(S930).If the value of the intra prediction mode IntraPredMode (C) is 6 or more and 14 or less, the encoding apparatus determines whether the value of the intra prediction mode IntraPredMode (C) is 22 or more and 30 or less (S930).

인트라 예측 모드(IntraPredMode(C))의 값이 22 이상이고 30 이하이면, 부호화 장치는 양자화 계수에 대한 스캔으로 수평 방향 스캔을 사용하도록 결정한다(S950). 그렇지 않으면, 부호화 장치는 양자화 계수에 대한 스캔으로 상단 우측 방향 스캔을 사용하도록 결정한다(S960).
If the value of the intra prediction mode IntraPredMode (C) is greater than or equal to 22 and less than or equal to 30, the encoding apparatus determines to use a horizontal scan as a scan for the quantization coefficients (S950). Otherwise, the encoding apparatus determines to use the upper right direction scan as a scan for the quantization coefficients (S960).

도 10은 인트라 예측 모드에 따른 스캔 방향을 결정하는 방법의 다른 실시예를 나타내는 순서도이다. 도 10의 방법은 상술한 도 1의 부호화 장치 또는 상술한 도 2의 복호화 장치에서 수행될 수 있다. 도 10의 실시예에서는 설명의 편의를 위해 도 10의 방법이 부호화 장치에서 수행되는 것으로 설명하나, 이는 복호화 장치에서도 동일하게 적용될 수 있다.10 is a flowchart illustrating another embodiment of a method of determining a scan direction according to an intra prediction mode. The method of FIG. 10 may be performed by the encoding apparatus of FIG. 1 or the decoding apparatus of FIG. 2 described above. In the embodiment of FIG. 10, for convenience of description, the method of FIG. 10 is described as being performed by the encoding apparatus, but the same may be applied to the decoding apparatus.

도 10에서 인덱스(Index)는 변환 블록의 크기를 나타내는 지시자이며, 각 변환 블록의 크기에 따라 인덱스 값이 다음과 같이 할당될 수 있다. In FIG. 10, an index is an indicator indicating the size of a transform block, and an index value may be allocated as follows according to the size of each transform block.

변환 블록의 크기가 64x64이면 인덱스의 값은 1, 변환 블록의 크기가 32x32이면 인덱스의 값은 2, 변환 블록의 크기가 16x16이면 인덱스의 값은 3, 변환 블록의 크기가 8x8이면 인덱스의 값은 4, 변환 블록의 크기가 4x4이면 인덱스의 값은 5, 변환 블록의 크기가 2x2이면 인덱스의 값은 6일 수 있다. If the size of the transform block is 64x64, the index value is 1; if the size of the transform block is 32x32, the index value is 2; if the size of the transform block is 16x16, the index value is 3; if the size of the transform block is 8x8, the index value is 4, if the size of the transform block is 4x4, the index value may be 5, and if the size of the transform block is 2x2, the index value may be 6.

도 10의 인트라 예측 모드에 따른 스캔 방향을 결정하는 방법에 따르면, 휘도 신호의 경우에는 8x8 크기 변환 블록과 4x4 크기 변환 블록에 적용하고 있으며, 색차 신호의 경우에는 현재 HEVC에서 2x2 크기 변환 블록을 허용하고 있지 않으므로 4x4 크기 변환 블록에만 적용하고 있음을 알 수 있다. 현재 HEVC에서는 인트라 예측 모드에 따른 스캔을 적용하지 않는 경우, 모두 상단 우측 방향 스캔을 적용하고 있다. According to the method of determining the scan direction according to the intra prediction mode of FIG. 10, a luminance signal is applied to an 8x8 size transform block and a 4x4 size transform block, and a color difference signal allows a 2x2 size transform block in the current HEVC. As you can see, it is applied only to 4x4 size conversion block. In HEVC, when the scan according to the intra prediction mode is not applied, all of the upper right scans are applied.

한편, 인트라 예측에서 양자화 계수를 부호화하기 위해 상기 표 2로부터 구해진 스캔 방향은 상술한 도 8에서와 같이 4x4 서브 블록에 대한 스캔 방향 및 significant_coeff_group_flag에 대한 스캔 방향으로 사용될 수 있다. Meanwhile, the scan direction obtained from Table 2 for encoding the quantization coefficients in intra prediction may be used as the scan direction for the 4x4 subblock and the scan direction for the significant_coeff_group_flag as shown in FIG. 8.

도 10에 방법에 대해 보다 구체적으로 설명하면, 부호화 장치는 인트라 예측 모드인지 판단한다(S1000).Referring to FIG. 10 in more detail, the encoding apparatus determines whether it is an intra prediction mode (S1000).

인트라 예측 모드가 아니면, 부호화 장치는 양자화 계수에 대한 스캔으로 상단 우측 방향 스캔을 사용하도록 결정한다(S1070).If not in the intra prediction mode, the encoding apparatus determines to use the upper right direction scan as a scan for the quantization coefficients (S1070).

인트라 예측 모드이면, 부호화 장치는 현재 변환 블록의 너비(width)를 인덱스(Index) 값으로 변환한다(S1005). 여기서, 인덱스는 상술한 바와 같이 변환 블록의 크기를 나타내는 지시자이며, 각 변환 블록의 크기에 따라 인덱스 값이 할당될 수 있다. In the intra prediction mode, the encoding apparatus converts the width of the current transform block into an index value (S1005). Here, the index is an indicator indicating the size of the transform block as described above, and an index value may be assigned according to the size of each transform block.

단계 S1010에서 휘도 신호인 경우, 부호화 장치는 휘도 신호에 대한 인트라 예측 모드(IntraPredMode)를 획득한다(S1015).In the case of the luminance signal in step S1010, the encoding apparatus obtains an intra prediction mode (IntraPredMode) for the luminance signal (S1015).

단계 S1020에서 현재 변환 블록의 인덱스 값이 3보다 크고 6보다 작은 경우, 즉 현재 변환 블록의 크기가 8x8 혹은 4x4인 경우, 부호화 장치는 휘도 신호에 대한 인트라 예측 모드(IntraPredMode)의 값이 6 이상이고 14 이하인지 판단한다(S1025).If the index value of the current transform block is greater than 3 and less than 6 in step S1020, that is, if the size of the current transform block is 8x8 or 4x4, the encoding apparatus has an intra prediction mode (IntraPredMode) value of the luminance signal of 6 or more. It is determined whether it is 14 or less (S1025).

단계 S1025의 판단 결과, 휘도 신호에 대한 인트라 예측 모드(IntraPredMode)의 값이 6 이상이고 14 이하이면, 부호화 장치는 양자화 계수에 대한 스캔으로 수직 방향 스캔을 사용하도록 결정한다(S1060). 그렇지 않은 경우, 부호화 장치는 휘도 신호에 대한 인트라 예측 모드(IntraPredMode)의 값이 22 이상이고 30 이하인지 판단한다(S1030). As a result of the determination in step S1025, if the value of the intra prediction mode (IntraPredMode) for the luminance signal is 6 or more and 14 or less, the encoding apparatus determines to use the vertical scan as a scan for the quantization coefficients (S1060). Otherwise, the encoding apparatus determines whether an intra prediction mode (IntraPredMode) value of the luminance signal is 22 or more and 30 or less (S1030).

단계 S1030의 판단 결과, 휘도 신호에 대한 인트라 예측 모드(IntraPredMode)의 값이 22 이상이고 30 이하이면, 부호화 장치는 양자화 계수에 대한 스캔으로 수평 방향 스캔을 사용하도록 결정한다(S1065). 그렇지 않은 경우, 부호화 장치는 양자화 계수에 대한 스캔으로 상단 우측 방향 스캔을 사용하도록 결정한다(S1070).As a result of the determination in step S1030, if the value of the intra prediction mode (IntraPredMode) for the luminance signal is 22 or more and 30 or less, the encoding apparatus determines to use the horizontal scan as a scan for the quantization coefficients (S1065). Otherwise, the encoding apparatus determines to use the upper right direction scan as a scan for the quantization coefficients (S1070).

단계 S1020에서 현재 변환 블록의 인덱스 값이 3보다 크고 6보다 작은 경우가 아닐 때, 즉 현재 변환 블록의 크기가 8x8 혹은 4x4를 제외한 64x64, 32x32, 16x16, 2x2인 경우, 부호화 장치는 양자화 계수에 대한 스캔으로 상단 우측 방향 스캔을 사용하도록 결정한다(S1070).When the index value of the current transform block is greater than 3 and less than 6 in step S1020, that is, when the size of the current transform block is 64x64, 32x32, 16x16, or 2x2 except for 8x8 or 4x4, the encoding apparatus performs The scan decides to use the upper right direction scan (S1070).

단계 S1010에서 휘도 신호가 아닌 경우, 즉 색차 신호인 경우, 부호화 장치는 DM 모드인지 판단한다(S1035). 여기서, DM 모드는 휘도 신호의 인트라 예측 모드를 색차 신호의 인트라 예측 모드로 그대로 적용하는 모드이다. If it is not the luminance signal in step S1010, that is, the color difference signal, the encoding apparatus determines whether the DM mode (S1035). Here, the DM mode is a mode in which the intra prediction mode of the luminance signal is applied as it is to the intra prediction mode of the chrominance signal.

DM 모드이면, 부호화 장치는 휘도 신호에 대한 인트라 예측 모드(IntraPredMode)를 획득하고(S1040), 색차 신호에 대한 인트라 예측 모드(IntraPredModeC)에 상기 획득된 휘도 신호에 대한 인트라 예측 모드(IntraPredMode)를 설정한다(S1045). In the DM mode, the encoding apparatus obtains an intra prediction mode (IntraPredMode) for the luminance signal (S1040), and sets an intra prediction mode (IntraPredMode) for the obtained luminance signal in the intra prediction mode (IntraPredModeC) for the chrominance signal. (S1045).

DM 모드가 아니면, 부호화 장치는 색차 신호에 대한 인트라 예측 모드(IntraPredModeC)를 획득한다(S1050).If not in the DM mode, the encoding apparatus obtains an intra prediction mode (IntraPredModeC) for the color difference signal (S1050).

부호화 장치는 현재 변환 블록의 인덱스 값이 4보다 크고 7보다 작은지 여부를 판단한다(S1055). 즉, 현재 변환 블록의 크기가 4x4, 2x2인지를 판단한다. The encoding apparatus determines whether the index value of the current transform block is larger than 4 and smaller than 7 (S1055). That is, it is determined whether the size of the current transform block is 4x4 or 2x2.

단계 S1055의 판단 결과에 따라 부호화 장치는 단계 S1025, S1030을 수행하고, 그 결과에 따라 양자화 계수에 대한 스캔 방법을 결정할 수 있다.
According to the determination result of step S1055, the encoding apparatus may perform steps S1025 and S1030, and may determine a scan method for the quantization coefficients according to the result.

한편, 상술한 바와 같이, 원본 영상과 예측 영상 간의 차분 값(혹은 잔여 신호, residual)은 주파수 영역 변환과 양자화를 거친 후 엔트로피 부호화된다. 이때 주파수 영역 변환으로 인한 부호화의 효율을 높이고자 정수 변환, 정수 이산 여현 변환(DCT), 정수 이산 정현 변환(DST), 또는 인트라 예측 모드 종속적인 DCT/DST 등을 블록의 크기에 따라 선택적, 적응적으로 적용하고 있다.
Meanwhile, as described above, the difference value (or residual signal) between the original image and the predicted image is entropy coded after undergoing frequency domain transformation and quantization. In this case, to improve the coding efficiency due to the frequency domain transform, an integer transform, an integer discrete cosine transform (DCT), an integer discrete sine transform (DST), or an intra prediction mode dependent DCT / DST may be selectively and adapted according to the block size. It is applied to the enemy.

도 11은 잔여 신호(잔여 영상)에 대한 주파수 변환 방식을 선택하는 방법의 일예를 나타내는 순서도이다. 도 11의 방법은 상술한 도 1의 부호화 장치 또는 상술한 도 2의 복호화 장치에서 수행될 수 있다. 도 11의 실시예에서는 설명의 편의를 위해 도 11의 방법이 부호화 장치에서 수행되는 것으로 설명하나, 이는 복호화 장치에서도 동일하게 적용될 수 있다.11 is a flowchart illustrating an example of a method of selecting a frequency conversion method for a residual signal (residual image). The method of FIG. 11 may be performed by the encoding apparatus of FIG. 1 or the decoding apparatus of FIG. 2 described above. In the embodiment of FIG. 11, for convenience of description, the method of FIG. 11 is described as being performed by the encoding apparatus, but the same may be applied to the decoding apparatus.

도 11을 참조하면, 단계 S1100에서 현재 블록이 인트라 모드로 부호화되었고 휘도 신호(luma)의 블록이 아니라면, 부호화 장치는 현재 블록의 색차 신호의 잔여 신호에 대한 주파수 변환 방식으로 정수 변환 혹은 DCT를 적용한다(S1190). Referring to FIG. 11, in operation S1100, if the current block is encoded in the intra mode and is not a block of the luma signal, the encoding apparatus applies an integer transform or a DCT as a frequency transform method for the residual signal of the color difference signal of the current block. (S1190).

단계 S1100에서 현재 블록이 인트라 모드로 부호화되었고 휘도 신호의 블록이라면, 부호화 장치는 현재 블록의 휘도 신호에 대한 인트라 예측 모드(IntraPredMode)를 획득한다(S1110).If the current block is encoded in the intra mode in step S1100 and is a block of the luminance signal, the encoding apparatus obtains an intra prediction mode (IntraPredMode) for the luminance signal of the current block (S1110).

부호화 장치는 현재 블록이 4x4 크기(iWidth == 4)의 블록인지를 확인한다(S1120).The encoding apparatus checks whether the current block is a block of 4x4 size (iWidth == 4) (S1120).

만일 현재 블록이 4x4 크기(iWidth == 4)의 블록이 아니라면, 부호화 장치는 현재 블록의 휘도 신호의 잔여 신호에 대한 주파수 변환 방식으로 정수 변환 혹은 DCT을 적용한다(S1190). If the current block is not a block of 4x4 size (iWidth == 4), the encoding apparatus applies integer transform or DCT as a frequency transform method for the residual signal of the luminance signal of the current block (S1190).

그렇지 않고 현재 블록이 4x4 크기(iWidth == 4)의 블록이라면, 부호화 장치는 현재 블록의 인트라 예측 모드를 검사한다. Otherwise, if the current block is a block of 4x4 size (iWidth == 4), the encoding apparatus checks the intra prediction mode of the current block.

만일 현재 블록의 인트라 예측 모드의 값이 2 이상이고 10 이하이면(S1130), 부호화 장치는 현재 블록의 휘도 신호에 대한 주파수 변환 방식으로 수평방향은 DST을 적용하고 수직방향은 DCT을 적용한다(S1160). If the value of the intra prediction mode of the current block is 2 or more and 10 or less (S1130), the encoding apparatus applies DST in the horizontal direction and DCT in the vertical direction in the frequency conversion method for the luminance signal of the current block (S1160). ).

그렇지 않고 만일 현재 블록의 인트라 예측 모드의 값이 0이거나 혹은 11 이상이고 25 이하이면(S1140), 부호화 장치는 현재 블록의 휘도 신호에 대한 주파수 변환 방식으로 수평 및 수직 방향 모두에 DST을 적용한다(S1170). Otherwise, if the value of the intra prediction mode of the current block is 0, 11 or more and 25 or less (S1140), the encoding apparatus applies the DST in both the horizontal and vertical directions as a frequency conversion method for the luminance signal of the current block ( S1170).

그렇지 않고 만일 현재 블록의 인트라 예측 모드의 값이 26 이상이고 34 이하이면(S1150), 부호화 장치는 현재 블록의 휘도 신호에 대한 주파수 변환 방식으로 수평 방향은 DCT을 적용하고 수직 방향은 DST을 적용한다(S1180). Otherwise, if the value of the intra prediction mode of the current block is 26 or more and 34 or less (S1150), the encoding apparatus applies DCT in the horizontal direction and DST in the vertical direction as a frequency conversion method for the luminance signal of the current block. (S1180).

그렇지 않다면, 부호화 장치는 현재 블록의 휘도 신호의 잔여 신호에 대한 주파수 변환 방식으로 수평 및 수직 방향 모두에 DCT을 적용한다(S1190).Otherwise, the encoding apparatus applies DCT in both the horizontal and vertical directions as a frequency conversion method for the residual signal of the luminance signal of the current block (S1190).

상술한 도 11에서, iWidth는 변환 블록의 크기를 나타내는 지시자이며, 각 변환 블록의 크기에 따른 iWidth 값은 다음과 같이 할당될 수 있다. In FIG. 11 described above, iWidth is an indicator indicating the size of a transform block, and an iWidth value according to the size of each transform block can be allocated as follows.

예를 들어, 변환 블록의 크기가 64x64이면 iWidth는 64, 변환 블록의 크기가 32x32이면 iWidth는 32, 변환 블록의 크기가 16x16이면 iWidth는 16, 변환 블록의 크기가 8x8이면 iWidth는 8, 변환 블록의 크기가 4x4이면 iWidth는 4, 변환 블록의 크기가 2x2이면 iWidth는 2일 수 있다.
For example, iWidth is 64 if the transform block is 64x64, iWidth is 32 if the transform block is 32x32, iWidth is 16 if the transform block is 16x16, iWidth is 8 if the transform block is 8x8, and 8 is the transform block. If the size of 4x4 iWidth may be 4, if the size of the transform block 2x2 iWidth may be 2.

한편, 상술한 도 11의 내용과 관련된 내용은, HEVC(High efficiency video coding) 작업문서(Working Draft)에서, 스케일된 변환 계수를 위한 변환 과정(Transformation process for scaled transform coefficients)부분에 게시되어 있으며 요약하면 다음과 같다. Meanwhile, contents related to the above-described content of FIG. 11 are posted in a transformation process for scaled transform coefficients in a high efficiency video coding (HEVC) working document. Is as follows.

여기서, 입력은 다음과 같다. Where the input is:

- 현재 변환 블록의 너비 Width; nWWidth of the current transform block; nW

- 현재 변환 블록의 높이 Height; nHHeight of the current transform block; nH

- 요소(element) dij를 가진 스케일된 변환 계수의 배열; (nWxnH) array dAn array of scaled transform coefficients with element dij; (nWxnH) array d

- 현재 블록의 휘도 신호 및 색차 신호에 대한 인덱스; cIdxAn index for the luminance signal and the chrominance signal of the current block; cIdx

만일, cIdx가 0 이면 휘도 신호를 의미하고, cIdx가 1 이거나 혹은 cIdx가 2이면 색차 신호를 의미한다. 또한 cIdx가 1이면 색차 신호에서 Cb를 의미하고, cIdx 가 2이면 색차 신호에서 Cr을 의미한다.If cIdx is 0, it means a luminance signal. If cIdx is 1 or cIdx is 2, it means a color difference signal. In addition, cIdx of 1 means Cb in the color difference signal, and cIdx of 2 means Cr in the color difference signal.

여기서, 출력은 다음과 같다. Where the output is

- 스케일된 변환 계수를 역변환하여 구해진 잔여 신호에 대한 배열; (nWxnH) array rAn array of residual signals obtained by inverse transforming the scaled transform coefficients; (nWxnH) array r

현재 블록에 대한 예측 모드(PredMode)가 인트라 예측 모드(Intra)이고, Log2(nW*nH) 값이 4와 같고 cIdx 값이 0이면, 휘도 신호의 인트라 예측 방향 모드에 따라 변수 horizTrType과 vertTrType은 아래 표 3을 통해 구해진다. 만일 그렇지 않다면, 변수 horizTrType과 vertTrType은 0으로 설정된다.If the prediction mode (PredMode) for the current block is intra prediction mode (Intra), Log2 (nW * nH) is equal to 4 and cIdx value is 0, then the variables horizTrType and vertTrType depend on the intra prediction direction mode of the luminance signal. Obtained through Table 3. If not, the variables horizTrType and vertTrType are set to zero.

Figure pat00005
Figure pat00005

변수 horizTrType과 vertTrType 값을 가지고 스케일된 변환 계수에 대한 역변환 과정을 수행한다. 먼저 현재 블록의 크기(nW, nH)와 스케일된 변환 계수 배열(nWxnH array d), 변수 horizTrType을 입력 받아 수평 방향으로 1차원 역변환을 수행하여 배열(nWxnH array e)를 출력한다.An inverse transform process is performed on scaled transform coefficients with the variables horizTrType and vertTrType. First, the size of the current block (nW, nH), the scaled transform coefficient array (nWxnH array d), and the variable horizTrType are input to perform a one-dimensional inverse transformation in the horizontal direction to output the array (nWxnH array e).

다음으로 배열(nWxnH array e)을 입력 받아 배열(nWxnH array g)를 다음 수학식 3과 같이 유도한다. Next, the array (nWxnH array e) is input and the array (nWxnH array g) is derived as shown in Equation 3 below.

Figure pat00006
Figure pat00006

다음으로 현재 블록의 크기(nW, nH)와 배열(nWxnH array g), 변수 vertTrType을 입력 받아 수직 방향으로 1차원 역변환을 수행한다.Next, one-dimensional inverse transform is performed in the vertical direction by receiving the size of the current block (nW, nH), the array (nWxnH array g), and the variable vertTrType.

다음으로 cIdx에 따라 잔여 신호에 대한 배열(nWxnH) array r을 다음 수학식 4와 같이 설정한다.Next, according to cIdx, an array (nWxnH) array r for residual signals is set as in Equation 4 below.

Figure pat00007
Figure pat00007

여기서, shift는 cIdx가 0일때는 shift = 20 - BitDepthY 이고, 그렇지 않으면 shift = 20 - BitDepthC 값을 가진다. BitDepth는 현재 영상에 대한 샘플의 비트수(예를 들어, 8 비트)를 의미한다.
Here, shift is shift = 20-BitDepth Y when cIdx is 0, otherwise shift = 20-BitDepth C. BitDepth means the number of bits (eg, 8 bits) of the sample for the current image.

HEVC에서는 잔여 신호에 대한 주파수 변환 방식을 선택하기 위하여 휘도 신호의 인트라 예측 모드 정보를 활용한다. 상술한 바와 같이, 인트라 예측 모드는 총 36가지이며, 33가지의 방향성을 가지는 인트라 예측 모드와 3가지의 방향성이 없는 인트라 예측 모드로 구분할 수 있다. In HEVC, intra prediction mode information of a luminance signal is used to select a frequency conversion scheme for a residual signal. As described above, a total of 36 intra prediction modes are classified into an intra prediction mode having 33 directionalities and an intra prediction mode having three directionalities.

이때, 인트라 예측 모드에 따른 주파수 변환 방식은 아래 4가지 방식 중 하나의 방식이 선택될 수 있다. In this case, one of the following four methods may be selected as the frequency conversion method according to the intra prediction mode.

1. 수평 및 수직 방향으로 모두 DCT 변환을 수행1. Perform DCT conversion in both horizontal and vertical directions

2. 수평 및 수직 방향으로 모두 DST 변환을 수행2. Perform DST conversion in both horizontal and vertical directions

3. 수평 방향으로는 DCT 변환을 수행하고 수직방향으로는 DST 변환을 수행3. Perform DCT conversion in the horizontal direction and DST conversion in the vertical direction.

4. 수평 방향으로는 DST 변환을 수행하고 수직방향으로는 DCT 변환을 수행
4. Perform DST conversion in the horizontal direction and DCT conversion in the vertical direction.

상기와 같이, 총 4가지의 주파수 변환 방식이 존재할 경우, 부호화기 및 복호화기는 4가지 주파수 변환 방식에 대하여 하드웨어 모듈이 모두 존재하여야 한다. 이는 하드웨어의 가격을 높이는 단점이 있다. 따라서 부호화 효율을 그대로 유지하면서 하드웨어의 생산가격을 낮추기 위해 주파수 변환 방식의 종류를 감소시키는 것이 바람직하다. 또한, 여러 가지 주파수 변환을 사용함에 따른 부호화 효율 증대와 복잡도 증가 사이에서 적절한 균형을 찾는 것이 바람직하다. As described above, if a total of four frequency conversion schemes exist, the encoder and the decoder should all have hardware modules for the four frequency conversion schemes. This has the disadvantage of increasing the price of the hardware. Therefore, it is desirable to reduce the type of frequency conversion scheme in order to lower the production cost of hardware while maintaining the coding efficiency. In addition, it is desirable to find an appropriate balance between increasing coding efficiency and increasing complexity by using various frequency transforms.

예를 들면, 상기 4가지의 HEVC 변환 방식의 예에서 1과 2만 허용하고 3과 4는 허용하지 않도록 하여 다양한 변환에 의한 부호화 효율 증대를 유지하면서도 복잡도를 크게 높이지 않도록 할 수 있다.For example, in the above four examples of HEVC transform schemes, only 1 and 2 are allowed, and 3 and 4 are not allowed, so that the complexity may not be greatly increased while maintaining an increase in encoding efficiency due to various transforms.

일반적으로, 인트라 예측 혹은 인터 예측을 통해 생성된 잔여 신호에 여러 가지의 주파수 변환을 적응적으로 수행할 경우, 부호화 효율을 증가시킬 수 있다. 하지만, 어떠한 주파수 변환이 사용되었는지에 대한 시그널링 정보를 복호화기로 전송해야 하는 오버헤드가 따른다. In general, when various frequency conversions are adaptively performed on the residual signal generated through intra prediction or inter prediction, encoding efficiency may be increased. However, there is an overhead of transmitting signaling information on which frequency transform is used to the decoder.

이하, 본 발명에서는 잔여 신호의 주파수 변환의 종류를 나타내는 정보를 시그널링하는 오버헤드를 줄이면서도 여러 가지 주파수 변환을 적응적으로 선택할 수 있도록 함으로써 복잡도 증가가 적으면서도 부호화 효율을 극대화 하기 위한 방법 및 장치를 제공한다. 이하, 본 명세서에서는 HEVC의 인트라 예측의 경우를 예를 들어 설명한다. Hereinafter, the present invention provides a method and apparatus for maximizing the coding efficiency while increasing the complexity by reducing the overhead of signaling information indicating the type of frequency transform of the residual signal while adaptively selecting various frequency transforms. to provide. Hereinafter, in this specification, the case of intra prediction of HEVC will be described as an example.

HEVC의 인트라 예측 모드는 33가지의 방향성을 가지는 예측 모드와 3가지의 방향성이 없는 예측 모드를 포함한다. 33가지의 방향성을 가지는 예측 모드는 등각도(예측 방향 간의 각도가 일정)로 나누어져 배치되어 있다. 예를 들어, 인트라 예측 모드 5번은 인트라 예측 모드 6번과 아주 약간의 각도 차이만 존재한다. 따라서 인트라 예측 모드 5번을 기반으로 예측되어 생성된 예측 블록은 인트라 예측 모드 6번을 기반으로 예측되어 생성된 예측 블록과 차이가 크지 않거나 혹은 차이가 거의 없을 수 있다. 다시 말하면, 인트라 예측 모드 5번을 기반으로 하여 생성된 잔여 신호와 인트라 예측 모드 6번을 기반으로 하여 생성된 잔여 신호는 거의 비슷하거나 혹은 동일할 수 있다.The intra prediction mode of HEVC includes a prediction mode having 33 directions and a prediction mode having three directions. The prediction modes having 33 directionality are arranged by dividing into equal angles (the angle between the prediction directions is constant). For example, intra prediction mode 5 has only a slight angle difference from intra prediction mode 6. Therefore, the prediction block predicted and generated based on the intra prediction mode 5 may have little or no difference from the prediction block predicted and generated based on the intra prediction mode 6. In other words, the residual signal generated based on intra prediction mode 5 and the residual signal generated based on intra prediction mode 6 may be almost similar or identical.

일반적으로, 잔여 신호에 여러 가지의 주파수 변환을 적응적으로 수행할 경우, 부호화 효율을 증가시킬 수 있다. 하지만, 어떠한 주파수 변환이 사용되었는지에 대한 시그널링 정보를 전송해야 하는 오버헤드가 따른다.In general, when various frequency conversions are adaptively performed on the residual signal, encoding efficiency may be increased. However, there is an overhead of transmitting signaling information on which frequency conversion is used.

만일 인트라 예측 모드 5번을 기반으로 하여 생성된 잔여 신호와 인트라 예측 모드 6번을 기반으로 하여 생성된 잔여 신호가 매우 유사하다고 가정해 보자. 이때 5번 모드에는 DCT 변환을 수행하고 6번 모드에는 DST 변환을 수행하도록 하면, 인코더에서는 인트라 예측 방향에 대한 선택만으로 유사한 잔여 신호에 대해 부호화 효율이 더 좋은 변환 방식을 선택할 수 있게 되며 어떠한 주파수 변환이 사용되었는지에 대한 시그널링 정보를 전송하지 않아도 된다.
Suppose that the residual signal generated based on intra prediction mode 5 and the residual signal generated based on intra prediction mode 6 are very similar. In this case, if DCT transform is performed in mode 5 and DST transform is performed in mode 6, the encoder can select a transform method with better coding efficiency for similar residual signals only by selecting the intra prediction direction. It is not necessary to transmit signaling information about whether this is used.

이하에서는 HEVC의 인트라 예측의 예를 들어 이러한 특성들을 이용하여 잔여 신호에 대한 부호화 효율을 높이는 구체적인 방법을 설명한다. 본 발명의 실시예에 따르면, 잔여 신호에 대해 인트라 예측 모드의 방향이 유사한 예측 모드끼리 그룹핑하고, 그룹핑에 의해 도출된 그룹을 기반으로 예측 모드 값에 따라 서로 다른 주파수 변환 방식을 사용하도록 한다. 이러한 본 발명에 따른 잔여 신호에 대한 주파수 변환 방법을 결정하는 실시예는 인트라 예측 및/또는 인터 예측에 적용될 수 있다. 또한, 휘도 신호에만 적용되거나 혹은 색차 신호에만 적용되거나 혹은 휘도 신호 및 색차 신호 모두에 적용될 수도 있다. 또한, 하나 이상의 특정 블록 크기(들)에만 적용하도록 제한하거나, 혹은 특정 블록 크기 이하(혹은 이상)에만 적용하도록 제한할 수도 있다. Hereinafter, a specific method of increasing coding efficiency for a residual signal using these characteristics, for example, for intra prediction of HEVC will be described. According to an embodiment of the present invention, prediction modes having similar directions of intra prediction modes are grouped with respect to the residual signal, and different frequency conversion schemes are used according to prediction mode values based on the group derived by the grouping. Such an embodiment of determining a frequency conversion method for the residual signal according to the present invention may be applied to intra prediction and / or inter prediction. It may also be applied only to the luminance signal or only to the chrominance signal or to both the luminance signal and the chrominance signal. It may also be restricted to only apply to one or more specific block size (s) or to only apply to or below (or more) a particular block size.

예를 들어, 잔여 신호에 대해 인트라 예측 모드의 방향이 유사한 모드끼리 그룹핑하기 위해, 인트라 예측 모드의 값이 홀수인지 짝수인지에 따라 예측 모드를 그룹핑할 수도 있고, 인트라 예측 모드의 값을 4로 나눈 나머지에 따라 예측 모드를 그룹핑할 수도 있다. For example, in order to group the modes of similar intra prediction modes with respect to the residual signal, the prediction modes may be grouped according to whether the value of the intra prediction mode is odd or even, and the value of the intra prediction mode divided by 4 The prediction modes may be grouped according to the rest.

인트라 예측 모드의 그룹핑 시, 모든 인트라 예측 모드에 대해 그룹핑을 적용할 수도 있고, 일부 인트라 예측 모드를 대상으로 그룹핑을 적용할 수도 있다. 예컨대, 인트라 예측 모드의 그룹핑 시, 평면 모드(이하, Planar 모드라 함) 및 평균 모드(이하, DC 모드라 함)에만 그룹핑을 적용할 수도 있고, 반대로 Planar 모드 및 DC 모드를 제외한 나머지 방향성 예측 모드에만 그룹핑을 적용할 수도 있다. When grouping intra prediction modes, grouping may be applied to all intra prediction modes, or grouping may be applied to some intra prediction modes. For example, when grouping the intra prediction mode, the grouping may be applied only to the planar mode (hereinafter referred to as planar mode) and the average mode (hereinafter referred to as DC mode), and conversely, the directional prediction mode except for the planar mode and DC mode. You can also apply grouping only to.

그룹핑에 의해 도출된 그룹에 대해 서로 다른 주파수 변환 방식을 사용할 수 있다. 아래는 주파수 변환 방식의 예이다. Different frequency conversion schemes may be used for groups derived by grouping. The following is an example of the frequency conversion method.

1. 수평 및 수직 방향으로 모두 DCT 변환을 수행1. Perform DCT conversion in both horizontal and vertical directions

2. 수평 및 수직 방향으로 모두 DST 변환을 수행2. Perform DST conversion in both horizontal and vertical directions

3. 수평 방향으로는 DCT 변환을 수행하고 수직방향으로는 DST 변환을 수행3. Perform DCT conversion in the horizontal direction and DST conversion in the vertical direction.

4. 수평 방향으로는 DST 변환을 수행하고 수직방향으로는 DCT 변환을 수행4. Perform DST conversion in the horizontal direction and DCT conversion in the vertical direction.

5. 수평 및 수직 방향으로 모두 무변환을 수행5. Perform no change in both horizontal and vertical directions

6. 수평 방향으로는 DCT 변환을 수행하고 수직방향으로는 무변환을 수행6. Perform DCT conversion in the horizontal direction and no conversion in the vertical direction.

7. 수평 방향으로는 무변환을 수행하고 수직방향으로는 DCT 변환을 수행7. Perform no conversion in the horizontal direction and DCT conversion in the vertical direction.

여기서, 무변환이란 주파수 변환(혹은 주파수 역변환)을 수행하지 않는 것을 의미한다.
Here, no conversion means not performing frequency conversion (or frequency inverse conversion).

도 12는 본 발명의 일 실시예에 따른 인트라 예측 모드에 따라 변환 방식을 결정하는 과정을 나타내는 순서도이다. 도 12 방법은 상술한 도 1의 부호화 장치 또는 상술한 도 2의 복호화 장치에서 수행될 수 있다. 도 12의 실시예에서는 설명의 편의를 위해 도 12의 방법이 부호화 장치에서 수행되는 것으로 설명하나, 이는 복호화 장치에서도 동일하게 적용될 수 있다.12 is a flowchart illustrating a process of determining a transformation scheme according to an intra prediction mode according to an embodiment of the present invention. 12 may be performed by the encoding apparatus of FIG. 1 or the decoding apparatus of FIG. 2 described above. In the embodiment of FIG. 12, for convenience of description, the method of FIG. 12 is described as being performed by the encoding apparatus. However, the same may be applied to the decoding apparatus.

도 12를 참조하면, 현재 블록이 인트라 예측 모드(intra)로 부호화되었고 현재 블록이 4x4 크기(trafoSize(혹은 iWidth) == 4)의 블록이면(S1200), 부호화 장치는 현재 블록에 대한 주파수 변환 방식으로 DST 혹은 DCT를 적용할 수 있다. 그렇지 않다면(S1200), 부호화 장치는 현재 블록의 주파수 변환 방식으로 DCT를 적용할 수 있다(S1250).Referring to FIG. 12, if the current block is encoded in an intra prediction mode and the current block is a block of 4x4 size (trafoSize (or iWidth) == 4) (S1200), the encoding apparatus performs a frequency conversion scheme on the current block. DST or DCT can be applied. Otherwise, the encoding apparatus may apply the DCT as the frequency transform scheme of the current block (S1250).

현재 블록이 휘도 블록이라면(S1210), 부호화 장치는 휘도 신호에 대한 인트라 예측 모드(Mode)를 획득한다(S1220). 만일 그렇지 않으면(S1210), 즉 현재 블록이 색차 블록이면, 부호화 장치는 현재 블록의 주파수 변환 방식으로 DCT를 적용할 수 있다(S1250).If the current block is a luminance block (S1210), the encoding apparatus obtains an intra prediction mode (Mode) for the luminance signal (S1220). If not (S1210), that is, if the current block is a chrominance block, the encoding apparatus may apply DCT as a frequency conversion scheme of the current block (S1250).

만일, 현재 블록의 인트라 예측 모드(Mode)가 짝수이면(예컨대, Mode%2 == 0)(S1230), 부호화 장치는 현재 블록의 주파수 변환 방식으로 수평 방향 및 수직 방향 모두에 DST를 적용할 수 있다(S1240).If the intra prediction mode (Mode) of the current block is even (eg, Mode% 2 == 0) (S1230), the encoding apparatus may apply the DST in both the horizontal direction and the vertical direction by using the frequency conversion method of the current block. There is (S1240).

그렇지 않고 만일 현재 블록의 인트라 예측 모드(Mode)가 홀수이면(예컨대, Mode%2 == 1)(S1230), 부호화 장치는 현재 블록의 주파수 변환 방식으로 수평 방향 및 수직 방향 모두에 DCT를 적용할 수 있다(S1250).Otherwise, if the intra prediction mode of the current block is odd (e.g., Mode% 2 == 1) (S1230), the encoding apparatus may apply the DCT in both the horizontal direction and the vertical direction using the frequency conversion scheme of the current block. It may be (S1250).

상술한 도 12의 실시예에서는 인트라 예측 모드를 모드의 값에 따라 홀수 그룹과 짝수 그룹으로 구분하고, 각 그룹(짝수 그룹과 홀수 그룹)마다 다른 주파수 변환 방식을 적용하도록 하였다. In the above-described embodiment of FIG. 12, the intra prediction mode is divided into odd groups and even groups according to the mode value, and different frequency conversion schemes are applied to each group (even and odd groups).

이때, 인트라 예측 모드 중 Planar 모드와 DC 모드는 하나의 그룹으로 여겨서 각각 다른 주파수 변환 방식을 결정할 수도 있다. 예를 들어, Planar 모드는 DST를 적용할 수 있고, DC 모드는 DCT를 적용할 수 있다.In this case, the planar mode and the DC mode among the intra prediction modes may be considered as one group and thus different frequency conversion methods may be determined. For example, the planar mode may apply DST, and the DC mode may apply DCT.

또한, 색차 신호의 LM 모드 경우에는 DST를 적용할 수 있으며, 혹은 DCT를 적용할 수 있다. 또한, LM 모드의 경우, 휘도 신호의 인트라 예측 모드를 사용하여 색차 신호의 잔여 신호에 대한 주파수 변환 방식으로 상술한 도 12의 실시 예를 적용할 수도 있다.
In addition, in the LM mode of the color difference signal, DST may be applied or DCT may be applied. In addition, in the LM mode, the above-described embodiment of FIG. 12 may be applied as a frequency conversion method for the residual signal of the color difference signal using the intra prediction mode of the luminance signal.

한편, 상술한 도 12의 방법은, HEVC를 기반으로 하여, 스케일된 변환 계수를 위한 변환 과정을 다음과 같이 수정할 수 있다. Meanwhile, in the above-described method of FIG. 12, a transformation process for scaled transform coefficients may be modified as follows based on HEVC.

여기서 입력은 다음과 같다. Where the input is:

- 현재 변환 블록의 너비 Width; nWWidth of the current transform block; nW

- 현재 변환 블록의 높이 Height; nHHeight of the current transform block; nH

- 요소(element) dij를 가진 스케일된 변환 계수의 배열; (nWxnH) array dAn array of scaled transform coefficients with element d ij ; (nWxnH) array d

- 현재 블록의 휘도 신호 및 색차 신호에 대한 인덱스; cIdxAn index for the luminance signal and the chrominance signal of the current block; cIdx

만일, cIdx 가 0이면 휘도 신호를 의미하고, cIdx가 1 이거나 혹은 cIdx가 2이면 색차 신호를 의미한다. 또한 cIdx 가 1이면 색차 신호에서 Cb를 의미하고, cIdx 가 2이면 색차 신호에서 Cr을 의미한다.If cIdx is 0, it means a luminance signal. If cIdx is 1 or cIdx is 2, it means a color difference signal. In addition, cIdx of 1 means Cb in the color difference signal, and cIdx of 2 means Cr in the color difference signal.

여기서 출력은 다음과 같다.Where the output is:

- 스케일된 변환 계수를 역변환하여 구해진 잔여 신호에 대한 배열; (nWxnH) array rAn array of residual signals obtained by inverse transforming the scaled transform coefficients; (nWxnH) array r

현재 블록에 대한 예측 모드(PredMode)가 인트라 예측 모드(Intra)이고, Log2(nW*nH) 값이 4와 같고 cIdx 값이 0이면, 아래의 과정이 수행되며, 만일 그렇지 않다면, 변수 horizTrType과 vertTrType은 0으로 설정된다.If the Prediction Mode (PredMode) for the current block is Intra Prediction Mode (Intra), Log2 (nW * nH) is equal to 4 and cIdx is 0, then the following process is performed, otherwise the variables horizTrType and vertTrType Is set to zero.

휘도 신호의 인트라 예측 모드가 짝수이면, 변수 horizTrType과 vertTrType은 1로 설정된다(즉, 수평 및 수직에 DST를 적용한다). 그렇지 않고 휘도 신호의 인트라 예측 모드가 홀수이면, 변수 horizTrType과 vertTrType은 0으로 설정된다(즉, 수평 및 수직에 DCT를 적용한다).If the intra prediction mode of the luminance signal is even, the variables horizTrType and vertTrType are set to 1 (ie, apply DST to horizontal and vertical). Otherwise, if the intra prediction mode of the luminance signal is odd, the variables horizTrType and vertTrType are set to 0 (i.e., apply DCT to horizontal and vertical).

변수 horizTrType과 vertTrType 값을 가지고 스케일된 변환 계수에 대한 역변환 과정을 수행한다. 먼저 현재 블록의 크기(nW, nH)와 스케일된 변환 계수 배열(nWxnH array d), 변수 horizTrType을 입력 받아 수평 방향으로 1차원 역변환을 수행하여 배열(nWxnH array e)를 출력한다.An inverse transform process is performed on scaled transform coefficients with the variables horizTrType and vertTrType. First, the size of the current block (nW, nH), the scaled transform coefficient array (nWxnH array d), and the variable horizTrType are input to perform a one-dimensional inverse transformation in the horizontal direction to output the array (nWxnH array e).

다음으로 배열(nWxnH array e)을 입력 받아 배열(nWxnH array g)을 다음 수학식 5와 같이 유도한다.Next, an array (nWxnH array e) is input and an array (nWxnH array g) is derived as shown in Equation 5 below.

Figure pat00008
Figure pat00008

다음으로 현재 블록의 크기(nW, nH)와 배열(nWxnH array g), 변수 vertTrType을 입력 받아 수직 방향으로 1차원 역변환을 수행한다.Next, one-dimensional inverse transform is performed in the vertical direction by receiving the size of the current block (nW, nH), the array (nWxnH array g), and the variable vertTrType.

다음으로 cIdx에 따라 잔여 신호에 대한 배열 (nWxnH) array r을 다음 수학식 6과 같이 설정한다.Next, the array (nWxnH) array r for the residual signal according to cIdx is set as in Equation 6 below.

Figure pat00009
Figure pat00009

여기서 shift는 cIdx가 0일 때는 shift = 20 - BitDepthY이고, 그렇지 않으면 shift = 20 - BitDepthC 값을 가진다. BitDepth는 현재 영상에 대한 샘플의 비트수(예를 들어, 8 비트)를 의미한다.
Here, shift is shift = 20-BitDepth Y when cIdx is 0, otherwise shift = 20-BitDepth C. BitDepth means the number of bits (eg, 8 bits) of the sample for the current image.

한편, 주파수 변환 방식을 선택하기 위한 인트라 예측 모드는 아래의 예와 같이 다양한 방법으로 가져올 수 있다. On the other hand, the intra prediction mode for selecting the frequency conversion scheme can be brought in a variety of ways as shown in the following example.

1. 현재 블록의 휘도 신호에 대한 인트라 예측 모드를 휘도 신호 및 색차 신호에 대한 잔여 신호(혹은 잔여 영상)에 모두 적용하여 주파수 변환 방식을 유도하는데 사용할 수 있다.1. The intra prediction mode of the luminance signal of the current block may be applied to both the luminance signal and the residual signal (or residual image) for the chrominance signal to be used to derive the frequency conversion scheme.

2. 현재 블록의 색차 신호에 대한 인트라 예측 모드를 휘도 신호 및 색차 신호에 대한 잔여 신호(혹은 잔여 영상)에 모두 적용하여 주파수 변환 방식을 유도하는데 사용할 수 있다.2. The intra prediction mode for the chrominance signal of the current block may be applied to both the luminance signal and the residual signal (or residual image) for the chrominance signal to be used to derive the frequency conversion scheme.

3. 현재 블록의 휘도 신호에 대한 인트라 예측 모드에는 DCT 혹은 DST만을 사용할 수 있다. 그리고 현재 블록의 색차 신호에 대한 인트라 예측 모드를 색차 신호에 대한 잔여 신호(혹은 잔여 영상)의 주파수 변환 방식을 유도하는데 사용할 수 있다.3. DCT or DST can be used only for the intra prediction mode for the luminance signal of the current block. The intra prediction mode for the color difference signal of the current block may be used to derive a frequency conversion method of the residual signal (or residual image) for the color difference signal.

상술한 방법 이외에도 다양한 방법으로 주파수 변환 방식은 유도될 수 있다.In addition to the above-described method, the frequency conversion scheme may be derived in various ways.

이때, 인트라 예측 모드에 따른 주파수 변환 방식은 다양한 방법으로 사용될 수 있다. 예를 들어, DC 모드는 DCT를 적용하고, DC 모드를 제외한 다른 모드는 수평 및 수직 방향에 DST를 적용할 수 있다.
In this case, the frequency conversion scheme according to the intra prediction mode may be used in various ways. For example, the DC mode may apply DCT, and other modes except the DC mode may apply DST in the horizontal and vertical directions.

도 13은 본 발명의 다른 실시예에 따른 인트라 예측 모드에 따라 변환 방식을 결정하는 과정을 나타내는 순서도이다. 도 13의 방법은 상술한 도 1의 부호화 장치 또는 상술한 도 2의 복호화 장치에서 수행될 수 있다. 도 13의 실시예에서는 설명의 편의를 위해 도 13의 방법이 부호화 장치에서 수행되는 것으로 설명하나, 이는 복호화 장치에서도 동일하게 적용될 수 있다.13 is a flowchart illustrating a process of determining a transformation scheme according to an intra prediction mode according to another embodiment of the present invention. The method of FIG. 13 may be performed by the encoding apparatus of FIG. 1 or the decoding apparatus of FIG. 2 described above. In the embodiment of FIG. 13, for convenience of description, the method of FIG. 13 is described as being performed by an encoding apparatus, but the same may be applied to the decoding apparatus.

도 13을 참조하면, 현재 블록이 인트라 예측 모드(intra)로 부호화되었고 현재 블록이 4x4 크기(trafoSize(혹은 iWidth) == 4)의 블록이면(S1300), 부호화 장치는 현재 블록에 대한 주파수 변환 방식으로 DST 혹은 DCT를 적용할 수 있다. 그렇지 않다면(S1300), 부호화 장치는 현재 블록의 주파수 변환 방식으로 DCT를 적용할 수 있다(S1390).Referring to FIG. 13, when the current block is encoded in the intra prediction mode and the current block is a block of 4x4 size (trafoSize (or iWidth) == 4) (S1300), the encoding apparatus performs a frequency conversion scheme on the current block. DST or DCT can be applied. If not (S1300), the encoding apparatus may apply DCT as the frequency conversion method of the current block (S1390).

현재 블록이 휘도 블록이라면(S1310), 부호화 장치는 휘도 신호에 대한 인트라 예측 모드(Mode)를 획득한다(S1320). 만일 그렇지 않으면(S1310), 즉 현재 블록이 색차 블록이면, 부호화 장치는 현재 블록의 주파수 변환 방식으로 DCT를 적용할 수 있다(S1390).If the current block is a luminance block (S1310), the encoding apparatus obtains an intra prediction mode for the luminance signal (S1320). If not (S1310), that is, if the current block is a chrominance block, the encoding apparatus may apply DCT as a frequency conversion scheme of the current block (S1390).

만일, 현재 블록의 인트라 예측 모드(Mode)를 4로 나눈 나머지가 0일 경우(예컨대, Mode%4 == 0)(S1330), 부호화 장치는 현재 블록의 주파수 변환 방식으로 수평 방향 및 수직 방향 모두에 DST를 적용할 수 있다(S1360).If the remainder obtained by dividing the intra prediction mode (Mode) of the current block by 4 is 0 (eg, Mode% 4 == 0) (S1330), the encoding apparatus performs both horizontal and vertical directions in the frequency conversion scheme of the current block. It is possible to apply the DST to (S1360).

그렇지 않고 만일 현재 블록의 인트라 예측 모드(Mode)를 4로 나눈 나머지가 1일 경우(예컨대, Mode%4 == 1)(S1340), 부호화 장치는 현재 블록의 주파수 변환 방식으로 수평 방향에 DST를 적용하고 수직 방향에 DCT를 적용할 수 있다(S1370). 혹은 수평 방향에 DCT를 적용하고 수직 방향에 DST를 적용할 수도 있다.Otherwise, if the remainder obtained by dividing the intra prediction mode (Mode) of the current block by 4 is 1 (for example, Mode% 4 == 1) (S1340), the encoding apparatus performs DST in the horizontal direction by using the frequency conversion method of the current block. DCT may be applied in the vertical direction (S1370). Alternatively, DCT may be applied in the horizontal direction and DST may be applied in the vertical direction.

그렇지 않고 만일 현재 블록의 인트라 예측 모드(Mode)를 4로 나눈 나머지가 2일 경우(예컨대, Mode%4 == 2)(S1350), 부호화 장치는 현재 블록의 주파수 변환 방식으로 수평 방향에 DCT를 적용하고 수직 방향에 DST를 적용할 수 있다(S1380). 혹은 수평 방향에 DST를 적용하고 수직 방향에 DCT를 적용할 수도 있다.Otherwise, if the remainder of dividing the intra prediction mode (Mode) of the current block by 4 is 2 (eg, Mode% 4 == 2) (S1350), the encoding apparatus performs DCT in the horizontal direction by using the frequency conversion method of the current block. DST may be applied in the vertical direction (S1380). Alternatively, DST may be applied in the horizontal direction and DCT may be applied in the vertical direction.

그렇지 않고 만일 현재 블록의 인트라 예측 모드(Mode)를 4로 나눈 나머지가 3일 경우(예컨대, Mode%4 == 3)(S1350), 부호화 장치는 현재 블록의 주파수 변환 방식으로 수평 방향 및 수직 방향에 DCT를 적용할 수 있다(S1390).Otherwise, if the intra prediction mode (Mode) of the current block divided by 4 is 3 (eg, Mode% 4 == 3) (S1350), the encoding apparatus performs horizontal and vertical directions in the frequency conversion scheme of the current block. DCT can be applied to the control (S1390).

상술한 도 13의 실시예에서는 인트라 예측 모드를 모드의 값에 따라 4개의 그룹(예컨대, 인트라 예측 모드의 모드 값을 4로 나눈 나머지에 따라 4개의 그룹)으로 구분하고, 각 그룹마다 다른 주파수 변환 방식을 적용하도록 하였다. In the above-described embodiment of FIG. 13, the intra prediction mode is divided into four groups according to the mode value (for example, four groups according to the remainder obtained by dividing the mode value of the intra prediction mode by 4), and the frequency conversion is different for each group. The method was applied.

상술한 도 12 및 도 13의 실시예에 따른 인트라 예측 모드의 그룹 개수는 하나의 예시일 뿐이며, 본 발명이 이에 한정되는 것은 아니다. 상술한 방법 이외에도 다른 방법으로 인트라 예측 모드를 그룹핑하여 각 그룹마다 서로 다른 변환 방식을 적용할 수 있다.
The number of groups of intra prediction modes according to the embodiments of FIGS. 12 and 13 described above is just one example, and the present invention is not limited thereto. In addition to the above-described method, different prediction methods may be applied to each group by grouping the intra prediction modes using other methods.

한편, 상술한 도 13의 방법은, HEVC를 기반으로 하여, 스케일된 변환 계수를 위한 변환 과정을 다음과 같이 수정할 수 있다.Meanwhile, in the aforementioned method of FIG. 13, a transformation process for scaled transform coefficients may be modified as follows based on HEVC.

여기서 입력은 다음과 같다. Where the input is:

- 현재 변환 블록의 너비 Width; nWWidth of the current transform block; nW

- 현재 변환 블록의 높이 Height; nHHeight of the current transform block; nH

- 요소(element) dij를 가진 스케일된 변환 계수의 배열; (nWxnH) array dAn array of scaled transform coefficients with element d ij ; (nWxnH) array d

- 현재 블록의 휘도 신호 및 색차 신호에 대한 인덱스; cIdxAn index for the luminance signal and the chrominance signal of the current block; cIdx

만일, cIdx 가 0이면 휘도 신호를 의미하고, cIdx가 1 이거나 혹은 cIdx가 2이면 색차 신호를 의미한다. 또한 cIdx 가 1이면 색차 신호에서 Cb를 의미하고, cIdx 가 2이면 색차 신호에서 Cr을 의미한다.If cIdx is 0, it means a luminance signal. If cIdx is 1 or cIdx is 2, it means a color difference signal. In addition, cIdx of 1 means Cb in the color difference signal, and cIdx of 2 means Cr in the color difference signal.

여기서 출력은 다음과 같다.Where the output is:

- 스케일된 변환 계수를 역변환하여 구해진 잔여 신호에 대한 배열; (nWxnH) array rAn array of residual signals obtained by inverse transforming the scaled transform coefficients; (nWxnH) array r

현재 블록에 대한 예측 모드(PredMode)가 인트라 예측 모드(Intra)이고, Log2(nW*nH) 값이 4와 같고 cIdx 값이 0이면, 아래의 과정이 수행되며, 만일 그렇지 않다면, 변수 horizTrType과 vertTrType은 0으로 설정된다.If the Prediction Mode (PredMode) for the current block is Intra Prediction Mode (Intra), Log2 (nW * nH) is equal to 4 and cIdx is 0, then the following process is performed, otherwise the variables horizTrType and vertTrType Is set to zero.

휘도 신호의 인트라 예측 모드를 4로 나눈 나머지가 0이면, 변수 horizTrType과 vertTrType은 1로 설정된다(즉, 수평 및 수직에 DST를 적용한다). 그렇지 않고 휘도 신호의 인트라 예측 모드를 4로 나눈 나머지가 1이면, 변수 horizTrType은 1로 vertTrType은 0으로 설정된다(즉, 수평에는 DST를 적용하고 수직에는 DCT적용한다). 그렇지 않고 휘도 신호의 인트라 예측 모드를 4로 나눈 나머지가 2이면, 변수 horizTrType은 0으로 vertTrType은 1로 설정된다(즉, 수평에는 DCT를 적용하고 수직에는 DST적용한다). 그렇지 않고 휘도 신호의 인트라 예측 모드를 4로 나눈 나머지가 3이면(0,1,2가 아닌 경우), 변수 horizTrType과 vertTrType은 0으로 설정된다(즉, 수평 및 수직에 DCT를 적용한다).If the intra prediction mode of the luminance signal divided by 4 is 0, the variables horizTrType and vertTrType are set to 1 (i.e., apply DST to horizontal and vertical). Otherwise, if the intra prediction mode of the luminance signal divided by 4 is 1, the variable horizTrType is set to 1 and vertTrType is set to 0 (ie, DST is applied horizontally and DCT is applied vertically). Otherwise, if the intra prediction mode of the luminance signal divided by 4 is 2, the variable horizTrType is set to 0 and vertTrType is set to 1 (ie, DCT is applied horizontally and DST is applied vertically). Otherwise, if the intra prediction mode of the luminance signal divided by 4 is 3 (if not 0, 1, 2), the variables horizTrType and vertTrType are set to 0 (ie, apply DCT to horizontal and vertical).

변수 horizTrType과 vertTrType 값을 가지고 스케일된 변환 계수에 대한 역변환 과정을 수행한다. 먼저 현재 블록의 크기(nW, nH)와 스케일된 변환 계수 배열(nWxnH array d), 변수 horizTrType 을 입력 받아 수평 방향으로 1차원 역변환을 수행하여 배열(nWxnH array e)를 출력한다.An inverse transform process is performed on scaled transform coefficients with the variables horizTrType and vertTrType. First of all, the size of the current block (nW, nH), the scaled transform coefficient array (nWxnH array d), and the variable horizTrType are input to perform a one-dimensional inverse transformation in the horizontal direction to output the array (nWxnH array e).

다음으로 배열(nWxnH array e)을 입력 받아 배열(nWxnH array g)를 다음 수학식 7과 같이 유도한다.Next, an array (nWxnH array e) is input and an array (nWxnH array g) is derived as shown in Equation 7 below.

Figure pat00010
Figure pat00010

다음으로 현재 블록의 크기(nW, nH)와 배열(nWxnH array g), 변수 vertTrType 을 입력 받아 수직 방향으로 1차원 역변환을 수행한다.Next, one-dimensional inverse transformation is performed in the vertical direction by receiving the size of the current block (nW, nH), the array (nWxnH array g), and the variable vertTrType.

다음으로 cIdx에 따라 잔여 신호에 대한 배열 (nWxnH) array r을 다음 수학식 8과 같이 설정한다.Next, the array (nWxnH) array r for the residual signal according to cIdx is set as in Equation 8.

Figure pat00011
Figure pat00011

여기서 shift는 cIdx가 0일 때는 shift = 20 - BitDepthY이고, 그렇지 않으면 shift = 20 - BitDepthC 값을 가진다. BitDepth는 현재 영상에 대한 샘플의 비트수(예를 들어, 8 비트)를 의미한다.
Here, shift is shift = 20-BitDepth Y when cIdx is 0, otherwise shift = 20-BitDepth C. BitDepth means the number of bits (eg, 8 bits) of the sample for the current image.

상술한 실시예들에서 그룹핑을 보다 효율적으로 하기 위한 방법으로 2개 단위로 계층적 그룹핑하는 방식을 사용할 수도 있다. 예를 들어, 상술한 도 13의 실시예를 이용하여 계층적 그룹핑 방법을 설명하면, Mode%2 값이 0인 경우와 1인 경우로 먼저 그룹핑하고, 이후 각 그룹에 대해 (Mode>>1)%2의 값이 0인지 1인지에 따라 그룹핑하여 변환 방식을 결정할 수 있다.In the above-described embodiments, a hierarchical grouping in two units may be used as a method for more effectively grouping. For example, when the hierarchical grouping method is described using the embodiment of FIG. 13 described above, grouping is performed first when the Mode% 2 value is 0 and 1, and then (Mode >> 1) for each group. The conversion method can be determined by grouping according to whether the value of% 2 is 0 or 1.

또한, 상술한 도 9 내지 도 13의 방법들은 현재 블록의 휘도 및 색차 신호에 대하여 다양하게 적용할 수 있으며, 일예로 다음과 같이 적용할 수 있다.In addition, the above-described methods of FIGS. 9 to 13 may be variously applied to the luminance and color difference signals of the current block, and may be applied as follows, for example.

현재 블록이 휘도 블록이면(혹은 색차 블록이면서 색차 블록의 인트라 예측 모드가 LM 모드라면), 휘도 신호에 대한 인트라 예측 모드(IntraPredMode)를 가져온다. 여기서, 현재 블록의 휘도 신호에 대한 인트라 예측 모드는 휘도 신호 및 색차 신호에 대한 잔여 신호(혹은 잔여 영상)의 주파수 변환 방식을 유도하는데 사용될 수 있다. 만일 그렇지 않으면, 색차 블록이 DM 모드인지 판단한다. 만일, 현재 블록이 색차 블록이고 DM 블록이라면, 현재 블록의 주파수 변환 방식으로 DCT를 적용할 수 있다. 그렇지 않고 만일, 현재 블록이 색차 블록이고 DM 블록이 아니라면, 색차 신호에 대한 인트라 예측 모드는 색차 신호에 대한 잔여 신호(혹은 잔여 영상)의 주파수 변환 방식을 유도하는데 사용될 수 있다.
If the current block is a luminance block (or a chrominance block and the intra prediction mode of the chrominance block is an LM mode), an intra prediction mode (IntraPredMode) for the luminance signal is obtained. Here, the intra prediction mode for the luminance signal of the current block may be used to derive a frequency conversion scheme of the residual signal (or residual image) for the luminance signal and the chrominance signal. If not, it is determined whether the color difference block is in DM mode. If the current block is a color difference block and a DM block, DCT may be applied as a frequency conversion method of the current block. Otherwise, if the current block is a chrominance block and not a DM block, the intra prediction mode for the chrominance signal may be used to derive the frequency conversion scheme of the residual signal (or residual image) for the chrominance signal.

한편, 상술한 실시예들은 블록 크기 혹은 CU 깊이 혹은 TU 깊이 등에 따라 주파수 변환 방식의 적용 범위를 달리할 수 있다. 이렇게 적용 범위를 결정하는 변수(예컨대, 블록의 크기 혹은 깊이 정보)는, 부호화기 및 복호화기가 미리 정해진 값을 사용하도록 설정할 수도 있고, 프로파일 또는 레벨에 따라 정해진 값을 사용하도록 할 수도 있고, 부호화기가 변수 값을 비트스트림에 기재하면 복호화기가 비트스트림으로부터 이 값을 구하여 사용할 수도 있다. Meanwhile, the above-described embodiments may vary the application range of the frequency conversion scheme according to the block size or the CU depth or the TU depth. The variable (for example, the size or depth information of the block) for determining the coverage can be set such that the encoder and the decoder use a predetermined value or use a predetermined value according to the profile or the level, If the value is written in the bitstream, the decoder may use this value from the bitstream.

표 4는 CU 깊이에 따라 주파수 변환 방식의 적용 범위를 달리하는 방법의 일예를 나타낸다. 예컨대, 방법 A는 주어진 깊이 이상의 깊이에만 특정 변환 방법을 적용하는 방식, 방법 B는 주어진 깊이 이하에만 특정 변환 방법을 적용하는 방식, 방법 C는 주어진 깊이에만 특정 변환 방법을 적용하는 방식일 수 있다. 아래 표 4에서 CU(혹은 TU)의 해당 깊이에 해당 방법을 적용하는 경우에는 O로 표기하였으며, CU(혹은 TU)의 해당 깊이에 해당 방법을 적용하지 않을 경우에는 X로 표기 하였다. Table 4 shows an example of a method of varying the application range of the frequency conversion scheme according to the CU depth. For example, Method A may apply a specific transformation method only to a depth above a given depth, Method B may apply a specific transformation method only below a given depth, and Method C may apply a specific transformation method only to a given depth. In Table 4 below, when the method is applied to the corresponding depth of the CU (or TU), it is marked as O, and when the method is not applied to the corresponding depth of the CU (or TU), it is marked as X.

Figure pat00012
Figure pat00012

표 4를 참조하면, CU(혹은 TU) 깊이가 2인 경우, 본 발명의 실시예들에 대해 방법 A, 방법 B, 방법 C를 모두 적용할 수 있다.Referring to Table 4, when the CU (or TU) depth is 2, all of the method A, method B, method C can be applied to the embodiments of the present invention.

CU(혹은 TU)의 모든 깊이에 대하여 본 발명의 실시예들을 적용하지 않는 경우, 임의의 지시자(예를 들어, flag)를 사용하여 나타낼 수도 있고, CU 깊이의 최대값보다 하나 더 큰 값을 적용 범위를 나타내는 CU 깊이 값으로 시그널링 함으로써 표현할 수도 있다.If the embodiments of the present invention are not applied to all depths of a CU (or TU), they may be indicated using any indicator (eg, a flag), and one greater than the maximum value of the CU depth is applied. It may be expressed by signaling with a CU depth value indicating a range.

또한, 상술한 블록 크기 혹은 블록 깊이에 따라 주파수 변환 방식의 적용 범위를 달리하는 방법은 휘도 신호와 색차 신호 간의 해상도가 다른 경우에도 적용할 수 있다. 이하, 도 14 및 도 15를 참조하여 휘도 신호와 색차 신호 간의 해상도가 다른 경우 주파수 변환 방식의 적용 범위를 결정하는 방법에 대해 설명한다.
In addition, the method of varying the application range of the frequency conversion scheme according to the above-described block size or block depth may be applied even when the resolution between the luminance signal and the color difference signal is different. Hereinafter, a method of determining an application range of the frequency conversion method when the resolution between the luminance signal and the color difference signal is different will be described with reference to FIGS. 14 and 15.

도 14는 본 발명의 실시예에 따라 주파수 변환 방식의 적용 범위를 결정하는 방법을 설명하기 위한 휘도 블록과 색차 블록 간의 해상도 차이의 일예를 도시한 도면이다. 14 is a diagram illustrating an example of a resolution difference between a luminance block and a chrominance block for explaining a method of determining an application range of a frequency conversion method according to an embodiment of the present invention.

도 14를 참조하면, 색차 영상이 휘도 영상의 1/4 크기라고 가정했을 때(예를 들어, 휘도 영상이 416x240 크기, 색차 영상이 208x120 크기), 8x8 크기의 휘도 블록(1410)은 4x4 크기의 색차 블록(1420)에 해당한다. Referring to FIG. 14, when it is assumed that a chrominance image is 1/4 size of a luminance image (for example, the luminance image is 416x240 size and the chrominance image is 208x120 size), the 8x8 luminance block 1410 is 4x4 size. Corresponds to the color difference block 1420.

이 경우, 8x8 크기의 휘도 블록(1410)은 4개의 4x4 크기 휘도 블록이 있을 수 있으며, 4x4 크기 휘도 블록마다 각각 인트라 예측 모드를 가질 수 있다. 반면, 4x4 크기의 색차 블록(1420)은 2x2 크기의 색차 블록으로 나누어지지 않을 수 있다. 4x4 크기의 색차 블록(1420)은 하나의 인트라 예측 모드를 가질 수 있다.In this case, the 8x8 sized luminance block 1410 may have four 4x4 sized luminance blocks, and each 4x4 sized luminance block may have an intra prediction mode. On the other hand, the 4x4 sized color difference block 1420 may not be divided into a 2x2 sized color difference block. The 4x4 sized color difference block 1420 may have one intra prediction mode.

이때, 4x4 크기의 색차 블록(1420)이 LM 모드로 부호화 되었을 경우 혹은 4x4 크기의 색차 블록(1420)이 DM 모드(휘도 신호의 인트라 예측 모드를 색차 신호의 인트라 예측 모드로 그대로 사용하는 모드)로 부호화 되었을 경우, 4x4 크기의 색차 블록(1420)의 잔여 신호(혹은 잔여 영상)에 대한 주파수 변환 방식을 유도하기 위한 8x8 크기의 휘도 블록(1410)의 인트라 예측 모드는 4개의 4x4 크기 휘도 블록의 인트라 예측 모드 중 하나가 사용될 수 있다. In this case, when the 4x4 sized color difference block 1420 is encoded in the LM mode or the 4x4 sized color difference block 1420 is in the DM mode (the mode that uses the intra prediction mode of the luminance signal as the intra prediction mode of the color difference signal). When encoded, the intra prediction mode of the 8x8 luminance block 1410 for inducing a frequency conversion scheme for the residual signal (or residual image) of the 4x4 sized chrominance block 1420 is an intra of four 4x4 luminance blocks. One of the prediction modes may be used.

색차 신호의 잔여 신호에 대하여 선택적으로 주파수 변환 방식을 적용하기 위해서, 인트라 예측 모드를 유도하는 방법은 다음과 같이 다양하게 적용될 수 있다.In order to selectively apply a frequency conversion scheme to the residual signal of the chrominance signal, a method of deriving an intra prediction mode may be variously applied as follows.

1. 일 실시예로, 휘도 신호 블록 좌상단에 위치한 블록의 인트라 예측 모드를 사용할 수 있다.1. In one embodiment, the intra prediction mode of the block located at the upper left of the luminance signal block may be used.

2. 다른 실시예로, 휘도 신호 블록 우상단 혹은 좌하단 혹은 우하단에 위치한 블록의 인트라 예측 모드를 사용할 수 있다.2. In another embodiment, an intra prediction mode of a block located at the upper right end, the lower left end, or the lower right end of the luminance signal block may be used.

3. 또 다른 실시예로, 4가지 휘도 신호 블록들의 평균 값 혹은 중간 값을 사용할 수 있다.3. In another embodiment, an average value or a median value of four luminance signal blocks may be used.

4. 또 다른 실시예로, 현재 블록의 4가지 휘도 신호 블록들과 현재 블록의 주변 블록들의 색차 신호 블록들의 인트라 예측 모드들을 이용한 평균 값 혹은 중간 값 등을 사용할 수 있다.4. In another embodiment, an average value or an intermediate value using intra prediction modes of the four luminance signal blocks of the current block and the color difference signal blocks of the neighboring blocks of the current block may be used.

상술한 방법 이외에도 다양한 방법으로 색차 신호에 대한 인트라 예측 모드를 유도할 수 있다.
In addition to the above-described method, the intra prediction mode for the color difference signal may be derived in various ways.

도 15는 본 발명의 실시예에 따라 주파수 변환 방식의 적용 범위를 결정하는 방법을 설명하기 위한 휘도 블록과 색차 블록 간의 해상도 차이의 다른 예를 도시한 도면이다. FIG. 15 is a diagram illustrating another example of a resolution difference between a luminance block and a chrominance block for explaining a method of determining an application range of a frequency conversion method according to an embodiment of the present invention.

도 15를 참조하면, 16x16 크기의 휘도 블록(1510)은 1개의 인트라 예측 모드를 가질 수 있다. 반면, 8x8 크기의 색차 블록(1520)은 4개의 4x4 크기 색차 블록으로 나누어질 수 있으며, 4x4 크기 색차 블록 각각에 대하여 인트라 예측 모드를 가질 수 있다.Referring to FIG. 15, a luminance block 1510 having a size of 16 × 16 may have one intra prediction mode. On the other hand, the 8x8 sized chrominance block 1520 may be divided into four 4x4 sized chrominance blocks and may have an intra prediction mode for each of the 4x4 sized chrominance blocks.

이때, 8x8 크기의 색차 블록(1520)이 LM 모드로 부호화 되었을 경우 혹은 8x8 크기의 색차 블록(1520)이 DM 모드(휘도 신호의 인트라 예측 모드를 색차 신호의 인트라 예측 모드로 그대로 사용하는 모드)로 부호화 되었을 경우, 16x16 크기의 휘도 블록(1510)의 인트라 예측 모드가 8x8 크기의 색차 블록(1520)의 잔여 신호(혹은 잔여 영상)에 대한 주파수 변환 방식을 유도하기 위해 사용될 수 있다. 혹은 8x8 크기의 색차 블록(1520)의 잔여 신호에 대한 주파수 변환 방식을 유도하기 위해 현재 블록의 주변 블록들(휘도 블록 혹은 색차 블록)로부터 인트라 예측 모드를 유도하여 사용할 수 있다.
At this time, when the 8x8 color difference block 1520 is encoded in the LM mode or the 8x8 size color difference block 1520 is in the DM mode (a mode in which the intra prediction mode of the luminance signal is used as the intra prediction mode of the color difference signal). When encoded, the intra prediction mode of the luminance block 1510 of size 16x16 may be used to derive a frequency conversion scheme for the residual signal (or residual image) of the color difference block 1520 of size 8x8. Alternatively, an intra prediction mode may be derived from a neighboring block (a luminance block or a chrominance block) of the current block to derive a frequency conversion method for the residual signal of the 8x8 color difference block 1520.

상술한 주파수 변환 방식의 적용 범위는 휘도 블록의 크기에 따라 색차 블록에 다르게 적용될 수 있으며, 휘도 신호 및 색차 신호에 다르게 적용될 수도 있으며, 수평 방향 및 수직 방향에 따라 다르게 적용될 수도 있다. The aforementioned application range of the frequency conversion scheme may be differently applied to the chrominance block according to the size of the luminance block, may be applied differently to the luminance signal and the chrominance signal, or may be differently applied according to the horizontal direction and the vertical direction.

표 5는 블록 크기, 색차 신호 및 휘도 신호, 수직 방향 및 수평 방향 등에 따라 주파수 변환 방식의 적용 범위를 결정하는 방법의 일예를 나타낸다.Table 5 shows an example of a method of determining the application range of the frequency conversion method according to the block size, the color difference signal and the luminance signal, the vertical direction and the horizontal direction.

Figure pat00013
Figure pat00013

표 5의 방법들 중 방법 사 1을 살펴보면, 휘도 블록의 크기가 8(8x8, 8x4, 2x8 등)인 경우이고, 그리고 색차 블록의 크기가 4(4x4, 4x2, 2x4)인 경우, 본 발명의 실시예에 따른 인트라 예측 모드에 따라 변환 방식을 결정하는 방법은 휘도 신호 및 색차 신호 및 수평 신호 및 수직 신호에 적용될 수 있다. Referring to Method 4 of Table 5, when the size of the luminance block is 8 (8x8, 8x4, 2x8, etc.), and the size of the color difference block is 4 (4x4, 4x2, 2x4), The method of determining the conversion scheme according to the intra prediction mode may be applied to the luminance signal, the color difference signal, the horizontal signal, and the vertical signal.

표 5의 방법들 중 방법 파 2를 살펴보면, 휘도 블록의 크기가 16(16x16, 8x16, 4x16 등)인 경우이고, 그리고 색차 블록의 크기가 4(4x4, 4x2, 2x4)인 경우, 본 발명의 실시예에 따른 인트라 예측 모드에 따라 변환 방식을 결정하는 방법은 휘도 신호 및 색차 신호 및 수평 신호에 적용될 수 있고 수직 신호에는 적용되지 않을 수 있다.
Looking at the method wave 2 of the method of Table 5, when the size of the luminance block is 16 (16x16, 8x16, 4x16, etc.), and the size of the color difference block is 4 (4x4, 4x2, 2x4), The method of determining the conversion scheme according to the intra prediction mode according to the embodiment may be applied to the luminance signal, the color difference signal, and the horizontal signal, but not to the vertical signal.

상술한 본 발명의 실시예들은 변환 계수 스캔 방식 결정을 위해서도 적용 가능하다. 이하에서는 HEVC의 인트라 예측 모드에 따른 변환 계수 스캔 방식의 예를 들어 본 발명을 적용하는 구체적인 방법을 설명한다. 본 발명의 실시예에 따르면, 잔여 신호의 특성이 유사한 예측 모드를 그룹핑하고, 그룹핑에 의해 도출된 그룹을 기반으로 예측 모드 값에 따라 서로 다른 변환 계수 스캔 순서를 사용하도록 한다. 이러한 본 발명의 실시예에 따른 방법은 인트라 예측 및/또는 인터 예측에 적용될 수 있다. 또한, 휘도 신호에만 적용되거나 혹은 색차 신호에만 적용되거나 혹은 휘도 신호 및 색차 신호에 모두 적용될 수도 있다. 또한, 하나 이상의 특정 블록 크기(들)에만 적용하도록 제한하거나, 혹은 특정 블록 크기 이하(혹은 이상)에만 적용하도록 제한할 수도 있다. The above-described embodiments of the present invention are also applicable for determining the transform coefficient scan method. Hereinafter, a specific method of applying the present invention to an example of a transform coefficient scan method according to the intra prediction mode of HEVC will be described. According to an embodiment of the present invention, a prediction mode having similar characteristics of residual signals is grouped, and different transform coefficient scan orders are used according to prediction mode values based on the group derived by the grouping. Such a method according to an embodiment of the present invention may be applied to intra prediction and / or inter prediction. Further, the present invention may be applied only to the luminance signal, only to the chrominance signal, or both to the luminance signal and the chrominance signal. It may also be restricted to only apply to one or more specific block size (s) or to only apply to or below (or more) a particular block size.

예를 들어, 잔여 신호에 대해 인트라 예측 모드의 방향이 유사한 모드끼리 그룹핑하기 위해, 인트라 예측 모드의 값을 3으로 나눈 나머지에 따라 예측 모드를 그룹핑할 수도 있고, 인트라 예측 모드 중 Planar 모드와 DC 모드를 하나의 그룹으로 하여 각각 다른 스캔 방식을 결정할 수도 있다.For example, in order to group the modes of similar intra prediction modes with respect to the residual signal, the prediction modes may be grouped according to the remainder obtained by dividing the value of the intra prediction mode by 3, and the planar mode and the DC mode among the intra prediction modes. As a group, different scan schemes may be determined.

이때, 각 그룹마다 서로 다른 스캔 방식을 사용할 수 있으며, 다음과 같은 스캔 방식을 사용할 수 있다. In this case, different scan methods may be used for each group, and the following scan methods may be used.

1. 상단 우측 방향(DIAG; Up-right = 0) 스캔1. Scan the top right direction (DIAG; Up-right = 0)

2. 수평 방향(HOR; Horizontal = 1) 스캔2. Scan horizontal (HOR; Horizontal = 1)

3. 수직 방향(VER; Vertical = 2) 스캔3. Vertical (VER; Vertical = 2) scan

이 외에도 지그재그(zigzag) 스캔 방식이 있을 수 있다.
In addition, there may be a zigzag scan method.

도 16은 본 발명의 일 실시예에 따른 인트라 예측 모드에 따라 스캔 방식을 결정하는 과정을 나타내는 순서도이다. 도 16의 방법은 상술한 도 1의 부호화 장치 또는 상술한 도 2의 복호화 장치에서 수행될 수 있다. 도 16의 실시예에서는 설명의 편의를 위해 도 16의 방법이 부호화 장치에서 수행되는 것으로 설명하나, 이는 복호화 장치에서도 동일하게 적용될 수 있다.16 is a flowchart illustrating a process of determining a scan method according to an intra prediction mode according to an embodiment of the present invention. The method of FIG. 16 may be performed by the encoding apparatus of FIG. 1 or the decoding apparatus of FIG. 2 described above. In the embodiment of FIG. 16, for convenience of description, the method of FIG. 16 is described as being performed by the encoding apparatus, but the same may be applied to the decoding apparatus.

도 16을 참조하면, 휘도 및 색차 신호에 대한 스캔 방향의 유도는 휘도 및 색차 신호의 인트라 예측 모드로 결정된다. Referring to FIG. 16, the derivation of the scan direction with respect to the luminance and color difference signals is determined as an intra prediction mode of the luminance and color difference signals.

현재 블록이 인트라 예측 모드(intra)로 부호화되지 않은 경우(S1600), 부호화 장치는 현재 블록의 스캔을 상단 우측 방향으로 수행한다(S1655).If the current block is not encoded in the intra prediction mode (S1600), the encoding apparatus scans the current block in the upper right direction (S1655).

만일 현재 블록이 인트라 예측 모드(intra)로 부호화되었고, 현재 블록이 휘도 블록이면(S1605), 부호화 장치는 현재 블록의 휘도 신호에 대한 인트라 예측 모드(Mode)를 획득한다(S1610).If the current block is encoded in the intra prediction mode (intra) and the current block is the luminance block (S1605), the encoding apparatus obtains an intra prediction mode for the luminance signal of the current block (S1610).

그렇지 않고 만일 현재 블록이 인트라 예측 모드(intra)로 부호화되었고, 현재 블록이 휘도 블록이 아니고(현재 블록이 색차 블록이고), 현재 블록이 DM 모드이면(S1615), 부호화 장치는 현재 블록의 휘도 신호에 대한 인트라 예측 모드(Mode)를 획득한다(S1620). Otherwise, if the current block is encoded in the intra prediction mode (intra), the current block is not the luminance block (the current block is the chrominance block), and the current block is the DM mode (S1615), the encoding apparatus determines the luminance signal of the current block. An intra prediction mode for is obtained (S1620).

그렇지 않고 만일 현재 블록이 인트라 예측 모드(intra)로 부호화되었고, 현재 블록이 휘도 블록이 아니고(현재 블록이 색차 블록이고), 현재 블록이 DM 모드가 아니면, 부호화 장치는 현재 블록의 색차 신호에 대한 인트라 예측 모드(Mode)를 획득한다(S1625).Otherwise, if the current block is encoded in the intra prediction mode, the current block is not the luminance block (the current block is the chrominance block), and the current block is not in the DM mode, the encoding apparatus may be used for the chrominance signal of the current block. An intra prediction mode is obtained (S1625).

상기와 같이 휘도 신호 혹은 색차 신호에 따라 획득된 현재 블록의 인트라 예측 모드(Mode)를 기반으로 아래 단계들이 수행될 수 있다. As described above, the following steps may be performed based on the intra prediction mode of the current block acquired according to the luminance signal or the color difference signal.

현재 블록의 크기가 4x4 혹은 8x8이 아닌 경우(S1630), 부호화 장치는 현재 블록의 스캔을 상단 우측 방향으로 수행한다(S1655).If the size of the current block is not 4x4 or 8x8 (S1630), the encoding apparatus scans the current block in the upper right direction (S1655).

현재 블록의 크기가 4x4 혹은 8x8이고, 현재 블록의 인트라 예측 모드(Mode)를 3으로 나눈 나머지가 1일 경우(예컨대, Mode%3 == 1)(S1635), 부호화 장치는 현재 블록의 스캔을 수직 방향으로 수행한다(S1645). 혹은 수평 방향 혹은 상단 우측 방향으로 수행할 수도 있다.If the size of the current block is 4x4 or 8x8 and the remainder of the intra prediction mode divided by 3 of the current block is 1 (for example, Mode% 3 == 1) (S1635), the encoding apparatus scans the current block. It performs in the vertical direction (S1645). Alternatively, it may be performed in the horizontal direction or the upper right direction.

그렇지 않고 만일 현재 블록의 크기가 4x4 혹은 8x8이고, 현재 블록의 인트라 예측 모드(Mode)를 3으로 나눈 나머지가 2일 경우(예컨대, Mode%3 == 2)(S1640), 부호화 장치는 현재 블록의 스캔을 수평 방향으로 수행한다(S1650). 혹은 수직 방향 혹은 상단 우측 방향으로 수행할 수도 있다.Otherwise, if the size of the current block is 4x4 or 8x8, and the remainder obtained by dividing the intra prediction mode (Mode) of the current block by 3 is 2 (eg, Mode% 3 == 2) (S1640), the encoding apparatus determines the current block. Scan in the horizontal direction (S1650). Alternatively, it may be performed in the vertical direction or the upper right direction.

그렇지 않고 만일 현재 블록의 크기가 4x4 혹은 8x8이고, 현재 블록의 인트라 예측 모드(Mode)를 3으로 나눈 나머지가 0일 경우(예컨대, Mode%3 == 0) (S1640), 부호화 장치는 현재 블록의 스캔을 상단 우측 방향으로 수행한다(S1655). 혹은 수평 방향 혹은 수직 방향으로 수행할 수도 있다.Otherwise, if the size of the current block is 4x4 or 8x8, and the remainder obtained by dividing the intra prediction mode of the current block by 3 is 0 (eg, Mode% 3 == 0) (S1640), the encoding apparatus determines that the current block Scan in the upper right direction (S1655). Alternatively, it may be performed in the horizontal direction or the vertical direction.

상술한 도 16의 실시예에서는 인트라 예측 모드를 모드의 값에 따라 3개의 그룹(예컨대, 인트라 예측 모드의 모드 값을 3로 나눈 나머지에 따라 3개의 그룹)으로 구분하고, 각 그룹마다 다른 스캔 방식을 적용하도록 하였다. In the above-described embodiment of FIG. 16, the intra prediction mode is divided into three groups according to the mode value (for example, three groups according to the remainder obtained by dividing the mode value of the intra prediction mode by 3) and each scan method is different for each group. Was applied.

이때, 인트라 예측 모드 중 Planar 모드와 DC 모드는 하나의 그룹으로 여겨서 각각 다른 스캔 방식을 결정할 수도 있다. 예를 들어, Planar 모드는 상단 우측 방향 스캔, 수평 방향 스캔, 수직 방향 스캔 중 하나를 적용하고, DC 모드는 상단 우측 방향 스캔, 수평 방향 스캔, 수직 방향 스캔 중 하나를 적용할 수 있다. 여기서, Planar 모드와 DC 모드의 스캔 방식은 서로 다를 수 있으며, 혹은 서로 동일할 수도 있다. In this case, the planar mode and the DC mode among the intra prediction modes may be considered as one group, and thus different scan methods may be determined. For example, the planar mode may apply one of the upper right direction scan, the horizontal direction scan, and the vertical direction scan, and the DC mode may apply one of the upper right direction scan, the horizontal direction scan, and the vertical direction scan. Here, the scan mode of the planar mode and the DC mode may be different from each other, or may be the same.

또한, 색차 신호의 LM 모드의 경우에는 상단 우측 방향 스캔, 수평 방향 스캔, 수직 방향 스캔 중 하나를 적용할 수 있다. 또한, LM 모드의 경우, 휘도 신호의 인트라 예측 모드를 사용하여 색차 신호의 잔여 신호에 대한 스캔 방식으로 상술한 도 16의 방법을 적용할 수도 있다.
In the LM mode of the color difference signal, one of the upper right direction scan, the horizontal direction scan, and the vertical direction scan may be applied. In addition, in the case of the LM mode, the method of FIG. 16 may be applied as a scan method for the residual signal of the color difference signal using the intra prediction mode of the luminance signal.

한편, 상술한 도 16의 방법은, HEVC를 기반으로 하여, TU 신택스(syntax)를 다음 표 6과 같이 수정할 수 있다.Meanwhile, in the aforementioned method of FIG. 16, the TU syntax may be modified as shown in Table 6 below based on HEVC.

Figure pat00014
Figure pat00014

표 6을 참조하면, Transform_unit은 하나의 TU(변환) 블록에 대한 비트스트림 순서를 의미한다. log2TrafoSize는 입력된 log2TrafoWidth와 log2TrafoHeight 간의 합을 오른쪽 Shift 연산한 결과를 의미하며, 휘도 신호에 대한 TU 블록 크기를 의미한다. log2TrafoSizeC는 색차 신호에 대한 TU 블록 크기를 의미한다. PredMode는 현재 블록에 대한 예측 부호화 모드를 의미하며, 인트라 부호화의 경우 Intra이며, 인터 부호화의 경우 Inter이다. scanIdx는 현재 TU 블록의 휘도 신호에 대한 스캔 방향 정보를 나타내며, 상단 우측 방향(DIAG; Up-right = 0), 수평 방향(HOR; Horizontal = 1), 수직 방향(VER; Vertical = 2)이 있다. scanIdxC는 현재 TU 블록의 색차 신호에 대한 스캔 방향 정보를 나타내며, 상단 우측 방향(DIAG; Up-right = 0), 수평 방향(HOR; Horizontal = 1), 수직 방향(VER; Vertical = 2)이 있다. IntraPredMode는 휘도 신호에 대한 인트라 예측 모드 정보를 의미하며, IntraPredModeC는 색차 신호에 대한 인트라 예측 모드 정보를 의미한다.
Referring to Table 6, Transform_unit means a bitstream order for one TU (Transform) block. log2TrafoSize means a result of right shift operation of the sum of the input log2TrafoWidth and log2TrafoHeight, and means the TU block size for the luminance signal. log2TrafoSizeC means the TU block size for the color difference signal. PredMode means a prediction encoding mode for the current block, Intra for intra coding, and Inter for inter coding. scanIdx represents the scan direction information on the luminance signal of the current TU block, and includes the upper right direction (DIAG; Up-right = 0), the horizontal direction (HOR; Horizontal = 1), and the vertical direction (VER; Vertical = 2). . scanIdxC represents the scan direction information on the color difference signal of the current TU block, and includes the upper right direction (DIAG; Up-right = 0), the horizontal direction (HOR; Horizontal = 1), and the vertical direction (VER; Vertical = 2). . IntraPredMode means intra prediction mode information on the luminance signal, and IntraPredModeC means intra prediction mode information on the chrominance signal.

상술한 도 16의 방법은, HEVC를 기반으로 하여, TU 시맨틱스(Transform unit semantics)를 다음과 같이 수정할 수 있다. The method of FIG. 16 described above may modify TU semantics based on HEVC as follows.

변환 계수 레벨은 transCoeffLevel 배열로 파싱 되어진다. 이때 PredMode가 Intra와 같을 경우, 인트라 예측 모드에 따라 각각 다른 스캔 방향이 적용된다. 이러한 스캔 방향은 인트라 예측 모드를 3으로 나눈 나머지로부터 얻어질 수 있다.The transform coefficient levels are parsed into the transCoeffLevel array. In this case, when PredMode is equal to Intra, different scan directions are applied according to the intra prediction mode. This scan direction can be obtained from the remainder of the intra prediction mode divided by three.

여기서, 색차 신호의 스캔 방향은 휘도 신호의 스캔 방향을 그대로 사용할 수 있다. In this case, the scanning direction of the color difference signal may be used as it is.

상술한 실시예들에서, 방법들은 일련의 단계 또는 블록으로서 순서도를 기초로 설명되고 있으나, 본 발명은 단계들의 순서에 한정되는 것은 아니며, 어떤 단계는 상술한 바와 다른 단계와 다른 순서로 또는 동시에 발생할 수 있다. 또한, 당해 기술 분야에서 통상의 지식을 가진 자라면 순서도에 나타난 단계들이 배타적이지 않고, 다른 단계가 포함되거나, 순서도의 하나 또는 그 이상의 단계가 본 발명의 범위에 영향을 미치지 않고 삭제될 수 있음을 이해할 수 있을 것이다.In the above-described embodiments, the methods are described on the basis of a flowchart as a series of steps or blocks, but the present invention is not limited to the order of the steps, and some steps may occur in different orders or simultaneously . It will also be understood by those skilled in the art that the steps depicted in the flowchart illustrations are not exclusive, that other steps may be included, or that one or more steps in the flowchart may be deleted without affecting the scope of the present invention. You will understand.

이상의 설명은 본 발명의 기술 사상을 예시적으로 설명한 것에 불과한 것으로서, 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자라면 본 발명의 본질적인 특성에서 벗어나지 않는 범위에서 다양한 수정 및 변형이 가능할 것이다. 따라서, 본 발명에 개시된 실시 예들은 본 발명의 기술 사상을 한정하기 위한 것이 아니라 설명하기 위한 것이고, 이러한 실시 예에 의하여 본 발명의 기술 사상의 범위가 한정되는 것은 아니다. 본 발명의 보호범위는 특허청구범위에 의하여 해석되어야 하며, 그와 동등한 범위 내에 있는 모든 기술 사상은 본 발명의 권리범위에 포함되는 것으로 해석되어야 할 것이다. The foregoing description is merely illustrative of the technical idea of the present invention, and various changes and modifications may be made by those skilled in the art without departing from the essential characteristics of the present invention. Therefore, the embodiments disclosed in the present invention are intended to illustrate rather than limit the scope of the present invention, and the scope of the technical idea of the present invention is not limited by these embodiments. The scope of protection of the present invention should be construed according to the claims, and all technical ideas within the scope of the claims should be construed as being included in the scope of the present invention.

Claims (1)

인트라 예측 모드의 방향성을 기반으로 소정의 그룹으로 분류하는 단계; 및
상기 분류된 소정의 그룹 각각에 대해 주파수 변환 방식을 결정하는 단계를 포함하는 것을 특징으로 하는 영상 복호화 방법.
Classifying into a predetermined group based on the directionality of the intra prediction mode; And
And determining a frequency conversion scheme for each of the classified predetermined groups.
KR1020130051518A 2012-05-07 2013-05-07 Method and apparatus for image encoding/decoding KR20130124920A (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
KR1020120048301 2012-05-07
KR20120048301 2012-05-07

Publications (1)

Publication Number Publication Date
KR20130124920A true KR20130124920A (en) 2013-11-15

Family

ID=49853540

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020130051518A KR20130124920A (en) 2012-05-07 2013-05-07 Method and apparatus for image encoding/decoding

Country Status (1)

Country Link
KR (1) KR20130124920A (en)

Similar Documents

Publication Publication Date Title
KR102323263B1 (en) Method and apparatus for image encoding/decoding
CA3037685C (en) Method and apparatus for processing video signal
KR102383107B1 (en) Method and apparatus for processing a video signal
KR102424418B1 (en) Method and apparatus for processing a video signal
KR102383105B1 (en) Method and apparatus for processing a video signal
KR102383106B1 (en) Method and apparatus for processing a video signal
CN109716775B (en) Method and apparatus for processing video signal
KR20190139785A (en) Method and apparatus for processing video signal
KR20190133628A (en) Method and apparatus for processing a video
KR20130083405A (en) Method for deblocking filtering and apparatus thereof
KR20130124920A (en) Method and apparatus for image encoding/decoding

Legal Events

Date Code Title Description
A201 Request for examination
E902 Notification of reason for refusal
E90F Notification of reason for final refusal
E601 Decision to refuse application