Video signal encoding / decoding method, and device therefor

IN607409BActive Publication Date: 2026-10-27XRIS CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
IN202318041082
Authority / Receiving Office
IN · IN
Patent Type
Patents
Current Assignee / Owner
Priority Date
2018-12-21
Filing Date
2023-06-16
Publication Date
2026-10-27
Estimated Expiration
2039-12-20
Patent Text Reader

Abstract

A video decoding method according to the present invention may comprise: a step for dividing a coding block into a first partition and a second partition; a step for deriving a merge candidate list for the coding block; a step for determining a first merge candidate and a second merge candidate by using the merge candidate list; a step for deriving a first prediction sample and a second prediction sample on the basis of first motion information on the first merge candidate and second motion information on the second merge candidate; and a step for obtaining a third prediction sample for the coding block on the basis of the first prediction sample and the second prediction sample.
Need to check novelty before this filing date? Find Prior Art

Description

Field of the Disclosure

[0001] The present disclosure relates to a videosignal encoding / decoding method and a device therefor.Description of the Related Art

[0002] As display panels become larger, videoservice of higher quality is required. The biggestproblem with high-definition video service is that anamount of data is greatly increased. In order to solvethe above problem, research for improving the videocompression rate is being actively conducted. As arepresentative example, the Joint Collaborative Team onVideo Coding (JCT-VC) was formed in 2009 by the MotionPicture Experts Group (MPEG) and the Video Coding ExpertsGroup (VCEG) under the International TelecommunicationUnion-Telecommunication (ITU-T). The JCT-VC proposedHigh Efficiency Video Coding (HEVC), a video compressionstandard that has about twice compression performance ofH.264 / AVC, and that was approved as standard on January25, 2013. However, with rapid development of highdefinition video services, the performance of HEVC isgradually showing its limitations.DisclosureTechnical purpose

[0003] A purpose of the present disclosure is toprovide a combined prediction method combining aplurality of prediction methods in encoding / decoding avideo signal, and a device for performing the method.

[0004] A purpose of the present disclosure is toprovide a method for partitioning a coding block into aplurality of prediction units in encoding / decoding avideo signal, and a device for performing the method.

[0005] A purpose of the present disclosure is toprovide a method for obtaining a prediction sample witha plurality of merge candidates in encoding / decoding avideo signal, and a device for performing the method.

[0006] Technical purposes obtainable from thepresent disclosure are non-limited to the abovementioned technical purposes, and other unmentionedtechnical purposes may be clearly understood from thefollowing description by those having ordinary skill inthe technical field to which the present disclosurepertains.Technical Solution

[0007] A video signal decoding / encoding methodaccording to the present disclosure may includepartitioning a coding block into a first partition anda second partition; deriving a merge candidate list onthe coding block; determining a first merge candidateand a second merge candidate by using the merge candidatelist; deriving a first prediction sample and a secondprediction sample based on first motion information ofthe first merge candidate and second motion informationof the second merge candidate; and obtaining a thirdprediction sample on the coding block based on the firstprediction sample and the second prediction sample. Inthis connection, the third prediction sample may beobtained based on a weighted sum operation of the firstprediction sample and the second prediction sample anda weight applied to the first prediction sample and thesecond prediction sample may be different between whenthe third prediction sample is included in the firstpartition and when the third prediction sample isincluded in the second partition.

[0008] In a video signal decoding / encoding methodaccording to the present disclosure, a partitioning linepartitioning the coding block into the first partitionand the second partition may be at least one of avertical line, a horizontal line or a diagonal line.

[0009] A video signal decoding / encoding methodaccording to the present disclosure may include decodingfirst index information for specifying the first mergecandidate and second index information for specifyingthe second merge candidate from bitstream. In thisconnection, when a value of the second index informationis equal to or greater than that of the first indexinformation, the second merge candidate may have a valueadding 1 to a value of the second index information asan index.

[0010] In the video signal decoding / encoding methodaccording to the present disclosure, the second mergecandidate may be derived by adding or subtracting anoffset to or from an index of the first merge candidate.

[0011] In the video signal decoding / encoding methodaccording to the present disclosure, a number of mergecandidates included in the merge candidate list may bebelow a predefined number.

[0012] In the video signal decoding / encoding methodaccording to the present disclosure, when the thirdprediction sample is included in the above firstpartition, a weight applied to the first predictionsample may be set larger than a weight applied to thesecond prediction sample and when the third predictionsample is included in the second partition, a weightapplied to the above second prediction sample may be setto be larger than a weight applied to the firstprediction sample.

[0013] It is to be understood that the foregoingsummarized features are exemplary aspects of thefollowing detailed description of the present disclosurewithout limiting the scope of the present disclosure.Technical Effect

[0014] According to the present disclosure, thecombined prediction method combining a plurality ofprediction methods may be provided to improve interprediction efficiency.

[0015] According to the present disclosure, a methodpartitioning a coding block into a plurality ofprediction blocks and deriving the motion information ofeach prediction block may be provided to improve interprediction efficiency.

[0016] According to the present disclosure, a methodobtaining a prediction sample by using a plurality ofmerge candidates may be provided to improve interprediction efficiency.

[0017] Effects obtainable from the presentdisclosure may be non-limited by the above-mentionedeffect, and other unmentioned effects may be clearlyunderstood from the following description by thosehaving ordinary skill in the technical field to whichthe present disclosure pertains.BRIEF DESCRIPTION OF THE DRAWINGS

[0018] FIG. 1 is a view showing a block diagram ofa video encoding device (encoder) according to anembodiment of the present disclosure;

[0019] FIG. 2 is a view showing a block diagram ofa video decoding device (decoder) according to anembodiment of the present disclosure;

[0020] FIG. 3 is a view showing a basic coding treeunit according to an embodiment of the present disclosure;

[0021] FIG. 4 is a view showing various partitioningtypes of a coding block.

[0022] FIG. 5 is a view of an example showing anaspect of partitioning a CTU.

[0023] FIG. 6 is a flow diagram of an interprediction method according to an embodiment of thepresent disclosure.

[0024] FIG. 7 is a flow diagram of a process derivingthe current block motion information under a merge mode.

[0025] FIG. 8 is a diagram of illustrating candidateblocks used to derive a merge candidate.

[0026] FIG. 9 is a diagram to explain the updateaspect of a motion information table.

[0027] FIG. 10 is a diagram showing the update aspectof a motion information table.

[0028] FIG. 11 is a diagram showing an example inwhich the index of a saved motion information candidateis renewed.

[0029] FIG. 12 is a diagram showing the position ofa representative sub-block.

[0030] FIG. 13 shows an example in which a motioninformation table is generated per inter-prediction mode.

[0031] FIG. 14 is a diagram showing an example inwhich a motion information candidate included in a longterm motion information table is added to a mergecandidate list.

[0032] FIG. 15 is a diagram showing an example inwhich a redundancy check is performed only for a part ofmerge candidates.

[0033] FIG. 16 is a diagram showing an example inwhich a redundancy check with a specific merge candidateis omitted.

[0034] FIG. 17 is a diagram showing an example inwhich a candidate block included in the same mergeprocessing region as a current block is set to beunavailable as a merge candidate.

[0035] FIG. 18 is a diagram showing an examplederiving a merge candidate for a current block when acurrent block is included in a merge processing region.

[0036] FIG. 19 is a diagram showing a temporarymotion information table.

[0037] FIG. 20 is a diagram showing an example inwhich a motion information table and a temporary motioninformation table are unified.

[0038] FIG. 21 is a flow diagram of an intraprediction method according to the embodiment of thepresent disclosure.

[0039] FIG. 22 is a diagram showing intra-predictionmodes.

[0040] FIG. 23 is a diagram showing wide angle intraprediction modes.

[0041] FIG. 24 is a diagram showing the applicationaspect of PDPC.

[0042] FIG. 25 is a diagram showing the applicationaspect of a weight.

[0043] FIG. 26 shows an example in which a differentweight is assigned to a sub-block according to whethera merge candidate has bidirectional motion informationor not.

[0044] FIG. 27 shows an example in which a differentweight is assigned to a sub-block according to the intraprediction mode of a current block.

[0045] FIG. 28 is a diagram showing an example inwhich a current block is partitioned into a plurality ofsub-partitions.

[0046] FIG. 29 shows an example in which the secondmerge candidate is specified considering the searchorder of candidate blocks.

[0047] FIG. 30 shows an example in which the firstmerge candidate and the second merge candidate areselected among merge candidates derived from nonneighboring blocks.

[0048] FIG. 31 is a diagram showing an example inwhich a merge candidate is rearranged.

[0049] FIG. 32 is a diagram to explain an exampledetermining the second merge candidate.

[0050] FIG. 33 is a diagram showing an example inwhich weights applied to prediction blocks aredetermined based on the shape of candidate blocks.

[0051] FIG. 34 is a diagram showing an example inwhich a weight applied to prediction blocks is setdifferently per sub-partition.

[0052] FIG. 35 is a diagram showing an example inwhich a merge candidate is replaced.DETAILED DESCRIPTION OF THE DISCLOSURE

[0053] Hereinafter, embodiments of the presentdisclosure will be described in detail with reference tothe accompanying drawings.

[0054] Image encoding and decoding is performed ona basis of a block. In an example, for a coding block,a transform block, or a prediction block,encoding / decoding processes such as transform,quantization, prediction, in-loop filtering,reconstruction, etc. may be performed.

[0055] Hereinafter, an encoding / decoding targetblock is referred to as a "current block". In an example,a current block may represent a coding block, a transformblock, or a prediction block according to a currentprocess of encoding / decoding.

[0056] In addition, the term "unit" used in thepresent specification represents a basis unit forperforming a specific encoding / decoding process, and a"block" may be understood to represent a sample arrayhaving a predetermined size. Unless otherwise stated,"block" and "unit" may be used interchangeably. In anexample, in examples described later, a coding block anda coding unit may be understood to have the same meaningas each other.

[0057] FIG. 1 is view showing a block diagram of animage encoding apparatus (encoder) according to anembodiment of the present disclosure.

[0058] Referring to FIG. 1, an image encodingapparatus 100 may include a picture partitioning unit110, prediction units 120 and 125, a transform unit 130,a quantization unit 135, a rearrangement unit 160, anentropy encoding unit 165, a dequantization unit 140, aninverse-transform unit 145, a filter unit 150, and amemory 155.

[0059] Components described in FIG. 1 areindependently illustrated in order to show differentcharacteristic functions in an image encoding apparatus,and the figure does not mean that each component isconstituted by separated hardware or one software unit.That is, each component is just enumerated forconvenience of explanation, at least two components ofrespective components may constitute one component orone component may be partitioned into a plurality ofcomponents which may perform their functions. Even anembodiment of integrating respective components andembodiment of dividing a component are also included inthe scope of the present disclosure unless they aredeparting from the spirit of the present disclosure.

[0060] Further, some components are not requisitecomponents that perform essential functions of thepresent disclosure but are optional components for justimproving performance. The present disclosure may beimplemented with the requisite component forimplementing the spirit of the present disclosure otherthan the component used to just improve the performanceand a structure including only the requisite componentother than the optional component used to just improvethe performance is also included in the scope of thepresent disclosure.

[0061] The picture partitioning unit 110 maypartition an input picture into at least one processingunit. In this connection, the processing unit may be aprediction unit (PU), a transform unit (TU), or a codingunit (CU). In the picture partitioning unit 110, a singlepicture may be partitioned into combinations of aplurality of coding units, prediction units, andtransform units, and the picture may be encoded byselecting a combination of the coding units, theprediction units, and the transform units according toa predetermined condition (for example, cost function).

[0062] For example, a single picture may bepartitioned into a plurality of coding units. In orderto partition a picture into coding units, a recursivetree structure such as a quad-tree structure may be used,and a coding unit that is originated from a root such asa single image or largest coding unit may be partitionedinto other coding units and may have child nodes as manyas the partitioned coding units. A coding unit that isno longer partitioned according to certain restrictionsbecomes a leaf node. Namely, when it is assumed thatonly square partitioning is available for a single codingunit, a single coding unit may be partitioned into atmost four other coding units.

[0063] Hereinafter, in the embodiment of the presentdisclosure, a coding unit may be used as a unit forencoding or may be used as a unit for decoding.

[0064] A prediction unit may be obtained bypartitioning a single coding unit into at least onesquare or rectangle having the same size, or a singlecoding unit may be partitioned into prediction units insuch a manner that one prediction unit may be differentfrom another prediction unit in a shape and / or size.

[0065] In generation of a prediction unit based ona coding block to which intra-prediction is beingperformed, when the coding unit is not the smallestcoding unit, intra-prediction may be performed withoutperforming partitioning into a plurality of NxNprediction units.

[0066] The prediction units 120 and 125 may includean inter-prediction unit 120 performing inter-predictionand an intra prediction unit 125 performing intraprediction. Whether to perform inter-prediction orintra-prediction on a prediction unit may be determined,and detailed information (for example, an intraprediction mode, a motion vector, a reference picture,etc.) according to each prediction method may bedetermined. In this connection, a processing unit onwhich prediction is performed may differ with aprocessing unit for which a prediction method, and detailthereof are determined. For example, a prediction method,a prediction mode, etc. may be determined on the basisof a prediction unit, and prediction may be performed onthe basis of a transform unit. A residual value (residualblock) between the generated prediction block and anoriginal block may be input to the transform unit 130.In addition, prediction mode information used forprediction, motion vector information, etc. may beencoded using a residual value by the entropy encodingunit 165 and may be transmitted to the decoder. When aspecific encoding mode is used, an original block isencoded as it is and transmitted to a decoding unitwithout generating a prediction block through theprediction unit 120 or 125.

[0067] The inter-prediction unit 120 may predict aprediction unit on the basis of information on at leastone of a previous picture and a subsequent picture of acurrent picture, or in some cases, may predict aprediction unit on the basis of information on someencoded regions in the current picture. The interprediction unit 120 may include a reference pictureinterpolation unit, a motion prediction unit, and amotion compensation unit.

[0068] The reference picture interpolation unit mayreceive reference picture information from the memory155, and generate pixel information of a pixel at aninteger or less from the reference picture. In case ofa luma pixel, an 8-tap DCT-based interpolation filterhaving different coefficients may be used so as togenerate pixel information on a pixel at an integer orless for a 1 / 4 pixel unit. In case of a chroma signal,a 4-tap DCT-based interpolation filter having differentfilter coefficients may be used so as to generate pixelinformation on a pixel at an integer or less for a 1 / 8pixel unit.

[0069] The motion prediction unit may perform motionprediction based on a reference picture interpolated bythe reference picture interpolation unit. As methods forcalculating a motion vector, various methods, such as afull search-based block matching algorithm (FBMA), athree step search (TSS) algorithm, a new three-stepsearch (NTS) algorithm, etc. may be used. A motion vectormay have a motion vector value in a unit of 1 / 2 or 1 / 4pixel on the basis of the interpolated pixel. The motionprediction unit may predict a current prediction unit byvarying a motion prediction method. As motion predictionmethods, various methods, such as a skip method, a mergemethod, an advanced motion vector prediction (AMVP)method, an intra block copy method, etc. may be used.

[0070] The intra-prediction unit 125 may generate aprediction unit on the basis of information on areference pixel around a current block, which is pixelinformation in a current picture. When a neighboringblock of a current prediction unit is a block for whichinter-prediction is performed, and thus a referencepixel is a pixel for which inter-prediction is performed,a reference pixel included in the block for which interprediction is performed may be replaced by informationon a reference pixel of a neighboring block for whichintra-prediction is performed. In other words, when areference pixel is unavailable, at least one referencepixel of available reference pixels may be used in placeof unavailable reference pixel information.

[0071] A prediction mode in intra-prediction mayinclude a directional prediction mode using referencepixel information according to a prediction directionand a non-directional mode not using directionalinformation when performing prediction. A mode forpredicting luma information may be different from a modefor predicting chroma information. In order to predictthe chroma information, information on an intraprediction mode used for predicting the luma informationor information on a predicted luma signal may be used.

[0072] In performing intra-prediction, when aprediction unit is identical in a size with a transformunit, intra-prediction may be performed on theprediction unit on the basis of pixels positioned at theleft, the top-left, and the top of the prediction unit.However, in performing intra-prediction, when aprediction unit is different in a size with a transformunit, intra-prediction may be performed by using areference pixel based on the transform unit. In addition,intra-prediction using NxN partitioning may be only usedfor the smallest coding unit.

[0073] In an intra-prediction method, a predictionblock may be generated after applying an adaptive intrasmoothing (AIS) filter to a reference pixel according toa prediction mode. A type of AIS filter applied to areference pixel may vary. In order to perform an intraprediction method, an intra prediction mode for a currentprediction unit may be predicted from an intraprediction mode of a prediction unit present around thecurrent prediction unit. In predicting a prediction modefor a current prediction unit by using mode informationpredicted from a neighboring prediction unit, when anintra prediction mode for the current prediction unit isidentical to an intra prediction mode of the neighboringprediction unit, information indicating that the currentprediction unit and the neighboring prediction unit havethe same prediction mode may be transmitted by usingpredetermined flag information. When a prediction modefor the current prediction unit is different fromprediction modes of the neighboring prediction units,entropy encoding may be performed to encode informationon a prediction mode for a current block.

[0074] In addition, a residual block may begenerated which includes information on a residual valuethat is a difference value between a prediction unit forwhich prediction is performed on by the prediction unit120 or 125, and an original block of the prediction unit.The generated residual block may be input to thetransform unit 130.

[0075] The transform unit 130 may perform transformon a residual block, which includes information on aresidual value between an original block and a predictionunit generated by the prediction unit 120 or 125, byusing a transform method such as discrete cosinetransform (DCT) or discrete sine transform (DST). Inthis connection, a DCT transform core includes at leastone of DCT2 or DCT8 and a DST transform core includesDST7. Whether to apply DCT, or DST so as to performtransform on a residual block may be determined on thebasis of information on an intra-prediction mode of aprediction unit which is used to generate the residualblock. It is possible to skip a transform for a residualblock. A flag indicating whether or not to skip atransform for a residual block may be encoded. Atransform skip may be allowed for a residual block whosea size is smaller than or equal to a threshold value, aresidual block of a luma component, or a residual blockof a chroma component under 4:4:4 format.

[0076] The quantization unit 135 may performquantization on values transformed into a frequencydomain by the transform unit 130. A quantizationcoefficient may vary according to a block or importanceof an image. Values calculated in the quantization unit135 may be provided to the dequantization unit 140 andthe rearrangement unit 160.

[0077] The rearrangement unit 160 may performrearrangement on coefficient values with respect toquantized residual values.

