[go: up one dir, main page]

WO2025005664A1 - Image encoding/decoding method and recording medium for storing bitstream - Google Patents

Image encoding/decoding method and recording medium for storing bitstream Download PDF

Info

Publication number
WO2025005664A1
WO2025005664A1 PCT/KR2024/008916 KR2024008916W WO2025005664A1 WO 2025005664 A1 WO2025005664 A1 WO 2025005664A1 KR 2024008916 W KR2024008916 W KR 2024008916W WO 2025005664 A1 WO2025005664 A1 WO 2025005664A1
Authority
WO
WIPO (PCT)
Prior art keywords
block
prediction
motion vector
picture
luma
Prior art date
Application number
PCT/KR2024/008916
Other languages
French (fr)
Korean (ko)
Inventor
임성원
Original Assignee
주식회사 케이티
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from KR1020240082641A external-priority patent/KR20250000891A/en
Application filed by 주식회사 케이티 filed Critical 주식회사 케이티
Publication of WO2025005664A1 publication Critical patent/WO2025005664A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • H04N19/105Selection of the reference unit for prediction within a chosen coding or prediction mode, e.g. adaptive choice of position and number of pixels used for prediction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/132Sampling, masking or truncation of coding units, e.g. adaptive resampling, frame skipping, frame interpolation or high-frequency transform coefficient masking
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/186Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a colour or a chrominance component
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/577Motion compensation with bidirectional frame interpolation, i.e. using B-pictures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/70Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by syntax aspects related to video coding, e.g. related to compression standards

Definitions

  • the present disclosure relates to a method and device for processing a video signal.
  • HD High Definition
  • UHD Ultra High Definition
  • inter-picture prediction technology that predicts pixel values included in the current picture from pictures before or after the current picture
  • intra-picture prediction technology that predicts pixel values included in the current picture using pixel information in the current picture
  • entropy coding technology that assigns short codes to values with high frequency of appearance and long codes to values with low frequency of appearance, etc.
  • the present disclosure aims to provide a method for predicting a chroma block through color component-specific prediction even when a luma block is encoded with inter prediction, and a device therefor.
  • the present disclosure aims to provide a method for deriving prediction parameters based on previously restored luma reference blocks and chroma reference blocks and a device therefor.
  • a video decoding method may include a step of deriving a first reference block of a luma block that is in the same position as a chroma block; a step of deriving a second reference block of the chroma block; a step of deriving a prediction parameter based on the first reference block and the second reference block; and a step of applying the prediction parameter to the luma block to obtain a prediction block for the chroma block.
  • a video encoding method may include a step of deriving a first reference block of a luma block that is in the same position as a chroma block; a step of deriving a second reference block of the chroma block; a step of deriving a prediction parameter based on the first reference block and the second reference block; and a step of applying the prediction parameter to the luma block to obtain a prediction block for the chroma block.
  • the first reference block when bidirectional prediction is applied to the luma block, the first reference block may be obtained by weighting the L0 reference block and the L1 reference block of the luma block, and the second reference block may be obtained by weighting the L0 reference block and the L1 reference block of the chroma block.
  • the first reference block and the second reference block can be determined based on the POC (Picture Order Count) of the L0 reference picture and the L1 reference picture of the luma block.
  • each of the first reference block and the second reference block may represent an L0 reference block of the luma block and an L0 reference block of the chroma block
  • each of the first reference block and the second reference block may represent an L1 reference block of the luma block and an L1 reference block of the chroma block.
  • the first reference block may be obtained by weighting the L0 reference block and the L1 reference block of the luma block
  • the second reference block may be obtained by weighting the L0 reference block and the L1 reference block of the chroma block.
  • the first reference block and the second reference block are derived from at least one of a reference picture in the L0 direction or a reference picture in the L1 direction, and at least one of the L0 direction and the L1 direction can be selected based on prediction direction information decoded from a bitstream.
  • the prediction parameters may include weights and offsets.
  • the prediction sample of the chroma block can be derived by adding the offset to the result of multiplying the restoration sample corresponding to the position of the prediction sample in the luma block by the weight.
  • the prediction parameter may include filter coefficients for a convolutional filter.
  • the prediction sample of the chroma block can be derived by inputting a restoration sample corresponding to a position of the prediction sample in the luma block and at least one neighboring sample adjacent to the restoration sample into the convolution filter.
  • the type of the prediction parameter is determined as one of a plurality of prediction parameter type candidates, and the plurality of prediction parameter type candidates may include a first prediction parameter candidate including a weight and an offset and a second prediction parameter candidate including filter coefficients of a convolution filter.
  • the first reference block when the within-screen block copy mode is applied to the luma block, the first reference block may be derived from a current luma picture including the luma block, and the second reference block may be derived from a current chroma picture including the chroma block.
  • the prediction parameter can be derived for each sub-block within the chroma block.
  • a computer-readable recording medium storing a bitstream generated by an image encoding method can be provided.
  • signaling overhead can be reduced by deriving prediction parameters based on previously restored luma reference blocks and chroma reference blocks.
  • FIG. 1 is a block diagram illustrating an image encoding device according to an embodiment of the present disclosure.
  • FIG. 2 is a block diagram illustrating an image decoding device according to an embodiment of the present disclosure.
  • Figure 3 is a diagram schematically illustrating the process of performing inter prediction in an encoder and decoder.
  • Figure 4 shows an example in which motion estimation is performed.
  • Figures 5 and 6 illustrate examples in which a prediction block of a current block is generated based on motion information generated through motion estimation.
  • Figure 7 shows the locations referenced to derive motion vector prediction values.
  • Figure 8 is a diagram for explaining a template-based motion estimation method.
  • Figure 9 shows examples of template configurations.
  • Figure 10 is a diagram for explaining a motion estimation method based on a bilateral matching method.
  • Figure 11 is a diagram for explaining a motion estimation method based on a one-way matching method.
  • Figures 12 and 13 illustrate examples in which prediction blocks are generated according to the precision of a motion vector.
  • Figure 14 shows an example in which motion compensation based on the translational model and the zooming model is performed for the current block.
  • Figure 15 shows an example in which motion compensation based on translational models and rotational models is performed for the current block.
  • Figures 16 and 17 show examples of generating a prediction block for a current block using control point motion vectors.
  • Figure 18 shows an example of generating a prediction block for the current block using three control point motion vectors.
  • Figure 19 shows an example in which a motion vector is derived in sub-block units.
  • Figures 20 and 21 illustrate examples in which motion vectors are derived for each sub-block within the current block when SbTMVP is applied.
  • Figures 22 and 23 are diagrams showing examples in which prediction blocks are derived according to motion vector precision.
  • Figures 24 and 25 are diagrams for explaining the process of encoding and decoding a motion vector difference value, respectively, when the AMVR method is applied.
  • Figure 26 shows a flow chart of a color component prediction method based on prediction parameters.
  • Figures 27 and 28 illustrate the operation of the encoder/decoder according to a color component prediction method based on prediction parameters.
  • Figure 29 illustrates an example of predicting a chroma block by selecting one of multiple prediction parameter candidates.
  • Figure 30 shows an example of deriving prediction parameters for color difference components.
  • Figure 31 shows the sub-sampled locations.
  • Figure 32 shows an example of deriving prediction parameters using a convolution filter.
  • Figure 33 shows the form of a convolution filter.
  • Figure 34 is a diagram for explaining an example in which a color component discrimination prediction method based on prediction parameters is performed on a sub-block basis.
  • first, second, etc. may be used to describe various components, but the components should not be limited by the terms. The terms are only used to distinguish one component from another.
  • the first component could be referred to as the second component, and similarly, the second component could also be referred to as the first component.
  • the term and/or includes any combination of a plurality of related described items or any item among a plurality of related described items.
  • FIG. 1 is a block diagram illustrating an image encoding device according to an embodiment of the present disclosure.
  • a video encoding device may include a picture segmentation unit (110), a prediction unit (120, 125), a transformation unit (130), a quantization unit (135), a reordering unit (160), an entropy encoding unit (165), an inverse quantization unit (140), an inverse transformation unit (145), a filter unit (150), and a memory (155).
  • each component shown in FIG. 1 is independently illustrated to indicate different characteristic functions in the image encoding device, and does not mean that each component is composed of separate hardware or a single software configuration unit. That is, each component is listed and included as a separate component for convenience of explanation, and at least two components among each component may be combined to form a single component, or one component may be divided into multiple components to perform a function, and such integrated and separated embodiments of each component are also included in the scope of the present disclosure as long as they do not deviate from the essence of the present disclosure.
  • some components may not be essential components that perform essential functions in the present disclosure, but may be optional components that are merely used to improve performance.
  • the present disclosure may be implemented by including only essential components for implementing the essence of the present disclosure, excluding components that are merely used to improve performance, and a structure that includes only essential components, excluding optional components that are merely used to improve performance, is also included in the scope of the present disclosure.
  • the picture splitting unit (110) can split an input picture into at least one processing unit.
  • the processing unit may be a prediction unit (PU), a transform unit (TU), or a coding unit (CU).
  • the picture splitting unit (110) can split one picture into a combination of multiple coding units, prediction units, and transform units, and select one combination of coding units, prediction units, and transform units based on a predetermined criterion (e.g., a cost function) to encode the picture.
  • a predetermined criterion e.g., a cost function
  • a picture can be split into multiple coding units.
  • a recursive tree structure such as a quad tree, a ternary tree, or a binary tree can be used.
  • a coding unit that is split into other coding units with one image or the largest coding unit as the root can be split with as many child nodes as the number of split coding units.
  • a coding unit that cannot be split any further according to a certain restriction becomes a leaf node. For example, assuming that a quad tree split is applied to a coding unit, a coding unit can be split into at most four different coding units.
  • the encoding unit may be used to mean a unit that performs encoding, or may be used to mean a unit that performs decoding.
  • a prediction unit may be divided into at least one square or rectangular shape of the same size within one coding unit, or may be divided such that one prediction unit among the divided prediction units within one coding unit has a different shape and/or size from another prediction unit.
  • the transformation unit and the prediction unit can be set to be the same.
  • the encoding unit can be divided into multiple transformation units, and then intra-screen prediction can be performed for each transformation unit.
  • the encoding unit can be divided in the horizontal direction or the vertical direction.
  • the number of transformation units generated by dividing the encoding unit can be 2 or 4, depending on the size of the encoding unit.
  • the prediction unit (120, 125) may include an inter-prediction unit (120) that performs inter-prediction and an intra-prediction unit (125) that performs intra-prediction. It may be determined whether to use inter-prediction or intra-prediction for an encoding unit, and specific information (e.g., intra-prediction mode, motion vector, reference picture, etc.) according to each prediction method may be determined. At this time, the processing unit where the prediction is performed and the processing unit where the prediction method and specific contents are determined may be different. For example, the prediction method and prediction mode, etc. are determined in the encoding unit, and the prediction may be performed in the prediction unit or the transformation unit.
  • specific information e.g., intra-prediction mode, motion vector, reference picture, etc.
  • the residual value (residual block) between the generated prediction block and the original block may be input to the transformation unit (130).
  • the prediction mode information, motion vector information, etc. used for the prediction may be encoded together with the residual value in the entropy encoding unit (165) and transmitted to the decoding device.
  • the inter-screen prediction unit (120) may predict a prediction unit based on information of at least one picture among the previous picture or the subsequent picture of the current picture, and in some cases, may predict a prediction unit based on information of a part of an encoded region within the current picture.
  • the inter-screen prediction unit (120) may include a reference picture interpolation unit, a motion prediction unit, and a motion compensation unit.
  • the reference picture interpolation unit can receive reference picture information from the memory (155) and generate pixel information below an integer pixel from the reference picture.
  • a DCT-based 8-tap interpolation filter (DCT-based Interpolation Filter) with different filter coefficients can be used to generate pixel information below an integer pixel in units of 1/4 pixels.
  • a DCT-based 4-tap interpolation filter (DCT-based Interpolation Filter) with different filter coefficients can be used to generate pixel information below an integer pixel in units of 1/8 pixels.
  • the prediction unit (125) within the screen can generate a prediction block based on reference pixel information, which is pixel information within the current picture.
  • the reference pixel information can be derived from one selected from among a plurality of reference pixel lines.
  • the Nth reference pixel line among the plurality of reference pixel lines can include left pixels having an x-axis difference of N from the upper left pixel within the current block and upper pixels having a y-axis difference of N from the upper left pixel.
  • the number of reference pixel lines that the current block can select can be 1, 2, 3, or 4.
  • the surrounding blocks of the current prediction unit are blocks that have performed inter-screen prediction and the reference pixel is a pixel that has performed inter-screen prediction
  • the reference pixel included in the block that has performed inter-screen prediction can be replaced and used with reference pixel information of the surrounding blocks that have performed intra-screen prediction. That is, if the reference pixel is unavailable, the unavailable reference pixel information can be replaced and used with information on at least one of the available reference pixels.
  • intra-screen prediction for the prediction unit can be performed based on the pixels on the left side of the prediction unit, the pixels on the upper left side, and the pixels on the top.
  • the on-screen prediction method can generate a prediction block after applying a smoothing filter to reference pixels according to the prediction mode. Depending on the selected reference pixel line, whether or not to apply the smoothing filter can be determined.
  • the intra-screen prediction mode of the current prediction unit can be predicted from the intra-screen prediction modes of prediction units existing in the vicinity of the current prediction unit.
  • the prediction mode of the current prediction unit is predicted using mode information predicted from the surrounding prediction units, if the intra-screen prediction modes of the current prediction unit and the surrounding prediction units are the same, information indicating that the prediction modes of the current prediction unit and the surrounding prediction units are the same can be transmitted using predetermined flag information, and if the prediction modes of the current prediction unit and the surrounding prediction units are different, entropy encoding can be performed to encode the prediction mode information of the current block.
  • a residual block including residual value information which is a difference value between the prediction unit that performed the prediction and the original block of the prediction unit based on the prediction unit generated in the prediction unit (120, 125), can be generated.
  • the generated residual block can be input to the transformation unit (130).
  • the residual block including the residual value information of the prediction unit generated through the original block and the prediction unit (120, 125) can be transformed using a transformation method such as DCT (Discrete Cosine Transform), DST (Discrete Sine Transform), or KLT. Whether to apply DCT, DST, or KLT to transform the residual block can be determined based on at least one of the size of the transformation unit, the shape of the transformation unit, the prediction mode of the prediction unit, or the prediction mode information within the screen of the prediction unit.
  • DCT Discrete Cosine Transform
  • DST Discrete Sine Transform
  • KLT Discrete Sine Transform
  • the quantization unit (135) can quantize the values converted to the frequency domain in the transformation unit (130).
  • the quantization coefficients can vary depending on the block or the importance of the image.
  • the values produced by the quantization unit (135) can be provided to the dequantization unit (140) and the reordering unit (160).
  • the rearrangement unit (160) can perform rearrangement of coefficient values for quantized residual values.
  • the rearrangement unit (160) can change a two-dimensional block-shaped coefficient into a one-dimensional vector form through a coefficient scanning method.
  • the rearrangement unit (160) can change the two-dimensional block-shaped coefficient into a one-dimensional vector form by scanning from the DC coefficient to the coefficient of the high-frequency region using a zig-zag scan method.
  • a vertical scan that scans the two-dimensional block-shaped coefficient in the column direction, a horizontal scan that scans the two-dimensional block-shaped coefficient in the row direction, or a diagonal scan that scans the two-dimensional block-shaped coefficient in the diagonal direction may be used instead of the zig-zag scan. That is, depending on the size of the conversion unit and the prediction mode within the screen, it is possible to determine which scan method among the zig-zag scan, the vertical scan, the horizontal scan, or the diagonal scan is used.
  • the entropy encoding unit (165) can perform entropy encoding based on the values produced by the rearrangement unit (160). Entropy encoding can use various encoding methods such as, for example, Exponential Golomb, CAVLC (Context-Adaptive Variable Length Coding), and CABAC (Context-Adaptive Binary Arithmetic Coding).
  • the entropy encoding unit (165) can encode various information such as residual value coefficient information of an encoding unit, block type information, prediction mode information, division unit information, prediction unit information, transmission unit information, motion vector information, reference frame information, block interpolation information, and filtering information from the rearrangement unit (160) and the prediction unit (120, 125).
  • the entropy encoding unit (165) can entropy encode the coefficient values of the encoding unit input from the rearrangement unit (160).
  • the values quantized in the quantization unit (135) are inversely quantized and the values transformed in the transformation unit (130) are inversely transformed.
  • the residual values generated in the inverse quantization unit (140) and the inverse transformation unit (145) can be combined with the predicted prediction units predicted through the motion estimation unit, motion compensation unit, and intra-screen prediction unit included in the prediction unit (120, 125) to generate a reconstructed block.
  • the filter unit (150) may include at least one of a deblocking filter, an offset correction unit, and an ALF (Adaptive Loop Filter).
  • a deblocking filter may include at least one of a deblocking filter, an offset correction unit, and an ALF (Adaptive Loop Filter).
  • ALF Adaptive Loop Filter
  • a deblocking filter can remove block distortion caused by boundaries between blocks in a restored picture.
  • a strong filter or a weak filter can be applied depending on the required deblocking filtering strength.
  • horizontal filtering and vertical filtering can be processed in parallel when performing vertical filtering and horizontal filtering.
  • the offset correction unit can correct the offset from the original image on a pixel basis for the image on which deblocking has been performed.
  • a method can be used in which the pixels included in the image are divided into a certain number of regions, the regions to be offset are determined, and the offset is applied to the regions, or a method can be used in which the offset is applied by considering the edge information of each pixel.
  • Adaptive Loop Filtering can be performed based on the value compared between the filtered restored image and the original image. After dividing the pixels included in the image into a predetermined group, one filter to be applied to the group is determined, and filtering can be performed differentially for each group. Information related to whether to apply ALF can be transmitted by luminance signal for each coding unit (CU), and the shape and filter coefficient of the ALF filter to be applied can be different for each block. In addition, the same shape (fixed shape) of the ALF filter can be applied regardless of the characteristics of the target block.
  • ALF Adaptive Loop Filtering
  • the memory (155) can store a restored block or picture produced through the filter unit (150), and the stored restored block or picture can be provided to the prediction unit (120, 125) when performing inter-screen prediction.
  • FIG. 2 is a block diagram illustrating an image decoding device according to an embodiment of the present disclosure.
  • the image decoding device (200) may include an entropy decoding unit (210), a reordering unit (215), an inverse quantization unit (220), an inverse transformation unit (225), a prediction unit (230, 235), a filter unit (240), and a memory (245).
  • the entropy decoding unit (210) can perform entropy decoding in a procedure opposite to that of performing entropy encoding in the entropy encoding unit of the video encoding device.
  • various methods such as Exponential Golomb, CAVLC (Context-Adaptive Variable Length Coding), and CABAC (Context-Adaptive Binary Arithmetic Coding) can be applied in response to the method performed in the video encoding device.
  • the entropy decoding unit (210) can decode information related to intra-screen prediction and inter-screen prediction performed in the encoding device.
  • the inverse quantization unit (220) can perform inverse quantization based on the quantization parameters provided from the encoding device and the coefficient values of the rearranged block.
  • the inverse transform unit (225) can perform inverse transform, i.e., inverse DCT, inverse DST, and inverse KLT, on the transforms performed by the transform unit, i.e., DCT, DST, and KLT, on the quantization result performed by the image encoding device.
  • the inverse transform can be performed based on the transmission unit determined by the image encoding device.
  • a transform technique e.g., DCT, DST, KLT
  • a transform technique can be selectively performed according to a plurality of pieces of information, such as a prediction method, the size and shape of the current block, the prediction mode, and the prediction direction within the screen.
  • the prediction unit (230, 235) can generate a prediction block based on prediction block generation related information provided from the entropy decoding unit (210) and previously decoded block or picture information provided from the memory (245).
  • intra-screen prediction for the prediction unit is performed based on the pixels on the left side of the prediction unit, the pixels on the upper left side, and the pixels on the upper side.
  • intra-screen prediction can be performed using reference pixels based on the transformation unit.
  • intra-screen prediction using NxN division only for the minimum coding unit can be used.
  • the prediction unit (230, 235) may include a prediction unit determination unit, an inter-screen prediction unit, and an intra-screen prediction unit.
  • the prediction unit determination unit may receive various information such as prediction unit information input from the entropy decoding unit (210), prediction mode information of an intra-screen prediction method, and motion prediction-related information of an inter-screen prediction method, and may distinguish a prediction unit from a current encoding unit and determine whether the prediction unit performs inter-screen prediction or intra-screen prediction.
  • the inter-screen prediction unit (230) may perform inter-screen prediction for the current prediction unit based on information included in at least one picture among a previous picture or a subsequent picture of the current picture including the current prediction unit by using information necessary for inter-screen prediction of the current prediction unit provided by the video encoding device. Alternatively, inter-screen prediction may be performed based on information of a pre-restored portion of the current picture including the current prediction unit.
  • the motion prediction method of the prediction unit included in the encoding unit is Skip Mode, Merge Mode, AMVP Mode, or Intra-screen Block Copy Mode based on the encoding unit.
  • the intra-screen prediction unit (235) can generate a prediction block based on pixel information within the current picture. If the prediction unit is a prediction unit that has performed intra-screen prediction, the intra-screen prediction can be performed based on intra-screen prediction mode information of the prediction unit provided by the image encoding device.
  • the intra-screen prediction unit (235) can include an AIS (Adaptive Intra Smoothing) filter, a reference pixel interpolation unit, and a DC filter.
  • the AIS filter is a part that performs filtering on the reference pixels of the current block, and can determine whether to apply the filter and apply it according to the prediction mode of the current prediction unit.
  • the AIS filter can be performed on the reference pixels of the current block using the prediction mode and AIS filter information of the prediction unit provided by the image encoding device. If the prediction mode of the current block is a mode that does not perform AIS filtering, the AIS filter may not be applied.
  • the reference pixel interpolation unit can generate a reference pixel of a pixel unit less than an integer value by interpolating the reference pixel when the prediction mode of the prediction unit is a prediction unit that performs prediction within the screen based on the pixel value interpolated with the reference pixel.
  • the prediction mode of the current prediction unit is a prediction mode that generates a prediction block without interpolating the reference pixel
  • the reference pixel may not be interpolated.
  • the DC filter can generate a prediction block through filtering when the prediction mode of the current block is the DC mode.
  • the restored block or picture may be provided to a filter unit (240).
  • the filter unit (240) may include a deblocking filter, an offset correction unit, and an ALF.
  • a deblocking filter of a video decoding device can receive information related to a deblocking filter provided from a video encoding device and perform deblocking filtering on a corresponding block in the video decoding device.
  • the offset correction unit can perform offset correction on the restored image based on information such as the type of offset correction applied to the image during encoding and the offset value.
  • ALF can be applied to an encoding unit based on ALF application information provided from an encoding device, ALF coefficient information, etc. This ALF information can be provided by being included in a specific parameter set.
  • the memory (245) can store a restored picture or block so that it can be used as a reference picture or reference block, and can also provide the restored picture to an output unit.
  • the term coding unit is used as an encoding unit, but it may also be a unit that performs not only encoding but also decoding.
  • the current block represents a block to be encoded/decoded, and may represent a coding tree block (or coding tree unit), an encoding block (or encoding unit), a transform block (or transform unit), a prediction block (or prediction unit), or a block to which an in-loop filter is applied, depending on the encoding/decoding step.
  • a 'unit' represents a basic unit for performing a specific encoding/decoding process
  • a 'block' may represent a pixel array of a predetermined size.
  • 'block' and 'unit' may be used with the same meaning.
  • an encoding block (coding block) and an encoding unit (coding unit) may be understood to have the same meaning.
  • Inter prediction can be performed on a block-by-block basis.
  • a prediction block of the current block can be generated from a reference picture using the motion information of the current block.
  • the motion information can include at least one of a motion vector, a reference picture index, and a prediction direction.
  • Figure 3 is a diagram schematically illustrating the process of performing inter prediction in an encoder and decoder.
  • motion information for the current block can be obtained (S310).
  • the motion information can include at least one of a motion vector, a reference picture index, or a weight applied to the prediction block.
  • motion information for at least one of the L0 direction or the L1 direction can be obtained.
  • motion information of the current block can be derived through motion estimation, and the derived motion information can be encoded and signaled to the decoder.
  • encoding/decoding of motion information can be based on a motion information merging mode, a motion vector prediction mode, a motion estimation method based on a template, or a bilateral matching method, which will be described later.
  • motion information of the current block can be derived based on the information transmitted from the encoder.
  • the motion information of the current block can be derived from the decoder in the same way as from the encoder. This method can be called decoder-side motion estimation.
  • a prediction block for the current block can be obtained based on the derived motion information (S320). For example, a reference block spaced apart by a motion vector from the position of the current block in the reference picture can be set as the prediction block of the current block.
  • the motion information of the current block can be generated through motion estimation.
  • Figure 4 shows an example in which motion estimation is performed.
  • a search range for motion estimation can be set from the same position as the reference point of the current block in the reference picture.
  • the reference point can be the position of the upper left sample of the current block.
  • a rectangle of sizes (w0+w01) and (h0+h1) is set as a search range centered on a reference point.
  • w0, w1, h0, and h1 may have the same values.
  • at least one of w0, w1, h0, and h1 may be set to have a different value from the other.
  • the sizes of w0, w1, h0, and h1 may be determined so as not to exceed a Coding Tree Unit (CTU) boundary, a slice boundary, a tile boundary, or a picture boundary.
  • CTU Coding Tree Unit
  • reference blocks having the same size as the current block can be set, and then the cost for each reference block with respect to the current block can be measured.
  • the cost can be calculated using the similarity between the two blocks.
  • the cost can be calculated based on the absolute sum of the differences between the original samples in the current block and the original samples (or reconstructed samples) in the reference block. The smaller the absolute sum, the lower the cost.
  • the cost of each reference block is compared, and the reference block with the optimal cost can be set as the prediction block of the current block.
  • the distance between the current block and the reference block can be set as a motion vector.
  • the x-coordinate difference and the y-coordinate difference between the current block and the reference block can be set as the motion vector.
  • the index of the picture containing the reference block identified through motion estimation is set as the reference picture index.
  • the prediction direction can be set based on whether the reference picture belongs to the L0 reference picture list or the L1 reference picture list.
  • motion estimation can be performed for each of the L0 direction and the L1 direction. If prediction is performed for both the L0 direction and the L1 direction, motion information in the L0 direction and motion information in the L1 direction can be generated, respectively.
  • Figures 5 and 6 illustrate examples in which a prediction block of a current block is generated based on motion information generated through motion estimation.
  • Figure 5 shows an example of generating a prediction block by unidirectional (i.e., L0 direction) prediction
  • Figure 6 shows an example of generating a prediction block by bidirectional (i.e., L0 and L1 direction) prediction.
  • a prediction block of the current block is generated using one motion information.
  • the motion information may include an L0 motion vector, an L0 reference picture index, and prediction direction information pointing to the L0 direction.
  • two pieces of motion information are used to generate a prediction block.
  • a reference block in the L0 direction specified based on motion information for the L0 direction (L0 motion information) can be set as an L0 prediction block
  • a reference block in the L1 direction specified based on motion information for the L1 direction (L1 motion information) can be generated as an L1 prediction block.
  • the L0 prediction block and the L1 prediction block can be weighted and combined to generate a prediction block of the current block.
  • the L0 reference picture is illustrated as existing in the previous direction of the current picture (i.e., having a POC value smaller than that of the current picture), and the L1 reference picture is illustrated as existing in the subsequent direction of the current picture (i.e., having a POC value larger than that of the current picture).
  • the L0 reference picture may exist in the subsequent direction of the current picture, or the L1 reference picture may exist in the previous direction of the current picture.
  • both the L0 reference picture and the L1 reference picture may exist in the previous direction of the current picture, or both may exist in the subsequent direction of the current picture.
  • bidirectional prediction may be performed using the L0 reference picture existing in the subsequent direction of the current picture and the L1 reference picture existing in the previous direction of the current picture.
  • the motion information of the block on which inter prediction is performed can be stored in memory.
  • the motion information can be stored in units of samples.
  • the motion information of the block to which a specific sample belongs can be stored as the motion information of the specific sample.
  • the stored motion information can be used to derive the motion information of the neighboring block to be encoded/decoded in the future.
  • information encoding a residual sample corresponding to a difference between a sample of a current block (i.e., an original sample) and a prediction sample, and motion information required to generate a prediction block can be signaled to the decoder.
  • information about the signaled difference can be decoded to derive a difference sample, and a prediction sample in a prediction block generated using motion information can be added to the difference sample to generate a reconstructed sample.
  • one of a plurality of inter prediction modes may be selected.
  • the plurality of inter prediction modes may include a motion information merging mode and a motion vector prediction mode.
  • the motion vector prediction mode is a mode that signals by encoding the difference between a motion vector and a motion vector prediction value.
  • the motion vector prediction value can be derived based on motion information of a neighboring block or neighboring sample adjacent to the current block.
  • Figure 7 shows the locations referenced to derive motion vector prediction values.
  • the current block is assumed to have a size of 4x4.
  • 'LB' represents a sample included in the leftmost column and the bottommost row in the current block.
  • 'RT' represents a sample included in the rightmost column and the topmost row in the current block.
  • A0 to A4 represent samples neighboring to the left of the current block, and B0 to B5 represent samples neighboring to the top of the current block.
  • A1 represents a sample neighboring to the left of LB, and B1 represents a sample neighboring to the top of RT.
  • Col indicates the location of a sample neighboring the lower right of the current block in a co-located picture.
  • a co-located picture is a picture different from the current picture, and information for specifying the co-located picture (e.g., a co-located picture index) can be explicitly encoded and signaled in the bitstream.
  • a reference picture having a predefined reference picture index can be set as the co-located picture.
  • the motion vector prediction value of the current block can be derived from at least one motion vector prediction candidate included in a motion vector prediction list.
  • the number of motion vector prediction candidates that can be inserted into the motion vector prediction list (i.e., the size of the list) may be predefined in the encoder and decoder.
  • the maximum number of motion vector prediction candidates may be 2.
  • a motion vector stored at the location of a neighboring sample adjacent to the current block or a scaled motion vector derived by scaling the motion vector can be inserted into the motion vector prediction list as a motion vector prediction candidate.
  • the neighboring samples adjacent to the current block can be scanned in a predefined order to derive the motion vector prediction candidate.
  • the first found available motion vector can be inserted into the motion vector prediction list as a motion vector prediction candidate.
  • the motion vector prediction candidate can be derived based on the available vector found first. Specifically, the available motion vector that is found first can be scaled, and then the scaled motion vector can be inserted as a motion vector prediction candidate into the motion vector prediction list.
  • the scaling can be performed based on the output order difference between the current picture and the reference picture (i.e., the POC difference) and the output order difference between the current picture and the reference picture of the neighboring sample (i.e., the POC difference).
  • the order of B0 to B5 it can be checked whether a motion vector is stored at each position. Then, according to the above scanning order, the first found available motion vector can be inserted into the motion vector prediction list as a motion vector prediction candidate.
  • the motion vector prediction candidate can be derived based on the available vector found first. Specifically, the available motion vector that is found first can be scaled, and then the scaled motion vector can be inserted as a motion vector prediction candidate into the motion vector prediction list.
  • the scaling can be performed based on the output order difference between the current picture and the reference picture (i.e., the POC difference) and the output order difference between the current picture and the reference picture of the neighboring sample (i.e., the POC difference).
  • a motion vector prediction candidate can be derived from a sample adjacent to the left of the current block, and a motion vector prediction candidate can be derived from a sample adjacent to the top of the current block.
  • the motion vector prediction candidate derived from the left sample may be inserted into the motion vector prediction list before the motion vector prediction candidate derived from the upper sample.
  • the index assigned to the motion vector prediction candidate derived from the left sample may have a smaller value than the motion vector prediction candidate derived from the upper sample.
  • the motion vector prediction candidates derived from the upper samples can also be inserted into the motion vector prediction list before the motion vector prediction candidates derived from the left samples.
  • a motion vector prediction candidate having the highest encoding efficiency can be set as a motion vector predictor (MVP) of a current block.
  • index information indicating a motion vector prediction candidate set as a motion vector predictor of a current block among a plurality of motion vector prediction candidates can be encoded and signaled to a decoder.
  • the index information can be a 1-bit flag (e.g., an MVP flag).
  • MVD motion vector difference
  • the decoder can construct a motion vector prediction list in the same manner as the encoder. In addition, it can decode index information from a bitstream and select one of a plurality of motion vector prediction candidates based on the decoded index information. The selected motion vector prediction candidate can be set as the motion vector prediction value of the current block.
  • the motion vector differential can be decoded from the bitstream. Afterwards, the motion vector prediction value and the motion vector differential value can be combined to derive the motion vector of the current block.
  • a motion vector prediction list can be generated for each of the L0 direction and the L1 direction. That is, the motion vector prediction list can be composed of motion vectors in the same direction. Accordingly, the motion vector of the current block and the motion vector prediction candidates included in the motion vector prediction list have the same direction.
  • reference picture index and prediction direction information can be explicitly encoded and signaled to the decoder.
  • a reference picture index for specifying a reference picture from which motion information of the current block is derived among the multiple reference pictures can be explicitly encoded and signaled to the decoder.
  • the reference picture list contains only one reference picture, encoding/decoding of the reference picture index may be omitted.
  • the prediction direction information may be an index pointing to one of L0 unidirectional prediction, L1 unidirectional prediction, or bidirectional prediction.
  • an L0 flag indicating whether prediction is performed in the L0 direction and an L1 flag indicating whether prediction is performed in the L1 direction may be encoded and signaled, respectively.
  • Motion information merge mode is a mode in which the motion information of the current block is set to be the same as the motion information of the neighboring block.
  • motion information can be encoded/decoded using the motion information merge list.
  • Motion information merging candidates can be derived based on motion information of neighboring blocks or neighboring samples adjacent to the current block. For example, after defining a location to be referenced around the current block, it can be checked whether motion information exists at the defined reference location. If motion information exists at the defined reference location, the motion information at that location can be inserted into the motion information merging list as a motion information merging candidate.
  • the predefined reference positions may include at least one of A0, A1, B0, B1, B5, and Col.
  • the motion information merging candidates may be derived in the order of A1, B1, B0, A0, B5, and Col.
  • the motion information of the motion information merging candidate with the optimal cost can be set as the motion information of the current block.
  • index information e.g., a merge index
  • the motion information merging candidate selected from among a plurality of motion information merging candidates can be encoded and transmitted to the decoder.
  • a motion information merge list can be constructed in the same manner as in the encoder. Then, a motion information merge candidate can be selected based on a merge index decoded from a bitstream. The motion information of the selected motion information merge candidate can be set as the motion information of the current block.
  • the motion information merge list is composed of a single list regardless of the prediction direction. That is, the motion information merge candidates included in the motion information merge list may have only L0 motion information or L1 motion information, or may have bidirectional motion information (i.e., L0 motion information and L1 motion information).
  • the motion information of the current block can also be derived by using the restoration sample area around the current block.
  • the restoration sample area used to derive the motion information of the current block can also be called a template.
  • Figure 8 is a diagram for explaining a template-based motion estimation method.
  • the prediction block of the current block is determined based on the cost between the current block and the reference block within the search range.
  • motion estimation for the current block can be performed based on the cost between the template neighboring the current block (hereinafter referred to as the current template) and the reference template having the same size and shape as the current template.
  • the cost can be calculated based on the absolute sum of the differences between the restored samples in the current template and the restored samples in the reference block. The smaller the absolute sum, the lower the cost.
  • the reference block neighboring the reference template can be set as the predicted block of the current block.
  • the motion information of the current block can be set.
  • the decoder itself can perform motion estimation in the same manner as the encoder. Accordingly, when deriving motion information using a template, there is no need to encode and signal the motion information other than information indicating whether or not the template is used.
  • the current template may include at least one of an area adjacent to the top of the current block or an area adjacent to the left of the current block, wherein the area adjacent to the top may include at least one row, and the area adjacent to the left may include at least one column.
  • Figure 9 shows examples of template configurations.
  • the current template can be constructed following one of the examples illustrated in FIG. 9.
  • the template may be composed of only the area adjacent to the left of the current block, or only the area adjacent to the top of the current block.
  • the size and/or shape of the current template may be predefined in the encoder and decoder.
  • one of the multiple template candidates may be adaptively selected based on at least one of the size, shape, or position of the current block. For example, if the current block is adjacent to the upper boundary of the CTU, the current template may be composed of only the region adjacent to the left of the current block.
  • Motion estimation based on a template can be performed on each of the reference pictures stored in the reference picture list. Alternatively, motion estimation can be performed on only some of the reference pictures. For example, motion estimation can be performed only on reference pictures having a reference picture index of 0, or motion estimation can be performed only on reference pictures having a reference picture index smaller than a threshold or reference pictures having a POC difference from the current picture smaller than a threshold.
  • the reference picture index can be explicitly encoded and signaled, and then motion estimation can be performed only for the reference picture pointed to by the reference picture index.
  • motion estimation can be performed targeting reference pictures of neighboring blocks corresponding to the current template. For example, if the template is composed of a left neighboring region and an upper neighboring region, at least one reference picture can be selected using at least one of the reference picture index of the left neighboring block or the reference picture index of the upper neighboring block. Thereafter, motion estimation can be performed targeting at least one selected reference picture.
  • Information indicating whether motion estimation based on template is applied can be encoded and signaled to a decoder.
  • the information can be a 1-bit flag. For example, if the flag is true (1), it indicates that motion estimation based on template is applied in the L0 direction and the L1 direction of the current block. On the other hand, if the flag is false (0), it indicates that motion estimation based on template is not applied. In this case, motion information of the current block can be derived based on the motion information merging mode or the motion vector prediction mode.
  • template-based motion estimation can be applied only when it is determined that neither the motion information merging mode nor the motion vector prediction mode is applied to the current block. For example, when the first flag indicating whether the motion information merging mode is applied and the second flag indicating whether the motion vector prediction mode is applied are both 0, template-based motion estimation can be performed.
  • template-based motion estimation can be applied to one of the L0 direction and the L1 direction, while another mode (e.g., motion information merging mode or motion vector prediction mode) can be applied to the other.
  • another mode e.g., motion information merging mode or motion vector prediction mode
  • the prediction block of the current block can be generated based on a weighted sum operation of the L0 prediction block and the L1 prediction block.
  • the prediction block of the current block can be generated based on a weighted sum operation of the L0 prediction block and the L1 prediction block.
  • a motion estimation method based on a template may be inserted as a motion information merging candidate in a motion information merging mode or a motion vector prediction candidate in a motion vector prediction mode.
  • whether or not to apply a motion estimation method based on a template may be determined based on whether the selected motion information merging candidate or the selected motion vector prediction candidate indicates a motion estimation method based on a template.
  • Figure 10 is a diagram for explaining a motion estimation method based on a bilateral matching method.
  • the bilateral matching method can be performed only when the temporal order (i.e., POC) of the current picture exists between the temporal order of the L0 reference picture and the temporal order of the L1 reference picture.
  • POC temporal order
  • a search range can be set for each of the L0 reference picture and the L1 reference picture.
  • an L0 reference picture index for identifying the L0 reference picture and an L1 reference picture index for identifying the L1 reference picture can be encoded and signaled, respectively.
  • only the L0 reference picture index may be encoded and signaled, and an L1 reference picture may be selected based on a distance between the current picture and the L0 reference picture (hereinafter referred to as the L0 POC difference).
  • the L0 POC difference an L1 reference picture included in an L1 reference picture list, of which an absolute value of the distance from the current picture (hereinafter referred to as the L1 POC difference) is equal to the absolute value of the distance between the current picture and the L0 reference picture, may be selected. If there is no L1 reference picture having an L1 POC difference equal to the L0 POC difference, an L1 reference picture whose L1 POC difference is most similar to the L0 POC difference may be selected among the L1 reference pictures.
  • the L1 reference pictures only the L1 reference pictures that have different temporal directions from the L0 reference pictures can be used for bilateral matching. For example, if the POC of the L0 reference picture is smaller than that of the current picture, one of the L1 reference pictures that has a larger POC than that of the current picture can be selected.
  • a bilateral matching method may be performed using the L0 reference picture having the closest distance to the current picture among the L0 reference pictures and the L1 reference picture having the closest distance to the current picture among the L1 reference pictures.
  • a bilateral matching method may be performed using an L0 reference picture (e.g., index 0) assigned with a predefined index in the L0 reference picture list and an L1 reference picture (e.g., index 0) assigned with a predefined index in the L1 reference picture list.
  • L0 reference picture e.g., index 0
  • L1 reference picture e.g., index 0
  • the LX (X is 0 or 1) reference picture is selected based on an explicitly signaled reference picture index, and the L
  • the L0 and/or L1 reference pictures can be selected based on the motion information of the neighboring blocks of the current block.
  • the L0 and/or L1 reference pictures to be used for bilateral matching can be selected using the reference picture index of the left or upper neighboring block of the current block.
  • the search range can be set within a predetermined range from a collocated block in a reference picture.
  • the search range can be set based on the initial motion information.
  • the initial motion information can be derived from the neighboring blocks of the current block.
  • the motion information of the left neighboring block or the upper neighboring block of the current block can be set as the initial motion information of the current block.
  • the L0 motion vector and the L1 direction motion vector are set to opposite directions. This indicates that the sign of the L0 motion vector and the L1 direction motion vector have opposite signs.
  • the size of the LX motion vector can be proportional to the distance between the current picture and the LX reference picture (i.e., the POC difference).
  • L0 reference block a reference block belonging to the search range of the L0 reference picture
  • L1 reference block a reference block belonging to the search range of the L1 reference picture
  • an L1 reference block located at a position (-Dx, -Dy) away from the current block can be selected.
  • D can be determined by the ratio of the distance between the current picture and the L0 reference picture and the distance between the L1 reference picture and the current picture.
  • the absolute value of the distance between the current picture (T) and the L0 reference picture (T-1) and the absolute value of the distance between the current picture (T) and the L1 reference picture (T+1) are equal to each other. Accordingly, in the illustrated example, the L0 motion vector (x0, y0) and the L1 motion vector (x1, y1) have equal magnitudes but opposite distances. If an L1 reference picture with POC of (T+2) were used, the L1 motion vector (x1, y1) would be set to (-2*x0, -2*y0).
  • the L0 reference block and the L1 reference block can be set as the L0 prediction block and the L1 prediction block of the current block, respectively. Thereafter, the final prediction block of the current block can be generated through a weighted sum operation of the L0 reference block and the L1 reference block.
  • the decoder can perform motion estimation in the same manner as the encoder. Accordingly, information indicating whether the bilateral motion matching method is applied can be explicitly encoded/decoded, while encoding/decoding of motion information such as a motion vector can be omitted. As described above, at least one of the L0 reference picture index or the L1 reference picture index can be explicitly encoded/decoded.
  • Information indicating whether the bilateral matching method is applied may be a 1-bit flag. For example, if the flag is true (e.g., 1), it may indicate that the bilateral matching method is applied to the current block. If the flag is false (e.g., 0), it may indicate that the bilateral matching method is not applied to the current block. In this case, the motion information merging mode or the motion vector prediction mode may be applied to the current block.
  • the bilateral matching method may be applied only when it is determined that neither the motion information merging mode nor the motion vector prediction mode is applied to the current block.
  • the bilateral matching method may be applied when both the first flag indicating whether the motion information merging mode is applied and the second flag indicating whether the motion vector prediction mode is applied are 0.
  • the bilateral matching method may be inserted as a motion information merging candidate in the motion information merging mode or a motion vector prediction candidate in the motion vector prediction mode.
  • whether the bilateral matching method is applied may be determined based on whether the selected motion information merging candidate or the selected motion vector prediction candidate indicates the bilateral matching method.
  • the temporal order of the current picture must exist between the temporal order of the L0 reference picture and the temporal order of the L1 reference picture.
  • a unidirectional matching method may also be applied to generate a prediction block of the current block.
  • two reference pictures having a temporal order i.e., POC
  • both reference pictures may be derived from the L0 reference picture list or the L1 reference picture list.
  • one of the two reference pictures may be derived from the L0 reference picture list and the other may be derived from the L1 reference picture list.
  • the one-way matching method can be performed based on two reference pictures having a POC smaller than that of the current picture (i.e., forward reference pictures) or two reference pictures having a POC larger than that of the current picture (i.e., backward reference pictures).
  • Fig. 11 it is illustrated that motion estimation based on the one-way matching method is performed based on a first reference picture (T-1) and a second reference picture (T-2) having a POC smaller than that of the current picture (T).
  • a first reference picture index for identifying the first reference picture and a second reference picture index for identifying the second reference picture may be encoded and signaled, respectively.
  • a reference picture having a smaller POC difference from the current picture among the two reference pictures used in the unidirectional matching method may be set as the first reference picture.
  • only reference pictures included in the reference picture list having a larger POC difference from the current picture than the first reference picture may be set as the second reference picture.
  • the second reference picture index may be set to point to an index of one of the rearranged reference pictures after rearranging reference pictures having the same temporal direction as the first reference picture and having a larger POC difference from the current picture than the first reference picture.
  • a reference picture having a larger POC difference from the current picture among the two reference pictures may be set as the first reference picture.
  • the second reference picture index may be set to point to an index of one of the rearranged reference pictures after rearranging the reference pictures having the same temporal direction as the first reference picture and having a smaller POC difference from the current picture than the first reference picture.
  • a one-way matching method may be performed using a reference picture to which a predefined index is assigned in the reference picture list and a reference picture having the same temporal direction as the reference picture.
  • a reference picture having an index of 0 in the reference picture list may be set as the first reference picture, and a reference picture having the smallest index among reference pictures having the same temporal direction as the first reference picture in the reference picture list may be selected as the second reference picture.
  • Both the first reference picture and the second reference picture can be selected from the L0 reference picture list or the L1 reference picture list.
  • two L0 reference pictures are illustrated as being used in the unidirectional matching method.
  • the first reference picture may be selected from the L0 reference picture list and the second reference picture may be selected from the L1 reference picture list.
  • Information indicating whether the first reference picture and/or the second reference picture belongs to the L0 reference picture list or the L1 reference picture list may be additionally encoded/decoded.
  • one-way matching can be performed using one of the L0 reference picture list and the L1 reference picture list, which is set as default.
  • two reference pictures can be selected from the L0 reference picture list and the L1 reference picture list, whichever has a larger number of reference pictures.
  • a search range within the first reference picture and the second reference picture can be set.
  • the search range can be set within a predetermined range from a collocated block in a reference picture.
  • the search range can be set based on the initial motion information.
  • the initial motion information can be derived from the neighboring blocks of the current block.
  • the motion information of the left neighboring block or the upper neighboring block of the current block can be set as the initial motion information of the current block.
  • the size of the motion vector should be set to increase in proportion to the distance between the current picture and the reference picture.
  • the second reference block should be spaced apart from the current block by (Dx, Dy).
  • D can be determined by the ratio of the distance between the current picture and the first reference picture and the distance between the current picture and the second reference picture.
  • the distance between the current picture and the first reference picture i.e., the POC difference
  • the distance between the current picture and the second reference picture i.e., the POC difference
  • the first motion vector for the first reference block in the first reference picture is (x0, y0)
  • the second motion vector (x1, y1) for the second reference block in the second reference picture can be set to (2x0, 2y0).
  • the first reference block and the second reference block having the optimal cost can be set as the first prediction block and the second prediction block of the current block, respectively. Thereafter, the final prediction block of the current block can be generated through a weighted sum operation of the first prediction block and the second prediction block.
  • the decoder can perform motion estimation in the same manner as the encoder. Accordingly, information indicating whether the unidirectional motion matching method is applied can be explicitly encoded/decoded, while encoding/decoding of motion information such as a motion vector can be omitted. As described above, at least one of the first reference picture index or the second reference picture index can be explicitly encoded/decoded.
  • information indicating whether a unidirectional matching method is applied may be explicitly encoded/decoded, and if the unidirectional matching method is applied, the first motion vector or the second motion vector may be explicitly encoded and signaled. If the first motion vector is signaled, the second motion vector may be derived based on the POC difference between the current picture and the first reference picture and the POC difference between the current picture and the second reference picture. If the second motion vector is signaled, the first motion vector may be derived based on the POC difference between the current picture and the first reference picture and the POC difference between the current picture and the second reference picture. In this case, the encoder may explicitly encode a smaller one of the first motion vector and the second motion vector.
  • Information indicating whether a one-way matching method is applied may be a 1-bit flag. For example, if the flag is true (e.g., 1), it may indicate that a one-way matching method is applied to the current block. If the flag is false (e.g., 0), it may indicate that a one-way matching method is not applied to the current block. In this case, a motion information merging mode or a motion vector prediction mode may be applied to the current block.
  • the one-way matching method may be applied only when it is determined that the motion information merging mode and the motion vector prediction mode are not applied to the current block.
  • the one-way matching method may be applied when the first flag indicating whether the motion information merging mode is applied and the second flag indicating whether the motion vector prediction mode is applied are both 0.
  • the unidirectional matching method may be inserted as a motion information merging candidate in the motion information merging mode or a motion vector prediction candidate in the motion vector prediction mode.
  • whether the unidirectional matching method is applied may be determined based on whether the selected motion information merging candidate or the selected motion vector prediction candidate indicates the unidirectional matching method.
  • the position of each pixel in a picture is specified as an integer.
  • the movement of an object between screens may not be expressed as an integer position.
  • Figures 12 and 13 illustrate examples in which prediction blocks are generated according to the precision of a motion vector.
  • Figure 12 shows the location of the current block within the current picture
  • Figure 13 shows an example in which a prediction block is obtained according to a motion vector.
  • FIG. 13 shows an example in which the motion vector precision is in integer pixel units
  • FIG. 13 shows an example in which the motion vector precision is in 1/2 pixel units and 1/4 pixel units, respectively.
  • the motion vector precision can also be set in smaller units than those shown.
  • the motion vector precision can be set in 1/8 pixel units, 1/16 pixel units, or 1/32 pixel units.
  • a reference block composed of integer position samples can be set as the prediction block of the current block, as in the example illustrated in (a) of Fig. 13.
  • a reference block composed of fractional position samples can be set as a prediction block of the current block.
  • the fractional position samples in the reference block can be generated by interpolating integer position samples.
  • the interpolation filter can have a size of 4 taps or 8 taps.
  • fractional position samples can be generated via linear interpolation using only integer position samples adjacent to the fractional position.
  • Information indicating the motion vector precision of the current block can be encoded and signaled. For example, after assigning a different index to each of a plurality of motion vector precision candidates, the index of the motion vector precision candidate corresponding to the motion vector precision of the current block can be encoded and signaled.
  • the number and/or types of available motion vector candidates can be determined based on at least one of the size of the current block, the shape of the current block, the reference picture, or the motion compensation model.
  • the motion compensation model can include at least one of a translation model, a zooming model, or a rotation model.
  • a motion compensation model in which at least one of a zooming model or a rotation model is combined with a translation model may be referred to as an affine model.
  • An index pointing to one of the available motion vector candidates for the current block may be encoded.
  • the maximum number of bits required to encode the index may be determined.
  • the motion vector By adjusting the precision of the motion vector, the motion vector can be searched more precisely, and thus the prediction accuracy for the current block can be improved.
  • motion vectors expressed in fractional positions can be scaled up to integers and encoded.
  • Compensation for the motion of the object may be performed based on at least one of a translational model for compensating for linear motion of the object (e.g., motion in the horizontal and/or vertical direction), a zooming model for compensating for change in size of the object, and a rotational model for compensating for rotational motion of the object.
  • zooming may represent size enlargement or size reduction.
  • Figure 14 shows an example in which motion compensation based on the translational model and the zooming model is performed for the current block.
  • the current block is assumed to have a size of 4x4, as illustrated in Fig. 12.
  • variable ⁇ represents a size adjustment parameter.
  • the size of the reference block can be derived by multiplying the size of the current block by the variable ⁇ .
  • a sizing parameter ⁇ less than 1 indicates that the reference block is smaller than the current block, and a sizing parameter ⁇ greater than 1 indicates that the reference block is larger than the current block.
  • Figures 14 (a) and (b) show examples when the size adjustment parameter ⁇ is less than 1, and Figure 14 (c) shows examples when the size adjustment parameter ⁇ is greater than 1.
  • the upper left position of the reference block can be specified. Specifically, a position spaced apart by the motion vector from a position corresponding to the upper left sample of the current block in the reference picture can be set as the upper left position of the reference block. Then, according to the size adjustment parameter, a reference block whose width and height are ⁇ times the width and height of the current block, respectively, can be set.
  • the fractional position samples in the reference block can be generated by interpolating the integer position samples.
  • a reference block derived by the motion vector and scale parameters can be set as a prediction block of the current block.
  • information about the sizing parameter ⁇ may be encoded and signaled. Specifically, a different index may be assigned to each of a plurality of sizing parameter candidates, and an index specifying a sizing parameter candidate applied to the current block may be encoded and signaled.
  • the resizing parameters of the current block can be derived based on the resizing parameters of the neighboring blocks. For example, the resizing parameters of the neighboring blocks at a predefined position can be set as the resizing parameters of the current block.
  • the size adjustment parameter of the first searched available neighboring block can be set as the size adjustment parameter of the current block.
  • the size adjustment parameter of the neighboring block may be set as the size adjustment parameter candidate.
  • a plurality of neighboring blocks may be sequentially searched to generate a size adjustment parameter candidate list including a plurality of size adjustment parameter candidates.
  • One of the plurality of size adjustment parameter candidates included in the plurality of size adjustment parameter candidate lists may be set as the size adjustment parameter of the current block.
  • an index indicating a candidate that is identical to the size adjustment parameter of the current block among the plurality of size adjustment parameter candidates may be encoded and signaled.
  • the neighboring blocks used to derive the size adjustment parameters of the current block may include at least one of an upper neighboring block, a left neighboring block, an upper-left neighboring block, an upper-right neighboring block, or a lower-left neighboring block.
  • Figure 15 shows an example in which motion compensation based on translational models and rotational models is performed for the current block.
  • the current block is assumed to have a size of 4x4, as illustrated in Fig. 12.
  • the position of a temporary block in a reference picture can be specified based on the motion vector of the current block. Specifically, a block position that takes a position spaced apart by the motion vector from the position corresponding to the upper left sample of the current block in the reference picture as the upper left sample can be specified.
  • the temporary block can be rotated, as in the example shown in (b) of Fig. 15.
  • the block at the rotated position is set as a reference block, and the reference block can be set as a prediction block of the current block.
  • a rotation matrix can be used to rotate a temporary block specified by a motion vector. That is, a prediction sample for the current block can be set to a sample at a position obtained by applying a rotation matrix to a sample position within the temporary block.
  • Mathematical expression 1 represents the rotation matrix
  • (pos_x, pos_y) represents the position of a sample within a temporary block. That is, (pos_x, pos_y) can be derived by adding a motion vector to the position of a prediction target sample within the current block.
  • the sample value at the (pos_x', pos_y') position in the reference picture can be set as the value of the prediction sample for the position of the prediction target sample. If the (pos_x', pos_y') position is a fractional position, the sample at the corresponding position can be generated by interpolating integer position samples.
  • information indicating the rotation angle ⁇ can be encoded and signaled. For example, after assigning a different index to each of a plurality of rotation angle candidates, the index of the rotation angle candidate corresponding to the rotation angle of the current block can be encoded and signaled.
  • the rotation angle of the current block can be derived based on the rotation angle of the neighboring block.
  • the rotation angle of the neighboring block at a predefined position can be set to the rotation angle of the current block.
  • the rotation angle of the first searched available neighboring block can be set to the rotation angle of the current block.
  • the rotation angle of the neighboring block may be set as the rotation angle candidate.
  • a plurality of neighboring blocks may be sequentially searched to generate a rotation angle candidate list including a plurality of rotation angle candidates.
  • One of the plurality of rotation angle candidates included in the plurality of rotation angle candidate lists may be set as the rotation angle of the current block.
  • an index indicating a candidate having the same rotation angle as the current block among the plurality of rotation angle candidates may be encoded and signaled.
  • the neighboring block used to derive the rotation angle of the current block may include at least one of an upper neighboring block, a left neighboring block, an upper-left neighboring block, an upper-right neighboring block, or a lower-left neighboring block.
  • the motion vector precision for the current block or the number and/or types of motion vector precision candidates available for the current block may be determined differently depending on the motion compensation model.
  • the number and/or type of motion vector precision candidates available for the current block may differ between cases where only a translational model is applied and cases where at least one of a zooming model or a rotational model is applied.
  • candidates of 1/4 pixel unit or more may be available for the current block.
  • candidates of 1/16 pixel unit or more may be available for the current block.
  • the motion vector precision of the current block may be set to 1/4 pixel units.
  • the motion vector precision of the current block may be set to 1/16 pixel units.
  • the available motion vector precisions or available motion vector precision candidates for each motion compensation model may be pre-stored.
  • information indicating the available motion vector precisions or available motion vector precision candidates for each motion compensation model may be encoded and signaled through the upper header.
  • Motion compensation can be performed on an affine model to which a zooming model and/or a rotation model are added to a translational model by using the motion vector of the control point.
  • the control point may correspond to a corner of the current block.
  • at least one of the motion vector of the upper left corner, the motion vector of the upper right corner, or the motion vector of the lower left corner can be used.
  • control point motion vector the motion vector of a control point.
  • Figures 16 and 17 show examples of generating a prediction block for a current block using control point motion vectors.
  • the current block is assumed to have a size of 4x4, as illustrated in Fig. 12.
  • a prediction block for the current block is derived by a motion vector of a first control point corresponding to the upper left corner of the current block (a first control point motion vector, A) and a motion vector of a second control point corresponding to the upper right corner of the current block (a second control point motion vector, B).
  • a prediction block of the current block by additionally utilizing the motion vector of the lower left corner, or by utilizing the motion vector of the lower left corner instead of the upper right corner.
  • Figure 18 shows an example of generating a prediction block for the current block using three control point motion vectors.
  • a prediction block for the current block is derived by a motion vector of a first control point corresponding to the upper left corner of the current block (first control point motion vector, A), a motion vector of a second control point corresponding to the upper right corner of the current block (second control point motion vector, B), and a motion vector of a third control point corresponding to the lower left corner of the current block (third control point motion vector, C).
  • translational, zooming, and rotational motion compensation for the current block can be performed using two control point motion vectors or three control point motion vectors.
  • Information indicating the number of control point motion vectors can be encoded and signaled.
  • the information can be signaled on a block-by-block basis.
  • the information can indicate whether two or three control point motion vectors are used in the current block.
  • the number of control point motion vectors can be adaptively determined based on at least one of the size or shape of the current block.
  • the number of control point motion vectors for the current block can be set equal to the number of control point motion vectors of the neighboring blocks.
  • Mathematical expression 2 represents a formula for deriving a motion vector for each sample using two control point motion vectors.
  • (mv x , mv y ) represents a motion vector at the (x, y) position within the current block.
  • (mv Ax , mv Ay ) represents a first control point motion vector (A)
  • (mv Bx , mv By ) represents a second control point motion vector (B).
  • W represents the width of the current block.
  • a motion vector per sample can be derived by the following mathematical expression 3.
  • (mv Cx , mv Cy ) represents the third control point motion vector (C).
  • motion compensation can be performed for each sample, as in the example illustrated in Fig. 17.
  • a reference sample indicated by the motion vector of the prediction target sample can be set as a prediction sample for the prediction target sample.
  • integer position samples can be interpolated to generate fractional position samples, and the generated fractional position samples can be set as prediction samples for the prediction target sample.
  • the precision of the motion vector for each sample may be different.
  • the motion vector for the first prediction target sample may be derived in units of 1/2 pixels, while the motion vector for the second prediction target sample may be derived in units of 1/4 pixels.
  • the fractional position sample can be generated according to the motion vector precision for each of the prediction target samples.
  • the motion vector of the prediction target sample can be adjusted according to the reference motion vector precision, and then the prediction sample for the prediction target sample can be derived based on the adjusted motion vector. For example, if the reference motion vector precision is 1/2, the motion vector for the second prediction target sample can be adjusted in units of 1/4 pixels.
  • the reference motion vector precision can be determined on a block-by-block basis. Alternatively, the precision of control point motion vectors can be set as the reference motion vector precision. Alternatively, in the encoder and decoder, the reference motion vector precision can be predefined.
  • motion vectors can be derived on a sub-block basis.
  • Figure 19 shows an example in which a motion vector is derived in sub-block units.
  • a sub-block may be predefined in the encoder and decoder.
  • a sub-block may be a square block of size 2x2 or 4x4.
  • the size and/or shape of the sub-block may be adaptively determined based on the size and/or shape of the current block. For example, if the current block is square, the sub-block may also be square. On the other hand, if the current block is non-square, the sub-block may also be non-square.
  • information on at least one of the division method or division shape of the current block may be explicitly encoded and signaled.
  • information on at least one of the size of a sub-block, the shape of a sub-block, the position of a division line dividing the current block, or the number of division lines may be explicitly encoded and signaled.
  • the information may be encoded and signaled on a block-by-block basis, or may be encoded and signaled via an upper header.
  • a motion vector of a sub-block can be derived using coordinates of a predefined position within a sub-block.
  • the predefined position can be one of the positions of the upper left sample, the upper right sample, the lower left sample, the lower right sample, or the center position within a sub-block.
  • the motion vector of the sub-block can be derived.
  • motion vectors can be derived for each sub-block based on the affine motion model.
  • deriving motion vectors in sub-block units using collocated pictures can be called SbTMVP (Sub-block Temporal Motion Vector Prediction).
  • a collocated picture may be one of the reference pictures included in a reference picture list. For example, a picture having an index of 0 in the reference picture list may be selected as a collocated picture.
  • information indicating the index of a reference picture to be set as a collocated picture in the reference picture list can be explicitly encoded and signaled.
  • Figures 20 and 21 illustrate examples in which motion vectors are derived for each sub-block within the current block when SbTMVP is applied.
  • the size and/or shape of the sub-block may be predefined in the encoder and decoder.
  • the size and/or shape of the sub-block may be adaptively determined based on the size and/or shape of the current block. For example, if at least one of the width or the height of the current block is greater than the threshold, the size of the sub-block may be set to 8x8. Otherwise, the size of the sub-block may be set to 4x4.
  • information indicating the size and/or shape of the sub-block may be explicitly encoded and signaled.
  • an initial motion vector of a current block can be derived.
  • the initial motion vector can be derived based on at least one of a motion vector prediction list or a motion information merge list. For example, an index indicating one of the motion vector prediction candidates included in the motion vector prediction list can be encoded and signaled.
  • the initial motion vector can be derived by adding a motion vector differential value to the motion vector prediction candidate indicated by the index. Meanwhile, the motion vector differential value can also be explicitly encoded and signaled.
  • encoding of the index may be omitted, and a motion vector prediction candidate having a predefined index in the motion vector prediction list may be set as a prediction value for the initial motion vector.
  • the motion vector prediction candidate having a predefined index may be a motion vector prediction candidate having an index of 0 or a motion vector prediction candidate having the largest index.
  • an index indicating one of the motion information merging candidates included in the motion information merging list may be encoded and signaled.
  • the initial motion vector may be set to be the same as the motion vector of the motion information merging candidate indicated by the index.
  • the initial motion vector may be derived based on a motion information merge candidate having a predefined index in the motion information merge list.
  • the motion information merge candidate having a predefined index may be a motion information merge candidate having an index of 0 or a motion information merge candidate having the largest index.
  • the initial motion vector can be derived using the motion vector of a neighboring block at a predefined position.
  • the neighboring block at the predefined position can be a left neighboring block or an upper neighboring block.
  • the motion vector of a neighboring block at a predefined position can be set as a predicted value of the initial motion vector, and the initial motion vector can be derived by adding a difference value to the predicted value.
  • the motion vector of a neighboring block at a predefined position can be set as the initial motion vector.
  • the initial motion vector can be derived using a template-based motion estimation method (i.e., template matching method) or bilateral matching.
  • the precision of the initial motion vector may be predefined in the encoder and decoder.
  • the precision of the initial motion vector may be fixed in integer pixel units.
  • information indicating the precision of the initial motion vector can be explicitly encoded and signaled.
  • the information can be an index indicating one of a plurality of motion vector precision candidates.
  • the motion vector prediction candidates can be derived based on the motion vector precision of the initial motion vector. That is, after adjusting the motion vector prediction candidate according to the motion vector precision of the initial motion vector, the adjusted initial motion vector prediction candidate can be inserted into the motion vector prediction list.
  • the motion information merge candidates can be derived based on the motion vector precision of the initial motion vector. That is, after adjusting the motion information merge candidate according to the motion vector precision of the initial motion vector, the adjusted initial motion information merge candidate can be inserted into the motion information merge list.
  • the initial motion vector may not be derived from the motion information merge candidate.
  • an index indicating one of the multiple candidates may be encoded and signaled.
  • the initial motion vector may be derived from the candidate having the smallest index or the largest index among the multiple candidates.
  • one of the motion information in the L0 direction and the motion information in the L1 direction can be selected according to a preset priority, and an initial motion vector can be derived from the selected motion information.
  • the priority may be determined based on at least one of the magnitude of the motion vector of the motion merging candidate, the index of the reference picture of the motion merging candidate, or whether the reference picture of the motion merging candidate is identical to the collocated picture.
  • it can be set to always derive the initial motion vector based on the motion information in the L0 direction.
  • motion estimation can be performed according to the precision of the initial motion vector. For example, when the precision of the initial motion vector is in integer pixel units, motion estimation based on template matching can also be performed only at integer positions.
  • motion estimation can be performed according to the precision of the initial motion vector.
  • a motion vector for the L0 direction (L0 motion vector) and a motion vector for the L1 direction (L1 motion vector) are derived.
  • one of the L0 motion vector and the L1 motion vector can be set as the initial motion vector according to the preset priority.
  • it can be set to always derive the initial motion vector based on the motion information in the L0 direction.
  • information indicating which of the L0 motion vector and the L1 motion vector is set as the initial motion vector may be encoded and signaled.
  • the position of the collocated block within the collocated block can be determined using the initial motion vector. For example, a block at a position spaced apart by the initial motion vector from a position corresponding to the current block within the reference picture can be set as the collocated block. At this time, the position of the collocated block can be determined based on a predefined position within the current block.
  • the predefined position can be an upper left position, an upper right position, a lower left position, a lower right position, or a center position.
  • the collocated block can be divided into a plurality of collocated sub-blocks. Then, the motion vector of each of the collocated sub-blocks in the collocated block can be set as the motion vector of each of the sub-blocks in the current block.
  • the positions of the collocated sub-blocks corresponding to each of the sub-blocks in the current block in the collocated picture can be determined using the initial motion vector.
  • the position of the collocated sub-block can be derived based on a predefined position in the sub-block.
  • the predefined position can be an upper left position, an upper right position, a lower left position, a lower right position, or a center position.
  • the motion vector of the collocated sub-block corresponding to the sub-block can be set as the motion vector of the sub-block.
  • the motion vector stored at a position corresponding to a predefined position within the sub-block within the collocated sub-block can be set as the motion vector of the sub-block.
  • a predefined motion vector can be set as the motion vector of the sub-block.
  • the predefined motion vector can be a zero vector (i.e., (0, 0)) or an initial motion vector.
  • the motion vector of the sub-block may be derived from another location within the collocated sub-block.
  • a position corresponding to a predefined position within a collocated sub-block is encoded with intra prediction, then there is no motion vector at that position.
  • the predefined position is a central position (e.g., c10 in Fig. 21)
  • the motion vector of the sub-block cannot be derived.
  • the motion vector of the sub-block can be derived based on the motion vector stored at a different location from the center location. Specifically, the motion vector of the sub-block can be derived from the motion vector stored at a location adjacent to the center location (e.g., the top adjacent location c6, the left adjacent location c9, or the top left adjacent location c5).
  • the samples within the collocated sub-block can be searched according to the scan order, and the first available motion vector found can be set as the motion vector of the sub-block.
  • the scan order can be horizontal scan, vertical scan, diagonal scan, or raster scan.
  • the motion vector of the sub-block may be set as the motion vector of the collocated block.
  • a motion vector stored at a position corresponding to a predefined position within the current block in the collocated block may be set as the motion vector of the sub-block.
  • motion vectors can be derived for each sub-block using the affine motion model or SbTMVP.
  • motion compensation can be performed for each sub-block based on the motion vectors of each sub-block.
  • a prediction block for the current block By performing motion compensation for each of the sub-blocks, a prediction block for the current block can be obtained. That is, the prediction block can be composed of prediction samples of each of the sub-blocks.
  • the motion vector precision can be adjusted.
  • the position of each sample in a picture is defined as an integer position.
  • the position where the motion is reflected may be a decimal position rather than an integer position.
  • Figures 22 and 23 are diagrams showing examples in which prediction blocks are derived according to motion vector precision.
  • Figure 22 shows the location of the current block within the current picture
  • Figure 23 shows the location of the reference block according to the motion vector precision.
  • the motion vector of the current block can be defined as the distance from a sample corresponding to the upper left position of the current block in the reference picture to a sample corresponding to the upper left position of the reference block in the reference picture.
  • Figure 23 (a) illustrates a case where the motion vector precision of the current block is an integer pel
  • Figure 23 (b) illustrates a case where the motion vector precision of the current block is 1/2 pel
  • Figure 23 (c) illustrates a case where the motion vector precision of the current block is 1/4 pel.
  • motion vectors are expressed up to 1/4 vector precision, but motion vectors can also be expressed more precisely, such as 1/8, 1/16, or 1/32.
  • information for indicating the motion vector precision of the current block may be encoded and signaled.
  • the information may be an index identifying one of the motion vector precision candidates.
  • a different index may be assigned to each of the motion vector precision candidates, and the information may indicate an index of a motion vector precision candidate applied to the current block.
  • the samples existing in the real position can be generated using the samples existing in the integer position and the interpolation filter.
  • the motion vector expressed in real numbers can be scaled up to an integer and encoded/decoded.
  • the motion vector (MV), the motion vector predictor (MVP) and the motion vector differential (MVD) can be encoded/decoded as integer values through integerization.
  • the motion vector, the motion vector predictor and/or the motion vector differential can be integerized based on the motion vector precision.
  • integerization can be performed by multiplying the motion vector difference MVD by N.
  • the motion vector difference MVD is (4/16, 8/16)
  • the motion vector difference MVD can be integerized by multiplying by 16. That is, the integerized motion vector difference MVD can be expressed as (4, 8).
  • the actual MVD can be derived from the integerized MVD. For example, if the motion vector precision is 1/N, the integerized MVD can be divided by N to derive the actual MVD. For example, if the integerized MVD is (4, 8) and the motion vector precision is 1/8, the actual MVD can be (4/8, 8/8). Alternatively, if the integerized MVD is (4, 8) and the motion vector precision is 1/4, the actual MVD can be (4/4, 8/4).
  • the representation range of the integerized MVD may be different. For example, assume that the motion vector difference MVD is (4/16, 8/16) (i.e., (1/4, 2/4)). When the motion vector precision is 1/16, the integerized MVD is derived as (4, 8). On the other hand, when the motion vector precision is 1/4, the integerized MVD is derived as (1, 2).
  • the integerized MVD value can be reduced from (4, 8) to (1, 2).
  • the number of bits required to encode/decode the integerized motion vector difference MVD may be different. Accordingly, when encode/decode the motion vector difference MVD, the motion vector precision that can minimize the number of bins can be selected. Then, based on the selected motion vector precision, the motion vector difference MVD can be integerized, and the integerized motion vector difference MVD can be encode/decode. In addition, information about the motion vector precision can be additionally encode/decode.
  • the actual MVD can be reconstructed from the decoded MVD based on the motion vector precision. Then, the motion vector MV can be derived by combining the reconstructed MVD and the motion vector prediction value MVP.
  • the method of adjusting the value of the motion vector differential value MVD to be encoded/decoded based on the motion vector precision is called the Adaptive Motion Vector Resolution (AMVR) method.
  • AMVR Adaptive Motion Vector Resolution
  • Figures 24 and 25 are diagrams for explaining the process of encoding and decoding a motion vector difference value, respectively, when the AMVR method is applied.
  • motion vector and motion vector difference are expressed in units of 1/16 before integerization is performed, and 1/16 is expressed as the original motion vector precision.
  • the motion vector differential value MVD can be derived by differentiating the motion vector prediction value MVP from the motion vector MV (S2410).
  • the motion vector difference MVD can be composed of a horizontal component (i.e., x-axis component) and a vertical component (i.e., y-axis component).
  • the motion vector difference is 0, that is, if both the horizontal direction component and the vertical direction component are 0, the value of the motion vector difference MVD to be encoded becomes 0 regardless of the motion vector precision. Therefore, if the motion vector difference MVD is 0, encoding of AMVR-related information can be omitted (S2420).
  • the motion vector precision can be determined (S2430). Meanwhile, the motion vector precision can be encoded as AMVR-related information.
  • Information related to AMVR may include at least one of a flag (e.g., amvr_flag) indicating whether the AMVR method is applied to the current block, and an index (e.g., amvr_prec_idx) indicating one of a plurality of motion precision candidates when the AMVR method is applied.
  • a flag e.g., amvr_flag
  • an index e.g., amvr_prec_idx
  • the motion vector precision can be set to the default value.
  • amvr_flag can be encoded as a value of 0.
  • the default value can be 1, 1/2, 1/4, 1/8 or 1/16.
  • an index indicating one of the plurality of motion vector precision candidates i.e., amvr_prec_idx
  • amvr_flag may be encoded with a value of 1
  • amvr_prec_idx may be encoded with a value from 0 to (n-1).
  • n represents the number of motion vector precision candidates.
  • the plurality of motion vector precision candidates may include at least one of 4, 2, 1, 1/2, 1/4, 1/8, or 1/16.
  • the default value may not be set to the plurality of motion vector precision candidates indicated by the index. That is, when the motion vector precision of the current block is the default value, it is encoded and signaled as the value of amvr_flag, 0, and encoding of amvr_prec_idx may be omitted.
  • the optimal motion vector precision can be determined by performing RDO (Rate Distortion Optimization) for each combination of amvr_flag and amvr_prec_idx. That is, the combination with the optimal cost can be selected by performing RDO for the following cases.
  • RDO Rate Distortion Optimization
  • amvr_flag is 1 and amvr_prec_idx is 0
  • amvr_flag is 1 and amvr_prec_idx is 1
  • amvr_flag 1 and amvr_prec_idx is 2
  • a variable for scaling the motion vector difference i.e., a scaling parameter
  • Table 1 illustrates the values of the variable amvrshift according to the motion vector precision.
  • the motion vector precision can be expressed as shown in the following mathematical expression 4.
  • the variable amvrshft can be determined according to the value of amvr_prec_idx. For example, when amvr_prec_idx is 1, the variable amvrshift is set to 4. This indicates that the motion vector precision is 1 according to mathematical expression 4.
  • the motion vector difference value MVD can be scaled down and encoded using the variable amvrshift according to the motion vector precision.
  • mathematical expression 5 shows an example in which a scale down operation is performed on the motion vector difference value MVD.
  • MVD_x represents the horizontal component of the motion vector difference
  • MVD_y represents the vertical component of the motion vector difference
  • MVD'_x and MVD'_y represent the results of performing the scale down operation.
  • the encoder can encode motion vector difference and AMVR information with changed precision (S2440).
  • the motion vector difference MVD can be decoded (S2510).
  • the motion vector difference is 0, decoding of AMVR related information is omitted, and the motion vector MV of the current block can be set to be the same as the motion vector prediction value (S2520).
  • a variable amvrshift can be derived for scaling the motion vector difference.
  • a variable amvrshfit can be derived based on amvr_flag and/or amvr_prec_idx.
  • the decoded MVD can be scaled up to obtain a motion vector difference MVD restored to the original precision (S2540).
  • Mathematical expression 6 shows an example in which a scale-up operation is applied to the decoded MVD.
  • MVD' represents the decoded motion vector difference.
  • MVD represents the motion vector difference restored to the original precision, i.e., 1/16, through a scale-up operation.
  • the motion vector MV can be obtained by combining the motion vector difference MVD restored to the original precision and the motion vector prediction MVP.
  • the decoder can derive the motion vector MV by combining the motion vector prediction value MVP and the motion vector differential value MVD.
  • a color picture may be composed of multiple channels.
  • a color picture may be composed of a Y picture, a Cb picture, and a Cr picture.
  • Y represents a luma (or luminance) component
  • Cb and Cr represent chroma (or chrominance) components.
  • Chroma formats can indicate the size of a chroma picture relative to a luma picture. For example, a 4:4:4 format indicates that the size of a luma picture is the same as that of a chroma picture. A 4:2:0 format indicates that the width and height of a chroma picture are each half the width and height of a luma picture.
  • a block within a luma picture is referred to as a luma block
  • a block within a chroma picture is referred to as a chroma block
  • a chroma block may represent at least one of a Cb component block or a Cr component block.
  • the motion information encoding/decoding method described above can be applied.
  • the motion information of the chroma block can be derived based on the motion information of the luma block. For example, if the sizes of the chroma picture and the luma picture are different depending on the chroma format, the motion information of the chroma block can be derived by scaling the motion vector of the luma block existing at the same position as the chroma block. If the chroma format is 4:2:0, the width and height of the chroma picture are each half the size of the width and height of the luma picture. Accordingly, the x-axis component and the y-axis component of the motion vector of the luma block, each reduced by 1/2 (i.e., shifted to the right by 1), can be set as the motion vector of the chroma block.
  • the motion information of the luma block can be used as the motion information of the chroma block without performing scaling.
  • a reference block within the reference picture can be specified, and the specified reference block can be set as a prediction block of the chroma block.
  • the prediction direction of the chroma block can also be set to be the same as that of the luma block. For example, if bi-prediction is used for the luma block, bi-prediction can also be applied to the chroma block, and if uni-directional prediction is used for the luma block, uni-directional prediction can also be applied to the chroma block.
  • a chroma block can also be predicted in a different way than described above. Specifically, after deriving a prediction parameter, a chroma block can be predicted from a luma block corresponding to the chroma block. Predicting a chroma block from a restored luma block can be referred to as a color component discrimination prediction method based on a prediction parameter. Hereinafter, a color component discrimination prediction method based on a prediction parameter will be described in detail. Meanwhile, the prediction parameter can be derived in the same way in each of an encoder and a decoder.
  • Figure 26 shows a flow chart of a color component prediction method based on prediction parameters.
  • a reference block of a luma block in a reference picture (hereinafter, referred to as a luma reference block) can be derived (S2610).
  • a block at a position spaced apart by a motion vector of the luma block from the position of the luma block in the reference picture can be set as a luma reference block.
  • the reference picture represents a previously reconstructed luma picture.
  • the luma reference block can be set as a prediction block of the luma block.
  • the prediction block of the luma block (hereinafter referred to as the luma prediction block) and the reference block of the luma block can be replaced with each other.
  • the luma prediction block can be replaced with the reference block of the luma block, or the reference block of the luma block can be replaced with the luma prediction block.
  • a reference block of a chroma block in a reference picture (hereinafter, referred to as a chroma reference block) can be derived (S2620).
  • a block at the same position as a luma reference block in the reference picture can be derived as a chroma reference block.
  • motion information of a chroma block can be derived from a luma block, and then a chroma reference block can be set based on the derived motion information.
  • a block at a position spaced apart from a position of a chroma block in the reference picture by a motion vector of the chroma block can be set as a chroma reference block.
  • the reference picture represents a previously reconstructed chroma picture.
  • prediction parameters can be derived based on the correlation between the luma prediction block and the chroma reference block (S2630).
  • the prediction parameters can include at least one of a weight and an offset.
  • a prediction sample of a chroma block can be obtained from a restored luma block (hereinafter, luma restored block) based on the derived prediction parameters (S2640).
  • Figures 27 and 28 illustrate the operation of the encoder/decoder according to a color component prediction method based on prediction parameters.
  • Figure 27 shows an example of a case where bidirectional prediction is applied to a luma block
  • Figure 28 shows an example of a case where unidirectional prediction is applied to a luma block.
  • a reference block in the L0 direction can be obtained based on the L0 motion information of the luma block
  • a reference block in the L1 direction can be obtained based on the L1 motion information of the luma block.
  • Each of the L0 reference block and the L1 reference block can be set as an L0 prediction block and an L1 prediction block, respectively.
  • a prediction block of the luma block i.e., a luma prediction block, can be obtained based on an average or weighted sum operation of the prediction block in the L0 direction and the prediction block in the L1 direction.
  • reference blocks can be derived for each of the L0 direction and the L1 direction.
  • a Cb component block at the same position as the L0 reference block of a luma block can be set as an L0 reference block for the Cb block
  • a Cb component block at the same position as the L1 reference block of a luma block can be set as an L1 reference block for the Cb component block.
  • the motion information of the Cb block can be derived based on the motion information of the luma block.
  • the motion vector of the luma block can be directly set to the motion vector of the Cb block, or the motion vector of the luma block can be scaled to derive the motion vector of the Cb block.
  • a reference block in the L0 direction can be obtained based on the L0 motion information of the Cb block
  • a reference block in the L1 direction can be obtained based on the L1 motion information of the Cb block.
  • a weighted reference block for the Cb component (hereinafter, referred to as a weighted Cb reference block) can be obtained based on an average or weighted sum operation of the reference block in the L0 direction and the prediction block in the L1 direction.
  • a weighted reference block for the Cr component (hereinafter referred to as a weighted Cr reference block) can be obtained in the same manner as for the Cb block.
  • a first prediction parameter for the Cb component can be derived using the luma prediction block and the weighted Cb reference block.
  • a second prediction parameter for the Cr component can be derived using the luma prediction block and the weighted Cr reference block.
  • a prediction block of the Cb block can be obtained.
  • the luma restoration block can be obtained by adding a residual block of the luma component to the luma prediction block.
  • a prediction block of the Cr block can be obtained.
  • the Cb block By adding the residual block of the Cb component to the prediction block of the Cb block, the Cb block can be restored, and by adding the residual block of the Cr component to the prediction block of the Cr block, the Cr block can be restored.
  • the weighted sum process can be omitted.
  • a reference block in the L0 direction can be obtained based on the L0 motion information of the luma block, and the L0 reference block can be set as a prediction block of the luma block.
  • the prediction parameter can be derived based on the correlation between the luma prediction block (i.e., the L0 reference block of the luma component) and the L0 reference block of the chroma block.
  • the first prediction parameter can be derived based on the luma prediction block and the L0 reference block of the Cb block
  • the first prediction parameter can be derived based on the luma prediction block and the L0 reference block of the Cr block.
  • prediction parameters can be derived based on the correlation between the luma prediction block (i.e., the L1 reference block of the luma component) and the L1 reference block of the chroma block.
  • prediction parameters may be derived using reference blocks for either the L0 direction or the L1 direction. That is, prediction parameters may be derived using a luma reference block in the L0 direction and a chroma reference block in the L0 direction, or prediction parameters may be derived using a luma reference block in the L1 direction and a chroma reference block in the L1 direction.
  • L0 direction or the L1 direction may be predefined in the encoder and decoder.
  • one of the L0 direction and the L1 direction may be selected by comparing the distances of the reference picture in the L0 direction (i.e., the L0 reference picture) and the reference picture in the L1 direction (i.e., the L1 reference picture) with the current picture, respectively.
  • the distance represents the POC (Picture Order Count) difference between the two pictures.
  • the prediction parameters may be derived using reference blocks in the direction in which the distance to the current picture is closer among the L0 reference picture and the L1 reference picture.
  • the prediction parameters may be derived using the luma reference block in the L0 direction and the chroma reference block in the L0 direction.
  • prediction parameters can be derived using the weighted reference blocks.
  • prediction parameters can be derived using only reference blocks derived from the reference picture designated as the Col picture.
  • prediction parameters can be derived using reference blocks in the same direction as the call picture.
  • a chroma block when bidirectional prediction is applied to a luma block, can also be predicted by selecting one of multiple prediction parameter candidates.
  • Figure 29 illustrates an example of predicting a chroma block by selecting one of multiple prediction parameter candidates.
  • the plurality of prediction parameter candidates may include at least one of a first prediction parameter candidate derived using reference blocks in the L0 direction, a second prediction parameter candidate derived using reference blocks in the L1 direction, or a third prediction parameter candidate derived using a weighted predicted reference block.
  • the first prediction parameter candidate may be derived based on a correlation between an L0 reference block of a luma block and an L0 reference block of a chroma block
  • the second prediction parameter candidate may be derived based on a correlation between an L1 reference block of the luma block and an L1 reference block of the chroma block.
  • the third prediction parameter candidate may be derived based on a correlation between a result of weighting the L0 reference block and the L1 reference block of the luma block and a result of weighting the L0 reference block and the L1 reference block of the chroma block.
  • an optimal prediction parameter candidate can be selected from among a plurality of prediction parameter candidates, and a chroma block can be predicted based on the selected prediction parameter candidate.
  • index information indicating an optimal prediction parameter candidate from among a plurality of prediction parameter candidates can be encoded and signaled to a decoder.
  • the index information may be encoded and signaled for each of the Cb component and the Cr component. That is, the optimal prediction parameter for the Cb component may be determined based on the index information decoded for the Cb component among a plurality of prediction parameter candidates for the Cb component, and the optimal prediction parameter for the Cr component may be determined based on the index information decoded for the Cr component among a plurality of prediction parameter candidates for the Cr component.
  • a single index information may be encoded and signaled. For example, if the index information points to the L0 direction, prediction parameters for both the Cb and Cr components may be derived based on reference blocks in the L0 direction.
  • the prediction parameters can be derived using chroma reference blocks for either the L0 direction or the L1 direction of the chroma block.
  • the prediction parameters can be derived using a weighted reference block of the luma component (i.e., a block derived by weighting the L0 reference block and the L1 reference block) and a chroma reference block in the L0 direction, or the prediction parameters can be derived using a weighted reference block of the luma component and a chroma reference block in the L1 direction.
  • a weighted reference block of the luma component i.e., a block derived by weighting the L0 reference block and the L1 reference block
  • a chroma reference block in the L1 direction i.e., a block derived by weighting the L0 reference block and the L1 reference block
  • whether to use the chroma reference block in the L0 direction or the chroma reference block in the L1 direction can be determined by a preset condition.
  • information indicating the prediction direction of the chroma block can be encoded and signaled.
  • the prediction direction can indicate L0 unidirectional prediction, L1 unidirectional prediction, or bidirectional prediction.
  • at least one of the chroma reference block in the L0 direction or the chroma reference block in the L1 direction can be selected.
  • a prediction parameter may be derived by a correlation between a luma prediction block and a chroma reference block, and for the other of the Cb component and the Cr component, differential information with respect to the prediction parameter may be encoded and signaled.
  • the prediction parameter can be derived based on the correlation between the luma prediction block and the reference block of the Cb component.
  • the differential information between the prediction parameter of the Cr component and the prediction parameter of the Cb component can be encoded and signaled.
  • the prediction parameter can be derived based on the correlation between the luma prediction block and the reference block of the Cb component. From the bitstream, the differential information between the prediction parameter of the Cr component and the prediction parameter of the Cb component is decoded, and then the differential value is added to the prediction parameter of the Cb component, thereby deriving the prediction parameter for the Cr component.
  • the differential information may include at least one of a difference between weights or a difference between offsets.
  • Figure 30 shows an example of deriving prediction parameters for color difference components.
  • the chroma format is 4:4:4 and the size of the reference block for the luma prediction block and the chroma component (i.e., the chroma reference block) is 4x4.
  • the chroma component can represent the Cb component or the Cr component.
  • the difference (i.e., error (E)) between samples in a luma prediction block and samples in a chroma reference block can be defined as in the following mathematical expression (7).
  • T represents a block
  • (i, j) represents the coordinate of a sample within the block.
  • RefC represents a sample value within a chroma reference block
  • PredL represents a prediction sample value within a luma prediction block.
  • the chroma format is not 4:4:4, PredL can be obtained by applying a down-sampling filter to prediction samples within the luma prediction block.
  • mathematical expression 7 is partially differentiated with the weight ⁇ and the offset ⁇ as in mathematical expressions 8 and 9, respectively, and the weight ⁇ and the offset ⁇ for which the result of the partial differentiation becomes 0 can be derived.
  • the derived prediction parameters can be applied to the restored luma block to obtain a prediction block for the chroma block.
  • Mathematical expression 10 shows an example of deriving a prediction block for a chroma block.
  • PredC represents a prediction sample of a chroma component
  • recL represents a reconstructed sample in a reconstructed luma block.
  • the chroma format is not 4:4:4
  • recL can be obtained by applying a down-sampling filter to the reconstructed samples in the luma reconstructed block.
  • a prediction sample of a chroma block can be obtained by multiplying a luma restoration sample at the same location as a location to be predicted within a chroma block by a weight ⁇ and adding an offset ⁇ to the result.
  • prediction parameters can be derived using only samples at sub-sampled locations.
  • Figure 31 shows the sub-sampled locations.
  • a prediction block for a chroma block can be obtained by using only samples at sub-sampled locations within a luma prediction block and a chroma reference block.
  • Which of the sub-sampling location candidates illustrated in Fig. 31 is to be used may be predefined in the encoder and decoder.
  • index information indicating one of the multiple sub-sampling location candidates may be encoded and signaled.
  • multiple prediction parameter candidates can be derived based on multiple sub-sampling location candidates.
  • a prediction parameter candidate can be derived from each of the candidates illustrated in (a) to (d) of FIG. 31.
  • an optimal prediction parameter among a plurality of prediction parameter candidates can be determined, and index information indicating the optimal prediction parameter among the plurality of prediction parameter candidates can be encoded and signaled.
  • the subsampling locations can be determined adaptively.
  • subsampling may be performed only on luma prediction blocks.
  • the prediction parameters are exemplified as including weights ⁇ and offsets ⁇ .
  • multiple filter coefficients may be defined as prediction parameters.
  • filter coefficients of a convolutional filter that minimizes the difference between a luma prediction block and a chroma reference block may be defined as prediction parameters.
  • Figure 32 shows an example of deriving prediction parameters using a convolution filter.
  • Figure 33 shows the form of a convolution filter.
  • Fig. 32 an example of deriving prediction parameters using the 5-tap convolution filter illustrated in Fig. 33 is shown.
  • C represents a luma prediction sample located at the center of the filter
  • N, W, S, and E represent samples around the luma prediction sample.
  • N may represent a sample neighboring the upper side of the luma prediction sample C, i.e., a sample at position [i, j-1].
  • S may represent a sample neighboring the lower side of the luma prediction sample C, i.e., a sample at position [i, j+1].
  • W may represent a sample neighboring the left side of the luma prediction sample C, i.e., a sample at position [i-1, j].
  • E may represent a sample neighboring the right side of the luma prediction sample C, i.e., a sample at position [i+1, j].
  • the luma prediction block can be downsampled. That is, C can represent a downsampled luma prediction sample. Additionally, N, W, S, and E can represent samples adjacent to C within the downsampled luma prediction block.
  • the sample input to the convolution filter may be a restoration sample around the luma block. That is, [i, j] may represent the coordinate within the luma block.
  • the samples input to the convolution filter may be reconstructed samples around the reference block of the luma block in the reference picture. That is, [i, j] may represent the coordinates of the reference block of the luma block in the reference picture.
  • an output value of the convolution filter can be obtained, and filter coefficients that minimize the difference (i.e., error (E)) between the output value of the convolution filter and the corresponding sample value in the chroma reference block can be derived.
  • mathematical expression 11 shows an example of deriving filter coefficients.
  • Equation 11 w0 to w4 represent weights applied to C, N, S, E, and W, respectively.
  • RefC represents a sample within a chroma reference block.
  • B may be a value derived based on the bit depth of the picture.
  • mathematical expression 12 shows an example of deriving the variable B.
  • D represents the bit depth.
  • B can be set to 512, which is the middle value of the range that can be expressed by 10 bits.
  • B can be set to 128, which is the middle value of the range that can be expressed by 8 bits.
  • variable B can be set to the mean of prediction samples within the luma prediction block.
  • variable B can be set to the mean of samples input to the convolution filter.
  • information representing the value of variable B can be explicitly encoded and signaled.
  • mathematical expression 11 can be partially differentiated with respect to each of the filter coefficients (i.e., w0 to w5), and filter coefficients for which the result of the partial differentiation becomes 0 can be derived.
  • a convolution filter can be applied to the luma block to obtain a prediction sample of the chroma block.
  • the prediction sample of the chroma block can be derived by the following mathematical expression 13.
  • PredC represents a prediction sample of a chroma block.
  • C' represents a reconstructed sample (i.e., recL[i][j]) at the same location as the chroma prediction sample in the luma block.
  • N', S', E', and W' represent samples adjacent to C'. For example, N' may represent an upper adjacent sample of C', S' may represent a lower adjacent sample of C', E' may represent a right adjacent sample of C', and W' may represent a left adjacent sample of C'.
  • the luma block can be downsampled. That is, C' can represent a downsampled luma restoration sample. Additionally, N', W', S' and E' can represent samples adjacent to C' within the downsampled luma block.
  • prediction parameters and chroma prediction samples may be derived using a 1D shape, square or rectangular filter.
  • the prediction parameters including the weights ⁇ and the offset ⁇ may be referred to as linear prediction parameters, and the prediction parameters including the filter coefficients of the convolution filter (e.g., w0 to w5) may be referred to as convolution prediction parameters.
  • one of the linear prediction parameter and the convolution prediction parameter may be selected based on at least one of the chroma format, the size of the luma/chroma block, the bit depth, the mean value of the reconstructed samples in the luma block, or the slice type.
  • the chroma format is 4:4:4
  • the chroma block can be predicted using the linear prediction parameter.
  • the chroma format is 4:2:2 or 4:2:0
  • the chroma block can be predicted using the convolution prediction parameter.
  • the linear prediction parameters and the convolution prediction parameters may be combined to obtain the prediction block of the chroma block.
  • a first prediction block for the chroma block may be obtained based on the linear prediction parameters
  • a second prediction block for the chroma block may be obtained based on the convolution prediction parameters. Thereafter, the first prediction block and the second prediction block may be averaged or weighted to derive the final prediction block of the chroma block.
  • color component prediction based on prediction parameters can be performed on a sub-block basis.
  • Figure 34 is a diagram for explaining an example in which a color component discrimination prediction method based on prediction parameters is performed on a sub-block basis.
  • a chroma block can be divided into multiple sub-blocks, and prediction parameters can be derived independently for each chroma sub-block.
  • a reference block for the first luma sub-block can be determined based on motion information of the first luma sub-block within the luma block.
  • the reference block for the first luma sub-block can be a prediction block of the first luma sub-block.
  • a reference block can be determined for the first chroma sub-block within a chroma block.
  • the reference block of the first chroma sub-block can be a block at the same location as the reference block of the first luma sub-block within the reference picture.
  • motion information of the first chroma sub-block can be derived from motion information of the first luma sub-block, and a reference block of the first chroma sub-block can be derived based on the motion information of the first chroma block.
  • a first prediction parameter for the first chroma sub-block can be derived using the reference block of the first luma sub-block and the reference block of the first chroma sub-block.
  • the second to fourth prediction parameters can be derived for the second to fourth chroma sub-blocks.
  • a prediction block of the chroma sub-block can be derived. For example, by applying a first prediction parameter to a first luma sub-block in a luma block, a prediction block for a first chroma sub-block in the chroma block can be obtained. In addition, by applying a second prediction parameter to a second luma sub-block in the luma block, a prediction block for a second chroma sub-block in the chroma block can be obtained.
  • a prediction block for a third chroma sub-block can be obtained by applying a third prediction parameter to a third luma sub-block
  • a prediction block for a fourth chroma sub-block can be obtained by applying a fourth prediction parameter to a fourth luma sub-block.
  • the size of a sub-block may be predefined in the encoder and decoder.
  • information indicating the size of the sub-block can be encoded and signaled via the upper header.
  • whether color component prediction based on prediction parameters is performed on a sub-block basis can be determined based on at least one of the size of a luma/chroma block, the number of samples included in a sub-block generated when dividing the block, or a chroma format.
  • whether the color component discriminant prediction based on the prediction parameter is performed on a sub-block basis can be determined based on whether the inter prediction of the luma block is performed on a sub-block basis. For example, if the luma block is encoded/decoded based on an affine model or SbTMVP, the color component discriminant prediction based on the prediction parameter can be performed on a sub-block basis. On the other hand, if the luma block is encoded/decoded based on a translational motion model, the color component discriminant prediction can be performed by deriving the prediction parameter at the block level.
  • prediction parameters derived at the block level can be derived.
  • a luma sub-block corresponding to a chroma sub-block is not encoded with inter prediction or there is no motion vector stored in the luma sub-block, it may not be possible to derive prediction parameters for the chroma sub-block.
  • prediction parameters can be derived at the block level, and the derived block level prediction parameters can be used as prediction parameters of chroma sub-blocks.
  • the prediction parameters at the block level can be derived based on the correlation between the reference block of the luma block and the reference block of the chroma block.
  • Information indicating whether color component prediction based on prediction parameters is applied to a chroma block may be encoded and signaled.
  • the information may be a 1-bit flag.
  • color component discrimination prediction based on prediction parameters may be allowed in a limited manner when certain conditions are satisfied.
  • the certain conditions may be determined based on at least one of the number of transformed and quantized coefficients, the values of the transformed and quantized coefficients, the number of samples in a luma block, the values of the samples in a luma block, the chroma format, or whether bidirectional prediction is performed.
  • the transformed and quantized coefficients may also be referred to as residual coefficients.
  • color component-specific prediction based on prediction parameters can be performed.
  • color component-specific prediction based on prediction parameters can be applied only if the number of non-zero transformed and quantized coefficients in the luma block is greater than or equal to a threshold.
  • color component prediction based on prediction parameters can be performed only if all samples within the luma block have non-zero values.
  • color component prediction based on prediction parameters can be performed only if the values of all residual samples within the luma block are not 0.
  • color component-specific prediction based on prediction parameters can be performed only when at least one of AMVP mode, merge mode, template matching or bilateral matching is applied to the luma block.
  • prediction parameters for a chroma sub-block only if all residual samples in the luma sub-block have non-zero values. If at least one residual sample in the luma sub-block has zero values, or if all residual samples have zero values, it may not be possible to derive prediction parameters for the chroma sub-block.
  • prediction parameters derived at the block level or prediction parameters of a neighboring chroma sub-block can be set as the prediction parameters of the chroma sub-block.
  • color component prediction based on prediction parameters can also be applied when the within-screen block copy mode is applied to the luma block.
  • the reference block of the luma block and the reference block of the chroma block may exist in the previously restored area in the current picture.
  • the prediction parameters of a chroma block can be derived based on the correlation between a reference block in the current luma picture and a reference block in the current chroma picture.
  • the reference region for deriving prediction parameters may be set differently based on the encoding mode of the corresponding luma block.
  • a reference block of the luma block when a luma block is encoded with inter-screen prediction, a reference block of the luma block can be derived from a reference picture based on motion information of the luma block, and a reference block of the chroma block can be derived from a reference picture based on motion information of the chroma block. Thereafter, a prediction parameter can be derived based on a correlation between the reference block of the luma block and the reference block of the chroma block.
  • the prediction parameters can be derived based on the correlation between the templates adjacent to the luma block and the templates adjacent to the chroma block.
  • each of the components (e.g., units, modules, etc.) constituting the block diagram in the above-described disclosure may be implemented as a hardware device or software, or a plurality of components may be combined to be implemented as a single hardware device or software.
  • the hardware device may include at least one of a processor for performing a calculation, a memory for storing data, a transmitter for transmitting data, and a receiver for receiving data.
  • the above-described disclosure may be implemented in the form of program commands that can be executed through various computer components and recorded on a computer-readable recording medium.
  • the computer-readable recording medium may include program commands, data files, data structures, etc., singly or in combination.
  • a computer-readable recording medium storing a bitstream generated by the above-described encoding method.
  • the bitstream can be transmitted by an encoding device, and a decoding device can receive the bitstream and decode an image.
  • Examples of computer-readable recording media include magnetic media such as hard disks, floppy disks, and magnetic tapes, optical recording media such as CD-ROMs, DVDs, magneto-optical media such as floptical disks, and hardware devices specifically configured to store and execute program instructions such as ROMs, RAMs, flash memories, and the like.
  • the hardware devices may be configured to operate as one or more software modules to perform processing according to the present disclosure, and vice versa.
  • the present disclosure may be applied to a computing or electronic device capable of encoding/decoding a video signal.

Landscapes

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

Abstract

An image decoding method according to the present disclosure may comprise the steps of: deriving a first reference block of a luma block that is in the same position as a chroma block; deriving a second reference block of the chroma block; deriving a prediction parameter on the basis of the first reference block and the second reference block; and applying the prediction parameter to the luma block to obtain a prediction block for the chroma block.

Description

영상 부호화/복호화 방법 및 비트스트림을 저장하는 기록 매체 Video encoding/decoding method and recording medium for storing bitstream

본 개시는 비디오 신호 처리 방법 및 장치에 관한 것이다.The present disclosure relates to a method and device for processing a video signal.

최근 HD(High Definition) 영상 및 UHD(Ultra High Definition) 영상과 같은 고해상도, 고품질의 영상에 대한 수요가 다양한 응용 분야에서 증가하고 있다. 영상 데이터가 고해상도, 고품질이 될수록 기존의 영상 데이터에 비해 상대적으로 데이터량이 증가하기 때문에 기존의 유무선 광대역 회선과 같은 매체를 이용하여 영상 데이터를 전송하거나 기존의 저장 매체를 이용해 저장하는 경우, 전송 비용과 저장 비용이 증가하게 된다. 영상 데이터가 고해상도, 고품질화 됨에 따라 발생하는 이러한 문제들을 해결하기 위해서는 고효율의 영상 압축 기술들이 활용될 수 있다.Recently, the demand for high-resolution, high-quality images such as HD (High Definition) images and UHD (Ultra High Definition) images is increasing in various application fields. As the image data becomes higher in resolution and quality, the amount of data increases relatively compared to existing image data. Therefore, when transmitting the image data using media such as existing wired and wireless broadband lines or storing it using existing storage media, the transmission and storage costs increase. In order to solve these problems that occur as image data becomes higher in resolution and quality, high-efficiency image compression technologies can be utilized.

영상 압축 기술로 현재 픽쳐의 이전 또는 이후 픽쳐로부터 현재 픽쳐에 포함된 화소값을 예측하는 화면 간 예측 기술, 현재 픽쳐 내의 화소 정보를 이용하여 현재 픽쳐에 포함된 화소값을 예측하는 화면 내 예측 기술, 출현 빈도가 높은 값에 짧은 부호를 할당하고 출현 빈도가 낮은 값에 긴 부호를 할당하는 엔트로피 부호화 기술 등 다양한 기술이 존재하고 이러한 영상 압축 기술을 이용해 영상 데이터를 효과적으로 압축하여 전송 또는 저장할 수 있다.There are various technologies such as inter-picture prediction technology that predicts pixel values included in the current picture from pictures before or after the current picture, intra-picture prediction technology that predicts pixel values included in the current picture using pixel information in the current picture, and entropy coding technology that assigns short codes to values with high frequency of appearance and long codes to values with low frequency of appearance, etc., and using these image compression technologies, image data can be effectively compressed and transmitted or stored.

한편, 고해상도 영상에 대한 수요가 증가함과 함께, 새로운 영상 서비스로서 입체 영상 컨텐츠에 대한 수요도 함께 증가하고 있다. 고해상도 및 초고해상도의 입체 영상 콘텐츠를 효과적으로 제공하기 위한 비디오 압축 기술에 대하여 논의가 진행되고 있다.Meanwhile, as the demand for high-resolution images increases, the demand for stereoscopic image content as a new image service is also increasing. Discussions are underway on video compression technology to effectively provide high-resolution and ultra-high-resolution stereoscopic image content.

본 개시는, 루마 블록이 인터 예측으로 부호화된 경우에도, 색성분간 예측을 통해 크로마 블록을 예측하는 방법 및 이를 위한 장치를 제공하는 것을 목적으로 한다. The present disclosure aims to provide a method for predicting a chroma block through color component-specific prediction even when a luma block is encoded with inter prediction, and a device therefor.

본 개시는, 기 복원된 루마 참조 블록 및 크로마 참조 블록을 기초로 예측 파라미터를 유도하는 방법 및 이를 위한 장치를 제공하는 것을 목적으로 한다.The present disclosure aims to provide a method for deriving prediction parameters based on previously restored luma reference blocks and chroma reference blocks and a device therefor.

본 개시에서 이루고자 하는 기술적 과제들은 이상에서 언급한 기술적 과제들로 제한되지 않으며, 언급하지 않은 또 다른 기술적 과제들은 아래의 기재로부터 본 개시가 속하는 기술분야에서 통상의 지식을 가진 자에게 명확하게 이해될 수 있을 것이다.The technical problems to be achieved in the present disclosure are not limited to the technical problems mentioned above, and other technical problems not mentioned will be clearly understood by a person having ordinary skill in the technical field to which the present disclosure belongs from the description below.

본 개시에 따른 영상 복호화 방법은, 크로마 블록과 동일 위치인 루마 블록의 제1 참조 블록을 유도하는 단게; 상기 크로마 블록의 제2 참조 블록을 유도하는 단계; 상기 제1 참조 블록 및 상기 제2 참조 블록에 기초하여, 예측 파라미터를 유도하는 단계; 및 상기 루마 블록에 상기 예측 파라미터를 적용하여, 상기 크로마 블록에 대한 예측 블록을 획득하는 단계를 포함할 수 있다. A video decoding method according to the present disclosure may include a step of deriving a first reference block of a luma block that is in the same position as a chroma block; a step of deriving a second reference block of the chroma block; a step of deriving a prediction parameter based on the first reference block and the second reference block; and a step of applying the prediction parameter to the luma block to obtain a prediction block for the chroma block.

본 개시에 따른 영상 부호화 방법은, 크로마 블록과 동일 위치인 루마 블록의 제1 참조 블록을 유도하는 단게; 상기 크로마 블록의 제2 참조 블록을 유도하는 단계; 상기 제1 참조 블록 및 상기 제2 참조 블록에 기초하여, 예측 파라미터를 유도하는 단계; 및 상기 루마 블록에 상기 예측 파라미터를 적용하여, 상기 크로마 블록에 대한 예측 블록을 획득하는 단계를 포함할 수 있다. A video encoding method according to the present disclosure may include a step of deriving a first reference block of a luma block that is in the same position as a chroma block; a step of deriving a second reference block of the chroma block; a step of deriving a prediction parameter based on the first reference block and the second reference block; and a step of applying the prediction parameter to the luma block to obtain a prediction block for the chroma block.

본 개시에 따른 영상 복호화/부호화 방법에 있어서, 상기 루마 블록에 양방향 예측이 적용된 경우, 상기 제1 참조 블록은, 상기 루마 블록의 L0 참조 블록 및 L1 참조 블록을 가중합하여 획득된 것이고, 상기 제2 참조 블록은, 상기 크로마 블록의 L0 참조 블록 및 L1 참조 블록을 가중합하여 획득된 것일 수 있다.In the image decoding/encoding method according to the present disclosure, when bidirectional prediction is applied to the luma block, the first reference block may be obtained by weighting the L0 reference block and the L1 reference block of the luma block, and the second reference block may be obtained by weighting the L0 reference block and the L1 reference block of the chroma block.

본 개시에 따른 영상 복호화/부호화 방법에 있어서, 상기 루마 블록에 양방향 예측이 적용된 경우, 상기 루마 블록의 L0 참조 픽처 및 L1 참조 픽처의 POC (Picture Order Count)를 기반으로, 상기 제1 참조 블록 및 상기 제2 참조 블록이 결정될 수 있다. In the image decoding/encoding method according to the present disclosure, when bidirectional prediction is applied to the luma block, the first reference block and the second reference block can be determined based on the POC (Picture Order Count) of the L0 reference picture and the L1 reference picture of the luma block.

본 개시에 따른 영상 복호화/부호화 방법에 있어서, 상기 L0 참조 픽처 및 현재 픽처 간의 거리가 상기 L1 참조 픽처 및 상기 현재 픽처 간의 거리보다 작은 경우, 상기 제1 참조 블록 및 상기 제2 참조 블록 각각은, 상기 루마 블록의 L0 참조 블록 및 상기 크로마 블록의 L0 참조 블록을 나타내고, 상기 L1 참조 픽처 및 상기 현재 픽처 간의 거리가 상기 L0 참조 픽처 및 상기 현재 픽처 간의 거리보다 작은 경우, 상기 제1 참조 블록 및 상기 제2 참조 블록 각각은, 상기 루마 블록의 L1 참조 블록 및 상기 크로마 블록의 L1 참조 블록을 나타낼 수 있다.In the video decoding/encoding method according to the present disclosure, if the distance between the L0 reference picture and the current picture is smaller than the distance between the L1 reference picture and the current picture, each of the first reference block and the second reference block may represent an L0 reference block of the luma block and an L0 reference block of the chroma block, and if the distance between the L1 reference picture and the current picture is smaller than the distance between the L0 reference picture and the current picture, each of the first reference block and the second reference block may represent an L1 reference block of the luma block and an L1 reference block of the chroma block.

본 개시에 따른 영상 복호화/부호화 방법에 있어서, 상기 L0 참조 픽처 및 상기 현재 픽처 간의 거리와 상기 L1 참조 픽처 및 상기 현재 픽처 간의 거리가 동일한 경우, 상기 제1 참조 블록은, 상기 루마 블록의 상기 L0 참조 블록 및 상기 L1 참조 블록을 가중합하여 획득된 것이고, 상기 제2 참조 블록은, 상기 크로마 블록의 상기 L0 참조 블록 및 상기 L1 참조 블록을 가중합하여 획득된 것일 수 있다.In the video decoding/encoding method according to the present disclosure, when the distance between the L0 reference picture and the current picture and the distance between the L1 reference picture and the current picture are the same, the first reference block may be obtained by weighting the L0 reference block and the L1 reference block of the luma block, and the second reference block may be obtained by weighting the L0 reference block and the L1 reference block of the chroma block.

본 개시에 따른 영상 복호화/부호화 방법에 있어서, 상기 루마 블록에 양방향 예측이 적용된 경우, 상기 제1 참조 블록 및 상기 제2 참조 블록은, L0 방향의 참조 픽처 또는 L1 방향의 참조 픽처 중 적어도 하나로부터 유도되고, 비트스트림으로부터 복호화되는 예측 방향 정보에 기초하여, 상기 L0 방향 및 상기 L1 방향 중 적어도 하나가 선택될 수 있다.In the image decoding/encoding method according to the present disclosure, when bidirectional prediction is applied to the luma block, the first reference block and the second reference block are derived from at least one of a reference picture in the L0 direction or a reference picture in the L1 direction, and at least one of the L0 direction and the L1 direction can be selected based on prediction direction information decoded from a bitstream.

본 개시에 따른 영상 복호화/부호화 방법에 있어서, 상기 예측 파라미터는, 가중치 및 오프셋을 포함할 수 있다.In the image decoding/encoding method according to the present disclosure, the prediction parameters may include weights and offsets.

본 개시에 따른 영상 복호화/부호화 방법에 있어서, 상기 크로마 블록의 예측 샘플은, 상기 루마 블록 내 상기 예측 샘플의 위치에 대응되는 복원 샘플에 상기 가중치를 곱한 결과값에 상기 오프셋을 더하여 유도될 수 있다.In the image decoding/encoding method according to the present disclosure, the prediction sample of the chroma block can be derived by adding the offset to the result of multiplying the restoration sample corresponding to the position of the prediction sample in the luma block by the weight.

본 개시에 따른 영상 복호화/부호화 방법에 있어서, 상기 예측 파라미터는, 콘볼루션 필터를 위한 필터 계수들을 포함할 수 있다.In the image decoding/encoding method according to the present disclosure, the prediction parameter may include filter coefficients for a convolutional filter.

본 개시에 따른 영상 복호화/부호화 방법에 있어서, 상기 크로마 블록의 예측 샘플은, 상기 루마 블록 내 상기 예측 샘플의 위치에 대응되는 복원 샘플 및 상기 복원 샘플에 인접하는 적어도 하나의 이웃 샘플을 상기 콘볼루션 필터에 입력하여 유도될 수 있다.In the image decoding/encoding method according to the present disclosure, the prediction sample of the chroma block can be derived by inputting a restoration sample corresponding to a position of the prediction sample in the luma block and at least one neighboring sample adjacent to the restoration sample into the convolution filter.

본 개시에 따른 영상 복호화/부호화 방법에 있어서, 상기 예측 파라미터의 타입은, 복수의 예측 파라미터 타입 후보들 중 하나로 결정되고, 상기 복수의 예측 파라미터 타입 후보는, 가중치 및 오프셋을 포함하는 제1 예측 파라미터 후보 및 콘볼루션 필터의 필터 게수들을 포함하는 제2 예측 파라미터 후보를 포함할 수 있다.In the image decoding/encoding method according to the present disclosure, the type of the prediction parameter is determined as one of a plurality of prediction parameter type candidates, and the plurality of prediction parameter type candidates may include a first prediction parameter candidate including a weight and an offset and a second prediction parameter candidate including filter coefficients of a convolution filter.

본 개시에 따른 영상 복호화/부호화 방법에 있어서, 상기 루마 블록에 화면 내 블록 카피 모드가 적용된 경우, 상기 제1 참조 블록은 상기 루마 블록이 포함된 현재 루마 픽처로부터 유도되고, 상기 제2 참조 블록은 상기 크로마 블록이 포함된 현재 크로마 픽처로부터 유도될 수 있다.In the video decoding/encoding method according to the present disclosure, when the within-screen block copy mode is applied to the luma block, the first reference block may be derived from a current luma picture including the luma block, and the second reference block may be derived from a current chroma picture including the chroma block.

본 개시에 따른 영상 복호화/부호화 방법에 있어서, 상기 크로마 블록 내 서브 블록 단위로 상기 예측 파라미터가 유도될 수 있다. In the image decoding/encoding method according to the present disclosure, the prediction parameter can be derived for each sub-block within the chroma block.

본 개시에 의하면, 영상 부호화 방법에 의해 생성된 비트스트림을 저장하는 컴퓨터로 판독 가능한 기록 매체가 제공될 수 있다.According to the present disclosure, a computer-readable recording medium storing a bitstream generated by an image encoding method can be provided.

본 개시에 대하여 위에서 간략하게 요약된 특징들은 후술하는 본 개시의 상세한 설명의 예시적인 양상일 뿐이며, 본 개시의 범위를 제한하는 것은 아니다.The features briefly summarized above regarding the present disclosure are merely exemplary aspects of the detailed description of the present disclosure that follows and do not limit the scope of the present disclosure.

본 개시에 의하면, 루마 블록이 인터 예측으로 부호화된 경우에도, 색성분간 예측을 수행함으로써, 예측 정확도를 향상시킬 수 있는 효과가 있다.According to the present disclosure, even when a luma block is encoded with inter prediction, there is an effect of improving prediction accuracy by performing color component-specific prediction.

본 개시에 의하면, 기 복원된 루마 참조 블록 및 크로마 참조 블록을 기초로 예측 파라미터를 유도함으로써, 시그날링 오버헤드를 감소시킬 수 있다.According to the present disclosure, signaling overhead can be reduced by deriving prediction parameters based on previously restored luma reference blocks and chroma reference blocks.

본 개시에서 얻을 수 있는 효과는 이상에서 언급한 효과들로 제한되지 않으며, 언급하지 않은 또 다른 효과들은 아래의 기재로부터 본 개시가 속하는 기술분야에서 통상의 지식을 가진 자에게 명확하게 이해될 수 있을 것이다.The effects obtainable from the present disclosure are not limited to the effects mentioned above, and other effects not mentioned will be clearly understood by a person skilled in the art to which the present disclosure belongs from the description below.

도 1은 본 개시의 일실시예에 따른 영상 부호화 장치를 나타낸 블록도이다. FIG. 1 is a block diagram illustrating an image encoding device according to an embodiment of the present disclosure.

도 2는 본 개시의 일실시예에 따른 영상 복호화 장치를 나타낸 블록도이다.FIG. 2 is a block diagram illustrating an image decoding device according to an embodiment of the present disclosure.

도 3은 부호화기 및 복호화기에서 인터 예측을 수행하는 과정을 도식화한 도면이다.Figure 3 is a diagram schematically illustrating the process of performing inter prediction in an encoder and decoder.

도 4는 움직임 추정이 수행되는 예를 나타낸다. Figure 4 shows an example in which motion estimation is performed.

도 5 및 도 6은, 움직임 추정을 통해 생성된 움직임 정보를 기초로, 현재 블록의 예측 블록이 생성되는 예를 나타낸 것이다.Figures 5 and 6 illustrate examples in which a prediction block of a current block is generated based on motion information generated through motion estimation.

도 7은 움직임 벡터 예측값을 유도하기 위해 참조되는 위치를 나타낸다.Figure 7 shows the locations referenced to derive motion vector prediction values.

도 8은 템플릿 기반 움직임 추정 방법을 설명하기 위한 도면이다.Figure 8 is a diagram for explaining a template-based motion estimation method.

도 9는 템플릿의 구성 예들을 나타낸다.Figure 9 shows examples of template configurations.

도 10은 쌍방 매칭 방법을 기반의 움직임 추정 방법을 설명하기 위한 도면이다.Figure 10 is a diagram for explaining a motion estimation method based on a bilateral matching method.

도 11은 단방향 매칭 방법 기반의 움직임 추정 방법을 설명하기 위한 도면이다. Figure 11 is a diagram for explaining a motion estimation method based on a one-way matching method.

도 12 및 도 13은 움직임 벡터의 정밀도에 따라 예측 블록이 생성되는 예를 도시한 것이다.Figures 12 and 13 illustrate examples in which prediction blocks are generated according to the precision of a motion vector.

도 14는 현재 블록에 대해, 병진 모델 및 주밍 모델에 기반한 움직임 보상이 수행되는 예를 나타낸 것이다.Figure 14 shows an example in which motion compensation based on the translational model and the zooming model is performed for the current block.

도 15는 현재 블록에 대해, 병진 모델 및 회전 모델에 기반한 움직임 보상이 수행되는 예를 나타낸 것이다.Figure 15 shows an example in which motion compensation based on translational models and rotational models is performed for the current block.

도 16 및 도 17은 컨트롤 포인트 움직임 벡터들을 이용하여 현재 블록에 대한 예측 블록을 생성하는 예를 나타낸다.Figures 16 and 17 show examples of generating a prediction block for a current block using control point motion vectors.

도 18은 3개의 컨트롤 포인트 움직임 벡터들을 이용하여 현재 블록에 대한 예측 블록을 생성하는 예를 나타낸다.Figure 18 shows an example of generating a prediction block for the current block using three control point motion vectors.

도 19는 서브 블록 단위로 움직임 벡터가 유도되는 예를 나타낸 것이다.Figure 19 shows an example in which a motion vector is derived in sub-block units.

도 20 및 도 21은 SbTMVP가 적용되는 경우, 현재 블록 내 서브 블록 단위로 움직임 벡터가 유도되는 예를 나타낸 것이다.Figures 20 and 21 illustrate examples in which motion vectors are derived for each sub-block within the current block when SbTMVP is applied.

도 22 및 도 23은 움직임 벡터 정밀도에 따라 예측 블록이 유도되는 예를 나타낸 도면이다. Figures 22 and 23 are diagrams showing examples in which prediction blocks are derived according to motion vector precision.

도 24 및 도 25는 각각 AMVR 방식이 적용되는 경우, 움직임 벡터 차분값을 부호화하는 과정 및 복호화하는 과정을 설명하기 위한 도면이다. Figures 24 and 25 are diagrams for explaining the process of encoding and decoding a motion vector difference value, respectively, when the AMVR method is applied.

도 26은 예측 파라미터에 기반한 색성분간 예측 방법의 흐름도를 나타낸 것이다.Figure 26 shows a flow chart of a color component prediction method based on prediction parameters.

도 27 및 도 28은 예측 파라미터에 기반한 색성분간 예측 방법에 따른, 부/복호화기의 동작을 나타낸 것이다. Figures 27 and 28 illustrate the operation of the encoder/decoder according to a color component prediction method based on prediction parameters.

도 29는 복수의 예측 파라미터 후보들 중 하나를 선택하여 크로마 블록을 예측하는 예를 도시한 것이다. Figure 29 illustrates an example of predicting a chroma block by selecting one of multiple prediction parameter candidates.

도 30은 색차 성분에 대한 예측 파라미터를 유도하는 예를 나타낸 것이다.Figure 30 shows an example of deriving prediction parameters for color difference components.

도 31은 서브 샘플링된 위치를 나타낸 것이다.Figure 31 shows the sub-sampled locations.

도 32는 콘볼루션 필터를 이용하여 예측 파라미터를 유도하는 예를 나타낸 것이다. Figure 32 shows an example of deriving prediction parameters using a convolution filter.

도 33은 콘볼루션 필터의 형태를 나타낸다. Figure 33 shows the form of a convolution filter.

도 34는 예측 파라미터에 기반한 색성분간 예측 방법이 서브 블록 단위로 수행되는 예를 설명하기 위한 도면이다. Figure 34 is a diagram for explaining an example in which a color component discrimination prediction method based on prediction parameters is performed on a sub-block basis.

본 개시는 다양한 변경을 가할 수 있고 여러 가지 실시예를 가질 수 있는 바, 특정 실시예들을 도면에 예시하고 상세한 설명에 상세하게 설명하고자 한다. 그러나, 이는 본 개시를 특정한 실시 형태에 대해 한정하려는 것이 아니며, 본 개시의 사상 및 기술 범위에 포함되는 모든 변경, 균등물 내지 대체물을 포함하는 것으로 이해되어야 한다. 각 도면을 설명하면서 유사한 참조부호를 유사한 구성요소에 대해 사용하였다.The present disclosure may have various modifications and various embodiments, and thus specific embodiments are illustrated in the drawings and described in detail in the detailed description. However, this is not intended to limit the present disclosure to specific embodiments, but should be understood to include all modifications, equivalents, or substitutes included in the spirit and technical scope of the present disclosure. In describing each drawing, similar reference numerals are used for similar components.

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

어떤 구성요소가 다른 구성요소에 "연결되어" 있다거나 "접속되어"있다고 언급된 때에는, 그 다른 구성요소에 직접적으로 연결되어 있거나 또는 접속되어 있을 수도 있지만, 중간에 다른 구성요소가 존재할 수도 있다고 이해되어야 할 것이다. 반면에, 어떤 구성요소가 다른 구성요소에 "직접 연결되어"있다거나 "직접 접속되어"있다고 언급된 때에는, 중간에 다른 구성요소가 존재하지 않는 것으로 이해되어야 할 것이다.When it is said that a component is "connected" or "connected" to another component, it should be understood that it may be directly connected or connected to that other component, but that there may be other components in between. On the other hand, when it is said that a component is "directly connected" or "directly connected" to another component, it should be understood that there are no other components in between.

본 출원에서 사용한 용어는 단지 특정한 실시예를 설명하기 위해 사용된 것으로, 본 개시를 한정하려는 의도가 아니다. 단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한, 복수의 표현을 포함한다. 본 출원에서, "포함하다" 또는 "가지다" 등의 용어는 명세서상에 기재된 특징, 숫자, 단계, 동작, 구성요소, 부품 또는 이들을 조합한 것이 존재함을 지정하려는 것이지, 하나 또는 그 이상의 다른 특징들이나 숫자, 단계, 동작, 구성요소, 부품 또는 이들을 조합한 것들의 존재 또는 부가 가능성을 미리 배제하지 않는 것으로 이해되어야 한다.The terminology used in this application is only used to describe specific embodiments and is not intended to limit the present disclosure. The singular expression includes the plural expression unless the context clearly indicates otherwise. In this application, it should be understood that the terms "comprises" or "has" and the like are intended to specify the presence of a feature, number, step, operation, component, part or combination thereof described in the specification, but do not exclude in advance the possibility of the presence or addition of one or more other features, numbers, steps, operations, components, parts or combinations thereof.

이하, 첨부한 도면들을 참조하여, 본 개시의 바람직한 실시예를 보다 상세하게 설명하고자 한다. 이하, 도면상의 동일한 구성요소에 대해서는 동일한 참조부호를 사용하고 동일한 구성요소에 대해서 중복된 설명은 생략한다.Hereinafter, with reference to the attached drawings, preferred embodiments of the present disclosure will be described in more detail. Hereinafter, the same reference numerals are used for the same components in the drawings, and redundant descriptions of the same components are omitted.

도 1은 본 개시의 일실시예에 따른 영상 부호화 장치를 나타낸 블록도이다. FIG. 1 is a block diagram illustrating an image encoding device according to an embodiment of the present disclosure.

도 1을 참조하면, 영상 부호화 장치(100)는 픽쳐 분할부(110), 예측부(120, 125), 변환부(130), 양자화부(135), 재정렬부(160), 엔트로피 부호화부(165), 역양자화부(140), 역변환부(145), 필터부(150) 및 메모리(155)를 포함할 수 있다.Referring to FIG. 1, a video encoding device (100) may include a picture segmentation unit (110), a prediction unit (120, 125), a transformation unit (130), a quantization unit (135), a reordering unit (160), an entropy encoding unit (165), an inverse quantization unit (140), an inverse transformation unit (145), a filter unit (150), and a memory (155).

도 1에 나타난 각 구성부들은 영상 부호화 장치에서 서로 다른 특징적인 기능들을 나타내기 위해 독립적으로 도시한 것으로, 각 구성부들이 분리된 하드웨어나 하나의 소프트웨어 구성단위로 이루어짐을 의미하지 않는다. 즉, 각 구성부는 설명의 편의상 각각의 구성부로 나열하여 포함한 것으로 각 구성부 중 적어도 두 개의 구성부가 합쳐져 하나의 구성부로 이루어지거나, 하나의 구성부가 복수개의 구성부로 나뉘어져 기능을 수행할 수 있고 이러한 각 구성부의 통합된 실시예 및 분리된 실시예도 본 개시의 본질에서 벗어나지 않는 한 본 개시의 권리범위에 포함된다.Each component shown in FIG. 1 is independently illustrated to indicate different characteristic functions in the image encoding device, and does not mean that each component is composed of separate hardware or a single software configuration unit. That is, each component is listed and included as a separate component for convenience of explanation, and at least two components among each component may be combined to form a single component, or one component may be divided into multiple components to perform a function, and such integrated and separated embodiments of each component are also included in the scope of the present disclosure as long as they do not deviate from the essence of the present disclosure.

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

픽쳐 분할부(110)는 입력된 픽쳐를 적어도 하나의 처리 단위로 분할할 수 있다. 이때, 처리 단위는 예측 단위(Prediction Unit: PU)일 수도 있고, 변환 단위(Transform Unit: TU)일 수도 있으며, 부호화 단위(Coding Unit: CU)일 수도 있다. 픽쳐 분할부(110)에서는 하나의 픽쳐에 대해 복수의 부호화 단위, 예측 단위 및 변환 단위의 조합으로 분할하고 소정의 기준(예를 들어, 비용 함수)으로 하나의 부호화 단위, 예측 단위 및 변환 단위 조합을 선택하여 픽쳐를 부호화 할 수 있다.The picture splitting unit (110) can split an input picture into at least one processing unit. At this time, the processing unit may be a prediction unit (PU), a transform unit (TU), or a coding unit (CU). The picture splitting unit (110) can split one picture into a combination of multiple coding units, prediction units, and transform units, and select one combination of coding units, prediction units, and transform units based on a predetermined criterion (e.g., a cost function) to encode the picture.

예를 들어, 하나의 픽쳐는 복수개의 부호화 단위로 분할될 수 있다. 픽쳐에서 부호화 단위를 분할하기 위해서는 쿼드 트리(Quad Tree), 터너리 트리 (Ternary Tree), 또는 바이너리 트리(Binary Tree) 와 같은 재귀적인 트리 구조를 사용할 수 있는데 하나의 영상 또는 최대 크기 부호화 단위(largest coding unit)를 루트로 하여 다른 부호화 단위로 분할되는 부호화 유닛은 분할된 부호화 단위의 개수만큼의 자식 노드를 가지고 분할될 수 있다. 일정한 제한에 따라 더 이상 분할되지 않는 부호화 단위는 리프 노드가 된다. 일 예로, 하나의 코딩 유닛에 대해 쿼드 트리 분할이 적용되는 것으로 가정하는 경우, 하나의 부호화 단위는 최대 4개의 다른 부호화 단위로 분할될 수 있다.For example, a picture can be split into multiple coding units. In order to split a coding unit in a picture, a recursive tree structure such as a quad tree, a ternary tree, or a binary tree can be used. A coding unit that is split into other coding units with one image or the largest coding unit as the root can be split with as many child nodes as the number of split coding units. A coding unit that cannot be split any further according to a certain restriction becomes a leaf node. For example, assuming that a quad tree split is applied to a coding unit, a coding unit can be split into at most four different coding units.

이하, 본 개시의 실시예에서는 부호화 단위는 부호화를 수행하는 단위의 의미로 사용할 수도 있고, 복호화를 수행하는 단위의 의미로 사용할 수도 있다.Hereinafter, in the embodiments of the present disclosure, the encoding unit may be used to mean a unit that performs encoding, or may be used to mean a unit that performs decoding.

예측 단위는 하나의 부호화 단위 내에서 동일한 크기의 적어도 하나의 정사각형 또는 직사각형 등의 형태를 가지고 분할된 것일 수도 있고, 하나의 부호화 단위 내에서 분할된 예측 단위 중 어느 하나의 예측 단위가 다른 하나의 예측 단위와 상이한 형태 및/또는 크기를 가지도록 분할된 것일 수도 있다.A prediction unit may be divided into at least one square or rectangular shape of the same size within one coding unit, or may be divided such that one prediction unit among the divided prediction units within one coding unit has a different shape and/or size from another prediction unit.

화면내 예측시, 변환 단위와 예측 단위가 동일하게 설정될 수 있다. 이때, 부호화 유닛을 복수의 변환 단위들로 분할한 뒤, 각 변환 단위마다 화면내 예측을 수행할 수도 있다. 부호화 유닛은, 수평 방향 또는 수직 방향으로 분할될 수 있다. 부호화 단위를 분할하여 생성되는 변환 단위들의 개수는 부호화 단위의 크기에 따라, 2개 또는 4개일 수 있다.In the case of intra-screen prediction, the transformation unit and the prediction unit can be set to be the same. At this time, the encoding unit can be divided into multiple transformation units, and then intra-screen prediction can be performed for each transformation unit. The encoding unit can be divided in the horizontal direction or the vertical direction. The number of transformation units generated by dividing the encoding unit can be 2 or 4, depending on the size of the encoding unit.

예측부(120, 125)는 화면간 예측을 수행하는 화면간 예측부(120)와 화면내 예측을 수행하는 화면내 예측부(125)를 포함할 수 있다. 부호화 단위에 대해 화면간 예측을 사용할 것인지 또는 화면내 예측을 수행할 것인지를 결정하고, 각 예측 방법에 따른 구체적인 정보(예컨대, 화면내 예측 모드, 움직임 벡터, 참조 픽쳐 등)를 결정할 수 있다. 이때, 예측이 수행되는 처리 단위와 예측 방법 및 구체적인 내용이 정해지는 처리 단위는 다를 수 있다. 예컨대, 예측의 방법과 예측 모드 등은 부호화 단위로 결정되고, 예측의 수행은 예측 단위 또는 변환 단위로 수행될 수도 있다. 생성된 예측 블록과 원본 블록 사이의 잔차값(잔차 블록)은 변환부(130)로 입력될 수 있다. 또한, 예측을 위해 사용한 예측 모드 정보, 움직임 벡터 정보 등은 잔차값과 함께 엔트로피 부호화부(165)에서 부호화되어 복호화 장치에 전달될 수 있다. 특정한 부호화 모드를 사용할 경우, 예측부(120, 125)를 통해 예측 블록을 생성하지 않고, 원본 블록을 그대로 부호화하여 복호화부에 전송하는 것도 가능하다.The prediction unit (120, 125) may include an inter-prediction unit (120) that performs inter-prediction and an intra-prediction unit (125) that performs intra-prediction. It may be determined whether to use inter-prediction or intra-prediction for an encoding unit, and specific information (e.g., intra-prediction mode, motion vector, reference picture, etc.) according to each prediction method may be determined. At this time, the processing unit where the prediction is performed and the processing unit where the prediction method and specific contents are determined may be different. For example, the prediction method and prediction mode, etc. are determined in the encoding unit, and the prediction may be performed in the prediction unit or the transformation unit. The residual value (residual block) between the generated prediction block and the original block may be input to the transformation unit (130). In addition, the prediction mode information, motion vector information, etc. used for the prediction may be encoded together with the residual value in the entropy encoding unit (165) and transmitted to the decoding device. When using a specific encoding mode, it is also possible to encode the original block as is and transmit it to the decoding unit without generating a prediction block through the prediction unit (120, 125).

화면간 예측부(120)는 현재 픽쳐의 이전 픽쳐 또는 이후 픽쳐 중 적어도 하나의 픽쳐의 정보를 기초로 예측 단위를 예측할 수도 있고, 경우에 따라서는 현재 픽쳐 내의 부호화가 완료된 일부 영역의 정보를 기초로 예측 단위를 예측할 수도 있다. 화면간 예측부(120)는 참조 픽쳐 보간부, 움직임 예측부, 움직임 보상부를 포함할 수 있다. The inter-screen prediction unit (120) may predict a prediction unit based on information of at least one picture among the previous picture or the subsequent picture of the current picture, and in some cases, may predict a prediction unit based on information of a part of an encoded region within the current picture. The inter-screen prediction unit (120) may include a reference picture interpolation unit, a motion prediction unit, and a motion compensation unit.

참조 픽쳐 보간부에서는 메모리(155)로부터 참조 픽쳐 정보를 제공받고 참조 픽쳐에서 정수 화소 이하의 화소 정보를 생성할 수 있다. 휘도 화소의 경우, 1/4 화소 단위로 정수 화소 이하의 화소 정보를 생성하기 위해 필터 계수를 달리하는 DCT 기반의 8탭 보간 필터(DCT-based Interpolation Filter)가 사용될 수 있다. 색차 신호의 경우 1/8 화소 단위로 정수 화소 이하의 화소 정보를 생성하기 위해 필터 계수를 달리하는 DCT 기반의 4탭 보간 필터(DCT-based Interpolation Filter)가 사용될 수 있다.The reference picture interpolation unit can receive reference picture information from the memory (155) and generate pixel information below an integer pixel from the reference picture. In the case of luminance pixels, a DCT-based 8-tap interpolation filter (DCT-based Interpolation Filter) with different filter coefficients can be used to generate pixel information below an integer pixel in units of 1/4 pixels. In the case of a chrominance signal, a DCT-based 4-tap interpolation filter (DCT-based Interpolation Filter) with different filter coefficients can be used to generate pixel information below an integer pixel in units of 1/8 pixels.

움직임 예측부는 참조 픽쳐 보간부에 의해 보간된 참조 픽쳐를 기초로 움직임 예측을 수행할 수 있다. 움직임 벡터를 산출하기 위한 방법으로 FBMA(Full search-based Block Matching Algorithm), TSS(Three Step Search), NTS(New Three-Step Search Algorithm) 등 다양한 방법이 사용될 수 있다. 움직임 벡터는 보간된 화소를 기초로 1/2 또는 1/4 화소 단위의 움직임 벡터값을 가질 수 있다. 움직임 예측부에서는 움직임 예측 방법을 다르게 하여 현재 예측 단위를 예측할 수 있다. 움직임 예측 방법으로 스킵(Skip) 방법, 머지(Merge) 방법, AMVP(Advanced Motion Vector Prediction) 방법, 화면내 블록 카피(Intra Block Copy) 방법 등 다양한 방법이 사용될 수 있다.The motion prediction unit can perform motion prediction based on a reference picture interpolated by the reference picture interpolation unit. Various methods such as FBMA (Full search-based Block Matching Algorithm), TSS (Three Step Search), and NTS (New Three-Step Search Algorithm) can be used to derive a motion vector. The motion vector can have a motion vector value of 1/2 or 1/4 pixel unit based on the interpolated pixel. The motion prediction unit can predict the current prediction unit by using a different motion prediction method. Various methods such as the Skip method, the Merge method, the AMVP (Advanced Motion Vector Prediction) method, and the Intra Block Copy method can be used as the motion prediction method.

화면내 예측부(125)는 현재 픽쳐 내의 화소 정보인 참조 픽셀 정보를 기초로 예측 블록을 생성할 수 있다. 복수의 참조 픽셀 라인들 중 선택된 하나로부터 참조 픽셀 정보를 유도할 수 있다. 복수의 참조 픽셀 라인들 중 N번째 참조 픽셀 라인은, 현재 블록 내 좌상단 픽셀과의 x축 차분이 N인 좌측 픽셀들 및 상기 좌상단 픽셀과의 y축 차분이 N인 상단 픽셀들을 포함할 수 있다. 현재 블록이 선택할 수 있는 참조 픽셀 라인들의 개수는, 1개, 2개, 3개 또는 4개일 수 있다.The prediction unit (125) within the screen can generate a prediction block based on reference pixel information, which is pixel information within the current picture. The reference pixel information can be derived from one selected from among a plurality of reference pixel lines. The Nth reference pixel line among the plurality of reference pixel lines can include left pixels having an x-axis difference of N from the upper left pixel within the current block and upper pixels having a y-axis difference of N from the upper left pixel. The number of reference pixel lines that the current block can select can be 1, 2, 3, or 4.

현재 예측 단위의 주변 블록이 화면간 예측을 수행한 블록이어서, 참조 픽셀이 화면간 예측을 수행한 픽셀일 경우, 화면간 예측을 수행한 블록에 포함되는 참조 픽셀을 주변의 화면내 예측을 수행한 블록의 참조 픽셀 정보로 대체하여 사용할 수 있다. 즉, 참조 픽셀이 가용하지 않는 경우, 가용하지 않은 참조 픽셀 정보를 가용한 참조 픽셀들 중 적어도 하나의 정보로 대체하여 사용할 수 있다.If the surrounding blocks of the current prediction unit are blocks that have performed inter-screen prediction and the reference pixel is a pixel that has performed inter-screen prediction, the reference pixel included in the block that has performed inter-screen prediction can be replaced and used with reference pixel information of the surrounding blocks that have performed intra-screen prediction. That is, if the reference pixel is unavailable, the unavailable reference pixel information can be replaced and used with information on at least one of the available reference pixels.

화면내 예측에서 예측 모드는 참조 픽셀 정보를 예측 방향에 따라 사용하는 방향성 예측 모드와 예측을 수행시 방향성 정보를 사용하지 않는 비방향성 모드를 가질 수 있다. 휘도 정보를 예측하기 위한 모드와 색차 정보를 예측하기 위한 모드가 상이할 수 있고, 색차 정보를 예측하기 위해 휘도 정보를 예측하기 위해 사용된 화면내 예측 모드 정보 또는 예측된 휘도 신호 정보를 활용할 수 있다.In intra-screen prediction, the prediction mode can have a directional prediction mode that uses reference pixel information according to the prediction direction, and a non-directional mode that does not use directional information when performing prediction. The mode for predicting luminance information and the mode for predicting chrominance information can be different, and the intra-screen prediction mode information used to predict luminance information or the predicted luminance signal information can be utilized to predict chrominance information.

화면내 예측을 수행할 때 예측 단위의 크기와 변환 단위의 크기가 동일할 경우, 예측 단위의 좌측에 존재하는 픽셀, 좌측 상단에 존재하는 픽셀, 상단에 존재하는 픽셀을 기초로 예측 단위에 대한 화면내 예측을 수행할 수 있다. When performing intra-screen prediction, if the size of the prediction unit and the size of the transformation unit are the same, intra-screen prediction for the prediction unit can be performed based on the pixels on the left side of the prediction unit, the pixels on the upper left side, and the pixels on the top.

화면내 예측 방법은 예측 모드에 따라 참조 화소에 스무딩(Smoothing) 필터를 적용한 후 예측 블록을 생성할 수 있다. 선택된 참조 픽셀 라인에 따라, 스무딩 필터의 적용 여부가 결정될 수 있다. The on-screen prediction method can generate a prediction block after applying a smoothing filter to reference pixels according to the prediction mode. Depending on the selected reference pixel line, whether or not to apply the smoothing filter can be determined.

화면내 예측 방법을 수행하기 위해 현재 예측 단위의 화면내 예측 모드는 현재 예측 단위의 주변에 존재하는 예측 단위의 화면내 예측 모드로부터 예측할 수 있다. 주변 예측 단위로부터 예측된 모드 정보를 이용하여 현재 예측 단위의 예측 모드를 예측하는 경우, 현재 예측 단위와 주변 예측 단위의 화면내 예측 모드가 동일하면 소정의 플래그 정보를 이용하여 현재 예측 단위와 주변 예측 단위의 예측 모드가 동일하다는 정보를 전송할 수 있고, 만약 현재 예측 단위와 주변 예측 단위의 예측 모드가 상이하면 엔트로피 부호화를 수행하여 현재 블록의 예측 모드 정보를 부호화할 수 있다.In order to perform an intra-screen prediction method, the intra-screen prediction mode of the current prediction unit can be predicted from the intra-screen prediction modes of prediction units existing in the vicinity of the current prediction unit. When the prediction mode of the current prediction unit is predicted using mode information predicted from the surrounding prediction units, if the intra-screen prediction modes of the current prediction unit and the surrounding prediction units are the same, information indicating that the prediction modes of the current prediction unit and the surrounding prediction units are the same can be transmitted using predetermined flag information, and if the prediction modes of the current prediction unit and the surrounding prediction units are different, entropy encoding can be performed to encode the prediction mode information of the current block.

또한, 예측부(120, 125)에서 생성된 예측 단위를 기초로 예측을 수행한 예측 단위와 예측 단위의 원본 블록과 차이값인 잔차값(Residual) 정보를 포함하는 잔차 블록이 생성될 수 있다. 생성된 잔차 블록은 변환부(130)로 입력될 수 있다. In addition, a residual block including residual value information, which is a difference value between the prediction unit that performed the prediction and the original block of the prediction unit based on the prediction unit generated in the prediction unit (120, 125), can be generated. The generated residual block can be input to the transformation unit (130).

변환부(130)에서는 원본 블록과 예측부(120, 125)를 통해 생성된 예측 단위의 잔차값(residual)정보를 포함한 잔차 블록을 DCT(Discrete Cosine Transform), DST(Discrete Sine Transform), KLT와 같은 변환 방법을 사용하여 변환시킬 수 있다. 잔차 블록을 변환하기 위해 DCT를 적용할지, DST를 적용할지 또는 KLT를 적용할지는, 변환 단위의 크기, 변환 단위의 형태, 예측 단위의 예측 모드 또는 예측 단위의 화면내 예측 모드 정보 중 적어도 하나를 기초로 결정할 수 있다. In the transformation unit (130), the residual block including the residual value information of the prediction unit generated through the original block and the prediction unit (120, 125) can be transformed using a transformation method such as DCT (Discrete Cosine Transform), DST (Discrete Sine Transform), or KLT. Whether to apply DCT, DST, or KLT to transform the residual block can be determined based on at least one of the size of the transformation unit, the shape of the transformation unit, the prediction mode of the prediction unit, or the prediction mode information within the screen of the prediction unit.

양자화부(135)는 변환부(130)에서 주파수 영역으로 변환된 값들을 양자화할 수 있다. 블록에 따라 또는 영상의 중요도에 따라 양자화 계수는 변할 수 있다. 양자화부(135)에서 산출된 값은 역양자화부(140)와 재정렬부(160)에 제공될 수 있다.The quantization unit (135) can quantize the values converted to the frequency domain in the transformation unit (130). The quantization coefficients can vary depending on the block or the importance of the image. The values produced by the quantization unit (135) can be provided to the dequantization unit (140) and the reordering unit (160).

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

재정렬부(160)는 계수 스캐닝(Coefficient Scanning) 방법을 통해 2차원의 블록 형태 계수를 1차원의 벡터 형태로 변경할 수 있다. 예를 들어, 재정렬부(160)에서는 지그-재그 스캔(Zig-Zag Scan)방법을 이용하여 DC 계수부터 고주파수 영역의 계수까지 스캔하여 1차원 벡터 형태로 변경시킬 수 있다. 변환 단위의 크기 및 화면내 예측 모드에 따라 지그-재그 스캔 대신 2차원의 블록 형태 계수를 열 방향으로 스캔하는 수직 스캔, 2차원의 블록 형태 계수를 행 방향으로 스캔하는 수평 스캔, 또는 2차원의 블록 형태 계수를 대각 방향으로 스캔하는 대각 스캔이 사용될 수도 있다. 즉, 변환 단위의 크기 및 화면내 예측 모드에 따라 지그-재그 스캔, 수직 방향 스캔, 수평 방향 스캔 또는 대각 스캔 중 어떠한 스캔 방법이 사용될지 여부를 결정할 수 있다.The rearrangement unit (160) can change a two-dimensional block-shaped coefficient into a one-dimensional vector form through a coefficient scanning method. For example, the rearrangement unit (160) can change the two-dimensional block-shaped coefficient into a one-dimensional vector form by scanning from the DC coefficient to the coefficient of the high-frequency region using a zig-zag scan method. Depending on the size of the conversion unit and the prediction mode within the screen, a vertical scan that scans the two-dimensional block-shaped coefficient in the column direction, a horizontal scan that scans the two-dimensional block-shaped coefficient in the row direction, or a diagonal scan that scans the two-dimensional block-shaped coefficient in the diagonal direction may be used instead of the zig-zag scan. That is, depending on the size of the conversion unit and the prediction mode within the screen, it is possible to determine which scan method among the zig-zag scan, the vertical scan, the horizontal scan, or the diagonal scan is used.

엔트로피 부호화부(165)는 재정렬부(160)에 의해 산출된 값들을 기초로 엔트로피 부호화를 수행할 수 있다. 엔트로피 부호화는 예를 들어, 지수 골롬(Exponential Golomb), CAVLC(Context-Adaptive Variable Length Coding), CABAC(Context-Adaptive Binary Arithmetic Coding)과 같은 다양한 부호화 방법을 사용할 수 있다. The entropy encoding unit (165) can perform entropy encoding based on the values produced by the rearrangement unit (160). Entropy encoding can use various encoding methods such as, for example, Exponential Golomb, CAVLC (Context-Adaptive Variable Length Coding), and CABAC (Context-Adaptive Binary Arithmetic Coding).

엔트로피 부호화부(165)는 재정렬부(160) 및 예측부(120, 125)로부터 부호화 단위의 잔차값 계수 정보 및 블록 타입 정보, 예측 모드 정보, 분할 단위 정보, 예측 단위 정보 및 전송 단위 정보, 움직임 벡터 정보, 참조 프레임 정보, 블록의 보간 정보, 필터링 정보 등 다양한 정보를 부호화할 수 있다. The entropy encoding unit (165) can encode various information such as residual value coefficient information of an encoding unit, block type information, prediction mode information, division unit information, prediction unit information, transmission unit information, motion vector information, reference frame information, block interpolation information, and filtering information from the rearrangement unit (160) and the prediction unit (120, 125).

엔트로피 부호화부(165)에서는 재정렬부(160)에서 입력된 부호화 단위의 계수값을 엔트로피 부호화할 수 있다.The entropy encoding unit (165) can entropy encode the coefficient values of the encoding unit input from the rearrangement unit (160).

역양자화부(140) 및 역변환부(145)에서는 양자화부(135)에서 양자화된 값들을 역양자화하고 변환부(130)에서 변환된 값들을 역변환한다. 역양자화부(140) 및 역변환부(145)에서 생성된 잔차값(Residual)은 예측부(120, 125)에 포함된 움직임 추정부, 움직임 보상부 및 화면내 예측부를 통해서 예측된 예측 단위와 합쳐져 복원 블록(Reconstructed Block)을 생성할 수 있다. In the inverse quantization unit (140) and the inverse transformation unit (145), the values quantized in the quantization unit (135) are inversely quantized and the values transformed in the transformation unit (130) are inversely transformed. The residual values generated in the inverse quantization unit (140) and the inverse transformation unit (145) can be combined with the predicted prediction units predicted through the motion estimation unit, motion compensation unit, and intra-screen prediction unit included in the prediction unit (120, 125) to generate a reconstructed block.

필터부(150)는 디블록킹 필터, 오프셋 보정부, ALF(Adaptive Loop Filter)중 적어도 하나를 포함할 수 있다.The filter unit (150) may include at least one of a deblocking filter, an offset correction unit, and an ALF (Adaptive Loop Filter).

디블록킹 필터는 복원된 픽쳐에서 블록간의 경계로 인해 생긴 블록 왜곡을 제거할 수 있다. 디블록킹을 수행할지 여부를 판단하기 위해 블록에 포함된 몇 개의 열 또는 행에 포함된 픽셀을 기초로 현재 블록에 디블록킹 필터 적용할지 여부를 판단할 수 있다. 블록에 디블록킹 필터를 적용하는 경우 필요한 디블록킹 필터링 강도에 따라 강한 필터(Strong Filter) 또는 약한 필터(Weak Filter)를 적용할 수 있다. 또한 디블록킹 필터를 적용함에 있어 수직 필터링 및 수평 필터링 수행시 수평 방향 필터링 및 수직 방향 필터링이 병행 처리되도록 할 수 있다.A deblocking filter can remove block distortion caused by boundaries between blocks in a restored picture. In order to determine whether to perform deblocking, it is possible to determine whether to apply a deblocking filter to the current block based on pixels included in several columns or rows included in the block. When applying a deblocking filter to a block, a strong filter or a weak filter can be applied depending on the required deblocking filtering strength. In addition, when applying a deblocking filter, horizontal filtering and vertical filtering can be processed in parallel when performing vertical filtering and horizontal filtering.

오프셋 보정부는 디블록킹을 수행한 영상에 대해 픽셀 단위로 원본 영상과의 오프셋을 보정할 수 있다. 특정 픽쳐에 대한 오프셋 보정을 수행하기 위해 영상에 포함된 픽셀을 일정한 수의 영역으로 구분한 후 오프셋을 수행할 영역을 결정하고 해당 영역에 오프셋을 적용하는 방법 또는 각 픽셀의 에지 정보를 고려하여 오프셋을 적용하는 방법을 사용할 수 있다.The offset correction unit can correct the offset from the original image on a pixel basis for the image on which deblocking has been performed. In order to perform offset correction for a specific picture, a method can be used in which the pixels included in the image are divided into a certain number of regions, the regions to be offset are determined, and the offset is applied to the regions, or a method can be used in which the offset is applied by considering the edge information of each pixel.

ALF(Adaptive Loop Filtering)는 필터링한 복원 영상과 원래의 영상을 비교한 값을 기초로 수행될 수 있다. 영상에 포함된 픽셀을 소정의 그룹으로 나눈 후 해당 그룹에 적용될 하나의 필터를 결정하여 그룹마다 차별적으로 필터링을 수행할 수 있다. ALF를 적용할지 여부에 관련된 정보는 휘도 신호는 부호화 단위(Coding Unit, CU) 별로 전송될 수 있고, 각각의 블록에 따라 적용될 ALF 필터의 모양 및 필터 계수는 달라질 수 있다. 또한, 적용 대상 블록의 특성에 상관없이 동일한 형태(고정된 형태)의 ALF 필터가 적용될 수도 있다. Adaptive Loop Filtering (ALF) can be performed based on the value compared between the filtered restored image and the original image. After dividing the pixels included in the image into a predetermined group, one filter to be applied to the group is determined, and filtering can be performed differentially for each group. Information related to whether to apply ALF can be transmitted by luminance signal for each coding unit (CU), and the shape and filter coefficient of the ALF filter to be applied can be different for each block. In addition, the same shape (fixed shape) of the ALF filter can be applied regardless of the characteristics of the target block.

메모리(155)는 필터부(150)를 통해 산출된 복원 블록 또는 픽쳐를 저장할 수 있고, 저장된 복원 블록 또는 픽쳐는 화면간 예측을 수행 시 예측부(120, 125)에 제공될 수 있다.The memory (155) can store a restored block or picture produced through the filter unit (150), and the stored restored block or picture can be provided to the prediction unit (120, 125) when performing inter-screen prediction.

도 2는 본 개시의 일실시예에 따른 영상 복호화 장치를 나타낸 블록도이다.FIG. 2 is a block diagram illustrating an image decoding device according to an embodiment of the present disclosure.

도 2를 참조하면, 영상 복호화 장치(200)는 엔트로피 복호화부(210), 재정렬부(215), 역양자화부(220), 역변환부(225), 예측부(230, 235), 필터부(240), 메모리(245)가 포함될 수 있다.Referring to FIG. 2, the image decoding device (200) may include an entropy decoding unit (210), a reordering unit (215), an inverse quantization unit (220), an inverse transformation unit (225), a prediction unit (230, 235), a filter unit (240), and a memory (245).

영상 부호화 장치에서 영상 비트스트림이 입력된 경우, 입력된 비트스트림은 영상 부호화 장치와 반대의 절차로 복호화될 수 있다.When a video bitstream is input from a video encoding device, the input bitstream can be decoded in the opposite procedure to that of the video encoding device.

엔트로피 복호화부(210)는 영상 부호화 장치의 엔트로피 부호화부에서 엔트로피 부호화를 수행한 것과 반대의 절차로 엔트로피 복호화를 수행할 수 있다. 예를 들어, 영상 부호화 장치에서 수행된 방법에 대응하여 지수 골롬(Exponential Golomb), CAVLC(Context-Adaptive Variable Length Coding), CABAC(Context-Adaptive Binary Arithmetic Coding)과 같은 다양한 방법이 적용될 수 있다. The entropy decoding unit (210) can perform entropy decoding in a procedure opposite to that of performing entropy encoding in the entropy encoding unit of the video encoding device. For example, various methods such as Exponential Golomb, CAVLC (Context-Adaptive Variable Length Coding), and CABAC (Context-Adaptive Binary Arithmetic Coding) can be applied in response to the method performed in the video encoding device.

엔트로피 복호화부(210)에서는 부호화 장치에서 수행된 화면내 예측 및 화면간 예측에 관련된 정보를 복호화할 수 있다.The entropy decoding unit (210) can decode information related to intra-screen prediction and inter-screen prediction performed in the encoding device.

재정렬부(215)는 엔트로피 복호화부(210)에서 엔트로피 복호화된 비트스트림을 부호화부에서 재정렬한 방법을 기초로 재정렬을 수행할 수 있다. 1차원 벡터 형태로 표현된 계수들을 다시 2차원의 블록 형태의 계수로 복원하여 재정렬할 수 있다. 재정렬부(215)에서는 부호화부에서 수행된 계수 스캐닝에 관련된 정보를 제공받고 해당 부호화부에서 수행된 스캐닝 순서에 기초하여 역으로 스캐닝하는 방법을 통해 재정렬을 수행할 수 있다.The reordering unit (215) can perform reordering based on the method in which the bitstream that has been entropy-decoded by the entropy decoding unit (210) is reordered by the encoding unit. The coefficients expressed in the form of a one-dimensional vector can be re-restored into coefficients in the form of a two-dimensional block and reordered. The reordering unit (215) can perform reordering by receiving information related to the coefficient scanning performed by the encoding unit and performing reverse scanning based on the scanning order performed by the corresponding encoding unit.

역양자화부(220)는 부호화 장치에서 제공된 양자화 파라미터와 재정렬된 블록의 계수값을 기초로 역양자화를 수행할 수 있다. The inverse quantization unit (220) can perform inverse quantization based on the quantization parameters provided from the encoding device and the coefficient values of the rearranged block.

역변환부(225)는 영상 부호화 장치에서 수행한 양자화 결과에 대해 변환부에서 수행한 변환 즉, DCT, DST, 및 KLT에 대해 역변환 즉, 역 DCT, 역 DST 및 역 KLT를 수행할 수 있다. 역변환은 영상 부호화 장치에서 결정된 전송 단위를 기초로 수행될 수 있다. 영상 복호화 장치의 역변환부(225)에서는 예측 방법, 현재 블록의 크기, 형태, 예측 모드 및 화면내 예측 방향 등 복수의 정보에 따라 변환 기법(예를 들어, DCT, DST, KLT)이 선택적으로 수행될 수 있다.The inverse transform unit (225) can perform inverse transform, i.e., inverse DCT, inverse DST, and inverse KLT, on the transforms performed by the transform unit, i.e., DCT, DST, and KLT, on the quantization result performed by the image encoding device. The inverse transform can be performed based on the transmission unit determined by the image encoding device. In the inverse transform unit (225) of the image decoding device, a transform technique (e.g., DCT, DST, KLT) can be selectively performed according to a plurality of pieces of information, such as a prediction method, the size and shape of the current block, the prediction mode, and the prediction direction within the screen.

예측부(230, 235)는 엔트로피 복호화부(210)에서 제공된 예측 블록 생성 관련 정보와 메모리(245)에서 제공된 이전에 복호화된 블록 또는 픽쳐 정보를 기초로 예측 블록을 생성할 수 있다. The prediction unit (230, 235) can generate a prediction block based on prediction block generation related information provided from the entropy decoding unit (210) and previously decoded block or picture information provided from the memory (245).

전술한 바와 같이 영상 부호화 장치에서의 동작과 동일하게 화면내 예측을 수행시 예측 단위의 크기와 변환 단위의 크기가 동일할 경우, 예측 단위의 좌측에 존재하는 픽셀, 좌측 상단에 존재하는 픽셀, 상단에 존재하는 픽셀을 기초로 예측 단위에 대한 화면내 예측을 수행하지만, 화면내 예측을 수행시 예측 단위의 크기와 변환 단위의 크기가 상이할 경우, 변환 단위를 기초로 한 참조 픽셀을 이용하여 화면내 예측을 수행할 수 있다. 또한, 최소 부호화 단위에 대해서만 NxN 분할을 사용하는 화면내 예측을 사용할 수도 있다.As described above, when performing intra-screen prediction in the same manner as the operation in the video encoding device, if the size of the prediction unit and the size of the transformation unit are the same, intra-screen prediction for the prediction unit is performed based on the pixels on the left side of the prediction unit, the pixels on the upper left side, and the pixels on the upper side. However, if the sizes of the prediction unit and the transformation unit are different when performing intra-screen prediction, intra-screen prediction can be performed using reference pixels based on the transformation unit. In addition, intra-screen prediction using NxN division only for the minimum coding unit can be used.

예측부(230, 235)는 예측 단위 판별부, 화면간 예측부 및 화면내 예측부를 포함할 수 있다. 예측 단위 판별부는 엔트로피 복호화부(210)에서 입력되는 예측 단위 정보, 화면내 예측 방법의 예측 모드 정보, 화면간 예측 방법의 움직임 예측 관련 정보 등 다양한 정보를 입력 받고 현재 부호화 단위에서 예측 단위를 구분하고, 예측 단위가 화면간 예측을 수행하는지 아니면 화면내 예측을 수행하는지 여부를 판별할 수 있다. 화면간 예측부(230)는 영상 부호화 장치에서 제공된 현재 예측 단위의 화면간 예측에 필요한 정보를 이용해 현재 예측 단위가 포함된 현재 픽쳐의 이전 픽쳐 또는 이후 픽쳐 중 적어도 하나의 픽쳐에 포함된 정보를 기초로 현재 예측 단위에 대한 화면간 예측을 수행할 수 있다. 또는, 현재 예측 단위가 포함된 현재 픽쳐 내에서 기-복원된 일부 영역의 정보를 기초로 화면간 예측을 수행할 수도 있다.The prediction unit (230, 235) may include a prediction unit determination unit, an inter-screen prediction unit, and an intra-screen prediction unit. The prediction unit determination unit may receive various information such as prediction unit information input from the entropy decoding unit (210), prediction mode information of an intra-screen prediction method, and motion prediction-related information of an inter-screen prediction method, and may distinguish a prediction unit from a current encoding unit and determine whether the prediction unit performs inter-screen prediction or intra-screen prediction. The inter-screen prediction unit (230) may perform inter-screen prediction for the current prediction unit based on information included in at least one picture among a previous picture or a subsequent picture of the current picture including the current prediction unit by using information necessary for inter-screen prediction of the current prediction unit provided by the video encoding device. Alternatively, inter-screen prediction may be performed based on information of a pre-restored portion of the current picture including the current prediction unit.

화면간 예측을 수행하기 위해 부호화 단위를 기준으로 해당 부호화 단위에 포함된 예측 단위의 움직임 예측 방법이 스킵 모드(Skip Mode), 머지 모드(Merge 모드), AMVP 모드(AMVP Mode), 화면내 블록 카피 모드 중 어떠한 방법인지 여부를 판단할 수 있다.In order to perform inter-screen prediction, it is possible to determine whether the motion prediction method of the prediction unit included in the encoding unit is Skip Mode, Merge Mode, AMVP Mode, or Intra-screen Block Copy Mode based on the encoding unit.

화면내 예측부(235)는 현재 픽쳐 내의 화소 정보를 기초로 예측 블록을 생성할 수 있다. 예측 단위가 화면내 예측을 수행한 예측 단위인 경우, 영상 부호화 장치에서 제공된 예측 단위의 화면내 예측 모드 정보를 기초로 화면내 예측을 수행할 수 있다. 화면내 예측부(235)에는 AIS(Adaptive Intra Smoothing) 필터, 참조 화소 보간부, DC 필터를 포함할 수 있다. AIS 필터는 현재 블록의 참조 화소에 필터링을 수행하는 부분으로써 현재 예측 단위의 예측 모드에 따라 필터의 적용 여부를 결정하여 적용할 수 있다. 영상 부호화 장치에서 제공된 예측 단위의 예측 모드 및 AIS 필터 정보를 이용하여 현재 블록의 참조 화소에 AIS 필터링을 수행할 수 있다. 현재 블록의 예측 모드가 AIS 필터링을 수행하지 않는 모드일 경우, AIS 필터는 적용되지 않을 수 있다.The intra-screen prediction unit (235) can generate a prediction block based on pixel information within the current picture. If the prediction unit is a prediction unit that has performed intra-screen prediction, the intra-screen prediction can be performed based on intra-screen prediction mode information of the prediction unit provided by the image encoding device. The intra-screen prediction unit (235) can include an AIS (Adaptive Intra Smoothing) filter, a reference pixel interpolation unit, and a DC filter. The AIS filter is a part that performs filtering on the reference pixels of the current block, and can determine whether to apply the filter and apply it according to the prediction mode of the current prediction unit. The AIS filter can be performed on the reference pixels of the current block using the prediction mode and AIS filter information of the prediction unit provided by the image encoding device. If the prediction mode of the current block is a mode that does not perform AIS filtering, the AIS filter may not be applied.

참조 화소 보간부는 예측 단위의 예측 모드가 참조 화소를 보간한 화소값을 기초로 화면내 예측을 수행하는 예측 단위일 경우, 참조 화소를 보간하여 정수값 이하의 화소 단위의 참조 화소를 생성할 수 있다. 현재 예측 단위의 예측 모드가 참조 화소를 보간하지 않고 예측 블록을 생성하는 예측 모드일 경우 참조 화소는 보간되지 않을 수 있다. DC 필터는 현재 블록의 예측 모드가 DC 모드일 경우 필터링을 통해서 예측 블록을 생성할 수 있다.The reference pixel interpolation unit can generate a reference pixel of a pixel unit less than an integer value by interpolating the reference pixel when the prediction mode of the prediction unit is a prediction unit that performs prediction within the screen based on the pixel value interpolated with the reference pixel. When the prediction mode of the current prediction unit is a prediction mode that generates a prediction block without interpolating the reference pixel, the reference pixel may not be interpolated. The DC filter can generate a prediction block through filtering when the prediction mode of the current block is the DC mode.

복원된 블록 또는 픽쳐는 필터부(240)로 제공될 수 있다. 필터부(240)는 디블록킹 필터, 오프셋 보정부, ALF를 포함할 수 있다.The restored block or picture may be provided to a filter unit (240). The filter unit (240) may include a deblocking filter, an offset correction unit, and an ALF.

영상 부호화 장치로부터 해당 블록 또는 픽쳐에 디블록킹 필터를 적용하였는지 여부에 대한 정보 및 디블록킹 필터를 적용하였을 경우, 강한 필터를 적용하였는지 또는 약한 필터를 적용하였는지에 대한 정보를 제공받을 수 있다. 영상 복호화 장치의 디블록킹 필터에서는 영상 부호화 장치에서 제공된 디블록킹 필터 관련 정보를 제공받고 영상 복호화 장치에서 해당 블록에 대한 디블록킹 필터링을 수행할 수 있다. Information on whether a deblocking filter has been applied to a corresponding block or picture from a video encoding device and, if a deblocking filter has been applied, information on whether a strong filter or a weak filter has been applied can be provided. A deblocking filter of a video decoding device can receive information related to a deblocking filter provided from a video encoding device and perform deblocking filtering on a corresponding block in the video decoding device.

오프셋 보정부는 부호화시 영상에 적용된 오프셋 보정의 종류 및 오프셋 값 정보 등을 기초로 복원된 영상에 오프셋 보정을 수행할 수 있다.The offset correction unit can perform offset correction on the restored image based on information such as the type of offset correction applied to the image during encoding and the offset value.

ALF는 부호화 장치로부터 제공된 ALF 적용 여부 정보, ALF 계수 정보 등을 기초로 부호화 단위에 적용될 수 있다. 이러한 ALF 정보는 특정한 파라메터 셋에 포함되어 제공될 수 있다.ALF can be applied to an encoding unit based on ALF application information provided from an encoding device, ALF coefficient information, etc. This ALF information can be provided by being included in a specific parameter set.

메모리(245)는 복원된 픽쳐 또는 블록을 저장하여 참조 픽쳐 또는 참조 블록으로 사용할 수 있도록 할 수 있고 또한 복원된 픽쳐를 출력부로 제공할 수 있다. The memory (245) can store a restored picture or block so that it can be used as a reference picture or reference block, and can also provide the restored picture to an output unit.

전술한 바와 같이 이하, 본 개시의 실시예에서는 설명의 편의상 코딩 유닛(Coding Unit)을 부호화 단위라는 용어로 사용하지만, 부호화뿐만 아니라 복호화를 수행하는 단위가 될 수도 있다.As described above, in the following embodiments of the present disclosure, for convenience of explanation, the term coding unit is used as an encoding unit, but it may also be a unit that performs not only encoding but also decoding.

또한, 현재 블록은, 부호화/복호화 대상 블록을 나타내는 것으로, 부호화/복호화 단계에 따라, 코딩 트리 블록(또는 코딩 트리 유닛), 부호화 블록(또는 부호화 유닛), 변환 블록(또는 변환 유닛), 예측 블록(또는 예측 유닛) 또는 인루프 필터의 적용 대상인 블록 등을 나타내는 것일 수 있다. 본 명세서에서, '유닛'은 특정 부호화/복호화 프로세스를 수행하기 위한 기본 단위를 나타내고, '블록'은 소정 크기의 화소 어레이를 나타낼 수 있다. 별도의 구분이 없는 한, '블록'과 '유닛'은 동등한 의미로 사용될 수 있다. 예컨대, 후술되는 실시예에서, 부호화 블록(코딩 블록) 및 부호화 유닛(코딩 유닛)은 상호 동등한 의미인 것으로 이해될 수 있다.In addition, the current block represents a block to be encoded/decoded, and may represent a coding tree block (or coding tree unit), an encoding block (or encoding unit), a transform block (or transform unit), a prediction block (or prediction unit), or a block to which an in-loop filter is applied, depending on the encoding/decoding step. In this specification, a 'unit' represents a basic unit for performing a specific encoding/decoding process, and a 'block' may represent a pixel array of a predetermined size. Unless otherwise distinguished, 'block' and 'unit' may be used with the same meaning. For example, in the embodiment described below, an encoding block (coding block) and an encoding unit (coding unit) may be understood to have the same meaning.

나아가, 현재 블록이 포함된 픽처를 현재 픽처라 호칭하기로 한다.Furthermore, we will refer to the picture containing the current block as the current picture.

현재 픽처의 부호화시, 픽처간 중복된 데이터는 인터 예측을 통해 제거될 수 있다. 인터 예측은, 블록 단위로 수행될 수 있다. 구체적으로, 현재 블록의 움직임 정보를 이용하여, 참조 픽처로부터 현재 블록의 예측 블록을 생성할 수 있다. 여기서, 움직임 정보는, 움직임 벡터, 참조 픽처 인덱스 및 예측 방향 중 적어도 하나를 포함할 수 있다.When encoding the current picture, redundant data between pictures can be removed through inter prediction. Inter prediction can be performed on a block-by-block basis. Specifically, a prediction block of the current block can be generated from a reference picture using the motion information of the current block. Here, the motion information can include at least one of a motion vector, a reference picture index, and a prediction direction.

도 3은 부호화기 및 복호화기에서 인터 예측을 수행하는 과정을 도식화한 도면이다.Figure 3 is a diagram schematically illustrating the process of performing inter prediction in an encoder and decoder.

도 3에 도시된 예에서와 같이, 인터 예측을 수행하기 위해, 현재 블록에 대한 움직임 정보를 획득할 수 있다(S310). 여기서, 움직임 정보는, 움직임 벡터, 참조 픽처 인덱스 또는 예측 블록에 적용되는 가중치 중 적어도 하나를 포함할 수 있다. 현재 블록에 대해, L0 방향 또는 L1 방향 중 적어도 하나에 대한 움직임 정보가 획득될 수 있다.As in the example illustrated in Fig. 3, in order to perform inter prediction, motion information for the current block can be obtained (S310). Here, the motion information can include at least one of a motion vector, a reference picture index, or a weight applied to the prediction block. For the current block, motion information for at least one of the L0 direction or the L1 direction can be obtained.

부호화기에서는, 움직임 추정을 통해 현재 블록의 움직임 정보를 유도하고, 유도된 움직임 정보를 부호화하여 복호화기로 시그날링할 수 있다. 한편, 움직임 정보의 부호화/복호화는, 후술되는, 움직임 정보 병합 모드, 움직임 벡터 예측 모드, 템플릿에 기반한 움직임 추정 방법 또는 쌍방 매칭 방법에 기초할 수 있다.In the encoder, motion information of the current block can be derived through motion estimation, and the derived motion information can be encoded and signaled to the decoder. Meanwhile, encoding/decoding of motion information can be based on a motion information merging mode, a motion vector prediction mode, a motion estimation method based on a template, or a bilateral matching method, which will be described later.

복호화기에서는, 부호화기로부터 전달된 정보를 기반으로, 현재 블록의 움직임 정보를 유도할 수 있다. In the decoder, motion information of the current block can be derived based on the information transmitted from the encoder.

또는, 복호화기에서 부호화기에서와 동일한 방법으로, 현재 블록의 움직임 정보를 유도할 수도 있다. 이와 같은 방법을, 디코더측 움직임 추정이라 호칭할 수 있다.Alternatively, the motion information of the current block can be derived from the decoder in the same way as from the encoder. This method can be called decoder-side motion estimation.

현재 블록의 움직임 정보가 유도되면, 유도된 움직임 정보를 기반으로, 현재 블록에 대한 예측 블록을 획득할 수 있다(S320). 일 예로, 참조 픽처 내 현재 블록의 위치로부터, 움직임 벡터 만큼 이격된 참조 블록을, 현재 블록의 예측 블록으로 설정할 수 있다.When the motion information of the current block is derived, a prediction block for the current block can be obtained based on the derived motion information (S320). For example, a reference block spaced apart by a motion vector from the position of the current block in the reference picture can be set as the prediction block of the current block.

이하, 인터 예측을 수해아는 과정에 대해 보다 상세히 설명하기로 한다.Below, we will explain in more detail the process of calculating inter predictions.

현재 블록의 움직임 정보는, 움직임 추정(Motion Estimation)을 통해 생성될 수 있다. The motion information of the current block can be generated through motion estimation.

도 4는 움직임 추정이 수행되는 예를 나타낸다. Figure 4 shows an example in which motion estimation is performed.

도 4에서, 현재 픽처의 POC(Picture Order Count)는 T이고, 참조 픽처의 POC는, (T-1)인 것으로 가정하였다. In Fig. 4, it is assumed that the POC (Picture Order Count) of the current picture is T and the POC of the reference picture is (T-1).

참조 픽처 내 현재 블록의 기준점과 동일한 위치로부터, 움직임 추정을 위한 탐색 범위를 설정할 수 있다. 여기서, 기준 점은, 현재 블록의 좌상단 샘플의 위치일 수 있다. A search range for motion estimation can be set from the same position as the reference point of the current block in the reference picture. Here, the reference point can be the position of the upper left sample of the current block.

일 예로, 도 4에서는, 기준점을 중심으로, (w0+w01) 및 (h0+h1) 크기의 사각형이 탐색 범위로 설정되는 것으로 예시되었다. 위 예시에서, w0, w1, h0, 및 h1은 상호 동일한 값을 가질 수 있다. 또는, w0, w1, h0 및 h1 중 적어도 하나는 다른 하나의 상이한 값을 갖도록 설정될 수 있다. 또는, CTU(Coding Tree Unit) 경계, 슬라이스 경계, 타일 경계 또는 픽처 경계를 초과하지 않도록, w0, w1, h0 및 h1의 크기가 결정될 수도 있다.For example, in FIG. 4, it is illustrated that a rectangle of sizes (w0+w01) and (h0+h1) is set as a search range centered on a reference point. In the above example, w0, w1, h0, and h1 may have the same values. Alternatively, at least one of w0, w1, h0, and h1 may be set to have a different value from the other. Alternatively, the sizes of w0, w1, h0, and h1 may be determined so as not to exceed a Coding Tree Unit (CTU) boundary, a slice boundary, a tile boundary, or a picture boundary.

탐색 범위 내, 현재 블록과 동일한 크기를 갖는 참조 블록들을 설정한 뒤, 각 참조 블록들에 대해 현재 블록과의 비용(Cost)를 측정할 수 있다. 비용은, 두 블록간 유사도를 이용하여 계산될 수 있다. Within the search range, reference blocks having the same size as the current block can be set, and then the cost for each reference block with respect to the current block can be measured. The cost can be calculated using the similarity between the two blocks.

일 예로, 현재 블록 내 원본 샘플들과 참조 블록 내 원본 샘플들(또는 복원 샘플들) 간의 차분값들의 절대값 합을 기반으로, 비용을 계산할 수 있다. 절대값 합이 작을수록, 비용은 감소할 수 있다. For example, the cost can be calculated based on the absolute sum of the differences between the original samples in the current block and the original samples (or reconstructed samples) in the reference block. The smaller the absolute sum, the lower the cost.

이후, 참조 블록들 각각의 비용을 비교한 뒤, 최적의 비용을 갖는 참조 블록을, 현재 블록의 예측 블록으로 설정할 수 있다.Afterwards, the cost of each reference block is compared, and the reference block with the optimal cost can be set as the prediction block of the current block.

그리고, 현재 블록과 참조 블록 간 거리를 움직임 벡터로 설정할 수 있다. 구체적으로, 현재 블록과 참조 블록 간의 x 좌표 차분 및 y 좌표 차분이 움직임 벡터로 설정될 수 있다.And, the distance between the current block and the reference block can be set as a motion vector. Specifically, the x-coordinate difference and the y-coordinate difference between the current block and the reference block can be set as the motion vector.

나아가, 움직임 추정을 통해 특정된 참조 블록이 포함된 픽처의 인덱스를 참조 픽처 인덱스로 설정한다. Furthermore, the index of the picture containing the reference block identified through motion estimation is set as the reference picture index.

또한, 참조 픽처가 L0 참조 픽처 리스트에 속하는지 또는 L1 참조 픽처 리스트에 속하는지 여부에 기반하여, 예측 방향을 설정할 수 있다. Additionally, the prediction direction can be set based on whether the reference picture belongs to the L0 reference picture list or the L1 reference picture list.

또한, L0 방향 및 L1 방향 각각에 대해 움직임 추정이 수행될 수 있다. L0 방향 및 L1방향 모두에 대해 예측이 수행된 경우, L0 방향의 움직임 정보 및 L1 방향의 움직임 정보가 각각 생성될 수 있다. Additionally, motion estimation can be performed for each of the L0 direction and the L1 direction. If prediction is performed for both the L0 direction and the L1 direction, motion information in the L0 direction and motion information in the L1 direction can be generated, respectively.

도 5 및 도 6은, 움직임 추정을 통해 생성된 움직임 정보를 기초로, 현재 블록의 예측 블록이 생성되는 예를 나타낸 것이다. Figures 5 and 6 illustrate examples in which a prediction block of a current block is generated based on motion information generated through motion estimation.

도 5는 단방향(즉, L0 방향) 예측으로 예측 블록을 생성하는 예를 나타낸 것이고, 도 6은 양방향(즉, L0 및 L1 방향) 예측으로 예측 블록을 생성하는 예를 나타낸 것이다.Figure 5 shows an example of generating a prediction block by unidirectional (i.e., L0 direction) prediction, and Figure 6 shows an example of generating a prediction block by bidirectional (i.e., L0 and L1 direction) prediction.

단방향 예측의 경우, 하나의 움직임 정보를 이용하여 현재 블록의 예측 블록을 생성한다. 일 예로, 상기 움직임 정보는 L0 움직임 벡터, L0 참조 픽처 인덱스 및 L0 방향을 가리지는 예측 방향 정보를 포함할 수 있다.In the case of unidirectional prediction, a prediction block of the current block is generated using one motion information. For example, the motion information may include an L0 motion vector, an L0 reference picture index, and prediction direction information pointing to the L0 direction.

양방향 예측의 경우, 두개의 움직임 정보를 이용하여 예측 블록을 생성한다. 일 예로, L0 방향에 대한 움직임 정보(L0 움직임 정보)를 기초로 특정된 L0 방향의 참조 블록을 L0 예측 블록으로 설정하고, L1 방향에 대한 움직임 정보(L1 움직임 정보)를 기초로 특정된 L1 방향의 참조 블록을 L1 예측 블록을 생성할 수 있다. 이후, L0 예측 블록 및 L1 예측 블록을 가중합하여, 현재 블록의 예측 블록을 생성할 수 있다. In the case of bidirectional prediction, two pieces of motion information are used to generate a prediction block. For example, a reference block in the L0 direction specified based on motion information for the L0 direction (L0 motion information) can be set as an L0 prediction block, and a reference block in the L1 direction specified based on motion information for the L1 direction (L1 motion information) can be generated as an L1 prediction block. Thereafter, the L0 prediction block and the L1 prediction block can be weighted and combined to generate a prediction block of the current block.

도 4 내지 도 6에 도시된 예에서는, L0 참조 픽처는, 현재 픽처의 이전 방향(즉, 현재 픽처보다 POC값이 작음)에 존재하고, L1 참조 픽처는, 현재 픽처의 이후 방향(즉, 현재 픽처보다 POC 값이 큼)에 존재하는 것으로 예시하였다.In the examples illustrated in FIGS. 4 to 6, the L0 reference picture is illustrated as existing in the previous direction of the current picture (i.e., having a POC value smaller than that of the current picture), and the L1 reference picture is illustrated as existing in the subsequent direction of the current picture (i.e., having a POC value larger than that of the current picture).

다만, 도시된 예와 달리, L0 참조 픽처가 현재 픽처의 이후 방향에 존재하거나, L1 참조 픽처가 현재 픽처의 이전 방향에 존재할 수 있다. 일 예로, L0 참조 픽처 및 L1 참조 픽처는 모두 현재 픽처의 이전 방향에 존재하거나, 또는 모두 현재 픽처의 이후 방향에 존재할 수 있다. 또는, 현재 픽처의 이후 방향에 존재하는 L0 참조 픽처 및 현재 픽처의 이전 방향에 존재하는 L1 참조 픽처를 이용하여 양방향 예측이 수행될 수도 있다. However, unlike the illustrated example, the L0 reference picture may exist in the subsequent direction of the current picture, or the L1 reference picture may exist in the previous direction of the current picture. For example, both the L0 reference picture and the L1 reference picture may exist in the previous direction of the current picture, or both may exist in the subsequent direction of the current picture. Alternatively, bidirectional prediction may be performed using the L0 reference picture existing in the subsequent direction of the current picture and the L1 reference picture existing in the previous direction of the current picture.

인터 예측이 수행된 블록의 움직임 정보는 메모리에 저장될 수 있다. 이때, 움직임 정보는 샘플 단위로 저장될 수 있다. 구체적으로, 특정 샘플이 속하는 블록의 움직임 정보가, 특정 샘플의 움직임 정보로 저장될 수 있다. 저장된 움직임 정보는, 차후 부/복호화될 이웃 블록의 움직임 정보를 유도하는 것에 이용될 수 있다. The motion information of the block on which inter prediction is performed can be stored in memory. At this time, the motion information can be stored in units of samples. Specifically, the motion information of the block to which a specific sample belongs can be stored as the motion information of the specific sample. The stored motion information can be used to derive the motion information of the neighboring block to be encoded/decoded in the future.

부호화기에서는, 현재 블록의 샘플(즉, 원본(Original) 샘플)과 예측 샘플 사이의 차분값에 해당하는 잔차 샘플을 부호화한 정보 및 예측 블록을 생성하는데 필요한 움직임 정보를 복호화기로 시그날링할 수 있다. 복호화기에서는, 시그날링된 차분값에 대한 정보를 복호화하여 차분 샘플을 유도하고, 상기 차분 샘플에 움직임 정보를 이용하여 생성된 예측 블록 내 예측 샘플을 더하여, 복원 샘플을 생성할 수 있다.In the encoder, information encoding a residual sample corresponding to a difference between a sample of a current block (i.e., an original sample) and a prediction sample, and motion information required to generate a prediction block can be signaled to the decoder. In the decoder, information about the signaled difference can be decoded to derive a difference sample, and a prediction sample in a prediction block generated using motion information can be added to the difference sample to generate a reconstructed sample.

이때, 복호화기로 시그날링되는 움직임 정보를 효과적으로 압축하기 위해, 복수의 인터 예측 모드들 중 하나가 선택될 수 있다. 여기서, 복수의 인터 예측 모드들은, 움직임 정보 병합 모드 및 움직임 벡터 예측 모드가 포함될 수 있다.At this time, in order to effectively compress the motion information signaled to the decoder, one of a plurality of inter prediction modes may be selected. Here, the plurality of inter prediction modes may include a motion information merging mode and a motion vector prediction mode.

움직임 벡터 예측 모드는, 움직임 벡터와 움직임 벡터 예측값 사이의 차분값을 부호화하여 시그날링하는 모드이다. 여기서, 움직임 벡터 예측값은, 현재 블록에 인접하는 주변 블록 또는 주변 샘플의 움직임 정보를 기초로 유도될 수 있다.The motion vector prediction mode is a mode that signals by encoding the difference between a motion vector and a motion vector prediction value. Here, the motion vector prediction value can be derived based on motion information of a neighboring block or neighboring sample adjacent to the current block.

도 7은 움직임 벡터 예측값을 유도하기 위해 참조되는 위치를 나타낸다.Figure 7 shows the locations referenced to derive motion vector prediction values.

설명의 편의를 위해, 현재 블록은 4x4 크기를 갖는 것으로 가정한다.For convenience of explanation, the current block is assumed to have a size of 4x4.

도시된 예에서, 'LB'는, 현재 블록 내 최좌측열 및 최하단행에 포함된 샘플을 나타낸다. 'RT'은, 현재 블록 내 최우측열 및 최상단행에 포함된 샘플을 나타낸다. A0 내지 A4는 현재 블록의 좌측에 이웃하는 샘플들을 나타내고, B0 내지 B5는, 현재 블록의 상단에 이웃하는 샘플들을 나타낸다. 일 예로, A1은, LB의 좌측에 이웃하는 샘플을 나타내고, B1은, RT의 상단에 이웃하는 샘플을 나타낸다.In the illustrated example, 'LB' represents a sample included in the leftmost column and the bottommost row in the current block. 'RT' represents a sample included in the rightmost column and the topmost row in the current block. A0 to A4 represent samples neighboring to the left of the current block, and B0 to B5 represent samples neighboring to the top of the current block. For example, A1 represents a sample neighboring to the left of LB, and B1 represents a sample neighboring to the top of RT.

Col은, 콜로케이티드(Co-located) 픽처 내 현재 블록의 우하단에 이웃하는 샘플의 위치를 나타낸다. 콜로케이티드 픽처는 현재 픽처와 상이한 픽처이고, 콜로케이티드 픽처를 특정하기 위한 정보(예컨대, 콜로케이티드 픽처 인덱스)가 명시적으로 비트스트림에 부호화되어 시그날링될 수 있다. 또는, 기 정의된 참조 픽처 인덱스를 갖는 참조 픽처를 콜로케이티드 픽처로 설정할 수도 있다. Col indicates the location of a sample neighboring the lower right of the current block in a co-located picture. A co-located picture is a picture different from the current picture, and information for specifying the co-located picture (e.g., a co-located picture index) can be explicitly encoded and signaled in the bitstream. Alternatively, a reference picture having a predefined reference picture index can be set as the co-located picture.

현재 블록의 움직임 벡터 예측값은, 움직임 벡터 예측 리스트(Motion Vector Prediction List)에 포함된 적어도 하나의 움직임 벡터 예측 후보로부터 유도될 수 있다. The motion vector prediction value of the current block can be derived from at least one motion vector prediction candidate included in a motion vector prediction list.

움직임 벡터 예측 리스트에 삽입될 수 있는 움직임 벡터 예측 후보들의 개수(즉, 리스트의 크기)가 부호화기 및 복호화기에 기 정의되어 있을 수 있다. 일 예로, 움직임 벡터 예측 후보들의 최대 개수는 2개일 수 있다. The number of motion vector prediction candidates that can be inserted into the motion vector prediction list (i.e., the size of the list) may be predefined in the encoder and decoder. For example, the maximum number of motion vector prediction candidates may be 2.

현재 블록에 인접하는 이웃 샘플의 위치에 저장된 움직임 벡터 또는 상기 움직임 벡터를 스케일링하여 유도된 스케일링된 움직임 벡터를 움직임 벡터 예측 후보로서 움직임 벡터 예측 리스트에 삽입할 수 있다. 이때, 현재 블록에 인접하는 이웃 샘플들을 기 정의된 순서에 따라 스캔하여, 움직임 벡터 예측 후보를 유도할 수 있다. A motion vector stored at the location of a neighboring sample adjacent to the current block or a scaled motion vector derived by scaling the motion vector can be inserted into the motion vector prediction list as a motion vector prediction candidate. At this time, the neighboring samples adjacent to the current block can be scanned in a predefined order to derive the motion vector prediction candidate.

일 예로, A0부터 A4의 순서로 각 위치에 움직임 벡터가 저장되어 있는지 여부를 확인할 수 있다. 그리고, 위 스캔 순서에 따라, 가장 먼저 발견된 이용 가능한 움직임 벡터를 움직임 벡터 예측 후보로서 움직임 벡터 예측 리스트에 삽입할 수 있다. For example, it can be checked whether a motion vector is stored at each position in the order of A0 to A4. Then, according to the above scanning order, the first found available motion vector can be inserted into the motion vector prediction list as a motion vector prediction candidate.

다른 예로, A0 부터 A4의 순서로, 각 위치에 움직임 벡터가 저장되어 있는지 여부를 확인하되, 가장 먼저 발견된, 현재 블록과 동일한 참조 픽처를 갖는 위치의 움직임 벡터를 움직임 벡터 예측 후보로서 움직임 벡터 예측 리스트에 삽입할 수 있다. 현재 블록과 동일한 참조 픽처를 갖는 이웃 샘플이 존재하지 않는 경우, 가장 먼저 발견된 이용 가능한 벡터를 기초로 움직임 벡터 예측 후보를 유도할 수 있다. 구체적으로, 가장 먼저 발견된 이용 가능한 움직임 벡터를 스케일링한 뒤, 스케일링된 움직임 벡터를 움직임 벡터 예측 후보로서 움직임 벡터 예측 리스트에 삽입할 수 있다. 이때, 스케일링은, 현재 픽처와 참조 픽처 사이의 출력 순서 차이(즉, POC 차이) 및 현재 픽처와 이웃 샘플의 참조 픽처 사이의 출력 순서 차이(즉, POC 차이)에 기초하여 수행될 수 있다. As another example, in the order of A0 to A4, it is checked whether a motion vector is stored at each position, and the motion vector of the position having the same reference picture as the current block that is found first can be inserted as a motion vector prediction candidate into the motion vector prediction list. If there is no neighboring sample having the same reference picture as the current block, the motion vector prediction candidate can be derived based on the available vector found first. Specifically, the available motion vector that is found first can be scaled, and then the scaled motion vector can be inserted as a motion vector prediction candidate into the motion vector prediction list. At this time, the scaling can be performed based on the output order difference between the current picture and the reference picture (i.e., the POC difference) and the output order difference between the current picture and the reference picture of the neighboring sample (i.e., the POC difference).

나아가, B0 부터 B5의 순서로, 각 위치에 움직임 벡터가 저장되어 있는지 여부를 확인할 수 있다. 그리고, 위 스캔 순서에 따라, 가장 먼저 발견된 이용 가능한 움직임 벡터를 움직임 벡터 예측 후보로서 움직임 벡터 예측 리스트에 삽입할 수 있다. Furthermore, in the order of B0 to B5, it can be checked whether a motion vector is stored at each position. Then, according to the above scanning order, the first found available motion vector can be inserted into the motion vector prediction list as a motion vector prediction candidate.

다른 예로, B0 부터 B5의 순서로, 각 위치에 움직임 벡터가 저장되어 있는지 여부를 확인하되, 가장 먼저 발견된, 현재 블록과 동일한 참조 픽처를 갖는 위치의 움직임 벡터를 움직임 벡터 예측 후보로서 움직임 벡터 예측 리스트에 삽입할 수 있다. 현재 블록과 동일한 참조 픽처를 갖는 이웃 샘플이 존재하지 않는 경우, 가장 먼저 발견된 이용 가능한 벡터를 기초로 움직임 벡터 예측 후보를 유도할 수 있다. 구체적으로, 가장 먼저 발견된 이용 가능한 움직임 벡터를 스케일링한 뒤, 스케일링된 움직임 벡터를 움직임 벡터 예측 후보로서 움직임 벡터 예측 리스트에 삽입할 수 있다. 이때, 스케일링은, 현재 픽처와 참조 픽처 사이의 출력 순서 차이(즉, POC 차이) 및 현재 픽처와 이웃 샘플의 참조 픽처 사이의 출력 순서 차이(즉, POC 차이)에 기초하여 수행될 수 있다. As another example, in the order of B0 to B5, it is checked whether a motion vector is stored at each position, and the motion vector of the position having the same reference picture as the current block that is found first can be inserted as a motion vector prediction candidate into the motion vector prediction list. If there is no neighboring sample having the same reference picture as the current block, the motion vector prediction candidate can be derived based on the available vector found first. Specifically, the available motion vector that is found first can be scaled, and then the scaled motion vector can be inserted as a motion vector prediction candidate into the motion vector prediction list. At this time, the scaling can be performed based on the output order difference between the current picture and the reference picture (i.e., the POC difference) and the output order difference between the current picture and the reference picture of the neighboring sample (i.e., the POC difference).

상술한 예에서와 같이, 현재 블록의 좌측에 인접하는 샘플로부터 움직임 벡터 예측 후보를 유도하고, 현재 블록의 상단에 인접하는 샘플로부터 움직임 벡터 예측 후보를 유도할 수 있다. As in the example described above, a motion vector prediction candidate can be derived from a sample adjacent to the left of the current block, and a motion vector prediction candidate can be derived from a sample adjacent to the top of the current block.

이때, 좌측 샘플로부터 유도된 움직임 벡터 예측 후보가 상단 샘플로부터 유도된 움직임 벡터 예측 후보보다 먼저 움직임 벡터 예측 리스트에 삽입될 수 있다. 이 경우, 좌측 샘플로부터 유도된 움직임 벡터 예측 후보에 할당되는 인덱스가 상단 샘플로부터 유도된 움직임 벡터 예측 후보보다 작은 값을 가질 수 있다.At this time, the motion vector prediction candidate derived from the left sample may be inserted into the motion vector prediction list before the motion vector prediction candidate derived from the upper sample. In this case, the index assigned to the motion vector prediction candidate derived from the left sample may have a smaller value than the motion vector prediction candidate derived from the upper sample.

위와 반대로, 상단 샘플로부터 유도된 움직임 벡터 예측 후보를 좌측 샘플로부터 유도된 움직임 벡터 예측 후보보다 먼저 움직임 벡터 예측 리스트에 삽입할 수도 있다. Conversely, the motion vector prediction candidates derived from the upper samples can also be inserted into the motion vector prediction list before the motion vector prediction candidates derived from the left samples.

상기 움직임 벡터 예측 리스트에 포함된 움직임 벡터 예측 후보들 중 부호화 효율이 가장 높은 움직임 벡터 예측 후보를, 현재 블록의 움직임 벡터 예측값(Motion Vector Predictor, MVP)으로 설정할 수 있다. 그리고, 복수의 움직임 벡터 예측 후보들 중 현재 블록의 움직임 벡터 예측값으로 설정되는 움직임 벡터 예측 후보를 가리키는 인덱스 정보를 부호화하여 복호화기로 시그날링할 수 있다. 움직임 벡터 예측 후보들의 개수가 2개인 경우, 상기 인덱스 정보는 1비트의 플래그(예컨대, MVP 플래그)일 수 있다. 또한, 현재 블록의 움직임 벡터와 움직임 벡터 예측값 사이의 차분인 움직임 벡터 차분값(Motion Vector Difference, MVD)를 부호화하여 복호화기로 시그날링할 수 있다.Among the motion vector prediction candidates included in the above motion vector prediction list, a motion vector prediction candidate having the highest encoding efficiency can be set as a motion vector predictor (MVP) of a current block. Then, index information indicating a motion vector prediction candidate set as a motion vector predictor of a current block among a plurality of motion vector prediction candidates can be encoded and signaled to a decoder. When the number of motion vector prediction candidates is 2, the index information can be a 1-bit flag (e.g., an MVP flag). In addition, a motion vector difference (MVD), which is a difference between the motion vector of the current block and the motion vector predictor, can be encoded and signaled to a decoder.

복호화기는, 부호화기와 동일하게 움직임 벡터 예측 리스트를 구성할 수 있다. 또한, 비트스트림으로부터 인덱스 정보를 복호화하고, 복호화된 인덱스 정보를 기초로 복수의 움직임 벡터 예측 후보들 중 하나를 선택할 수 있다. 선택된 움직임 벡터 예측 후보를, 현재 블록의 움직임 벡터 예측값으로 설정할 수 있다. The decoder can construct a motion vector prediction list in the same manner as the encoder. In addition, it can decode index information from a bitstream and select one of a plurality of motion vector prediction candidates based on the decoded index information. The selected motion vector prediction candidate can be set as the motion vector prediction value of the current block.

또한, 비트스트림으로부터 움직임 벡터 차분값을 복호화할 수 있다. 이후, 움직임 벡터 예측값과 움직임 벡터 차분값을 합하여, 현재 블록의 움직임 벡터를 유도할 수 있다. Additionally, the motion vector differential can be decoded from the bitstream. Afterwards, the motion vector prediction value and the motion vector differential value can be combined to derive the motion vector of the current block.

현재 블록에 양방향 예측이 적용되는 경우, L0 방향 및 L1 방향 각각에 대해 움직임 벡터 예측 리스트가 생성될 수 있다. 즉, 움직임 벡터 예측 리스트는, 동일 방향의 움직임 벡터들로 구성될 수 있다. 이에 따라, 현재 블록의 움직임 벡터와, 움직임 벡터 예측 리스트에 포함된 움직임 벡터 예측 후보들은 동일한 방향을 갖는다.When bidirectional prediction is applied to the current block, a motion vector prediction list can be generated for each of the L0 direction and the L1 direction. That is, the motion vector prediction list can be composed of motion vectors in the same direction. Accordingly, the motion vector of the current block and the motion vector prediction candidates included in the motion vector prediction list have the same direction.

움직임 벡터 예측 모드가 선택된 경우, 참조 픽처 인덱스 및 예측 방향 정보가 명시적으로 부호화되어 복호화기로 시그날링될 수 있다. 일 예로, 참조 픽처 리스트 상에 복수의 참조 픽처들이 존재하고, 복수 참조 픽처들 각각에 대해 움직임 추정이 수행된 경우, 상기 복수 참조 픽처들 중 현재 블록의 움직임 정보가 유도된 참조 픽처를 특정하기 위한 참조 픽처 인덱스가 명시적으로 부호화되어 복호화기로 시그날링될 수 있다. When the motion vector prediction mode is selected, reference picture index and prediction direction information can be explicitly encoded and signaled to the decoder. For example, when there are multiple reference pictures on the reference picture list and motion estimation is performed on each of the multiple reference pictures, a reference picture index for specifying a reference picture from which motion information of the current block is derived among the multiple reference pictures can be explicitly encoded and signaled to the decoder.

이때, 참조 픽처 리스트에 하나의 참조 픽처만이 포함된 경우에는 상기 참조 픽처 인덱스의 부/복호화가 생략될 수 있다.At this time, if the reference picture list contains only one reference picture, encoding/decoding of the reference picture index may be omitted.

예측 방향 정보는, L0 단방향 예측, L1 단방향 예측, 또는 양방향 예측 중 하나를 가리키는 인덱스일 수 있다. 또는, L0 방향에 대한 예측이 수행되는지 여부를 나타내는 L0 플래그 및 L1 방향에 대한 예측이 수행되는지 여부를 나타내는 L1 플래그가 각각 부호화되어 시그날링될 수도 있다.The prediction direction information may be an index pointing to one of L0 unidirectional prediction, L1 unidirectional prediction, or bidirectional prediction. Alternatively, an L0 flag indicating whether prediction is performed in the L0 direction and an L1 flag indicating whether prediction is performed in the L1 direction may be encoded and signaled, respectively.

움직임 정보 병합 모드는, 현재 블록의 움직임 정보를 이웃 블록의 움직임 정보와 동일하게 설정하는 모드이다. 움직임 정보 병합 모드에서는, 움직임 정보 병합 리스트를 이용하여, 움직임 정보가 부/복호화될 수 있다.Motion information merge mode is a mode in which the motion information of the current block is set to be the same as the motion information of the neighboring block. In motion information merge mode, motion information can be encoded/decoded using the motion information merge list.

움직임 정보 병합 후보는, 현재 블록에 인접하는 이웃 블록 또는 이웃 샘플의 움직임 정보를 기초로 유도될 수 있다. 일 예로, 현재 블록에 주변에 참조할 위치를 기 정의한 뒤, 기 정의된 참조 위치에 움직임 정보가 존재하는지 여부를 확인할 수 있다. 기 정의된 참조 위치에 움직임 정보가 존재하는 경우, 해당 위치의 움직임 정보를 움직임 정보 병합 후보로서 움직임 정보 병합 리스트에 삽입할 수 있다.Motion information merging candidates can be derived based on motion information of neighboring blocks or neighboring samples adjacent to the current block. For example, after defining a location to be referenced around the current block, it can be checked whether motion information exists at the defined reference location. If motion information exists at the defined reference location, the motion information at that location can be inserted into the motion information merging list as a motion information merging candidate.

도 7의 예시에서, 기 정의된 참조 위치는, A0, A1, B0, B1, B5 및 Col 중 적어도 하나를 포함할 수 있다. 나아가, A1, B1, B0, A0, B5 및 Col의 순서로, 움직임 정보 병합 후보를 유도할 수 있다.In the example of Fig. 7, the predefined reference positions may include at least one of A0, A1, B0, B1, B5, and Col. Furthermore, the motion information merging candidates may be derived in the order of A1, B1, B0, A0, B5, and Col.

움직임 정보 병합 리스트에 포함된 움직임 정보 병합 후보들 중 최적의 비용을 갖는 움직임 정보 병합 후보의 움직임 정보를 현재 블록의 움직임 정보로 설정할 수 있다. 나아가, 복수의 움직임 정보 병합 후보들 중 선택된 움직임 정보 병합 후보를 가리키는 인덱스 정보(예컨대, 병합 인덱스)를 부호화하여 복호화기로 전송할 수 있다.Among the motion information merging candidates included in the motion information merging list, the motion information of the motion information merging candidate with the optimal cost can be set as the motion information of the current block. Furthermore, index information (e.g., a merge index) indicating the motion information merging candidate selected from among a plurality of motion information merging candidates can be encoded and transmitted to the decoder.

복호화기에서는, 부호화기에서와 동일하게 움직임 정보 병합 리스트를 구성할 수 있다. 그리고, 비트스트림으로부터 복호화된 병합 인덱스를 기초로, 움직임 정보 병합 후보를 선택할 수 있다. 선택된 움직임 정보 병합 후보의 움직임 정보가, 현재 블록의 움직임 정보로 설정될 수 있다. In the decoder, a motion information merge list can be constructed in the same manner as in the encoder. Then, a motion information merge candidate can be selected based on a merge index decoded from a bitstream. The motion information of the selected motion information merge candidate can be set as the motion information of the current block.

움직임 정보 병합 리스트는 움직임 벡터 예측 리스트와는 달리, 예측 방향과 상관없이 단일의 리스트로 구성된다. 즉, 움직임 정보 병합 리스트에 포함된 움직임 정보 병합 후보은 L0 움직임 정보 또는 L1 움직임 정보만을 가질 수도 있고, 양방향 움직임 정보(즉, L0 움직임 정보 및 L1 움직임 정보)를 가질 수도 있다. Unlike the motion vector prediction list, the motion information merge list is composed of a single list regardless of the prediction direction. That is, the motion information merge candidates included in the motion information merge list may have only L0 motion information or L1 motion information, or may have bidirectional motion information (i.e., L0 motion information and L1 motion information).

현재 블록 주변 복원 샘플 영역을 이용하여, 현재 블록의 움직임 정보를 유도할 수도 있다. 여기서, 현재 블록의 움직임 정보를 유도하는데 이용되는 복원 샘플 영역을 템플릿(Template)이라 호칭할 수도 있다. The motion information of the current block can also be derived by using the restoration sample area around the current block. Here, the restoration sample area used to derive the motion information of the current block can also be called a template.

도 8은 템플릿 기반 움직임 추정 방법을 설명하기 위한 도면이다.Figure 8 is a diagram for explaining a template-based motion estimation method.

도 4에서는, 탐색 범위 내 현재 블록과 참조 블록 간의 비용을 기반으로, 현재 블록의 예측 블록을 결정하는 것으로 설명하였다. 본 실시예에 따르면, 도 4와 달리, 현재 블록에 이웃하는 템플릿(이하, 현재 템플릿이라 함) 및 현재 템플릿과 동일한 크기 및 형태를 갖는 참조 템플릿 사이의 비용을 기반으로, 현재 블록에 대한 움직임 추정을 수행할 수 있다. In Fig. 4, it is explained that the prediction block of the current block is determined based on the cost between the current block and the reference block within the search range. According to the present embodiment, unlike Fig. 4, motion estimation for the current block can be performed based on the cost between the template neighboring the current block (hereinafter referred to as the current template) and the reference template having the same size and shape as the current template.

일 예로, 현재 템플릿 내 복원 샘플들과 참조 블록 내 복원 샘플들 간의 차분값의 절대값 합을 기반으로, 비용을 계산할 수 있다. 절대값 합이 작을수록, 비용은 감소할 수 있다. For example, the cost can be calculated based on the absolute sum of the differences between the restored samples in the current template and the restored samples in the reference block. The smaller the absolute sum, the lower the cost.

탐색 범위 내 현재 템플릿과 최적의 비용을 갖는 참조 템플릿이 결정되면, 참조 템플릿에 이웃하는 참조 블록을 현재 블록의 예측 블록으로 설정할 수 있다. Once the reference template with the optimal cost is determined relative to the current template within the search range, the reference block neighboring the reference template can be set as the predicted block of the current block.

그리고, 현재 블록과 참조 블록 사이의 거리, 참조 블록이 속하는 픽처의 인덱스 및 참조 픽처가 L0 또는 L1 참조 픽처 리스트에 포함되는지 여부를 기반으로, 현재 블록의 움직임 정보를 설정할 수 있다. And, based on the distance between the current block and the reference block, the index of the picture to which the reference block belongs, and whether the reference picture is included in the L0 or L1 reference picture list, the motion information of the current block can be set.

템플릿은 현재 블록 주변 기 복원된 영역이 템플릿으로 정의되는 바, 복호화기 스스로 부호화기와 동일한 방식으로 움직임 추정을 수행할 수 있다. 이에 따라, 템플릿을 이용하여 움직임 정보를 유도하는 경우, 템플릿 이용 여부를 나타내는 정보 외, 움직임 정보를 부호화하여 시그날링할 필요가 없다.Since the template is defined as a restored area around the current block, the decoder itself can perform motion estimation in the same manner as the encoder. Accordingly, when deriving motion information using a template, there is no need to encode and signal the motion information other than information indicating whether or not the template is used.

현재 템플릿은 현재 블록 상단에 인접하는 영역 또는 좌측에 인접하는 영역 중 적어도 하나를 포함할 수 있다. 이때, 상단에 인접하는 영역은, 적어도 하나의 행을 포함하고, 좌측에 인접하는 영역은, 적어도 하나의 열을 포함할 수 있다.The current template may include at least one of an area adjacent to the top of the current block or an area adjacent to the left of the current block, wherein the area adjacent to the top may include at least one row, and the area adjacent to the left may include at least one column.

도 9는 템플릿의 구성 예들을 나타낸다.Figure 9 shows examples of template configurations.

도 9에 도시된 예들 중 하나를 따라, 현재 템플릿이 구성될 수 있다. The current template can be constructed following one of the examples illustrated in FIG. 9.

또는, 도 9에 도시된 예와 달리, 현재 블록의 좌측에 인접하는 영역만으로 템플릿을 구성하거나, 현재 블록의 상단에 인접하는 영역만으로 템플릿을 구성할 수도 있다.Alternatively, unlike the example illustrated in FIG. 9, the template may be composed of only the area adjacent to the left of the current block, or only the area adjacent to the top of the current block.

현재 템플릿의 크기 및/또는 형태는 부호화기 및 복호화기에서 기 정의되어 있을 수 있다.The size and/or shape of the current template may be predefined in the encoder and decoder.

또는, 크기 및/또는 형태가 상이한 복수의 템플릿 후보들을 기 정의한 뒤, 복수의 템플릿 후보들 중 하나를 특정하는 인덱스 정보를 부호화하여 복호화기로 시그날링할 수 있다. Alternatively, multiple template candidates having different sizes and/or shapes may be predefined, and then index information specifying one of the multiple template candidates may be encoded and signaled to a decoder.

또는, 현재 블록의 크기, 형태 또는 위치 중 적어도 하나에 기초하여, 복수의 템플릿 후보들 중 하나를 적응적으로 선택할 수도 있다. 일 예로, 현재 블록이 CTU의 상단 경계에 접하는 경우, 현재 블록의 좌측에 인접하는 영역만으로 현재 템플릿을 구성할 수 있다. Alternatively, one of the multiple template candidates may be adaptively selected based on at least one of the size, shape, or position of the current block. For example, if the current block is adjacent to the upper boundary of the CTU, the current template may be composed of only the region adjacent to the left of the current block.

참조 픽처 리스트에 저장된 참조 픽처들 각각에 대해 템플릿에 기반한 움직임 추정을 수행할 수 있다. 또는, 참조 픽처들 중 일부에 대해서만 움직임 추정을 수행할 수도 있다. 일 예로, 참조 픽처 인덱스가 0인 참조 픽처에 대해서만 움직임 추정을 수행하거나, 참조 픽처 인덱스가 문턱값보다 작은 참조 픽처들 또는 현재 픽처와의 POC 차분이 문턱값보다 작은 참조 픽처들에 대해서만 움직임 추정을 수행할 수 있다. Motion estimation based on a template can be performed on each of the reference pictures stored in the reference picture list. Alternatively, motion estimation can be performed on only some of the reference pictures. For example, motion estimation can be performed only on reference pictures having a reference picture index of 0, or motion estimation can be performed only on reference pictures having a reference picture index smaller than a threshold or reference pictures having a POC difference from the current picture smaller than a threshold.

또는, 참조 픽처 인덱스를 명시적으로 부호화하여 시그날링한 뒤, 상기 참조 픽처 인덱스가 가리키는 참조 픽처에 대해서만 움직임 추정을 수행할 수 있다.Alternatively, the reference picture index can be explicitly encoded and signaled, and then motion estimation can be performed only for the reference picture pointed to by the reference picture index.

또는, 현재 템플릿에 대응하는 이웃 블록의 참조 픽처를 대상으로 움직임 추정을 수행할 수 있다. 일 예로, 템플릿이 좌측 인접 영역 및 상단 인접 영역으로 구성되어 있다면, 좌측 이웃 블록의 참조 픽처 인덱스 또는 상단 이웃 블록의 참조 픽처 인덱스 중 적어도 하나를 이용하여 적어도 하나의 참조 픽처를 선택할 수 있다. 이후, 선택된 적어도 하나의 참조 픽처를 대상으로, 움직임 추정을 수행할 수 있다. Alternatively, motion estimation can be performed targeting reference pictures of neighboring blocks corresponding to the current template. For example, if the template is composed of a left neighboring region and an upper neighboring region, at least one reference picture can be selected using at least one of the reference picture index of the left neighboring block or the reference picture index of the upper neighboring block. Thereafter, motion estimation can be performed targeting at least one selected reference picture.

템플릿에 기반한 움직임 추정이 적용되었는지 여부를 나타내는 정보가 부호화되어 복호화기로 시그날링될 수 있다. 상기 정보는 1비트의 플래그일 수 있다. 일 예로, 상기 플래그가 참(1)인 것은, 현재 블록의 L0 방향 및 L1 방향에 템플릿에 기반한 움직임 추정이 적용됨을 가리킨다. 반면, 상기 플래그가 거짓(0)인 것은, 템플릿에 기반한 움직임 추정이 적용되지 않음을 나타낸다. 이 경우, 움직임 정보 병합 모드 또는 움직임 벡터 예측 모드를 기반으로, 현재 블록의 움직임 정보가 유도될 수 있다. Information indicating whether motion estimation based on template is applied can be encoded and signaled to a decoder. The information can be a 1-bit flag. For example, if the flag is true (1), it indicates that motion estimation based on template is applied in the L0 direction and the L1 direction of the current block. On the other hand, if the flag is false (0), it indicates that motion estimation based on template is not applied. In this case, motion information of the current block can be derived based on the motion information merging mode or the motion vector prediction mode.

위와 반대로, 현재 블록에 움직임 정보 병합 모드 및 움직임 벡터 예측 모드가 적용되지 않는 것으로 결정된 경우에 한하여, 템플릿에 기반한 움직임 추정이 적용될 수 있다. 일 예로, 움직임 정보 병합 모드가 적용되는지 여부를 나타내는 제1 플래그 및 움직임 벡터 예측 모드가 적용되는지 여부를 나타내는 제2 플래그가 모두 0인 경우, 템플릿에 기반한 움직임 추정이 수행될 수 있다.Conversely, template-based motion estimation can be applied only when it is determined that neither the motion information merging mode nor the motion vector prediction mode is applied to the current block. For example, when the first flag indicating whether the motion information merging mode is applied and the second flag indicating whether the motion vector prediction mode is applied are both 0, template-based motion estimation can be performed.

L0 방향 및 L1 방향 각각에 대해, 템플릿에 기반한 움직임 추정이 적용되었는지 여부를 나타내는 정보가 시그날링될 수 있다. 즉, L0 방향에 템플릿에 기반한 움직임 추정이 적용되는지 여부 및 L1 방향에 템플릿에 기반한 움직임 추정이 적용되는지 여부가 상호 독립적으로 결정될 수 있다. 이에 따라, L0 방향 및 L1 방향 중 어느 하나에는 템플릿에 기반한 움직임 추정이 적용되는 반면, 다른 하나에는, 타 모드(예컨대, 움직임 정보 병합 모드 또는 움직임 벡터 예측 모드)가 적용될 수 있다.For each of the L0 direction and the L1 direction, information indicating whether template-based motion estimation is applied can be signaled. That is, whether template-based motion estimation is applied in the L0 direction and whether template-based motion estimation is applied in the L1 direction can be determined independently of each other. Accordingly, template-based motion estimation can be applied to one of the L0 direction and the L1 direction, while another mode (e.g., motion information merging mode or motion vector prediction mode) can be applied to the other.

L0 방향 및 L1 방향에 모두 템플릿에 기반한 움직임 추정이 적용되는 경우, L0 예측 블록 및 L1 예측 블록의 가중합 연산을 기초로, 현재 블록의 예측 블록이 생성될 수 있다. 또는, L0 방향 및 L1 방향 중 하나에는 템플릿에 기반한 움직임 추정이 적용되었으나, 다른 하나에는, 타 모드가 적용된 경우에도, L0 예측 블록 및 L1 예측 블록의 가중합 연산을 기초로, 현재 블록의 예측 블록이 생성될 수 있다. When template-based motion estimation is applied to both the L0 direction and the L1 direction, the prediction block of the current block can be generated based on a weighted sum operation of the L0 prediction block and the L1 prediction block. Alternatively, when template-based motion estimation is applied to one of the L0 direction and the L1 direction, but another mode is applied to the other, the prediction block of the current block can be generated based on a weighted sum operation of the L0 prediction block and the L1 prediction block.

또는, 템플릿에 기반한 움직임 추정 방법이, 움직임 정보 병합 모드 상의 움직임 정보 병합 후보 또는 움직임 벡터 예측 모드 상의 움직임 벡터 예측 후보로 삽입될 수도 있다. 이 경우, 선택된 움직임 정보 병합 후보 또는 선택된 움직임 벡터 예측 후보가 템플릿에 기반한 움직임 추정 방법을 가리키는지 여부에 기초하여, 템플릿에 기반한 움직임 추정 방법의 적용 여부가 결정될 수 있다.Alternatively, a motion estimation method based on a template may be inserted as a motion information merging candidate in a motion information merging mode or a motion vector prediction candidate in a motion vector prediction mode. In this case, whether or not to apply a motion estimation method based on a template may be determined based on whether the selected motion information merging candidate or the selected motion vector prediction candidate indicates a motion estimation method based on a template.

쌍방 매칭 방법을 기반으로, 현재 블록의 움직임 정보를 생성할 수도 있다. Based on the two-way matching method, the movement information of the current block can also be generated.

도 10는 쌍방 매칭 방법을 기반의 움직임 추정 방법을 설명하기 위한 도면이다.Figure 10 is a diagram for explaining a motion estimation method based on a bilateral matching method.

쌍방 매칭 방법은, 현재 픽처의 시간적 순서(즉, POC)가 L0 참조 픽처의 시간적 순서 및 L1 참조 픽처의 시간적 순서 사이에 존재하는 경우에 한하여 수행될 수 있다. The bilateral matching method can be performed only when the temporal order (i.e., POC) of the current picture exists between the temporal order of the L0 reference picture and the temporal order of the L1 reference picture.

쌍방 매칭 방법이 적용되는 경우, L0 참조 픽처 및 L1 참조 픽처 각각에 탐색 범위를 설정할 수 있다. 이때, L0 참조 픽처를 식별하기 위한 L0 참조 픽처 인덱스 및 L1 참조 픽처를 식별하기 위한 L1 참조 픽처 인덱스가 각각 부호화되어 시그날링될 수 있다. When a bilateral matching method is applied, a search range can be set for each of the L0 reference picture and the L1 reference picture. At this time, an L0 reference picture index for identifying the L0 reference picture and an L1 reference picture index for identifying the L1 reference picture can be encoded and signaled, respectively.

다른 예로, L0 참조 픽처 인덱스만을 부호화하여 시그날링하고, 현재 픽처와 L0 참조 픽처 사이의 거리(이하, L0 POC 차분이라 함)을 기초로, L1 참조 픽처를 선택할 수 있다. 일 예로, L1 참조 픽처 리스트에 포함된 L1 참조 픽처들 중, 현재 픽처와의 거리(이하, L1 POC 차분이라 함)의 절대값이 현재 픽처와 L0 참조 픽처 사이의 거리의 절대값과 동일한 L1 참조 픽처를 선택할 수 있다. L0 POC 차분과 동일한 L1 POC 차분을 갖는 L1 참조 픽처가 존재하지 않는 경우, L1 참조 픽처들 중 L1 POC 차분이 L0 POC 차분과 가장 유사한 L1 참조 픽처를 선택할 수 있다.As another example, only the L0 reference picture index may be encoded and signaled, and an L1 reference picture may be selected based on a distance between the current picture and the L0 reference picture (hereinafter referred to as the L0 POC difference). For example, an L1 reference picture included in an L1 reference picture list, of which an absolute value of the distance from the current picture (hereinafter referred to as the L1 POC difference) is equal to the absolute value of the distance between the current picture and the L0 reference picture, may be selected. If there is no L1 reference picture having an L1 POC difference equal to the L0 POC difference, an L1 reference picture whose L1 POC difference is most similar to the L0 POC difference may be selected among the L1 reference pictures.

이때, L1 참조 픽처들 중 L0 참조 픽처와 시간적 방향이 상이한 L1 참조 픽처 만이 쌍방 매칭에 이용될 수 있다. 일 예로, L0 참조 픽처의 POC가 현재 픽처보다 작은 경우, 현재 픽처보다 POC가 큰 L1 참조 픽처들 중에서 하나를 선택할 수 있다.At this time, among the L1 reference pictures, only the L1 reference pictures that have different temporal directions from the L0 reference pictures can be used for bilateral matching. For example, if the POC of the L0 reference picture is smaller than that of the current picture, one of the L1 reference pictures that has a larger POC than that of the current picture can be selected.

위와 반대로, L1 참조 픽처 인덱스만을 부호화하여 시그날링하고, 현재 픽처와 L1 참조 픽처 사이의 거리를 기초로, L0 참조 픽처를 선택할 수도 있다. Conversely, one could also encode and signal only the L1 reference picture index, and select the L0 reference picture based on the distance between the current picture and the L1 reference picture.

또는, L0 참조 픽처들 중 현재 픽처와의 거리가 가장 가까운 L0 참조 픽처 및, L1 참조 픽처들 중 현재 픽처와의 거리가 가장 가까운 L1 참조 픽처를 이용하여 쌍방 매칭 방법을 수행할 수도 있다.Alternatively, a bilateral matching method may be performed using the L0 reference picture having the closest distance to the current picture among the L0 reference pictures and the L1 reference picture having the closest distance to the current picture among the L1 reference pictures.

또는, L0 참조 픽처 리스트 내 기 정의된 인덱스가 할당된 L0 참조 픽처(예컨대, 인덱스 0) 및 L1 참조 픽처 리스트 내 기 정의된 인덱스가 할당된 L1 참조 픽처(예컨대, 인덱스 0)를 이용하여, 쌍방 매칭 방법을 수행할 수도 있다.Alternatively, a bilateral matching method may be performed using an L0 reference picture (e.g., index 0) assigned with a predefined index in the L0 reference picture list and an L1 reference picture (e.g., index 0) assigned with a predefined index in the L1 reference picture list.

또는, LX (X는 0 또는 1) 참조 픽처는 명시적으로 시그날링되는 참조 픽처 인덱스를 기반으로 선택하고, L|X-1| 참조 픽처는, L|X-1| 참조 픽처들 중 현재 픽처와 가장 가까운 거리를 갖는 참조 픽처, 또는 L|X-1| 참조 픽처 리스트 내 기 정의된 인덱스를 갖는 참조 픽처로 선택될 수 있다.Alternatively, the LX (X is 0 or 1) reference picture is selected based on an explicitly signaled reference picture index, and the L|X-1| reference picture can be selected as a reference picture having the closest distance to the current picture among the L|X-1| reference pictures, or a reference picture having a predefined index in the L|X-1| reference picture list.

다른 예로, 현재 블록의 이웃 블록의 움직임 정보를 기초로 L0 및/또는 L1 참조 픽처를 선택할 수 있다. 일 예로, 현재 블록의 좌측 또는 상단 이웃 블록의 참조 픽처 인덱스를 이용하여, 쌍방 매칭에 이용될 L0 및/또는 L1 참조 픽처를 선택할 수 있다.As another example, the L0 and/or L1 reference pictures can be selected based on the motion information of the neighboring blocks of the current block. For example, the L0 and/or L1 reference pictures to be used for bilateral matching can be selected using the reference picture index of the left or upper neighboring block of the current block.

탐색 범위는 참조 픽처 내 콜로케이티드 블록으로부터 소정 범위 이내로 설정될 수 있다.The search range can be set within a predetermined range from a collocated block in a reference picture.

다른 예로, 초기 움직임 정보를 기초로 탐색 범위를 설정할 수 있다. 초기 움직임 정보는, 현재 블록의 이웃 블록으로부터 유도될 수 있다. 일 예로, 현재 블록의 좌측 이웃 블록 또는 상단 이웃 블록의 움직임 정보가, 현재 블록의 초기 움직임 정보로 설정될 수 있다.As another example, the search range can be set based on the initial motion information. The initial motion information can be derived from the neighboring blocks of the current block. For example, the motion information of the left neighboring block or the upper neighboring block of the current block can be set as the initial motion information of the current block.

쌍방 매칭 방법이 적용되는 경우, L0 움직임 벡터와 L1 방향의 움직임 벡터는 서로 반대 방향으로 설정된다. 이는, L0 움직임 벡터의 부호와 L1 방향의 움직임 벡터가 서로 반대 부호를 가짐을 나타낸다. 아울러, LX 움직임 벡터의 크기는, 현재 픽처와 LX 참조 픽처 사이의 거리(즉, POC 차분)에 비례할 수 있다. When the bidirectional matching method is applied, the L0 motion vector and the L1 direction motion vector are set to opposite directions. This indicates that the sign of the L0 motion vector and the L1 direction motion vector have opposite signs. In addition, the size of the LX motion vector can be proportional to the distance between the current picture and the LX reference picture (i.e., the POC difference).

이후, L0 참조 픽처의 탐색 범위에 속하는 참조 블록(이하, L0 참조 블록이라 함) 및 L1 참조 픽처의 탐색 범위에 속하는 참조 블록(이하, L1 참조 블록이라 함) 사이의 비용(cost)를 이용하여, 움직임 추정을 수행할 수 있다. Thereafter, motion estimation can be performed using the cost between a reference block belonging to the search range of the L0 reference picture (hereinafter referred to as an L0 reference block) and a reference block belonging to the search range of the L1 reference picture (hereinafter referred to as an L1 reference block).

현재 블록과의 벡터가 (x, y)인 L0 참조 블록을 선택한 경우, 현재 블록으로부터 (-Dx, -Dy) 만큼 이격된 위치의 L1 참조 블록을 선택할 수 있다. 여기서, D는, 현재 픽처와 L0 참조 픽처 사이의 거리 및 L1 참조 픽처와 현재 픽처 사이의 거리의 비율에 의해 결정될 수 있다.If an L0 reference block whose vector to the current block is (x, y) is selected, an L1 reference block located at a position (-Dx, -Dy) away from the current block can be selected. Here, D can be determined by the ratio of the distance between the current picture and the L0 reference picture and the distance between the L1 reference picture and the current picture.

일 예로, 도 10에 도시된 예에서, 현재 픽처(T)와 L0 참조 픽처(T-1) 사이의 거리의 절대값 및 현재 픽처(T)와 L1 참조 픽처(T+1) 사이의 거리의 절대값은 상호 동일하다. 이에 따라, 도시된 예에서, L0 움직임 벡터 (x0, y0) 및 L1 움직임 벡터 (x1, y1)는 상호 크기는 동일하나 거리는 반대이다. 만약, POC가 (T+2)인 L1 참조 픽처가 이용되었다면, L1 움직임 벡터 (x1, y1)은, (-2*x0, -2*y0)로 설정될 것이다. For example, in the example illustrated in FIG. 10, the absolute value of the distance between the current picture (T) and the L0 reference picture (T-1) and the absolute value of the distance between the current picture (T) and the L1 reference picture (T+1) are equal to each other. Accordingly, in the illustrated example, the L0 motion vector (x0, y0) and the L1 motion vector (x1, y1) have equal magnitudes but opposite distances. If an L1 reference picture with POC of (T+2) were used, the L1 motion vector (x1, y1) would be set to (-2*x0, -2*y0).

최적의 비용을 갖는 L0 참조 블록 및 L1 참조 블록이 선택되면, L0 참조 블록 및 L1 참조 블록 각각을 현재 블록의 L0 예측 블록 및 L1 예측 블록으로 설정할 수 있다. 이후, L0 참조 블록 및 L1 참조 블록의 가중합 연산을 통해, 현재 블록의 최종 예측 블록을 생성할 수 있다. Once the L0 reference block and L1 reference block with the optimal cost are selected, the L0 reference block and the L1 reference block can be set as the L0 prediction block and the L1 prediction block of the current block, respectively. Thereafter, the final prediction block of the current block can be generated through a weighted sum operation of the L0 reference block and the L1 reference block.

쌍방 매칭 방법이 적용되는 경우, 복호화기에서는 부호화기와 동일한 방법으로 움직임 추정을 수행할 수 있다. 이에 따라, 쌍방 움직임 매칭 방법이 적용되는지 여부를 나타내는 정보는 명시적으로 부/복호화하는 한편, 움직임 벡터 등의 움직임 정보의 부/복호화는 생략할 수 있다. 앞서 설명한 바와 같이, L0 참조 픽처 인덱스 또는 L1 참조 픽처 인덱스 중 적어도 하나가 명시적으로 부/복호화될 수도 있다. When the bilateral matching method is applied, the decoder can perform motion estimation in the same manner as the encoder. Accordingly, information indicating whether the bilateral motion matching method is applied can be explicitly encoded/decoded, while encoding/decoding of motion information such as a motion vector can be omitted. As described above, at least one of the L0 reference picture index or the L1 reference picture index can be explicitly encoded/decoded.

다른 예로, 쌍방 매칭 방법이 적용되었는지 여부를 나타내는 정보를 명시적으로 부/복호화하되, 쌍방 매칭 방법이 적용된 경우, L0 움직임 벡터 또는 L1 움직임 벡터를 명시적으로 부호화하여 시그날링할 수도 있다. L0 움직임 벡터가 시그날링된 경우, L1 움직임 벡터는, 현재 픽처와 L0 참조 픽처간의 POC 차분 및 현재 픽처와 L1 참조 픽처간의 POC 차분을 기초로 유도될 수 있다. L1 움직임 벡터가 시그날링된 경우, L0 움직임 벡터는, 현재 픽처와 L0 참조 픽처간의 POC 차분 및 현재 픽처와 L1 참조 픽처간의 POC 차분을 기초로 유도될 수 있다. 이때, 부호화기에서는, L0 움직임 벡터 및 L1 움직임 벡터 중 크기가 작은 것을 명시적으로 부호화할 수 있다. As another example, information indicating whether a bidirectional matching method is applied may be explicitly encoded/decoded, and if the bidirectional matching method is applied, the L0 motion vector or the L1 motion vector may be explicitly encoded and signaled. If the L0 motion vector is signaled, the L1 motion vector can be derived based on the POC difference between the current picture and the L0 reference picture and the POC difference between the current picture and the L1 reference picture. If the L1 motion vector is signaled, the L0 motion vector can be derived based on the POC difference between the current picture and the L0 reference picture and the POC difference between the current picture and the L1 reference picture. In this case, the encoder can explicitly encode a smaller one of the L0 motion vector and the L1 motion vector.

쌍방 매칭 방법이 적용되었는지 여부를 나타내는 정보는 1비트의 플래그일 수 있다. 일 예로, 상기 플래그가 참(예컨대, 1)인 것은, 현재 블록에 쌍방 매칭 방법이 적용됨을 나타낼 수 있다. 상기 플래그가 거짓(예컨대, 0)인 것은, 현재 블록에 쌍방 매칭 방법이 적용되지 않음을 나타낼 수 있다. 이 경우, 현재 블록에는, 움직임 정보 병합 모드 또는 움직임 벡터 예측 모드가 적용될 수 있다.Information indicating whether the bilateral matching method is applied may be a 1-bit flag. For example, if the flag is true (e.g., 1), it may indicate that the bilateral matching method is applied to the current block. If the flag is false (e.g., 0), it may indicate that the bilateral matching method is not applied to the current block. In this case, the motion information merging mode or the motion vector prediction mode may be applied to the current block.

위와 반대로, 현재 블록에 움직임 정보 병합 모드 및 움직임 벡터 예측 모드가 적용되지 않는 것으로 결정된 경우에 한하여, 쌍방 매칭 방법이 적용될 수 있다. 일 예로, 움직임 정보 병합 모드가 적용되는지 여부를 나타내는 제1 플래그 및 움직임 벡터 예측 모드가 적용되는지 여부를 나타내는 제2 플래그가 모두 0인 경우, 쌍방 매칭 방법이 적용될 수 있다. Conversely, the bilateral matching method may be applied only when it is determined that neither the motion information merging mode nor the motion vector prediction mode is applied to the current block. For example, the bilateral matching method may be applied when both the first flag indicating whether the motion information merging mode is applied and the second flag indicating whether the motion vector prediction mode is applied are 0.

또는, 쌍방 매칭 방법이, 움직임 정보 병합 모드 상의 움직임 정보 병합 후보 또는 움직임 벡터 예측 모드 상의 움직임 벡터 예측 후보로 삽입될 수도 있다. 이 경우, 선택된 움직임 정보 병합 후보 또는 선택된 움직임 벡터 예측 후보가 쌍방 매칭 방법을 가리키는지 여부에 기초하여, 쌍방 매칭 방법의 적용 여부가 결정될 수 있다.Alternatively, the bilateral matching method may be inserted as a motion information merging candidate in the motion information merging mode or a motion vector prediction candidate in the motion vector prediction mode. In this case, whether the bilateral matching method is applied may be determined based on whether the selected motion information merging candidate or the selected motion vector prediction candidate indicates the bilateral matching method.

쌍방 매칭 방법에서는, 현재 픽처의 시간적 순서가, L0 참조 픽처의 시간적 순서 및 L1 참조 픽처의 시간적 순서 사이에 존재해야 하는 것으로 예시되었다. 위 쌍방 매칭 방법의 제약이 적용되지 않는 단방향 매칭 방법을 적용하여, 현재 블록의 예측 블록을 생성할 수도 있다. 구체적으로, 단방향 매칭 방법에서는, 현재 블록보다 시간적 순서(즉, POC)가 작은 2개의 참조 픽처들 또는 현재 블록보다 시간적 순서가 큰 2개의 참조 픽처들이 이용될 수 있다. 이때, 2개의 참조 픽처들은 모두 L0 참조 픽처 리스트 또는 L1 참조 픽처 리스트로부터 유도된 것일 수 있다. 또는, 2개의 참조 픽처들 중 1개는 L0 참조 픽처 리스트로부터 유도되고, 다른 하나는 L1 참조 픽처 리스트로부터 유도될 수도 있다. In the bidirectional matching method, it is exemplified that the temporal order of the current picture must exist between the temporal order of the L0 reference picture and the temporal order of the L1 reference picture. A unidirectional matching method, to which the constraint of the above bidirectional matching method is not applied, may also be applied to generate a prediction block of the current block. Specifically, in the unidirectional matching method, two reference pictures having a temporal order (i.e., POC) smaller than that of the current block or two reference pictures having a temporal order larger than that of the current block may be used. At this time, both reference pictures may be derived from the L0 reference picture list or the L1 reference picture list. Alternatively, one of the two reference pictures may be derived from the L0 reference picture list and the other may be derived from the L1 reference picture list.

도 11은 단방향 매칭 방법 기반의 움직임 추정 방법을 설명하기 위한 도면이다. Figure 11 is a diagram for explaining a motion estimation method based on a one-way matching method.

단방향 매칭 방법은, 현재 픽처보다 POC가 작은 2개의 참조 픽처들(즉, Forward 참조 픽처들) 또는 현재 픽처보다 POC가 큰 2개의 참조 픽처들(즉, Backward 참조 픽처들)을 기초로 수행될 수 있다. 도 11에서는, 현재 픽처(T) 보다 POC가 작은 제1 참조 픽처(T-1) 및 제2 참조 픽처(T-2)를 기초로 단방향 매칭 방법에 기반한 움직임 추정이 수행되는 것으로 예시되었다. The one-way matching method can be performed based on two reference pictures having a POC smaller than that of the current picture (i.e., forward reference pictures) or two reference pictures having a POC larger than that of the current picture (i.e., backward reference pictures). In Fig. 11, it is illustrated that motion estimation based on the one-way matching method is performed based on a first reference picture (T-1) and a second reference picture (T-2) having a POC smaller than that of the current picture (T).

이때, 제1 참조 픽처를 식별하기 위한 제1 참조 픽처 인덱스 및 제2 참조 픽처를 식별하기 위한 제2 참조 픽처 인덱스가 각각 부호화되어 시그날링될 수 있다. 이때, 단방향 매칭 방법에 이용되는 두 참조 픽처들 중 현재 픽처와의 POC 차분이 더 작은 참조 픽처를 제1 참조 픽처로 설정할 수 있다. 이에 따라, 제1 참조 픽처가 선택되면, 참조 픽처 리스트에 포함된 참조 픽처들 중 제1 참조 픽처보다 현재 픽처와의 POC 차분이 더 큰 참조 픽처들만이 제2 참조 픽처로 설정될 수 있다. 제2 참조 픽처 인덱스는, 제1 참조 픽처와 동일한 시간적 방향을 가지면서, 제1 참조 픽처보다 현재 픽처와의 POC 차분이 더 큰 참조 픽처들을 재정렬한 뒤, 재정렬된 참조 픽처들 중 하나의 인덱스를 가리키도록 설정될 수 있다.At this time, a first reference picture index for identifying the first reference picture and a second reference picture index for identifying the second reference picture may be encoded and signaled, respectively. At this time, a reference picture having a smaller POC difference from the current picture among the two reference pictures used in the unidirectional matching method may be set as the first reference picture. Accordingly, when the first reference picture is selected, only reference pictures included in the reference picture list having a larger POC difference from the current picture than the first reference picture may be set as the second reference picture. The second reference picture index may be set to point to an index of one of the rearranged reference pictures after rearranging reference pictures having the same temporal direction as the first reference picture and having a larger POC difference from the current picture than the first reference picture.

위와 반대로, 두 참조 픽처들 중 현재 픽처와의 POC 차분이 더 큰 참조 픽처를 제1 참조 픽처로 설정할 수도 있다. 이 경우, 제2 참조 픽처 인덱스는, 제1 참조 픽처와 동일한 시간적 방향을 가지면서, 제1 참조 픽처보다 현재 픽처와의 POC 차분이 더 작은 참조 픽처들을 재정렬한 뒤, 재정렬된 참조 픽처들 중 하나의 인덱스를 가리키도록 설정될 수 있다.Conversely, a reference picture having a larger POC difference from the current picture among the two reference pictures may be set as the first reference picture. In this case, the second reference picture index may be set to point to an index of one of the rearranged reference pictures after rearranging the reference pictures having the same temporal direction as the first reference picture and having a smaller POC difference from the current picture than the first reference picture.

또는, 참조 픽처 리스트 내 기 정의된 인덱스가 할당된 참조 픽처 및 이와 동일한 시간적 방향을 갖는 참조 픽처를 이용하여, 단방향 매칭 방법을 수행할 수도 있다. 일 예로, 참조 픽처 리스트 내 인덱스가 0인 참조 픽처를 제1 참조 픽처로 설정하고, 참조 픽처 리스트 내 제1 참조 픽처와 시간적 방향이 동일한 참조 픽처들 중 인덱스가 가장 작은 참조 픽처를 제2 참조 픽처로 선택할 수 있다.Alternatively, a one-way matching method may be performed using a reference picture to which a predefined index is assigned in the reference picture list and a reference picture having the same temporal direction as the reference picture. For example, a reference picture having an index of 0 in the reference picture list may be set as the first reference picture, and a reference picture having the smallest index among reference pictures having the same temporal direction as the first reference picture in the reference picture list may be selected as the second reference picture.

제1 참조 픽처 및 제2 참조 픽처는 모두 L0 참조 픽처 리스트 또는 L1 참조 픽처 리스트로부터 선택될 수 있다. 도 11에서는, 2개의 L0 참조 픽처들이 단방향 매칭 방법에 이용되는 것으로 도시되었다. 또는, 제1 참조 픽처는 L0 참조 픽처 리스트로부터 선택되고, 제2 참조 픽처는 L1 참조 픽처 리스트로부터 선택될 수도 있다.Both the first reference picture and the second reference picture can be selected from the L0 reference picture list or the L1 reference picture list. In Fig. 11, two L0 reference pictures are illustrated as being used in the unidirectional matching method. Alternatively, the first reference picture may be selected from the L0 reference picture list and the second reference picture may be selected from the L1 reference picture list.

제1 참조 픽처 및/또는 제2 참조 픽처가 L0 참조 픽처 리스트에 속하는지 또는 L1 참조 픽처 리스트에 속하는지 여부를 나타내는 정보가 추가로 부/복호화될 수도 있다. Information indicating whether the first reference picture and/or the second reference picture belongs to the L0 reference picture list or the L1 reference picture list may be additionally encoded/decoded.

또는, L0 참조 픽처 리스트 및 L1 참조 픽처 리스트 중 디폴트로 설정된 하나를 이용하여 단방향 매칭을 수행할 수 있다. 또는, L0 참조 픽처 리스트 및 L1 참조 픽처 리스트 중 참조 픽처들의 개수가 더 많은 것으로부터 두개의 참조 픽처들을 선택할 수도 있다. Alternatively, one-way matching can be performed using one of the L0 reference picture list and the L1 reference picture list, which is set as default. Alternatively, two reference pictures can be selected from the L0 reference picture list and the L1 reference picture list, whichever has a larger number of reference pictures.

이후, 제1 참조 픽처 및 제2 참조 픽처 내 탐색 범위를 설정할 수 있다.Afterwards, a search range within the first reference picture and the second reference picture can be set.

탐색 범위는 참조 픽처 내 콜로케이티드 블록으로부터 소정 범위 이내로 설정될 수 있다.The search range can be set within a predetermined range from a collocated block in a reference picture.

다른 예로, 초기 움직임 정보를 기초로 탐색 범위를 설정할 수 있다. 초기 움직임 정보는, 현재 블록의 이웃 블록으로부터 유도될 수 있다. 일 예로, 현재 블록의 좌측 이웃 블록 또는 상단 이웃 블록의 움직임 정보가, 현재 블록의 초기 움직임 정보로 설정될 수 있다.As another example, the search range can be set based on the initial motion information. The initial motion information can be derived from the neighboring blocks of the current block. For example, the motion information of the left neighboring block or the upper neighboring block of the current block can be set as the initial motion information of the current block.

이후, 제1 참조 픽처의 탐색 범위에 속하는 제1 참조 블록 및 제2 참조 픽처의 탐색 범위에 속하는 제2 참조 블록 사이의 비용(cost)를 이용하여, 움직임 추정을 수행할 수 있다.Thereafter, motion estimation can be performed using the cost between the first reference block belonging to the search range of the first reference picture and the second reference block belonging to the search range of the second reference picture.

이때, 단방향 매칭 방법 하에서, 움직임 벡터의 크기는, 현재 픽처와 참조 픽처 사이의 거리에 비례하여 증가하도록 설정되어야 한다. 구체적으로, 현재 픽처와의 벡터가 (x, y)인 제1 참조 블록을 선택한 경우, 제2 참조 블록은 현재 블록으로부터 (Dx, Dy)만큼 이격되어야 한다. 여기서, D는, 현재 픽처와 제1 참조 픽처 사이의 거리 및 현재 픽처와 제2 참조 픽처 사이의 거리의 비율에 의해 결정될 수 있다.At this time, under the one-way matching method, the size of the motion vector should be set to increase in proportion to the distance between the current picture and the reference picture. Specifically, when a first reference block whose vector with the current picture is (x, y) is selected, the second reference block should be spaced apart from the current block by (Dx, Dy). Here, D can be determined by the ratio of the distance between the current picture and the first reference picture and the distance between the current picture and the second reference picture.

일 예로, 도 11의 예에서, 현재 픽처와 제1 참조 픽처 사이의 거리(즉, POC 차분)은 1이고, 현재 픽처와 제2 참조 픽처 사이의 거리(즉, POC 차분)은 2이다. 이에 따라, 제1 참조 픽처 내 제1 참조 블록에 대한 제1 움직임 벡터가 (x0, y0)인 경우, 제2 참조 픽처 내 제2 참조 블록에 대한 제2 움직임 벡터 (x1, y1)은, (2x0, 2y0)로 설정될 수 있다. For example, in the example of FIG. 11, the distance between the current picture and the first reference picture (i.e., the POC difference) is 1, and the distance between the current picture and the second reference picture (i.e., the POC difference) is 2. Accordingly, when the first motion vector for the first reference block in the first reference picture is (x0, y0), the second motion vector (x1, y1) for the second reference block in the second reference picture can be set to (2x0, 2y0).

최적의 비용을 갖는 제1 참조 블록 및 제2 참조 블록이 선택되면, 제1 참조 블록 및 제2 참조 블록 각각을 현재 블록의 제1 예측 블록 및 제2 예측 블록으로 설정할 수 있다. 이후, 제1 예측 블록 및 제2 예측 블록의 가중합 연산을 통해, 현재 블록의 최종 예측 블록을 생성할 수 있다. Once the first reference block and the second reference block having the optimal cost are selected, the first reference block and the second reference block can be set as the first prediction block and the second prediction block of the current block, respectively. Thereafter, the final prediction block of the current block can be generated through a weighted sum operation of the first prediction block and the second prediction block.

단방향 매칭 방법이 적용되는 경우, 복호화기에서는 부호화기와 동일한 방법으로 움직임 추정을 수행할 수 있다. 이에 따라, 단방향 움직임 매칭 방법이 적용되는지 여부를 나타내는 정보는 명시적으로 부/복호화하는 한편, 움직임 벡터 등의 움직임 정보의 부/복호화는 생략할 수 있다. 앞서 설명한 바와 같이, 제1 참조 픽처 인덱스 또는 제2 참조 픽처 인덱스 중 적어도 하나가 명시적으로 부/복호화될 수도 있다. When the unidirectional matching method is applied, the decoder can perform motion estimation in the same manner as the encoder. Accordingly, information indicating whether the unidirectional motion matching method is applied can be explicitly encoded/decoded, while encoding/decoding of motion information such as a motion vector can be omitted. As described above, at least one of the first reference picture index or the second reference picture index can be explicitly encoded/decoded.

다른 예로, 단방향 매칭 방법이 적용되었는지 여부를 나타내는 정보를 명시적으로 부/복호화하되, 단방향 매칭 방법이 적용된 경우, 제1 움직임 벡터 또는 제2 움직임 벡터를 명시적으로 부호화하여 시그날링할 수도 있다. 제1 움직임 벡터가 시그날링된 경우, 제2 움직임 벡터는, 현재 픽처와 제1 참조 픽처간의 POC 차분 및 현재 픽처와 제2 참조 픽처간의 POC 차분을 기초로 유도될 수 있다. 제2 움직임 벡터가 시그날링된 경우, 제1 움직임 벡터는, 현재 픽처와 제1 참조 픽처간의 POC 차분 및 현재 픽처와 제2 참조 픽처간의 POC 차분을 기초로 유도될 수 있다. 이때, 부호화기에서는, 제1 움직임 벡터 및 제2 움직임 벡터 중 크기가 작은 것을 명시적으로 부호화할 수 있다. As another example, information indicating whether a unidirectional matching method is applied may be explicitly encoded/decoded, and if the unidirectional matching method is applied, the first motion vector or the second motion vector may be explicitly encoded and signaled. If the first motion vector is signaled, the second motion vector may be derived based on the POC difference between the current picture and the first reference picture and the POC difference between the current picture and the second reference picture. If the second motion vector is signaled, the first motion vector may be derived based on the POC difference between the current picture and the first reference picture and the POC difference between the current picture and the second reference picture. In this case, the encoder may explicitly encode a smaller one of the first motion vector and the second motion vector.

단방향 매칭 방법이 적용되었는지 여부를 나타내는 정보는 1비트의 플래그일 수 있다. 일 예로, 상기 플래그가 참(예컨대, 1)인 것은, 현재 블록에 단방향 매칭 방법이 적용됨을 나타낼 수 있다. 상기 플래그가 거짓(예컨대, 0)인 것은, 현재 블록에 단방향 매칭 방법이 적용되지 않음을 나타낼 수 있다. 이 경우, 현재 블록에는, 움직임 정보 병합 모드 또는 움직임 벡터 예측 모드가 적용될 수 있다.Information indicating whether a one-way matching method is applied may be a 1-bit flag. For example, if the flag is true (e.g., 1), it may indicate that a one-way matching method is applied to the current block. If the flag is false (e.g., 0), it may indicate that a one-way matching method is not applied to the current block. In this case, a motion information merging mode or a motion vector prediction mode may be applied to the current block.

위와 반대로, 현재 블록에 움직임 정보 병합 모드 및 움직임 벡터 예측 모드가 적용되지 않는 것으로 결정된 경우에 한하여, 단방향 매칭 방법이 적용될 수 있다. 일 예로, 움직임 정보 병합 모드가 적용되는지 여부를 나타내는 제1 플래그 및 움직임 벡터 예측 모드가 적용되는지 여부를 나타내는 제2 플래그가 모두 0인 경우, 단방향 매칭 방법이 적용될 수 있다. Conversely, the one-way matching method may be applied only when it is determined that the motion information merging mode and the motion vector prediction mode are not applied to the current block. For example, the one-way matching method may be applied when the first flag indicating whether the motion information merging mode is applied and the second flag indicating whether the motion vector prediction mode is applied are both 0.

또는, 단방향 매칭 방법이, 움직임 정보 병합 모드 상의 움직임 정보 병합 후보 또는 움직임 벡터 예측 모드 상의 움직임 벡터 예측 후보로 삽입될 수도 있다. 이 경우, 선택된 움직임 정보 병합 후보 또는 선택된 움직임 벡터 예측 후보가 단방향 매칭 방법을 가리키는지 여부에 기초하여, 단방향 매칭 방법의 적용 여부가 결정될 수 있다.Alternatively, the unidirectional matching method may be inserted as a motion information merging candidate in the motion information merging mode or a motion vector prediction candidate in the motion vector prediction mode. In this case, whether the unidirectional matching method is applied may be determined based on whether the selected motion information merging candidate or the selected motion vector prediction candidate indicates the unidirectional matching method.

움직임 벡터의 정밀도를 조절하여, 오브젝트의 화면 간 움직임을 탐색할 수도 있다. 구체적으로, 픽처 내 픽셀들 각각의 위치는 정수로 특정된다. 반면, 오브젝트의 화면 간 움직임은 정수 위치로 표현되지 않을 수 있다. By adjusting the precision of the motion vector, it is also possible to detect the movement of an object between screens. Specifically, the position of each pixel in a picture is specified as an integer. On the other hand, the movement of an object between screens may not be expressed as an integer position.

이를 고려하여, 참조 픽처에 대해 보간을 수행하여, 분수 화소 단위로 움직임 벡터를 탐색할 수 있다.Taking this into account, we can search for motion vectors on a fractional pixel basis by performing interpolation on the reference picture.

도 12 및 도 13은 움직임 벡터의 정밀도에 따라 예측 블록이 생성되는 예를 도시한 것이다.Figures 12 and 13 illustrate examples in which prediction blocks are generated according to the precision of a motion vector.

도 12는, 현재 픽처 내 현재 블록의 위치를 나타낸 것이고, 도 13은, 움직임 벡터에 따라, 예측 블록이 획득되는 예를 도시한 것이다.Figure 12 shows the location of the current block within the current picture, and Figure 13 shows an example in which a prediction block is obtained according to a motion vector.

구체적으로, 도 13의 (a)는, 움직임 벡터 정밀도가 정수 화소 단위인 경우의 예를 나타내고, 도 13의 (b) 및 (c)는, 각각, 움직임 벡터 정밀도가 1/2 화소 단위 및 1/4 화소 단위인 경우의 예를 나타낸다.Specifically, (a) of Fig. 13 shows an example in which the motion vector precision is in integer pixel units, and (b) and (c) of Fig. 13 show examples in which the motion vector precision is in 1/2 pixel units and 1/4 pixel units, respectively.

도시된 것보다, 더 작은 단위로, 움직임 벡터 정밀도를 설정할 수도 있다. 일 예로, 움직임 벡터 정밀도는 1/8 화소 단위, 1/16 화소 단위 또는 1/32 화소 단위로 설정될 수 있다. The motion vector precision can also be set in smaller units than those shown. For example, the motion vector precision can be set in 1/8 pixel units, 1/16 pixel units, or 1/32 pixel units.

현재 블록의 움직임 벡터가 정수 단위로 표현되는 경우, 도 13의 (a) 도시된 예에서와 같이, 정수 위치 샘플들로 구성된 참조 블록을, 현재 블록의 예측 블록으로 설정할 수 있다.When the motion vector of the current block is expressed in integer units, a reference block composed of integer position samples can be set as the prediction block of the current block, as in the example illustrated in (a) of Fig. 13.

반면, 현재 블록의 움직임 벡터가 분수 단위로 표현되는 경우, 도 13의 (b) 및 (c)에 도시된 예에서와 같이, 분수 위치 샘플들로 구성된 참조 블록을, 현재 블록의 예측 블록으로 설정할 수 있다. 이때, 참조 블록 내 분수 위치 샘플은, 정수 위치 샘플들을 보간하여 생성될 수 있다. 보간 필터는, 4탭 또는 8탭의 크기를 가질 수 있다. On the other hand, if the motion vector of the current block is expressed in fractional units, as in the examples shown in (b) and (c) of Fig. 13, a reference block composed of fractional position samples can be set as a prediction block of the current block. At this time, the fractional position samples in the reference block can be generated by interpolating integer position samples. The interpolation filter can have a size of 4 taps or 8 taps.

다른 예로, 복잡도 감소를 위해, 분수 위치에 인접하는 정수 위치 샘플들만을 이용하는 선형 보간을 통해, 분수 위치 샘플을 생성할 수도 있다. As another example, to reduce complexity, fractional position samples can be generated via linear interpolation using only integer position samples adjacent to the fractional position.

현재 블록의 움직임 벡터 정밀도를 지시하는 정보가 부호화되어 시그날링될 수 있다. 일 예로, 복수의 움직임 벡터 정밀도 후보들 각각에 상이한 인덱스를 할당한 뒤, 현재 블록의 움직임 벡터 정밀도에 해당하는 움직임 벡터 정밀도 후보의 인덱스를 부호화하여 시그날링할 수 있다. Information indicating the motion vector precision of the current block can be encoded and signaled. For example, after assigning a different index to each of a plurality of motion vector precision candidates, the index of the motion vector precision candidate corresponding to the motion vector precision of the current block can be encoded and signaled.

이때, 이용 가능한 움직임 벡터 후보들의 개수 및/또는 종류는, 현재 블록의 크기, 현재 블록의 형태, 참조 픽처 또는 움직임 보상 모델 중 적어도 하나에 기초하여 결정될 수 있다. 여기서, 움직임 보상 모델은, 병진(translation) 모델, 주밍 모델 또는 회전 모델 중 적어도 하나를 포함할 수 있다. 병진 모델에, 주밍 모델 또는 회전 모델 중 적어도 하나가 결합된 움직임 보상 모델을 어파인(Affine) 모델이라 호칭할 수도 있다.At this time, the number and/or types of available motion vector candidates can be determined based on at least one of the size of the current block, the shape of the current block, the reference picture, or the motion compensation model. Here, the motion compensation model can include at least one of a translation model, a zooming model, or a rotation model. A motion compensation model in which at least one of a zooming model or a rotation model is combined with a translation model may be referred to as an affine model.

현재 블록에 대해 이용 가능한 움직임 벡터 후보들 중 하나를 지시하는 인덱스가 부호화될 수 있다. 현재 블록에 대해 이용 가능한 움직임 벡터 후보들의 개수에 따라, 인덱스를 부호화하는데 필요한 최대 비트수가 결정될 수 있다.An index pointing to one of the available motion vector candidates for the current block may be encoded. Depending on the number of motion vector candidates available for the current block, the maximum number of bits required to encode the index may be determined.

움직임 벡터의 정밀도를 조절함으로써, 더욱 정밀하게 움직임 벡터를 탐색할 수 있고, 이에 따라, 현재 블록에 대한 예측 정확도를 향상시킬 수 있다. By adjusting the precision of the motion vector, the motion vector can be searched more precisely, and thus the prediction accuracy for the current block can be improved.

한편, 분수 위치로 표현된 움직임 벡터는, 정수로 스케일 업되어 부호화될 수 있다. Meanwhile, motion vectors expressed in fractional positions can be scaled up to integers and encoded.

오브젝트의 움직임에 대한 보상은, 오브젝트의 선형 움직임(예컨대, 수평 및/또는 수직 방향으로의 움직임)을 보상하기 위한 병진 모델, 오브젝트의 크기 변경을 보상하는 주밍(Zooming) 모델 및 오브젝트의 회전 움직임을 보상하는 회전 모델 중 적어도 하나에 기반하여 수행될 수 있다. 여기서, 주밍은, 크기 확대 또는 크기 축소를 나타낼 수 있다.Compensation for the motion of the object may be performed based on at least one of a translational model for compensating for linear motion of the object (e.g., motion in the horizontal and/or vertical direction), a zooming model for compensating for change in size of the object, and a rotational model for compensating for rotational motion of the object. Here, zooming may represent size enlargement or size reduction.

도 14는 현재 블록에 대해, 병진 모델 및 주밍 모델에 기반한 움직임 보상이 수행되는 예를 나타낸 것이다.Figure 14 shows an example in which motion compensation based on the translational model and the zooming model is performed for the current block.

설명의 편의를 위해, 현재 블록은, 도 12에 도시된 것과 같이, 4x4 크기를 갖는 것으로 가정한다.For convenience of explanation, the current block is assumed to have a size of 4x4, as illustrated in Fig. 12.

도 14에서, 변수 α는 크기 조절 파라미터를 나타낸다. 참조 블록의 크기는, 현재 블록의 크기에 변수 α를 곱하여 유도될 수 있다.In Fig. 14, the variable α represents a size adjustment parameter. The size of the reference block can be derived by multiplying the size of the current block by the variable α.

크기 조절 파라미터 α가 1보다 작은 것은, 참조 블록이 현재 블록보다 작음을 나타내고, 크기 조절 파라미터 α가 1보다 큰 것은, 참조 블록이 현재 블록보다 큼을 나타낸다.A sizing parameter α less than 1 indicates that the reference block is smaller than the current block, and a sizing parameter α greater than 1 indicates that the reference block is larger than the current block.

도 14의 (a) 및 (b)는, 크기 조절 파라미터 α가 1보다 작은 경우의 예를 나타낸 것이고, 도 14의 (c)는, 크기 조절 파라미터 α가 1보다 큰 경우의 예를 나타낸 것이다.Figures 14 (a) and (b) show examples when the size adjustment parameter α is less than 1, and Figure 14 (c) shows examples when the size adjustment parameter α is greater than 1.

현재 블록의 움직임 벡터를 기반으로, 참조 블록의 좌상단 위치를 특정할 수 있다. 구체적으로, 참조 픽처 내 현재 블록의 좌상단 샘플에 대응하는 위치로부터, 움직임 벡터 만큼 이격된 위치를 참조 블록의 좌상단 위치로 설정할 수 있다. 이후, 크기 조절 파라미터에 따라, 너비 및 높이가 각각 현재 블록의 너비 및 높이의 α배인 참조 블록을 설정할 수 있다. 참조 블록 내 분수 위치 샘플은, 정수 위치 샘플들을 보간하여 생성될 수 있다. Based on the motion vector of the current block, the upper left position of the reference block can be specified. Specifically, a position spaced apart by the motion vector from a position corresponding to the upper left sample of the current block in the reference picture can be set as the upper left position of the reference block. Then, according to the size adjustment parameter, a reference block whose width and height are α times the width and height of the current block, respectively, can be set. The fractional position samples in the reference block can be generated by interpolating the integer position samples.

움직임 벡터 및 크기 조절 파라미터에 의해 유도된 참조 블록은, 현재 블록의 예측 블록으로 설정될 수 있다. A reference block derived by the motion vector and scale parameters can be set as a prediction block of the current block.

한편, 크기 조절 파라미터 α에 대한 정보가 부호화되어 시그날링될 수 있다. 구체적으로, 복수의 크기 조절 파라미터 후보들 각각에 상이한 인덱스가 할당되고, 현재 블록에 적용되는 크기 조절 파라미터 후보를 특정하는 인덱스가 부호화되어 시그날링될 수 있다. Meanwhile, information about the sizing parameter α may be encoded and signaled. Specifically, a different index may be assigned to each of a plurality of sizing parameter candidates, and an index specifying a sizing parameter candidate applied to the current block may be encoded and signaled.

또는, 이웃 블록의 크기 조절 파라미터에 기초하여, 현재 블록의 크기 조절 파라미터를 유도할 수도 있다. 일 예로, 기 정의된 위치의 이웃 블록의 크기 조절 파라미터를, 현재 블록의 크기 조절 파라미터로 설정할 수 있다. Alternatively, the resizing parameters of the current block can be derived based on the resizing parameters of the neighboring blocks. For example, the resizing parameters of the neighboring blocks at a predefined position can be set as the resizing parameters of the current block.

또는, 복수개의 이웃 블록들을 순차적으로 탐색하였을 때, 첫번째로 탐색된 가용한 이웃 블록의 크기 조절 파라미터를, 현재 블록의 크기 조절 파라미터로 설정할 수 있다.Alternatively, when sequentially searching multiple neighboring blocks, the size adjustment parameter of the first searched available neighboring block can be set as the size adjustment parameter of the current block.

또는, 이웃 블록의 크기 조절 파라미터를 크기 조절 파라미터 후보로 설정할 수 있다. 이 경우, 복수개의 이웃 블록들을 순차적으로 탐색하여, 복수개의 크기 조절 파라미터 후보들을 포함하는 크기 조절 파라미터 후보 리스트를 생성할 수 있다. 복수개의 크기 조절 파라미터 후보 리스트에 포함된 복수개의 크기 조절 파라미터 후보들 중 하나를 현재 블록의 크기 조절 파라미터로 설정할 수 있다. 이 경우, 복수개의 크기 조절 파라미터 후보들 중 현재 블록의 크기 조절 파라미터와 동일한 후보를 지시하는 인덱스가 부호화되어 시그날링될 수 있다. Alternatively, the size adjustment parameter of the neighboring block may be set as the size adjustment parameter candidate. In this case, a plurality of neighboring blocks may be sequentially searched to generate a size adjustment parameter candidate list including a plurality of size adjustment parameter candidates. One of the plurality of size adjustment parameter candidates included in the plurality of size adjustment parameter candidate lists may be set as the size adjustment parameter of the current block. In this case, an index indicating a candidate that is identical to the size adjustment parameter of the current block among the plurality of size adjustment parameter candidates may be encoded and signaled.

한편, 현재 블록의 크기 조절 파라미터를 유도하는데 이용되는 이웃 블록은, 상단 이웃 블록, 좌측 이웃 블록, 좌상단 이웃 블록, 우상단 이웃 블록 또는 좌하단 이웃 블록 중 적어도 하나를 포함할 수 있다.Meanwhile, the neighboring blocks used to derive the size adjustment parameters of the current block may include at least one of an upper neighboring block, a left neighboring block, an upper-left neighboring block, an upper-right neighboring block, or a lower-left neighboring block.

도 15는 현재 블록에 대해, 병진 모델 및 회전 모델에 기반한 움직임 보상이 수행되는 예를 나타낸 것이다.Figure 15 shows an example in which motion compensation based on translational models and rotational models is performed for the current block.

설명의 편의를 위해, 현재 블록은, 도 12에 도시된 것과 같이, 4x4 크기를 갖는 것으로 가정한다.For convenience of explanation, the current block is assumed to have a size of 4x4, as illustrated in Fig. 12.

먼저, 도 15의 (a)에 도시된 에에서와 같이, 현재 블록의 움직임 벡터를 기초로, 참조 픽처 내 임시 블록의 위치를 특정할 수 있다. 구체적으로, 참조 픽처 내 현재 블록의 좌상단 샘플에 대응하는 위치로부터, 움직임 벡터 만큼 이격된 위치를 좌상단 샘플로 삼는 블록 위치를 특정할 수 있다.First, as in the example illustrated in (a) of Fig. 15, the position of a temporary block in a reference picture can be specified based on the motion vector of the current block. Specifically, a block position that takes a position spaced apart by the motion vector from the position corresponding to the upper left sample of the current block in the reference picture as the upper left sample can be specified.

이후, 도 15의 (b)에 도시된 예에서와 같이, 임시 블록을 회전할 수 있다. 회전된 위치의 블록은 참조 블록으로 설정되고, 참조 블록은, 현재 블록의 예측 블록으로 설정될 수 있다. Thereafter, the temporary block can be rotated, as in the example shown in (b) of Fig. 15. The block at the rotated position is set as a reference block, and the reference block can be set as a prediction block of the current block.

한편, 움직임 벡터에 의해 특정된 임시 블록을 회전함에 있어서, 회전 행렬이 이용될 수 있다. 즉, 현재 블록에 대한 예측 샘플은, 임시 블록 내 샘플 위치에 회전 행렬을 적용함으로써 획득된 위치의 샘플로 설정될 수 있다.Meanwhile, a rotation matrix can be used to rotate a temporary block specified by a motion vector. That is, a prediction sample for the current block can be set to a sample at a position obtained by applying a rotation matrix to a sample position within the temporary block.

수학식 1은 회전 행렬을 나타낸 것이다. Mathematical expression 1 represents the rotation matrix.

Figure PCTKR2024008916-appb-img-000001
Figure PCTKR2024008916-appb-img-000001

상기 수학식 1에서, (pos_x, pos_y)는, 임시 블록 내 샘플의 위치를 나타낸다. 즉, (pos_x, pos_y)는, 현재 블록 내 예측 대상 샘플의 위치에 움직임 벡터를 더하여 유도될 수 있다. In the above mathematical expression 1, (pos_x, pos_y) represents the position of a sample within a temporary block. That is, (pos_x, pos_y) can be derived by adding a motion vector to the position of a prediction target sample within the current block.

(pos_x', pos_y')은, 임시 블록 내 샘플의 위치로부터 회전된 위치를 나타내고, θ는 회전 각도를 의미한다.(pos_x', pos_y') represents the rotated position from the position of the sample within the temporary block, and θ represents the rotation angle.

참조 픽처 내 (pos_x', pos_y') 위치의 샘플 값이, 예측 대상 샘플의 위치에 대한 예측 샘플의 값으로 설정될 수 있다. (pos_x', pos_y') 위치가 분수 위치인 경우, 정수 위치 샘플들을 보간하여, 해당 위치의 샘플이 생성될 수 있다.The sample value at the (pos_x', pos_y') position in the reference picture can be set as the value of the prediction sample for the position of the prediction target sample. If the (pos_x', pos_y') position is a fractional position, the sample at the corresponding position can be generated by interpolating integer position samples.

한편, 회전 각도 θ를 나타내는 정보가 부호화되어 시그날링될 수 있다. 일 예로, 복수의 회전 각도 후보들 각각에 상이한 인덱스를 할당한 뒤, 현재 블록의 회전 각도에 해당하는 회전 각도 후보의 인덱스를 부호화하여 시그날링할 수 있다. Meanwhile, information indicating the rotation angle θ can be encoded and signaled. For example, after assigning a different index to each of a plurality of rotation angle candidates, the index of the rotation angle candidate corresponding to the rotation angle of the current block can be encoded and signaled.

또는, 이웃 블록의 회전 각도에 기초하여, 현재 블록의 회전 각도를 유도할 수도 있다. 일 예로, 기 정의된 위치의 이웃 블록의 회전 각도를, 현재 블록의 회전 각도로 설정할 수 있다. Alternatively, the rotation angle of the current block can be derived based on the rotation angle of the neighboring block. For example, the rotation angle of the neighboring block at a predefined position can be set to the rotation angle of the current block.

또는, 복수개의 이웃 블록들을 순차적으로 탐색하였을 때, 첫번째로 탐색된 가용한 이웃 블록의 회전 각도를, 현재 블록의 회전 각도로 설정할 수 있다.Alternatively, when sequentially searching multiple neighboring blocks, the rotation angle of the first searched available neighboring block can be set to the rotation angle of the current block.

또는, 이웃 블록의 회전 각도를 회전 각도 후보로 설정할 수 있다. 이 경우, 복수개의 이웃 블록들을 순차적으로 탐색하여, 복수개의 회전 각도 후보들을 포함하는 회전 각도 후보 리스트를 생성할 수 있다. 복수개의 회전 각도 후보 리스트에 포함된 복수개의 회전 각도 후보들 중 하나를 현재 블록의 회전 각도로 설정할 수 있다. 이 경우, 복수개의 회전 각도 후보들 중 현재 블록의 회전 각도와 동일한 후보를 지시하는 인덱스가 부호화되어 시그날링될 수 있다. Alternatively, the rotation angle of the neighboring block may be set as the rotation angle candidate. In this case, a plurality of neighboring blocks may be sequentially searched to generate a rotation angle candidate list including a plurality of rotation angle candidates. One of the plurality of rotation angle candidates included in the plurality of rotation angle candidate lists may be set as the rotation angle of the current block. In this case, an index indicating a candidate having the same rotation angle as the current block among the plurality of rotation angle candidates may be encoded and signaled.

한편, 현재 블록의 회전 각도를 유도하는데 이용되는 이웃 블록은, 상단 이웃 블록, 좌측 이웃 블록, 좌상단 이웃 블록, 우상단 이웃 블록 또는 좌하단 이웃 블록 중 적어도 하나를 포함할 수 있다.Meanwhile, the neighboring block used to derive the rotation angle of the current block may include at least one of an upper neighboring block, a left neighboring block, an upper-left neighboring block, an upper-right neighboring block, or a lower-left neighboring block.

도시되지는 않았지만, 병진 모델, 주밍 모델 및 회전 모델을 동시에 적용하여, 현재 블록에 대한 움직임 보상을 수행할 수도 있다. Although not shown, it is also possible to perform motion compensation for the current block by simultaneously applying the translation model, zooming model, and rotation model.

한편, 현재 블록에 대한 움직임 벡터 정밀도 또는 현재 블록에 이용 가능한 움직임 벡터 정밀도 후보의 개수 및/또는 종류는, 움직임 보상 모델에 따라 상이하게 결정될 수 있다. Meanwhile, the motion vector precision for the current block or the number and/or types of motion vector precision candidates available for the current block may be determined differently depending on the motion compensation model.

일 예로, 현재 블록에 이용 가능한 움직임 벡터 정밀도 후보의 개수 및/또는 종류는, 병진 모델만이 적용되는 경우와 주밍 모델 또는 회전 모델 중 적어도 하나가 적용되는 경우 사이에 있어서, 상이할 수 있다. For example, the number and/or type of motion vector precision candidates available for the current block may differ between cases where only a translational model is applied and cases where at least one of a zooming model or a rotational model is applied.

구체적 예로, 현재 블록에 병진 모델이 적용되는 경우, 1/4 화소 단위 이상의 후보들이 현재 블록에 이용 가능할 수 있다. 반면, 현재 블록에 병진 모델과 함께 주밍 모델 또는 회전 모델 중 적어도 하나가 추가 적용되는 경우, 1/16 화소 단위 이상의 후보들이 현재 블록에 대해 이용 가능할 수 있다. For example, if a translational model is applied to the current block, candidates of 1/4 pixel unit or more may be available for the current block. On the other hand, if at least one zooming model or rotational model is additionally applied to the current block along with the translational model, candidates of 1/16 pixel unit or more may be available for the current block.

또는, 현재 블록에 병진 모델이 적용되는 경우, 현재 블록의 움직임 벡터 정밀도가 1/4 화소 단위로 설정될 수 있다. 반면, 현재 블록에 병진 모델과 함께 주밍 모델 또는 회전 모델 중 적어도 하나가 추가 적용되는 경우, 현재 블록의 움직임 벡터 정밀도가 1/16 화소 단위로 설정될 수도 있다. Alternatively, if a translational model is applied to the current block, the motion vector precision of the current block may be set to 1/4 pixel units. On the other hand, if at least one of a zooming model or a rotational model is additionally applied to the current block along with the translational model, the motion vector precision of the current block may be set to 1/16 pixel units.

한편, 부호화기 및 복호화기에, 움직임 보상 모델 마다 이용 가능한 움직임 벡터 정밀도 또는 이용 가능한 움직임 벡터 정밀도 후보들이 기 저장되어 있을 수 있다. 또는, 상위 헤더를 통해, 움직임 보상 모델 마다 이용 가능한 움직임 벡터 정밀도 또는 이용 가능한 움직임 벡터 정밀도 후보들을 나타내는 정보가 부호화되어 시그날링될 수 있다.Meanwhile, in the encoder and decoder, the available motion vector precisions or available motion vector precision candidates for each motion compensation model may be pre-stored. Alternatively, information indicating the available motion vector precisions or available motion vector precision candidates for each motion compensation model may be encoded and signaled through the upper header.

컨트롤 포인트의 움직임 벡터를 이용하여, 병진 모델에 주밍 모델 및/또는 회전 모델이 부가된 어파인 모델에 대한 움직임 보상을 수행할 수 있다. 여기서, 컨트롤 포인트는, 현재 블록의 코너에 대응하는 것일 수 있다. 일 예로, 어파인 모델에 기반하는 움직임 보상을 수행하기 위해, 좌상단 코너의 움직임 벡터, 우상단 코너의 움직임 벡터, 또는 좌하단 코너의 움직임 벡터 중 적어도 하나가 이용될 수 있다. Motion compensation can be performed on an affine model to which a zooming model and/or a rotation model are added to a translational model by using the motion vector of the control point. Here, the control point may correspond to a corner of the current block. For example, in order to perform motion compensation based on the affine model, at least one of the motion vector of the upper left corner, the motion vector of the upper right corner, or the motion vector of the lower left corner can be used.

이하에서는, 컨트롤 포인트의 움직임 벡터를, 컨트롤 포인트 움직임 벡터라 호칭하기로 한다.Hereinafter, the motion vector of a control point is referred to as the control point motion vector.

도 16 및 도 17은 컨트롤 포인트 움직임 벡터들을 이용하여 현재 블록에 대한 예측 블록을 생성하는 예를 나타낸다.Figures 16 and 17 show examples of generating a prediction block for a current block using control point motion vectors.

설명의 편의를 위해, 현재 블록은, 도 12에 도시된 것과 같이, 4x4 크기를 갖는 것으로 가정한다.For convenience of explanation, the current block is assumed to have a size of 4x4, as illustrated in Fig. 12.

도 16의 (a) 및 (b)에서는, 현재 블록의 좌상단 코너에 해당하는 제1 컨트롤 포인트의 움직임 벡터(제1 컨트롤 포인트 움직임 벡터, A) 및 현재 블록의 우상단 코너에 해당하는 제2 컨트롤 포인트의 움직임 벡터(제2 컨트롤 포인트 움직임 벡터, B)에 의해, 현재 블록에 대한 예측 블록이 유도되는 것으로 예시되었다. In (a) and (b) of FIG. 16, it is exemplified that a prediction block for the current block is derived by a motion vector of a first control point corresponding to the upper left corner of the current block (a first control point motion vector, A) and a motion vector of a second control point corresponding to the upper right corner of the current block (a second control point motion vector, B).

도시된 예에 그치지 않고, 좌하단 코너의 움직임 벡터를 추가 이용하거나, 우상단 코너 대신 좌하단 코너의 움직임 벡터를 이용하여, 현재 블록의 예측 블록을 유도하는 것도 가능하다.In addition to the illustrated example, it is also possible to derive a prediction block of the current block by additionally utilizing the motion vector of the lower left corner, or by utilizing the motion vector of the lower left corner instead of the upper right corner.

도 18은 3개의 컨트롤 포인트 움직임 벡터들을 이용하여 현재 블록에 대한 예측 블록을 생성하는 예를 나타낸다.Figure 18 shows an example of generating a prediction block for the current block using three control point motion vectors.

도 18의 (a) 및 (b)에서는, 현재 블록의 좌상단 코너에 해당하는 제1 컨트롤 포인트의 움직임 벡터(제1 컨트롤 포인트 움직임 벡터, A), 현재 블록의 우상단 코너에 해당하는 제2 컨트롤 포인트의 움직임 벡터(제2 컨트롤 포인트 움직임 벡터, B) 및 현재 블록의 좌하단 코너에 해당하는 제3 컨트롤 포인트의 움직임 벡터(제3 컨트롤 포인트 움직임 벡터, C)에 의해, 현재 블록에 대한 예측 블록이 유도되는 것으로 예시되었다. In (a) and (b) of FIG. 18, it is exemplified that a prediction block for the current block is derived by a motion vector of a first control point corresponding to the upper left corner of the current block (first control point motion vector, A), a motion vector of a second control point corresponding to the upper right corner of the current block (second control point motion vector, B), and a motion vector of a third control point corresponding to the lower left corner of the current block (third control point motion vector, C).

도 16 내지 도 18에 도시된 예에서와 같이, 2개의 컨트롤 포인트 움직임 벡터들 또는 3개의 컨트롤 포인트 움직임 벡터들을 이용하여, 현재 블록에 대한 병진, 주밍 및 회전 움직임 보상이 수행될 수 있다. As in the examples illustrated in FIGS. 16 to 18, translational, zooming, and rotational motion compensation for the current block can be performed using two control point motion vectors or three control point motion vectors.

컨트롤 포인트 움직임 벡터들의 개수를 나타내는 정보가 부호화되어 시그날링될 수 있다. 상기 정보는, 블록 단위로 시그날링될 수 있다. 일 예로, 상기 정보는, 현재 블록에 2개의 컨트롤 포인트 움직임 벡터들이 이용되는지 또는 3개의 컨트롤 포인트 움직임 벡터들이 이용되는지 여부를 지시할 수 있다. Information indicating the number of control point motion vectors can be encoded and signaled. The information can be signaled on a block-by-block basis. For example, the information can indicate whether two or three control point motion vectors are used in the current block.

또는, 현재 블록의 크기 또는 형태 중 적어도 하나에 기초하여, 컨트롤 포인트 움직임 벡터들의 개수가 적응적으로 결정될 수 있다.Alternatively, the number of control point motion vectors can be adaptively determined based on at least one of the size or shape of the current block.

또는, 현재 블록의 컨트롤 포인트 움직임 벡터들이 이웃 블록으로부터 유도되는 경우, 현재 블록에 대한 컨트롤 포인트 움직임 벡터들의 개수는, 이웃 블록의 컨트롤 포인트 움직임 벡터들의 개수와 동일하게 설정될 수 있다. Alternatively, if the control point motion vectors of the current block are derived from neighboring blocks, the number of control point motion vectors for the current block can be set equal to the number of control point motion vectors of the neighboring blocks.

컨트롤 포인트 움직임 벡터들을 이용하여, 현재 블록 내 샘플별 움직임 벡터를 유도할 수 있다. 수학식 2는, 2개의 컨트롤 포인트 움직임 벡터들을 이용하여, 샘플마다 움직임 벡터를 유도하는 수식을 나타낸다. Using the control point motion vectors, the motion vector for each sample in the current block can be derived. Mathematical expression 2 represents a formula for deriving a motion vector for each sample using two control point motion vectors.

Figure PCTKR2024008916-appb-img-000002
Figure PCTKR2024008916-appb-img-000002

상기 수학식 2에서, (mvx, mvy)는, 현재 블록 내 (x, y) 위치에서의 움직임 벡터를 나타낸다. (mvAx, mvAy)는, 제1 컨트롤 포인트 움직임 벡터(A)를 나타내고, (mvBx, mvBy)는, 제2 컨트롤 포인트 움직임 벡터(B)를 나타낸다. W는, 현재 블록의 너비를 나타낸다. In the above mathematical expression 2, (mv x , mv y ) represents a motion vector at the (x, y) position within the current block. (mv Ax , mv Ay ) represents a first control point motion vector (A), and (mv Bx , mv By ) represents a second control point motion vector (B). W represents the width of the current block.

3개의 컨트롤 포인트 움직임 벡터들이 이용되는 경우에는, 다음의 수학식 3에 의해, 샘플별 움직임 벡터가 유도될 수 있다.When three control point motion vectors are used, a motion vector per sample can be derived by the following mathematical expression 3.

Figure PCTKR2024008916-appb-img-000003
Figure PCTKR2024008916-appb-img-000003

상기 수학식 3에서, (mvCx, mvCy)는, 제3 컨트롤 포인트 움직임 벡터(C)를 나타낸다. In the above mathematical expression 3, (mv Cx , mv Cy ) represents the third control point motion vector (C).

샘플 별로 움직임 벡터가 유도되면, 도 17에 도시된 예에서와 같이, 각 샘플에 대한 움직임 보상을 수행할 수 있다. 구체적으로, 예측 대상 샘플의 움직임 벡터가 지시하는 참조 샘플을, 예측 대상 샘플에 대한 예측 샘플로 설정할 수 있다.Once a motion vector is derived for each sample, motion compensation can be performed for each sample, as in the example illustrated in Fig. 17. Specifically, a reference sample indicated by the motion vector of the prediction target sample can be set as a prediction sample for the prediction target sample.

한편, 예측 대상 샘플의 움직임 벡터가 분수 단위로 표현되는 경우, 정수 위치 샘플들을 보간하여, 분수 위치 샘플을 생성하고, 생성된 분수 위치 샘플을, 예측 대상 샘플에 대한 예측 샘플로 설정할 수 있다.Meanwhile, if the motion vector of the prediction target sample is expressed in fractional units, integer position samples can be interpolated to generate fractional position samples, and the generated fractional position samples can be set as prediction samples for the prediction target sample.

이때, 샘플들 각각에 대한 움직임 벡터의 정밀도가 상이할 수 있다. 일 예로, 제1 예측 대상 샘플에 대한 움직임 벡터는 1/2 화소 단위로 유도된 반면, 제2 예측 대상 샘플에 대한 움직임 벡터는 1/4 화소 단위로 유도될 수 있다.At this time, the precision of the motion vector for each sample may be different. For example, the motion vector for the first prediction target sample may be derived in units of 1/2 pixels, while the motion vector for the second prediction target sample may be derived in units of 1/4 pixels.

이 경우, 예측 대상 샘플들 각각에 대한 움직임 벡터 정밀도에 맞춰, 분수 위치 샘플을 생성할 수 있다. 또는, 예측 대상 샘플의 움직임 벡터를 기준 움직임 벡터 정밀도에 맞춰 조절한 뒤, 조절된 움직임 벡터를 기반으로, 예측 대상 샘플에 대한 예측 샘플을 유도할 수 있다. 일 예로, 기준 움직임 벡터 정밀도가 1/2인 경우, 제2 예측 대상 샘플에 대한 움직임 벡터를, 1/4 화소 단위로 조절할 수 있다. In this case, the fractional position sample can be generated according to the motion vector precision for each of the prediction target samples. Alternatively, the motion vector of the prediction target sample can be adjusted according to the reference motion vector precision, and then the prediction sample for the prediction target sample can be derived based on the adjusted motion vector. For example, if the reference motion vector precision is 1/2, the motion vector for the second prediction target sample can be adjusted in units of 1/4 pixels.

기준 움직임 벡터 정밀도는, 블록 단위로 결정될 수 있다. 또는, 컨트롤 포인트 움직임 벡터들의 정밀도를, 기준 움직임 벡터 정밀도를 설정할 수 있다. 또는, 부호화기 및 복호화기에서, 기준 움직임 벡터 정밀도가 기 정의되어 있을 수 있다.The reference motion vector precision can be determined on a block-by-block basis. Alternatively, the precision of control point motion vectors can be set as the reference motion vector precision. Alternatively, in the encoder and decoder, the reference motion vector precision can be predefined.

다른 예로, 복잡도 감소를 위해, 서브 블록 단위로 움직임 벡터를 유도할 수도 있다. As another example, to reduce complexity, motion vectors can be derived on a sub-block basis.

도 19는 서브 블록 단위로 움직임 벡터가 유도되는 예를 나타낸 것이다.Figure 19 shows an example in which a motion vector is derived in sub-block units.

서브 블록의 크기 및/또는 형태는 부호화기 및 복호화기에 기 정의되어 있을 수 있다. 일 예로, 서브 블록은, 2x2 또는 4x4 크기의 정방형 블록일 수 있다. The size and/or shape of a sub-block may be predefined in the encoder and decoder. For example, a sub-block may be a square block of size 2x2 or 4x4.

또는, 현재 블록의 크기 및/또는 형태에 따라, 서브 블록의 크기 및/또는 형태가 적응적으로 결정될 수 있다. 일 예로, 현재 블록이 정방형인 경우, 서브 블록도 정방형일 수 있다. 반면, 현재 블록이 비정방형인 경우, 서브 블록도 비정방형일 수 있다.Alternatively, the size and/or shape of the sub-block may be adaptively determined based on the size and/or shape of the current block. For example, if the current block is square, the sub-block may also be square. On the other hand, if the current block is non-square, the sub-block may also be non-square.

또는, 현재 블록의 분할 방법 또는 분할 형태 중 적어도 하나에 대한 정보가 명시적으로 부호화되어 시그날링될 수 있다. 일 예로, 서브 블록의 크기, 서브 블록의 형태, 현재 블록을 분할하는 분할선의 위치 또는 분할선의 개수 중 적어도 하나에 대한 정보가 명시적으로 부호화되어 시그날링될 수 있다. 상기 정보를 블록 단위로 부호화되어 시그날링될 수도 있고, 상위 헤더를 통해 부호화되어 시그날링될 수도 있다. Alternatively, information on at least one of the division method or division shape of the current block may be explicitly encoded and signaled. For example, information on at least one of the size of a sub-block, the shape of a sub-block, the position of a division line dividing the current block, or the number of division lines may be explicitly encoded and signaled. The information may be encoded and signaled on a block-by-block basis, or may be encoded and signaled via an upper header.

도 19에서는, 서브 블록이 2x2 크기의 정방형 블록인 것으로 가정하였다.In Figure 19, it is assumed that the sub-blocks are square blocks of 2x2 size.

서브 블록 내 기 정의된 위치의 좌표를 이용하여, 서브 블록의 움직임 벡터를 유도할 수 있다. 여기서, 기 정의된 위치는, 서브 블록 내 좌상단 샘플의 위치, 우상단 샘플의 위치, 좌하단 샘플의 위치, 우하단 샘플의 위치 또는 중앙 위치 중 하나일 수 있다.A motion vector of a sub-block can be derived using coordinates of a predefined position within a sub-block. Here, the predefined position can be one of the positions of the upper left sample, the upper right sample, the lower left sample, the lower right sample, or the center position within a sub-block.

서브 블록 내 기 정의된 위치의 좌표를 수학식 2의 (x, y)에 대입함으로써, 서브 블록의 움직임 벡터를 유도할 수 있다.By substituting the coordinates of a predefined position within a sub-block into (x, y) in Equation 2, the motion vector of the sub-block can be derived.

상술한 예에서와 같이, 어파인 모션 모델에 기반하여, 서브 블록 단위로 움직임 벡터를 유도할 수 있다. As in the example described above, motion vectors can be derived for each sub-block based on the affine motion model.

한편, 콜로케이티드(Collocated) 픽처를 이용하여, 서브 블록 단위로 움직임 벡터를 유도할 수도 있다. 위와 같이, 콜로케이드 픽처를 이용하여, 서브 블록 단위로 움직임 벡터를 유도하는 것을 SbTMVP (Sub-block Temporal Motion Vector Prediction) 라 호칭할 수 있다. Meanwhile, it is also possible to derive motion vectors in sub-block units using collocated pictures. As above, deriving motion vectors in sub-block units using collocated pictures can be called SbTMVP (Sub-block Temporal Motion Vector Prediction).

콜로케이티드 픽처는, 참조 픽처 리스트에 포함된 참조 픽처들 중 하나일 수 있다. 일 예로, 참조 픽처 리스트 내 인덱스가 0인 픽처가 콜로케이티드 픽처로 선택될 수 있다. A collocated picture may be one of the reference pictures included in a reference picture list. For example, a picture having an index of 0 in the reference picture list may be selected as a collocated picture.

또는, 참조 픽처 리스트 내 콜로케이티드 픽처로 설정되는 참조 픽처의 인덱스를 지시하는 정보가 명시적으로 부호화되어 시그날링될 수 있다.Alternatively, information indicating the index of a reference picture to be set as a collocated picture in the reference picture list can be explicitly encoded and signaled.

도 20 및 도 21은 SbTMVP가 적용되는 경우, 현재 블록 내 서브 블록 단위로 움직임 벡터가 유도되는 예를 나타낸 것이다. Figures 20 and 21 illustrate examples in which motion vectors are derived for each sub-block within the current block when SbTMVP is applied.

서브 블록의 크기 및/또는 형태는, 부호화기 및 복호화기에서 기 정의되어 있을 수 있다.The size and/or shape of the sub-block may be predefined in the encoder and decoder.

또는, 현재 블록의 크기 및/또는 형태에 따라, 서브 블록의 크기 및/또는 형태가 적응적으로 결정될 수 있다. 일 예로, 현재 블록의 너비 또는 높이 중 적어도 하나가 문턱값보다 큰 경우, 서브 블록의 크기는, 8x8로 설정될 수 있다. 그렇지 않은 경우, 서브 블록의 크기는 4x4로 설정될 수 있다. Alternatively, the size and/or shape of the sub-block may be adaptively determined based on the size and/or shape of the current block. For example, if at least one of the width or the height of the current block is greater than the threshold, the size of the sub-block may be set to 8x8. Otherwise, the size of the sub-block may be set to 4x4.

또는, 서브 블록의 크기 및/또는 형태를 지시하는 정보가 명시적으로 부호화되어 시그날링될 수 있다. Alternatively, information indicating the size and/or shape of the sub-block may be explicitly encoded and signaled.

도 20에 도시된 예에서는, 현재 블록의 크기는 16x16이고, 서브 블록의 크기는 4x4인 것으로 가정한다. In the example shown in Figure 20, it is assumed that the current block size is 16x16 and the sub-block size is 4x4.

SbTMVP가 적용되는 경우, 현재 블록의 초기 움직임 벡터를 유도할 수 있다. 초기 움직임 벡터는, 움직임 벡터 예측 리스트 또는 움직임 정보 병합 리스트 중 적어도 하나에 기초하여, 유도될 수 있다. 일 예로, 움직임 벡터 예측 리스트에 포함된 움직임 벡터 예측 후보들 중 하나를 지시하는 인덱스가 부호화되어 시그날링될 수 있다. 초기 움직임 벡터는, 상기 인덱스가 지시하는 움직임 벡터 예측 후보에 움직임 벡터 차분값을 더하여 유도될 수 있다. 한편, 움직임 벡터 차분값도 명시적으로 부호화되어 시그날링될 수 있다.When SbTMVP is applied, an initial motion vector of a current block can be derived. The initial motion vector can be derived based on at least one of a motion vector prediction list or a motion information merge list. For example, an index indicating one of the motion vector prediction candidates included in the motion vector prediction list can be encoded and signaled. The initial motion vector can be derived by adding a motion vector differential value to the motion vector prediction candidate indicated by the index. Meanwhile, the motion vector differential value can also be explicitly encoded and signaled.

또는, 인덱스의 부호화를 생략하고, 움직임 벡터 예측 리스트 내 기 정의된 인덱스를 갖는 움직임 벡터 예측 후보를, 초기 움직임 벡터에 대한 예측값으로 설정할 수도 있다. 여기서, 기 정의된 인덱스를 갖는 움직임 벡터 예측 후보는, 인덱스가 0인 움직임 벡터 예측 후보 또는 인덱스가 가장 큰 움직임 벡터 예측 후보일 수 있다. Alternatively, encoding of the index may be omitted, and a motion vector prediction candidate having a predefined index in the motion vector prediction list may be set as a prediction value for the initial motion vector. Here, the motion vector prediction candidate having a predefined index may be a motion vector prediction candidate having an index of 0 or a motion vector prediction candidate having the largest index.

또는, 움직임 정보 병합 리스트에 포함된 움직임 정보 병합 후보들 중 하나를 지시하는 인덱스가 부호화되어 시그날링될 수 있다. 초기 움직임 벡터는, 상기 인덱스가 지시하는 움직임 정보 병합 후보의 움직임 벡터와 동일하게 설정될 수 있다. Alternatively, an index indicating one of the motion information merging candidates included in the motion information merging list may be encoded and signaled. The initial motion vector may be set to be the same as the motion vector of the motion information merging candidate indicated by the index.

또는, 인덱스의 부호화를 생략하고, 움직임 정보 병합 리스트 내 기 정의된 인덱스를 갖는 움직임 정보 병합 후보를 기반으로, 초기 움직임 벡터를 유도할 수 있다. 여기서, 기 정의된 인덱스를 갖는 움직임 정보 병합 후보는, 인덱스가 0인 움직임 정보 병합 후보 또는 인덱스가 가장 큰 움직임 정보 병합 후보일 수 있다. Alternatively, encoding of the index may be omitted, and the initial motion vector may be derived based on a motion information merge candidate having a predefined index in the motion information merge list. Here, the motion information merge candidate having a predefined index may be a motion information merge candidate having an index of 0 or a motion information merge candidate having the largest index.

또는, 기 정의된 위치의 이웃 블록의 움직임 벡터를 이용하여, 초기 움직임 벡터를 유도할 수 있다. 여기서, 기 정의된 위치의 이웃 블록은, 좌측 이웃 블록 또는 상단 이웃 블록일 수 있다. Alternatively, the initial motion vector can be derived using the motion vector of a neighboring block at a predefined position. Here, the neighboring block at the predefined position can be a left neighboring block or an upper neighboring block.

기 정의된 위치의 이웃 블록의 움직임 벡터를, 초기 움직임 벡터의 예측값으로 설정하고, 상기 예측값에 차분값을 더하여, 초기 움직임 벡터를 유도할 수 있다. The motion vector of a neighboring block at a predefined position can be set as a predicted value of the initial motion vector, and the initial motion vector can be derived by adding a difference value to the predicted value.

또는, 기 정의된 위치의 이웃 블록의 움직임 벡터를, 초기 움직임 벡터로 설정할 수 있다. Alternatively, the motion vector of a neighboring block at a predefined position can be set as the initial motion vector.

또는, 템플릿 기반 움직임 추정 방법(즉, 템플릿 매칭 방법) 또는 쌍방 매칭을 이용하여, 초기 움직임 벡터를 유도할 수도 있다. Alternatively, the initial motion vector can be derived using a template-based motion estimation method (i.e., template matching method) or bilateral matching.

초기 움직임 벡터의 정밀도는, 부호화기 및 복호화기에서 기 정의되어 있을 수 있다. 일 예로, 초기 움직임 벡터의 정밀도는, 정수 화소 단위로 고정되어 있을 수 있다.The precision of the initial motion vector may be predefined in the encoder and decoder. For example, the precision of the initial motion vector may be fixed in integer pixel units.

또는, 초기 움직임 벡터의 정밀도를 지시하는 정보가 명시적으로 부호화되어 시그날링될 수 있다. 상기 정보는, 복수의 움직임 벡터 정밀도 후보들 중 하나를 지시하는 인덱스일 수 있다.Alternatively, information indicating the precision of the initial motion vector can be explicitly encoded and signaled. The information can be an index indicating one of a plurality of motion vector precision candidates.

움직임 벡터 예측 후보를 이용하여, 초기 움직임 벡터를 유도하는 경우, 초기 움직임 벡터의 움직임 벡터 정밀도에 기반하여, 움직임 벡터 예측 후보들을 유도할 수 있다. 즉, 초기 움직임 벡터의 움직임 벡터 정밀도에 맞춰 움직임 벡터 예측 후보를 조정한 뒤, 조정된 초기 움직임 벡터 예측 후보를 움직임 벡터 예측 리스트에 삽입할 수 있다.When deriving an initial motion vector using a motion vector prediction candidate, the motion vector prediction candidates can be derived based on the motion vector precision of the initial motion vector. That is, after adjusting the motion vector prediction candidate according to the motion vector precision of the initial motion vector, the adjusted initial motion vector prediction candidate can be inserted into the motion vector prediction list.

움직임 정보 병합 후보를 이용하여, 초기 움직임 벡터를 유도하는 경우, 초기 움직임 벡터의 움직임 벡터 정밀도에 기반하여, 움직임 정보 병합 후보들을 유도할 수 있다. 즉, 초기 움직임 벡터의 움직임 벡터 정밀도에 맞춰 움직임 정보 병합 후보를 조정한 뒤, 조정된 초기 움직임 정보 병합 후보를 움직임 정보 병합 리스트에 삽입할 수 있다.When deriving an initial motion vector using a motion information merge candidate, the motion information merge candidates can be derived based on the motion vector precision of the initial motion vector. That is, after adjusting the motion information merge candidate according to the motion vector precision of the initial motion vector, the adjusted initial motion information merge candidate can be inserted into the motion information merge list.

한편, 움직임 정보 병합 리스트에 포함된 움직임 정보 병합 후보들 중 참조 픽처가 현재 블록의 콜로케이티드 픽처와 동일한 후보들 만이, 초기 움직임 벡터를 유도하는데 이용될 수 있다. 즉, 움직임 정보 병합 후보의 참조 픽처가, 현재 블록의 콜로케이티드 픽처와 상이한 경우, 해당 움직임 정보 병합 후보로부터는, 초기 움직임 벡터를 유도하지 않을 수 있다. Meanwhile, among the motion information merge candidates included in the motion information merge list, only candidates whose reference pictures are identical to the collocated pictures of the current block can be used to derive the initial motion vector. That is, if the reference picture of a motion information merge candidate is different from the collocated picture of the current block, the initial motion vector may not be derived from the motion information merge candidate.

움직임 정보 병합 후보들 중 참조 픽처가 현재 블록의 콜로케이티드 픽처와 동일한 후보들의 개수가 복수개인 경우, 복수개의 후보들 중 하나를 지시하는 인덱스가 부호화되어 시그날링될 수 있다. 또는, 움직임 정보 병합 후보들 중 참조 픽처가 현재 블록의 콜로케이티드 픽처와 동일한 후보들의 개수가 복수개인 경우, 복수개의 후보들 중 인덱스가 가장 작은 후보 또는 인덱스가 가장 큰 후보로부터 초기 움직임 벡터를 유도할 수 있다. If there are multiple candidates among the motion information merging candidates whose reference pictures are identical to the collocated pictures of the current block, an index indicating one of the multiple candidates may be encoded and signaled. Alternatively, if there are multiple candidates among the motion information merging candidates whose reference pictures are identical to the collocated pictures of the current block, the initial motion vector may be derived from the candidate having the smallest index or the largest index among the multiple candidates.

움직임 정보 병합 후보가 L0 방향의 움직임 정보 및 L1 방향의 움직임 정보를 모두 갖고 있는 경우, 기 설정된 우선 순위에 따라, L0 방향의 움직임 정보 및 L1 방향의 움직임 정보 중 하나를 선택하고, 선택된 움직임 정보로부터, 초기 움직임 벡터를 유도할 수 있다. When a motion information merging candidate has both motion information in the L0 direction and motion information in the L1 direction, one of the motion information in the L0 direction and the motion information in the L1 direction can be selected according to a preset priority, and an initial motion vector can be derived from the selected motion information.

우선 순위는, 움직임 병합 후보의 움직임 벡터의 크기, 움직임 병합 후보의 참조 픽처의 인덱스, 또는 움직임 병합 후보의 참조 픽처가 콜로케이티드 픽처와 동일한지 여부 중 적어도 하나에 기초하여 결정될 수 있다.The priority may be determined based on at least one of the magnitude of the motion vector of the motion merging candidate, the index of the reference picture of the motion merging candidate, or whether the reference picture of the motion merging candidate is identical to the collocated picture.

또는, 항상 L0 방향의 움직임 정보에 기반하여, 초기 움직임 벡터를 유도하도록 설정될 수도 있다.Alternatively, it can be set to always derive the initial motion vector based on the motion information in the L0 direction.

템플릿 매칭 방법에 기반하여 초기 움직임 벡터가 유도되는 경우, 초기 움직임 벡터의 정밀도에 맞춰, 움직임 추정이 수행될 수 잇다. 일 예로, 초기 움직임 벡터의 정밀도가 정수 화소 단위인 경우, 템플릿 매칭에 기반한 움직임 추정 역시 정수 위치에서만 수행될 수 있다. When the initial motion vector is derived based on the template matching method, motion estimation can be performed according to the precision of the initial motion vector. For example, when the precision of the initial motion vector is in integer pixel units, motion estimation based on template matching can also be performed only at integer positions.

마찬가지로, 쌍방 매칭에 기반하여 초기 움직임 벡터가 유도되는 경우, 초기 움직임 벡터의 정밀도에 맞춰 움직임 추정이 수행될 수 있다. Similarly, when the initial motion vector is derived based on bilateral matching, motion estimation can be performed according to the precision of the initial motion vector.

한편, 쌍방 매칭의 결과, L0 방향에 대한 움직임 벡터(L0 움직임 벡터) 및 L1 방향에 대한 움직임 벡터(L1 움직임 벡터)가 유도된다. 이 경우, 기 설정된 우선 순위에 따라, L0 움직임 벡터 및 L1 움직임 벡터 중 하나를 초기 움직임 벡터로 설정할 수 있다. Meanwhile, as a result of the bilateral matching, a motion vector for the L0 direction (L0 motion vector) and a motion vector for the L1 direction (L1 motion vector) are derived. In this case, one of the L0 motion vector and the L1 motion vector can be set as the initial motion vector according to the preset priority.

또는, 항상 L0 방향의 움직임 정보에 기반하여, 초기 움직임 벡터를 유도하도록 설정될 수도 있다.Alternatively, it can be set to always derive the initial motion vector based on the motion information in the L0 direction.

또는, L0 움직임 벡터 및 L1 움직임 벡터 중 초기 움직임 벡터로 설정되는 것을 지시하는 정보가 부호화되어 시그날링될 수도 있다. Alternatively, information indicating which of the L0 motion vector and the L1 motion vector is set as the initial motion vector may be encoded and signaled.

초기 움직임 벡터가 유도되면, 초기 움직임 벡터를 이용하여, 콜로케이티드 블록 내 콜로케이티드 블록의 위치를 결정할 수 있다. 일 예로, 참조 픽처 내 현재 블록에 대응하는 위치로부터, 초기 움직임 벡터 만큼 이격된 위치의 블록이 콜로케이티드 블록으로 설정될 수 있다. 이때, 콜로케이티드 블록의 위치는, 현재 블록 내 기 정의된 위치를 기반으로 결정될 수 있다. 여기서, 기 정의된 위치는, 좌상단 위치, 우상단 위치, 좌하단 위치, 우하단 위치 또는 중앙 위치일 수 있다. Once the initial motion vector is derived, the position of the collocated block within the collocated block can be determined using the initial motion vector. For example, a block at a position spaced apart by the initial motion vector from a position corresponding to the current block within the reference picture can be set as the collocated block. At this time, the position of the collocated block can be determined based on a predefined position within the current block. Here, the predefined position can be an upper left position, an upper right position, a lower left position, a lower right position, or a center position.

현재 블록의 분할 방식에 따라, 콜로케이티드 블록을 복수의 콜로케이티드 서브 블록들로 분할할 수 있다. 그리고, 콜로케이티드 블록 내 콜로케이티드 서브 블록들 각각의 움직임 벡터를, 현재 블록 내 서브 블록들 각각의 움직임 벡터로 설정할 수 있다. Depending on the division method of the current block, the collocated block can be divided into a plurality of collocated sub-blocks. Then, the motion vector of each of the collocated sub-blocks in the collocated block can be set as the motion vector of each of the sub-blocks in the current block.

다른 예로, 초기 움직임 벡터를 이용하여, 콜로케이티드 픽처 내 현재 블록 내 서브 블록들 각각에 대응하는 콜로케이티드 서브 블록들의 위치를 결정할 수도 있다. 이때, 콜로케이티드 서브 블록의 위치는, 서브 블록 내 기 정의된 위치를 기반으로 유도될 수 있다. 여기서, 기 정의된 위치는, 좌상단 위치, 우상단 위치, 좌하단 위치, 우하단 위치 또는 중앙 위치일 수 있다. As another example, the positions of the collocated sub-blocks corresponding to each of the sub-blocks in the current block in the collocated picture can be determined using the initial motion vector. At this time, the position of the collocated sub-block can be derived based on a predefined position in the sub-block. Here, the predefined position can be an upper left position, an upper right position, a lower left position, a lower right position, or a center position.

이후, 서브 블록에 대응하는 콜로케이티드 서브 블록의 움직임 벡터를, 서브 블록의 움직임 벡터로 설정할 수 있다. 구체적으로, 콜로케이티드 서브 블록 내, 서브 블록 내 기 정의된 위치에 대응하는 위치에 저장된 움직임 벡터를, 서브 블록의 움직임 벡터로 설정할 수 있다.Thereafter, the motion vector of the collocated sub-block corresponding to the sub-block can be set as the motion vector of the sub-block. Specifically, the motion vector stored at a position corresponding to a predefined position within the sub-block within the collocated sub-block can be set as the motion vector of the sub-block.

한편, 콜로케이티드 서브 블록의 움직임 정보가 이용 불가능한 경우, 기 정의된 움직임 벡터를 서브 블록의 움직임 벡터로 설정할 수 있다. 여기서, 기 정의된 움직임 벡터는, 제로 벡터(즉, (0, 0)) 또는 초기 움직임 벡터일 수 있다.Meanwhile, if the motion information of the collocated sub-block is unavailable, a predefined motion vector can be set as the motion vector of the sub-block. Here, the predefined motion vector can be a zero vector (i.e., (0, 0)) or an initial motion vector.

또는, 서브 블록에 대응하는 콜로케이티드 서브 블록의 움직임 정보가 이용 불가능한 경우, 콜로케이티드 서브 블록 내 다른 위치로부터 서브 블록의 움직임 벡터를 유도할 수도 있다.Alternatively, if the motion information of the collocated sub-block corresponding to the sub-block is not available, the motion vector of the sub-block may be derived from another location within the collocated sub-block.

구체적으로, 콜로케이티드 서브 블록 내, 서브 블록 내 기 정의된 위치에 대응하는 위치가 인트라 예측으로 부호화된 경우, 해당 위치에는, 움직임 벡터가 존재하지 않는다. 일 예로, 기 정의된 위치가 중앙 위치(예컨대, 도 21의 c10)이라 가정할 경우, 중앙 위치에 움직임 벡터가 저장되어 있지 않은 경우, 서브 블록의 움직임 벡터를 유도할 수 없다. Specifically, if a position corresponding to a predefined position within a collocated sub-block is encoded with intra prediction, then there is no motion vector at that position. For example, assuming that the predefined position is a central position (e.g., c10 in Fig. 21), if a motion vector is not stored at the central position, then the motion vector of the sub-block cannot be derived.

이 경우, 중심 위치와 상이한 위치에 저장된 움직임 벡터를 기반으로, 서브 블록의 움직임 벡터를 유도할 수 있다. 구체적으로, 중앙 위치에 인접하는 위치(예컨대, 상단 인접 위치 c6, 좌측 인접 위치 c9 또는 좌상단 인접 위치 c5)에 저장된 움직임 벡터를 서브 블록의 움직임 벡터를 유도할 수 있다.In this case, the motion vector of the sub-block can be derived based on the motion vector stored at a different location from the center location. Specifically, the motion vector of the sub-block can be derived from the motion vector stored at a location adjacent to the center location (e.g., the top adjacent location c6, the left adjacent location c9, or the top left adjacent location c5).

또는, 중심 위치가 이용 불가능한 경우, 스캔 순서에 따라, 콜로케이티드 서브 블록 내 샘플들을 탐색한 뒤, 첫번째로 발견된 가용한 움직임 벡터를, 서브 블록의 움직임 벡터로 설정할 수 있다. 여기서, 스캔 순서는, 수평 스캔, 수직 스캔, 대각 스캔 또는 래스터 스캔일 수 있다. Alternatively, if the center position is not available, the samples within the collocated sub-block can be searched according to the scan order, and the first available motion vector found can be set as the motion vector of the sub-block. Here, the scan order can be horizontal scan, vertical scan, diagonal scan, or raster scan.

또는, 콜로케이티드 서브 블록의 움직임 정보가 이용 불가능한 경우, 서브 블록의 움직임 벡터를, 콜로케이티드 블록의 움직임 벡터로 설정할 수 있다. 일 예로, 콜로케이티드 블록 내, 현재 블록 내 기 정의된 위치에 대응하는 위치에 저장된 움직임 벡터를, 서브 블록의 움직임 벡터로 설정할 수 있다. Alternatively, if the motion information of the collocated sub-block is not available, the motion vector of the sub-block may be set as the motion vector of the collocated block. For example, a motion vector stored at a position corresponding to a predefined position within the current block in the collocated block may be set as the motion vector of the sub-block.

상술한 예에서와 같이, 어파인 모션 모델 또는 SbTMVP를 이용하여, 서브 블록 단위로 움직임 벡터를 유도할 수 있다. 서브 블록 단위로 움직임 벡터가 유도된 경우, 서브 블록들 각각의 움직임 벡터에 기반하여, 서브 블록들 각각에 대해 움직임 보상이 수행될 수 있다. As in the example described above, motion vectors can be derived for each sub-block using the affine motion model or SbTMVP. When motion vectors are derived for each sub-block, motion compensation can be performed for each sub-block based on the motion vectors of each sub-block.

서브 블록들 각각에 대해 움직임 보상을 수행함으로써, 현재 블록에 대한 예측 블록을 획득할 수 있다. 즉, 상기 예측 블록은, 서브 블록들 각각의 예측 샘플들로 구성된 것일 수 있다.By performing motion compensation for each of the sub-blocks, a prediction block for the current block can be obtained. That is, the prediction block can be composed of prediction samples of each of the sub-blocks.

화면 간의 움직임을 탐색할 때, 움직임 벡터 정밀도(precision)가 조절될 수 있다. 구체적으로, 픽처 내 샘플들 각각의 위치는 정수 위치로 정의된다. 허나, 움직임이 반영된 위치는, 정수 위치가 아닌 소수 위치일 수 있다. When detecting motion between screens, the motion vector precision can be adjusted. Specifically, the position of each sample in a picture is defined as an integer position. However, the position where the motion is reflected may be a decimal position rather than an integer position.

이를 고려하여, 참조 픽처 보간을 통해, 더욱 정밀하게, 움직임 벡터를 탐색할 수 있다.Taking this into account, we can search for motion vectors more precisely through reference picture interpolation.

도 22 및 도 23은 움직임 벡터 정밀도에 따라 예측 블록이 유도되는 예를 나타낸 도면이다. Figures 22 and 23 are diagrams showing examples in which prediction blocks are derived according to motion vector precision.

도 22는, 현재 픽처 내 현재 블록의 위치를 나타내고, 도 23은, 움직임 벡터 정밀도에 따른, 참조 블록의 위치를 나타낸다.Figure 22 shows the location of the current block within the current picture, and Figure 23 shows the location of the reference block according to the motion vector precision.

도 22 및 도 23에 도시된 예에서와 같이, 현재 블록의 움직임 벡터는, 참조 픽처 내 현재 블록의 좌상단 위치에 해당하는 샘플로부터, 참조 픽처 내 참조 블록의 좌상단 위치에 해당하는 샘플까지의 거리로 정의될 수 있다. As in the examples illustrated in FIGS. 22 and 23, the motion vector of the current block can be defined as the distance from a sample corresponding to the upper left position of the current block in the reference picture to a sample corresponding to the upper left position of the reference block in the reference picture.

도 23의 (a)는, 현재 블록의 움직임 벡터 정밀도가 정수 펠인 경우를 예시한 것이고, 도 23의 (b)는, 현재 블록의 움직임 벡터 정밀도가 1/2 펠인 경우를 예시한 것이다. 또한, 도 23의 (c)는, 현재 블록의 움직임 벡터 정밀도가 1/4 펠인 경우를 예시한 것이다. Figure 23 (a) illustrates a case where the motion vector precision of the current block is an integer pel, Figure 23 (b) illustrates a case where the motion vector precision of the current block is 1/2 pel, and Figure 23 (c) illustrates a case where the motion vector precision of the current block is 1/4 pel.

도 23에서는, 1/4 벡터 정밀도까지 표현되었으나, 1/8, 1/16 또는 1/32와 같이 더욱 정밀하게 움직임 벡터를 표현할 수도 있다.In Figure 23, motion vectors are expressed up to 1/4 vector precision, but motion vectors can also be expressed more precisely, such as 1/8, 1/16, or 1/32.

한편, 현재 블록의 움직임 벡터 정밀도를 나타내기 위한 정보가 부호화되어 시그날링될 수 있다. 일 예로, 상기 정보는, 움직임 벡터 정밀도 후보들 중 하나를 식별하는 인덱스일 수 있다. 구체적으로, 움직임 벡터 정밀도 후보들 각각에는 상이한 인덱스가 할당될 수 있고, 상기 정보는, 현재 블록에 적용되는 움직임 벡터 정밀도 후보의 인덱스를 가리킬 수 있다. Meanwhile, information for indicating the motion vector precision of the current block may be encoded and signaled. For example, the information may be an index identifying one of the motion vector precision candidates. Specifically, a different index may be assigned to each of the motion vector precision candidates, and the information may indicate an index of a motion vector precision candidate applied to the current block.

화면 간 예측에 사용되는 움직임 벡터 정밀도를 조절함으로써, 더욱 정밀한 움직임 벡터 탐색이 가능할 수 있다. 움직임 벡터에 의해 지시되는 참조 블록이 실수 위치에 존재하는 경우, 실수 위치에 존재하는 샘플들은, 정수 위치에 존재하는 샘플들 및 보간 필터를 이용하여 생성될 수 있다. 또한, 실수로 표현된 움직임 벡터는, 정소로 스케일업(Scale-up) 되어 부호화/복호화될 수도 있다. By adjusting the precision of the motion vector used for inter-screen prediction, more precise motion vector search can be possible. If the reference block indicated by the motion vector exists in a real position, the samples existing in the real position can be generated using the samples existing in the integer position and the interpolation filter. In addition, the motion vector expressed in real numbers can be scaled up to an integer and encoded/decoded.

이처럼, 움직임 벡터(MV), 움직임 벡터 예측값(MVP) 및 움직임 벡터 차분값(MVD)은, 정수화를 통해 정수 값으로 부/복호화될 수 있다. 구체적으로, 움직임 벡터 정밀도에 기초하여, 움직임 벡터, 움직임 벡터 예측값 및/또는 움직임 벡터 차분값을 정수화할 수 있다. In this way, the motion vector (MV), the motion vector predictor (MVP) and the motion vector differential (MVD) can be encoded/decoded as integer values through integerization. Specifically, the motion vector, the motion vector predictor and/or the motion vector differential can be integerized based on the motion vector precision.

일 예로, 움직임 벡터 정밀도가 1/N인 경우, 움직임 벡터 차분값 MVD에 N을 곱하여, 정수화가 수행될 수 있다. 일 예로, 움직임 벡터 차분값 MVD가 (4/16, 8/16)인 경우, 16을 곱하여, 움직임 벡터 차분값 MVD를 정수화할 수 있다. 즉, 정수화된 움직임 벡터 차분값 MVD는 (4, 8)로 표현될 수 있다. For example, if the motion vector precision is 1/N, integerization can be performed by multiplying the motion vector difference MVD by N. For example, if the motion vector difference MVD is (4/16, 8/16), the motion vector difference MVD can be integerized by multiplying by 16. That is, the integerized motion vector difference MVD can be expressed as (4, 8).

움직임 벡터 정밀도에 기초하여, 정수화된 MVD로부터 실제 MVD를 유도할 수 있다. 일 예로, 움직임 벡터 정밀도가 1/N인 경우, 정수화된 MVD를, N으로 나누어, 실제 MVD를 유도할 수 있다. 일 예로, 정수화된 MVD가 (4, 8)이고, 움직임 벡터 정밀도가 1/8이라면, 실제 MVD는, (4/8, 8/8)일 수 있다. 또는, 정수화된 MVD가 (4, 8)이고, 움직임 벡터 정밀도가 1/4라면, 실제 MVD는, (4/4, 8/4)일 수 있다. Based on the motion vector precision, the actual MVD can be derived from the integerized MVD. For example, if the motion vector precision is 1/N, the integerized MVD can be divided by N to derive the actual MVD. For example, if the integerized MVD is (4, 8) and the motion vector precision is 1/8, the actual MVD can be (4/8, 8/8). Alternatively, if the integerized MVD is (4, 8) and the motion vector precision is 1/4, the actual MVD can be (4/4, 8/4).

움직임 벡터 정밀도에 따라, 정수화된 MVD의 표현 범위가 상이할 수 있다. 일 예로, 움직임 벡터 차분값 MVD가 (4/16, 8/16)(즉, (1/4, 2/4))인 것으로 가정한다. 움직임 벡터 정밀도가 1/16인 경우, 정수화된 MVD는 (4, 8)로 유도된다. 반면, 움직임 벡터 정밀도가 1/4인 경우, 정수화된 MVD는, (1, 2)로 유도된다. Depending on the motion vector precision, the representation range of the integerized MVD may be different. For example, assume that the motion vector difference MVD is (4/16, 8/16) (i.e., (1/4, 2/4)). When the motion vector precision is 1/16, the integerized MVD is derived as (4, 8). On the other hand, when the motion vector precision is 1/4, the integerized MVD is derived as (1, 2).

위 두 경우를 비교하면, 움직임 벡터 정밀도를 1/16에서 1/4로 조절한다면, 정수화된 MVD의 값이 (4, 8)에서 (1, 2)로 감소될 수 있다. Comparing the two cases above, if the motion vector precision is adjusted from 1/16 to 1/4, the integerized MVD value can be reduced from (4, 8) to (1, 2).

결과적으로, 움직임 벡터 정밀도에 따라, 정수화된 움직임 벡터 차분값 MVD을 부/복호화하는데 필요한 비트 수가 상이할 수 있다. 이에 따라, 움직임 벡터 차분값 MVD를 부/복호화함에 있어서, 빈의 개수를 최소화할 수 있는 움직임 벡터 정밀도를 선택할 수 있다. 그리고, 선택된 움직임 벡터 정밀도를 기반으로, 움직임 벡터 차분값 MVD을 정수화하고, 정수화된 움직임 벡터 차분값 MVD를 부/복호화할 수 있다. 아울러, 움직임 벡터 정밀도에 관한 정보를 추가적으로 부/복호화할 수 있다. As a result, depending on the motion vector precision, the number of bits required to encode/decode the integerized motion vector difference MVD may be different. Accordingly, when encode/decode the motion vector difference MVD, the motion vector precision that can minimize the number of bins can be selected. Then, based on the selected motion vector precision, the motion vector difference MVD can be integerized, and the integerized motion vector difference MVD can be encode/decode. In addition, information about the motion vector precision can be additionally encode/decode.

복호화기에서는, 움직임 벡터 정밀도를 기반으로, 복호화된 MVD로부터 실제 MVD를 복원할 수 있다. 그리고 나서, 복원된 MVD와 움직임 벡터 예측값 MVP를 합하여, 움직임 벡터 MV를 유도할 수 있다.In the decoder, the actual MVD can be reconstructed from the decoded MVD based on the motion vector precision. Then, the motion vector MV can be derived by combining the reconstructed MVD and the motion vector prediction value MVP.

위와 같이, 움직임 벡터 정밀도에 기반하여 부/복호화되는 움직임 벡터 차분값 MVD의 값을 조절하는 것을 AMVR (Adaptive Motion Vector Resolution)방식이라 한다.As above, the method of adjusting the value of the motion vector differential value MVD to be encoded/decoded based on the motion vector precision is called the Adaptive Motion Vector Resolution (AMVR) method.

도 24 및 도 25는 각각 AMVR 방식이 적용되는 경우, 움직임 벡터 차분값을 부호화하는 과정 및 복호화하는 과정을 설명하기 위한 도면이다. Figures 24 and 25 are diagrams for explaining the process of encoding and decoding a motion vector difference value, respectively, when the AMVR method is applied.

설명의 편의를 위해, 정수화가 수행되기 이전, 움직임 벡터 및 움직임 벡터 차분값은 1/16 단위에 맞춰 표현되는 것으로 가정하고, 1/16을 원래의 움직임 벡터 정밀도라 표현하기로 한다. For convenience of explanation, it is assumed that the motion vector and motion vector difference are expressed in units of 1/16 before integerization is performed, and 1/16 is expressed as the original motion vector precision.

움직임 벡터 MV에서 움직임 벡터 예측값 MVP을 차분하여 움직임 벡터 차분값 MVD를 유도할 수 있다(S2410). The motion vector differential value MVD can be derived by differentiating the motion vector prediction value MVP from the motion vector MV (S2410).

움직임 벡터 차분값 MVD는, 수평 방향 성분(즉, x축 성분) 및 수직 방향 성분(즉, y축 성분)으로 구성되어 있을 수 있다.The motion vector difference MVD can be composed of a horizontal component (i.e., x-axis component) and a vertical component (i.e., y-axis component).

움직임 벡터 차분값이 0인 경우, 즉, 즉, 수평 방향 성분 및 수직 방향 성분 모두가 0인 경우, 움직임 벡터 정밀도와 관계없이, 부호화해야 하는 움직임 벡터 차분값 MVD의 값은 0이 된다. 따라서, 움직임 벡터 차분값 MVD가 0인 경우, AMVR 관련 정보의 부호화를 생략할 수 있다(S2420). If the motion vector difference is 0, that is, if both the horizontal direction component and the vertical direction component are 0, the value of the motion vector difference MVD to be encoded becomes 0 regardless of the motion vector precision. Therefore, if the motion vector difference MVD is 0, encoding of AMVR-related information can be omitted (S2420).

반면, 움직임 벡터 차분값이 0이 아닌 경우, 즉, 수평 방향 성분 및 수직 방향 성분 중 적어도 하나가 0이 아닌 경우, 움직임 벡터 정밀도를 결정할 수 있다 (S2430). 한편, 움직임 벡터 정밀도는, AMVR 관련 정보로서 부호화될 수 있다.On the other hand, if the motion vector difference is not 0, that is, if at least one of the horizontal direction component and the vertical direction component is not 0, the motion vector precision can be determined (S2430). Meanwhile, the motion vector precision can be encoded as AMVR-related information.

AMVR과 관련된 정보는, 현재 블록에 AMVR 방식이 적용되는지 여부를 나타내는 플래그(예컨대, amvr_flag) 및 AMVR 방식이 적용되는 경우, 복수의 움직임 정밀도 후보들 중 하나를 지시하는 인덱스(예컨대, amvr_prec_idx) 중 적어도 하나를 포함할 수 있다. Information related to AMVR may include at least one of a flag (e.g., amvr_flag) indicating whether the AMVR method is applied to the current block, and an index (e.g., amvr_prec_idx) indicating one of a plurality of motion precision candidates when the AMVR method is applied.

현재 블록에 AMVR 방식이 적용되지 않는 경우, 움직임 벡터 정밀도는 디폴트 값으로 설정될 수 있다. 이 경우, amvr_flag는 0의 값으로 부호화될 수 있다. 한편, 디폴트 값은, 1, 1/2, 1/4, 1/8 또는 1/16 일 수 있다.If the AMVR method is not applied to the current block, the motion vector precision can be set to the default value. In this case, amvr_flag can be encoded as a value of 0. Meanwhile, the default value can be 1, 1/2, 1/4, 1/8 or 1/16.

현재 블록에 AMVR 방식이 적용되는 경우, 복수의 움직임 벡터 정밀도 후보들 중 하나를 지시하는 인덱스, 즉, amvr_prec_idx가 추가 복호화될 수 있다. 이 경우, amvr_flag는 1의 값으로 부호화되고, amvr_prec_idx는 0 부터, (n-1)의 값으로 부호화될 수 있다. 여기서, n은, 움직임 벡터 정밀도 후보들의 개수를 나타낸다. 일 예로, 복수의 움직임 벡터 정밀도 후보들은, 4, 2, 1, 1/2, 1/4, 1/8 또는 1/16 중 적어도 하나를 포함할 수 있다. 한편, 디폴트 값은, 인덱스가 가리키는 복수의 움직임 벡터 정밀도 후보로 설정되지 않을 수 있다. 즉, 현재 블록의 움직임 벡터 정밀도가 디폴트 값인 경우, amvr_flag의 값인 0으로 부호화되어 시그날링되고, amvr_prec_idx의 부호화는 생략될 수 있다.When the AMVR method is applied to the current block, an index indicating one of the plurality of motion vector precision candidates, i.e., amvr_prec_idx, may be additionally decoded. In this case, amvr_flag may be encoded with a value of 1, and amvr_prec_idx may be encoded with a value from 0 to (n-1). Here, n represents the number of motion vector precision candidates. For example, the plurality of motion vector precision candidates may include at least one of 4, 2, 1, 1/2, 1/4, 1/8, or 1/16. Meanwhile, the default value may not be set to the plurality of motion vector precision candidates indicated by the index. That is, when the motion vector precision of the current block is the default value, it is encoded and signaled as the value of amvr_flag, 0, and encoding of amvr_prec_idx may be omitted.

부호화기에서는, amvr_flag 및 amvr_prec_idx의 조합들 각각에 대한 RDO (Rate Distortion Optimization)를 수행하여, 최적의 움직임 벡터 정밀도를 결정할 수 있다. 즉, 다음 경우들에 대한 RDO를 수행하여, 최적의 비용을 갖는 조합을 선택할 수 있다. In the encoder, the optimal motion vector precision can be determined by performing RDO (Rate Distortion Optimization) for each combination of amvr_flag and amvr_prec_idx. That is, the combination with the optimal cost can be selected by performing RDO for the following cases.

1) amvr_flag가 0인 경우1) If amvr_flag is 0

2) amvr_flag가 1이고, amvr_prec_idx가 0인 경우2) If amvr_flag is 1 and amvr_prec_idx is 0

3) amvr_flag가 1이고, amvr_prec_idx가 1인 경우3) If amvr_flag is 1 and amvr_prec_idx is 1

4) amvr_flag가 1이고, amvr_prec_idx가 2인 경우 4) If amvr_flag is 1 and amvr_prec_idx is 2

현재 블록의 움직임 벡터 정밀도에 따라, 움직임 벡터 차분값의 스케일링을 위한 변수, 즉, 스케일링 파라미터가 설정될 수 있다. 일 예로, 표 1은, 움직임 벡터 정밀도에 따른, 변수 amvrshift의 값을 예시한 것이다.Depending on the motion vector precision of the current block, a variable for scaling the motion vector difference, i.e., a scaling parameter, can be set. As an example, Table 1 illustrates the values of the variable amvrshift according to the motion vector precision.

amvr_flagamvr_flag amvr_prec_idxamvr_prec_idx amvrshiftamvrshift 0 (1/4)0 (1/4) -- 22 11 0 (1/2)0 (1/2) 33 11 1 (1-pel)1 (1-pel) 44 11 2 (4-pel)2 (4-pel) 66

현재 블록에 적용될 수 있는, 가장 미세한 움직임 벡터 정밀도가 1/16이라 할 경우, 움직임 벡터 정밀도는 다음의 수학식 4와 같이 표현될 수 있다.If the finest motion vector precision that can be applied to the current block is 1/16, the motion vector precision can be expressed as shown in the following mathematical expression 4.

Figure PCTKR2024008916-appb-img-000004
Figure PCTKR2024008916-appb-img-000004

표 1에서와 같이, amvr_flag의 값이 0인 경우, 변수 amvrshift는, 2로 설정된다. 이는, 수학식 4에 따라, 움직임 벡터 정밀도가 1/4임을 나타낸다. As shown in Table 1, when the value of amvr_flag is 0, the variable amvrshift is set to 2. This indicates that the motion vector precision is 1/4 according to Equation 4.

amvr_flag의 값이 1인 경우, amvr_prec_idx의 값에 따라, 변수 amvrshft가 결정될 수 있다. 일 예로, amvr_prec_idx가 1인 경우, 변수 amvrshift는 4로 설정된다. 이는, 수학식 4에 따라, 움직임 벡터 정밀도가 1임을 나타낸다. When the value of amvr_flag is 1, the variable amvrshft can be determined according to the value of amvr_prec_idx. For example, when amvr_prec_idx is 1, the variable amvrshift is set to 4. This indicates that the motion vector precision is 1 according to mathematical expression 4.

부호화기에서는, 움직임 벡터 정밀도에 따른 변수 amvrshift를 이용하여, 움직임 벡터 차분값 MVD을 스케일 다운하여 부호화할 수 있다. 일 예로, 수학식 5는, 움직임 벡터 차분값 MVD에 대한 스케일 다운 연산이 수행되는 예를 나타낸 것이다.In the encoder, the motion vector difference value MVD can be scaled down and encoded using the variable amvrshift according to the motion vector precision. As an example, mathematical expression 5 shows an example in which a scale down operation is performed on the motion vector difference value MVD.

Figure PCTKR2024008916-appb-img-000005
Figure PCTKR2024008916-appb-img-000005

상기 수학식 5에서, MVD_x는, 움직임 벡터 차분값의 수평 방향 성분을, MVD_y는, 움직임 벡터 차분값의 수직 방향 성분을 나타낸다. MVD'_x 및 MVD'_y는, 스케일 다운 연산의 수행 결과를 나타낸다. In the above mathematical expression 5, MVD_x represents the horizontal component of the motion vector difference, and MVD_y represents the vertical component of the motion vector difference. MVD'_x and MVD'_y represent the results of performing the scale down operation.

부호화기는, 정밀도가 변경된 움직임 벡터 차분값 및 AMVR 정보를 부호화할 수 있다(S2440).The encoder can encode motion vector difference and AMVR information with changed precision (S2440).

복호화기에서는, 움직임 벡터 차분값 MVD을 복호화할 수 있다(S2510). In the decoder, the motion vector difference MVD can be decoded (S2510).

움직임 벡터 차분값이 0인 경우, AMVR 관련 정보의 복호화가 생략되고, 현재 블록의 움직임 벡터 MV는, 움직임 벡터 예측값과 동일하게 설정될 수 있다(S2520).If the motion vector difference is 0, decoding of AMVR related information is omitted, and the motion vector MV of the current block can be set to be the same as the motion vector prediction value (S2520).

반면, 움직임 벡터 차분값이 0이 아닌 경우, 즉, 수평 방향 성분 및 수직 방향 성분 중 적어도 하나가 0이 아닌 경우, AMVR과 관련된 정보가 추가 복호화될 수 있다(S2530).On the other hand, if the motion vector difference is not 0, that is, if at least one of the horizontal direction component and the vertical direction component is not 0, information related to AMVR can be additionally decoded (S2530).

AMVR 정보를 기반으로, 움직임 벡터 차분값의 스케일링을 위한 변수 amvrshift를 유도할 수 있다. 일 예로, 표 1의 예시와 같이, amvr_flag 및/또는 amvr_prec_idx에 기반하여, 변수 amvrshfit를 유도할 수 있다. Based on the AMVR information, a variable amvrshift can be derived for scaling the motion vector difference. For example, as in the example in Table 1, a variable amvrshfit can be derived based on amvr_flag and/or amvr_prec_idx.

이후, 변수 amvrshift를 이용하여, 복호화된 MVD를 스케일 업하여, 원래의 정밀도로 복원된 움직임 벡터 차분값 MVD를 획득할 수 있다(S2540). 수학식 6은, 복호화된 MVD에 스케일 업 연산이 적용되는 예를 나타낸 것이다.Thereafter, by using the variable amvrshift, the decoded MVD can be scaled up to obtain a motion vector difference MVD restored to the original precision (S2540). Mathematical expression 6 shows an example in which a scale-up operation is applied to the decoded MVD.

Figure PCTKR2024008916-appb-img-000006
Figure PCTKR2024008916-appb-img-000006

수학식 6에서, MVD'는, 복호화된 움직임 벡터 차분값을 나타낸다. MVD는, 스케일 업 연산을 통해, 원래의 정밀도, 즉, 1/16으로 복원된 움직임 벡터 차분값을 나타낸다. In mathematical expression 6, MVD' represents the decoded motion vector difference. MVD represents the motion vector difference restored to the original precision, i.e., 1/16, through a scale-up operation.

이후, 원래의 정밀도로 복원된 움직임 벡터 차분값 MVD과 움직임 벡터 예측값 MVP를 합하여, 움직임 벡터 MV를 획득할 수 있다.Afterwards, the motion vector MV can be obtained by combining the motion vector difference MVD restored to the original precision and the motion vector prediction MVP.

상술한 예에서와 같이, 움직임 벡터 예측 모드가 적용되는 경우, 복호화기에서는, 움직임 벡터 예측값 MVP 및 움직임 벡터 차분값 MVD를 합하여 움직임 벡터 MV를 유도할 수 있다.As in the example described above, when the motion vector prediction mode is applied, the decoder can derive the motion vector MV by combining the motion vector prediction value MVP and the motion vector differential value MVD.

컬러 픽처는, 복수 채널로 구성될 수 있다. 일 예로, 컬러 픽처는, Y 픽처, Cb 픽처 및 Cr 픽처로 구성될 수 있다. Y는, 루마(Luma, 또는 루미넌스(Luminance)) 성분을 나타내고, Cb 및 Cr은, 크로마(Chroma, 또는 크로미넌스(Chrominance)) 성분을 나타낸다.A color picture may be composed of multiple channels. For example, a color picture may be composed of a Y picture, a Cb picture, and a Cr picture. Y represents a luma (or luminance) component, and Cb and Cr represent chroma (or chrominance) components.

크로마 포맷은, 루마 픽처 대비 크로마 픽처의 크기를 나타낼 수 있다. 일 예로, 4:4:4 포맷은, 루마 픽처의 크기와 크로마 픽처의 크기가 동일함을 나타낸다. 4:2:0 포맷은, 크로마 픽처의 너비 및 높이 각각이 루마 픽처의 너비 및 높이의 1/2 임을 나타낸다. Chroma formats can indicate the size of a chroma picture relative to a luma picture. For example, a 4:4:4 format indicates that the size of a luma picture is the same as that of a chroma picture. A 4:2:0 format indicates that the width and height of a chroma picture are each half the width and height of a luma picture.

후술되는 실시예에서는, 루마 픽처 내 블록을, 루마 블록이라 호칭하고, 크로마 픽처 내 블록을, 크로마 블록이라 호칭하기로 한다. 크로마 블록은, Cb 성분 블록 또는 Cr 성분 블록 중 적어도 하나를 나타낼 수 있다.In the embodiments described below, a block within a luma picture is referred to as a luma block, and a block within a chroma picture is referred to as a chroma block. A chroma block may represent at least one of a Cb component block or a Cr component block.

루마 픽처 내 루마 블록의 경우, 상술한 움직임 정보 부/복호화 방법이 적용될 수 있다.For luma blocks within a luma picture, the motion information encoding/decoding method described above can be applied.

반면, 크로마 블록의 움직임 정보는, 루마 블록의 움직임 정보를 기초로 유도될 수 있다. 일 예로, 크로마 포맷에 따라, 크로마 픽처와 루마 픽처의 크기가 상이한 경우, 크로마 블록과 동일 위치에 존재하는 루마 블록의 움직임 벡터를 스케일링하여, 크로마 블록의 움직임 정보를 유도할 수 있다. 크로마 포맷이 4:2:0인 경우, 크로마 픽처의 너비 및 높이 각각은 루마 픽처의 너비 및 높이 대비 1/2 크기를 갖는다. 이에 따라, 루마 블록의 움직임 벡터의 x축 성분 및 y축 성분을 각각 1/2 만큼 축소한 것(즉, 우측으로 1만큼 시프팅)을, 크로마 블록의 움직임 벡터로 설정할 수 있다.On the other hand, the motion information of the chroma block can be derived based on the motion information of the luma block. For example, if the sizes of the chroma picture and the luma picture are different depending on the chroma format, the motion information of the chroma block can be derived by scaling the motion vector of the luma block existing at the same position as the chroma block. If the chroma format is 4:2:0, the width and height of the chroma picture are each half the size of the width and height of the luma picture. Accordingly, the x-axis component and the y-axis component of the motion vector of the luma block, each reduced by 1/2 (i.e., shifted to the right by 1), can be set as the motion vector of the chroma block.

한편, 크로마 픽처와 루마 픽처의 크기가 동일한 경우, 즉, 크로마 포맷이 4:4:4인 경우, 스케일링을 수행함이 없이, 루마 블록의 움직임 정보를 그대로 크로마 블록의 움직임 정보로 사용할 수 있다. Meanwhile, if the sizes of the chroma picture and the luma picture are the same, that is, if the chroma format is 4:4:4, the motion information of the luma block can be used as the motion information of the chroma block without performing scaling.

이후, 크로마 블록의 움직임 정보를 이용하여, 참조 픽처 내 참조 블록을 특정하고, 특정된 참조 블록을 크로마 블록의 예측 블록으로 설정할 수 있다. Thereafter, by using the motion information of the chroma block, a reference block within the reference picture can be specified, and the specified reference block can be set as a prediction block of the chroma block.

루마 블록의 움직임 정보가 크로마 블록에 계승되는 바, 크로마 블록의 예측 방향도, 루마 블록과 동일하게 설정될 수 있다. 일 예로, 루마 블록에 양방향 예측(Bi-prediction)이 사용되었다면, 크로마 블록에도 양방향 예측이 적용되고, 루마 블록에 단방향 예측이 사용되었다면, 크로마 블록에도 단방향 예측이 적용될 수 있다. Since the motion information of the luma block is inherited by the chroma block, the prediction direction of the chroma block can also be set to be the same as that of the luma block. For example, if bi-prediction is used for the luma block, bi-prediction can also be applied to the chroma block, and if uni-directional prediction is used for the luma block, uni-directional prediction can also be applied to the chroma block.

상술한 것과 다른 방법으로 크로마 블록을 예측할 수도 있다. 구체적으로, 예측 파라미터를 유도한 뒤, 크로마 블록에 대응되는 루마 블록으로부터, 크로마 블록을 예측할 수 있다. 복원된 루마 블록으로부터 크로마 블록을 예측하는 것을, 예측 파라미터에 기반한 색성분간 예측 방법이라 호칭할 수 있다. 이하, 예측 파라미터에 기반한 색성분간 예측 방법에 대해 상세히 설명하기로 한다. 한편, 예측 파라미터는, 부호화기 및 복호화기 각각에서, 동일한 방법으로 유도할 수 있다.A chroma block can also be predicted in a different way than described above. Specifically, after deriving a prediction parameter, a chroma block can be predicted from a luma block corresponding to the chroma block. Predicting a chroma block from a restored luma block can be referred to as a color component discrimination prediction method based on a prediction parameter. Hereinafter, a color component discrimination prediction method based on a prediction parameter will be described in detail. Meanwhile, the prediction parameter can be derived in the same way in each of an encoder and a decoder.

도 26은 예측 파라미터에 기반한 색성분간 예측 방법의 흐름도를 나타낸 것이다.Figure 26 shows a flow chart of a color component prediction method based on prediction parameters.

예측을 수행할 크로마 블록과 동일 위치인 루마 블록의 움직임 정보를 이용하여, 참조 픽처 내 루마 블록의 참조 블록(이하, 루마 참조 블록이라 함)을 유도할 수 있다(S2610). 일 예로, 참조 픽처 내 루마 블록의 위치로부터, 루마 블록의 움직임 벡터 만큼 이격된 위치의 블록을, 루마 참조 블록으로 설정할 수 있다. 여기서, 참조 픽처는, 기 복원된 루마 픽처를 나타낸다. 루마 참조 블록은, 루마 블록의 예측 블록으로 설정될 수 있다. Using motion information of a luma block at the same position as a chroma block for which prediction is to be performed, a reference block of a luma block in a reference picture (hereinafter, referred to as a luma reference block) can be derived (S2610). For example, a block at a position spaced apart by a motion vector of the luma block from the position of the luma block in the reference picture can be set as a luma reference block. Here, the reference picture represents a previously reconstructed luma picture. The luma reference block can be set as a prediction block of the luma block.

이에 따라, 후술되는 실시예들은, 루마 블록의 예측 블록(이하, 루마 예측 블록이라 함) 및 루마 블록의 참조 블록은, 상호 대체될 수 있다. 일 예로, 후술되는 실시예들에서, 루마 예측 블록을 루마 블록의 참조 블록으로 대체하거나, 루마 블록의 참조 블록을 루마 예측 블록으로 대체할 수 있다. Accordingly, in the embodiments described below, the prediction block of the luma block (hereinafter referred to as the luma prediction block) and the reference block of the luma block can be replaced with each other. For example, in the embodiments described below, the luma prediction block can be replaced with the reference block of the luma block, or the reference block of the luma block can be replaced with the luma prediction block.

참조 픽처 내 크로마 블록의 참조 블록(이하, 크로마 참조 블록이라 함)을 유도할 수 있다(S2620). 일 에로, 참조 픽처 내 루마 참조 블록과 동일 위치의 블록을 크로마 참조 블록으로 유도할 수 있다. 또는, 루마 블록으로부터 크로마 블록의 움직임 정보를 유도한 뒤, 유도된 움직임 정보를 기반으로, 크로마 참조 블록을 설정할 수 있다. 일 예로, 참조 픽처 내 크로마 블록의 위치로부터, 크로마 블록의 움직임 벡터 만큼 이격된 위치의 블록을, 크로마 참조 블록으로 설정할 수 있다. 여기서, 참조 픽처는, 기 복원된 크로마 픽처를 나타낸다.A reference block of a chroma block in a reference picture (hereinafter, referred to as a chroma reference block) can be derived (S2620). For example, a block at the same position as a luma reference block in the reference picture can be derived as a chroma reference block. Alternatively, motion information of a chroma block can be derived from a luma block, and then a chroma reference block can be set based on the derived motion information. For example, a block at a position spaced apart from a position of a chroma block in the reference picture by a motion vector of the chroma block can be set as a chroma reference block. Here, the reference picture represents a previously reconstructed chroma picture.

이후, 루마 예측 블록과 크로마 참조 블록의 상관 관계에 따라, 예측 파라미터를 유도할 수 있다(S2630). 여기서, 예측 파라미터는, 가중치(weight) 및 오프셋(offset) 중 적어도 하나를 포함할 수 있다.Thereafter, prediction parameters can be derived based on the correlation between the luma prediction block and the chroma reference block (S2630). Here, the prediction parameters can include at least one of a weight and an offset.

예측 파라미터가 유도되면, 유도된 예측 파라미터에 기초하여, 복원된 루마 블록(이하, 루마 복원 블록)으로부터, 크로마 블록의 예측 샘플을 획득할 수 있다(S2640).Once the prediction parameters are derived, a prediction sample of a chroma block can be obtained from a restored luma block (hereinafter, luma restored block) based on the derived prediction parameters (S2640).

도 27 및 도 28은 예측 파라미터에 기반한 색성분간 예측 방법에 따른, 부/복호화기의 동작을 나타낸 것이다. Figures 27 and 28 illustrate the operation of the encoder/decoder according to a color component prediction method based on prediction parameters.

도 27은, 루마 블록에 양방향 예측이 적용된 경우의 예를 나타낸 것이고, 도 28은, 루마 블록에 단방향 예측이 적용된 경우의 예를 나타낸 것이다. Figure 27 shows an example of a case where bidirectional prediction is applied to a luma block, and Figure 28 shows an example of a case where unidirectional prediction is applied to a luma block.

루마 블록에 양방향 예측이 적용되는 경우, 루마 블록의 L0 움직임 정보를 기초로, L0 방향의 참조 블록을 획득하고, 루마 블록의 L1 움직임 정보를 기초로, L1 방향의 참조 블록을 획득할 수 있다. L0 참조 블록 및 L1 참조 블록 각각은, L0 예측 블록 및 L1 예측 블록으로 설정될 수 있다. 이후, L0 방향의 예측 블록 및 L1 방향의 예측 블록의 평균 또는 가중합 연산에 기초하여, 루마 블록의 예측 블록, 즉, 루마 예측 블록을 획득할 수 있다.When bidirectional prediction is applied to a luma block, a reference block in the L0 direction can be obtained based on the L0 motion information of the luma block, and a reference block in the L1 direction can be obtained based on the L1 motion information of the luma block. Each of the L0 reference block and the L1 reference block can be set as an L0 prediction block and an L1 prediction block, respectively. Thereafter, a prediction block of the luma block, i.e., a luma prediction block, can be obtained based on an average or weighted sum operation of the prediction block in the L0 direction and the prediction block in the L1 direction.

한편, 크로마 블록에 대해서도, L0 방향 및 L1 방향 각각에 대해 참조 블록을 유도할 수 있다. 일 예로, 루마 블록의 L0 참조 블록과 동일 위치의 Cb 성분 블록을 Cb 블록에 대한 L0 참조 블록으로 설정하고, 루마 블록의 L1 참조 블록과 동일 위치의 Cb 성분 블록을 Cb 성분 블록에 대한 L1 참조 블록으로 설정할 수 있다. Meanwhile, for chroma blocks, reference blocks can be derived for each of the L0 direction and the L1 direction. For example, a Cb component block at the same position as the L0 reference block of a luma block can be set as an L0 reference block for the Cb block, and a Cb component block at the same position as the L1 reference block of a luma block can be set as an L1 reference block for the Cb component block.

또는, 루마 블록의 움직임 정보를 기초로, Cb 블록의 움직임 정보를 유도할 수 있다. 일 예로, 크로마 포맷에 따라, 루마 블록의 움직임 벡터를 그대로 Cb 블록의 움직임 벡터로 설정하거나, 루마 블록의 움직임 벡터를 스케일링하여, Cb 블록의 움직임 벡터를 유도할 수 있다. 이후, Cb 블록의 L0 움직임 정보를 기초로, L0 방향의 참조 블록을 획득하고, Cb 블록의 L1 움직임 정보를 기초로, L1 방향의 참조 블록을 획득할 수 있다. 이후, L0 방향의 참조 블록 및 L1 방향의 예측 블록의 평균 또는 가중합 연산에 기초하여, Cb 성분에 대한 가중합된 참조 블록(이하, 가중합된 Cb 참조 블록이라 호칭함)을 획득할 수 있다.Alternatively, the motion information of the Cb block can be derived based on the motion information of the luma block. For example, depending on the chroma format, the motion vector of the luma block can be directly set to the motion vector of the Cb block, or the motion vector of the luma block can be scaled to derive the motion vector of the Cb block. Thereafter, a reference block in the L0 direction can be obtained based on the L0 motion information of the Cb block, and a reference block in the L1 direction can be obtained based on the L1 motion information of the Cb block. Thereafter, a weighted reference block for the Cb component (hereinafter, referred to as a weighted Cb reference block) can be obtained based on an average or weighted sum operation of the reference block in the L0 direction and the prediction block in the L1 direction.

한편, Cr 블록에 대해서도, Cb 블록과 동일한 방법으로, Cr 성분에 대한 가중합된 참조 블록(이하, 가중합된 Cr 참조 블록이라 함)을 획득할 수 있다.Meanwhile, for the Cr block, a weighted reference block for the Cr component (hereinafter referred to as a weighted Cr reference block) can be obtained in the same manner as for the Cb block.

이후, 루마 예측 블록과 가중합된 Cb 참조 블록을 이용하여, Cb 성분에 대한 제1 예측 파라미터를 유도할 수 있다. 또한, 루마 예측 블록과 가중합된 Cr 참조 블록을 이용하여, Cr 성분에 대한 제2 예측 파라미터를 유도할 수 있다. Thereafter, a first prediction parameter for the Cb component can be derived using the luma prediction block and the weighted Cb reference block. In addition, a second prediction parameter for the Cr component can be derived using the luma prediction block and the weighted Cr reference block.

이후, 루마 복원 블록에 제1 예측 파라미터를 적용하여, Cb 블록의 예측 블록을 획득할 수 있다. 여기서, 루마 복원 블록은, 루마 예측 블록에 루마 성분의 잔차 블록을 더하여 획득될 수 있다. 또한, 루마 복원 블록에 제2 예측 파라미터를 적용하여, Cr 블록의 예측 블록을 획득할 수 있다. Afterwards, by applying the first prediction parameter to the luma restoration block, a prediction block of the Cb block can be obtained. Here, the luma restoration block can be obtained by adding a residual block of the luma component to the luma prediction block. In addition, by applying the second prediction parameter to the luma restoration block, a prediction block of the Cr block can be obtained.

Cb 블록의 예측 블록에, Cb 성분의 잔차 블록을 더하여, Cb 블록을 복원하고, Cr 블록의 예측 블록에 Cr 성분의 잔차 블록을 더하여, Cr 블록을 복원할 수 있다. By adding the residual block of the Cb component to the prediction block of the Cb block, the Cb block can be restored, and by adding the residual block of the Cr component to the prediction block of the Cr block, the Cr block can be restored.

단방향 예측이 적용된 경우에는, 가중합 과정이 생략될 수 있다.When one-way prediction is applied, the weighted sum process can be omitted.

일 예로, 루마 블록에 L0 예측이 적용되는 경우, 루마 블록의 L0 움직임 정보를 기초로, L0 방향의 참조 블록을 획득하고, L0 참조 블록을 루마 블록의 예측 블록으로 설정할 수 있다. For example, when L0 prediction is applied to a luma block, a reference block in the L0 direction can be obtained based on the L0 motion information of the luma block, and the L0 reference block can be set as a prediction block of the luma block.

크로마 블록에 대해서도, L0 참조 블록을 유도한 뒤, 루마 예측 블록(즉, 루마 성분의 L0 참조 블록) 및 크로마 블록의 L0 참조 블록 간의 상관 관계에 기반하여, 예측 파라미터를 유도할 수 있다. 일 예로, 루마 예측 블록과 Cb 블록의 L0 참조 블록을 기초로, 제1 예측 파라미터를 유도하고, 루마 예측 블록과 Cr 블록의 L0 참조 블록을 기초로, 제1 예측 파라미터를 유도할 수 있다.For chroma blocks as well, after deriving the L0 reference block, the prediction parameter can be derived based on the correlation between the luma prediction block (i.e., the L0 reference block of the luma component) and the L0 reference block of the chroma block. For example, the first prediction parameter can be derived based on the luma prediction block and the L0 reference block of the Cb block, and the first prediction parameter can be derived based on the luma prediction block and the L0 reference block of the Cr block.

루마 블록에 L1 예측이 적용되는 경우, 루마 예측 블록(즉, 루마 성분의 L1 참조 블록) 및 크로마 블록의 L1 참조 블록 간의 상관 관계에 기반하여, 예측 파라미터가 유도될 수 있다. When L1 prediction is applied to a luma block, prediction parameters can be derived based on the correlation between the luma prediction block (i.e., the L1 reference block of the luma component) and the L1 reference block of the chroma block.

간소화를 위해, 루마 블록에 양방향 예측이 적용된 경우, L0 방향 및 L1 방향 중 하나에 대한 참조 블록들을 이용하여, 예측 파라미터를 유도할 수도 있다. 즉, L0 방향의 루마 참조 블록 및 L0 방향의 크로마 참조 블록을 이용하여 예측 파라미터를 유도하거나, L1 방향의 루마 참조 블록 및 L1 방향의 크로마 참조 블록을 이용하여 예측 파라미터를 유도할 수 있다. For simplicity, when bidirectional prediction is applied to a luma block, prediction parameters may be derived using reference blocks for either the L0 direction or the L1 direction. That is, prediction parameters may be derived using a luma reference block in the L0 direction and a chroma reference block in the L0 direction, or prediction parameters may be derived using a luma reference block in the L1 direction and a chroma reference block in the L1 direction.

이때, L0 방향 및 L1 방향 중 어느 방향을 이용할 것인지가 부호화기 및 복호화기에서 기 정의되어 있을 수 있다.At this time, which direction to use, the L0 direction or the L1 direction, may be predefined in the encoder and decoder.

또는, L0 방향의 참조 픽처(즉, L0 참조 픽처) 및 L1 방향의 참조 픽처(즉, L1 참조 픽처) 각각의 현재 픽처와의 거리를 비교하여, L0 방향 및 L1 방향 중 하나를 선택할 수 있다. 여기서, 거리는, 두 픽처들 간의 POC (Picture Order Count) 차분을 나타낸다. 일 예로, L0 참조 픽처 및 L1 참조 픽처 중 현재 픽처와의 거리가 더 가까운 방향의 참조 블록들을 이용하여, 예측 파라미터를 유도할 수 있다. 즉, L0 참조 픽처 및 현재 픽처 사이의 거리가 L1 참조 픽처 및 현재 픽처 사이의 거리보다 작다면, L0 방향의 루마 참조 블록 및 L0 방향의 크로마 참조 블록을 이용하여, 예측 파라미터를 유도할 수 있다.Alternatively, one of the L0 direction and the L1 direction may be selected by comparing the distances of the reference picture in the L0 direction (i.e., the L0 reference picture) and the reference picture in the L1 direction (i.e., the L1 reference picture) with the current picture, respectively. Here, the distance represents the POC (Picture Order Count) difference between the two pictures. For example, the prediction parameters may be derived using reference blocks in the direction in which the distance to the current picture is closer among the L0 reference picture and the L1 reference picture. That is, if the distance between the L0 reference picture and the current picture is smaller than the distance between the L1 reference picture and the current picture, the prediction parameters may be derived using the luma reference block in the L0 direction and the chroma reference block in the L0 direction.

한편, L0 참조 픽처 및 현재 픽처 사이의 거리와 L1 참조 픽처 및 현재 픽처 사이의 거리가 동일한 경우에는, 가중합된 참조 블록들을 이용하여, 예측 파라미터를 유도할 수 있다. Meanwhile, when the distance between the L0 reference picture and the current picture and the distance between the L1 reference picture and the current picture are the same, prediction parameters can be derived using the weighted reference blocks.

또는, L0 참조 픽처 및 L1 참조 픽처 중 콜(Col) 픽처로 지정된 픽처가 존재한다면, 콜 픽처로 지정된 참조 픽처로부터 유도된 참조 블록들만을 이용하여, 예측 파라미터를 유도할 수 있다.Alternatively, if there is a picture designated as a Col picture among the L0 reference picture and the L1 reference picture, prediction parameters can be derived using only reference blocks derived from the reference picture designated as the Col picture.

또는, 콜 픽처와 동일한 방향의 참조 블록들을 이용하여, 예측 파라미터를 유도할 수 있다.Alternatively, prediction parameters can be derived using reference blocks in the same direction as the call picture.

다른 예로, 루마 블록에 양방향이 예측이 적용된 경우, 복수의 예측 파라미터 후보들 중 하나를 선택하여, 크로마 블록을 예측할 수도 있다. As another example, when bidirectional prediction is applied to a luma block, a chroma block can also be predicted by selecting one of multiple prediction parameter candidates.

도 29는 복수의 예측 파라미터 후보들 중 하나를 선택하여 크로마 블록을 예측하는 예를 도시한 것이다. Figure 29 illustrates an example of predicting a chroma block by selecting one of multiple prediction parameter candidates.

복수의 예측 파라미터 후보들은, L0 방향의 참조 블록들을 이용하여 유도된 제1 예측 파라미터 후보, L1 방향의 참조 블록들을 이용하여 유도된 제2 예측 파라미터 후보 또는 가중 예측된 참조 블록을 이용하여 유도된 제3 예측 파라미터 후보 중 적어도 하나를 포함할 수 있다. 제1 예측 파라미터 후보는, 루마 블록의 L0 참조 블록 및 크로마 블록의 L0 참조 블록 간의 상관 관계를 기반으로 유도된 것이고, 제2 예측 파라미터 후보는, 루마 블록의 L1 참조 블록 및 크로마 블록의 L1 참조 블록 간의 상관 관계를 기반으로 유도된 것일 수 있다. 또한, 제3 예측 파라미터 후보는, 루마 블록의 L0 참조 블록 및 L1 참조 블록을 가중합 결과와, 크로마 블록의 L0 참조 블록 및 L1 참조 블록을 가중합한 결과 사이의 상관 관계를 기반으로 유도된 것일 수 있다. The plurality of prediction parameter candidates may include at least one of a first prediction parameter candidate derived using reference blocks in the L0 direction, a second prediction parameter candidate derived using reference blocks in the L1 direction, or a third prediction parameter candidate derived using a weighted predicted reference block. The first prediction parameter candidate may be derived based on a correlation between an L0 reference block of a luma block and an L0 reference block of a chroma block, and the second prediction parameter candidate may be derived based on a correlation between an L1 reference block of the luma block and an L1 reference block of the chroma block. In addition, the third prediction parameter candidate may be derived based on a correlation between a result of weighting the L0 reference block and the L1 reference block of the luma block and a result of weighting the L0 reference block and the L1 reference block of the chroma block.

부호화기에서는, 복수의 예측 파라미터 후보들 중 최적의 예측 파라미터 후보를 선택하고, 선택된 예측 파라미터 후보에 기초하여, 크로마 블록을 예측할 수 있다. 또한, 부호화기에서는, 복수의 예측 파라미터 후보들 중 최적의 예측 파라미터 후보를 가리키는 인덱스 정보를 부호화여, 복호화기로 시그날링할 수 있다.In the encoder, an optimal prediction parameter candidate can be selected from among a plurality of prediction parameter candidates, and a chroma block can be predicted based on the selected prediction parameter candidate. In addition, in the encoder, index information indicating an optimal prediction parameter candidate from among a plurality of prediction parameter candidates can be encoded and signaled to a decoder.

한편, 상기 인덱스 정보는, Cb 성분 및 Cr 성분 각각에 대해 부호화되어 시그날링될 수 있다. 즉, Cb 성분에 대한 최적의 예측 파라미터는, Cb 성분에 대한 복수의 예측 파라미터 후보들 중 Cb 성분에 대해 복호화되는 인덱스 정보를 기초로 결정되고, Cr 성분에 대한 최적의 예측 파라미터는, Cr 성분에 대한 복수의 예측 파라미터 후보들 중 Cr 성분에 대해 복호화되는 인덱스 정보를 기초로 결정될 수 있다.Meanwhile, the index information may be encoded and signaled for each of the Cb component and the Cr component. That is, the optimal prediction parameter for the Cb component may be determined based on the index information decoded for the Cb component among a plurality of prediction parameter candidates for the Cb component, and the optimal prediction parameter for the Cr component may be determined based on the index information decoded for the Cr component among a plurality of prediction parameter candidates for the Cr component.

또는, Cb 및 Cr 성분에 대해, 단일의 인덱스 정보가 부호화되어 시그날링될 수도 있다. 일 예로, 상기 인덱스 정보가 L0 방향을 가리키는 경우, Cb 및 Cr 성분 모두, L0 방향의 참조 블록들에 기초하여 예측 파라미터가 유도될 수 있다.Alternatively, for the Cb and Cr components, a single index information may be encoded and signaled. For example, if the index information points to the L0 direction, prediction parameters for both the Cb and Cr components may be derived based on reference blocks in the L0 direction.

또는, 루마 블록에 양방향 예측이 적용된 경우, 크로마 블록의 L0 방향 또는 L1 방향 중 하나에 대한 크로마 참조 블록을 이용하여, 예측 파라미터를 유도할 수도 있다. Alternatively, when bidirectional prediction is applied to the luma block, the prediction parameters can be derived using chroma reference blocks for either the L0 direction or the L1 direction of the chroma block.

즉, 루마 성분의 가중합된 참조 블록(즉, L0 참조 블록 및 L1 참조 블록을 가중합하여 유도된 블록)과 L0 방향의 크로마 참조 블록을 이용하여 예측 파라미터를 유도하거나, 루마 성분의 가중합된 참조 블록과 L1 방향의 크로마 참조 블록을 이용하여 예측 파라미터를 유도할 수 있다. 이는, 루마 예측 블록에는 양방향 예측이 적용되는 반면, 크로마 블록에 대해서는, 단방향 예측이 수행됨을 의미한다.That is, the prediction parameters can be derived using a weighted reference block of the luma component (i.e., a block derived by weighting the L0 reference block and the L1 reference block) and a chroma reference block in the L0 direction, or the prediction parameters can be derived using a weighted reference block of the luma component and a chroma reference block in the L1 direction. This means that bidirectional prediction is applied to the luma prediction block, whereas unidirectional prediction is performed for the chroma block.

한편, 기설정된 조건에 의해 L0 방향의 크로마 참조 블록을 이용할 것인지 또는 L1 방향의 크로마 참조 블록을 이용할 것인지 여부가 결정될 수 있다. 또는, 크로마 블록의 예측 방향을 나타내는 정보가 부호화되어 시그날링될 수 있다. 상기 예측 방향은, L0 단방향 예측, L1 단방향 예측 또는 양방향 예측을 지시할 수 있다. 상기 예측 방향에 따라, L0 방향의 크로마 참조 블록 또는 L1방향의 크로마 참조 블록 중 적어도 하나가 선택될 수 있다. Meanwhile, whether to use the chroma reference block in the L0 direction or the chroma reference block in the L1 direction can be determined by a preset condition. Alternatively, information indicating the prediction direction of the chroma block can be encoded and signaled. The prediction direction can indicate L0 unidirectional prediction, L1 unidirectional prediction, or bidirectional prediction. Depending on the prediction direction, at least one of the chroma reference block in the L0 direction or the chroma reference block in the L1 direction can be selected.

다른 예로, Cb 성분 및 Cr 성분 중 하나에 대해서는, 루마 예측 블록 및 크로마 참조 블록 간의 상관 관계에 의해 예측 파라미터를 유도하고, Cb 성분 및 Cr 성분 중 다른 하나에 대해서는, 상기 예측 파라미터와의 차분 정보가 부호화되어 시그날링될 수도 있다. As another example, for one of the Cb component and the Cr component, a prediction parameter may be derived by a correlation between a luma prediction block and a chroma reference block, and for the other of the Cb component and the Cr component, differential information with respect to the prediction parameter may be encoded and signaled.

일 예로, 부호화기에서는, Cb 성분에 대해서는, 루마 예측 블록 및 Cb 성분의 참조 블록 간의 상관 관계에 기초하여 예측 파라미터를 유도할 수 있다. Cr 성분의 예측 파라미터를 결정한 뒤, Cr 성분의 예측 파라미터와 Cb 성분의 예측 파라미터 간의 차분 정보를 부호화하여 시그날링할 수 있다. For example, in the encoder, for the Cb component, the prediction parameter can be derived based on the correlation between the luma prediction block and the reference block of the Cb component. After the prediction parameter of the Cr component is determined, the differential information between the prediction parameter of the Cr component and the prediction parameter of the Cb component can be encoded and signaled.

복호화기에서는, 부호화기와 동일하게, Cb 성분에 대해서는, 루마 예측 블록 및 Cb 성분의 참조 블록 간의 상관 관계에 기초하여 예측 파라미터를 유도할 수 있다. 비트스트림으로부터, Cr 성분의 예측 파라미터와 Cb 성분의 예측 파라미터 간의 차분 정보를 복호화한 뒤, Cb 성분의 예측 파라미터에 상기 차분값을 더하여, Cr 성분에 대한 예측 파라미터를 유도할 수 있다.In the decoder, similarly to the encoder, for the Cb component, the prediction parameter can be derived based on the correlation between the luma prediction block and the reference block of the Cb component. From the bitstream, the differential information between the prediction parameter of the Cr component and the prediction parameter of the Cb component is decoded, and then the differential value is added to the prediction parameter of the Cb component, thereby deriving the prediction parameter for the Cr component.

한편, 상기 차분 정보는, 가중치 간 차분값 또는 오프셋 간 차분값 중 적어도 하나를 포함할 수 있다. Meanwhile, the differential information may include at least one of a difference between weights or a difference between offsets.

도 30은 색차 성분에 대한 예측 파라미터를 유도하는 예를 나타낸 것이다.Figure 30 shows an example of deriving prediction parameters for color difference components.

설명의 편의를 위해, 크로마 포맷은 4:4:4이고, 루마 예측 블록 및 크로마 성분에 대한 참조 블록(즉, 크로마 참조 블록)의 크기는 4x4인 것으로 가정한다. 여기서, 크로마 성분은 Cb 성분 또는 Cr 성분을 나타낼 수 있다.For convenience of explanation, it is assumed that the chroma format is 4:4:4 and the size of the reference block for the luma prediction block and the chroma component (i.e., the chroma reference block) is 4x4. Here, the chroma component can represent the Cb component or the Cr component.

크로마 성분에 대한 예측 파라미터를 유도하기 위해, 루마 예측 블록 내 샘플들과 크로마 참조 블록 내 샘플들 간의 차이(즉, 에러 (E))를 다음의 수학식 7과 같이 정의할 수 있다. To derive prediction parameters for chroma components, the difference (i.e., error (E)) between samples in a luma prediction block and samples in a chroma reference block can be defined as in the following mathematical expression (7).

Figure PCTKR2024008916-appb-img-000007
Figure PCTKR2024008916-appb-img-000007

상기 수학식 7에서, T는, 블록을 나타내고, (i, j)는, 블록 내 샘플의 좌표를 나타낸다. RefC는, 크로마 참조 블록 내 샘플 값을 나타내고, PredL은, 루마 예측 블록 내 예측 샘플 값을 나타낸다. 크로마 포맷이 4:4:4가 아닌 경우, PredL은, 루마 예측 블록 내 예측 샘플들에 다운 샘플링 필터를 적용하여 획득될 수 있다. In the above mathematical expression 7, T represents a block, and (i, j) represents the coordinate of a sample within the block. RefC represents a sample value within a chroma reference block, and PredL represents a prediction sample value within a luma prediction block. When the chroma format is not 4:4:4, PredL can be obtained by applying a down-sampling filter to prediction samples within the luma prediction block.

이후, 수학식 7을 각각 수학식 8 및 수학식 9와 같이, 가중치 α 및 오프셋 β로 편미분하고, 편미분 결과가 0이 되는, 가중치 α 및 오프셋 β를 유도할 수 있다. Afterwards, mathematical expression 7 is partially differentiated with the weight α and the offset β as in mathematical expressions 8 and 9, respectively, and the weight α and the offset β for which the result of the partial differentiation becomes 0 can be derived.

Figure PCTKR2024008916-appb-img-000008
Figure PCTKR2024008916-appb-img-000008

Figure PCTKR2024008916-appb-img-000009
Figure PCTKR2024008916-appb-img-000009

상술한 과정을 통해 예측 파라미터가 유도되면, 유도된 예측 파라미터를 복원된 루마 블록에 적용하여, 크로마 블록에 대한 예측 블록을 획득할 수 있다. 수학식 10은, 크로마 블록에 대한 예측 블록을 유도하는 예를 나타낸 것이다.Once the prediction parameters are derived through the above-described process, the derived prediction parameters can be applied to the restored luma block to obtain a prediction block for the chroma block. Mathematical expression 10 shows an example of deriving a prediction block for a chroma block.

Figure PCTKR2024008916-appb-img-000010
Figure PCTKR2024008916-appb-img-000010

수학식 10에서, PredC는, 크로마 성분의 예측 샘플을 나타내고, recL은, 복원된 루마 블록 내 복원 샘플을 나타낸다. 크로마 포맷이 4:4:4가 아닌 경우, recL은, 루마 복원 블록 내 복원 샘플들에 다운 샘플링 필터를 적용하여 획득될 수 있다. In Equation 10, PredC represents a prediction sample of a chroma component, and recL represents a reconstructed sample in a reconstructed luma block. When the chroma format is not 4:4:4, recL can be obtained by applying a down-sampling filter to the reconstructed samples in the luma reconstructed block.

수학식 10에 도시된 예에서와 같이, 크로마 블록 내 예측하고자 하는 위치와 동일 위치의 루마 복원 샘플에 가중치 α를 곱하고, 그 결과값에 오프셋 β를 더하여, 크로마 블록의 예측 샘플을 획득할 수 있다.As in the example illustrated in mathematical expression 10, a prediction sample of a chroma block can be obtained by multiplying a luma restoration sample at the same location as a location to be predicted within a chroma block by a weight α and adding an offset β to the result.

한편, 예측 파라미터의 유도 과정을 간소화하기 위해, 서브 샘플링된 위치의 샘플들만을 이용하여, 예측 파라미터를 유도할 수도 있다.Meanwhile, to simplify the process of deriving prediction parameters, prediction parameters can be derived using only samples at sub-sampled locations.

도 31은 서브 샘플링된 위치를 나타낸 것이다.Figure 31 shows the sub-sampled locations.

루마 예측 블록 및 크로마 참조 블록 내 서브 샘플링된 위치의 샘플들만을 이용하여, 크로마 블록에 대한 예측 블록을 획득할 수 있다.A prediction block for a chroma block can be obtained by using only samples at sub-sampled locations within a luma prediction block and a chroma reference block.

도 31에 도시된 서브 샘플링 위치 후보들 중 어느 것을 사용할 것인지는, 부호화기 및 복호화기에서 기 정의되어 있을 수 있다.Which of the sub-sampling location candidates illustrated in Fig. 31 is to be used may be predefined in the encoder and decoder.

또는, 복수의 서브 샘플링 위치 후보들 중 하나를 지시하는 인덱스 정보가 부호화되어 시그날링될 수 있다.Alternatively, index information indicating one of the multiple sub-sampling location candidates may be encoded and signaled.

또는, 복수의 서브 샘플링 위치 후보들에 기초하여, 복수의 예측 파라미터 후보들을 유도할 수 있다. 일 예로, 도 31의 (a) 내지 (d)에 도시된 후보들 각각으로부터, 예측 파라미터 후보를 유도할 수 있다. Alternatively, multiple prediction parameter candidates can be derived based on multiple sub-sampling location candidates. For example, a prediction parameter candidate can be derived from each of the candidates illustrated in (a) to (d) of FIG. 31.

부호화기에서는, 복수의 예측 파라미터 후보들 중 최적의 예측 파라미터를 결정하고, 복수의 예측 파라미터 후보들 중 최적의 예측 파라미터를 가리키는 인덱스 정보를 부호화하여 시그날링할 수 있다.In the encoder, an optimal prediction parameter among a plurality of prediction parameter candidates can be determined, and index information indicating the optimal prediction parameter among the plurality of prediction parameter candidates can be encoded and signaled.

또는, 크로마 포맷에 따라, 서브 샘플링 위치가 적응적으로 결정될 수 있다.Alternatively, depending on the chroma format, the subsampling locations can be determined adaptively.

또는, 크로마 포맷에 따라, 루마 예측 블록에 대해서만, 서브 샘플링을 수행할 수도 있다. Alternatively, depending on the chroma format, subsampling may be performed only on luma prediction blocks.

상술한 예에서는, 예측 파라미터가 가중치 α 및 오프셋 β를 포함하는 것으로 예시하였다. 다른 예로, 복수의 필터 계수들을 예측 파라미터로 정의할 수도 있다. 일 예로, 루마 예측 블록 및 크로마 참조 블록 간의 차이를 최소화하는 콘볼루션 필터의 필터 계수들을 예측 파라미터로 정의할 수 있다. In the above example, the prediction parameters are exemplified as including weights α and offsets β. In another example, multiple filter coefficients may be defined as prediction parameters. As an example, filter coefficients of a convolutional filter that minimizes the difference between a luma prediction block and a chroma reference block may be defined as prediction parameters.

도 32는 콘볼루션 필터를 이용하여 예측 파라미터를 유도하는 예를 나타낸 것이다. 또한, 도 33은 콘볼루션 필터의 형태를 나타낸다. Figure 32 shows an example of deriving prediction parameters using a convolution filter. Also, Figure 33 shows the form of a convolution filter.

도 32에서는, 도 33에 도시된 5탭의 콘볼루션 필터를 이용하여, 예측 파라미터를 유도하는 예를 나타낸다. In Fig. 32, an example of deriving prediction parameters using the 5-tap convolution filter illustrated in Fig. 33 is shown.

도 33에 도시된 예에서와 같이, C는, 필터 중앙에 위치하는 루마 예측 샘플을 나타내고, N, W, S 및 E는, 루마 예측 샘플 주변의 샘플들을 나타낸다. 일 예로, N은, 루마 예측 샘플 C의 상단에 이웃하는 샘플, 즉, [i, j-1] 위치의 샘플을 나타낼 수 있다. S는, 루마 예측 샘플 C의 하단에 이웃하는 샘플, 즉, [i, j+1] 위치의 샘플을 나타낼 수 있다. W는, 루마 예측 샘플 C의 좌측에 이웃하는 샘플, 즉, [i-1, j] 위치의 샘플을 나타낼 수 있다. E는, 루마 예측 샘플 C의 우측에 이웃하는 샘플, 즉, [i+1, j] 위치의 샘플을 나타낼 수 있다.As in the example illustrated in FIG. 33, C represents a luma prediction sample located at the center of the filter, and N, W, S, and E represent samples around the luma prediction sample. For example, N may represent a sample neighboring the upper side of the luma prediction sample C, i.e., a sample at position [i, j-1]. S may represent a sample neighboring the lower side of the luma prediction sample C, i.e., a sample at position [i, j+1]. W may represent a sample neighboring the left side of the luma prediction sample C, i.e., a sample at position [i-1, j]. E may represent a sample neighboring the right side of the luma prediction sample C, i.e., a sample at position [i+1, j].

크로마 포맷이 4:4:4가 아닌 경우, 루마 예측 블록을 다운 샘플링할 수 있다. 즉, C는, 다운 샘플링된 루마 예측 샘플을 나타낼 수 있다. 또한, N, W, S 및 E는, 다운 샘플링된 루마 예측 블록 내 상기 C에 인접하는 샘플들을 나타낼 수 있다. If the chroma format is not 4:4:4, the luma prediction block can be downsampled. That is, C can represent a downsampled luma prediction sample. Additionally, N, W, S, and E can represent samples adjacent to C within the downsampled luma prediction block.

한편, 루마 예측 샘플이, 루마 블록의 경계에 위치하는 경우, 루마 블록의 바깥에 존재하는 샘플을 콘볼루션 필터에 입력해야 한다. 이 때, 콘볼루션 필터로 입력되는 샘플은, 루마 블록 주변의 복원 샘플일 수 있다. 즉, [i, j]는, 루마 블록 내 좌표를 나타낼 수 있다. Meanwhile, if the luma prediction sample is located at the boundary of the luma block, the sample existing outside the luma block must be input to the convolution filter. At this time, the sample input to the convolution filter may be a restoration sample around the luma block. That is, [i, j] may represent the coordinate within the luma block.

또는, 콘볼루션 필터로 입력되는 샘플은, 참조 픽처 내 루마 블록의 참조 블록 주변의 복원 샘플일 수 있다. 즉, [i, j]는, 참조 픽처 내 루마 블록의 참조 블록의 좌표를 나타낼 수 있다.Alternatively, the samples input to the convolution filter may be reconstructed samples around the reference block of the luma block in the reference picture. That is, [i, j] may represent the coordinates of the reference block of the luma block in the reference picture.

루마 예측 블록에 콘볼루션 필터를 적용하여, 콘볼루션 필터의 출력값을 획득하고, 콘볼루션 필터의 출력값과 대응하는 크로마 참조 블록 내 샘플값의 차이(즉, 에러 (E))를 최소화하는 필터 계수들을 유도할 수 있다. 일 예로, 수학식 11은, 필터 계수들을 유도하는 예를 나타낸 것이다. By applying a convolution filter to a luma prediction block, an output value of the convolution filter can be obtained, and filter coefficients that minimize the difference (i.e., error (E)) between the output value of the convolution filter and the corresponding sample value in the chroma reference block can be derived. As an example, mathematical expression 11 shows an example of deriving filter coefficients.

Figure PCTKR2024008916-appb-img-000011
Figure PCTKR2024008916-appb-img-000011

수학식 11에서, w0 내지 w4 각각은, C, N, S, E 및 W에 적용되는 가중치를 나타낸다. RefC는, 크로마 참조 블록 내 샘플을 나타낸다. In Equation 11, w0 to w4 represent weights applied to C, N, S, E, and W, respectively. RefC represents a sample within a chroma reference block.

B는, 픽처의 비트 뎁스(Bit-Depth)를 기초로 유도되는 값일 수 있다. 일 예로, 수학식 12는, 변수 B를 유도하는 예를 나타낸다.B may be a value derived based on the bit depth of the picture. As an example, mathematical expression 12 shows an example of deriving the variable B.

Figure PCTKR2024008916-appb-img-000012
Figure PCTKR2024008916-appb-img-000012

수학식 12에서, D는, 비트 뎁스를 나타낸다. 일 예로, 비트 뎁스가 10비트인 경우, B는, 10비트로 표현할 수 있는 범위의 중간값인 512로 설정될 수 있다. 또는, 비트 뎁스가 8비트인 경우, B는, 8비트로 표현할 수 있는 범위의 중간값인 128로 설정될 수 있다. In mathematical expression 12, D represents the bit depth. For example, if the bit depth is 10 bits, B can be set to 512, which is the middle value of the range that can be expressed by 10 bits. Or, if the bit depth is 8 bits, B can be set to 128, which is the middle value of the range that can be expressed by 8 bits.

또는, 변수 B를, 루마 예측 블록 내 예측 샘플들의 평균값으로 설정할 수 있따. 또는, 변수 B를, 콘볼루션 필터로 입력되는 샘플들의 평균값으로 설정할 수 있다. 또는, 변수 B의 값을 나타내는 정보를 명시적으로 부호화하여 시그날링할 수 있다. Alternatively, variable B can be set to the mean of prediction samples within the luma prediction block. Alternatively, variable B can be set to the mean of samples input to the convolution filter. Alternatively, information representing the value of variable B can be explicitly encoded and signaled.

이후, 수학식 11을 필터 계수들(즉, w0 내지 w5) 각각에 대해 편미분하고, 편미분 결과가 0이 되는 필터 계수를 유도할 수 있다. Afterwards, mathematical expression 11 can be partially differentiated with respect to each of the filter coefficients (i.e., w0 to w5), and filter coefficients for which the result of the partial differentiation becomes 0 can be derived.

필터 계수들이 유도되면, 루마 블록에 콘볼루션 필터를 적용하여, 크로마 블록의 예측 샘플을 획득할 수 있다. 일 예로, 크로마 블록의 예측 샘플은, 다음의 수학식 13에 의해 유도될 수 있다. Once the filter coefficients are derived, a convolution filter can be applied to the luma block to obtain a prediction sample of the chroma block. For example, the prediction sample of the chroma block can be derived by the following mathematical expression 13.

Figure PCTKR2024008916-appb-img-000013
Figure PCTKR2024008916-appb-img-000013

수학식 13에서, PredC는, 크로마 블록의 예측 샘플을 나타낸다. C'는, 루마 블록 내 크로마 예측 샘플과 동일 위치의 복원 샘플(즉, recL[i][j])를 의미한다. N', S', E' 및 W'는 C'에 인접하는 샘플들을 나타낸다. 일 예로, N'은, C'의 상단 인접 샘플을 나타내고, S'은, C'의 하단 인접 샘플을 나타낼 수 있다. E'는, C'의 우측 인접 샘플을 나타내고, W'은, C'의 좌측 인접 샘플을 나타낼 수 있다.In Equation 13, PredC represents a prediction sample of a chroma block. C' represents a reconstructed sample (i.e., recL[i][j]) at the same location as the chroma prediction sample in the luma block. N', S', E', and W' represent samples adjacent to C'. For example, N' may represent an upper adjacent sample of C', S' may represent a lower adjacent sample of C', E' may represent a right adjacent sample of C', and W' may represent a left adjacent sample of C'.

크로마 포맷이 4:4:4가 아닌 경우, 루마 블록을 다운 샘플링할 수 있다. 즉, C'는, 다운 샘플링된 루마 복원 샘플을 나타낼 수 있다. 또한, N', W', S' 및 E'는, 다운 샘플링된 루마 블록 내 상기 C'에 인접하는 샘플들을 나타낼 수 있다.If the chroma format is not 4:4:4, the luma block can be downsampled. That is, C' can represent a downsampled luma restoration sample. Additionally, N', W', S' and E' can represent samples adjacent to C' within the downsampled luma block.

한편, 필터 형태는, 도시된 예에 한정되지 않는다. 일 예로, 1D 형태, 정사각형 또는 직사각형 필터를 이용하여, 예측 파라미터 및 크로마 예측 샘플을 유도할 수도 있다.Meanwhile, the filter shape is not limited to the illustrated example. For example, prediction parameters and chroma prediction samples may be derived using a 1D shape, square or rectangular filter.

상술한 예에서, 가중치 α 및 오프셋 β를 포함하는 예측 파라미터를, 선형 예측 파라미터라 호칭하고, 콘볼루션 필터의 필터 계수들(예컨대, w0 내지 w5)를 포함하는 예측 파라미터를, 콘볼루션 예측 파라미터라 호칭할 수 있다. In the above example, the prediction parameters including the weights α and the offset β may be referred to as linear prediction parameters, and the prediction parameters including the filter coefficients of the convolution filter (e.g., w0 to w5) may be referred to as convolution prediction parameters.

이때, 크로마 블록의 예측을 위해, 선형 예측 파라미터 및 콘볼루션 예측 파라미터 중 어느 것을 이용할 것인지를 지시하는 정보가 부호화되어 시그날링될 수 있다. At this time, information indicating which of the linear prediction parameters and the convolutional prediction parameters to use for prediction of the chroma block can be encoded and signaled.

또는, 크로마 포맷, 루마/크로마 블록의 크기, 비트 뎁스, 루마 블록 내 복원 샘플들의 평균값 또는 슬라이스 타입 중 적어도 하나에 기초하여, 선형 예측 파라미터 및 콘볼루션 예측 파라미터 중 하나를 선택할 수도 있다. 일 예로, 크로마 포맷이 4:4:4인 경우에는, 선형 예측 파라미터를 이용하여, 크로마 블록을 예측할 수 있다. 반면, 크로마 포맷이 4:2:2 또는 4:2:0인 경우에는, 콘볼루션 예측 파라미터를 이용하여, 크로마 블록을 예측할 수 있다.Alternatively, one of the linear prediction parameter and the convolution prediction parameter may be selected based on at least one of the chroma format, the size of the luma/chroma block, the bit depth, the mean value of the reconstructed samples in the luma block, or the slice type. For example, when the chroma format is 4:4:4, the chroma block can be predicted using the linear prediction parameter. On the other hand, when the chroma format is 4:2:2 or 4:2:0, the chroma block can be predicted using the convolution prediction parameter.

또는, 선형 예측 파라미터 및 콘볼루션 예측 파라미터를 조합하여, 크로마 블록의 예측 블록을 획득할 수도 있다. 일 예로, 선형 예측 파라미터를 기반으로, 크로마 블록에 대한 제1 예측 블록을 획득하고, 콘볼루션 예측 파라미터를 기반으로, 크로마 블록에 대한 제2 예측 블록을 획득할 수 있다. 이후, 제1 예측 블록 및 제2 예측 블록을 평균 또는 가중합 하여, 크로마 블록의 최종 예측 블록을 유도할 수 있다.Alternatively, the linear prediction parameters and the convolution prediction parameters may be combined to obtain the prediction block of the chroma block. For example, a first prediction block for the chroma block may be obtained based on the linear prediction parameters, and a second prediction block for the chroma block may be obtained based on the convolution prediction parameters. Thereafter, the first prediction block and the second prediction block may be averaged or weighted to derive the final prediction block of the chroma block.

한편, 예측 파라미터에 기반한 색성분간 예측은, 서브 블록 단위로 수행될 수 있다. Meanwhile, color component prediction based on prediction parameters can be performed on a sub-block basis.

도 34는 예측 파라미터에 기반한 색성분간 예측 방법이 서브 블록 단위로 수행되는 예를 설명하기 위한 도면이다. Figure 34 is a diagram for explaining an example in which a color component discrimination prediction method based on prediction parameters is performed on a sub-block basis.

크로마 블록을 복수개의 서브 블록들로 분할하고, 크로마 서브 블록들 각각에 대해 독립적으로 예측 파라미터를 유도할 수 있다.A chroma block can be divided into multiple sub-blocks, and prediction parameters can be derived independently for each chroma sub-block.

일 예로, 루마 블록 내 제1 루마 서브 블록의 움직임 정보를 기초로, 제1 루마 서브 블록에 대한 참조 블록을 결정할 수 있다. 제1 루마 서브 블록에 대한 참조 블록은, 제1 루마 서브 블록의 예측 블록일 수 있다. For example, a reference block for the first luma sub-block can be determined based on motion information of the first luma sub-block within the luma block. The reference block for the first luma sub-block can be a prediction block of the first luma sub-block.

또한, 크로마 블록 내 제1 크로마 서브 블록에 대해서도, 참조 블록을 결정할 수 있다. 제1 크로마 서브 블록의 참조 블록은, 참조 픽처 내 제1 루마 서브 블록의 참조 블록과 동일 위치의 블록일 수 있다. Additionally, a reference block can be determined for the first chroma sub-block within a chroma block. The reference block of the first chroma sub-block can be a block at the same location as the reference block of the first luma sub-block within the reference picture.

또는, 제1 루마 서브 블록의 움직임 정보로부터, 제1 크로마 서브 블록의 움직임 정보를 유도하고, 제1 크로마 블록의 움직임 정보를 기초로, 제1 크로마 서브 블록의 참조 블록을 유도할 수 있다.Alternatively, motion information of the first chroma sub-block can be derived from motion information of the first luma sub-block, and a reference block of the first chroma sub-block can be derived based on the motion information of the first chroma block.

이후, 제1 루마 서브 블록의 참조 블록과 제1 크로마 서브 블록의 참조 블록을 이용하여, 제1 크로마 서브 블록에 대한 제1 예측 파라미터를 유도할 수 있다. Thereafter, a first prediction parameter for the first chroma sub-block can be derived using the reference block of the first luma sub-block and the reference block of the first chroma sub-block.

위와 동일한 방법으로, 제2 내지 제4 크로마 서브 블록들에 대해, 제2 내지 제4 예측 파라미터를 유도할 수 있다. In the same manner as above, the second to fourth prediction parameters can be derived for the second to fourth chroma sub-blocks.

이후, 크로마 서브 블록 각각의 예측 파라미터에 기반하여, 크로마 서브 블록의 예측 블록을 유도할 수 있다. 일 예로, 루마 블록 내 제1 루마 서브 블록에 제1 예측 파라미터를 적용함으로써, 크로마 블록 내 제1 크로마 서브 블록에 대한 예측 블록을 획득할 수 있다. 또한, 루마 블록 내 제2 루마 서브 블록에 제2 예측 파라미터를 적용함으로써, 크로마 블록 내 제2 크로마 서브 블록에 대한 예측 블록을 획득할 수 있다.Thereafter, based on the prediction parameter of each chroma sub-block, a prediction block of the chroma sub-block can be derived. For example, by applying a first prediction parameter to a first luma sub-block in a luma block, a prediction block for a first chroma sub-block in the chroma block can be obtained. In addition, by applying a second prediction parameter to a second luma sub-block in the luma block, a prediction block for a second chroma sub-block in the chroma block can be obtained.

마찬가지로, 제3 크로마 서브 블록에 대한 예측 블록은, 제3 루마 서브 블록에 제3 예측 파라미터를 적용하여 획득되고, 제4 크로마 서브 블록에 대한 예측 블록은, 제4 루마 서브 블록에 제4 예측 파라미터를 적용하여 획득될 수 있다. Similarly, a prediction block for a third chroma sub-block can be obtained by applying a third prediction parameter to a third luma sub-block, and a prediction block for a fourth chroma sub-block can be obtained by applying a fourth prediction parameter to a fourth luma sub-block.

서브 블록의 크기는, 부호화기 및 복호화기에서 기 정의되어 있을 수 있다. The size of a sub-block may be predefined in the encoder and decoder.

또는, 상위 헤더를 통해, 서브 블록의 크기를 나타내는 정보가 부호화되어 시그날링될 수 있다.Alternatively, information indicating the size of the sub-block can be encoded and signaled via the upper header.

예측 파라미터에 기초한 색성분간 예측이 서브 블록 단위로 수행되는지 여부를 나타내는 정보가 부호화되어 시그날링될 수 있다. Information indicating whether color component prediction based on prediction parameters is performed on a sub-block basis can be encoded and signaled.

또는, 루마/크로마 블록의 크기, 블록을 분할하였을 때 생성되는 서브 블록이 포함하는 샘플들의 개수 또는 크로마 포맷 중 적어도 하나에 기초하여, 예측 파라미터에 기초한 색성분간 예측이 서브 블록 단위로 수행되는지 여부가 결정될 수 있다.Alternatively, whether color component prediction based on prediction parameters is performed on a sub-block basis can be determined based on at least one of the size of a luma/chroma block, the number of samples included in a sub-block generated when dividing the block, or a chroma format.

또는, 루마 블록의 인터 예측이 서브 블록 단위로 수행되었는지 여부에 기초하여, 예측 파라미터에 기초한 색성분간 예측이 서브 블록 단위로 수행되는지 여부가 결정될 수 있다. 일 예로, 루마 블록이 어파인 모델 또는 SbTMVP에 기초로 부호화/복호화된 경우, 예측 파라미터에 기초한 색성분간 예측이 서브 블록 단위로 수행될 수 있다. 반면, 루마 블록에 병진 움직임 모델을 기초로 부호화/복호화된 경우, 블록 레벨에서 예측 파라미터를 유도하여, 색성분간 예측이 수행될 수 있다.Alternatively, whether the color component discriminant prediction based on the prediction parameter is performed on a sub-block basis can be determined based on whether the inter prediction of the luma block is performed on a sub-block basis. For example, if the luma block is encoded/decoded based on an affine model or SbTMVP, the color component discriminant prediction based on the prediction parameter can be performed on a sub-block basis. On the other hand, if the luma block is encoded/decoded based on a translational motion model, the color component discriminant prediction can be performed by deriving the prediction parameter at the block level.

한편, 크로마 블록 내 서브 블록들 중 예측 파라미터 유도가 비가용한 서브 블록에 대해서는, 블록 레벨에서 유도된 예측 파라미터를 유도할 수 있다. Meanwhile, for sub-blocks among the chroma blocks for which prediction parameter derivation is not available, prediction parameters derived at the block level can be derived.

일 에로, 크로마 서브 블록에 대응하는 루마 서브 블록이 인터 예측으로 부호화되지 않았거나, 루마 서브 블록에 저장된 움직임 벡터가 존재하지 않는 경우, 상기 크로마 서브 블록에 대해서는, 예측 파라미터를 유도하는 것이 비가용할 수 있다. In one embodiment, if a luma sub-block corresponding to a chroma sub-block is not encoded with inter prediction or there is no motion vector stored in the luma sub-block, it may not be possible to derive prediction parameters for the chroma sub-block.

이 경우, 블록 레벨에서 예측 파라미터를 유도하고, 유도된 블록 레벨의 예측 파라미터를, 크로마 서브 블록의 예측 파라미터로 이용할 수 있다. 여기서, 블록 레벨에서의 예측 파라미터는, 루마 블록의 참조 블록과 크로마 블록의 참조 블록 간의 상관 관계에를 기초로 유도된 것일 수 있다. In this case, prediction parameters can be derived at the block level, and the derived block level prediction parameters can be used as prediction parameters of chroma sub-blocks. Here, the prediction parameters at the block level can be derived based on the correlation between the reference block of the luma block and the reference block of the chroma block.

또는, 크로마 서브 블록에 대해, 예측 파라미터를 유도하는 것이 비가용한 경우, 인접하는 크로마 서브 블록의 예측 파라미터를, 상기 크로마 서브 블록의 예측 파라미터로 설정할 수 있다. 일 예로, 크로마 서브 블록의 좌측 또는 상단에 인접하는 이웃 크로마 서브 블록의 예측 파라미터를, 상기 크로마 서브 블록의 예측 파라미터로 설정할 수 있다. Alternatively, if it is not possible to derive prediction parameters for a chroma sub-block, the prediction parameters of an adjacent chroma sub-block may be set as the prediction parameters of the chroma sub-block. For example, the prediction parameters of a neighboring chroma sub-block adjacent to the left or top of the chroma sub-block may be set as the prediction parameters of the chroma sub-block.

크로마 블록에 예측 파라미터에 기초한 색성분간 예측이 적용되는지 여부를 나타내는 정보가 부호하되어 시그날링될 수 있다. 상기 정보는 1비트의 플래그일 수 있다.Information indicating whether color component prediction based on prediction parameters is applied to a chroma block may be encoded and signaled. The information may be a 1-bit flag.

한편, 예측 파라미터에 기초한 색성분간 예측은, 소정 조건을 만족하는 경우에 제한적으로 허용될 수 있다. 여기서, 소정 조건은, 변환 및 양자화된 계수들의 개수, 변환 및 양자화된 계수의 값, 루마 블록 내 샘플들의 개수, 루마 블록 내 샘플의 값, 크로마 포맷 또는 양방향 예측 수행 여부 중 적어도 하나를 기초로 결정될 수 있다. 변환 및 양자화된 계수를 잔차 계수라 호칭할 수도 있다.Meanwhile, color component discrimination prediction based on prediction parameters may be allowed in a limited manner when certain conditions are satisfied. Here, the certain conditions may be determined based on at least one of the number of transformed and quantized coefficients, the values of the transformed and quantized coefficients, the number of samples in a luma block, the values of the samples in a luma block, the chroma format, or whether bidirectional prediction is performed. The transformed and quantized coefficients may also be referred to as residual coefficients.

일 예로, 루마 블록 내 변환 및 양자화된 계수들이 모두 0이 아닌 경우, 예측 파라미터에 기초한 색성분간 예측이 수행될 수 있다.For example, if all transformed and quantized coefficients in the luma block are non-zero, color component-specific prediction based on prediction parameters can be performed.

또는, 루마 블록 내 0이 아닌 변환 및 양자화된 계수들의 개수가 문턱값 이상인 경우에만, 예측 파라미터에 기초한 색성분간 예측이 적용될 수 있다.Alternatively, color component-specific prediction based on prediction parameters can be applied only if the number of non-zero transformed and quantized coefficients in the luma block is greater than or equal to a threshold.

또는, 루마 블록 내 모든 샘플들의 값이 0이 아닌 경우에만, 예측 파라미터에 기초한 색성분간 예측이 수행될 수 있다.Alternatively, color component prediction based on prediction parameters can be performed only if all samples within the luma block have non-zero values.

또는, 루마 블록 내 모든 잔차 샘플들의 값이 0이 아닌 경우에만, 예측 파라미터에 기초한 색성분간 예측이 수행될 수 있다. Alternatively, color component prediction based on prediction parameters can be performed only if the values of all residual samples within the luma block are not 0.

또는, 루마 블록에 AMVP 모드, 머지 모드, 템플릿 매칭 또는 쌍방 매칭 중 적어도 하나가 적용된 경우에만, 예측 파라미터에 기초한 색성분간 예측이 수행될 수 있다. Alternatively, color component-specific prediction based on prediction parameters can be performed only when at least one of AMVP mode, merge mode, template matching or bilateral matching is applied to the luma block.

상기 열거된 조건들 중 적어도 하나에 기반하여, 서브 블록 단위로 예측 파라미터를 유도할 것인지 여부를 결정할 수도 있다.Based on at least one of the conditions listed above, it may be determined whether to derive prediction parameters on a sub-block basis.

일 예로, 루마 서브 블록 내 모든 잔차 샘플들의 값이 0이 아닌 경우에만, 크로마 서브 블록에 대해 예측 파라미터를 유도할 수 있다. 만약, 루마 서브 블록 내 적어도 하나의 잔차 샘플들의 값이 0이거나, 모든 잔차 샘플들의 값이 0인 경우에는, 크로마 서브 블록에 대해, 예측 파라미터를 유도하는 것이 비가용할 수 있다.For example, it is possible to derive prediction parameters for a chroma sub-block only if all residual samples in the luma sub-block have non-zero values. If at least one residual sample in the luma sub-block has zero values, or if all residual samples have zero values, it may not be possible to derive prediction parameters for the chroma sub-block.

크로마 서브 블록에 대해 예측 파라미터를 유도하는 것이 비가용한 경우, 블록 레벨에서 유도된 예측 파라미터 또는 이웃 크로마 서브 블록의 예측 파라미터가, 상기 크로마 서브 블록의 예측 파라미터로 설정될 수 있다. If it is not possible to derive prediction parameters for a chroma sub-block, prediction parameters derived at the block level or prediction parameters of a neighboring chroma sub-block can be set as the prediction parameters of the chroma sub-block.

한편, 예측 파라미터에 기초한 색성분간 예측은, 루마 블록에 화면내 블록 카피 모드가 적용된 경우에도 적용될 수 있다. 이 경우, 루마 블록의 참조 블록 및 크로마 블록의 참조 블록은, 현재 픽처 내 기 복원된 영역에 존재할 수 있다.Meanwhile, color component prediction based on prediction parameters can also be applied when the within-screen block copy mode is applied to the luma block. In this case, the reference block of the luma block and the reference block of the chroma block may exist in the previously restored area in the current picture.

크로마 블록의 예측 파라미터는, 현재 루마 픽처 내 참조 블록과 현재 크로마 픽처 내 참조 블록 간의 상관 관계를 기반으로 유도될 수 있다.The prediction parameters of a chroma block can be derived based on the correlation between a reference block in the current luma picture and a reference block in the current chroma picture.

크로마 블록에 색성분간 예측을 적용하기로 결정된 경우, 대응되는 루마 블록의 부호화 모드에 기초하여, 예측 파라미터를 유도하기 위한 참조 영역을 상이하게 설정할 수도 있다.When it is decided to apply color component-specific prediction to a chroma block, the reference region for deriving prediction parameters may be set differently based on the encoding mode of the corresponding luma block.

일 에로, 루마 블록이 화면 간 예측으로 부호화된 경우에는, 루마 블록의 움직임 정보를 기초로 참조 픽처로부터 루마 블록의 참조 블록을 유도하고, 크로마 블록의 움직임 정보를 기초로, 참조 픽처로부터 크로마 블록의 참조 블록을 유도할 수 있다. 이후, 루마 블록의 참조 블록 및 크로마 블록의 참조 블록 간의 상관 관계에 기초하여, 예측 파라미터를 유도할 수 있다. In one embodiment, when a luma block is encoded with inter-screen prediction, a reference block of the luma block can be derived from a reference picture based on motion information of the luma block, and a reference block of the chroma block can be derived from a reference picture based on motion information of the chroma block. Thereafter, a prediction parameter can be derived based on a correlation between the reference block of the luma block and the reference block of the chroma block.

반면, 루마 블록이 화면 내 에측으로 부호화된 경우에는, 루마 블록에 인접하는 템플릿 및 크로마 블록에 인접하는 템플릿 간의 상관 관계에 기초하여, 예측 파라미터를 유도할 수 있다. On the other hand, if the luma block is encoded as a prediction within the screen, the prediction parameters can be derived based on the correlation between the templates adjacent to the luma block and the templates adjacent to the chroma block.

복호화 과정 또는 부호화 과정을 중심으로 설명된 실시예들을, 부호화 과정 또는 복호화 과정에 적용하는 것은, 본 개시의 범주에 포함되는 것이다. 소정의 순서로 설명된 실시예들을, 설명된 것과 상이한 순서로 변경하는 것 역시, 본 개시의 범주에 포함되는 것이다.It is within the scope of the present disclosure to apply the embodiments described with a focus on the decoding process or the encoding process to the encoding process or the decoding process. It is also within the scope of the present disclosure to change the embodiments described in a certain order to a different order from the described order.

상술한 개시는 일련의 단계 또는 순서도를 기초로 설명되고 있으나, 이는 발명의 시계열적 순서를 한정한 것은 아니며, 필요에 따라 동시에 수행되거나 다른 순서로 수행될 수 있다. 또한, 상술한 개시에서 블록도를 구성하는 구성요소(예를 들어, 유닛, 모듈 등) 각각은 하드웨어 장치 또는 소프트웨어로 구현될 수도 있고, 복수의 구성요소가 결합하여 하나의 하드웨어 장치 또는 소프트웨어로 구현될 수도 있다. 일 예로, 상기 하드웨어 장치는, 연산을 수행하기 위한 프로세서, 데이터를 저장하는 메모리, 데이터를 전송하는 송신기 및 데이터를 수신하는 수신기 중 적어도 하나를 포함할 수 있다.Although the above-described disclosure has been described based on a series of steps or a flow chart, this does not limit the chronological order of the invention, and may be performed simultaneously or in a different order as needed. In addition, each of the components (e.g., units, modules, etc.) constituting the block diagram in the above-described disclosure may be implemented as a hardware device or software, or a plurality of components may be combined to be implemented as a single hardware device or software. As an example, the hardware device may include at least one of a processor for performing a calculation, a memory for storing data, a transmitter for transmitting data, and a receiver for receiving data.

상술한 개시는 다양한 컴퓨터 구성요소를 통하여 수행될 수 있는 프로그램 명령어의 형태로 구현되어 컴퓨터 판독 가능한 기록 매체에 기록될 수 있다. 상기 컴퓨터 판독 가능한 기록 매체는 프로그램 명령어, 데이터 파일, 데이터 구조 등을 단독으로 또는 조합하여 포함할 수 있다. The above-described disclosure may be implemented in the form of program commands that can be executed through various computer components and recorded on a computer-readable recording medium. The computer-readable recording medium may include program commands, data files, data structures, etc., singly or in combination.

또한, 본 개시에 의하면, 상술한 부호화 방법에 의해 생성된 비트스트림을 저장하는 컴퓨터로 판독 가능한 기록 매체가 제공될 수 있다. 상기 비트스트림은, 부호화 장치에 의해 전송될 수 있고, 복호화 장치는, 상기 비트스트림을 수신하여, 영상을 복호화할 수 있다. In addition, according to the present disclosure, a computer-readable recording medium storing a bitstream generated by the above-described encoding method can be provided. The bitstream can be transmitted by an encoding device, and a decoding device can receive the bitstream and decode an image.

컴퓨터 판독 가능한 기록 매체의 예에는, 하드 디스크, 플로피 디스크 및 자기 테이프와 같은 자기 매체, CD-ROM, DVD와 같은 광기록 매체, 플롭티컬 디스크(floptical disk)와 같은 자기-광 매체(magneto-optical media), 및 ROM, RAM, 플래시 메모리 등과 같은 프로그램 명령어를 저장하고 수행하도록 특별히 구성된 하드웨어 장치가 포함된다. 상기 하드웨어 장치는 본 개시에 따른 처리를 수행하기 위해 하나 이상의 소프트웨어 모듈로서 작동하도록 구성될 수 있으며, 그 역도 마찬가지이다. Examples of computer-readable recording media include magnetic media such as hard disks, floppy disks, and magnetic tapes, optical recording media such as CD-ROMs, DVDs, magneto-optical media such as floptical disks, and hardware devices specifically configured to store and execute program instructions such as ROMs, RAMs, flash memories, and the like. The hardware devices may be configured to operate as one or more software modules to perform processing according to the present disclosure, and vice versa.

본 개시는 비디오 신호를 인코딩/디코딩할 수 있는 컴퓨팅 또는 전자 장치 에 적용될 수 있다.The present disclosure may be applied to a computing or electronic device capable of encoding/decoding a video signal.

Claims (15)

크로마 블록과 동일 위치인 루마 블록의 제1 참조 블록을 유도하는 단게;A step for deriving a first reference block of a luma block that is in the same position as the chroma block; 상기 크로마 블록의 제2 참조 블록을 유도하는 단계;A step of deriving a second reference block of the above chroma block; 상기 제1 참조 블록 및 상기 제2 참조 블록에 기초하여, 예측 파라미터를 유도하는 단계; 및A step of deriving prediction parameters based on the first reference block and the second reference block; and 상기 루마 블록에 상기 예측 파라미터를 적용하여, 상기 크로마 블록에 대한 예측 블록을 획득하는 단계를 포함하는, 영상 복호화 방법. A method for decoding an image, comprising the step of obtaining a prediction block for the chroma block by applying the prediction parameter to the luma block. 제1 항에 있어서,In the first paragraph, 상기 루마 블록에 양방향 예측이 적용된 경우, 상기 제1 참조 블록은, 상기 루마 블록의 L0 참조 블록 및 L1 참조 블록을 가중합하여 획득된 것이고,When bidirectional prediction is applied to the above luma block, the first reference block is obtained by weighting the L0 reference block and the L1 reference block of the luma block, 상기 제2 참조 블록은, 상기 크로마 블록의 L0 참조 블록 및 L1 참조 블록을 가중합하여 획득된 것을 특징으로 하는, 영상 복호화 방법.A method for decoding an image, characterized in that the second reference block is obtained by weighting the L0 reference block and the L1 reference block of the chroma block. 제1 항에 있어서,In the first paragraph, 상기 루마 블록에 양방향 예측이 적용된 경우, 상기 루마 블록의 L0 참조 픽처 및 L1 참조 픽처의 POC (Picture Order Count)를 기반으로, 상기 제1 참조 블록 및 상기 제2 참조 블록이 결정되는 것을 특징으로 하는, 영상 복호화 방법. An image decoding method, characterized in that when bidirectional prediction is applied to the luma block, the first reference block and the second reference block are determined based on a POC (Picture Order Count) of an L0 reference picture and an L1 reference picture of the luma block. 제3 항에 있어서,In the third paragraph, 상기 L0 참조 픽처 및 현재 픽처 간의 거리가 상기 L1 참조 픽처 및 상기 현재 픽처 간의 거리보다 작은 경우, 상기 제1 참조 블록 및 상기 제2 참조 블록 각각은, 상기 루마 블록의 L0 참조 블록 및 상기 크로마 블록의 L0 참조 블록을 나타내고,If the distance between the L0 reference picture and the current picture is less than the distance between the L1 reference picture and the current picture, each of the first reference block and the second reference block represents an L0 reference block of the luma block and an L0 reference block of the chroma block, 상기 L1 참조 픽처 및 상기 현재 픽처 간의 거리가 상기 L0 참조 픽처 및 상기 현재 픽처 간의 거리보다 작은 경우, 상기 제1 참조 블록 및 상기 제2 참조 블록 각각은, 상기 루마 블록의 L1 참조 블록 및 상기 크로마 블록의 L1 참조 블록을 나타내는 것을 특징으로 하는, 영상 복호화 방법.A video decoding method, characterized in that each of the first reference block and the second reference block represents an L1 reference block of the luma block and an L1 reference block of the chroma block, when the distance between the L1 reference picture and the current picture is smaller than the distance between the L0 reference picture and the current picture. 제4 항에 있어서,In the fourth paragraph, 상기 L0 참조 픽처 및 상기 현재 픽처 간의 거리와 상기 L1 참조 픽처 및 상기 현재 픽처 간의 거리가 동일한 경우, 상기 제1 참조 블록은, 상기 루마 블록의 상기 L0 참조 블록 및 상기 L1 참조 블록을 가중합하여 획득된 것이고, 상기 제2 참조 블록은, 상기 크로마 블록의 상기 L0 참조 블록 및 상기 L1 참조 블록을 가중합하여 획득된 것을 특징으로 하는, 영상 복호화 방법.A method for decoding an image, characterized in that when the distance between the L0 reference picture and the current picture and the distance between the L1 reference picture and the current picture are equal, the first reference block is obtained by weighting the L0 reference block and the L1 reference block of the luma block, and the second reference block is obtained by weighting the L0 reference block and the L1 reference block of the chroma block. 제1 항에 있어서,In the first paragraph, 상기 루마 블록에 양방향 예측이 적용된 경우, 상기 제1 참조 블록 및 상기 제2 참조 블록은, L0 방향의 참조 픽처 또는 L1 방향의 참조 픽처 중 적어도 하나로부터 유도되고,When bidirectional prediction is applied to the above luma block, the first reference block and the second reference block are derived from at least one of a reference picture in the L0 direction or a reference picture in the L1 direction, 비트스트림으로부터 복호화되는 예측 방향 정보에 기초하여, 상기 L0 방향 및 상기 L1 방향 중 적어도 하나가 선택되는 것을 특징으로 하는, 영상 복호화 방법.An image decoding method, characterized in that at least one of the L0 direction and the L1 direction is selected based on prediction direction information decoded from a bitstream. 제1 항에 있어서,In the first paragraph, 상기 예측 파라미터는, 가중치 및 오프셋을 포함하는 것을 특징으로 하는, 영상 복호화 방법.An image decoding method, characterized in that the above prediction parameters include weights and offsets. 제7 항에 있어서,In Article 7, 상기 크로마 블록의 예측 샘플은, 상기 루마 블록 내 상기 예측 샘플의 위치에 대응되는 복원 샘플에 상기 가중치를 곱한 결과값에 상기 오프셋을 더하여 유도되는 것을 특징으로 하는, 영상 복호화 방법.A method for decoding an image, characterized in that the prediction sample of the chroma block is derived by adding the offset to the result of multiplying the restoration sample corresponding to the position of the prediction sample in the luma block by the weight. 제1 항에 있어서,In the first paragraph, 상기 예측 파라미터는, 콘볼루션 필터를 위한 필터 계수들을 포함하는 것을 특징으로 하는, 영상 복호화 방법.An image decoding method, characterized in that the above prediction parameters include filter coefficients for a convolution filter. 제9 항에 있어서,In Article 9, 상기 크로마 블록의 예측 샘플은, 상기 루마 블록 내 상기 예측 샘플의 위치에 대응되는 복원 샘플 및 상기 복원 샘플에 인접하는 적어도 하나의 이웃 샘플을 상기 콘볼루션 필터에 입력하여 유도되는 것을 특징으로 하는, 영상 복호화 방법.An image decoding method, characterized in that the prediction sample of the chroma block is derived by inputting a restoration sample corresponding to the position of the prediction sample in the luma block and at least one neighboring sample adjacent to the restoration sample into the convolution filter. 제1 항에 있어서,In the first paragraph, 상기 예측 파라미터의 타입은, 복수의 예측 파라미터 타입 후보들 중 하나로 결정되고, The type of the above prediction parameter is determined as one of multiple prediction parameter type candidates, 상기 복수의 예측 파라미터 타입 후보는, 가중치 및 오프셋을 포함하는 제1 예측 파라미터 후보 및 콘볼루션 필터의 필터 게수들을 포함하는 제2 예측 파라미터 후보를 포함하는 것을 특징으로 하는, 영상 복호화 방법.An image decoding method, characterized in that the plurality of prediction parameter type candidates include a first prediction parameter candidate including weights and offsets and a second prediction parameter candidate including filter coefficients of a convolution filter. 제1 항에 있어서,In the first paragraph, 상기 루마 블록에 화면 내 블록 카피 모드가 적용된 경우, 상기 제1 참조 블록은 상기 루마 블록이 포함된 현재 루마 픽처로부터 유도되고, 상기 제2 참조 블록은 상기 크로마 블록이 포함된 현재 크로마 픽처로부터 유도되는 것을 특징으로 하는, 영상 복호화 방법.A video decoding method, characterized in that when a screen block copy mode is applied to the luma block, the first reference block is derived from a current luma picture including the luma block, and the second reference block is derived from a current chroma picture including the chroma block. 제1 항에 있어서,In the first paragraph, 상기 크로마 블록 내 서브 블록 단위로 상기 예측 파라미터가 유도되는 것을 특징으로 하는, 영상 복호화 방법. An image decoding method, characterized in that the prediction parameters are derived in units of sub-blocks within the chroma block. 크로마 블록과 동일 위치인 루마 블록의 제1 참조 블록을 유도하는 단게;A step for deriving a first reference block of a luma block that is in the same position as the chroma block; 상기 크로마 블록의 제2 참조 블록을 유도하는 단계;A step of deriving a second reference block of the above chroma block; 상기 제1 참조 블록 및 상기 제2 참조 블록에 기초하여, 예측 파라미터를 유도하는 단계; 및A step of deriving prediction parameters based on the first reference block and the second reference block; and 상기 루마 블록에 상기 예측 파라미터를 적용하여, 상기 크로마 블록에 대한 예측 블록을 획득하는 단계를 포함하는, 영상 부호화 방법. A method for encoding an image, comprising the step of obtaining a prediction block for the chroma block by applying the prediction parameter to the luma block. 크로마 블록과 동일 위치인 루마 블록의 제1 참조 블록을 유도하는 단게;A step for deriving a first reference block of a luma block that is in the same position as the chroma block; 상기 크로마 블록의 제2 참조 블록을 유도하는 단계;A step of deriving a second reference block of the above chroma block; 상기 제1 참조 블록 및 상기 제2 참조 블록에 기초하여, 예측 파라미터를 유도하는 단계; 및A step of deriving prediction parameters based on the first reference block and the second reference block; and 상기 루마 블록에 상기 예측 파라미터를 적용하여, 상기 크로마 블록에 대한 예측 블록을 획득하는 단계를 포함하는, 영상 부호화 방법에 의해 생생된 비트스트림을 저장하는 기록 매체. A recording medium storing a bitstream generated by a video encoding method, comprising the step of obtaining a prediction block for the chroma block by applying the prediction parameter to the luma block.
PCT/KR2024/008916 2023-06-27 2024-06-26 Image encoding/decoding method and recording medium for storing bitstream WO2025005664A1 (en)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
KR20230083018 2023-06-27
KR10-2023-0083018 2023-06-27
KR1020240082641A KR20250000891A (en) 2023-06-27 2024-06-25 A method of encoding/decoding a video and recording medium storing bitstream
KR10-2024-0082641 2024-06-25

Publications (1)

Publication Number Publication Date
WO2025005664A1 true WO2025005664A1 (en) 2025-01-02

Family

ID=93939283

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/KR2024/008916 WO2025005664A1 (en) 2023-06-27 2024-06-26 Image encoding/decoding method and recording medium for storing bitstream

Country Status (1)

Country Link
WO (1) WO2025005664A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220038738A1 (en) * 2018-01-24 2022-02-03 Vid Scale, Inc. Generalized bi-prediction for video coding with reduced coding complexity
KR102398997B1 (en) * 2011-06-21 2022-05-17 한국전자통신연구원 Method for inter prediction and apparatus thereof
KR20230070198A (en) * 2017-06-09 2023-05-22 한국전자통신연구원 Method and apparatus for encoding/decoding image and recording medium for storing bitstream
KR20230093063A (en) * 2018-10-04 2023-06-26 엘지전자 주식회사 Cclm-based intra-prediction method and apparatus therefor

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102398997B1 (en) * 2011-06-21 2022-05-17 한국전자통신연구원 Method for inter prediction and apparatus thereof
KR20230070198A (en) * 2017-06-09 2023-05-22 한국전자통신연구원 Method and apparatus for encoding/decoding image and recording medium for storing bitstream
US20220038738A1 (en) * 2018-01-24 2022-02-03 Vid Scale, Inc. Generalized bi-prediction for video coding with reduced coding complexity
KR20230093063A (en) * 2018-10-04 2023-06-26 엘지전자 주식회사 Cclm-based intra-prediction method and apparatus therefor

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
P. ASTOLA (NOKIA), J. LAINEMA (NOKIA): "AHG12: Cross-component residual model (CCRM) for inter prediction", 30. JVET MEETING; 20230421 - 20230428; ANTALYA; (THE JOINT VIDEO EXPLORATION TEAM OF ISO/IEC JTC1/SC29/WG11 AND ITU-T SG.16 ), 21 April 2023 (2023-04-21), XP030308741 *

Similar Documents

Publication Publication Date Title
WO2020096389A1 (en) Image signal encoding/decoding method and apparatus therefor
WO2019190224A1 (en) Image encoding/decoding method and device, and recording medium in which bitstream is stored
WO2018097693A2 (en) Image encoding/decoding method and device, and recording medium having bitstream stored thereon
WO2020096388A1 (en) Method for encoding/decoding image signal, and apparatus therefor
WO2016137149A1 (en) Polygon unit-based image processing method, and device for same
WO2019083334A1 (en) Method and device for image encoding/decoding on basis of asymmetric sub-block
WO2018030773A1 (en) Method and apparatus for image encoding/decoding
WO2018012886A1 (en) Image encoding/decoding method and recording medium therefor
WO2018012851A1 (en) Image encoding/decoding method and recording medium therefor
WO2020060329A1 (en) Method for encoding/decoding image signal and apparatus therefor
WO2021015581A1 (en) Method, apparatus, and recording medium for encoding/decoding image by using geometric partitioning
WO2020184979A1 (en) Method for encoding/decoding image signal, and device therefor
WO2020096426A1 (en) Method for encoding/decoding image signal, and device for same
WO2023043223A1 (en) Video signal encoding/decoding method and recording medium having bitstream stored therein
WO2023043226A1 (en) Video signal encoding/decoding method, and recording medium having bitstream stored thereon
WO2020004978A1 (en) Method and apparatus for processing video signal
WO2017176092A1 (en) Method and device for inducing motion prediction information
WO2020159199A1 (en) Image signal encoding/decoding method and device therefor
WO2017171438A1 (en) Method and apparatus for encoding and decoding video using picture division information
WO2020141904A1 (en) Image signal encoding/decoding method and device for same
WO2022260374A1 (en) Video coding method and device using improved cross-component linear model prediction
WO2020130714A1 (en) Video signal encoding/decoding method, and device therefor
WO2020184920A1 (en) Image encoding/decoding method and apparatus, and recording medium for storing bitstream
WO2020226359A1 (en) Image encoding/decoding method and device, and recording medium storing bitstream
WO2020005046A1 (en) Image encoding/decoding method and apparatus

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 24832442

Country of ref document: EP

Kind code of ref document: A1