[0078] The rearrangement unit 160 may changecoefficients in the form of a two-dimensional block intocoefficients in the form of a one-dimensional vectorthrough a coefficient scanning method. For example, therearrangement unit 160 may scan from a DC coefficient toa coefficient in a high frequency domain by using azigzag scanning method so as to change the coefficientsinto the form of a one-dimensional vector. According toa size and an intra prediction mode of a transform unit,rather than zigzag scanning, vertical directionalscanning where coefficients in the form of a twodimensional block are scanned in a column direction, orhorizontal directional scanning where coefficients inthe form of two-dimensional block are scanned in a rowdirection may be used. In other words, which scanningmethod among zigzag scanning, vertical directionalscanning, and horizontal directional scanning is usedmay be determined according to a size and an intraprediction mode of a transform unit.

[0079] The entropy encoding unit 165 may performentropy encoding on the basis of values calculated bythe rearrangement unit 160. Entropy encoding may usevarious encoding methods, for example, exponentialGolomb coding, context-adaptive variable length coding(CAVLC), or context-adaptive binary arithmetic coding(CABAL).

[0080] The entropy encoding unit 165 may encodevarious types of information, such as information on aresidual value coefficient and information on a blocktype of a coding unit, information on a prediction mode,information on a partitioning unit, information on aprediction unit, information on a partitioning unit,information on a prediction unit and information on atransmission unit, information on a motion vector,information on a reference frame, information on a blockinterpolation, filtering information, etc. obtained fromthe rearrangement unit 160 and the prediction units 120and 125.

[0081] The entropy encoding unit 165 may entropyencode coefficients of a coding unit input from therearrangement unit 160.

[0082] The dequantization unit 140 may performdequantization on values quantized in the quantizationunit 135, and the inverse-transform unit 145 may performinverse-transform on values transformed in the transformunit 130. A residual value generated by thedequantization unit 140 and the inverse-transform unit145 may be added with a prediction unit predicted by amotion estimation unit, a motion compensation unit, orthe intra-prediction unit which are included in theprediction units 120 and 125 so as to generate areconstructed block.

[0083] The filter unit 150 may include at least oneof a deblocking filter, an offset correction unit, andan adaptive loop filter (ALF).

[0084] The deblocking filter may remove blockdistortion that occurs due to boundaries between blocksin a reconstructed picture. In order to determine whetheror not to perform deblocking, whether or not to apply adeblocking filter to a current block may be determinedon the basis of pixels included in several rows andcolumns included in a block. When a deblocking filter isapplied to a block, a strong filter or a weak filter isapplied according to required deblocking filteringstrength. In addition, in applying a deblocking filter,when performing horizontal directional filtering andvertical directional filtering, horizontal directionalfiltering and vertical directional filtering may beconfigured to be processed in parallel.

[0085] The offset correction unit may correct anoriginal image by an offset in a unit of a pixel withrespect to an image for which deblocking is performed.In order to perform offset correction on a specificpicture, a method of applying a offset to a region whichis determined after partitioning pixels of the imageinto the predetermined number of regions, or a method ofapplying an offset according to edge information of eachpixel may be used.

[0086] Adaptive loop filtering (ALF) may beperformed on the basis of a value obtained by comparinga filtered reconstructed image with an original image.Pixels included in an image may be partitioned intopredetermined groups, a filter to be applied to each ofthe groups may be determined, and filtering may beindividually performed on each group. Information onwhether or not to apply ALF and may be transmitted foreach coding unit (CU) for a luma signal, and a shape anda filter coefficient of an ALF filter to be applied mayvary on the basis of each block. Alternatively, an ALFfilter having the same shape (fixed shape) may be appliedregardless of a feature of a block to which the filterwill be applied.

[0087] In the memory 155, a reconstructed block orpicture calculated through the filter unit 150 may bestored. The stored reconstructed block or picture may beprovided to the prediction unit 120 or 125 whenperforming inter-prediction.

[0088] FIG. 2 is view showing a block diagram of animage decoding apparatus (decoder) according to anembodiment of the present disclosure.

[0089] Referring to FIG. 2, an image decodingapparatus 200 may include: an entropy decoding unit 210,a rearrangement unit 215, a dequantization unit 220, aninverse-transform unit 225, prediction units 230 and 235,a filter unit 240, and a memory 245.

[0090] When an image bitstream is input from theencoder, the input bitstream may be decoded according toan inverse process of the image encoding apparatus.

[0091] The entropy decoding unit 210 may performentropy decoding according to the inverse process of theentropy encoding by the entropy encoding unit of theimage encoder. For example, in association with themethods performed by the image encoder apparatus,various methods, such as exponential Golomb coding,context-adaptive variable length coding (CAVLC), orcontext-adaptive binary arithmetic coding (CABAC) may beapplied.

[0092] The entropy decoding unit 210 may decodeinformation on intra-prediction and inter-predictionperformed by the encoder.

[0093] The rearrangement unit 215 may performrearrangement on the bitstream entropy decoded by theentropy decoding unit 210 on the basis of therearrangement method used in the encoder. Coefficientsrepresented in the form of a one-dimensional vector maybe reconstructed and rearranged into coefficients in theform of a two-dimensional block. The rearrangement unit215 may perform rearrangement through a method ofreceiving information related to coefficient scanningperformed in the encoder and of inversely scanning onthe basis of the scanning order performed in the encoder.

[0094] The dequantization unit 220 may performdequantization on the basis of a quantization parameterreceived from the encoder and coefficient values of therearranged block.

[0095] The inverse-transform unit 225 may perform,an inverse transform, that is inverse DCT or inverse DST,against to a transform, that is DCT or DST, performed onthe quantization result by the transform unit in theimage encoder. In this connection, a DCT transform coremay include at least one of DCT2 or DCT8, and a DSTtransform core may include DST7. Alternatively, when thetransform is skipped in the image encoder, the inversetransform also not be performed in the inverse-transformunit 225. Inverse transform may be performed on the basisof a transmission unit determined by the image encoder.The inverse transform unit 225 of the image decoder mayselectively perform a transform method (for example, DCT,or DST) according to multiple pieces of information,such as a prediction method, a size of a current block,a prediction direction, etc.

[0096] The prediction unit 230 or 235 may generatea prediction block on the basis of information relatedto a prediction block received from the entropy decodingunit 210 and information on a previously decoded blockor picture received from the memory 245.

[0097] As described above, as the operation of theimage encoder, in performing intra-prediction, when aprediction unit is identical in size with a transformunit, intra-prediction may be performed on theprediction unit on the basis of pixels positioned at theleft, the top-left, and the top of the prediction unit.However, in performing intra-prediction, when aprediction unit is different in size with a transformunit, intra-prediction may be performed by using areference pixel based on the transform unit. In addition,intra-prediction using NxN partitioning may be only usedfor the smallest coding unit.

[0098] The prediction units 230 and 235 may includea PU determination module, an inter-prediction unit, andan intra-prediction unit. The PU determination unit mayreceive various types of information, such asinformation on a prediction unit, information on aprediction mode of an intra-prediction method,information on a motion prediction of an interprediction method, etc. which are input from the entropydecoding unit 210, divide a prediction unit in a currentcoding unit, and determine whether inter-prediction orintra-prediction is performed on the prediction unit. Byusing information required in inter-prediction of acurrent prediction unit received from the image encoder,the inter-prediction unit 230 may perform interprediction on the current prediction unit on the basisof information on at least one of a previous picture anda subsequent picture of a current picture including thecurrent prediction unit. Alternatively, inter-predictionmay be performed on the basis of information on somepre-reconstructed regions in a current picture includingthe current prediction unit.

[0099] In order to perform inter-prediction, whichmethod among a skip mode, a merge mode, an AMVP mode, oran intra block copy mode is used as a motion predictionmethod for a prediction unit included in a coding unitmay be determined on the basis of the coding unit.

[00100] The intra prediction unit 235 may generate aprediction block on the basis of information on a pixelwithin a current picture. When a prediction unit is aprediction unit for which intra-prediction has beenperformed, intra-prediction may be performed on thebasis of information on an intra-prediction mode of aprediction unit received from the image encoder. Theintra prediction unit 235 may include an adaptive intrasmoothing (AIS) filter, a reference pixel interpolationmodule, or a DC filter. The AIS filter may performfiltering on a reference pixel of a current block, andwhether to apply the filter may be determined accordingto a prediction mode for a current prediction unit. Aprediction mode of the prediction unit and informationon an AIS filter which are received from the imageencoder may be used when performing AIS filtering on areference pixel of a current block. When a predictionmode for the current block is a mode to which AISfiltering is not applied, the AIS filter may not beapplied.

[00101] When a prediction mode of a prediction unitis a prediction mode for which intra-prediction isperformed on the basis of a pixel value obtained byinterpolating reference pixels, the reference pixelinterpolation unit may interpolate the reference pixelsso as to generate a reference pixel having a unit of aninteger or less. When a prediction mode for a currentprediction unit is a prediction mode where a predictionblock is generated without interpolating referencepixels, the reference pixels may not be interpolated.The DC filter may generate a prediction block throughfiltering when a prediction mode for a current block isa DC mode.

[00102] A reconstructed block or picture may beprovided to the filter unit 240. The filter unit 240 mayinclude a deblocking filter, an offset correction module,and an ALF.

[00103] Information on whether or not a deblockingfilter has been applied to a corresponding block orpicture and information on whether a strong filter or aweak filter is applied when the deblocking filter isapplied may be received from the image encoder. Thedeblocking filter of the image decoder may receiveinformation on a deblocking filter from the image encoder,and the image decoder may perform deblocking filteringon a corresponding block.

[00104] The offset correction unit may perform offsetcorrection on a reconstructed image on the basis of atype of offset correction, information on an offset value,etc. applied to an image when performing encoding.

[00105] The ALF may be applied to a coding unit onthe basis of information on whether or not to apply ALF,information on an ALF coefficient, etc. received fromthe encoder. The above ALF information may be providedby being included in a particular parameter set.

[00106] In the memory 245, a reconstructed picture orblock may be stored so as to be used as a referencepicture or reference block, and the reconstructedpicture may be provided to an output unit.

[00107]

[00108] FIG. 3 is a view showing a basic coding treeunit according to an embodiment of the present disclosure.

[00109] The largest coding block may be defined as acoding tree block. A single picture may be partitionedinto a plurality of coding tree units (CTU). A CTU maybe a coding unit of the largest size, and may be referredto as the largest coding unit (LCU). FIG. 3 is a viewshowing an example where a single picture is partitionedinto a plurality of CTUs.

[00110] A size of a CTU may be defined in a picturelevel or sequence level. For the same, informationrepresenting a size of a CTU may be signaled through apicture parameter set or sequence parameter set.

[00111] In an example, a size of a CTU for the entirepicture within a sequence may be set to 128x128.Alternatively, any one of 128x128 or 256x256 may bedetermined as a size of a CTU in a picture level. In anexample, a CTU may be set to have a size of 128x128 ina first picture, and a size of 256x256 in a secondpicture.

[00112] Coding blocks may be generated bypartitioning a CTU. A coding block represents a basicunit for performing encoding / decoding. In an example,prediction or transform may be performed for each codingblock, or a prediction encoding mode may be determinedfor each coding block. In this connection, the predictionencoding mode represents a method of generating aprediction image. In an example, a prediction encodingmode may include intra-prediction, inter-prediction,current picture referencing (CPR), intra block copy (IBC)or combined prediction. For a coding block, a predictionblock of the coding block may be generated by using aprediction encoding mode of at least one of intraprediction, inter-prediction, current picturereferencing, or combined prediction.

[00113] Information representing a predictionencoding mode for a current block may be signaled in abitstream. In an example, the information may be a 1-bitflag representing whether a prediction encoding mode isan intra mode or an inter mode. When a predictionencoding mode for a current block is determined as aninter mode, current picture referencing or combinedprediction may be available.

[00114] Current picture referencing is setting acurrent picture as a reference picture and obtaining aprediction block of a current block from a region thathas been already encoded / decoded within a currentpicture. In this connection, the current picture meansa picture including the current block. Informationrepresenting whether or not current picture referencingis applied to a current block may be signaled in abitstream. In an example, the information may be a 1-bitflag. When the flag is TRUE, a prediction encoding modefor a current block may be determined as current picturereferencing, and when the flag is FALSE, a predictionencoding mode for a current block may be determined asinter-prediction.

[00115] Alternatively, a prediction encoding mode fora current block may be determined on the basis of areference picture index. In an example, when a referencepicture index indicates a current picture, a predictionencoding mode for a current block may be determined ascurrent picture referencing. When a reference pictureindex indicates a picture other than a current picture,a prediction encoding mode for a current block may bedetermined as inter-prediction. In other words, currentpicture referencing is a prediction method usinginformation on a region that has been alreadyencoded / decoded within a current picture, and interprediction is a prediction method using information onanother picture that has been already encoded / decoded.

[00116] Combined prediction represents a combinedencoding mode combining at least two of intra-prediction,inter-prediction, and current picture referencing. In anexample, when combined prediction is applied, a firstprediction block may be generated on the basis of anyone of intra-prediction, inter-prediction or currentpicture referencing, and a second prediction block maybe generated on the basis of another. When a firstprediction block and a second prediction block aregenerated, a final prediction block may be generated bycalculating an average or weighted sum of the firstprediction block and the second prediction block.Information representing whether or not to applycombined prediction to a current block may be signaledin a bitstream. The information may be a 1-bit flag.

[00117] FIG. 4 is a view showing various partitioningtypes a coding block.

[00118] A coding block may be partitioned into aplurality of coding blocks on the basis of quad-treepartitioning, binary-tree partitioning or ternary treepartitioning. The partitioned coding block may bepartitioned again into a plurality of coding blocks onthe basis of quad-tree partitioning, binary-treepartitioning or ternary tree partitioning.

[00119] Quad-tree partitioning represents a method ofpartitioning a current block into four blocks. As aresult of quad-tree partitioning, a current block may bepartitioned into four square partitions (refer to"SPLIT_QT" of FIG. 4 (a)).

[00120] Binary-tree partitioning represents a methodof partitioning a current block into two blocks.Partitioning a current block into two blocks along avertical direction (that is, using a vertical line acrossthe current block) may be referred to verticaldirectional binary-tree partitioning, and partitioninga current block into two blocks along a horizontaldirection (that is, using a horizontal line across thecurrent block) may be referred to as horizontaldirectional binary-tree partitioning. As a result ofbinary-tree partitioning, a current block may bepartitioned into two non-square partitions."SPLIT_BT_VER" of FIG. 4 (b) is a view showing a resultof vertical directional binary-tree partitioning, and"SPLIT_BT_HOR" of FIG. 4 (c) is a view showing a resultof horizontal directional binary-tree partitioning.

[00121] Ternary-tree partitioning represents a methodof partitioning a current block into three blocks.Partitioning a current block into three blocks along avertical direction (that is, using two vertical linesacross the current block) may be referred to verticaldirectional ternary-tree partitioning, and partitioninga current block into three blocks along a horizontaldirection (that is, using two horizontal lines acrossthe current block) may be referred to as horizontaldirectional ternary-tree partitioning. As a result ofternary-tree partitioning, a current block may bepartitioned into three non-square partitions. In thisconnection, a width / height of a partition positioned atthe center of a current block may be twice than awidth / height of other partitions. "SPLIT_TT_VER" of FIG.4 (d) is a view showing a result of vertical directionalternary-tree partitioning, and "SPLIT_TT_HOR" of FIG. 4(e) is a view showing a result of horizontal directionalternary-tree partitioning.

[00122] The number of partitioning times of a CTU maybe defined as a partitioning depth. The maximumpartitioning depth of a CTU may be determined in asequence or picture level. Accordingly, the maximumpartitioning depth of a CTU may vary on the basis of asequence or picture.

[00123] Alternatively, the maximum partitioning depthmay be independently determined for each partitioningmethod. In an example, the maximum partitioning depthwhere quad-tree partitioning is allowed may differ fromthe maximum partitioning depth where binary-treepartitioning and / or ternary-tree partitioning is allowed.

[00124] The encoder may signal informationrepresenting at least one of a partitioning type and apartitioning depth of a current block in a bitstream.The decoder may determine a partitioning type and apartitioning depth of a CTU on the basis of theinformation obtained by parsing a bitstream.

[00125] FIG. 5 is a view of an example showing anaspect of partitioning a CTU.

[00126] Partitioning a coding block by using quadtree partitioning, binary-tree partitioning and / orternary-tree partitioning may be referred to as multitree partitioning.

[00127] Coding blocks generated by partitioning acoding block by applying multi-tree partitioning may bereferred to child coding blocks. When a partitioningdepth of a coding block is k, a partitioning depth ofchild coding blocks is set to k + 1.

[00128] To the contrary, for coding blocks having apartitioning depth of k + 1, a coding block having apartitioning depth of k may be referred to as a parentcoding block.

[00129] A partitioning type of a current coding blockmay be determined on the basis of at least one of apartitioning type of a parent coding block and apartitioning type of a neighboring coding block. In thisconnection, the neighboring coding block may be a blockadjacent to a current coding block, and include at leastone of an top neighboring block, a left neighboring block,or a neighboring block adjacent to the top-left cornerof the current coding block. In this connection, thepartitioning type may include whether or not to applyquad-tree partitioning, whether or not to apply binarytree partitioning, a direction of binary-treepartitioning, whether or not to apply ternary-treepartitioning, or a direction of ternary-treepartitioning.

[00130] In order to determine a partitioning type ofa coding block, information representing whether or nota coding block is partitioned may be signaled in abitstream. The information is a 1-bit flag of"split_cu_flag", and when the flag is TRUE, it mayrepresent that a coding block is partitioned by a multitree partitioning method.

[00131] When split_cu_flag is TRUE, informationrepresenting whether or not a coding block is partitionedby quad-tree partitioning may be signaled in a bitstream.The information is a 1-bit flag of split_qt_flag, andwhen the flag is TRUE, a coding block may be partitionedinto four blocks.

[00132] In an example, in an example shown in FIG. 5,a CTU is partitioned by quad-tree partitioning, and thusfour coding blocks having a partitioning depth of 1 aregenerated. In addition, it is shown that quad-treepartitioning is applied again to the first coding blockand the fourth coding block among four coding blocksgenerated by quad-tree partitioning. As a result, fourcoding blocks having a partitioning depth of 2 may begenerated.

[00133] In addition, by applying again quad-treepartitioning to a coding block having a partitioningdepth of 2, a coding block having a partitioning depthof 3 may be generated.

[00134] When quad-tree partitioning is not applied toa coding block, whether to perform binary-treepartitioning or ternary-tree partitioning for the codingblock may be determined according to at least one of asize of the coding block, whether or not the coding blockis positioned at a picture boundary, the maximumpartitioning depth, or a partitioning type of aneighboring block. When it is determined to performbinary-tree partitioning or ternary-tree partitioningfor the coding block, information representing apartitioning direction may be signaled in a bitstream.The information may be a 1-bit flag ofmtt_split_cu_vertical_flag. Whether a partitioningdirection is a vertical direction or a horizontaldirection may be determined on the basis of the flag.Additionally, information representing which one ofbinary-tree partitioning or ternary-tree partitioning isapplied to the coding block may be signaled in abitstream. The information may be a 1-bit flag ofmtt_split_cu_binary_flag. Whether binary-treepartitioning is applied to the coding block or ternarytree partitioning is applied to the coding block may bedetermined on the basis of the flag.

[00135] In an example, in an example shown in FIG. 5,vertical directional binary-tree partitioning is appliedto a coding block having a partitioning depth of 1,vertical directional ternary-tree partitioning isapplied to a left coding block among coding blocksgenerated by the partitioning, and vertical directionalbinary-tree partitioning is applied to a right codingblock.

[00136]

[00137] Inter-prediction is a prediction encodingmode predicting a current block by using information ona previous picture. In an example, a block (hereinafter,collocated block) at the same position with a currentblock within a previous picture may be set as aprediction block of the current block. Hereinafter, aprediction block generated on the basis of a collocatedblock of the current block may be referred to as acollocated prediction block.

[00138] To the contrary, when an object present in aprevious picture has moved to another position in acurrent picture, a current block may be effectivelypredicted by using motions of the object. For example,when a motion direction and a size of the object isdetermined by comparing a previous picture with a currentpicture, a prediction block (or prediction image) of thecurrent block may be generated according to motioninformation of the objects. Hereinafter, a predictionblock generated by using motion information may bereferred to as a motion prediction block.

[00139] A residual block may be generated bysubtracting a prediction block from a current block. Inthis connection, in case where an object moves, energyof a residual block may be reduced by using a motionprediction block rather than using a collocatedprediction block, and thus compression performance ofthe residual block may be improved.

[00140] As above, generating a prediction block byusing motion information may be referred to as motionestimation prediction. In the most inter-prediction, aprediction block may be generated on the basis of motioncompensation prediction.

[00141] Motion information may include at least oneof a motion vector, a reference picture index, aprediction direction, and a bidirectional weightingfactor index. A motion vector represents a motiondirection of an object and a magnitude. A referencepicture index specifies a reference picture of a currentblock among reference pictures included in a referencepicture list. A prediction direction indicates any oneof uni-directional L0 prediction, uni-directional L1prediction, or bi-directional prediction (L0 predictionand L1 prediction). At least one of L0 directional motioninformation and L1 directional motion information may beused according to a prediction direction of a currentblock. A bidirectional weighting factor index specifiesa weighting factor applied to an L0 prediction block anda weighting factor applied to an L1 prediction block.

[00142] FIG.6 is a flow diagram of an interprediction method according to the embodiment of thepresent disclosure.

[00143] In reference to FIG.6, an inter-predictionmethod includes determining an inter-prediction mode fora current block S601, obtaining motion information ofthe current block according to the determined interprediction mode S602, and performing motion compensationprediction for a current block on the basis of theobtained motion information S603.

[00144] In this connection, the inter-prediction modemay represent various methods for determining motioninformation of a current block, and include an interprediction mode using translation motion information, aninter-prediction mode using affine motion information.In an example, an inter-prediction mode usingtranslation motion information may include a merge modeand a motion vector prediction mode, and an interprediction mode using affine motion information mayinclude an affine merge mode and an affine motion vectorprediction mode. Motion information on a current blockmay be determined on the basis of a neighboring blockneighboring the current block or information obtained byparsing a bitstream.

[00145] Motion information of a current block may bederived from motion information of another block. Inthis connection, another block may be a blockencoded / decoded by inter prediction previous to thecurrent block. Setting motion information of a currentblock to be the same as motion information of anotherblock may be defined as a merge mode. Also, setting amotion vector of another block as a prediction value ofa motion vector of the current block may be defined asa motion vector prediction mode.

[00146] FIG.7 is a flow diagram of a process derivingthe motion information of a current block under a mergemode.

[00147] The merge candidate of a current block may bederived S701. The merge candidate of a current block maybe derived from a block encoded / decoded by interprediction prior to a current block.

[00148] FIG.8 is a diagram illustrating candidateblocks used to derive a merge candidate.

[00149] The candidate blocks may include at least oneof neighboring blocks including a sample adjacent to acurrent block or non-neighboring blocks including asample non-adjacent to a current block. Hereinafter,samples determining candidate blocks are defined as basesamples. In addition, a base sample adjacent to a currentblock is referred to as a neighboring base sample and abase sample non-adjacent to a current block is referredto as a non-neighboring base sample.

[00150] A neighboring base sample may be included ina neighboring column of a leftmost column of a currentblock or a neighboring row of an uppermost row of acurrent block. In an example, when the coordinate of aleft-top sample of a current block is (0,0), at leastone of a block including a base sample at a position of(-1, H-1), (W-1, -1), (W, -1), (-1, H) or (-1, -1) maybe used as a candidate block. In reference to a diagram,the neighboring blocks of index 0 to 4 may be used ascandidate blocks.

[00151] A non-neighboring base sample represents asample that at least one of a x-axis distance or a yaxis distance with a base sample adjacent to a currentblock has a predefined value. In an example, at leastone of a block including a base sample that a x-axisdistance with a left base sample is a predefined value,a block including a non-neighboring sample that a y-axisdistance with a top base sample is a predefined value ora block including a non-neighboring sample that a x-axisdistance and a y-axis distance with a left-top basesample are a predefined value may be used as a candidateblock. A predefined value may be a natural number suchas 4, 8, 12, 16, etc. In reference to a diagram, at leastone of blocks in an index 5 to 26 may be used as acandidate block.

[00152] Alternatively, a candidate block notbelonging to the same coding tree unit as a current blockmay be set to be unavailable as a merge candidate. In anexample, when a base sample is out of an upper boundaryof a coding tree unit to which a current block belongs,a candidate block including the base sample may be setto be unavailable as a merge candidate.

[00153] A merge candidate may be derived from atemporal neighboring block included in a picturedifferent from a current block. In an example, a mergecandidate may be derived from a collocated block includedin a collocated picture. Any one of reference picturesincluded in a reference picture list may be set as acollocated picture. Index information identifying acollocated picture among reference pictures may besignaled in a bitstream. Alternatively, a referencepicture with a predefined index among reference picturesmay be determined as a collocated picture.

[00154] The motion information of a merge candidatemay be set the same as the motion information of acandidate block. In an example, at least one of a motionvector, a reference picture index, a predictiondirection or a bidirectional weight index of a candidateblock may be set as the motion information of a mergecandidate.

[00155] A merge candidate list including a mergecandidate may be generated S702.

[00156] The index of merge candidates in a mergecandidate list may be assigned according to thepredetermined order. In an example, an index may beassigned in the order of a merge candidate derived froma left neighboring block, a merge candidate derived froma top neighboring block, a merge candidate derived froma right-top neighboring block, a merge candidate derivedfrom a left-bottom neighboring block, a merge candidatederived from a left-top neighboring block and a mergecandidate derived from a temporal neighboring block.

[00157] When a plurality of merge candidates areincluded in a merge candidate, at least one of aplurality of merge candidates may be selected S703.Concretely, information for specifying any one of aplurality of merge candidates may be signaled in abitstream. In an example, information, merge_idx,representing an index of any one of merge candidatesincluded in a merge candidate list may be signaled in abitstream.

[00158]

[00159] When the number of merge candidates includedin a merge candidate list is less than the threshold, amotion information candidate included in a motioninformation table may be added to a merge candidate listas a merge candidate. In this connection, the thresholdmay be the maximum number of merge candidates which maybe included in a merge candidate list or a value in whichan offset is subtracted from the maximum number of mergecandidates. An offset may be a natural number such as 1or 2, etc.

[00160] A motion information table includes a motioninformation candidate derived from a blockencoded / decoded based on inter-prediction in a currentpicture. In an example, the motion information of amotion information candidate included in a motioninformation table may be set the same as the motioninformation of a block encoded / decoded based on interprediction. In this connection, motion information mayinclude at least one of a motion vector, a referencepicture index, a prediction direction or a bidirectionalweight index.

[00161] A motion information candidate included in amotion information table also can be referred to as ainter region merge candidate or a prediction region mergecandidate.

[00162] The maximum number of a motion informationcandidate which may be included in a motion informationtable may be predefined in an encoder and a decoder. Inan example, the maximum number of a motion informationcandidate which may be included in a motion informationtable may be 1, 2, 3, 4, 5, 6, 7, 8 or more (e.g. 16).

[00163] Alternatively, information representing themaximum number of a motion information candidate whichmay be included in a motion information table may besignaled in a bitstream. The information may be signaledin a sequence, a picture or a slice level. Theinformation may represent the maximum number of a motioninformation candidate which may be included in a motioninformation table. Alternatively, the information mayrepresent difference between the maximum number of amotion information candidate which may be included in amotion information table and the maximum number of amerge candidate which may be included in a mergecandidate list.

[00164] Alternatively, the maximum number of a motioninformation candidate which may be included in a motioninformation table may be determined according to apicture size, a slice size or a coding tree unit size.

[00165] A motion information table may be initializedin a unit of a picture, a slice, a tile, a brick, acoding tree unit or a coding tree unit line (a row or acolumn). In an example, when a slice is initialized, amotion information table is also initialized thus amotion information table may not include any motioninformation candidate.

[00166] Alternatively, information representingwhether a motion information table will be initializedmay be signaled in a bitstream. The information may besignaled in a slice, a tile, a brick or a block level.Until the information indicates the initialization of amotion information table, a pre-configured motioninformation table may be used.

[00167] Alternatively, information on an initialmotion information candidate may be signaled in a pictureparameter set or a slice header. Although a slice isinitialized, a motion information table may include aninitial motion information candidate. Accordingly, aninitial motion information candidate may be used for ablock which is the first encoding / decoding target in aslice.

[00168] Alternatively, a motion information candidateincluded in the motion information table of a previouscoding tree unit may be set as an initial motioninformation candidate. In an example, a motioninformation candidate with the smallest index or withthe largest index among motion information candidatesincluded in the motion information table of a previouscoding tree unit may be set as an initial motioninformation candidate.

[00169] Blocks are encoded / decoded in the order ofencoding / decoding, and blocks encoded / decoded based oninter-prediction may be sequentially set as a motioninformation candidate in the order of encoding / decoding.

[00170] FIG.9 is a diagram to explain the updateaspect of a motion information table.

[00171] For a current block, when inter-prediction isperformed S901, a motion information candidate may bederived based on a current block S902. The motioninformation of a motion information candidate may be setthe same as that of a current block.

[00172] When a motion information table is emptyS903, a motion information candidate derived based on acurrent block may be added to a motion information tableS904.

[00173] When a motion information table alreadyincludes a motion information candidate S903, aredundancy check for the motion information of a currentblock (or, a motion information candidate derived basedon it) may be performed S905. A redundancy check is todetermine whether the motion information of a pre-storedmotion information candidate in a motion informationtable is the same as the motion information of a currentblock. A redundancy check may be performed for all prestored motion information candidates in a motioninformation table. Alternatively, a redundancy check maybe performed for motion information candidates with anindex over or below the threshold among pre-stored motioninformation candidates in a motion information table.Alternatively, a redundancy check may be performed forthe predefined number of motion information candidates.In an example, 2 motion information candidates withsmallest indexes or with largest indexes may bedetermined as targets for a redundancy check.

[00174] When a motion information candidate with thesame motion information as a current block is notincluded, a motion information candidate derived basedon a current block may be added to a motion informationtable S908. Whether motion information candidates areidentical may be determined based on whether the motioninformation (e.g. a motion vector / a reference pictureindex, etc.) of motion information candidates isidentical.

[00175] In this connection, when the maximum numberof motion information candidates are already stored ina motion information table S906, the oldest motioninformation candidate may be deleted S907 and a motioninformation candidate derived based on a current blockmay be added to a motion information table S908. In thisconnection, the oldest motion information candidate maybe a motion information candidate with the largest orthe smallest index.

[00176] Motion information candidates may beidentified by respective index. When a motioninformation candidate derived from a current block isadded to a motion information table, the smallest index(e.g. 0) may be assigned to the motion informationcandidate and indexes of pre-stored motion informationcandidates may be increased by 1. In this connection,When the maximum number of motion information candidatesare already stored in a motion information table, amotion information candidate with the largest index isremoved.

[00177] Alternatively, when a motion informationcandidate derived from a current block is added to amotion information table, the largest index may beassigned to the motion information candidate. In anexample, when the number of pre-stored motioninformation candidates in a motion information table isless than the maximum value, an index with the same valueas the number of pre-stored motion informationcandidates may be assigned to the motion informationcandidate. Alternatively, when the number of pre-storedmotion information candidates in a motion informationtable is equal to the maximum value, an index subtracting1 from the maximum value may be assigned to the motioninformation candidate. Alternatively, a motioninformation candidate with the smallest index is removedand the indexes of residual pre-stored motioninformation candidates are decreased by 1.

[00178] FIG. 10 is a diagram showing the update aspectof a motion information table.

[00179] It is assumed that as a motion informationcandidate derived from a current block is added to amotion information table, the largest index is assignedto the motion information candidate. In addition, it isassumed that the maximum number of a motion informationcandidate is already stored in a motion information table.

[00180] When a motion information candidateHmvpCand[n+1] derived from a current block is added toa motion information table HmvpCandList, a motioninformation candidate HmvpCand[0] with the smallestindex among pre-stored motion information candidates maybe deleted and indexes of residual motion informationcandidates may be decreased by 1. In addition, the indexof a motion information candidate HmvpCand[n+1] derivedfrom a current block may be set to the maximum value(for an example shown in FIG. 10, n).

[00181] When a motion information candidate identicalto a motion information candidate derived based on acurrent block is prestored S905, a motion informationcandidate derived based on a current block may not beadded to a motion information table S909.

[00182] Alternatively, while a motion informationcandidate derived based on a current block is added toa motion information table, a pre-stored motioninformation candidate identical to the motioninformation candidate may be removed. In this case, itcauses the same effect as when the index of a pre-storedmotion information candidate is newly updated.

[00183] FIG. 11 is a diagram showing an example inwhich the index of a pre-stored motion informationcandidate is updated.

[00184] When the index of a pre-stored motioninformation candidate identical to a motion informationcandidate mvCand derived from a current block is hIdx,the pre-stored motion information candidate may beremoved and the index of motion information candidateswith an index larger than hIdx may be decreased by 1. Inan example, an example shown in FIG. 11 showed thatHmvpCand[2] identical to mvCand is deleted in a motioninformation table HvmpCandList and an index fromHmvpCand[3] to HmvpCand[n] is decreased by 1.

[00185] And, a motion information candidate mvCandderived based on a current block may be added to the endof a motion information table.

[00186] Alternatively, an index assigned to a prestored motion information candidate identical to amotion information candidate derived based on a currentblock may be updated. For example, the index of a prestored motion information candidate may be changed tothe minimum value or the maximum value.

[00187] The motion information of blocks included ina predetermined region may be set not to be added to amotion information table. In an example, a motioninformation candidate derived based on the motioninformation of a block included in a merge processingregion may not be added to a motion information table.Since the encoding / decoding order for blocks included ina merge processing region is not defined, it is improperto use motion information of any one of them for theinter-prediction of another of them. Accordingly, motioninformation candidates derived based on blocks includedin a merge processing region may not be added to a motioninformation table.

[00188] Alternatively, the motion information of ablock smaller than a preset size may be set not to beadded to a motion information table. In an example, amotion information candidate derived based on the motioninformation of a coding block whose width or height issmaller than 4 or 8 or the motion information of a 4x4sized coding block may not be added to a motioninformation table.

[00189] When motion compensation prediction isperformed per sub-block basis, a motion informationcandidate may be derived based on the motion informationof a representative sub-block among a plurality of subblocks included in a current block. In an example, whena sub-block merge candidate is used for a current block,a motion information candidate may be derived based onthe motion information of a representative sub-blockamong sub-blocks.

[00190] The motion vector of sub-blocks may bederived in the following order. First, any one of mergecandidates included in the mere candidate list of acurrent block may be selected and an initial shift vector(shVector) may be derived based on the motion vector ofa selected merge candidate. And, a shift sub-block thata base sample is at a position of (xColSb, yColSb) maybe derived by adding an initial shift vector to theposition (xSb, ySb) of the base sample of each sub-blockin a coding block (e.g. a left-top sample or a centersample). The below Equation 1 shows a formula forderiving a shift sub-block.

[00191] [Equation 1]

[00192] Then, the motion vector of a collocated blockcorresponding to the center position of a sub-blockincluding (xColSb, yColSb) may be set as the motionvector of a sub-block including (xSb, ySb).

[00193] A representative sub-block may mean a subblock including the left-top sample or center sample ofa current block.

[00194] FIG. 12 is a diagram showing the position ofa representative sub-block.

[00195] FIG. 12 (a) shows an example in which a subblock positioned at the left-top of a current block isset as a representative sub-block and FIG. 12 (b) showsan example in which a sub-block positioned at the centerof a current block is set as a representative sub-block.When motion compensation prediction is performed in abasis of a sub-block, the motion information candidateof a current block may be derived based on the motionvector of a sub-block including the left-top sample ofa current block or including the central sample of acurrent block.

[00196] Based on the inter-prediction mode of acurrent block, it may be determined whether a currentblock will be used as a motion information candidate. Inan example, a block encoded / decoded based on an affinemotion model may be set to be unavailable as a motioninformation candidate. Accordingly, although a currentblock is encoded / decoded by inter-prediction, a motioninformation table may not be updated based on a currentblock when the inter-prediction mode of a current blockis an affine prediction mode.

[00197] Alternatively, a motion information candidatemay be derived based on at least one sub-block vector ofa sub-block included in a block encoded / decoded based onan affine motion model. In an example, a motioninformation candidate may be derived by using a subblock positioned at the left-top, the center or theright-top of a current block. Alternatively, the averagevalue of the sub-block vectors of a plurality of subblocks may be set as the motion vector of a motioninformation candidate.

[00198] Alternatively, a motion information candidatemay be derived based on the average value of the affineseed vectors of a block encoded / decoded based on anaffine motion model. In an example, at least one averageof the first affine seed vector, the second affine seedvector or the third affine seed vector of a current blockmay be set as the motion vector of a motion informationcandidate.

[00199] Alternatively, a motion information table maybe configured per inter-prediction mode. In an example,at least one of a motion information table for a blockencoded / decoded by an intra block copy, a motioninformation table for a block encoded / decoded based ona translation motion model or a motion information tablefor a block encoded / decoded based on an affine motionmodel may be defined. According to the inter-predictionmode of a current block, any one of a plurality of motioninformation tables may be selected.

[00200] FIG. 13 shows an example in which a motioninformation table is generated per inter-prediction mode.

[00201] When a block is encoded / decoded based on anon-affine motion model, a motion information candidatemvCand derived based on the block may be added to a nonaffine motion information table HmvpCandList. On theother hand, when a block is encoded / decoded based on anaffine motion model, a motion information candidatemvAfCand derived based on the above model may be addedto an affine motion information table HmvpCandList.

[00202] The affine seed vectors of the above blockmay be stored in a motion information candidate derivedfrom a block encoded / decoded based on an affine motionmodel. Accordingly, the motion information candidate maybe used as a merge candidate for deriving the affineseed vectors of a current block.

[00203]

[00204] An additional motion information table may bedefined in addition to the described motion informationtable. A long-term motion information table (hereinafter,referred to as the second motion information table) maybe defined in addition to the above-described motioninformation table (hereinafter, referred to as the firstmotion information table). In this connection, a longterm motion information table includes long-term motioninformation candidates.

[00205] When both the first motion information tableand the second motion information table are empty, first,a motion information candidate may be added to the secondmotion information table. After the number of motioninformation candidates available for the second motioninformation table reaches the maximum number, a motioninformation candidate may be added to the first motioninformation table.

[00206] Alternatively, one motion informationcandidate may be added to both the second motioninformation table and the first motion information table.

[00207] In this connection, a second motioninformation table which is fully filled may not performan update any more. Alternatively, when a decoded regionin a slice is over a predetermined ratio, the secondmotion information table may be updated. Alternatively,the second motion information table may be updated perN coding tree unit line.

[00208] On the other hand, the first motioninformation table may be updated whenever anencoded / decoded block is generated by inter-prediction.But, a motion information candidate added to the secondmotion information table may be set not to be used toupdate the first motion information table.

[00209] Information for selecting any one of thefirst motion information table or the second motioninformation table may be signaled in a bitstream. Whenthe number of a merge candidate included in a mergecandidate list is less than the threshold, motioninformation candidates included in a motion informationtable indicated by the information may be added to amerge candidate list as a merge candidate.

[00210] Alternatively, a motion information table maybe selected based on a size of a current block, a shapeof the current block, an inter-prediction mode of thecurrent block, whether bidirectional prediction isapplied to the current block, whether a motion vector isrefined or whether a triangular partitioning is appliedto the current block.

[00211] Alternatively, when the number of mergecandidates included in a merge candidate list is lessthan the maximum number even though a motion informationcandidate included in the first motion information tableis added, a motion information candidate included in thesecond motion information table may be added to a mergecandidate list.

[00212] FIG. 14 is a diagram showing an example inwhich a motion information candidate included in a longterm motion information table is added to a mergecandidate list.

[00213] In case that the number of a merge candidateincluded in a merge candidate list is less than themaximum number, a motion information candidate includedin the first motion information table HmvpCandList maybe added to a merge candidate list. In When the numberof a merge candidate included in the merge candidatelist is less than the maximum number even though motioninformation candidates included in the first motioninformation table is added to a merge candidate list, amotion information candidate included in a long-termmotion information table HmvpLTCandList may be added tothe merge candidate list.

[00214] Table 1 shows a process in which motioninformation candidates included in a long-terminformation table are added to a merge candidate list.

[00215] [Table 1]For each candidate in HMVPCandList with index HMVPLTIdx =1..numHMVPLTCand, the following ordered steps are repeated until combStop isequal to true- sameMotion is set to FALSE- If hmvpStop is equal to FALSE and numCurrMergecand is less than(MaxNumMergeCand-1), hmvpLT is set to TRUE- If HMVPLTCandList[NumLTHmvp-HMVPLTIdx] have the same motion vectorsand the same reference indices with any mergeCandList[i] with I being 0..numOrigMergeCand-1 and HasBeenPruned[i] equal to false, sameMotion is set totrue- If sameMotion is equal to false, mergeCandList[numCurrMergeCand++]is set to HMVPLTCandList[NumLTHmvp-HMVPLTIdx]- If numCurrMergeCand is equal to (MaxNumMergeCand-1), hmvpLTStop isset to TRUE

[00216] A motion information candidate may be set toinclude additional information except for motioninformation. In an example, at least one of a size, shapeor partition information of a block may be additionallystored in a motion information candidate. When the mergecandidate list of a current block is configured, onlymotion information candidate whose a size, shape orpartition information is identical or similar to acurrent block among motion information candidates may beused or a motion information candidate whose a size,shape or partition information is identical or similarto a current block may be added to a merge candidatelist in advance.

[00217] Alternatively, a motion information table maybe generated per block size, shape or partitioninformation. The merge candidate list of a current blockmay be configured by using a motion information tablematching the shape, size or partition information of acurrent block among a plurality of motion informationtables.

[00218] When the number of a merge candidate includedin the merge candidate list of a current block is lessthan the threshold, a motion information candidateincluded in a motion information table may be added toa merge candidate list as a merge candidate. Theadditional process is performed in the order reflectingsorted order of indexes of motion information candidatesin ascending or descending order. In an example, a motioninformation candidate with the largest index may be firstadded to the merge candidate list of a current block.

[00219] When a motion information candidate includedin a motion information table is added to a mergecandidate list, a redundancy check between a motioninformation candidate and pre-stored merge candidates inthe merge candidate list may be performed. As a resultof a redundancy check, a motion information candidatewith the same motion information as a pre-stored mergecandidate may not be added to the merge candidate list.

[00220] In an example, Table 2 shows a process inwhich a motion information candidate is added to a mergecandidate list.

[00221] [Table 2]For each candidate in HMVPCandList with index HMVPIdx = 1..numCheckedHMVPCand, the following ordered steps are repeated until combStopis equal to true- sameMotion is set to false- If HMVPCandList[NumHmvp-HMVPIdx] have the same motion vectors and thesame reference indices with any mergeCandList[i] with I being 0..numOrigMergeCand-1 and HasBeenPruned[i] equal to false, sameMotion is set totrue- If sameMotion is equal to false, mergeCandList[numCurrMergeCand++]is set to HMVPCandList[NumHmvp-HMVPIdx]- If numCurrMergeCand is equal to (MaxNumMergeCand-1), hmvpStop is setto TRUE

[00222] A redundancy check may be performed only fora part of motion information candidates included in amotion information table. In an example, a redundancycheck may be performed only for a motion informationcandidate with an index over or below the threshold.Alternatively, a redundancy check may be performed onlyfor N motion information candidates with the largestindex or the smallest index.

[00223] Alternatively, a redundancy check may beperformed only for a part of pre-stored merge candidatesin a merge candidate list. In an example, a redundancycheck may be performed only for a merge candidate whoseindex is over or below the threshold or a merge candidatederived from a block at a specific position. In thisconnection, a specific position may include at least oneof the left neighboring block, the top neighboring block,the right-top neighboring block or the left-bottomneighboring block of a current block.

[00224] FIG. 15 is a diagram showing an example inwhich a redundancy check is performed only for a part ofmerge candidates.

[00225] When a motion information candidateHmvpCand[j] is added to a merge candidate list, aredundancy check with 2 merge candidates with the largestindex, mergeCandList[NumMerge-2] andmergeCandList[NumMerge-1], may be performed for a motioninformation candidate. In this connection, NumMerge mayshow the number of an available spatial merge candidateand a temporal merge candidate.

[00226] Unlike a shown example, when a motioninformation candidate HmvpCand[j] is added to a mergecandidate list, a redundancy check with 2 mergecandidates with the smallest index may be performed fora motion information candidate. For example, it may bechecked whether mergeCandList[0] and mergeCandList[1]are identical to HmvpCand[j].

[00227] Alternatively, a redundancy check may beperformed only for a merge candidate derived from aspecific position. In an example, a redundancy check maybe performed for at least one of a merge candidatederived from a neighboring block positioned at the leftof a current block or at the top of a current block.When there is no merge candidate derived from a specificposition in a merge candidate list, a motion informationcandidate may be added to a merge candidate list withouta redundancy check.

[00228] When a motion information candidateHmvpCand[j] is added to a merge candidate list, aredundancy check with 2 merge candidates with the largestindex, mergeCandList[NumMerge-2] andmergeCandList[NumMerge-1], may be performed for a motioninformation candidate. In this connection, NumMerge mayshow the number of an available spatial merge candidateand a temporal merge candidate.

[00229] A redundancy check with a merge candidate maybe performed only for a part of motion informationcandidates. In an example, a redundancy check may beperformed only for N motion information candidates witha large or a small index among motion informationcandidates included in a motion information table. In anexample, a redundancy check may be performed only formotion information candidates with an index that thenumber and difference of motion information candidatesincluded in a motion information table are below thethreshold. When the threshold is 2, a redundancy checkmay be performed only for 3 motion information candidateswith the largest index value among motion informationcandidates included in a motion information table. Aredundancy check may be omitted for motion informationcandidates except for the above 3 motion informationcandidates. When a redundancy check is omitted, a motioninformation candidate may be added to a merge candidatelist regardless of whether the same motion informationas a merge candidate is exist or not.

[00230] Conversely, a redundancy check is set to beperformed only for motion information candidates with anindex that the number and difference of motioninformation candidates included in a motion informationtable are over the threshold.

[00231] The number of a motion information candidatethat a redundancy check is performed may be redefined inan encoder and a decoder. In an example, the thresholdmay be an integer such as 0, 1 or 2.

[00232] Alternatively, the threshold may bedetermined based on at least one of the number of a mergecandidate included in a merge candidate list or thenumber of motion information candidates included in amotion information table.

[00233] When a merge candidate identical to the firstmotion information candidate is found, a redundancycheck with the merge candidate identical to the firstmotion information candidate may be omitted in aredundancy check for the second motion informationcandidate.

[00234] FIG. 16 is a diagram showing an example inwhich a redundancy check with a specific merge candidateis omitted.

[00235] When a motion information candidateHmvpCand[i] whose index is i is added to a mergecandidate list, a redundancy check between the motioninformation candidate and pre-stored merge candidates ina merge candidate list is performed. In this connection,when a merge candidate mergeCandlist[j] identical to amotion information candidate HmvpCand[i] is found, aredundancy check between a motion information candidateHmvpCand[i-1] whose index is i-1 and merge candidatesmay be performed without adding the motion informationcandidate HmvpCand[i] to a merge candidate list. In thisconnection, a redundancy check between the motioninformation candidate HmvpCand[i-1] and the mergecandidate mergeCandList[j] may be omitted.

[00236] In an example, in an example shown in FIG.16, it was determined that HmvpCand[i] andmergeCandList[2] are identical. Accordingly, aredundancy check for HmvpCand[i-1] may be performedwithout adding HmvpCand[i] to a merge candidate list. Inthis connection, a redundancy check between HmvpCand[i1] and mergeCandList[2] may be omitted.

[00237] When the number of a merge candidate includedin the merge candidate list of a current block is lessthan the threshold, at least one of a pairwise mergecandidate or a zero merge candidate may be additionallyincluded except for a motion information candidate. Apairwise merge candidate means a merge candidate havinga value obtained from averaging the motion vectors ofmore than 2 merge candidates as a motion vector and azero merge candidate means a merge candidate whose motionvector is 0.

[00238] For the merge candidate list of a currentblock, a merge candidate may be added in the followingorder.

[00239] Spatial merge candidate - Temporal mergecandidate - Motion information candidate - (Affinemotion information candidate) - Pairwise merge candidate- Zero merge candidate

[00240] A spatial merge candidate means a mergecandidate derived from at least one of a neighboringblock or a non-neighboring block and a temporal mergecandidate means a merge candidate derived from a previousreference picture. An affine motion informationcandidate represents a motion information candidatederived from a block encoded / decoded by an affine motionmodel.

[00241] A motion information table may be used in amotion vector prediction mode. In an example, when thenumber of a motion vector prediction candidate includedin the motion vector prediction candidate list of acurrent block is less than the threshold, a motioninformation candidate included in a motion informationtable may be set as a motion vector prediction candidatefor a current block. Concretely, the motion vector of amotion information candidate may be set as a motionvector prediction candidate.

[00242] If any one of motion vector predictioncandidates included in the motion vector predictioncandidate list of a current block is selected, a selectedcandidate may be set as a motion vector predictor of acurrent block. Then, after the motion vector residualvalue of a current block is decoded, the motion vectorof a current block may be obtained by adding up themotion vector predictor and the motion vector residualvalue.

[00243] The motion vector prediction candidate listof a current block may be configured in the followingorder.

[00244] Spatial motion vector prediction candidate -Temporal motion vector prediction candidate - Motioninformation candidate - (Affine motion informationcandidate) - Zero motion vector prediction candidate

[00245] A spatial motion vector prediction candidatemeans a motion vector prediction candidate derived fromat least one of a neighboring block or a non-neighboringblock and a temporal motion vector prediction candidatemeans a motion vector prediction candidate derived froma previous reference picture. An affine motioninformation candidate represents a motion informationcandidate derived from a block encoded / decoded by anaffine motion model. A zero motion vector predictioncandidate represents a candidate that the value of amotion vector is 0.

[00246]

[00247] A merge processing region larger than acoding block may be defined. Coding blocks included ina merge processing region may be processed in parallelwithout being sequentially encoded / decoded. In thisconnection, not being sequentially encoded / decoded meansthe order of encoding / decoding is not defined.Accordingly, the encoding / decoding process of blocksincluded in a merge processing region may beindependently processed. Alternatively, blocks includedin a merge processing region may share merge candidates.In this connection, the merge candidates may be derivedbased on a merge processing region.

[00248] According to the above-mentioned feature, amerge processing region may be referred to as a parallelprocessing region, a shared merge region (SMR) or a mergeestimation region (MER).

[00249] A merge candidate of a current block may bederived based on a coding block. However, when a currentblock is included in a merge processing region largerthan the current block, a candidate block included inthe same merge processing region as the current blockmay be set to be unavailable as a merge candidate.

[00250] FIG. 17 is a diagram showing an example inwhich a candidate block included in the same mergeprocessing region as a current block is set to beunavailable as a merge candidate.

[00251] In an example shown in FIG. 17 (a), in thedecoding / decoding of CU5, blocks including base samplesadjacent to CU5 may be set as candidate blocks. In thisconnection, candidate blocks X3 and X4 included in thesame merge processing region as CU5 may be set to beunavailable as a merge candidate of CU5. But, candidateblocks X0, X1 and X2 not included in the same mergeprocessing region as CU5 may be set to be available asa merge candidate.

[00252] In an example shown in FIG. 17 (b), in thedecoding / decoding of CU8, blocks including base samplesadjacent to CU8 may be set as candidate blocks. In thisconnection, candidate blocks X6, X7 and X8 included inthe same merge processing region as CU8 may be set to beunavailable as a merge candidate. However, candidateblocks X5 and X9 not included in the same mergeprocessing region as CU8 may be set to be available asa merge candidate.

[00253] Alternatively, when a current block isincluded in a merge processing region, a neighboringblock adjacent to a current block and to a mergeprocessing region may be set as a candidate block.

[00254] FIG. 18 is a diagram showing an example whichderives a merge candidate for a current block when acurrent block is included in a merge processing region.

[00255] As in an example shown in FIG. 18 (a),neighboring blocks adjacent to a current block may beset as candidate blocks for deriving the merge candidateof the current block. In this connection, a candidateblock included in the same merge processing region asthe current block may be set to be unavailable as a mergecandidate. In an example, in deriving a merge candidatefor a coding block CU3, a top neighboring block y3 anda right-top neighboring block y4 included in the samemerge processing region as the coding block CU3 may beset to be unavailable as a merge candidate of the codingblock CU3.

[00256] By scanning neighboring blocks adjacent to acurrent block in the predefined order, a merge candidatemay be derived. In an example, the predefined order maybe the order of y1, y3, y4, y0 and y2.

[00257] When the number of merge candidates which maybe derived from neighboring blocks adjacent to a currentblock is less than a value that an offset is subtractedfrom the maximum number of merge candidates or themaximum number, a merge candidate for the current blockmay be derived by using neighboring blocks adjacent toa merge processing region like an example shown in FIG.18 (b). In an example, neighboring blocks adjacent to amerge processing region including a coding block CU3 maybe set as candidate blocks for the coding block CU3. Inthis connection, neighboring blocks adjacent to a mergeprocessing region may include at least one of a leftneighboring block x1, a top neighboring block x3, a leftbottom neighboring block x0, a right-top neighboringblock x4 or a left-top neighboring block x2.

[00258] By scanning neighboring blocks adjacent to amerge processing region in the predefined order, a mergecandidate may be derived. In an example, the predefinedorder may be the order of x1, x3, x4, x0 and x2.

[00259] In summary, a merge candidate on the codingblock CU3 including in a merge processing region may bederived by scanning candidate blocks in the followingscanning order.

[00260] (y1, y3, y4, y0, y2, x1, x3, x4, x0, x2)

[00261] But, the scanning order of the aboveillustrated candidate blocks only shows the example ofthe present disclosure and candidate blocks may bescanned in the order different from the above example.Alternatively, the scanning order may be adaptivelydetermined based on at least one of a size or a shape ofa current block or a merge processing region.

[00262] A merge processing region may be square ornon-square. Information for determining a mergeprocessing region may be signaled in a bitstream. Theinformation may include at least one of informationrepresenting the shape of a merge processing region orinformation representing the size of a merge processingregion. When a merge processing region is non-square, atleast one of information representing the size of a mergeprocessing region, information representing the width orheight of a merge processing region or informationrepresenting a ratio between the width and height of amerge processing region may be signaled in a bitstream.

[00263] The size of a merge processing region may bedetermined based on at least one of information signaledin a bitstream, picture resolution, the size of a sliceor the size of a tile.

[00264] If motion compensation prediction isperformed for a block included in a merge processingregion, a motion information candidate derived based onthe motion information of a block in which motioncompensation prediction is performed may be added to amotion information table.

[00265] But, if a motion information candidatederived from a block included in a merge processingregion is added to a motion information table, a casemay occur where a motion information candidate derivedfrom the block is used in the encoding / decoding of otherblock in the merge processing region whoseencoding / decoding is actually slower than the block. Inother words, although dependence between blocks shouldbe excluded in the encoding / decoding of blocks includedin a merge processing region, a case may occur wheremotion prediction compensation is performed by using themotion information of other block included in the mergeprocessing region. To solve such a problem, although theencoding / decoding of a block included in a mergeprocessing region is completed, the motion informationof the block whose encoding / decoding is completed maynot be added to a motion information table.

[00266] Alternatively, if motion compensationprediction is performed for blocks included in a mergeprocessing region, a motion information candidatederived from the blocks may be added to a motioninformation table in the predefined order. In thisconnection, the predefined order may be determined inthe scanning order of coding blocks in a merge processingregion or a coding tree unit. The scanning order may beat least one of raster scanning, horizontal scanning,vertical scanning or zigzag scanning. Alternatively, thepredefined order may be determined based on each block'smotion information or the number of blocks with the samemotion information.

[00267] Alternatively, a motion information candidateincluding a unidirectional motion information may beadded to motion information table before a motioninformation candidate including bidirectional motioninformation. On the contrary, motion informationcandidate including bidirectional motion information maybe added to a motion information table before a motioninformation candidate including unidirectional motioninformation.

[00268] Alternatively, a motion information candidatemay be added to a motion information table in the orderof high frequency of use or low frequency of use in amerge processing region or a coding tree unit.

[00269] When a current block is included in a mergeprocessing region and the number of merge candidatesincluded in a merge candidate list of the current blockis less than the maximum number, a motion informationcandidate included in a motion information table may beadded to the merge candidate list. In this connection,a motion information candidate derived from a blockincluded in the same merge processing region as a currentblock may be set not to be added to the merge candidatelist of the current block.

[00270] Alternatively, when a current block isincluded in a merge processing region, it may be set notto use a motion information candidate included in amotion information table. In other words, although thenumber of merge candidates included in a merge candidatelist of the current block is less than the maximum number,a motion information candidate included in a motioninformation table may not be added to the merge candidatelist.

[00271] In another example, a motion informationtable on a merge processing region or a coding tree unitmay be configured. This motion information table playsa role of temporarily storing the motion information ofblocks included in a merge processing region. Todistinguish between a general motion information tableand a motion information table for a merge processingregion or a coding tree unit, the motion informationtable for the merge processing region or the coding treeunit is referred to as a temporary motion informationtable. And, a motion information candidate stored in thetemporary motion information table is referred to as atemporary motion information candidate.

[00272] FIG. 19 is a diagram showing a temporarymotion information table.

[00273] A temporary motion information table for acoding tree unit or a merge processing region may beconfigured. When motion compensation prediction isperformed for a current block included in a coding treeunit or a merge processing region, the motion informationof the block may not be added to a motion informationtable HmvpCandList. Instead, a temporary motioninformation candidate derived from the block may be addedto a temporary motion information table HmvpMERCandList.In other words, a temporary motion information candidateadded to a temporary motion information table may not beadded to a motion information table. Accordingly, amotion information table may not include a motioninformation candidate derived based on motioninformation of blocks included in a coding tree unit ora merge processing region including a current block.

[00274] The maximum number of temporary motioninformation candidates which may be included by atemporary motion information table may be set the sameas the maximum number of motion information candidates.Alternatively, the maximum number of temporary motioninformation candidates which may be included by atemporary motion information table may be determinedaccording to a size of a coding tree unit or a mergeprocessing region.

[00275] A current block included in a coding treeunit or a merge processing region may be set not to usea temporary motion information table on thecorresponding coding tree unit or merge processingregion. In other words, when the number of mergecandidates included in the merge candidate list of thecurrent block is less than the threshold, a motioninformation candidate included in a motion informationtable may be added to the merge candidate list and atemporary motion information candidate included in atemporary motion information table may not be added tothe merge candidate list. Accordingly, the motioninformation of other block including in the same codingtree unit or the same merge processing region as thecurrent block may not be used for the motion compensationprediction of the current block.

[00276] If the encoding / decoding of all blocksincluded in a coding tree unit or a merge processingregion is completed, a motion information table and atemporary motion information table may be unified.

[00277] FIG. 20 is a diagram showing an example inwhich a motion information table and a temporary motioninformation table are unified.

[00278] If the encoding / decoding of all blocksincluded in a coding tree unit or a merge processingregion is completed, a temporary motion informationcandidate included in a temporary motion informationtable may be updated in a motion information table as inan example shown in FIG. 20.

[00279] In this connection, temporary motioninformation candidates included in a temporary motioninformation table may be added to a motion informationtable in the order inserted in the temporary motioninformation table. (In other words, in the ascendingorder or the descending order of the index value)

[00280] In another example, temporary motioninformation candidates included in a temporary motioninformation table may be added to a motion informationtable in the predefined order. In this connection, thepredefined order may be determined in the scanning orderof coding blocks in a merge processing region or a codingtree unit. The scanning order may be at least one ofraster scanning, horizontal scanning, vertical scanningor zigzag scanning. Alternatively, the predefined ordermay be determined based on the motion information ofeach block or the number of blocks with the same motioninformation.

[00281] Alternatively, a temporary motion informationcandidate including a unidirectional motion informationmay be added to a motion information table before atemporary motion information candidate including abidirectional motion information. On the contrary, atemporary motion information candidate including abidirectional motion information may be added to a motioninformation table before a temporary motion informationcandidate including a unidirectional motion information.

[00282] Alternatively, a temporary motion informationcandidate may be added to a motion information table inthe order of high frequency of use or low frequency ofuse in a merge processing region or a coding tree unit.

[00283] In case that a temporary motion informationcandidate included in a temporary motion informationtable is added to a motion information table, aredundancy check for a temporary motion informationcandidate may be performed. In an example, when the samemotion information candidate as a temporary motioninformation candidate included in a temporary motioninformation table is prestored in a motion informationtable, the temporary motion information candidate maynot be added to the motion information table. In thisconnection, a redundancy check may be performed for apart of motion information candidates included in amotion information table. In an example, a redundancycheck may be performed for motion information candidateswith an index over or below the threshold. In an example,when a temporary motion information candidate is equalto a motion information candidate with an index over thepredefined value, the temporary motion informationcandidate may not be added to a motion information table.

[00284] It may limit the use of a motion informationcandidate derived from a block included in the samecoding tree unit or the same merge processing region asa current block as the merge candidate of the currentblock. For it, the address information of a block may beadditionally stored for a motion information candidate.The address information of a block may include at leastone of the position of the block, the address of theblock, the index of the block, the position of a mergeprocessing region in which the block is included, theaddress of a merge processing region in which the blockis included, the index of a merge processing region inwhich the block is included, the position of a codingtree region in which the block is included, the addressof a coding tree region in which the block is includedor the index of a coding tree region in which the blockis included.

[00285]

[00286] Intra-prediction is a method for performingprediction on a current block by using a reconstructedsample that has been already encoded / decoded and whichis around the current block. In this connection, areconstructed sample before applying an in-loop filtermay be used for intra-prediction of the current block.

[00287] An intra-prediction method includes intraprediction based on a matrix and intra-predictionaccording to a direction with a neighboringreconstruction sample. Information indicating an intraprediction method of a current block may be signaled ina bitstream. The information may be a 1-bit flag.Alternatively, an intra-prediction of a current blockmay be determined on the basis of at least one of aposition of the current block, a size of the currentblock, a shape of the current block, or an intraprediction method of a neighboring block. In an example,when a current block is present crossing a pictureboundary, it may be set such that an intra-predictionmethod based on a matrix is not applied to the currentblock.

[00288] An intra-prediction method based on a matrixis a method of obtaining a prediction block of a currentblock on the basis of a matrix product of a matrix storedin the encoder and the decoder, and reconstructionsamples around the current block. Information forspecifying any one of a plurality of prestored matricesmay be signaled in a bitstream. The decoder may determinea matrix for performing intra-prediction on a currentblock on the basis of the above information and a sizeof the current block.

[00289] General intra-prediction is a method ofobtaining a prediction block of a current block on thebasis of a non-directional intra-prediction mode ordirectional intra-prediction mode. Hereinafter, withreference to the figure, a process of intra-predictionbased on general intra-prediction will be described.

[00290] FIG. 21 is a view of a flowchart showing anintra-prediction method according to an embodiment ofthe present disclosure.

[00291] A reference sample line of a current blockmay be determined S2101. The reference sample line meansa group of reference samples included in a k-th spacedapart line from the top and / or the left of the currentblock. The reference sample may be derived from areconstructed sample around the current block which hasbeen already encoded / decoded.

[00292] Index information identifying a referencesample line for the current block among the plurality ofreference sample lines may be signaled in a bitstream.In an example, index information, intra_luma_ref_idx,for specifying the reference sample line for the currentblock may be signaled in a bitstream. The indexinformation may be signaled on a coding block basis.

[00293] A plurality of reference sample lines mayinclude at least one of a first line, a second line, athird line, or a fourth line from a top and / or a left ofthe current block. A reference sample line consisted ofa row adjacent to a top of the current block and a columnadjacent to a left of the current block among theplurality of reference sample lines may be referred toas an adjacent reference sample line, and remainingreference sample lines may be referred to as non-adjacentreference sample lines.

[00294] Only some of the plurality of referencesample lines may be selected as a reference sample linefor the current block. In one example, remainingreference sample lines other than a third non-adjacentreference sample line among the plurality of referencesample lines may be set as the candidate reference samplelines. Table 1 shows an index assigned to each of thecandidate reference sample lines.

[00295] [Table 3]Index (intra_luma_ref_idx) Reference sample line0 Adjacent referencesample line1 First non-adjacentreference sample line2 Second non-adjacentreference sample line

[00296] A larger or smaller number of the candidatereference sample lines than the number of the candidatereference sample lines as described above may be set.Further, the number or position of the non-adjacentreference sample lines set as the candidate referencesample lines may not be limited to the above describedexamples. In one example, a first non-adjacent referencesample line and a third non-adjacent reference sampleline may be set as the candidate reference sample lines,or a second non-adjacent reference sample line and thethird non-adjacent reference sample line may be set asthe candidate reference sample lines. Alternatively, allof the first non-adjacent reference sample line, thesecond non-adjacent reference sample line and the thirdnon-adjacent reference sample line may be set as thecandidate reference sample lines.

[00297] The number or a type of the candidatereference sample lines may be determined based on atleast one of a size, a shape, and a position of thecurrent block, whether the current block is divided intosub-blocks, or an intra prediction mode for the currentblock.

[00298] Based on at least one of the position, thesize, the shape of a current block or the predictionencoding mode of a neighboring block thereto, thereference sample line for the current block may bedetermined. In one example, when the current blockadjoins a boundary of a picture, a tile, a slice or acoding tree unit, the adjacent reference sample line maybe determined as the reference sample line for thecurrent block.

[00299] Alternatively, when the current block has anon-square shape, the adjacent reference sample line maybe determined as the reference sample line for thecurrent block. Alternatively, when a ratio between awidth and a height of the current block is above or belowthe threshold, the adjacent reference sample line may bedetermined as the reference sample line for the currentblock.

[00300] The reference sample line may include topreference samples located at the top of the current blockand left reference samples located at the left of thecurrent block. Top reference samples and left referencesamples may be derived from reconstructed samples aroundthe current block. The reconstructed samples may be ina state before the in-loop filter is applied.

[00301] Next, the intra prediction mode for thecurrent block may be determined S2102. In this connection,at least one of a non-directional intra prediction modeor a directional intra prediction mode may be determinedas the intra prediction mode for the current block. Thenon-directional intra prediction mode includes a planarmode and a DC mode. The directional intra predictionmode includes 33 or 65 modes from a left-bottom diagonaldirection to a right-top diagonal direction.

[00302] FIG. 22 is a diagram showing intra predictionmodes.

[00303] FIG. 22 (a) shows 35 intra prediction modes.FIG. 22 (b) shows 67 intra prediction modes.

[00304] The larger or smaller number of intraprediction modes than the number of those shown in FIG.22 may be defined.

[00305] Based on an intra-prediction mode of aneighboring block adjacent to a current block, anMPM(Most Probable Mode) may be set. In this connection,a neighboring block may include a left neighboring blockadjacent to the left of the current block and a topneighboring block adjacent to the top of the currentblock.

[00306]

[00307] When an intra-prediction mode for the currentblock is determined, prediction samples for the currentblock may be obtained based on the determined intraprediction mode S2103.

[00308] In case that the DC mode is selected,prediction samples for a current block are generatedbased on the average value of the reference samples. Indetail, values of all of samples within the predictionblock may be generated based on an average value of thereference samples. An average value may be derived usingat least one of top reference samples adjacent to thetop of the current block, and left reference samplesadjacent to the left of the current block.

[00309] The number or a range of the reference samplesused when deriving an average value may vary based onthe shape of the current block. In an example, when acurrent block is a non-square block where a width isgreater than a height, an average value may be calculatedby using top reference samples. To the contrary, when acurrent block is a non-square block where a width issmaller than a height, an average value may be calculatedby using left reference samples. In other words, when awidth and a height of the current block are different,reference samples adjacent to the greater length may beused so as to calculate an average value. Alternatively,whether to calculate an average value by using topreference samples or by using left reference samples maybe determined on the basis of a ratio between a widthand a height of the current block.

[00310] When a planar mode is selected, a predictionsample may be obtained by using a horizontal directionalprediction sample and a vertical directional predictionsample. In this connection, the horizontal directionalprediction sample may be obtained on the basis of a leftreference sample and a right reference sample which arepositioned at the same horizontal line with theprediction sample, and the vertical directionalprediction sample may be obtained on the basis of an topreference sample and a bottom reference sample which arepositioned at the same vertical line with the predictionsample. In this connection, the right reference samplemay be generated by copying a reference sample adjacentto the top-right corner of the current block, and thebottom reference sample may be generated by copying areference sample adjacent to the lower-left corner ofthe current block. The horizontal directional predictionsample may be obtained on the basis of a weighted sum ofthe left reference sample and the right reference sample,and the vertical directional prediction sample may beobtained on the basis of a weighted sum of the topreference sample and the bottom reference sample. Inthis connection, a weighting factor assigned to eachreference sample may be determined according to aposition of the prediction sample. The prediction samplemay be obtained on the basis of an average or a weightedsum of the horizontal directional prediction sample andthe vertical directional prediction sample. When aweighted sum is used, a weighting factor assigned to thehorizontal directional prediction sample and thevertical directional prediction sample may be determinedon the basis of a position of the prediction sample.

[00311] When a directional prediction mode isselected, a parameter representing a predictiondirection (or prediction angle) of the selecteddirectional prediction mode may be determined. Table 4below represents an intra directional parameter ofintraPredAng for each intra-prediction mode.

[00312] [Table 4]PredModeIntra 1 2 3 4 5 6 7IntraPredAng - 32 26 21 17 13 9PredModeIntra 8 9 10 11 12 13 14IntraPredAng 5 2 0 -2 -5 -9 -13PredModeIntra 15 16 17 18 19 20 21IntraPredAng -17 -21 -26 -32 -26 -21 -17PredModeIntra 22 23 24 25 26 27 28IntraPredAng -13 -9 -5 -2 0 2 5PredModeIntra 29 30 31 32 33 34IntraPredAng 9 13 17 21 26 32

[00313] Table 4 represents an intra directionalparameter of each intra-prediction mode where an indexthereof is one of 2 to 34 when 35 intra-prediction modesare defined. When directional intra-prediction modes aredefined more than 33, an intra directional parameter ofeach intra-prediction mode may be set by subdividingTable 4.

[00314] Top reference samples and left referencesamples for the current block are arranged in a line,and then a prediction sample may be obtained on the basisof a value of an intra directional parameter. In thisconnection, when a value of the intra directionalparameter is a negative value, left reference samplesand top reference samples may be arranged in a line.

[00315]

[00316] A reference sample index, iIdx, and aweighting factor parameter, ifact, may be respectivelyobtained through Equations 2 and 3 below.

[00317] [Equation 2]

[00318] [Equation 3]

[00319] In Equations 2 and 3, Pang represents an intradirectional parameter. A reference sample specified bya reference sample index of iIdx corresponds to aninteger pel.

[00320] In order to derive a prediction sample, atleast one reference sample may be specified. In detail,according to a slope of a prediction mode, a position ofa reference sample used for deriving a prediction samplemay be specified. In an example, a reference sample usedfor deriving a prediction sample may be specified byusing a reference sample index of iIdx.

[00321] In this connection, when a slope of an intraprediction mode is not represented by one referencesample, a prediction sample may be generated byperforming interpolation on a plurality of referencesamples. In an example, when a slope of an intraprediction mode is a value between a slope between aprediction sample and a first reference sample, and aslope between the prediction sample and a secondreference sample, the prediction sample may be obtainedby performing interpolation on the first referencesample and the second reference sample. In other words,when an angular line according to an intra-predictionangle does not pass a reference sample positioned at aninteger pel, a prediction sample may be obtained byperforming interpolation on reference samples positionedadjacent to the left and the right, or the top and thebottom of the position where the angular line passes.

[00322] Equation 4 below represents an example ofobtaining a prediction sample on the basis of referencesamples.

[00323] [Equation 4]

[00324] In Equation 4, P represents a predictionsample, and Ref_1D represents any one of referencesamples that are arranged in a line. In this connection,a position of the reference sample may be determined bya position (x, y) of the prediction sample and areference sample index of iIdx.

[00325] When a slope of an intra-prediction mode ispossibly represented by one reference sample, aweighting factor parameter of ifact is set to 0.Accordingly, Equation 4 may be simplified as Equation 5below.

[00326] [Equation 5]

[00327] When a current block is a non-square, a casemay be present where a prediction sample is derived byusing, among reference samples positioned at the angularline according to an intra-prediction angle, a referencesample that is positioned farther than a reference sampleclose to a prediction sample according to an intraprediction mode for the current block.

[00328] To solve the above problem, when a currentblock is a non-square, an intra-prediction mode for thecurrent block may be substituted with an intraprediction mode in opposite direction. Accordingly, fora non-square block, directional prediction modes havingangles greater or smaller than those of directionalprediction modes shown in FIG. 22 may be used. The abovedirectional intra-prediction mode may be defined as awide angle intra-prediction mode. A wide angle intraprediction mode represents a directional intraprediction mode that does not belong to a range of 45degrees to -135 degrees.

[00329] FIG. 23 is a view showing wide angle intraprediction modes.

[00330] In an example show in FIG. 23, intraprediction modes having indices from -1 to -14 and intraprediction modes having indices from 67 to 80 representwide angle intra-prediction modes.

[00331] In FIG. 23, 14 wide angle intra-predictionmodes (from -1 to -14) which are greater in angle than45 degrees and 4 wide angle intra-prediction modes (from67 to 80) which are smaller in angle than -135 degreesare shown. However, more or fewer number of wide angleintra-prediction modes may be defined.

[00332] When a wide angle intra-prediction mode isused, a length of top reference samples may be set to 2W+ 1, and a length of left reference samples may be setto 2H + 1.

[00333]

[00334] When a prediction block is generated as aresult of intra-prediction, prediction samples may beupdated based on each position of prediction samplesincluded in a prediction block. Such an update methodmay be referred to as a sample position-based intraweighting prediction method (or, Position DependentPrediction Combination, PDPC).

[00335] Whether PDPC is used may be determinedconsidering an intra-prediction mode of a current block,a reference sample line of a current block, a size of acurrent block or a color component. In an example, PDPCmay be used when the intra-prediction mode of a currentblock is at least one of a planar, DC, a verticaldirection, a horizontal direction, a mode with an indexvalue smaller than a vertical direction or a mode withan index value larger than a horizontal direction.Alternatively, PDPC may be used only when at least oneof a width or height of a current block is greater than4. Alternatively, PDPC may be used only when the indexof a reference picture line of a current block is 0.Alternatively, PDPC may be used only when the index ofa reference picture line of a current block is over thepredefined value. Alternatively, PDPC may be used onlyfor a luminance component. Alternatively, Whether PDPCis used may be determined according to whether more than2 of the above-enumerated conditions are satisfied.

[00336] In another example, information showingwhether PDPC is applied may be signaled in a bitstream.

[00337] When a prediction sample is obtained throughan intra-prediction sample, a reference sample used tocorrect the prediction sample may be determined based onthe position of the obtained prediction sample. For theconvenience of explanation, a reference sample used tocorrect a prediction sample is referred to as a PDPCreference sample in the embodiment described later. Inaddition, a prediction sample obtained by intraprediction is referred to as a first prediction sampleand a prediction sample obtained by correcting the firstprediction sample is referred to as a second predictionsample.

[00338] FIG. 24 is a diagram showing the applicationaspect of PDPC.

[00339] With at least one PDPC reference sample, thefirst prediction sample may be corrected. A PDPCreference sample may include at least one of a referencesample adjacent to the left-top corner of a current block,a top reference sample positioned at the top of a currentblock or a left reference sample positioned at the leftof a current block.

[00340] At least one of reference samples belongingto the reference sample line of a current block may beset as a PDPC reference sample. Alternatively,regardless of a reference sample line of a current block,at least one of reference samples belonging to areference sample line that an index is 0 may be set asa PDPC reference sample. In an example, although thefirst prediction sample is obtained by using a referencesample included in a reference sample line that an indexis 1 or 2, the second prediction sample may be obtainedby using a reference sample included in a referencesample line that an index is 0.

[00341] The number or position of PDPC referencesamples used to correct the first prediction sample maybe determined considering at least one of an intraprediction mode of a current block, a size of a currentblock, a shape of a current block or a position of thefirst prediction sample.

[00342] In an example, when the intra-prediction modeof a current block is a planar or a DC mode, the secondprediction sample may be obtained by using a topreference sample and a left reference sample. In thisconnection, a top reference sample may be a referencesample vertical to the first prediction sample (e.g. areference sample with the same x-coordinate) and a leftreference sample may be a reference sample horizontal tothe first prediction sample (e.g. a reference samplewith the same y-coordinate).

[00343] When the intra-prediction mode of a currentblock is a horizontal directional intra-prediction mode,the second prediction sample may be obtained by using atop reference sample. In this connection, a top referencesample may be a reference sample vertical to the firstprediction sample.

[00344] When the intra-prediction mode of a currentblock is a vertical directional intra-prediction mode,the second prediction sample may be obtained by using aleft reference sample. In this connection, a leftreference sample may be a reference sample horizontal tothe first prediction sample.

[00345] When the intra-prediction mode of a currentblock is a left-bottom diagonal directional or a righttop diagonal directional intra-prediction mode, thesecond prediction sample may be obtained based on a lefttop reference sample, a top reference sample and a leftreference sample. A left-top reference sample may be areference sample adjacent to the left-top corner of acurrent block (e.g. a reference sample positioned at (-1, -1)). A top reference sample may be a reference samplepositioned at the right-top diagonal direction of thefirst prediction sample and a left reference sample maybe a reference sample positioned at the left-bottomdiagonal direction of the first prediction sample.

[00346] In summary, when the first prediction sampleis positioned at (x, y), R(-1, -1) may be set as a lefttop reference sample and R(x+y+1, -1) or R(x, -1) may beset as a top reference sample. In addition, R(-1, x+y+1)or R(-1, y) may be set as a left reference sample.

[00347]

[00348] A single prediction mode may be applied to acurrent block multiple times or a plurality of predictionmodes may be applied repeatedly. Likewise, a predictionmethod using prediction modes of the same kind or of adifferent kind may be referred to as a combinedprediction mode (or, Multi-hypothesis Prediction Mode).

[00349] A combined prediction mode may include atleast one of a mode that a merge mode and a merge modeare combined, a mode that inter-prediction and intraprediction are combined, a mode that a merge mode and amotion vector prediction mode are combined, a mode thata motion vector prediction mode and a motion vectorprediction mode are combined or a mode that a merge modeand intra-prediction are combined.

[00350] In a combined prediction mode, the firstprediction block may be generated based on the firstprediction mode and the second prediction block may begenerated based on the second prediction mode. Then, thethird prediction block may be generated based on aweighted sum operation of the first prediction block andthe second prediction block. The third prediction blockmay be set as the final prediction block of a currentblock.

[00351] Based on a size or shape of a current block,whether a combined prediction mode is used may bedetermined. In an example, whether a combined predictionmode is used may be determined based on at least one ofthe size of a coding block, the number of samplesincluded in a coding block, a width of a coding block ora height of a coding block. In an example, when at leastone of the width or height of a coding block is over 128or when the number of samples included in a coding blockis below 64, a combined prediction mode may not beapplied to the coding block.

[00352] Alternatively, information showing whether acombined prediction mode is applied to a current blockmay be signaled in a bitstream. In an example, theinformation may be a 1-bit flag. In an example, a flag,mh_intra_flag, indicating whether a combined predictionmode that a merge mode and intra-prediction are combinedis used, may be signaled in a bitstream. WhenMh_intra_flag is 1, it represents that a combinedprediction mode in which a merge mode and intraprediction are combined is used and when mh_intra_flagis 0, it represents that a combined prediction mode inwhich a merge mode and intra-prediction are combined isnot used.

[00353] Only when the prediction encoding mode of acurrent block is an inter-prediction mode and when amerge mode is applied to the current block, a combinedprediction mode in which the merge mode and intraprediction are combined may be applied to the currentblock. In other words, mh_intra_flag may be signaledwhen the value of a flag, merge_flag, indicating whetherthe merge mode is applied to the current block is 1.

[00354] In a prediction mode in which a merge modeand intra-prediction are combined, the intra-predictionmode of a current block may be set as a predefined intraprediction mode. In an example, when a combinedprediction mode is used, the intra-prediction mode of acurrent block may be set as a planar mode.

[00355] In another example, when a combinedprediction mode in which a merge mode and intraprediction are combined is used, the intra-predictionmode of a current block may be determined as one ofcandidate intra-prediction modes. In this connection,candidate intra-prediction modes may include at leastone of a non-directional intra-prediction mode or adirectional intra-prediction mode for a specificdirection. In this connection, the non-directionalintra-prediction mode may include at least one of DC orplanar and the directional intra-prediction mode mayinclude at least one of the intra-prediction mode of ahorizontal direction, the intra-prediction mode of avertical direction or the intra-prediction mode of adiagonal direction. In an example, when a combinedprediction mode is used, only the intra-prediction modeof a DC, planar or horizontal direction or a verticaldirection can be set as the intra-prediction mode of acurrent block. Alternatively, when a combined predictionmode is used, only the intra-prediction mode of a planar,horizontal direction, or vertical direction can be setas the current block's intra-prediction mode.Alternatively, when a combined prediction mode is used,only the intra-prediction mode of a DC, planar, orvertical direction can be set as the current block'sintra-prediction mode. Alternatively, when a combinedprediction mode is used, only the intra-prediction modeof a DC, planar, or horizontal direction can be set asthe current block's intra-prediction mode.

[00356] Index information for specifying any one ofcandidate intra-prediction modes may be signaled in abitstream. In an example, an index, mh_intra_idx,specifying any one of candidate intra-prediction modes,may be signaled in a bitstream. Table 5 and 6 show anintra-prediction mode according to the value ofmh_intra_idx. The intra-prediction mode of a currentblock may be determined as an intra-prediction modeindicated by mh_intra_idx.

[00357] [Table 5]mh_intra_idx 0 1 2 3intra mode PLANAR DC VERTICAL HORIZONTAL

[00358] [Table 6]mh_intra_idx 0 1 2intra mode PLANAR VERTICAL HORIZONTAL

[00359] The number of candidate intra-predictionmodes may have a fixed value in an encoder and a decoder.Alternatively, according to at least one of a size orshape of a current block or whether a neighboring blockis encoded by intra-prediction, the number or type ofcandidate intra-prediction modes may vary.

[00360] In another example, when a combinedprediction mode in which a merge mode and intraprediction are combined is applied, based on MPMs, theintra-prediction mode of a current block may bedetermined. In this connection, the number of MPMsincluded in an MPM list when general intra-prediction isapplied may be different from that of MPMs included inan MPM list when a combined prediction mode is applied.In an example, while an MPM list includes 6 or 5 MPMswhen a combined prediction mode is not applied, an MPMlist may include 4 or 3 MPMs when a combined predictionmode is applied. In other words, while N MPMs are usedwhen general intra-prediction is performed, MPMs lessthan N may be used when a combined prediction mode isapplied.

[00361] In an example, when general intra-predictionmode is applied, it is assumed that MPMs derived basedon the intra-prediction mode of a neighboring blockadjacent to a current block are planar, DC, INTRA_MODE32,INTRA_MODE31, INTRA_MODE33 and INTRA_MODE30. when acombined prediction mode is applied to a current block,the intra-prediction mode of a current block may bedetermined by using only a part of the above 6 MPMs. Inan example, the intra-prediction mode of a current blockmay be determined by using an MPM list including 3 MPMs,planar, DC and INTRA_MODE32, having the smallest indexamong the MPMs. Alternatively, one having a predefinedindex value among the MPMs may be determined as theintra-prediction mode of a current block.

[00362] In another example, the number of MPMs usedto determine the intra-prediction mode of a current blockwhen general intra-prediction is applied may be set thesame as the number of MPMs used to determine the intraprediction mode of a current block when a combinedprediction mode is applied.

[00363] When a combined prediction mode is applied,the encoding of an MPM flag may be omitted and the MPMflag may be inferred true. In other words, when acombined prediction mode is applied, any one of MPMs maybe determined as the intra-prediction mode of a currentblock.

[00364] Alternatively, based on the intra-predictionmodes of neighboring blocks adjacent to a current block,the intra-prediction mode of the current block may bederived. In this connection, a neighboring block mayinclude at least one of a top neighboring block, a leftneighboring block, a left-top neighboring block, aright-top neighboring block or a left-bottom neighboringblock. The intra-prediction mode of a current block maybe set as an intra-prediction mode with the highestfrequency among the intra-prediction modes ofneighboring blocks adjacent to the current block.

[00365] Alternatively, by comparing the intraprediction modes of neighboring blocks at a predefinedposition, the intra-prediction mode of a current blockmay be determined. In an example, when the intraprediction mode of a top neighboring block and a leftneighboring block of a current block is identical, theintra-prediction mode of the current block may be setthe same as the intra-prediction mode of the topneighboring block and the left neighboring block.

[00366] Alternatively, index information forspecifying a neighboring block identical to the intraprediction mode of a current block among a plurality ofneighboring blocks may be signaled in a bitstream. In anexample, information indicating any one of a topneighboring block or a left neighboring block may besignaled in a bitstream and the intra-prediction mode ofa current block may be set the same as the intraprediction mode of a block indicated by the information.

[00367] Alternatively, when a combined predictionmode is applied to a neighboring block, the intraprediction mode of the neighboring block to which thecombined prediction mode is applied may be set as theintra-prediction mode of a current block.

[00368] When a combined prediction mode in which amerge mode and intra-prediction are combined is appliedto a current block, it may be set not to use a multiline intra-prediction encoding method. If the multi-lineintra-prediction encoding method is not used, anadjacent reference sample line may be used for the intraprediction of the current block.

[00369] Alternatively, when a combined predictionmode in which a merge mode and intra-prediction arecombined is applied to a current block, it may be set touse a multi-line intra-prediction encoding method.Information for determining the reference sample line ofthe current block among a plurality of reference samplelines may be signaled in a bitstream. Alternatively,considering at least one of the size of a current block,the shape of a current block, the intra-prediction modeof a current block or the reference sample line of aneighboring block, the reference sample line of thecurrent block may be determined.

[00370] Alternatively, information indicatingwhether a multi-line intra method is applied in acombined prediction mode may be signaled in a bitstream.The information may be 1-bit flag. When the aboveindicates a multi-line intra method is applied, indexinformation specifying any one of multi-lines may besignaled in a bitstream.

[00371] According to the reference sample line of acurrent block, the number of available candidate intraprediction modes may be set differently. In an example,when an adjacent reference sample line is used, acandidate intra-prediction mode may include at least oneof the intra-prediction mode of a planar, DC, horizontaldirectional intra-prediction mode, a verticaldirectional intra-prediction mode, a left-bottomdiagonal directional intra-prediction mode or a righttop diagonal directional intra-prediction mode. On theother hand, when a non-adjacent reference sample line isused, a candidate intra-prediction mode may include atleast one of a horizontal directional intra-predictionmode, a vertical directional intra-prediction mode, aleft-bottom diagonal directional intra-prediction modeor a right-top diagonal directional intra-predictionmode.

[00372] The first prediction block may be generatedby using a merge candidate selected in a merge mode andthe second prediction block may be generated by using anintra-prediction mode. In this connection, when thefirst prediction block is generated, a triangularpartitioning may be set not to be applied to a currentblock. In other words, a triangular partitioning may notbe allowed in a combined prediction mode in which a mergemode and intra-prediction are combined. In addition,when the second prediction block is generated, PDPC maybe set not to be applied to a current block. In otherwords, PDPC may not be allowed in a combined predictionmode in which a merge mode and intra-prediction arecombined.

[00373] Based on the weighted sum operation of thefirst prediction block and the second prediction block,the third prediction block may be generated. In anexample, Equation 6 is a diagram showing an example inwhich based on the weighted sum operation of the firstprediction block and the second prediction block, thethird prediction block is generated.

[00374] [Equation 6]

[00375] In the Equation 6, Pmerge represents the firstprediction block obtained based on a merge mode and Pintrarepresents the second prediction block obtained based onintra-prediction. Pcomb represents the third predictionblock obtained by combing the first prediction block andthe second prediction block. w represents the firstweight applied to the first prediction block. The secondweight applied to the second prediction block may bederived by differentiating the first weight, w, from aconstant N. In this connection, N may have a predefinedvalue in an encoder and a decoder. In an example, N mayby 4 or 8. Alternatively, a constant N may be derivedbased on at least one of a size, shape or intraprediction mode of a current block.

[00376] Unlike an example shown in Equation 6, w maybe set as the second weight and a value differentiatingthe second weight from a predetermined constant N may beset as the first weight.

[00377] Weights applied to the first prediction blockand the second prediction block may be determined basedon at least one of the intra-prediction mode of a currentblock or whether a merge mode has bidirectional motioninformation. In an example, the value of the first weight,w, when the intra-prediction mode of a current block isa directional prediction mode may have a value greaterthan the value of the first weight, w, when the intraprediction mode of a current block is a non-directionalprediction mode. Alternatively, the value of the firstweight, w, when a bidirectional prediction is performedby a merge candidate may have a value greater than thevalue of the first weight, w, when a uni-directionalprediction is performed by a merge candidate.

[00378] In another example, weights may be determinedconsidering the prediction encoding mode of neighboringblocks adjacent to a current block. In this connection,a neighboring block may include at least one of a topneighboring block adjacent to the top of the currentblock, a left neighboring block adjacent to the left ofthe current block or a left-top neighboring blockadjacent to the left-top corner of the current block. Aweight may be determined based on the number ofneighboring blocks encoded by intra-prediction amongneighboring blocks adjacent to the current block. In anexample, it may be set that as the number of neighboringblocks encoded by intra-prediction among neighboringblocks adjacent to the current block is on the increase,the first weight has a small value and the second weighthas a large value. On the other hand, it may be set thatas the number of neighboring blocks encoded by non-intraprediction among neighboring blocks adjacent to thecurrent block is on the decrease, the first weight hasa large value and the second weight has a small value.In an example, when both a left neighboring block and atop neighboring block are encoded by intra-prediction,the second weight may be set as n. When only one of aleft neighboring block and a top neighboring block isencoded by intra-prediction, the second weight may beset as n / 2. When both a left neighboring block and a topneighboring block are not encoded by intra-prediction,the second weight may be set as n / 4. In this connection,n represents an integer equal to or smaller than N.

[00379] A weight may be determined in a sample or asub-block unit in a current block. In an example, acurrent block is partitioned into a plurality of subblocks and a weight applied to each sub-block may be setto respectively have a different value. In thisconnection, the number of sub-blocks may have a fixedvalue in an encoder and a decoder. Alternatively, basedon at least one of the size or shape of a current block,an intra-prediction mode of a current block or theprediction encoding mode of a neighboring block, thenumber of sub-blocks may be adaptively determined.

[00380] FIG. 25 is a diagram showing the applicationaspect of a weight.

[00381] A current block is partitioned into aplurality of sub-blocks and a weight applied to eachsub-block may be set as a value different from each other.In an example, as in an example shown in (a) and (b) ofFIG. 25, while the second weight may be set to have avalue larger than the first weight for a sub-blockincluding a sample positioned at a left-top corner in acurrent block, the first weight may be set to have avalue larger than the second weight for a sub-blockincluding a sample positioned at a right-bottom cornerin a current block.

[00382] The third prediction sub-block for a subblock may be obtained by the weighted prediction of thefirst prediction sub-block and the second predictionsub-block corresponding to the sub-block. In thisconnection, as in an example shown in FIG. 25, a weightused for weighted prediction per sub-block may bedifferently set.

[00383] According to whether a merge candidate hasbidirectional motion information, a weight assigned toa sub-block may be differently determined.

[00384] FIG. 26 shows an example in which accordingto whether a merge candidate has bidirectional motioninformation, a different weight is assigned to a subblock.

[00385] When a merge candidate has bidirectionalmotion information, the first weight, w, assigned to atleast one of sub-blocks may be set as a large value incomparison with a case in which a merge candidate hasuni-directional motion information. In an example, (a)and (b) of FIG. 26 illustrated that regarding all subblocks, a weight, w, applied when a bidirectionalprediction is applied has a value larger than a weight,w, applied when an uni-directional prediction is applied.

[00386] Alternatively, based on the intra-predictionmode of a current block, a weight applied to a sub-blockmay be determined.

[00387] FIG. 27 shows an example in which a differentweight is assigned to a sub-block according to the intraprediction mode of a current block.

[00388] When the intra-prediction mode of a currentblock has a vertical direction, the second weight of asub-block positioned at the top of the current block maybe set to have a value larger than the second weight ofa sub-block positioned at the bottom of the current block.

[00389] In an example, while the second weight may beset to have a value larger than the first weight for asub-block positioned at the top of the current block,the first weight may be set to have a value equal to orlarger than the second weight for a sub-block positionedat the bottom of the current block.

[00390] When the intra-prediction mode of a currentblock has a horizontal direction, the second weight ofa sub-block positioned at the left of the current blockmay be set to have a value larger than the second weightof a sub-block positioned at the right of the currentblock.

[00391] In an example, while the second weight may beset to have a value larger than the first weight for asub-block positioned at the left of the current block,the first weight may be set to have a value equal to orlarger than the second weight for a sub-block positionedat the right of the current block.

[00392] In another example, when the intra-predictionmode of a current block has a vertical direction, thefirst weight of a sub-block positioned at the top of thecurrent block may be set to have a value larger than thefirst weight of a sub-block positioned at the bottom ofthe current block or when the intra-prediction mode ofa current block has a horizontal direction, the firstweight of a sub-block positioned at the left of thecurrent block may be set to have a value larger than thefirst weight of a sub-block positioned at the right ofthe current block.

[00393] In another example, based on the predictionencoding mode of neighboring blocks adjacent to a currentblock, a weight assigned to each sub-block may bedetermined. In one example, when while the topneighboring block of the current block is encoded byintra-prediction, the left neighboring block of thecurrent block is not encoded by intra-prediction, thesecond weight of a sub-block positioned at the top ofthe current block may be set to have a value larger thanthe second weight of a sub-block positioned at the bottomof the current block. On the other hand, when while thetop neighboring block of the current block is not encodedby intra-prediction, the left neighboring block of thecurrent block is encoded by intra-prediction, the secondweight of a sub-block positioned at the left of thecurrent block may be set to have a value larger than thesecond weight of a sub-block positioned at the right ofthe current block.

[00394] For at least one of a plurality of sub-blocks,the first or second weight may be set as 0. In otherwords, for at least one of a plurality of sub-blocks,the first or second prediction sub-block may be set asthe third prediction sub-block. Accordingly, combinedprediction may not be performed in at least one of aplurality of sub-blocks. In one example, for at leastone of a plurality of sub-blocks, the first weight, w,may be set as 0 or a constant N.

[00395] A block to which a combined prediction modethat a merge mode and intra-prediction are combined isapplied may be considered encoded by inter-prediction.Accordingly, the intra-prediction mode of a blockencoded by a combined prediction mode may be set to beunavailable for deriving the intra-prediction mode of ablock which will be encoded / decoded. In deriving an MPM,the intra-prediction mode of an unavailable block may beconsidered to be planar.

[00396] On the other hand, the motion information ofa block encoded by a combined prediction mode may be setto be available for deriving the motion information ofa block which will be encoded / decoded.

[00397]

[00398] In a mode in which a merge mode and a mergemode are combined, motion compensation prediction may beperformed by using a plurality of merge candidates.Concretely, the first prediction block may be generatedby using the first merge candidate and the secondprediction block may be generated by using the secondmerge candidate. Based on the weighted operation of thefirst prediction block and the second prediction block,the third prediction block may be generated.

[00399] Alternatively, after partitioning a currentblock into a plurality of sub-partitions (e.g., subblocks), a combined prediction mode may be applied.

[00400] FIG. 28 is a diagram showing an example inwhich a current block is partitioned into a plurality ofsub-partitions.

[00401] As in an example shown in (a) to (d) of FIG.28, a current block may be partitioned into 2 subpartitions based on a horizontal line, a vertical line,the diagonal line of a left-top direction or the diagonalline of a right-top direction.

[00402] At least one of the information indicatingwhether a current block will be partitioned into aplurality of sub-partitions or information indicatingthe partition type of a current block may be signaled ina bitstream. Information indicating the partition typeof a current block represents at least one of the type,direction or position of a partitioning linepartitioning the current block. In one example, based oninformation indicating a partition type, at least one ofwhether a partitioning line partitioning the currentblock is a horizontal line, a vertical line or a diagonalline, or whether a partitioning line partitioning thecurrent block connects the right-top and the left-bottomof the current block, or the left-top and the rightbottom of the current block may be determined.

[00403] A current block is partitioned into aplurality of sub-partitions and the motion informationof each sub-partition may be set to be derived fromdifferent merge candidates. In one example, if the motioninformation of the first sub-partition is derived fromthe first merge candidate, the motion information of thesecond sub-partition may be derived from the second mergecandidate different from the first merge candidate.

[00404] In a combined prediction mode in which a mergemode and a merge mode are combined, information forspecifying the first merge candidate and the second mergecandidate may be signaled in a bitstream, respectively.In one example, index information, merge_idx, forspecifying the first merge candidate, and indexinformation, merge_2nd_idx, for specifying the secondmerge candidate, may be signaled in a bitstream. Thesecond merge candidate may be determined based on indexinformation, merge_2nd_idx and index information,merge_idx.

[00405] Index information, merge_idx, specifies anyone of merge candidates included in a merge candidatelist.

[00406] Index information, merge_2nd_idx, may specifyany one of residual merge candidates except for a mergecandidate specified by merge_idx. Accordingly, when thevalue of merge_2nd_idx is smaller than that of merge_idx,a merge candidate that the value of merge_2nd_idx is anindex may be set as the second merge candidate. When thevalue of merge_2nd_idx is equal to or larger than thatof merge_idx, a merge candidate whose index value isobtained by adding 1 to the value of merge_2nd_idx maybe set as the second merge candidate.

[00407] Alternatively, considering the search orderof candidate blocks, the second merge candidate may bespecified.

[00408] FIG. 29 shows an example in which the secondmerge candidate is specified considering the searchorder of candidate blocks.

[00409] In an example shown in FIG. 29, an indexmarked in neighboring and non-neighboring samples showsthe search order of candidate blocks. In one example,candidate blocks may be sequentially searched from aposition A0 to A14.

[00410] When an A4 block is selected as the firstmerge candidate, a merge candidate derived from acandidate block in the search order after A4 may bespecified as the second merge candidate. In one example,a merge candidate derived from A5 may be selected as thesecond merge candidate. If a candidate block at aposition of A5 is unavailable as a merge candidate, amerge candidate derived from a next-rank candidate blockmay be selected as the second merge candidate.

[00411] The first merge candidate and the secondmerge candidate may be selected among merge candidatesderived from non-neighboring blocks.

[00412] FIG. 30 shows an example in which the firstmerge candidate and the second merge candidate areselected among merge candidates derived from nonneighboring blocks.

[00413] As in an example shown in FIG. 30, mergecandidates derived from the first candidate block andthe second candidate block non-adjacent to a currentblock may be selected as the first merge candidate andthe second merge candidate, respectively. In thisconnection, a block line to which the first candidateblock belongs may be different from a block line to whichthe second candidate block belongs. In one example, thefirst merge candidate may be derived from any candidateblock of A5 to A10 and the second merge candidate may bederived from any candidate block of A11 to A15.

[00414] Alternatively, the first candidate block andthe second candidate block may be set not to be includedin the same line (e.g., a row, a column).

[00415] In another example, the second mergecandidate may be specified based on the first mergecandidate. In this connection, the first merge candidatemay be specified by index information, merge_idx,signaled by a bitstream. In one example, a mergecandidate neighboring the first merge candidate may bedetermined as the second merge candidate. In thisconnection, a merge candidate neighboring the firstmerge candidate may mean a merge candidate that a valueof an index difference with the first merge candidate is1. In one example, a merge candidate that an index valueis merge_idx+1 may be set as the second merge candidate.In this connection, when the value of merge_idx+1 isgreater than the maximum index value (or, when the indexvalue of the first merge candidate is the maximum index),a merge candidate that an index value is merge_idx-1 orthat an index value is a predefined value (e.g., 0) maybe set as the second merge candidate.

[00416] Alternatively, a merge candidate neighboringthe first merge candidate may mean a merge candidatederived from a candidate block spatially neighboring acandidate block used to derive the first merge candidate.In this connection, the neighboring candidate block ofthe candidate block may mean a block adjacent to theleft, right, top, bottom or diagonal direction of thecandidate block.

[00417] In another example, the second mergecandidate may be specified based on the motioninformation of the first merge candidate. In one example,a merge candidate with the same reference picture as thefirst merge candidate may be selected as the second mergecandidate. When there are multiple merge candidates withthe same reference picture as the first merge candidate,a merge candidate with the smallest index, a mergecandidate having the smallest difference of an indexwith the first merge candidate, or a merge candidatehaving the smallest difference of a motion vector withthe first merge candidate among a plurality of mergecandidates may be selected as the second merge candidate.Alternatively, the second merge candidate may beselected based on index information specifying any oneof a plurality of merge candidates.

[00418] Alternatively, when the first merge candidatehas uni-directional prediction information of the firstdirection, a merge candidate including motioninformation on the second direction may be set as thesecond merge candidate. In one example, when the firstmerge candidate has the motion information of L0direction, a merge candidate having the motioninformation of L1 direction may be selected as the secondmerge candidate. When there are multiple mergecandidates having the motion information of L1 direction,a merge candidate with the smallest index or a mergecandidate having the smallest difference of an indexwith the first merge candidate among a plurality of mergecandidates may be set as the second merge candidate.Alternatively, the second merge candidate may beselected based on index information specifying any oneof multiple merge candidates.

[00419] When the first merge candidate is selected ina merge candidate list and the selected first mergecandidate has the uni-directional motion information ofthe first direction, the merge candidate list may berearranged, and based on the rearranged merge candidatelist, the second merge candidate may be selected.Rearrangement may be performed in order that the indexof a merge candidate having the motion information ofthe second direction has a value smaller than the indexof a merge candidate having the motion information ofthe first direction.

[00420] FIG. 31 is a diagram showing an example inwhich a merge candidate is rearranged.

[00421] When the first merge candidate has the unidirectional motion information of L0 direction,rearrangement may be performed in order that a mergecandidate having the motion information of L1 is placedin front of a merge candidate list.

[00422] In one example, as in an example shown in FIG.31, rearrangement may be performed so that a mergecandidate having the motion information of L1 directionhas an index value smaller than a merge candidate havingthe uni-directional motion information of L0 direction.

[00423] Unlike an example shown in FIG. 31, the unidirectional merge candidate of L1 direction may be setto have a priority higher than a bidirectional mergecandidate.

[00424] Alternatively, a first merge candidate listand a second merge candidate list may be generated. Inthis connection, respective the first merge candidateand the second merge candidate may be derived from adifferent merge candidate list. In one example, the firstmerge candidate may be derived from the first mergecandidate list and the second merge candidate may bederived from the second merge candidate list. In thisconnection, the first merge candidate list may includemerge candidates including the motion information of L0direction and the second merge candidate list may includemerge candidates including the motion information of L1direction. Alternatively, when a merge candidate hasbidirectional motion information, it may be set to useonly one of L0 or L1 motion information. In thisconnection, whether which one of L0 or L1 motioninformation will be used may be determined based on theindex of a merge candidate.

[00425] In one example, when the index of a mergecandidate is an even number, only the L1 motioninformation of the merge candidate may be used. On theother hand, when the index of a merge candidate is anodd number, only the L0 motion information of the mergecandidate may be used. Contrary to a described example,it may be set to use only L0 motion information when theindex of the merge candidate is an even number and touse only L1 motion information when the index of themerge candidate is an odd number.

[00426] In another example, the first merge candidatemay be set as one of merge candidates derived fromneighboring blocks adjacent to a current block and thesecond merge candidate may be set as one of mergecandidates derived from non-neighboring blocks nonadjacent to a current block.

[00427] In another example, the first merge candidatemay be set as one of merge candidates derived fromcandidate blocks positioned at the top of a current blockand the second merge candidate may be set as one of mergecandidates derived from candidate blocks positioned atthe left of a current block.

[00428] In a combined prediction mode in which theabove-mentioned merge mode and a merge mode are combined,the merge mode may mean a translation motion model basedmerge mode (hereinafter, referred to as a translationmerge mode) or an affine motion model based merge mode(hereinafter, referred to as an affine merge mode). Inother words, motion compensation prediction may beperformed by combing a translation merge mode and atranslation merge mode or by combining an affine mergemode and an affine merge mode.

[00429] In another example, when a neighboring blockused to derive the first merge candidate is encoded basedon affine motion information, a merge candidate derivedfrom a neighboring block encoded based on affine motioninformation may be set as the second merge candidate. Inone example, when the first merge candidate is an affinemerge candidate or that the first merge candidate isderived based on the motion information of a sub-blockin a coding block encoded based on an affine motioninformation, a merge candidate derived based on an affinemotion information or the motion information of a subblock in a coding block encoded based on an affine mergecandidate may be selected as the second merge candidate.In this connection, the second merge candidate mayinclude at least one of a merge candidate whose searchorder is closest to the first merge candidate, a mergecandidate having the smallest difference of an indexwith the first merge candidate, a merge candidate withthe smallest index or a merge candidate having thesmallest difference of a motion vector with the firstmerge candidate among merge candidates which satisfy theabove condition.

[00430] Contrary to the above-mentioned example, whena neighboring block used to derive the first mergecandidate is encoded based on translation motioninformation (namely, non-affine motion information), amerge candidate derived from a neighboring block encodedbased on translation motion information may be set asthe second merge candidate. In one example, when thefirst merge candidate is a non-affine merge candidate,a non-affine merge candidate may be selected as thesecond merge candidate. In this connection, the secondmerge candidate may include at least one of a mergecandidate whose search order is closest to the firstmerge candidate, a merge candidate having the smallestdifference of an index with the first merge candidate,a merge candidate with the smallest index or a mergecandidate having the smallest difference of a motionvector with the first merge candidate among non-affinemerge candidates.

[00431] Alternatively, the second merge candidate maybe derived by adding or subtracting an offset to or fromthe index of the first merge candidate, but when theencoding method of neighboring blocks used to derive thefirst and second merge candidates are different fromeach other, the second merge candidate may be replacedby another merge candidate. Only when the number of mergecandidates included in a merge candidate list is lessthan the predefined number, the second merge candidatemay be derived by adding or subtracting an offset to orfrom the first merge candidate. In this connection, thepredefined number may be 2, 3, or 4, etc.

[00432] FIG. 32 is a diagram to explain an exampledetermining the second merge candidate.

[00433] When the first merge candidate is selected,a merge candidate having an index derived by adding orsubtracting an offset to or from the index of the firstmerge candidate may be selected as the second mergecandidate. In one example, a merge candidate having avalue indicated by merge_idx signaled by a bitstream asan index may be selected as the first merge candidateand a merge candidate having merge_idx+1 as an index maybe selected as the second merge candidate.

[00434] In this connection, when the first mergecandidate is derived from a sub-block belonging to acoding block encoded by an affine merge candidate or anaffine motion model, the second merge candidate shouldbe also set as a merge candidate derived from a subblock belonging to a coding block encoded by an affinemerge candidate or an affine motion model. When a mergecandidate having merge_idx+1 as an index is not an affinemerge candidate or is not derived from a sub-blockbelonging to a coding block encoded by an affine motionmodel, another merge candidate may be set as the secondmerge candidate. In this connection, the other mergecandidate may be a merge candidate having the smallestdifference of an index with the first merge candidate orwith merge_idx+1 among merge candidates derived from asub-block belonging to a coding block encoded by affinemerge candidates or an affine motion model.

[00435] On the contrary, when the first mergecandidate is a non-affine merge candidate, the secondmerge candidate should be also set as a non-affine mergecandidate. When a merge candidate having merge_idx+1 asan index is derived from a sub-block belonging to acoding block encoded by an affine merge candidate or anaffine motion model, another merge candidate may be setas the second merge candidate. In this connection, theother merge candidate may be a merge candidate with thesmallest difference of an index with the first mergecandidate or with merge_idx+1 among non-affine mergecandidates. In one example, an example shown in FIG. 32illustrated that a merge candidate A3 having merge_idx+2as an index is set as the second merge candidate.

[00436] In another example, motion compensationprediction may be performed by combining a translationmerge mode and an affine merge mode. In other words,among the first merge candidate or the second mergecandidate, one may be an affine merge candidate and theother may be a non-affine merge candidate.

[00437] A combined prediction block may be obtainedby the weighted sum operation of the first predictionblock derived from the first merge candidate and thesecond prediction block derived based on the second mergecandidate. A weight may be a real number including 0. Inthis connection, a weight applied to the first predictionblock may be set as a value greater than a weight appliedto the second prediction block.

[00438] Alternatively, based on the motioninformation of the first merge candidate and the secondmerge candidate, weights may be determined. In oneexample, based on the difference of output order betweena reference picture and a current picture, weightsapplied to the first and second prediction block may bedetermined. Concretely, as the difference of outputorder between a reference picture and a current pictureis greater, a weight applied to a prediction block maybe set as a small value.

[00439] Alternatively, considering a size or shape ofa candidate block used to derive the first mergecandidate (hereinafter, referred to as the firstcandidate block) and a size or shape of a candidate blockused to derive the second merge candidate (hereinafter,referred to as the second candidate block), weightsapplied to the first and second prediction block may bedetermined. In one example, a weight applied to aprediction block derived from one having a shape similarto a current block among the first candidate block andthe second candidate block may be set as a large value.On the other hand, a weight applied to a prediction blockderived from one having a shape non-similar to a currentblock may be set as a small value.

[00440] FIG. 33 is a diagram showing an example inwhich weights applied to prediction blocks aredetermined based on the shape of candidate blocks.

[00441] It is assumed that a current block has a nonsquare shape whose width is greater than height.

[00442] The first prediction block and the secondprediction block may be derived based on the first mergecandidate and the second merge candidate and a combinedprediction block may be generated based on the weightedsum operation of the first prediction block and thesecond prediction block. In this connection, weightsapplied to the first prediction block and the secondprediction block may be determined based on the shape ofthe first candidate block and the second candidate block.

[00443] In one example, in an example shown in FIG.33, the first candidate block has a square shape and thesecond candidate block has a non-square shape whose widthis greater than height. As the shape of the secondcandidate block is identical to a current block, a weightapplied to the second prediction block may be set tohave a value greater than a weight applied to the firstprediction block. In one example, 5 / 8 weight may beapplied to the second prediction block and 3 / 8 weightmay be applied to the first prediction block. Thefollowing Equation 7 shows an example deriving a combinedprediction block based on the weighted sum operation ofthe first prediction block and the second predictionblock.

[00444] [Equation 7]

[00445] P(x, y) represents a combined predictionblock, P1(x, y) represents the first prediction blockand P2(x, y) represents the second prediction block.

[00446] In another example, based on the shape of acurrent block, a weight applied to the first and secondprediction block may be determined. In one example, whena current block has a non-square shape whose width isgreater than height, a larger weight may be applied toa prediction block generated based on a candidate blockpositioned at the top of the current block among thefirst merge candidate and the second merge candidate.When both the first merge candidate and the second mergecandidate are derived from candidate blocks positionedat the top, a weight applied to the first predictionblock may be set to be equal to a weight applied to thesecond prediction block. On the other hand, when thecurrent block has a non-square shape whose height isgreater than width, a larger weight may be applied to aprediction block generated based on a candidate blockpositioned at the left of a current block among the firstmerge candidate and the second merge candidate. Whenboth the first merge candidate and the second mergecandidate are derived from candidate blocks positionedat the left, a weight applied to the first predictionblock may be set to be equal to a weight applied to thesecond prediction block. When a current block is square,a weight applied to the first prediction block may beset to be equal to a weight applied to the secondprediction block.

[00447] In another example, based on distance betweena current block and a candidate block, a weight appliedto each prediction block may be determined. In thisconnection, distance may be derived based on x-axiscoordinate difference with the current block, y-axiscoordinate difference with the current block or theminimum value among them. A weight applied to aprediction block derived from a merge candidate with asmall distance with the current block may be set to begreater than a weight applied to a prediction blockderived from a merge candidate with a large distancewith the current block. In one example, in an exampleshown in FIG. 30, the first merge candidate was derivedfrom a neighboring block adjacent to the current blockand the second merge candidate was derived from a nonneighboring block non-adjacent to the current block. Inthis case, as an x-axis distance between the firstcandidate block and the current block is smaller than anx-axis distance between the second candidate block andthe current block, a weight applied to the firstprediction block may be set to be larger than a weightapplied to the second prediction block.

[00448] Alternatively, when both the first mergecandidate and the second merge candidate are derivedfrom non-neighboring blocks, a larger weight may beassigned to a prediction block derived from what iscloser to a current block among non-neighboring blocks.In one example, in an example shown in FIG. 32, as a yaxis distance between the first candidate block and thecurrent block is smaller than a y-axis distance betweenthe second candidate block and the current block, aweight applied to the first prediction block may be setto be larger than a weight applied to the secondprediction block.

[00449] Considering the priority between mergecandidates, a weight applied to the first predictionblock and the second prediction block may be determined.In this connection, the priority between mergecandidates may be determined based on at least one ofwhether a merge candidate is derived from a spatialneighboring block, whether a merge candidate is derivedfrom a temporal neighboring block, whether a mergecandidate is added to a merge candidate list from amotion information table, whether a merge candidate isgenerated by combining two merge candidates or an indexassigned to a merge candidate.

[00450] In one example, considering whether the firstmerge candidate or the second merge candidate is a mergecandidate added to a merge candidate list from a motioninformation table, a weight applied to the firstprediction block and the second prediction block may bedetermined. Concretely, a weight applied to a predictionblock derived based on the motion information of a mergecandidate derived from a motion information table may beset to be smaller than a weight applied to a predictionblock derived based on the motion information of a mergecandidate which is not derived therefrom.

[00451] In one example, when both the first mergecandidate and the second merge candidate are derivedfrom a spatial neighboring block or a temporalneighboring block, a combined prediction block may bederived by applying Equation 7. On the other hand, whenwhile the first merge candidate is derived from a spatialneighboring block or a temporal neighboring block, thesecond merge candidate is derived from a motioninformation candidate included in a motion informationtable, a weight applied to the first prediction blockmay be set to be greater than a weight applied to thesecond prediction block. In one example, Equation 8 showsan example in which a weight applied to the firstprediction block is greater than a weight applied to thesecond prediction block.

[00452] [Equation 8]

[00453] Alternatively, as described in an example inFIG. 25, a weight applied to the first prediction blockand the second prediction block may be differently setper sub-block.

[00454] Alternatively, when a current block ispartitioned into a plurality of sub-partitions, a weightapplied to the first prediction block and a weightapplied to the second prediction block may be set to beset differently per sub-block. In one example, it may beset that while a weight applied to the first predictionblock is greater than a weight applied to the secondprediction block for the first sub-partition, a weightapplied to the second prediction block is greater thana weight applied to the first prediction block for thesecond sub-partition.

[00455] Alternatively, it may be set that for thefirst sub-partition, a weight applied to the firstprediction block is greater than a weight applied to thesecond prediction block and for the second sub-partition,a weight applied to the second prediction block isgreater than a weight applied to the first predictionblock, but for a boundary region between the first subpartition and the second sub-partition, a weight appliedto the first prediction block has the same value as aweight applied to the second prediction block. In thisconnection, the boundary region may include at least oneof a sample positioned on a partitioning linepartitioning a current block or a sample whose distancewith these samples is below the threshold.

[00456] Alternatively, it may be set that while aweight applied to the first prediction block is differentfrom a weight applied to the second prediction block forone of the first sub-partition and the second subpartition, a weight applied to the first prediction blockis equal to a weight applied to the second predictionblock for the other of the first sub-partition and thesecond sub-partition.

[00457] FIG. 34 is a diagram showing an example inwhich a weight applied to prediction blocks is setdifferently per sub-partition.

[00458] A shown example showed that a weight appliedto the second prediction block is set to be greater thana weight applied to the first prediction block for thefirst sub-partition and a weight applied to the firstprediction block is set to be equal to a weight appliedto the second prediction block for the second subpartition. In one example, a combined prediction blockfor the first sub-partition may be derived based on thebelow Equation 9 and a combined prediction block for thesecond sub-partition may be derived based on the belowEquation 10.

[00459] [Equation 9]

[00460] [Equation 10]

[00461] Unified motion information may be derived bybased on the first merge candidate and the second mergecandidate and motion compensation prediction on acurrent block based on unified motion information may beperformed. In one example, the motion vector of a currentblock may be derived based on the average operation orthe weighted sum operation of a motion vector betweenthe first merge candidate and the second merge candidate.In this connection, a weight applied to the motion vectorof the first merge candidate and a weight applied to themotion vector of the second merge candidate may bedetermined by the above-mentioned embodiments.

[00462] When the first merge candidate is a nonaffine merge candidate and the second merge candidate isan affine merge candidate, the motion vector of a currentblock may be derived by scaling the motion vector of thesecond merge candidate. Equation 11 represents anexample deriving the motion vector of a current block.

[00463] [Equation 11]

[00464] In Equation 11, (mvX, mvY) represents themotion vector of a current block, (mv0x, mv0y) representsthe motion vector of the first merge candidate and (mv1x,mv1y) represents the motion vector of the second mergecandidate. M represents a scaling parameter. M may bepredefined in an encoder and a decoder. Alternatively,according to the size of a current block or a candidateblock, the value of a scaling parameter M may bedetermined. In one example, when the width or height ofthe second candidate block is greater than 32, M may beset to be 3 and otherwise, M may be set to be 2.

[00465] The motion information of the first mergecandidate or the second merge candidate may be stored asthe motion information of a block that a combinedprediction mode in which a merge mode and a merge modeare combined is applied. The stored motion informationmay be used to derive the motion information of a blockwhich will be encoded / decoded later.

[00466] Alternatively, the above blocks may bepartitioned into a plurality of sub-blocks and any oneof the motion information of the first merge candidateor the second candidate may be stored as the motioninformation of each sub-block. In this connection, themotion information for a part of a plurality of subblocks may be set as the motion information of the firstmerge candidate and the motion information for othersmay be set as the motion information of the second mergecandidate.

[00467] Alternatively, unified motion informationderived based on the motion information of the firstmerge candidate and the second merge candidate may bestored as the motion information of a block that acombined prediction mode in which a merge mode and amerge mode are combined is applied.

[00468]

[00469] In a prediction mode in which a merge modeand a motion vector prediction mode are combined, thefirst prediction block may be generated by using motioninformation derived from a merge candidate and the secondprediction block may be generated by using a motionvector derived from a motion vector prediction candidate.

[00470] In a motion vector prediction mode, a motionvector prediction candidate may be derived from aneighboring block adjacent to a current block or from acollocated block in a collocated picture. After that,any one of a plurality of motion vector predictioncandidates may be specified and a specified motion vectorprediction candidate may be set as a motion vectorpredictor for the current block. Hereinafter, the motionvector of a current block may be derived by adding themotion vector predictor of a current block and thedifference value of a motion vector.

[00471] In a prediction mode in which a merge modeand a motion vector prediction mode are combined, a mergecandidate and a motion vector prediction candidate maybe derived from the same candidate block. In one example,if a merge candidate is specified by merge_idx, themotion vector of a candidate block used to derive thespecified merge candidate may be set as a motion vectorpredictor. Alternatively, if a motion vector predictioncandidate is specified by mvp_flag, a merge candidatederived from a candidate block used to derive thespecified merge candidate may be selected.

[00472] Alternatively, a candidate block used toderive a merge candidate may be different from acandidate block used to derive a motion vector predictioncandidate. In one example, if a merge candidate derivedfrom a candidate block positioned at the top of a currentblock is selected, a motion vector prediction candidatederived from a candidate block positioned at the left ofthe current block may be set to be selected.

[00473] Alternatively, when a merge candidateselected by index information and a motion vectorprediction candidate selected by index information arederived from the same candidate block, the motion vectorprediction candidate may be replaced with a motion vectorprediction candidate derived from a candidate blockneighboring the candidate block or the merge candidatemay be replaced with a merge candidate derived from acandidate block neighboring the candidate block.

[00474] FIG. 35 is a diagram showing an example inwhich a merge candidate is replaced.

[00475] An example shown in FIG. 35 (a) showed thata merge candidate and a motion vector predictioncandidate derived from a candidate block at a positionof A2 were selected. As shown, when a merge candidateand a motion vector prediction candidate are derivedfrom the same candidate block, a merge candidate or amotion vector prediction candidate derived from acandidate block neighboring the candidate block may beused instead of the merge candidate or the motion vectorprediction candidate. In one example, as in an exampleshown in FIG. 35 (b), a merge candidate at a position ofA1 may be used instead of the merge candidate at aposition of A2.

[00476] The first prediction block may be derivedbased on the merge candidate of a current block and thesecond prediction block may be derived based on a motionvector prediction candidate. Hereinafter, a combinedprediction block may be derived by the weighted sumoperation of the first prediction block and the secondprediction block. In this connection, a weight appliedto the second prediction block generated in a motionvector prediction mode may be set to be greater than aweight applied to the first prediction block generatedin a merge mode. Alternatively, conversely, a weightapplied to the first prediction block generated in amerge mode may be set to be greater than a weight appliedto the second prediction block generated in a motionvector prediction mode.

[00477] Alternatively, as described in the example ofFIG. 25, a weight applied to the first prediction blockand the second prediction block may be set differentlyper sub-block.

[00478]

[00479] A residual image may be derived bysubtracting a prediction image from an original image.In this connection, when the residual image is convertedinto a frequency domain, even though high frequencycomponents are removed from frequency components,subjective image quality of the image does not dropsignificantly. Accordingly, when values of highfrequency components are transformed into small values,or when values of high frequency components are set to0, compression efficiency may be increased withoutcausing large visual distortion. Reflecting the abovefeature, transform may be performed on a current blockso as to decompose a residual image to two-dimensionalfrequency components. The transform may be performed byusing transform methods such as DCT (discrete cosinetransform), DST (discrete sine transform), etc.

[00480] A transform method may be determined on abasis of a block. A transform method may be determinedon the basis of at least one of a prediction encodingmode for a current block, a size of the current block,or a size of the current block. In an example, when acurrent block is encoded through an intra-predictionmode, and a size of the current block is smaller thanNxN, transform may be performed by using a transformmethod of DST. On the other hand, when the abovecondition is not satisfied, transform may be performedby using a transform method of DCT.

[00481] For a partial block of a residual image, twodimensional image transform may not be performed. Notperforming two-dimensional image transform may bereferred to as transform skip. When transform skip isapplied, quantization may be applied to residual valuesfor which transform is not performed.

[00482] After performing transform on a current blockby using DCT or DST, transform may be performed again onthe transformed current block. In this connection,transform based on DCT or DST may be defined as firsttransform, and performing transform again on a block towhich first transform is applied may be defined as secondtransform.

[00483] First transform may be performed by using anyone of a plurality of transform core candidates. In anexample, first transform may be performed by using anyone of DCT2, DCT8, or DCT7.

[00484] Different transform cores may be used for ahorizontal direction and a vertical direction.Information representing a combination of a transformcore of a horizontal direction and a transform core ofa vertical direction may be signaled in a bitstream.

[00485] A processing unit of first transform maydiffer with second transform. In an example, firsttransform may be performed on an 8x8 block, and secondtransform may be performed on a 4x4 sized sub-blockwithin the transformed 8x8 block. In this connection, atransform coefficient for remaining regions for whichsecond transform is not performed may be set to 0.

[00486] Alternatively, first transform may beperformed on a 4x4 block, and second transform may beperformed on a region having an 8x8 size including thetransformed 4x4 block.

[00487] Information representing whether or not toperform second transform may be signaled in a bitstream.

[00488] Alternatively, whether to perform the secondtransform may be determined based on whether a horizontaldirectional transform core and a vertical directionaltransform core are identical with each other. In oneexample, the second transform may be performed only whenthe horizontal directional transform core and thevertical directional transform core are identical witheach other. Alternatively, the second transform may beperformed only when the horizontal directional transformcore and the vertical directional transform core aredifferent from each other.

[00489] Alternatively, the second transform may beallowed only when a predefined transform core is usedfor the horizontal directional transform and thevertical directional transform. In one example, when aDCT2 transform core is used for transform in thehorizontal direction and transform in the verticaldirection, the second transform may be allowed.

[00490] Alternatively, it may be determined whetherto perform the second transform based on the number ofnon-zero transform coefficients of the current block. Inone example, when the number of the non-zero transformscoefficient of the current block is smaller than or equalto a threshold, the prediction method may be configurednot to use the second transform. When the number of thenon-zero transform coefficients of the current block isgreater than the threshold, the prediction method may beconfigured to use the second transform. As long as thecurrent block is encoded using intra prediction, theprediction method may be configured to use the secondtransform.

[00491] The decoder may perform inverse-transform(second inverse-transform) to the second transform andmay perform inverse-transform (first inverse-transform)to the first transform resultant from the second inversetransform. As a result of performing the second inversetransform and the first inverse-transform, residualsignals for the current block may be obtained.

[00492] When transform and quantization are performedby the encoder, the decoder may obtain the residual blockvia inverse-quantization and inverse-transform. Thedecoder may add the prediction block and the residualblock to each other to obtain the reconstructed blockfor the current block.

[00493]

[00494] When the reconstructed block of the currentblock is obtained, loss of information as occurring inthe process of the quantization and encoding may bereduced via the in-loop filtering. The in-loop filtermay include at least one of a deblocking filter, a sampleadaptive offset filter (SAO), or an adaptive loop filter(ALF).

[00495]

[00496] Applying the embodiments as described aboutthe decoding process or the encoding process to theencoding process or the decoding process respectivelymay be included in the scope of the present disclosure.Within the scope of the present disclosure, theembodiments in which operations occur in a predeterminedorder may be modified to embodiments in which theoperations occur in a different order from thepredetermined order.

[00497] Although the above-described embodiment isdescribed based on a series of the operations or theflowchart, the embodiment does not limit a time-seriesorder of the operations of the method thereto. In anotherexample, the operations may be performed simultaneouslyor in a different order therefrom as necessary. Further,in the above-described embodiment, each of thecomponents (for example, a unit, a module, etc.)constituting the block diagram may be implemented in aform of a hardware device or software. A plurality ofcomponents may be combined with each other into a singlecomponent which may be implemented using a singlehardware device or software. The above-describedembodiment may be implemented using program instructionsthat may be executed via various computer components.The instructions may be recorded in a computer-readablestorage medium. The computer-readable storage medium maycontain therein program instructions, data files, datastructures, or the like alone or in combination witheach other. Examples of the computer-readable storagemedia include magnetic media such as hard disks, floppydisks, and magnetic tapes, optical storage media such asCD-ROMs, DVDs, and magneto-optical media such asfloptical disks, and hardware devices such as ROM, RAM,flash memory, and the like specifically configured tostore therein and execute the program instructions. Thehardware device may be configured to operate as one ormore software modules to perform processing according tothe present disclosure, and vice versa.[Industrial availability]

[00498] The present disclosure may be applied to anelectronic device that encodes / decodes video.

Claims

1. A method of decoding a video, the method comprising: generating a merge candidate list for a current block, the merge candidate list being generated by adding at least one of a spatial merge candidate and a temporal merge candidate thereto; in response to a determination that a number of merge candidates included in the merge candidate list is less than a threshold value, updating the merge candidate list by adding a motion information candidate included in a motion information table to the merge candidate list as a new merge candidate; and obtaining motion information of the current block based on the updated merge candidate list, wherein in case that the current block is included in a parallel processing region, a block that is included in the same parallel processing region with the current block is not used to update the motion information table.

2. The method of claim 1, wherein the method further comprises updating the motion information table by adding the motion information of the current block as a new motion information candidate, and wherein in response to a determination that a motion information candidate same as the new motion information candidate is already included in the motion information table, the motion information candidate same as the new information candidate is deleted from the motion information table and then the new motion information candidate is added to the motion information table with a highest index.

3. The method of claim 1, wherein updating the merge candidate list comprises performing a redundancy check of the motion information candidate with merge candidates included in the merge candidate list, and wherein the redundancy check of the motion information candidate is performed only with merge candidates that are derived from blocks that are at predefined positions.

4. The method of claim 3, wherein the blocks comprise a top neighboring block and a left neighboring block adjacent to the current block.

5. The method of claim 1, wherein the method further comprises re-updating the merge candidate list by adding a pair-wise merge candidate thereto, and wherein the pair-wise merge candidate is derived by averaging motion vectors of two merge candidates that are already included in the merge candidate list.

6. The method of claim 1, wherein the threshold value is derived by subtracting a pre-defined offset to a maximum number of merge candidates that can be included in the merge candidate list.

7. The method of claim 1, wherein the current block is located at a bottom-right position in the parallel processing region.

8. A method of encoding a video, the method comprising: generating a merge candidate list for a current block, the merge candidate list being generated by adding at least one of a spatial merge candidate and a temporal merge candidate thereto; in response to a determination that a number of merge candidates included in the merge candidate list is less than a threshold value, updating the merge candidate list by adding a motion information candidate included in a motion information table to the merge candidate list as a new merge candidate; and obtaining motion information of the current block based on the updated merge candidate list, wherein in case that the current block is included in a parallel processing region, a block that is included in the same parallel processing region with the current block is not used to update the motion information table.

9. The method of claim 8, wherein the method further comprises updating the motion information table by adding the motion information of the current block as a new motion information candidate, and wherein in response to a determination that a motion information candidate same as the new motion information candidate is already included in the motion information table, the motion information candidate same as the new information candidate is deleted from the motion information table and then the new motion information candidate is added to the motion information table with a highest index.

10. The method of claim 8, wherein updating the merge candidate list comprises performing a redundancy check of the motion information candidate with merge candidates included in the merge candidate list, and wherein the redundancy check of the motion information candidate is performed only with merge candidates that are derived from blocks that are at pre defined positions.

11. The method of claim 10, wherein the blocks comprise a top neighboring block and a left neighboring block adjacent to the current block.

12. The method of claim 8, wherein the method further comprises re-updating the merge candidate list by adding a pair-wise merge candidate thereto, and wherein the pair-wise merge candidate is derived by averaging motion vectors of two merge candidates that are already included in the merge candidate list.

13. The method of claim 8, wherein the threshold value is derived by subtracting a pre-defined offset to a maximum number of merge candidates that can be included in the merge candidate list.

14. The method of claim 8, wherein the current block is located at a bottom-right position in the parallel processing region.

15. A device for storing a compressed video data which being generated with program instructions, when the program instructions being executed, the device being configured to: generate a merge candidate list for a current block, the merge candidate list being generated by adding at least one of a spatial merge candidate and a temporal merge candidate thereto; in response to a determination that a number of merge candidates included in the merge candidate list is less than a threshold value, update the merge candidate list by adding a motion information candidate included in a motion information table to the merge candidate list as a new merge candidate; and obtain motion information of the current block based on the updated merge candidate list, wherein in case that the current block is included in a parallel processing region, a block that is included in the same parallel processing region with the current block is not used to update the motion information table.